#include "Agent.h" #include "Instance.h" #include "Player.h" #include "Main.h" /* Guidelines All packets sent from within this file must terminate the function with FinishPacket(); Only packets that are not Agent Actions should be handled within this file. If the networkId is != 0 the packet will be sent to the client possessing that networkId */ //Set free attribute points MiniCompPck Agent::APSetFreeAtrribPoints(unsigned char freeAttribPoints, unsigned short networkId) { CompiledPacket pck; //Add the header pck.AddShort(ServerOpcode(23)); //Add the AgentID pck.AddLong(mAgentId); //Add the free attribute points pck.AddByte(freeAttribPoints); //Zero pck.AddByte(0); FinishPacket(); } MiniCompPck Agent::APSetPrivateProfession(char primary, char secondary, unsigned short networkId) { CompiledPacket pck; //Add the header pck.AddShort(ServerOpcode(24)); //Add the AgentID pck.AddLong(mAgentId); //Add the primary profession pck.AddByte(primary); //Add the secondary profession pck.AddByte(secondary); //Add unused? pck.AddByte(0); FinishPacket(); } MiniCompPck Agent::APSetSkillBar(unsigned short networkId) { if (USES_BATTLE_DATA) { CompiledPacket pck; //Add the header pck.AddShort(ServerOpcode(25)); //Add the AgentID pck.AddLong(mAgentId); pck.AddShort(8); for (unsigned int i=0; i<8; i++) { pck.AddLong(GetBattleData()->equippedSkills[i]); } pck.AddShort(8); for (unsigned int i=0; i<8; i++) { pck.AddLong(GetBattleData()->equippedSkills[i]); } pck.AddByte(1); FinishPacket(); } return MiniCompPck(); } MiniCompPck Agent::APGotoLocation(Vertex position, unsigned short networkId) { CompiledPacket pck; pck.AddShort(ServerOpcode(44)); pck.AddLong(mAgentId); pck.AddFloat(position.x); pck.AddFloat(position.y); pck.AddFloat(position.z); FinishPacket(); } MiniCompPck Agent::APStartMovement(Vertex position, int moveType, unsigned short networkId) { CompiledPacket pck; pck.AddShort(ServerOpcode(45)); pck.AddLong(mAgentId); pck.AddFloat(position.x); pck.AddFloat(position.y); pck.AddByte((unsigned char)moveType); gCoreLog.debug("\nSTART: Pos: (%f, %f) Type: %u", position.x, position.y, moveType); FinishPacket(); } MiniCompPck Agent::APStopMovement(float flo, int moveType, unsigned short networkId) { CompiledPacket pck; pck.AddShort(ServerOpcode(46)); pck.AddLong(mAgentId); pck.AddFloat(flo); pck.AddByte((unsigned char)moveType); gCoreLog.debug("STOP: Flo: %f Type: %u", flo, moveType); FinishPacket(); } MiniCompPck Agent::APRotateAgent(Vertex rotation, unsigned short networkId) { CompiledPacket pck; pck.AddShort(ServerOpcode(47)); pck.AddLong(mAgentId); pck.AddFloat(rotation.x); pck.AddLong(0x40060a92); FinishPacket(); }