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

@ -151,7 +151,7 @@ void logMissionActionLaunch(uint32 line, CMission *m, const string &ActionNameAn
{
if (!VerboseMissions) return;
string sTmp = "sline:" + toString(line) + " ";
std::vector<TDataSetRow> entities;
m->getEntities( entities );
for ( uint i = 0; i < entities.size(); i++)
@ -159,15 +159,15 @@ void logMissionActionLaunch(uint32 line, CMission *m, const string &ActionNameAn
CCharacter *pChar = PlayerManager.getChar(entities[i]);
sTmp += "user:" + pChar->getId().toString() + " ";
}
TAIAlias alias = m->getTemplateId();
sTmp += "miss:" + CPrimitivesParser::aliasToString(alias);
CMissionTemplate *templ = CMissionManager::getInstance()->getTemplate( alias );
if (templ != NULL)
sTmp += ",'" + templ->getMissionName() + "' ";
sTmp += "EXEC " + ActionNameAndParams;
MISDBG("%s", sTmp.c_str());
}
#define LOGMISSIONACTION(xxxx) logMissionActionLaunch(_SourceLine, instance, xxxx)
@ -255,7 +255,7 @@ static bool evaluateSDBExpr(const std::string &sdbExpr, double &res, bool ignore
}
if (i == sdbExpr.size() || varName.empty())
return false;
if (!CStatDB::getInstance()->valueGet(varName, varValue))
{
if (!ignoreUnknownVar)
@ -301,7 +301,7 @@ protected:
{
return CMissionParser::solveTextsParams( _SourceLine, _Params, missionData );
}
string _Text;
TVectorParamCheck _Params;
};
@ -355,7 +355,7 @@ class CMissionActionBotChat :public CMissionActionText
// get speaking bot
if ( !CMissionParser::parseBotName(script[2],_Bot,missionData) )
return false;
return CMissionParser::parseParamText(line, script[3], _Text, _Params );
}
@ -378,7 +378,7 @@ class CMissionActionBotChat :public CMissionActionText
std::vector<TDataSetRow> entities;
instance->getEntities( entities );
TVectorParamCheck params = _Params;
CMissionParser::solveBotNames(params,CAIAliasTranslator::getInstance()->getEntityId(instance->getGiver()));
// 2 different loop : avoid multi test on chat type
@ -401,7 +401,7 @@ class CMissionActionBotChat :public CMissionActionText
}
}
};
TAIAlias _Bot;
CChatGroup::TGroupType _ChatMode;
@ -444,7 +444,7 @@ protected:
}
return true;
}
void launch(CMission* instance, std::list< CMissionEvent * > & eventList)
{
LOGMISSIONACTION("popup_msg");
@ -514,16 +514,16 @@ class CMissionActionSetDesc : public IMissionAction
return false;
return true;
}
void launch(CMission* instance, std::list< CMissionEvent * > & eventList)
{
LOGMISSIONACTION("set_desc");
instance->overrideDesc( _DescIndex );
};
// index of this description in the template
uint32 _DescIndex;
MISSION_ACTION_GETNEWPTR(CMissionActionSetDesc)
};
MISSION_REGISTER_ACTION(CMissionActionSetDesc,"set_desc");
@ -574,7 +574,7 @@ class CMissionActionRecvItem : public IMissionAction
ret = false;
}
missionData.ChatParams.push_back( make_pair( args[0], STRING_MANAGER::item ) );
_Quality = 1;
if ( args.size() == 3 )
{
@ -606,7 +606,7 @@ class CMissionActionRecvItem : public IMissionAction
}
}
if ( _Quantity == 0 )
{
MISLOGERROR("quantity = 0");
@ -940,12 +940,12 @@ class CMissionActionRecvNamedItem : public IMissionAction
MISLOGERROR("bad named item format");
return false;
}
// read quantity
_Quantity = 1;
if ( args.size() >= 2)
NLMISC::fromString(args[1], _Quantity);
// read group
_Group = false;
if ( script.size() == 3 )
@ -1179,12 +1179,12 @@ public:
vector<string> args;
CMissionParser::tokenizeString( script[1]," \t",args );
// read the quantity, or 1 by default
_Quantity = 1;
if ( args.size() >= 2)
NLMISC::fromString(args[1], _Quantity);
// If the name of the item macthes one of the special defined mission items for this mission
uint i = 0;
for (; i < missionData.Items.size(); i++ )
@ -1201,7 +1201,7 @@ public:
break;
}
}
// If no special mission item found, get a sheetid/quality
if ( i == missionData.Items.size() )
{
@ -1214,7 +1214,7 @@ public:
ret = false;
}
missionData.ChatParams.push_back( make_pair( args[0], STRING_MANAGER::item ) );
// read the minimum quality to destroy (1 if not specified)
_Quality = 1;
if ( args.size() == 3 )
@ -1227,7 +1227,7 @@ public:
}
}
}
// Bad quantity?
if ( _Quantity == 0 )
{
@ -1243,10 +1243,10 @@ public:
uint16 _Quality;
uint16 _Quantity;
};
/// we destroy the item of the user in its inventory
// -----------------------------------------------------------------------------
class CMissionActionDestroyItem :
class CMissionActionDestroyItem :
public IMissionAction,
private CMissionBaseItemSelector
{
@ -1382,7 +1382,7 @@ MISSION_REGISTER_ACTION(CMissionActionDestroyItem,"destroy_item");
/// We test if the user has the requested item in its inventory
// ----------------------------------------------------------------------------
class CMissionActionCondJumpIfItemInInv :
class CMissionActionCondJumpIfItemInInv :
public CMissionActionJump,
private CMissionBaseItemSelector
{
@ -1395,10 +1395,10 @@ public:
MISLOGSYNTAXERROR("<item> [<quantity>] [<quality>]:<label>");
return false;
}
// Build the item filter
bool ret= CMissionBaseItemSelector::buildItemFilter(line, script, missionData);
Label = CMissionParser::getNoBlankString(script[2]);
missionData.Jumps.push_back( Label );
return ret;
@ -1407,7 +1407,7 @@ public:
void launch(CMission* instance, std::list< CMissionEvent * > & eventList)
{
LOGMISSIONACTION("if_item_in_inv");
// For all entities affected by the mission
std::vector<TDataSetRow> entities;
instance->getEntities(entities);
@ -1425,7 +1425,7 @@ public:
quantityDetected+= user->selectItems(INVENTORIES::bag, _SheetId, _Quality);
for(uint pa=0;pa<INVENTORIES::max_pet_animal;pa++)
quantityDetected+= user->selectItems(INVENTORIES::TInventory(INVENTORIES::pet_animal + pa), _SheetId, _Quality);
// if not enough requested items, fail!
if(quantityDetected<_Quantity)
return;
@ -1435,7 +1435,7 @@ public:
// ok all palyer have the request in their bag!
CMissionActionJump::launch( instance, eventList );
}
MISSION_ACTION_GETNEWPTR(CMissionActionCondJumpIfItemInInv)
};
MISSION_REGISTER_ACTION(CMissionActionCondJumpIfItemInInv,"if_item_in_inv");
@ -1558,16 +1558,16 @@ class CMissionActionLearnAction : public IMissionAction
if (_Npc == CAIAliasTranslator::Invalid)
{
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_RECV_ACTION_%u", _ActionSheets.size()),
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_RECV_ACTION_%u", _ActionSheets.size()),
params);
}
else
{
STRING_MANAGER::TParam p(STRING_MANAGER::bot, _Npc);
params.push_back(p);
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_RECV_ACTION_NPC_%u", _ActionSheets.size()),
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_RECV_ACTION_NPC_%u", _ActionSheets.size()),
params);
}
}
@ -1702,16 +1702,16 @@ class CMissionActionLearnBrick : public IMissionAction
if (_Npc == CAIAliasTranslator::Invalid)
{
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_RECV_BRICK_%u", _BrickSheets.size()),
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_RECV_BRICK_%u", _BrickSheets.size()),
params);
}
else
{
STRING_MANAGER::TParam p(STRING_MANAGER::bot, _Npc);
params.push_back(p);
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_RECV_BRICK_NPC_%u", _BrickSheets.size()),
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_RECV_BRICK_NPC_%u", _BrickSheets.size()),
params);
}
}
@ -1846,16 +1846,16 @@ class CMissionActionUnlearnBrick : public IMissionAction
if (_Npc == CAIAliasTranslator::Invalid)
{
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_REMV_BRICK_%u", _BrickSheets.size()),
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_REMV_BRICK_%u", _BrickSheets.size()),
params);
}
else
{
STRING_MANAGER::TParam p(STRING_MANAGER::bot, _Npc);
params.push_back(p);
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_REMV_BRICK_NPC_%u", _BrickSheets.size()),
PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),
toString("MIS_REMV_BRICK_NPC_%u", _BrickSheets.size()),
params);
}
}
@ -1882,7 +1882,7 @@ class CMissionActionRecvMoney : public IMissionAction
MISLOGSYNTAXERROR("<money> [: guild] OR <item><quality><factor> *[;<item><quality><factor>]");
return false;
}
_Amount = 0;
vector<string> multiArgs;
CMissionParser::tokenizeString( script[1],";",multiArgs );
@ -2037,7 +2037,7 @@ class CMissionActionRecvFame : public IMissionAction
}
return true;
}
void launch(CMission* instance, std::list< CMissionEvent * > & eventList)
{
@ -2146,7 +2146,7 @@ class CMissionActionRecvXp : public IMissionAction
std::vector<TDataSetRow> entities;
instance->getEntities(entities);
// distribute XP among all entities
for (uint32 i = 0; i < entities.size(); i++)
{
@ -2272,7 +2272,7 @@ class CMissionActionEmote : public IMissionAction
// get speaking bot
if ( !CMissionParser::parseBotName(vars[0],_Bot,missionData) )
ret = false;
uint32 emoteId = 0;
string sEmote = CMissionParser::getNoBlankString(vars[1]);
if ( !CMissionManager::getInstance()->getEmoteId(sEmote, emoteId) )
@ -2324,7 +2324,7 @@ class CMissionActionEmote : public IMissionAction
double dx = (double) ( user->getState().X - bot->getState().X );
double dy = (double) ( user->getState().Y - bot->getState().Y );
// send the heading to AI
CSetBotHeadingMsg msg;
msg.BotRowId = bot->getEntityRowId();
@ -2378,7 +2378,7 @@ IMissionAction* CMissionActionJump::getNewPtr()
{
CMissionActionJump * ptr = new CMissionActionJump;
*ptr = *this;
return ptr;
return ptr;
}
MISSION_REGISTER_ACTION(CMissionActionJump,"jump");
@ -2643,7 +2643,7 @@ class CMissionActionEnd : public IMissionAction
MISLOGSYNTAXERROR("no param expected");
return false;
}
return true;
}
void launch(CMission* instance, std::list< CMissionEvent * > & eventList)
@ -2792,7 +2792,7 @@ class CMissionActionFailMissionCat : public IMissionAction
}
// and the main mission template category
if (!bFailed) // do not fail a mission twice
if (!bFailed) // do not fail a mission twice
{
pMissTemplate = pMM->getTemplate(pMiss->getMainMissionTemplateId());
if (pMissTemplate != NULL)
@ -2860,7 +2860,7 @@ class CMissionActionCompassNpc : public IMissionAction
sint32 y;
string textName;
c->getPositionCheck(toUpper(templ->getMissionName()), x, y, textName);
SM_STATIC_PARAMS_1(textParams, STRING_MANAGER::literal);
textParams[0].Literal.fromUtf8(textName);
uint32 txtId = STRING_MANAGER::sendStringToClient( c->getEntityRowId(), "LITERAL", textParams );
@ -2955,7 +2955,7 @@ class CMissionActionRemoveCompassNpc : public IMissionAction
alias = instance->getGiver();
else
alias = Alias;
instance->removeCompassBot(alias);
}
TAIAlias Alias;
@ -3020,7 +3020,7 @@ class CMissionActionAIEvent : public IMissionAction
MISLOGSYNTAXERROR("<group>;<event number>*[;<param>]");
return false;
}
string sGroup = CMissionParser::getNoBlankString(args[0]);
CAIAliasTranslator::getInstance()->getGroupAliasesFromName(sGroup, Groups);
if ( Groups.empty() )
@ -3060,7 +3060,7 @@ class CMissionActionAIEvent : public IMissionAction
{
const CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( instance->getTemplateId() );
nlassert(templ);
LOGMISSIONACTION("ai_event : can't send event '" + toString(EventId) + "' from mission '" +
LOGMISSIONACTION("ai_event : can't send event '" + toString(EventId) + "' from mission '" +
templ->getMissionName() + "' : mission giver invalid, can't retrieve AI instance");
}
}
@ -3112,7 +3112,7 @@ class CMissionActionDayPeriod : public IMissionAction
MISLOGSYNTAXERROR("<hour> <min>; <hour> <min>");
return false;
}
vector<string> args;
splitString(script[1],";",args);
if ( args.size() != 2)
@ -3120,7 +3120,7 @@ class CMissionActionDayPeriod : public IMissionAction
MISLOGSYNTAXERROR("<hour> <min>; <hour> <min>");
return false;
}
vector<string> params;
CMissionParser::tokenizeString(args[0]," \t",params);
if ( params.size() != 2 )
@ -3210,13 +3210,13 @@ class CMissionActionSeason : public IMissionAction
}
return true;
}
void launch(CMission* instance, std::list< CMissionEvent * > & eventList)
{
LOGMISSIONACTION("season");
instance->setSeason(Season);
}
EGSPD::CSeason::TSeason Season;
MISSION_ACTION_GETNEWPTR(CMissionActionSeason)
@ -3239,7 +3239,7 @@ public:
}
return true;
}
void launch(CMission* instance, std::list< CMissionEvent * > & eventList)
{
LOGMISSIONACTION("reward");
@ -3285,11 +3285,11 @@ public:
bool ret = true;
vector<string> args;
CMissionParser::tokenizeString( script[1]," \t",args );
uint16 quantity = 1;
if ( args.size() >= 2)
NLMISC::fromString(args[1], quantity);
for (uint i = 0; i < items.size(); i++ )
{
if ( !nlstricmp( items[i].first , args[0] ) )
@ -3303,14 +3303,14 @@ public:
return true;
}
}
CSheetId sheet = CSheetId( CMissionParser::getNoBlankString(args[0]) + ".sitem" );
if ( sheet == CSheetId::Unknown )
{
MISLOG("sline:%u syntax error sheetId '%s' is unknon", line, (CMissionParser::getNoBlankString(args[0]) + ".sitem").c_str() ) ;
ret = false;
}
uint16 quality = 1;
if ( args.size() == 3 )
{
@ -3355,7 +3355,7 @@ public:
vector<CSheetId> Phrases;
vector< pair<CMissionItem,uint16> > MissionItems;
vector<CItemDesc> StdItems;
MISSION_ACTION_GETNEWPTR(CMissionActionRewardGroup)
};
@ -3468,7 +3468,7 @@ protected:
LOGMISSIONACTION("teleport : invalid tp index " + toString(DestinationIdx) + "TP is NULL");
return;
}
sint32 x,y,z;
float heading;
for ( uint i = 0; i < entities.size(); i++ )
@ -3522,7 +3522,7 @@ protected:
LOGMISSIONACTION("teleport_x_y");
vector<TDataSetRow> entities;
instance->getEntities( entities );
for ( uint i = 0; i < entities.size(); i++ )
{
CCharacter * user = PlayerManager.getChar( entities[i] );
@ -3805,7 +3805,7 @@ class CMissionActionGiveOutpostControl : public IMissionAction
{
if (guild->getOwnedCharge()->getOutpost() != op)
{
nlwarning("GiveOutpostControl : the guild '%s' is associated to outpost '%s', NOT to '%s'",
nlwarning("GiveOutpostControl : the guild '%s' is associated to outpost '%s', NOT to '%s'",
guild->getGuildName().toString().c_str(),
guild->getOwnedCharge()->getOutpost()->getName().c_str(),
_OutpostName.c_str());
@ -4112,7 +4112,7 @@ class CMissionActionCancelOutside: public IMissionAction
CMissionManager::getInstance()->cleanPlaceConstraint( instance, Place );
}
uint16 Place;
MISSION_ACTION_GETNEWPTR(CMissionActionCancelOutside)
};
MISSION_REGISTER_ACTION(CMissionActionCancelOutside,"cancel_outside");
@ -4122,7 +4122,7 @@ class CMissionActionSpawnMission: public IMissionAction
{
protected:
TAIAlias Mission;
TAIAlias Mission;
TAIAlias NPCOwner; // NPC giver the mission have to be attached at spawn time
bool Guild;
@ -4143,7 +4143,7 @@ protected:
MISLOGERROR1("invalid mission '%s'", name.c_str());
return false;
}
// Get the owner of the mission that will be spawn
name = CMissionParser::getNoBlankString( script[2] );
@ -4161,7 +4161,7 @@ protected:
MISLOG("sline:%u WARNING %s : name '%s' give multiple aliases", line, script[0].c_str(), name.c_str());
}
}
NPCOwner = CAIAliasTranslator::Invalid;
if (vRet.size() > 0)
NPCOwner = vRet[0];
@ -4186,6 +4186,8 @@ protected:
if (NPCOwner == CAIAliasTranslator::Invalid)
{
CAIAliasTranslator::getInstance()->getNPCNameFromAlias(instance->getGiver(), sDebugBotName);
if (sDebugBotName.find('$') != string::npos)
sDebugBotName = sDebugBotName.substr(0, sDebugBotName.find('$'));
nlassert(instance);
CMissionEventAddMission * event = new CMissionEventAddMission( instance->getGiver(), Mission, mainMission, Guild );
eventList.push_back( event );
@ -4193,6 +4195,8 @@ protected:
else
{
CAIAliasTranslator::getInstance()->getNPCNameFromAlias(NPCOwner, sDebugBotName);
if (sDebugBotName.find('$') != string::npos)
sDebugBotName = sDebugBotName.substr(0, sDebugBotName.find('$'));
CMissionEventAddMission * event = new CMissionEventAddMission( NPCOwner, Mission, mainMission, Guild );
eventList.push_back( event );
}
@ -4251,9 +4255,9 @@ class CMissionActionEncycloUnlock : public IMissionAction
{
uint32 AlbumNb;
uint32 ThemaNb;
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
CMissionSpecificParsingData & missionData )
{
_SourceLine = line;
@ -4270,7 +4274,7 @@ class CMissionActionEncycloUnlock : public IMissionAction
MISLOGSYNTAXERROR("<album> <thema>");
return false;
}
NLMISC::fromString(vars[0], AlbumNb);
NLMISC::fromString(vars[1], ThemaNb);
@ -4304,8 +4308,8 @@ MISSION_REGISTER_ACTION(CMissionActionEncycloUnlock,"encyclo_unlock");
class CMissionActionGameEventSubscribe : public IMissionAction
{
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
CMissionSpecificParsingData & missionData )
{
_SourceLine = line;
@ -4318,7 +4322,7 @@ class CMissionActionGameEventSubscribe : public IMissionAction
LOGMISSIONACTION("game_event_subscribe");
vector<TDataSetRow> entities;
instance->getEntities(entities);
for (uint32 i = 0; i < entities.size(); ++i)
{
CCharacter *pChar = PlayerManager.getChar(entities[i]);
@ -4339,8 +4343,8 @@ MISSION_REGISTER_ACTION(CMissionActionGameEventSubscribe,"game_event_subscribe")
class CMissionActionGameEventReset : public IMissionAction
{
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
CMissionSpecificParsingData & missionData )
{
_SourceLine = line;
@ -4353,7 +4357,7 @@ class CMissionActionGameEventReset : public IMissionAction
LOGMISSIONACTION("game_event_reset");
vector<TDataSetRow> entities;
instance->getEntities(entities);
for (uint32 i = 0; i < entities.size(); ++i)
{
CCharacter *pChar = PlayerManager.getChar(entities[i]);
@ -4375,8 +4379,8 @@ class CMissionActionSetEventFaction : public IMissionAction
{
string EventFaction;
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
CMissionSpecificParsingData & missionData )
{
_SourceLine = line;
@ -4418,8 +4422,8 @@ class CMissionActionSetRespawnPoints : public IMissionAction
vector<uint16> _RespawnPoints;
bool _HideOthers;
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
CMissionSpecificParsingData & missionData )
{
_SourceLine = line;
@ -4493,7 +4497,7 @@ class CMissionActionSetRespawnPoints : public IMissionAction
LOGMISSIONACTION("set_respawn_points");
vector<TDataSetRow> entities;
instance->getEntities(entities);
for (uint32 i = 0; i < entities.size(); ++i)
{
CCharacter *pChar = PlayerManager.getChar(entities[i]);
@ -4517,8 +4521,8 @@ class CMissionActionSDBSet : public IMissionAction
string _SDBPath;
sint32 _SDBValue;
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
CMissionSpecificParsingData & missionData )
{
_SourceLine = line;
@ -4555,8 +4559,8 @@ class CMissionActionSDBAdd : public IMissionAction
string _SDBPath;
sint32 _SDBDelta;
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
CMissionSpecificParsingData & missionData )
{
_SourceLine = line;
@ -4593,8 +4597,8 @@ class CMissionActionSDBPlayerAdd : public IMissionAction
string _SDBPath;
sint32 _SDBDelta;
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
CMissionSpecificParsingData & missionData )
{
_SourceLine = line;
@ -4617,7 +4621,7 @@ class CMissionActionSDBPlayerAdd : public IMissionAction
LOGMISSIONACTION("sdb_player_add");
vector<TDataSetRow> entities;
instance->getEntities(entities);
for (uint32 i = 0; i < entities.size(); ++i)
{
CCharacter *pChar = PlayerManager.getChar(entities[i]);
@ -4993,7 +4997,7 @@ class CMissionActionCondJumpGuildCiv : public CMissionActionJump
};
MISSION_REGISTER_ACTION(CMissionActionCondJumpGuildCiv,"if_guild_civ");
// ----------------------------------------------------------------------------
class CMissionActionCondJumpGuildFame : public CMissionActionJump
{
@ -5073,7 +5077,7 @@ public:
MISLOGSYNTAXERROR("<label>");
return false;
}
Label = CMissionParser::getNoBlankString(script[1]);
missionData.Jumps.push_back( Label );
return true;
@ -5086,7 +5090,7 @@ public:
instance->getEntities( entities );
if ( entities.empty() )
return;
// If player have a trial account, do not jump
for (uint i = 0 ; i < entities.size(); ++i)
{
@ -5106,7 +5110,7 @@ public:
}
CMissionActionJump::launch( instance, eventList );
}
MISSION_ACTION_GETNEWPTR(CMissionActionCondJumpNoTrial)
};
MISSION_REGISTER_ACTION(CMissionActionCondJumpNoTrial,"if_no_trial");
@ -5223,8 +5227,8 @@ class CMissionActionSDBSetPVPPath : public IMissionAction
{
string _SDBPath;
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
CMissionSpecificParsingData & missionData )
{
_SourceLine = line;
@ -5245,7 +5249,7 @@ class CMissionActionSDBSetPVPPath : public IMissionAction
LOGMISSIONACTION("sdb_set_pvp_path");
vector<TDataSetRow> entities;
instance->getEntities(entities);
for (uint32 i = 0; i < entities.size(); ++i)
{
CCharacter *pChar = PlayerManager.getChar(entities[i]);
@ -5266,8 +5270,8 @@ MISSION_REGISTER_ACTION(CMissionActionSDBSetPVPPath,"sdb_set_pvp_path");
// ----------------------------------------------------------------------------
class CMissionActionSDBClearPVPPath : public IMissionAction
{
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
CMissionSpecificParsingData & missionData )
{
_SourceLine = line;
@ -5285,7 +5289,7 @@ class CMissionActionSDBClearPVPPath : public IMissionAction
LOGMISSIONACTION("sdb_clear_pvp_path");
vector<TDataSetRow> entities;
instance->getEntities(entities);
for (uint32 i = 0; i < entities.size(); ++i)
{
CCharacter *pChar = PlayerManager.getChar(entities[i]);
@ -5367,7 +5371,7 @@ class CMissionActionCondJumpFactionPoint : public CMissionActionJump
CMissionActionJump::launch( instance, eventList );
}
}
bool evaluateFPExpr(double & res, CCharacter * c)
{
string numExpr;
@ -5386,7 +5390,7 @@ class CMissionActionCondJumpFactionPoint : public CMissionActionJump
}
if (i == _FPExpr.size() || factionName.empty())
return false;
PVP_CLAN::TPVPClan clan = PVP_CLAN::fromString(factionName);
if (clan < PVP_CLAN::BeginClans || clan > PVP_CLAN::EndClans)
return false;
@ -5420,9 +5424,9 @@ MISSION_REGISTER_ACTION(CMissionActionCondJumpFactionPoint,"if_faction_point");
class CMissionActionHandleRelease : public IMissionAction
{
TAIAlias GroupAlias;
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
bool buildAction ( uint32 line, const std::vector< std::string > & script,
CMissionGlobalParsingData & globalData,
CMissionSpecificParsingData & missionData )
{
_SourceLine = line;
@ -5442,14 +5446,14 @@ class CMissionActionHandleRelease : public IMissionAction
GroupAlias = aliases[0];
return true;
}
void launch(CMission* instance, std::list< CMissionEvent * > & eventList)
{
LOGMISSIONACTION("handle_release");
vector<TDataSetRow> entities;
instance->getEntities(entities);
for (uint32 i = 0; i < entities.size(); ++i)
{
CCharacter *pChar = PlayerManager.getChar(entities[i]);
@ -5461,7 +5465,7 @@ class CMissionActionHandleRelease : public IMissionAction
pChar->delHandledAIGroup(instance, GroupAlias);
}
}
MISSION_ACTION_GETNEWPTR(CMissionActionHandleRelease)
};
MISSION_REGISTER_ACTION(CMissionActionHandleRelease, "handle_release");

@ -625,6 +625,9 @@ class CMissionStepKillNpc : public IMissionStepTemplate
string 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]) )
{
user->validateDynamicMissionStep(webAppUrl);

@ -7657,10 +7657,21 @@ void CCharacter::sendAnimalCommand(uint8 petIndexCode, uint8 command)
CPetCommandMsg::TCommand petCommand;
const CStaticItem* form = CSheets::getForm(_PlayerPets[petIndex].TicketPetSheetId);
switch ((ANIMALS_ORDERS::EBeastOrder)command)
{
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;
if (_PlayerPets[petIndex].IsInBag)
continue;
@ -15095,15 +15106,21 @@ string CCharacter::getTargetInfos()
}
else
{
string name;
CCreature * cTarget = CreatureManager.getCreature(target);
if (cTarget)
{
string name;
string title;
sint32 petSlot = getPlayerPet(cTarget->getEntityRowId());
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+"|";
}
else
@ -15123,7 +15140,7 @@ string CCharacter::getTargetInfos()
CMirrorPropValueRO<TYPE_CELL> srcCell(TheDataset, dsr, DSPropertyCELL);
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 salt = toString(getLastConnectedDate())+ArkSalt.get();
string playerPos = getPositionInfos();
strFindReplace(playerPos, " ", "%20");
while(strFindReplace(playerPos, " ", "%20"));
string targetInfos = getTargetInfos();
string serverInfos = getServerInfos(getState().X / 1000., getState().Y / 1000.);
strFindReplace(targetInfos, " ", "%20");
while(strFindReplace(targetInfos, " ", "%20"));
string final_url;
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;
}
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();
uint32 userId = PlayerManager.getPlayerId(getId());
@ -21148,9 +21168,6 @@ uint32 CPetAnimal::getAnimalMaxBulk()
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;
}
}

Loading…
Cancel
Save