Fixes for getNPCNameFromAlias

feature/prepare-cross-merge
Nuno 4 years ago committed by kaetemi
parent 5761a4a638
commit c0129de5ed
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -4186,6 +4186,8 @@ protected:
if (NPCOwner == CAIAliasTranslator::Invalid) if (NPCOwner == CAIAliasTranslator::Invalid)
{ {
CAIAliasTranslator::getInstance()->getNPCNameFromAlias(instance->getGiver(), sDebugBotName); CAIAliasTranslator::getInstance()->getNPCNameFromAlias(instance->getGiver(), sDebugBotName);
if (sDebugBotName.find('$') != string::npos)
sDebugBotName = sDebugBotName.substr(0, sDebugBotName.find('$'));
nlassert(instance); nlassert(instance);
CMissionEventAddMission * event = new CMissionEventAddMission( instance->getGiver(), Mission, mainMission, Guild ); CMissionEventAddMission * event = new CMissionEventAddMission( instance->getGiver(), Mission, mainMission, Guild );
eventList.push_back( event ); eventList.push_back( event );
@ -4193,6 +4195,8 @@ protected:
else else
{ {
CAIAliasTranslator::getInstance()->getNPCNameFromAlias(NPCOwner, sDebugBotName); CAIAliasTranslator::getInstance()->getNPCNameFromAlias(NPCOwner, sDebugBotName);
if (sDebugBotName.find('$') != string::npos)
sDebugBotName = sDebugBotName.substr(0, sDebugBotName.find('$'));
CMissionEventAddMission * event = new CMissionEventAddMission( NPCOwner, Mission, mainMission, Guild ); CMissionEventAddMission * event = new CMissionEventAddMission( NPCOwner, Mission, mainMission, Guild );
eventList.push_back( event ); eventList.push_back( event );
} }

@ -625,6 +625,9 @@ class CMissionStepKillNpc : public IMissionStepTemplate
string name; string name;
CAIAliasTranslator::getInstance()->getNPCNameFromAlias(c->getAlias(), name); CAIAliasTranslator::getInstance()->getNPCNameFromAlias(c->getAlias(), name);
if (name.find('$') != string::npos)
name = name.substr(0, name.find('$'));
nlinfo("NEED: %s GET : %s", name.c_str(), params[1].c_str());
if ( NLMISC::strlwr(name) == NLMISC::strlwr(params[1]) ) if ( NLMISC::strlwr(name) == NLMISC::strlwr(params[1]) )
{ {
user->validateDynamicMissionStep(webAppUrl); user->validateDynamicMissionStep(webAppUrl);

@ -7657,10 +7657,21 @@ void CCharacter::sendAnimalCommand(uint8 petIndexCode, uint8 command)
CPetCommandMsg::TCommand petCommand; CPetCommandMsg::TCommand petCommand;
const CStaticItem* form = CSheets::getForm(_PlayerPets[petIndex].TicketPetSheetId);
switch ((ANIMALS_ORDERS::EBeastOrder)command) switch ((ANIMALS_ORDERS::EBeastOrder)command)
{ {
case ANIMALS_ORDERS::ENTER_BAG: case ANIMALS_ORDERS::ENTER_BAG:
if (!form || form->Type != ITEM_TYPE::ANIMAL_TICKET) {
if (!form)
nlinfo("Not form");
else
nlinfo("Not Anima but %s", ITEM_TYPE::toString(form->Type).c_str());
continue;
}
_PlayerPets[petIndex].PetStatus = CPetAnimal::in_bag; _PlayerPets[petIndex].PetStatus = CPetAnimal::in_bag;
if (_PlayerPets[petIndex].IsInBag) if (_PlayerPets[petIndex].IsInBag)
continue; continue;
@ -15095,15 +15106,21 @@ string CCharacter::getTargetInfos()
} }
else else
{ {
string name;
CCreature * cTarget = CreatureManager.getCreature(target); CCreature * cTarget = CreatureManager.getCreature(target);
if (cTarget) if (cTarget)
{ {
string name;
string title;
sint32 petSlot = getPlayerPet(cTarget->getEntityRowId()); sint32 petSlot = getPlayerPet(cTarget->getEntityRowId());
if (petSlot == -1) if (petSlot == -1)
{ {
CAIAliasTranslator::getInstance()->getNPCNameFromAlias(CAIAliasTranslator::getInstance()->getAIAlias(target), name); CAIAliasTranslator::getInstance()->getNPCNameFromAlias(CAIAliasTranslator::getInstance()->getAIAlias(target), name);
if (name.find('$') != string::npos)
{
title = name.substr(name.find('$')+1);
name = name.substr(0, name.find('$'));
}
msg += name+"|"; msg += name+"|";
} }
else else
@ -15123,7 +15140,7 @@ string CCharacter::getTargetInfos()
CMirrorPropValueRO<TYPE_CELL> srcCell(TheDataset, dsr, DSPropertyCELL); CMirrorPropValueRO<TYPE_CELL> srcCell(TheDataset, dsr, DSPropertyCELL);
sint32 cell = srcCell; sint32 cell = srcCell;
msg += toString("%.2f|%.2f|%.2f|%.2f|%.4f|%d|", dist, x, y, z, h, cell)+cTarget->getType().toString()+"|"+EGSPD::CPeople::toString(cTarget->getRace())+"|"+toString("%d", cTarget->getGender()); msg += toString("%.2f|%.2f|%.2f|%.2f|%.4f|%d|", dist, x, y, z, h, cell)+cTarget->getType().toString()+"|"+EGSPD::CPeople::toString(cTarget->getRace())+"|"+toString("%d", cTarget->getGender())+"|"+title;
} }
} }
@ -15814,10 +15831,10 @@ void CCharacter::sendUrl(const string &url)
string control; string control;
string salt = toString(getLastConnectedDate())+ArkSalt.get(); string salt = toString(getLastConnectedDate())+ArkSalt.get();
string playerPos = getPositionInfos(); string playerPos = getPositionInfos();
strFindReplace(playerPos, " ", "%20"); while(strFindReplace(playerPos, " ", "%20"));
string targetInfos = getTargetInfos(); string targetInfos = getTargetInfos();
string serverInfos = getServerInfos(getState().X / 1000., getState().Y / 1000.); string serverInfos = getServerInfos(getState().X / 1000., getState().Y / 1000.);
strFindReplace(targetInfos, " ", "%20"); while(strFindReplace(targetInfos, " ", "%20"));
string final_url; string final_url;
if (url.find("$(") != string::npos ) if (url.find("$(") != string::npos )
@ -15835,6 +15852,9 @@ void CCharacter::sendUrl(const string &url)
final_url = url + toString("&urlidx=%d", getUrlIndex())+"&player_pos="+playerPos+"&target_infos="+targetInfos+"&server_infos="+serverInfos; final_url = url + toString("&urlidx=%d", getUrlIndex())+"&player_pos="+playerPos+"&target_infos="+targetInfos+"&server_infos="+serverInfos;
} }
while(strFindReplace(final_url, "#", "%23"));
while(strFindReplace(final_url, "$", "%24"));
control = "&hmac="+ getHMacSHA1((uint8*)&final_url[0], (uint32)final_url.size(), (uint8*)&salt[0], (uint32)salt.size()).toString(); control = "&hmac="+ getHMacSHA1((uint8*)&final_url[0], (uint32)final_url.size(), (uint8*)&salt[0], (uint32)salt.size()).toString();
uint32 userId = PlayerManager.getPlayerId(getId()); uint32 userId = PlayerManager.getPlayerId(getId());
@ -21148,9 +21168,6 @@ uint32 CPetAnimal::getAnimalMaxBulk()
if (formBag) if (formBag)
{ {
// zig inventories have bulk proportionnal to size (size is 1->250)
if (creatureBagSheet == CSheetId("zig_inventory.sitem") && Size > 0)
return max((uint32)10, (uint32)ceil((formBag->BulkMax*Size)/100));
return formBag->BulkMax; return formBag->BulkMax;
} }
} }

Loading…
Cancel
Save