#pragma once #include #include #include "../../src/Item.h" #include "../../src/IDManager.h" #include "../../src/CompiledPacket.h" #include "Vertex.h" #include "LocalData.h" #include "PlayerStatsStruct.h" #include "Agent.h" using namespace std; //Character appearance byte references #define CHAR_APP_HEIGHT_SEX 0 #define CHAR_APP_HAIR_SKIN_COLOR 1 #define CHAR_APP_PROFESSION_HAIR_STYLE 2 #define CHAR_APP_CAMPAIGN_FACE 3 //Character profession references #define CHAR_PROF_PRIMARY 0 #define CHAR_PROF_SECONDARY 1 //Equipped item references #define EQUIPPED_WEAPON 0 #define EQUIPPED_OFFHAND 1 #define EQUIPPED_ARMOR_HEAD 2 #define EQUIPPED_ARMOR_CHEST 3 #define EQUIPPED_ARMOR_ARMS 4 #define EQUIPPED_ARMOR_LEGS 5 #define EQUIPPED_ARMOR_FEET 6 //Player class flags #define DISTRICT_INFO_SENT 0 #define PLAYER_IS_CONNECTED 1 #define SPAWN_PACKET_SENT 2 #define PLAYER_IS_GHOST 3 #define PLAYER_IS_MOVING 4 #define PLAYER_IS_PVP_CHAR 5 class Player { public: //Constructors and deconstructor Player(); ~Player(); Player(char* pName, PLAYER_DATA* pLir); //General functions void Update(); unsigned long GetPing(); //Packet creation functions MiniCompPck Send_SetFreeAtrribPoints(unsigned short networkId); MiniCompPck Send_SetPrivateProfession(unsigned short networkId); MiniCompPck Send_UpdateMyPrivateStats(unsigned short networkId); MiniCompPck Send_SetPlayerAppearance(unsigned short networkId); MiniCompPck Send_SetMyMiscCape(unsigned short networkId); MiniCompPck Send_SetMyEquippedItems(unsigned short networkId); MiniCompPck Send_MyAvailableSkills(unsigned short networkId); //Create a CIH packet void CreateCih(CompiledPacket* pPck, NetMessage* pOutData); //ID Management functions unsigned long GetAgentId(); unsigned long GetAccountId(); short GetnetworkId(); unsigned long GetCharacterId(); unsigned long GetLocalId(); short GetStreamId(); void FreeUsedIds(); //Functions that return linked data objects Agent* GetAgent(); PLAYER_DATA* GetLir(); //Functions dealing with the player's name void GetPlayerNameUnicode(unsigned char* pBuffer, int* pLengthStorage); char* GetPlayerName(); //Functions that change the appearance of the player void SetAppearance(int value, int appParam); unsigned char GetAppearance(int appParam); //Functions that modify and retrieve the player's profession void SetProfession(int value, int profParam); unsigned char GetProfession(int appParam); //Functions that set and retrieve the currently equipped armor void SetEquippedArmor(int piece, char* pItemId); Item* GetEquippedArmor(int piece); //Functions that deal with the equipped offhand and weapon Item* GetEquippedWeapon(); Item* GetEquippedOffhand(); Item* GetEquippedItem(int ref); //Functions that modify/get the current group this character belongs to void SetGroupId(char groupId); char GetGroupId(); //Functions that set/get flags void SetFlag(int flag, bool state); bool GetFlag(int flag); //Get the player's (player's agent) position Vertex GetCurrentPos(); //Get character type =p bool IsCharacterPvP(); //The following functions should only be called ONCE or should only be called in one place of the code void SetLocalId(unsigned long Id); void SetStreamID(short Id); void SetAgent(Agent* pAgent); void StartCharInfoTimer(); void SetCharacterType(bool pvp); void SetIdManagers(IDManager* pIsa, IDManager* pEisa); void AddItem(Item* pItem); //Debatable PLAYER_STATS* GetStats(); void SetPingTimeSent(unsigned long time); unsigned long mLastPing; //Temporary unsigned long mStartMovTimer; Vertex mStartMov; hash_map mItems; private: Item* AccessItem(unsigned long id); //Character stuff char mName[50]; //This characters name unsigned char mAppearance[4]; //stores the character's appearance unsigned long mEquippedItems[7]; //Equipped items 0=Weapon, 1=Offhand, 2=INT_HEAD, 3=INT_CHEST, 4=INT_ARMS, 5=INT_LEGS, 6=INT_FEET //Player data PLAYER_STATS mStats; //Player's instance related id's unsigned long mLocalId; //the ID of the player in the current instance short mStreamId; // the ID used for adding items to the player's inventory char mGroupId; //Used for determining permissions //Timers. YAY! xD unsigned long mTimePingSent;//Ping timers unsigned long mCharInfoTimer;//Used to detect if 18b force is needed unsigned long mCihTimer; //Player flags bitset<32> mFlags; //Pointers to other data objects PLAYER_DATA* mpLir; Agent* mpAgent; IDManager* mpIsaMan; IDManager* mpEisaMan; };