#include "Agent.h" #include "Instance.h" #include "Player.h" #include "Main.h" /* Guidelines All packets sent from within this file must be terminated with a call to FinishAgentAction() this ensures that the action is added to the action queue. Note: The packet is only added to the action queue if the networkId != 0 */ MiniCompPck Agent::AAAgentMsg(unsigned long statId, unsigned long newValue, short exclusionId, long expiresIn, unsigned short networkId) { CompiledPacket pck; pck.AddShort(ServerOpcode(30)); //Add the stat id we are updating pck.AddLong(statId); //Add the agent id pck.AddLong(mAgentId); //Add the new values pck.AddLong(newValue); FinishAgentAction(exclusionId, expiresIn, 0); } MiniCompPck Agent::AASetMorale(unsigned short networkId) { CompiledPacket pck; if (USES_BATTLE_DATA) { BattleData *bd=(BattleData*)mpData; pck.AddShort(ServerOpcode(31)); //Add agent id pck.AddLong(mAgentId); //Add morale level pck.AddLong(bd->currentMorale); } FinishAgentAction(0, 1, 0); } MiniCompPck Agent::AASetPublicProfession(unsigned short networkId) { CompiledPacket pck; if (USES_BATTLE_DATA) { BattleData *bd=(BattleData*)mpData; pck.AddShort(ServerOpcode(34)); pck.AddLong(mAgentId); pck.AddByte(bd->professions[0]); pck.AddByte(bd->professions[1]); } FinishAgentAction(0, 1, 0); } MiniCompPck Agent::AASetVitalStatus(unsigned short networkId) { CompiledPacket pck; if (USES_BATTLE_DATA) { BattleData *bd=(BattleData*)mpData; pck.AddShort(ServerOpcode(35)); pck.AddLong(mAgentId); pck.AddLong(bd->vitalStatus.to_ulong()); } FinishAgentAction(AGENT_ACTION_VITAL_STATUS, 1, 0); } MiniCompPck Agent::AAAgentItem(unsigned long eIsa, void* pItem2, unsigned short networkId) { Item *item=(Item*)pItem2; CompiledPacket pck; GWITEM *g=item->GetRawItemData(); pck.AddShort(ServerOpcode(48)); pck.AddLong(eIsa); pck.AddShort(g->gwId); pck.AddShort(0); pck.AddByte(g->upgradeComponent); pck.Add(g->color, 3, false); pck.AddByte(g->unknownBlock1); pck.AddByte(g->unknownBlock2); pck.AddByte(g->unknownBlock3); pck.AddByte(g->uniqueness); pck.AddByte(g->unknownBlock4); pck.AddByte(g->rarity); pck.AddByte(g->unknownBlock5); pck.AddByte(g->unknownBlock6); pck.AddByte(g->unknownBlock7); pck.AddByte(g->unknownBlock8); pck.AddByte(g->unknownBlock9); FinishAgentAction(0, 1, 0); } MiniCompPck Agent::AASetEquippedItems(unsigned long weaponIsa, unsigned long offhandIsa, unsigned long chestIsa, unsigned long feetIsa, unsigned long legsIsa, unsigned long armsIsa, unsigned long headIsa, unsigned short networkId) { CompiledPacket pck; pck.AddShort(ServerOpcode(37)); pck.AddLong(mAgentId); pck.AddLong(weaponIsa); pck.AddLong(offhandIsa); pck.AddLong(chestIsa); pck.AddLong(feetIsa); pck.AddLong(legsIsa); pck.AddLong(armsIsa); pck.AddLong(headIsa); FinishAgentAction(0, 1, 0); } MiniCompPck Agent::AADestroyAgent(unsigned short networkId) { CompiledPacket pck; pck.AddShort(ServerOpcode(49)); pck.AddLong(mAgentId); FinishAgentAction(AGENT_ACTION_DESTROY, 1, 0); }