Player.h 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. EQ2Emulator is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef __EQ2_PLAYER__
  17. #define __EQ2_PLAYER__
  18. #include "Entity.h"
  19. #include "Items/Items.h"
  20. #include "Factions.h"
  21. #include "Skills.h"
  22. #include "Quests.h"
  23. #include "MutexMap.h"
  24. #include "Guilds/Guild.h"
  25. #include "Collections/Collections.h"
  26. #include "Recipes/Recipe.h"
  27. #include "Titles.h"
  28. #include "Languages.h"
  29. #include "Achievements/Achievements.h"
  30. #include <algorithm>
  31. #include <set>
  32. #define CF_COMBAT_EXPERIENCE_ENABLED 0
  33. #define CF_ENABLE_CHANGE_LASTNAME 1
  34. #define CF_FOOD_AUTO_CONSUME 2
  35. #define CF_DRINK_AUTO_CONSUME 3
  36. #define CF_AUTO_ATTACK 4
  37. #define CF_RANGED_AUTO_ATTACK 5
  38. #define CF_QUEST_EXPERIENCE_ENABLED 6
  39. #define CF_CHASE_CAMERA_MAYBE 7
  40. #define CF_100 8
  41. #define CF_200 9
  42. #define CF_IS_SITTING 10 /*CAN'T CAST OR ATTACK*/
  43. #define CF_800 11
  44. #define CF_ANONYMOUS 12
  45. #define CF_ROLEPLAYING 13
  46. #define CF_AFK 14
  47. #define CF_LFG 15
  48. #define CF_LFW 16
  49. #define CF_HIDE_HOOD 17
  50. #define CF_HIDE_HELM 18
  51. #define CF_SHOW_ILLUSION 19
  52. #define CF_ALLOW_DUEL_INVITES 20
  53. #define CF_ALLOW_TRADE_INVITES 21
  54. #define CF_ALLOW_GROUP_INVITES 22
  55. #define CF_ALLOW_RAID_INVITES 23
  56. #define CF_ALLOW_GUILD_INVITES 24
  57. #define CF_2000000 25
  58. #define CF_4000000 26
  59. #define CF_DEFENSE_SKILLS_AT_MAX_QUESTIONABLE 27
  60. #define CF_SHOW_GUILD_HERALDRY 28
  61. #define CF_SHOW_CLOAK 29
  62. #define CF_IN_PVP 30
  63. #define CF_IS_HATED 31
  64. #define CF2_1 32
  65. #define CF2_2 33
  66. #define CF2_4 34
  67. #define CF2_ALLOW_LON_INVITES 35
  68. #define CF2_SHOW_RANGED 36
  69. #define CF2_ALLOW_VOICE_INVITES 37
  70. #define CF2_CHARACTER_BONUS_EXPERIENCE_ENABLED 38
  71. #define CF2_80 39
  72. #define CF2_100 40 /* hide achievments*/
  73. #define CF2_200 41
  74. #define CF2_400 42
  75. #define CF2_800 43 /* enable facebook updates*/
  76. #define CF2_1000 44 /* enable twitter updates*/
  77. #define CF2_2000 45 /* enable eq2 player updates */
  78. #define CF2_4000 46 /*eq2 players, link to alt chars */
  79. #define CF2_8000 47
  80. #define CF2_10000 48
  81. #define CF2_20000 49
  82. #define CF2_40000 50
  83. #define CF2_80000 51
  84. #define CF2_100000 52
  85. #define CF2_200000 53
  86. #define CF2_400000 54
  87. #define CF2_800000 55
  88. #define CF2_1000000 56
  89. #define CF2_2000000 57
  90. #define CF2_4000000 58
  91. #define CF2_8000000 59
  92. #define CF2_10000000 60
  93. #define CF2_20000000 61
  94. #define CF2_40000000 62
  95. #define CF2_80000000 63
  96. #define CF_MAXIMUM_FLAG 63
  97. #define CF_HIDE_STATUS 49 /* !!FORTESTING ONLY!! */
  98. #define CF_GM_HIDDEN 50 /* !!FOR TESTING ONLY!! */
  99. #define UPDATE_ACTIVITY_FALLING 0
  100. #define UPDATE_ACTIVITY_RUNNING 128
  101. #define UPDATE_ACTIVITY_RIDING_BOAT 256
  102. #define UPDATE_ACTIVITY_JUMPING 1024
  103. #define UPDATE_ACTIVITY_IN_WATER_ABOVE 6144
  104. #define UPDATE_ACTIVITY_IN_WATER_BELOW 6272
  105. #define UPDATE_ACTIVITY_SITING 6336
  106. #define UPDATE_ACTIVITY_DROWNING 14464
  107. #define UPDATE_ACTIVITY_DROWNING2 14336
  108. #define NUM_MAINTAINED_EFFECTS 30
  109. #define NUM_SPELL_EFFECTS 45
  110. /* Character History Type Defines */
  111. #define HISTORY_TYPE_NONE 0
  112. #define HISTORY_TYPE_DEATH 1
  113. #define HISTORY_TYPE_DISCOVERY 2
  114. #define HISTORY_TYPE_XP 3
  115. /* Spell Status */
  116. #define SPELL_STATUS_QUEUE 4
  117. #define SPELL_STATUS_LOCK 66
  118. /* Character History Sub Type Defines */
  119. #define HISTORY_SUBTYPE_NONE 0
  120. #define HISTORY_SUBTYPE_ADVENTURE 1
  121. #define HISTORY_SUBTYPE_TRADESKILL 2
  122. #define HISTORY_SUBTYPE_QUEST 3
  123. #define HISTORY_SUBTYPE_AA 4
  124. #define HISTORY_SUBTYPE_ITEM 5
  125. #define HISTORY_SUBTYPE_LOCATION 6
  126. /// <summary>Character history data, should match the `character_history` table in the DB</summary>
  127. struct HistoryData {
  128. int32 Value;
  129. int32 Value2;
  130. char Location[200];
  131. int32 EventID;
  132. int32 EventDate;
  133. };
  134. /// <summary>History set through the LUA system</summary>
  135. struct LUAHistory {
  136. int32 Value;
  137. int32 Value2;
  138. bool SaveNeeded;
  139. };
  140. struct SpellBookEntry{
  141. int32 spell_id;
  142. int8 tier;
  143. int32 type;
  144. sint32 slot;
  145. int32 recast_available;
  146. int8 status;
  147. int16 recast;
  148. int32 timer;
  149. bool save_needed;
  150. bool in_use;
  151. Player* player;
  152. bool visible;
  153. };
  154. #define QUICKBAR_NORMAL 1
  155. #define QUICKBAR_INV_SLOT 2
  156. #define QUICKBAR_MACRO 3
  157. #define QUICKBAR_TEXT_CMD 4
  158. #define QUICKBAR_ITEM 6
  159. #define EXP_DISABLED_STATE 0
  160. #define EXP_ENABLED_STATE 1
  161. #define MELEE_COMBAT_STATE 16
  162. #define RANGE_COMBAT_STATE 32
  163. struct QuickBarItem{
  164. bool deleted;
  165. int32 hotbar;
  166. int32 slot;
  167. int32 type;
  168. int16 icon;
  169. int16 icon_type;
  170. int32 id;
  171. int8 tier;
  172. int32 unique_id;
  173. EQ2_16BitString text;
  174. };
  175. struct LoginAppearances {
  176. bool deleted;
  177. int16 equip_type;
  178. int8 red;
  179. int8 green;
  180. int8 blue;
  181. int8 h_red;
  182. int8 h_green;
  183. int8 h_blue;
  184. bool update_needed;
  185. };
  186. class PlayerLoginAppearance {
  187. public:
  188. PlayerLoginAppearance() { appearanceList = new map<int8, LoginAppearances>; }
  189. ~PlayerLoginAppearance() { }
  190. void AddEquipmentToUpdate(int8 slot_id, LoginAppearances* equip)
  191. {
  192. //LoginAppearances data;
  193. //data.equip_type = equip->equip_type;
  194. //appearanceList[slot_id] = data;
  195. }
  196. void DeleteEquipmentFromUpdate(int8 slot_id, LoginAppearances* equip)
  197. {
  198. //LoginAppearances data;
  199. //data.deleted = equip->deleted;
  200. //data.update_needed = true;
  201. //appearanceList[slot_id] = data;
  202. }
  203. void RemoveEquipmentUpdates()
  204. {
  205. appearanceList->clear();
  206. safe_delete(appearanceList);
  207. }
  208. private:
  209. map<int8, LoginAppearances>* appearanceList;
  210. };
  211. struct InstanceData{
  212. int32 db_id;
  213. int32 instance_id;
  214. int32 zone_id;
  215. int8 zone_instance_type;
  216. string zone_name;
  217. int32 last_success_timestamp;
  218. int32 last_failure_timestamp;
  219. int32 success_lockout_time;
  220. int32 failure_lockout_time;
  221. };
  222. class CharacterInstances {
  223. public:
  224. CharacterInstances();
  225. ~CharacterInstances();
  226. ///<summary>Adds an instance data to the player with the given data</summary>
  227. ///<param name='db_id'>The unique id for this record in the database</param>
  228. ///<param name='instance_id'>The id of the instance</param>
  229. ///<param name='last_success_timestamp'>The success timestamp</param>
  230. ///<param name='last_failure_timestamp'>The failure timestamp</param>
  231. ///<param name='success_lockout_time'>The lockout time, in secs, for completing the instance</param>
  232. ///<param name='failure_lockout_time'>The lockout time, in secs, for failing the instance</param>
  233. ///<param name='zone_id'>The id of the zone</param>
  234. ///<param name='zone_instancetype'>The type of instance of the zone</param>
  235. ///<param name='zone_name'>The name of the zone</param>
  236. void AddInstance(int32 db_id, int32 instance_id, int32 last_success_timestamp, int32 last_failure_timestamp, int32 success_lockout_time, int32 failure_lockout_time, int32 zone_id, int8 zone_instancetype, string zone_name);
  237. ///<summary>Clears all instance data</summary>
  238. void RemoveInstances();
  239. ///<summary>Removes the instace with the given zone id</summary>
  240. ///<param name='zone_id'>The zone id of the instance to remove</param>
  241. ///<returns>True if the instance was found and removed</returns>
  242. bool RemoveInstanceByZoneID(int32 zone_id);
  243. ///<summary>Removes the instance with the given instance id</summary>
  244. ///<param name='instance_id'>the instance id of the instance to remove</param>
  245. ///<returns>True if instance was found and removed</returns>
  246. bool RemoveInstanceByInstanceID(int32 instance_id);
  247. ///<summary>Gets the instance with the given zone id</summary>
  248. ///<param name='zone_id'>The zone id of the instance to get</param>
  249. ///<returns>InstanceData* of the instance record for the given zone id</returns>
  250. InstanceData* FindInstanceByZoneID(int32 zone_id);
  251. ///<summary>Gets the instance with the given database id</summary>
  252. ///<param name='db_id'>The database id of the instance to get</param>
  253. ///<returns>InstanceData* of the instance record for the given database id</returns>
  254. InstanceData* FindInstanceByDBID(int32 db_id);
  255. ///<summary>Gets the instance with the given instance id</summary>
  256. ///<param name='instance_id'>The instance id of the instance to get</param>
  257. ///<returns>InstanceData* of the instance record for the given instance id</returns>
  258. InstanceData* FindInstanceByInstanceID(int32 instance_id);
  259. ///<summary>Gets a list of all the lockout instances</summary>
  260. vector<InstanceData> GetLockoutInstances();
  261. ///<summary>Gets a list of all the persistent instances</summary>
  262. vector<InstanceData> GetPersistentInstances();
  263. ///<summary>Check the timers for the instances</summary>
  264. ///<param name='player'>player we are checking the timers for</param>
  265. void ProcessInstanceTimers(Player* player);
  266. ///<summary>Gets the total number of instances</summary>
  267. int32 GetInstanceCount();
  268. private:
  269. vector<InstanceData> instanceList;
  270. Mutex m_instanceList;
  271. };
  272. class Player;
  273. struct PlayerGroup;
  274. struct GroupMemberInfo;
  275. struct Statistic;
  276. struct Mail;
  277. class PlayerInfo {
  278. public:
  279. ~PlayerInfo();
  280. PlayerInfo(Player* in_player);
  281. EQ2Packet* serialize(int16 version, int16 modifyPos = 0, int32 modifyValue = 0);
  282. PacketStruct* serialize2(int16 version);
  283. EQ2Packet* serialize3(PacketStruct* packet, int16 version);
  284. EQ2Packet* serializePet(int16 version);
  285. void CalculateXPPercentages();
  286. void CalculateTSXPPercentages();
  287. void SetHouseZone(int32 id);
  288. void SetBindZone(int32 id);
  289. void SetBindX(float x);
  290. void SetBindY(float y);
  291. void SetBindZ(float z);
  292. void SetBindHeading(float heading);
  293. void SetAccountAge(int16 days);
  294. int32 GetHouseZoneID();
  295. int32 GetBindZoneID();
  296. float GetBindZoneX();
  297. float GetBindZoneY();
  298. float GetBindZoneZ();
  299. float GetBindZoneHeading();
  300. float GetBoatX() { return boat_x_offset; }
  301. float GetBoatY() { return boat_y_offset; }
  302. float GetBoatZ() { return boat_z_offset; }
  303. int32 GetBoatSpawn();
  304. void SetBoatX(float x) { boat_x_offset = x; }
  305. void SetBoatY(float y) { boat_y_offset = y; }
  306. void SetBoatZ(float z) { boat_z_offset = z; }
  307. void SetBoatSpawn(Spawn* boat);
  308. void RemoveOldPackets();
  309. private:
  310. int32 house_zone_id;
  311. int32 bind_zone_id;
  312. float bind_x;
  313. float bind_y;
  314. float bind_z;
  315. float bind_heading;
  316. uchar* changes;
  317. uchar* orig_packet;
  318. uchar* pet_changes;
  319. uchar* pet_orig_packet;
  320. InfoStruct* info_struct;
  321. Player* player;
  322. float boat_x_offset;
  323. float boat_y_offset;
  324. float boat_z_offset;
  325. int32 boat_spawn;
  326. };
  327. class PlayerControlFlags{
  328. public:
  329. PlayerControlFlags();
  330. ~PlayerControlFlags();
  331. void SetPlayerControlFlag(int8 param, int8 param_value, bool is_active);
  332. bool ControlFlagsChanged();
  333. void SendControlFlagUpdates(Client* client);
  334. private:
  335. bool flags_changed;
  336. map<int8, map<int8, int8> > flag_changes;
  337. map<int8, map<int8, bool> > current_flags;
  338. Mutex MControlFlags;
  339. Mutex MFlagChanges;
  340. };
  341. class Player : public Entity{
  342. public:
  343. Player();
  344. virtual ~Player();
  345. EQ2Packet* serialize(Player* player, int16 version);
  346. //int8 GetMaxArtLevel(){ return info->GetInfo()->max_art_level; }
  347. //int8 GetArtLevel(){ return info->GetInfo()->art_level; }
  348. Client* GetClient() { return client; }
  349. void SetClient(Client* client) { this->client = client; }
  350. PlayerInfo* GetPlayerInfo();
  351. void SetCharSheetChanged(bool val);
  352. bool GetCharSheetChanged();
  353. void AddFriend(const char* name, bool save);
  354. bool IsFriend(const char* name);
  355. void RemoveFriend(const char* name);
  356. map<string, int8>* GetFriends();
  357. void AddIgnore(const char* name, bool save);
  358. bool IsIgnored(const char* name);
  359. void RemoveIgnore(const char* name);
  360. map<string, int8>* GetIgnoredPlayers();
  361. // JA: POI Discoveries
  362. map<int32, vector<int32> >* GetPlayerDiscoveredPOIs();
  363. void AddPlayerDiscoveredPOI(int32 location_id);
  364. //
  365. EQ2Packet* Move(float x, float y, float z, int16 version, float heading = -1.0f);
  366. /*void SetMaxArtLevel(int8 new_max){
  367. max_art_level = new_max;
  368. }
  369. void SetArtLevel(int8 new_lvl){
  370. art_level = new_lvl;
  371. }*/
  372. bool WasSentSpawn(int32 spawn_id);
  373. bool NeedsSpawnResent(Spawn* spawn);
  374. void SetSideSpeed(float side_speed, bool updateFlags = true) {
  375. SetPos(&appearance.pos.SideSpeed, side_speed, updateFlags);
  376. }
  377. float GetSideSpeed() {
  378. return appearance.pos.SideSpeed;
  379. }
  380. int8 GetTutorialStep() {
  381. return tutorial_step;
  382. }
  383. void SetTutorialStep(int8 val) {
  384. tutorial_step = val;
  385. }
  386. void AddMaintainedSpell(LuaSpell* spell);
  387. void AddSpellEffect(LuaSpell* spell, int32 override_expire_time = 0);
  388. void RemoveMaintainedSpell(LuaSpell* spell);
  389. void RemoveSpellEffect(LuaSpell* spell);
  390. bool HasActiveMaintainedSpell(Spell* spell, Spawn* target);
  391. bool HasActiveSpellEffect(Spell* spell, Spawn* target);
  392. void AddQuickbarItem(int32 bar, int32 slot, int32 type, int16 icon, int16 icon_type, int32 id, int8 tier, int32 unique_id, const char* text, bool update = true);
  393. void RemoveQuickbarItem(int32 bar, int32 slot, bool update = true);
  394. void MoveQuickbarItem(int32 id, int32 new_slot);
  395. void ClearQuickbarItems();
  396. PlayerItemList* GetPlayerItemList();
  397. PlayerItemList item_list;
  398. PlayerSkillList skill_list;
  399. Skill* GetSkillByName(const char* name, bool check_update = false);
  400. Skill* GetSkillByID(int32 skill_id, bool check_update = false);
  401. PlayerSkillList* GetSkills();
  402. bool DamageEquippedItems(int8 amount = 10, Client* client = 0);
  403. vector<EQ2Packet*> EquipItem(int16 index, int16 version, int8 appearance_type, int8 slot_id = 255);
  404. bool CanEquipItem(Item* item);
  405. void SetEquippedItemAppearances();
  406. vector<EQ2Packet*> UnequipItem(int16 index, sint32 bag_id, int8 slot, int16 version, int8 appearance_type = 0);
  407. int8 ConvertSlotToClient(int8 slot, int16 version);
  408. int8 ConvertSlotFromClient(int8 slot, int16 version);
  409. EQ2Packet* SwapEquippedItems(int8 slot1, int8 slot2, int16 version);
  410. EQ2Packet* RemoveInventoryItem(int8 bag_slot, int8 slot);
  411. EQ2Packet* SendInventoryUpdate(int16 version);
  412. EQ2Packet* SendBagUpdate(int32 bag_unique_id, int16 version);
  413. void SendQuestRequiredSpawns(int32 quest_id);
  414. void SendHistoryRequiredSpawns(int32 event_id);
  415. map<int32, Item*>* GetItemList();
  416. map<int32, Item*>* GetBankItemList();
  417. vector<Item*>* GetEquippedItemList();
  418. vector<Item*>* GetAppearanceEquippedItemList();
  419. Quest* SetStepComplete(int32 quest_id, int32 step);
  420. Quest* AddStepProgress(int32 quest_id, int32 step, int32 progress);
  421. int32 GetStepProgress(int32 quest_id, int32 step_id);
  422. bool AddItem(Item* item);
  423. bool AddItemToBank(Item* item);
  424. int16 GetSpellSlotMappingCount();
  425. int16 GetSpellPacketCount();
  426. Quest* GetQuest(int32 quest_id);
  427. bool GetQuestStepComplete(int32 quest_id, int32 step_id);
  428. int16 GetQuestStep(int32 quest_id);
  429. int16 GetTaskGroupStep(int32 quest_id);
  430. int8 GetSpellTier(int32 id);
  431. void SetSpellStatus(Spell* spell, int8 status);
  432. void RemoveSpellStatus(Spell* spell, int8 status);
  433. EQ2Packet* GetSpellBookUpdatePacket(int16 version);
  434. EQ2Packet* GetSpellSlotMappingPacket(int16 version);
  435. int32 GetCharacterID();
  436. void SetCharacterID(int32 new_id);
  437. EQ2Packet* GetQuickbarPacket(int16 version);
  438. vector<QuickBarItem*>* GetQuickbar();
  439. bool UpdateQuickbarNeeded();
  440. void ResetQuickbarNeeded();
  441. void set_character_flag(int flag);
  442. void reset_character_flag(int flag);
  443. void toggle_character_flag(int flag);
  444. bool get_character_flag(int flag);
  445. void AddCoins(int64 val);
  446. bool RemoveCoins(int64 val);
  447. /// <summary>Checks to see if the player has the given amount of coins</summary>
  448. /// <param name="val">Amount of coins to check</param>
  449. /// <returns>True if the player has enough coins</returns>
  450. bool HasCoins(int64 val);
  451. void AddSkill(int32 skill_id, int16 current_val, int16 max_val, bool save_needed = false);
  452. void RemovePlayerSkill(int32 skill_id, bool save = false);
  453. void RemoveSkillFromDB(Skill* skill, bool save = false);
  454. void AddSpellBookEntry(int32 spell_id, int8 tier, sint32 slot, int32 type, int32 timer, bool save_needed = false);
  455. SpellBookEntry* GetSpellBookSpell(int32 spell_id);
  456. vector<SpellBookEntry*>* GetSpellsSaveNeeded();
  457. sint32 GetFreeSpellBookSlot(int32 type);
  458. /// <summary>Get a vector of spell ids for all spells in the spell book for the given skill</summary>
  459. /// <param name='skill_id'>The id of the skill to check</param>
  460. /// <returns>A vector of int32's of the spell id's</returns>
  461. vector<int32> GetSpellBookSpellIDBySkill(int32 skill_id);
  462. EQ2Packet* MoveInventoryItem(sint32 to_bag_id, int16 from_index, int8 new_slot, int8 charges, int8 appearance_type, int16 version = 1);
  463. bool IsPlayer(){ return true; }
  464. MaintainedEffects* GetFreeMaintainedSpellSlot();
  465. MaintainedEffects* GetMaintainedSpell(int32 id);
  466. MaintainedEffects* GetMaintainedSpellBySlot(int8 slot);
  467. MaintainedEffects* GetMaintainedSpells();
  468. SpellEffects* GetFreeSpellEffectSlot();
  469. SpellEffects* GetSpellEffects();
  470. int32 GetCoinsCopper();
  471. int32 GetCoinsSilver();
  472. int32 GetCoinsGold();
  473. int32 GetCoinsPlat();
  474. int32 GetBankCoinsCopper();
  475. int32 GetBankCoinsSilver();
  476. int32 GetBankCoinsGold();
  477. int32 GetBankCoinsPlat();
  478. int32 GetStatusPoints();
  479. float GetXPVitality();
  480. float GetTSXPVitality();
  481. bool AdventureXPEnabled();
  482. bool TradeskillXPEnabled();
  483. void SetNeededXP(int32 val);
  484. void SetNeededXP();
  485. void SetXP(int32 val);
  486. void SetNeededTSXP(int32 val);
  487. void SetNeededTSXP();
  488. void SetTSXP(int32 val);
  489. int32 GetNeededXP();
  490. float GetXPDebt();
  491. int32 GetXP();
  492. int32 GetNeededTSXP();
  493. int32 GetTSXP();
  494. bool AddXP(int32 xp_amount);
  495. bool AddTSXP(int32 xp_amount);
  496. bool DoubleXPEnabled();
  497. float CalculateXP(Spawn* victim);
  498. float CalculateTSXP(int8 level);
  499. void CalculateOfflineDebtRecovery(int32 unix_timestamp);
  500. void InCombat(bool val, bool range = false);
  501. void PrepareIncomingMovementPacket(int32 len, uchar* data, int16 version);
  502. uchar* GetMovementPacketData(){
  503. return movement_packet;
  504. }
  505. void AddSpawnInfoPacketForXOR(int32 spawn_id, uchar* packet, int16 packet_size);
  506. uchar* GetSpawnInfoPacketForXOR(int32 spawn_id);
  507. void AddSpawnVisPacketForXOR(int32 spawn_id, uchar* packet, int16 packet_size);
  508. uchar* GetSpawnVisPacketForXOR(int32 spawn_id);
  509. void AddSpawnPosPacketForXOR(int32 spawn_id, uchar* packet, int16 packet_size);
  510. uchar* GetSpawnPosPacketForXOR(int32 spawn_id);
  511. uchar* GetTempInfoPacketForXOR();
  512. uchar* GetTempVisPacketForXOR();
  513. uchar* GetTempPosPacketForXOR();
  514. uchar* SetTempInfoPacketForXOR(int16 size);
  515. uchar* SetTempVisPacketForXOR(int16 size);
  516. uchar* SetTempPosPacketForXOR(int16 size);
  517. int32 GetTempInfoXorSize() { return info_xor_size; }
  518. int32 GetTempVisXorSize() { return vis_xor_size; }
  519. int32 GetTempPosXorSize() { return pos_xor_size; }
  520. bool CheckPlayerInfo();
  521. void CalculateLocation();
  522. void SetSpawnDeleteTime(int32 id, int32 time);
  523. int32 GetSpawnDeleteTime(int32 id);
  524. void ClearEverything();
  525. bool IsFullyLoggedIn();
  526. void SetFullyLoggedIn(bool val);
  527. bool IsResurrecting();
  528. void SetResurrecting(bool val);
  529. int8 GetArrowColor(int8 spawn_level);
  530. int8 GetTSArrowColor(int8 level);
  531. Spawn* GetSpawnByIndex(int16 index);
  532. int16 GetIndexForSpawn(Spawn* spawn);
  533. bool WasSpawnRemoved(Spawn* spawn);
  534. void RemoveSpawn(Spawn* spawn);
  535. void ClearRemovedSpawn(Spawn* spawn);
  536. bool ShouldSendSpawn(Spawn* spawn);
  537. Client* client = 0;
  538. void SetLevel(int16 level, bool setUpdateFlags = true) {
  539. SetInfo(&appearance.level, level, setUpdateFlags);
  540. SetXP(0);
  541. SetNeededXP();
  542. }
  543. Spawn* GetSpawnWithPlayerID(int32 id){
  544. Spawn* spawn = 0;
  545. index_mutex.readlock(__FUNCTION__, __LINE__);
  546. if (player_spawn_id_map.count(id) > 0)
  547. spawn = player_spawn_id_map[id];
  548. index_mutex.releasereadlock(__FUNCTION__, __LINE__);
  549. return spawn;
  550. }
  551. int32 GetIDWithPlayerSpawn(Spawn* spawn){
  552. int32 id = 0;
  553. index_mutex.readlock(__FUNCTION__, __LINE__);
  554. if (player_spawn_reverse_id_map.count(spawn) > 0)
  555. id = player_spawn_reverse_id_map[spawn];
  556. index_mutex.releasereadlock(__FUNCTION__, __LINE__);
  557. return id;
  558. }
  559. void SetSpawnMap(Spawn* spawn);
  560. void SetSpawnMapIndex(Spawn* spawn, int32 index)
  561. {
  562. index_mutex.writelock(__FUNCTION__, __LINE__);
  563. if (player_spawn_id_map.count(index))
  564. player_spawn_id_map[index] = spawn;
  565. else
  566. player_spawn_id_map[index] = spawn;
  567. index_mutex.releasewritelock(__FUNCTION__, __LINE__);
  568. }
  569. int16 SetSpawnMapAndIndex(Spawn* spawn)
  570. {
  571. int16 new_index = 0;
  572. index_mutex.writelock(__FUNCTION__, __LINE__);
  573. spawn_index += 1;
  574. if (spawn_index == 255)
  575. spawn_index += 1; //just so we dont have to worry about overloading
  576. new_index = spawn_index;
  577. player_spawn_id_map[new_index] = spawn;
  578. player_spawn_reverse_id_map[spawn] = new_index;
  579. index_mutex.releasewritelock(__FUNCTION__, __LINE__);
  580. return new_index;
  581. }
  582. PacketStruct* GetQuestJournalPacket(bool all_quests, int16 version, int32 crc, int32 current_quest_id, bool updated = true);
  583. void RemoveQuest(int32 id, bool delete_quest);
  584. vector<Quest*>* CheckQuestsChatUpdate(Spawn* spawn);
  585. vector<Quest*>* CheckQuestsItemUpdate(Item* item);
  586. vector<Quest*>* CheckQuestsLocationUpdate();
  587. vector<Quest*>* CheckQuestsKillUpdate(Spawn* spawn,bool update = true);
  588. vector<Quest*>* CheckQuestsSpellUpdate(Spell* spell);
  589. void CheckQuestsCraftUpdate(Item* item, int32 qty);
  590. void CheckQuestsHarvestUpdate(Item* item, int32 qty);
  591. vector<Quest*>* CheckQuestsFailures();
  592. bool CheckQuestRemoveFlag(Spawn* spawn);
  593. int8 CheckQuestFlag(Spawn* spawn);
  594. bool CheckQuestRequired(Spawn* spawn);
  595. void AddQuestRequiredSpawn(Spawn* spawn, int32 quest_id);
  596. void AddHistoryRequiredSpawn(Spawn* spawn, int32 event_id);
  597. int16 spawn_index;
  598. int32 spawn_id;
  599. int8 tutorial_step;
  600. map<int32, vector<int32>*> player_spawn_quests_required;
  601. map<int32, vector<int32>*> player_spawn_history_required;
  602. Mutex m_playerSpawnQuestsRequired;
  603. Mutex m_playerSpawnHistoryRequired;
  604. Quest* GetCompletedQuest(int32 quest_id);
  605. void AddCompletedQuest(Quest* quest);
  606. map<int32, Quest*> pending_quests;
  607. map<int32, Quest*> player_quests;
  608. map<int32, Quest*>* GetPlayerQuests();
  609. map<int32, Quest*>* GetCompletedPlayerQuests();
  610. void LockQuests();
  611. void UnlockQuests();
  612. void SetFactionValue(int32 faction_id, sint32 value){
  613. factions.SetFactionValue(faction_id, value);
  614. }
  615. PlayerFaction* GetFactions(){
  616. return &factions;
  617. }
  618. vector<int32> GetQuestIDs();
  619. map<int32, int16> macro_icons;
  620. bool HasPendingLootItems(int32 id);
  621. bool HasPendingLootItem(int32 id, int32 item_id);
  622. vector<Item*>* GetPendingLootItems(int32 id);
  623. void RemovePendingLootItem(int32 id, int32 item_id);
  624. void RemovePendingLootItems(int32 id);
  625. void AddPendingLootItems(int32 id, vector<Item*>* items);
  626. int16 GetTierUp(int16 tier);
  627. bool HasSpell(int32 spell_id, int8 tier = 255, bool include_higher_tiers = false, bool include_possible_scribe = false);
  628. bool HasRecipeBook(int32 recipe_id);
  629. void AddPlayerStatistic(int32 stat_id, sint32 stat_value, int32 stat_date);
  630. void UpdatePlayerStatistic(int32 stat_id, sint32 stat_value, bool overwrite = false);
  631. sint64 GetPlayerStatisticValue(int32 stat_id);
  632. void WritePlayerStatistics();
  633. //PlayerGroup* GetGroup();
  634. void SetGroup(PlayerGroup* group);
  635. bool IsGroupMember(Entity* player);
  636. void SetGroupInformation(PacketStruct* packet);
  637. void ResetRemovedSpawns();
  638. void ResetSavedSpawns();
  639. bool IsReturningFromLD();
  640. void SetReturningFromLD(bool val);
  641. bool CheckLevelStatus(int16 new_level);
  642. int16 GetLastMovementActivity();
  643. void DestroyQuests();
  644. string GetAwayMessage() const { return away_message; }
  645. void SetAwayMessage(string val) { away_message = val; }
  646. void SetRangeAttack(bool val);
  647. bool GetRangeAttack();
  648. ZoneServer* GetGroupMemberInZone(int32 zone_id);
  649. bool AddMail(Mail* mail);
  650. MutexMap<int32, Mail*>* GetMail();
  651. Mail* GetMail(int32 mail_id);
  652. void DeleteMail(bool from_database = false);
  653. void DeleteMail(int32 mail_id, bool from_database = false);
  654. CharacterInstances* GetCharacterInstances() { return &character_instances; }
  655. void SetIsTracking(bool val) { is_tracking = val; }
  656. bool GetIsTracking() const { return is_tracking; }
  657. void SetBiography(string new_biography) { biography = new_biography; }
  658. string GetBiography() const { return biography; }
  659. void SetPlayerAdventureClass(int8 new_class);
  660. void SetGuild(Guild* new_guild) { guild = new_guild; }
  661. Guild* GetGuild() { return guild; }
  662. void AddSkillBonus(int32 spell_id, int32 skill_id, float value);
  663. SkillBonus* GetSkillBonus(int32 spell_id);
  664. virtual void RemoveSkillBonus(int32 spell_id);
  665. virtual bool CanSeeInvis(Entity* target);
  666. bool CheckChangeInvisHistory(Entity* target);
  667. void UpdateTargetInvisHistory(int32 targetID, bool canSeeStatus);
  668. void RemoveTargetInvisHistory(int32 targetID);
  669. bool HasFreeBankSlot();
  670. int8 FindFreeBankSlot();
  671. PlayerCollectionList * GetCollectionList() { return &collection_list; }
  672. PlayerRecipeList * GetRecipeList() { return &recipe_list; }
  673. PlayerRecipeBookList * GetRecipeBookList() { return &recipebook_list; }
  674. PlayerAchievementList * GetAchievementList() { return &achievement_list; }
  675. PlayerAchievementUpdateList * GetAchievementUpdateList() { return &achievement_update_list; }
  676. void SetPendingCollectionReward(Collection *collection) { pending_collection_reward = collection; }
  677. Collection * GetPendingCollectionReward() { return pending_collection_reward; }
  678. void AddPendingSelectableItemReward(int32 source_id, Item* item) {
  679. if (pending_selectable_item_rewards.count(source_id) == 0)
  680. pending_selectable_item_rewards[source_id] = vector<Item*>();
  681. pending_selectable_item_rewards[source_id].push_back(item);
  682. }
  683. void AddPendingItemReward(Item* item) {
  684. pending_item_rewards.push_back(item);
  685. }
  686. bool HasPendingItemRewards() { return (pending_item_rewards.size() > 0 || pending_selectable_item_rewards.size() > 0); }
  687. vector<Item*> GetPendingItemRewards() { return pending_item_rewards; }
  688. map<int32, Item*> GetPendingSelectableItemReward(int32 item_id) { //since the client sends the selected item id, we need to have the associated source and remove all of them. Yes, there is an edge case if multiple sources have the same Item in them, but limited on what the client sends (just a single item id)
  689. map<int32, Item*> ret;
  690. if (pending_selectable_item_rewards.size() > 0) {
  691. map<int32, vector<Item*>>::iterator map_itr;
  692. for (map_itr = pending_selectable_item_rewards.begin(); map_itr != pending_selectable_item_rewards.end(); map_itr++) {
  693. vector<Item*>::iterator itr;
  694. for (itr = map_itr->second.begin(); itr != map_itr->second.end(); itr++) {
  695. if ((*itr)->details.item_id == item_id) {
  696. ret[map_itr->first] = *itr;
  697. break;
  698. }
  699. }
  700. if (ret.size() > 0)
  701. break;
  702. }
  703. }
  704. return map<int32, Item*>();
  705. }
  706. void ClearPendingSelectableItemRewards(int32 source_id, bool all = false) {
  707. if (pending_selectable_item_rewards.size() > 0) {
  708. map<int32, vector<Item*>>::iterator map_itr;
  709. if (all) {
  710. for (map_itr = pending_selectable_item_rewards.begin(); map_itr != pending_selectable_item_rewards.end(); map_itr++) {
  711. vector<Item*>::iterator itr;
  712. for (itr = map_itr->second.begin(); itr != map_itr->second.end(); itr++) {
  713. safe_delete(*itr);
  714. }
  715. }
  716. pending_selectable_item_rewards.clear();
  717. }
  718. else {
  719. if (pending_selectable_item_rewards.count(source_id) > 0) {
  720. vector<Item*>::iterator itr;
  721. for (itr = pending_selectable_item_rewards[source_id].begin(); itr != pending_selectable_item_rewards[source_id].end(); itr++) {
  722. safe_delete(*itr);
  723. }
  724. pending_selectable_item_rewards.erase(source_id);
  725. }
  726. }
  727. }
  728. }
  729. void ClearPendingItemRewards() { //the client doesn't send any reference to where the pending rewards came from, so if they collect one, we should just them all of them at once
  730. if (pending_item_rewards.size() > 0) {
  731. vector<Item*>::iterator itr;
  732. for (itr = pending_item_rewards.begin(); itr != pending_item_rewards.end(); itr++) {
  733. safe_delete(*itr);
  734. }
  735. pending_item_rewards.clear();
  736. }
  737. }
  738. void RemoveSpellBookEntry(int32 spell_id, bool remove_passives_from_list = true);
  739. void ResortSpellBook(int32 sort_by, int32 order, int32 pattern, int32 maxlvl_only, int32 book_type);
  740. static bool SortSpellEntryByName(SpellBookEntry* s1, SpellBookEntry* s2);
  741. static bool SortSpellEntryByCategory(SpellBookEntry* s1, SpellBookEntry* s2);
  742. static bool SortSpellEntryByLevel(SpellBookEntry* s1, SpellBookEntry* s2);
  743. static bool SortSpellEntryByNameReverse(SpellBookEntry* s1, SpellBookEntry* s2);
  744. static bool SortSpellEntryByCategoryReverse(SpellBookEntry* s1, SpellBookEntry* s2);
  745. static bool SortSpellEntryByLevelReverse(SpellBookEntry* s1, SpellBookEntry* s2);
  746. int8 GetSpellSlot(int32 spell_id);
  747. void AddTitle(sint32 title_id, const char *name, int8 prefix, bool save_needed = false);
  748. void AddAAEntry(int16 template_id, int8 tab_id, int32 aa_id, int16 order, int8 treeid);
  749. PlayerTitlesList* GetPlayerTitles() { return &player_titles_list; }
  750. void AddLanguage(int32 id, const char *name, bool save_needed = false);
  751. PlayerLanguagesList* GetPlayerLanguages() { return &player_languages_list; }
  752. bool HasLanguage(int32 id);
  753. bool HasLanguage(const char* name);
  754. bool CanReceiveQuest(int32 quest_id);
  755. float GetBoatX() { if (info) return info->GetBoatX(); return 0; }
  756. float GetBoatY() { if (info) return info->GetBoatY(); return 0; }
  757. float GetBoatZ() { if (info) return info->GetBoatZ(); return 0; }
  758. int32 GetBoatSpawn() { if (info) return info->GetBoatSpawn(); return 0; }
  759. void SetBoatX(float x) { if (info) info->SetBoatX(x); }
  760. void SetBoatY(float y) { if (info) info->SetBoatY(y); }
  761. void SetBoatZ(float z) { if (info) info->SetBoatZ(z); }
  762. void SetBoatSpawn(Spawn* boat) { if (info) info->SetBoatSpawn(boat); }
  763. Mutex* GetGroupBuffMutex();
  764. void SetPendingDeletion(bool val) { pending_deletion = val; }
  765. bool GetPendingDeletion() { return pending_deletion; }
  766. float GetPosPacketSpeed() { return pos_packet_speed; }
  767. bool ControlFlagsChanged();
  768. void SetPlayerControlFlag(int8 param, int8 param_value, bool is_active);
  769. void SendControlFlagUpdates(Client* client);
  770. /// <summary>Casts all the passive spells for the player, only call after zoning is complete.</summary>
  771. void ApplyPassiveSpells();
  772. /// <summary>Removes all passive spell effects from the player and clears the passive list</summary>
  773. void RemoveAllPassives();
  774. /// <summary>Gets the current recipie ID</summary>
  775. int32 GetCurrentRecipe() { return current_recipe; }
  776. /// <summary>Sets the current recipie ID</summary>
  777. /// <param name="val">Id of the new recipe</param>
  778. void SetCurrentRecipe(int32 val) { current_recipe = val; }
  779. /// <summary>Reset the pet window info</summary>
  780. void ResetPetInfo();
  781. void ProcessCombat();
  782. /* Character history stuff */
  783. /// <summary>Adds a new history event to the player</summary>
  784. /// <param name="type">The history type</param>
  785. /// <param name="subtype">The history sub type</param>
  786. /// <param name="value">The first history value</param>
  787. /// <param name="value2">The second history value</param>
  788. void UpdatePlayerHistory(int8 type, int8 subtype, int32 value, int32 value2 = 0);
  789. /// <summary>Checks to see if the player has discovered the location</summary>
  790. /// <param name="locationID">The ID of the location to check</param>
  791. /// <returns>True if the player has discovered the location</returns>
  792. bool DiscoveredLocation(int32 locationID);
  793. /// <summary>Load the players history from the database</summary>
  794. /// <param name="type">The history type</param>
  795. /// <param name="subtype">The history sub type</param>
  796. /// <param name="hd">The history data</param>
  797. void LoadPlayerHistory(int8 type, int8 subtype, HistoryData* hd);
  798. /// <summary>Save the player's history to the database</summary>
  799. void SaveHistory();
  800. /* New functions for spell locking and unlocking*/
  801. /// <summary>Lock all Spells, Combat arts, and Abilities (not trade skill spells)</summary>
  802. void LockAllSpells();
  803. /// <summary>Unlocks all Spells, Combat arts, and Abilities (not trade skill spells)</summary>
  804. void UnlockAllSpells(bool modify_recast = false, Spell* exception = 0);
  805. /// <summary>Locks the given spell as well as all spells with a shared timer</summary>
  806. void LockSpell(Spell* spell, int16 recast);
  807. /// <summary>Unlocks the given spell as well as all spells with shared timers</summary>
  808. void UnlockSpell(Spell* spell);
  809. /// <summary>Locks all ts spells and unlocks all normal spells</summary>
  810. void LockTSSpells();
  811. /// <summary>Unlocks all ts spells and locks all normal spells</summary>
  812. void UnlockTSSpells();
  813. /// <summary>Queue the given spell</summary>
  814. void QueueSpell(Spell* spell);
  815. /// <summary>Unqueue the given spell</summary>
  816. void UnQueueSpell(Spell* spell);
  817. ///<summary>Get all the spells the player has with the given id</summary>
  818. vector<Spell*> GetSpellBookSpellsByTimer(int32 timerID);
  819. PacketStruct* GetQuestJournalPacket(Quest* quest, int16 version, int32 crc, bool updated = true);
  820. void SetSpawnInfoStruct(PacketStruct* packet) { safe_delete(spawn_info_struct); spawn_info_struct = packet; }
  821. void SetSpawnVisStruct(PacketStruct* packet) { safe_delete(spawn_vis_struct); spawn_vis_struct = packet; }
  822. void SetSpawnPosStruct(PacketStruct* packet) { safe_delete(spawn_pos_struct); spawn_pos_struct = packet; }
  823. void SetSpawnHeaderStruct(PacketStruct* packet) { safe_delete(spawn_header_struct); spawn_header_struct = packet; }
  824. void SetSpawnFooterStruct(PacketStruct* packet) { safe_delete(spawn_footer_struct); spawn_footer_struct = packet; }
  825. void SetSignFooterStruct(PacketStruct* packet) { safe_delete(sign_footer_struct); sign_footer_struct = packet; }
  826. void SetWidgetFooterStruct(PacketStruct* packet) { safe_delete(widget_footer_struct); widget_footer_struct = packet; }
  827. PacketStruct* GetSpawnInfoStruct() { return spawn_info_struct; }
  828. PacketStruct* GetSpawnVisStruct() { return spawn_vis_struct; }
  829. PacketStruct* GetSpawnPosStruct() { return spawn_pos_struct; }
  830. PacketStruct* GetSpawnHeaderStruct() { return spawn_header_struct; }
  831. PacketStruct* GetSpawnFooterStruct() { return spawn_footer_struct; }
  832. PacketStruct* GetSignFooterStruct() { return sign_footer_struct; }
  833. PacketStruct* GetWidgetFooterStruct() { return widget_footer_struct; }
  834. Mutex info_mutex;
  835. Mutex pos_mutex;
  836. Mutex vis_mutex;
  837. Mutex index_mutex;
  838. void SetTempMount(int32 id) { tmp_mount_model = id; }
  839. int32 GetTempMount() { return tmp_mount_model; }
  840. void SetTempMountColor(EQ2_Color* color) { tmp_mount_color = *color; }
  841. EQ2_Color GetTempMountColor() { return tmp_mount_color; }
  842. void SetTempMountSaddleColor(EQ2_Color* color) { tmp_mount_saddle_color = *color; }
  843. EQ2_Color GetTempMountSaddleColor() { return tmp_mount_saddle_color; }
  844. void LoadLUAHistory(int32 event_id, LUAHistory* history);
  845. void SaveLUAHistory();
  846. void UpdateLUAHistory(int32 event_id, int32 value, int32 value2);
  847. LUAHistory* GetLUAHistory(int32 event_id);
  848. bool HasGMVision() { return gm_vision; }
  849. void SetGMVision(bool val) { gm_vision = val; }
  850. void StopCombat(int8 type=0) {
  851. switch(type)
  852. {
  853. case 2:
  854. SetRangeAttack(false);
  855. InCombat(false, true);
  856. break;
  857. default:
  858. InCombat(false);
  859. InCombat(false, true);
  860. SetRangeAttack(false);
  861. break;
  862. }
  863. }
  864. NPC* InstantiateSpiritShard(float origX, float origY, float origZ, float origHeading, int32 origGridID, ZoneServer* origZone);
  865. void DismissAllPets();
  866. void SaveSpellEffects();
  867. void SetSaveSpellEffects(bool val) { stop_save_spell_effects = val; }
  868. AppearanceData SavedApp;
  869. CharFeatures SavedFeatures;
  870. bool custNPC;
  871. Entity* custNPCTarget;
  872. // bot index, spawn id
  873. map<int32, int32> SpawnedBots;
  874. bool StopSaveSpellEffects() { return stop_save_spell_effects; }
  875. private:
  876. bool range_attack;
  877. int16 last_movement_activity;
  878. bool returning_from_ld;
  879. PlayerGroup* group;
  880. float test_x;
  881. float test_y;
  882. float test_z;
  883. int32 test_time;
  884. map<int32, map<int32, bool> > pending_loot_items;
  885. Mutex MSpellsBook;
  886. Mutex MRecipeBook;
  887. Mutex MPlayerQuests;
  888. map<Spawn*, bool> current_quest_flagged;
  889. PlayerFaction factions;
  890. map<int32, Quest*> completed_quests;
  891. bool charsheet_changed;
  892. map<int32, string> spawn_vis_packet_list;
  893. map<int32, string> spawn_info_packet_list;
  894. map<int32, string> spawn_pos_packet_list;
  895. uchar* movement_packet;
  896. uchar* old_movement_packet;
  897. uchar* spell_orig_packet;
  898. uchar* spell_xor_packet;
  899. int16 spell_count;
  900. //float speed;
  901. int16 target_id;
  902. Spawn* combat_target;
  903. int32 char_id;
  904. bool quickbar_updated;
  905. bool fully_logged_in;
  906. bool resurrecting;
  907. PlayerInfo* info;
  908. vector<SpellBookEntry*> spells;
  909. vector<QuickBarItem*> quickbar_items;
  910. map<int32, Statistic*> statistics;
  911. void RemovePlayerStatistics();
  912. map<string, int8> friend_list;
  913. map<string, int8> ignore_list;
  914. bool pending_deletion;
  915. float pos_packet_speed;
  916. PlayerControlFlags control_flags;
  917. map<int32, bool> target_invis_history;
  918. // JA: POI Discoveries
  919. map<int32, vector<int32> > players_poi_list;
  920. // Jabantiz: Passive spell list, just stores spell id's
  921. vector<int32> passive_spells;
  922. /// <summary>Adds a new passive spell to the list</summary>
  923. /// <param name='id'>Spell id to add</param>
  924. /// <param name='tier'>Tier of spell to add</param>
  925. void AddPassiveSpell(int32 id, int8 tier);
  926. /// <summary>Removes a passive spell from the list</summary>
  927. /// <param name='id'>Spell id to remove</param>
  928. /// <param name='tier'>Tier of spell to remove</param>
  929. /// <param name='remove_from_list'>Remove the spell from this players passive list, default true</param>
  930. void RemovePassive(int32 id, int8 tier, bool remove_from_list = true);
  931. CharacterInstances character_instances;
  932. string away_message;
  933. string biography;
  934. MutexMap<int32, Mail*> mail_list;
  935. bool is_tracking;
  936. Guild* guild;
  937. PlayerCollectionList collection_list;
  938. Collection * pending_collection_reward;
  939. vector<Item*> pending_item_rewards;
  940. map<int32, vector<Item*>> pending_selectable_item_rewards;
  941. PlayerTitlesList player_titles_list;
  942. PlayerRecipeList recipe_list;
  943. PlayerLanguagesList player_languages_list;
  944. PlayerRecipeBookList recipebook_list;
  945. PlayerAchievementList achievement_list;
  946. PlayerAchievementUpdateList achievement_update_list;
  947. // Need to keep track of the recipe the player is crafting as not all crafting packets have this info
  948. int32 current_recipe;
  949. void HandleHistoryNone(int8 subtype, int32 value, int32 value2);
  950. void HandleHistoryDeath(int8 subtype, int32 value, int32 value2);
  951. void HandleHistoryDiscovery(int8 subtype, int32 value, int32 value2);
  952. void HandleHistoryXP(int8 subtype, int32 value, int32 value2);
  953. /// <summary></summary>
  954. void ModifySpellStatus(SpellBookEntry* spell, sint16 value, bool modify_recast = true, int16 recast = 0);
  955. void AddSpellStatus(SpellBookEntry* spell, sint16 value, bool modify_recast = true, int16 recast = 0);
  956. void RemoveSpellStatus(SpellBookEntry* spell, sint16 value, bool modify_recast = true, int16 recast = 0);
  957. void InitXPTable();
  958. map<int8, int32> m_levelXPReq;
  959. //The following variables are for serializing spawn packets
  960. PacketStruct* spawn_pos_struct;
  961. PacketStruct* spawn_info_struct;
  962. PacketStruct* spawn_vis_struct;
  963. PacketStruct* spawn_header_struct;
  964. PacketStruct* spawn_footer_struct;
  965. PacketStruct* sign_footer_struct;
  966. PacketStruct* widget_footer_struct;
  967. uchar* spawn_tmp_vis_xor_packet;
  968. uchar* spawn_tmp_pos_xor_packet;
  969. uchar* spawn_tmp_info_xor_packet;
  970. int32 vis_xor_size;
  971. int32 pos_xor_size;
  972. int32 info_xor_size;
  973. // Character history, map<type, map<subtype, vector<data> > >
  974. map<int8, map<int8, vector<HistoryData*> > > m_characterHistory;
  975. map<int32, LUAHistory*> m_charLuaHistory;
  976. Mutex mLUAHistory;
  977. int32 tmp_mount_model;
  978. EQ2_Color tmp_mount_color;
  979. EQ2_Color tmp_mount_saddle_color;
  980. bool gm_vision;
  981. bool stop_save_spell_effects;
  982. map<int32, Spawn*> player_spawn_id_map;
  983. map<Spawn*, int32> player_spawn_reverse_id_map;
  984. map<Spawn*, int8> player_removed_spawns;
  985. };
  986. #pragma pack()
  987. #endif