Player.h 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102
  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. Player* player;
  151. bool visible;
  152. };
  153. #define QUICKBAR_NORMAL 1
  154. #define QUICKBAR_INV_SLOT 2
  155. #define QUICKBAR_MACRO 3
  156. #define QUICKBAR_TEXT_CMD 4
  157. #define QUICKBAR_ITEM 6
  158. #define EXP_DISABLED_STATE 0
  159. #define EXP_ENABLED_STATE 1
  160. #define MELEE_COMBAT_STATE 16
  161. #define RANGE_COMBAT_STATE 32
  162. struct QuickBarItem{
  163. bool deleted;
  164. int32 hotbar;
  165. int32 slot;
  166. int32 type;
  167. int16 icon;
  168. int16 icon_type;
  169. int32 id;
  170. int8 tier;
  171. int32 unique_id;
  172. EQ2_16BitString text;
  173. };
  174. struct LoginAppearances {
  175. bool deleted;
  176. int16 equip_type;
  177. int8 red;
  178. int8 green;
  179. int8 blue;
  180. int8 h_red;
  181. int8 h_green;
  182. int8 h_blue;
  183. bool update_needed;
  184. };
  185. class PlayerLoginAppearance {
  186. public:
  187. PlayerLoginAppearance() { appearanceList = new map<int8, LoginAppearances>; }
  188. ~PlayerLoginAppearance() { }
  189. void AddEquipmentToUpdate(int8 slot_id, LoginAppearances* equip)
  190. {
  191. //LoginAppearances data;
  192. //data.equip_type = equip->equip_type;
  193. //appearanceList[slot_id] = data;
  194. }
  195. void DeleteEquipmentFromUpdate(int8 slot_id, LoginAppearances* equip)
  196. {
  197. //LoginAppearances data;
  198. //data.deleted = equip->deleted;
  199. //data.update_needed = true;
  200. //appearanceList[slot_id] = data;
  201. }
  202. void RemoveEquipmentUpdates()
  203. {
  204. appearanceList->clear();
  205. safe_delete(appearanceList);
  206. }
  207. private:
  208. map<int8, LoginAppearances>* appearanceList;
  209. };
  210. struct InstanceData{
  211. int32 db_id;
  212. int32 instance_id;
  213. int32 zone_id;
  214. int8 zone_instance_type;
  215. string zone_name;
  216. int32 last_success_timestamp;
  217. int32 last_failure_timestamp;
  218. int32 success_lockout_time;
  219. int32 failure_lockout_time;
  220. };
  221. class CharacterInstances {
  222. public:
  223. CharacterInstances();
  224. ~CharacterInstances();
  225. ///<summary>Adds an instance data to the player with the given data</summary>
  226. ///<param name='db_id'>The unique id for this record in the database</param>
  227. ///<param name='instance_id'>The id of the instance</param>
  228. ///<param name='last_success_timestamp'>The success timestamp</param>
  229. ///<param name='last_failure_timestamp'>The failure timestamp</param>
  230. ///<param name='success_lockout_time'>The lockout time, in secs, for completing the instance</param>
  231. ///<param name='failure_lockout_time'>The lockout time, in secs, for failing the instance</param>
  232. ///<param name='zone_id'>The id of the zone</param>
  233. ///<param name='zone_instancetype'>The type of instance of the zone</param>
  234. ///<param name='zone_name'>The name of the zone</param>
  235. 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);
  236. ///<summary>Clears all instance data</summary>
  237. void RemoveInstances();
  238. ///<summary>Removes the instace with the given zone id</summary>
  239. ///<param name='zone_id'>The zone id of the instance to remove</param>
  240. ///<returns>True if the instance was found and removed</returns>
  241. bool RemoveInstanceByZoneID(int32 zone_id);
  242. ///<summary>Removes the instance with the given instance id</summary>
  243. ///<param name='instance_id'>the instance id of the instance to remove</param>
  244. ///<returns>True if instance was found and removed</returns>
  245. bool RemoveInstanceByInstanceID(int32 instance_id);
  246. ///<summary>Gets the instance with the given zone id</summary>
  247. ///<param name='zone_id'>The zone id of the instance to get</param>
  248. ///<returns>InstanceData* of the instance record for the given zone id</returns>
  249. InstanceData* FindInstanceByZoneID(int32 zone_id);
  250. ///<summary>Gets the instance with the given database id</summary>
  251. ///<param name='db_id'>The database id of the instance to get</param>
  252. ///<returns>InstanceData* of the instance record for the given database id</returns>
  253. InstanceData* FindInstanceByDBID(int32 db_id);
  254. ///<summary>Gets the instance with the given instance id</summary>
  255. ///<param name='instance_id'>The instance id of the instance to get</param>
  256. ///<returns>InstanceData* of the instance record for the given instance id</returns>
  257. InstanceData* FindInstanceByInstanceID(int32 instance_id);
  258. ///<summary>Gets a list of all the lockout instances</summary>
  259. vector<InstanceData> GetLockoutInstances();
  260. ///<summary>Gets a list of all the persistent instances</summary>
  261. vector<InstanceData> GetPersistentInstances();
  262. ///<summary>Check the timers for the instances</summary>
  263. ///<param name='player'>player we are checking the timers for</param>
  264. void ProcessInstanceTimers(Player* player);
  265. ///<summary>Gets the total number of instances</summary>
  266. int32 GetInstanceCount();
  267. private:
  268. vector<InstanceData> instanceList;
  269. Mutex m_instanceList;
  270. };
  271. class Player;
  272. struct PlayerGroup;
  273. struct GroupMemberInfo;
  274. struct Statistic;
  275. struct Mail;
  276. class PlayerInfo {
  277. public:
  278. ~PlayerInfo();
  279. PlayerInfo(Player* in_player);
  280. EQ2Packet* serialize(int16 version, int16 modifyPos = 0, int32 modifyValue = 0);
  281. PacketStruct* serialize2(int16 version);
  282. EQ2Packet* serialize3(PacketStruct* packet, int16 version);
  283. EQ2Packet* serializePet(int16 version);
  284. void CalculateXPPercentages();
  285. void CalculateTSXPPercentages();
  286. void SetHouseZone(int32 id);
  287. void SetBindZone(int32 id);
  288. void SetBindX(float x);
  289. void SetBindY(float y);
  290. void SetBindZ(float z);
  291. void SetBindHeading(float heading);
  292. void SetAccountAge(int16 days);
  293. int32 GetHouseZoneID();
  294. int32 GetBindZoneID();
  295. float GetBindZoneX();
  296. float GetBindZoneY();
  297. float GetBindZoneZ();
  298. float GetBindZoneHeading();
  299. float GetBoatX() { return boat_x_offset; }
  300. float GetBoatY() { return boat_y_offset; }
  301. float GetBoatZ() { return boat_z_offset; }
  302. int32 GetBoatSpawn();
  303. void SetBoatX(float x) { boat_x_offset = x; }
  304. void SetBoatY(float y) { boat_y_offset = y; }
  305. void SetBoatZ(float z) { boat_z_offset = z; }
  306. void SetBoatSpawn(Spawn* boat);
  307. void RemoveOldPackets();
  308. private:
  309. int32 house_zone_id;
  310. int32 bind_zone_id;
  311. float bind_x;
  312. float bind_y;
  313. float bind_z;
  314. float bind_heading;
  315. uchar* changes;
  316. uchar* orig_packet;
  317. uchar* pet_changes;
  318. uchar* pet_orig_packet;
  319. InfoStruct* info_struct;
  320. Player* player;
  321. float boat_x_offset;
  322. float boat_y_offset;
  323. float boat_z_offset;
  324. int32 boat_spawn;
  325. };
  326. class PlayerControlFlags{
  327. public:
  328. PlayerControlFlags();
  329. ~PlayerControlFlags();
  330. void SetPlayerControlFlag(int8 param, int8 param_value, bool is_active);
  331. bool ControlFlagsChanged();
  332. void SendControlFlagUpdates(Client* client);
  333. private:
  334. bool flags_changed;
  335. map<int8, map<int8, int8> > flag_changes;
  336. map<int8, map<int8, bool> > current_flags;
  337. Mutex MControlFlags;
  338. Mutex MFlagChanges;
  339. };
  340. class Player : public Entity{
  341. public:
  342. Player();
  343. virtual ~Player();
  344. EQ2Packet* serialize(Player* player, int16 version);
  345. //int8 GetMaxArtLevel(){ return info->GetInfo()->max_art_level; }
  346. //int8 GetArtLevel(){ return info->GetInfo()->art_level; }
  347. Client* GetClient() { return client; }
  348. void SetClient(Client* client) { this->client = client; }
  349. PlayerInfo* GetPlayerInfo();
  350. void SetCharSheetChanged(bool val);
  351. bool GetCharSheetChanged();
  352. void AddFriend(const char* name, bool save);
  353. bool IsFriend(const char* name);
  354. void RemoveFriend(const char* name);
  355. map<string, int8>* GetFriends();
  356. void AddIgnore(const char* name, bool save);
  357. bool IsIgnored(const char* name);
  358. void RemoveIgnore(const char* name);
  359. map<string, int8>* GetIgnoredPlayers();
  360. // JA: POI Discoveries
  361. map<int32, vector<int32> >* GetPlayerDiscoveredPOIs();
  362. void AddPlayerDiscoveredPOI(int32 location_id);
  363. //
  364. EQ2Packet* Move(float x, float y, float z, int16 version, float heading = -1.0f);
  365. /*void SetMaxArtLevel(int8 new_max){
  366. max_art_level = new_max;
  367. }
  368. void SetArtLevel(int8 new_lvl){
  369. art_level = new_lvl;
  370. }*/
  371. bool WasSentSpawn(int32 spawn_id);
  372. bool NeedsSpawnResent(Spawn* spawn);
  373. void SetSideSpeed(float side_speed, bool updateFlags = true) {
  374. SetPos(&appearance.pos.SideSpeed, side_speed, updateFlags);
  375. }
  376. float GetSideSpeed() {
  377. return appearance.pos.SideSpeed;
  378. }
  379. int8 GetTutorialStep() {
  380. return tutorial_step;
  381. }
  382. void SetTutorialStep(int8 val) {
  383. tutorial_step = val;
  384. }
  385. void AddMaintainedSpell(LuaSpell* spell);
  386. void AddSpellEffect(LuaSpell* spell);
  387. void RemoveMaintainedSpell(LuaSpell* spell);
  388. void RemoveSpellEffect(LuaSpell* spell);
  389. bool HasActiveMaintainedSpell(Spell* spell, Spawn* target);
  390. bool HasActiveSpellEffect(Spell* spell, Spawn* target);
  391. 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);
  392. void RemoveQuickbarItem(int32 bar, int32 slot, bool update = true);
  393. void MoveQuickbarItem(int32 id, int32 new_slot);
  394. void ClearQuickbarItems();
  395. PlayerItemList* GetPlayerItemList();
  396. PlayerItemList item_list;
  397. PlayerSkillList skill_list;
  398. Skill* GetSkillByName(const char* name, bool check_update = false);
  399. PlayerSkillList* GetSkills();
  400. bool DamageEquippedItems(int8 amount = 10, Client* client = 0);
  401. vector<EQ2Packet*> EquipItem(int16 index, int16 version, int8 slot_id = 255);
  402. bool CanEquipItem(Item* item);
  403. void SetEquippedItemAppearances();
  404. vector<EQ2Packet*> UnequipItem(int16 index, sint32 bag_id, int8 slot, int16 version);
  405. int8 ConvertSlotToClient(int8 slot, int16 version);
  406. int8 ConvertSlotFromClient(int8 slot, int16 version);
  407. EQ2Packet* SwapEquippedItems(int8 slot1, int8 slot2, int16 version);
  408. EQ2Packet* RemoveInventoryItem(int8 bag_slot, int8 slot);
  409. EQ2Packet* SendInventoryUpdate(int16 version);
  410. EQ2Packet* SendBagUpdate(int32 bag_unique_id, int16 version);
  411. void SendQuestRequiredSpawns(int32 quest_id);
  412. void SendHistoryRequiredSpawns(int32 event_id);
  413. map<int32, Item*>* GetItemList();
  414. map<int32, Item*>* GetBankItemList();
  415. vector<Item*>* GetEquippedItemList();
  416. Quest* SetStepComplete(int32 quest_id, int32 step);
  417. Quest* AddStepProgress(int32 quest_id, int32 step, int32 progress);
  418. int32 GetStepProgress(int32 quest_id, int32 step_id);
  419. bool AddItem(Item* item);
  420. bool AddItemToBank(Item* item);
  421. int16 GetSpellSlotMappingCount();
  422. int16 GetSpellPacketCount();
  423. Quest* GetQuest(int32 quest_id);
  424. bool GetQuestStepComplete(int32 quest_id, int32 step_id);
  425. int16 GetQuestStep(int32 quest_id);
  426. int16 GetTaskGroupStep(int32 quest_id);
  427. int8 GetSpellTier(int32 id);
  428. void SetSpellStatus(Spell* spell, int8 status);
  429. void RemoveSpellStatus(Spell* spell, int8 status);
  430. EQ2Packet* GetSpellBookUpdatePacket(int16 version);
  431. EQ2Packet* GetSpellSlotMappingPacket(int16 version);
  432. int32 GetCharacterID();
  433. void SetCharacterID(int32 new_id);
  434. EQ2Packet* GetQuickbarPacket(int16 version);
  435. vector<QuickBarItem*>* GetQuickbar();
  436. bool UpdateQuickbarNeeded();
  437. void ResetQuickbarNeeded();
  438. void set_character_flag(int flag);
  439. void reset_character_flag(int flag);
  440. void toggle_character_flag(int flag);
  441. bool get_character_flag(int flag);
  442. void AddCoins(int64 val);
  443. bool RemoveCoins(int64 val);
  444. /// <summary>Checks to see if the player has the given amount of coins</summary>
  445. /// <param name="val">Amount of coins to check</param>
  446. /// <returns>True if the player has enough coins</returns>
  447. bool HasCoins(int64 val);
  448. void AddSkill(int32 skill_id, int16 current_val, int16 max_val, bool save_needed = false);
  449. void RemovePlayerSkill(int32 skill_id, bool save = false);
  450. void RemoveSkillFromDB(Skill* skill, bool save = false);
  451. void AddSpellBookEntry(int32 spell_id, int8 tier, sint32 slot, int32 type, int32 timer, bool save_needed = false);
  452. SpellBookEntry* GetSpellBookSpell(int32 spell_id);
  453. vector<SpellBookEntry*>* GetSpellsSaveNeeded();
  454. sint32 GetFreeSpellBookSlot(int32 type);
  455. /// <summary>Get a vector of spell ids for all spells in the spell book for the given skill</summary>
  456. /// <param name='skill_id'>The id of the skill to check</param>
  457. /// <returns>A vector of int32's of the spell id's</returns>
  458. vector<int32> GetSpellBookSpellIDBySkill(int32 skill_id);
  459. EQ2Packet* MoveInventoryItem(sint32 to_bag_id, int16 from_index, int8 new_slot, int8 charges, int16 version = 1);
  460. bool IsPlayer(){ return true; }
  461. MaintainedEffects* GetFreeMaintainedSpellSlot();
  462. MaintainedEffects* GetMaintainedSpell(int32 id);
  463. MaintainedEffects* GetMaintainedSpellBySlot(int8 slot);
  464. MaintainedEffects* GetMaintainedSpells();
  465. SpellEffects* GetFreeSpellEffectSlot();
  466. SpellEffects* GetSpellEffects();
  467. int32 GetCoinsCopper();
  468. int32 GetCoinsSilver();
  469. int32 GetCoinsGold();
  470. int32 GetCoinsPlat();
  471. int32 GetBankCoinsCopper();
  472. int32 GetBankCoinsSilver();
  473. int32 GetBankCoinsGold();
  474. int32 GetBankCoinsPlat();
  475. float GetXPVitality();
  476. float GetTSXPVitality();
  477. bool AdventureXPEnabled();
  478. bool TradeskillXPEnabled();
  479. void SetNeededXP(int32 val);
  480. void SetNeededXP();
  481. void SetXP(int32 val);
  482. void SetNeededTSXP(int32 val);
  483. void SetNeededTSXP();
  484. void SetTSXP(int32 val);
  485. int32 GetNeededXP();
  486. int32 GetXPDebt();
  487. int32 GetXP();
  488. int32 GetNeededTSXP();
  489. int32 GetTSXP();
  490. bool AddXP(int32 xp_amount);
  491. bool AddTSXP(int32 xp_amount);
  492. bool DoubleXPEnabled();
  493. float CalculateXP(Spawn* victim);
  494. float CalculateTSXP(int8 level);
  495. void InCombat(bool val, bool range = false);
  496. void PrepareIncomingMovementPacket(int32 len, uchar* data, int16 version);
  497. uchar* GetMovementPacketData(){
  498. return movement_packet;
  499. }
  500. void AddSpawnInfoPacketForXOR(int32 spawn_id, uchar* packet, int16 packet_size);
  501. uchar* GetSpawnInfoPacketForXOR(int32 spawn_id);
  502. void AddSpawnVisPacketForXOR(int32 spawn_id, uchar* packet, int16 packet_size);
  503. uchar* GetSpawnVisPacketForXOR(int32 spawn_id);
  504. void AddSpawnPosPacketForXOR(int32 spawn_id, uchar* packet, int16 packet_size);
  505. uchar* GetSpawnPosPacketForXOR(int32 spawn_id);
  506. uchar* GetTempInfoPacketForXOR();
  507. uchar* GetTempVisPacketForXOR();
  508. uchar* GetTempPosPacketForXOR();
  509. uchar* SetTempInfoPacketForXOR(int16 size);
  510. uchar* SetTempVisPacketForXOR(int16 size);
  511. uchar* SetTempPosPacketForXOR(int16 size);
  512. int32 GetTempInfoXorSize() { return info_xor_size; }
  513. int32 GetTempVisXorSize() { return vis_xor_size; }
  514. int32 GetTempPosXorSize() { return pos_xor_size; }
  515. bool CheckPlayerInfo();
  516. void CalculateLocation();
  517. void SetSpawnDeleteTime(int32 id, int32 time);
  518. int32 GetSpawnDeleteTime(int32 id);
  519. void ClearEverything();
  520. bool IsFullyLoggedIn();
  521. void SetFullyLoggedIn(bool val);
  522. bool IsResurrecting();
  523. void SetResurrecting(bool val);
  524. int8 GetArrowColor(int8 spawn_level);
  525. int8 GetTSArrowColor(int8 level);
  526. Spawn* GetSpawnByIndex(int16 index);
  527. int16 GetIndexForSpawn(Spawn* spawn);
  528. bool WasSpawnRemoved(Spawn* spawn);
  529. void RemoveSpawn(Spawn* spawn);
  530. void ClearRemovedSpawn(Spawn* spawn);
  531. bool ShouldSendSpawn(Spawn* spawn);
  532. Client* client = 0;
  533. void SetLevel(int16 level, bool setUpdateFlags = true) {
  534. SetInfo(&appearance.level, level, setUpdateFlags);
  535. SetXP(0);
  536. SetNeededXP();
  537. }
  538. Spawn* GetSpawnWithPlayerID(int32 id){
  539. Spawn* spawn = 0;
  540. index_mutex.readlock(__FUNCTION__, __LINE__);
  541. if (player_spawn_id_map.count(id) > 0)
  542. spawn = player_spawn_id_map[id];
  543. index_mutex.releasereadlock(__FUNCTION__, __LINE__);
  544. return spawn;
  545. }
  546. int32 GetIDWithPlayerSpawn(Spawn* spawn){
  547. int32 id = 0;
  548. index_mutex.readlock(__FUNCTION__, __LINE__);
  549. if (player_spawn_reverse_id_map.count(spawn) > 0)
  550. id = player_spawn_reverse_id_map[spawn];
  551. index_mutex.releasereadlock(__FUNCTION__, __LINE__);
  552. return id;
  553. }
  554. void SetSpawnMap(Spawn* spawn)
  555. {
  556. index_mutex.writelock(__FUNCTION__, __LINE__);
  557. spawn_id += 1;
  558. int32 tmp_id = spawn_id;
  559. player_spawn_id_map[tmp_id] = spawn;
  560. if(player_spawn_reverse_id_map.count(spawn))
  561. player_spawn_reverse_id_map.erase(spawn);
  562. player_spawn_reverse_id_map.insert(make_pair(spawn,tmp_id));
  563. index_mutex.releasewritelock(__FUNCTION__, __LINE__);
  564. }
  565. void SetSpawnMapIndex(Spawn* spawn, int16 index)
  566. {
  567. index_mutex.writelock(__FUNCTION__, __LINE__);
  568. if (player_spawn_map.count(index))
  569. player_spawn_map[index] = spawn;
  570. else
  571. player_spawn_map[index] = spawn;
  572. index_mutex.releasewritelock(__FUNCTION__, __LINE__);
  573. }
  574. int16 SetSpawnMapAndIndex(Spawn* spawn)
  575. {
  576. int16 new_index = 0;
  577. index_mutex.writelock(__FUNCTION__, __LINE__);
  578. spawn_index += 1;
  579. if (spawn_index == 255)
  580. spawn_index += 1; //just so we dont have to worry about overloading
  581. new_index = spawn_index;
  582. if (player_spawn_index_map.count(spawn))
  583. player_spawn_index_map.erase(spawn);
  584. player_spawn_index_map.insert(make_pair(spawn,new_index));
  585. if (player_spawn_map.count(new_index))
  586. player_spawn_map[new_index] = spawn;
  587. else
  588. player_spawn_map.insert(make_pair(new_index, spawn));
  589. index_mutex.releasewritelock(__FUNCTION__, __LINE__);
  590. return new_index;
  591. }
  592. PacketStruct* GetQuestJournalPacket(bool all_quests, int16 version, int32 crc, int32 current_quest_id, bool updated = true);
  593. void RemoveQuest(int32 id, bool delete_quest);
  594. vector<Quest*>* CheckQuestsChatUpdate(Spawn* spawn);
  595. vector<Quest*>* CheckQuestsItemUpdate(Item* item);
  596. vector<Quest*>* CheckQuestsLocationUpdate();
  597. vector<Quest*>* CheckQuestsKillUpdate(Spawn* spawn,bool update = true);
  598. vector<Quest*>* CheckQuestsSpellUpdate(Spell* spell);
  599. void CheckQuestsCraftUpdate(Item* item, int32 qty);
  600. void CheckQuestsHarvestUpdate(Item* item, int32 qty);
  601. vector<Quest*>* CheckQuestsFailures();
  602. bool CheckQuestRemoveFlag(Spawn* spawn);
  603. int8 CheckQuestFlag(Spawn* spawn);
  604. bool CheckQuestRequired(Spawn* spawn);
  605. void AddQuestRequiredSpawn(Spawn* spawn, int32 quest_id);
  606. void AddHistoryRequiredSpawn(Spawn* spawn, int32 event_id);
  607. int16 spawn_index;
  608. int32 spawn_id;
  609. int8 tutorial_step;
  610. map<int32, vector<int32>*> player_spawn_quests_required;
  611. map<int32, vector<int32>*> player_spawn_history_required;
  612. Mutex m_playerSpawnQuestsRequired;
  613. Mutex m_playerSpawnHistoryRequired;
  614. Quest* GetCompletedQuest(int32 quest_id);
  615. void AddCompletedQuest(Quest* quest);
  616. map<int32, Quest*> pending_quests;
  617. map<int32, Quest*> player_quests;
  618. map<int32, Quest*>* GetPlayerQuests();
  619. map<int32, Quest*>* GetCompletedPlayerQuests();
  620. void LockQuests();
  621. void UnlockQuests();
  622. void SetFactionValue(int32 faction_id, sint32 value){
  623. factions.SetFactionValue(faction_id, value);
  624. }
  625. PlayerFaction* GetFactions(){
  626. return &factions;
  627. }
  628. vector<int32> GetQuestIDs();
  629. map<int32, int16> macro_icons;
  630. bool HasPendingLootItems(int32 id);
  631. bool HasPendingLootItem(int32 id, int32 item_id);
  632. vector<Item*>* GetPendingLootItems(int32 id);
  633. void RemovePendingLootItem(int32 id, int32 item_id);
  634. void RemovePendingLootItems(int32 id);
  635. void AddPendingLootItems(int32 id, vector<Item*>* items);
  636. bool HasSpell(int32 spell_id, int8 tier = 255, bool include_higher_tiers = false);
  637. bool HasRecipeBook(int32 recipe_id);
  638. void AddPlayerStatistic(int32 stat_id, sint32 stat_value, int32 stat_date);
  639. void UpdatePlayerStatistic(int32 stat_id, sint32 stat_value, bool overwrite = false);
  640. sint64 GetPlayerStatisticValue(int32 stat_id);
  641. void WritePlayerStatistics();
  642. //PlayerGroup* GetGroup();
  643. void SetGroup(PlayerGroup* group);
  644. bool IsGroupMember(Entity* player);
  645. void SetGroupInformation(PacketStruct* packet);
  646. void ResetSavedSpawns();
  647. bool IsReturningFromLD();
  648. void SetReturningFromLD(bool val);
  649. bool CheckLevelStatus(int16 new_level);
  650. int16 GetLastMovementActivity();
  651. void DestroyQuests();
  652. string GetAwayMessage() const { return away_message; }
  653. void SetAwayMessage(string val) { away_message = val; }
  654. void SetRangeAttack(bool val);
  655. bool GetRangeAttack();
  656. ZoneServer* GetGroupMemberInZone(int32 zone_id);
  657. bool AddMail(Mail* mail);
  658. MutexMap<int32, Mail*>* GetMail();
  659. Mail* GetMail(int32 mail_id);
  660. void DeleteMail(bool from_database = false);
  661. void DeleteMail(int32 mail_id, bool from_database = false);
  662. CharacterInstances* GetCharacterInstances() { return &character_instances; }
  663. void SetIsTracking(bool val) { is_tracking = val; }
  664. bool GetIsTracking() const { return is_tracking; }
  665. void SetBiography(string new_biography) { biography = new_biography; }
  666. string GetBiography() const { return biography; }
  667. void SetPlayerAdventureClass(int8 new_class);
  668. void SetGuild(Guild* new_guild) { guild = new_guild; }
  669. Guild* GetGuild() { return guild; }
  670. void AddSkillBonus(int32 spell_id, int32 skill_id, float value);
  671. SkillBonus* GetSkillBonus(int32 spell_id);
  672. virtual void RemoveSkillBonus(int32 spell_id);
  673. virtual bool CanSeeInvis(Entity* target);
  674. bool CheckChangeInvisHistory(Entity* target);
  675. void UpdateTargetInvisHistory(int32 targetID, bool canSeeStatus);
  676. void RemoveTargetInvisHistory(int32 targetID);
  677. bool HasFreeBankSlot();
  678. int8 FindFreeBankSlot();
  679. PlayerCollectionList * GetCollectionList() { return &collection_list; }
  680. PlayerRecipeList * GetRecipeList() { return &recipe_list; }
  681. PlayerRecipeBookList * GetRecipeBookList() { return &recipebook_list; }
  682. PlayerAchievementList * GetAchievementList() { return &achievement_list; }
  683. PlayerAchievementUpdateList * GetAchievementUpdateList() { return &achievement_update_list; }
  684. void SetPendingCollectionReward(Collection *collection) { pending_collection_reward = collection; }
  685. Collection * GetPendingCollectionReward() { return pending_collection_reward; }
  686. void AddPendingSelectableItemReward(int32 source_id, Item* item) {
  687. if (pending_selectable_item_rewards.count(source_id) == 0)
  688. pending_selectable_item_rewards[source_id] = vector<Item*>();
  689. pending_selectable_item_rewards[source_id].push_back(item);
  690. }
  691. void AddPendingItemReward(Item* item) {
  692. pending_item_rewards.push_back(item);
  693. }
  694. bool HasPendingItemRewards() { return (pending_item_rewards.size() > 0 || pending_selectable_item_rewards.size() > 0); }
  695. vector<Item*> GetPendingItemRewards() { return pending_item_rewards; }
  696. 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)
  697. map<int32, Item*> ret;
  698. if (pending_selectable_item_rewards.size() > 0) {
  699. map<int32, vector<Item*>>::iterator map_itr;
  700. for (map_itr = pending_selectable_item_rewards.begin(); map_itr != pending_selectable_item_rewards.end(); map_itr++) {
  701. vector<Item*>::iterator itr;
  702. for (itr = map_itr->second.begin(); itr != map_itr->second.end(); itr++) {
  703. if ((*itr)->details.item_id == item_id) {
  704. ret[map_itr->first] = *itr;
  705. break;
  706. }
  707. }
  708. if (ret.size() > 0)
  709. break;
  710. }
  711. }
  712. return map<int32, Item*>();
  713. }
  714. void ClearPendingSelectableItemRewards(int32 source_id, bool all = false) {
  715. if (pending_selectable_item_rewards.size() > 0) {
  716. map<int32, vector<Item*>>::iterator map_itr;
  717. if (all) {
  718. for (map_itr = pending_selectable_item_rewards.begin(); map_itr != pending_selectable_item_rewards.end(); map_itr++) {
  719. vector<Item*>::iterator itr;
  720. for (itr = map_itr->second.begin(); itr != map_itr->second.end(); itr++) {
  721. safe_delete(*itr);
  722. }
  723. }
  724. pending_selectable_item_rewards.clear();
  725. }
  726. else {
  727. if (pending_selectable_item_rewards.count(source_id) > 0) {
  728. vector<Item*>::iterator itr;
  729. for (itr = pending_selectable_item_rewards[source_id].begin(); itr != pending_selectable_item_rewards[source_id].end(); itr++) {
  730. safe_delete(*itr);
  731. }
  732. pending_selectable_item_rewards.erase(source_id);
  733. }
  734. }
  735. }
  736. }
  737. 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
  738. if (pending_item_rewards.size() > 0) {
  739. vector<Item*>::iterator itr;
  740. for (itr = pending_item_rewards.begin(); itr != pending_item_rewards.end(); itr++) {
  741. safe_delete(*itr);
  742. }
  743. pending_item_rewards.clear();
  744. }
  745. }
  746. void RemoveSpellBookEntry(int32 spell_id, bool remove_passives_from_list = true);
  747. void ResortSpellBook(int32 sort_by, int32 order, int32 pattern, int32 maxlvl_only, int32 book_type);
  748. static bool SortSpellEntryByName(SpellBookEntry* s1, SpellBookEntry* s2);
  749. static bool SortSpellEntryByCategory(SpellBookEntry* s1, SpellBookEntry* s2);
  750. static bool SortSpellEntryByLevel(SpellBookEntry* s1, SpellBookEntry* s2);
  751. static bool SortSpellEntryByNameReverse(SpellBookEntry* s1, SpellBookEntry* s2);
  752. static bool SortSpellEntryByCategoryReverse(SpellBookEntry* s1, SpellBookEntry* s2);
  753. static bool SortSpellEntryByLevelReverse(SpellBookEntry* s1, SpellBookEntry* s2);
  754. int8 GetSpellSlot(int32 spell_id);
  755. void AddTitle(int32 title_id, const char *name, int8 prefix, bool save_needed = false);
  756. void AddAAEntry(int16 template_id, int8 tab_id, int32 aa_id, int16 order, int8 treeid);
  757. PlayerTitlesList* GetPlayerTitles() { return &player_titles_list; }
  758. void AddLanguage(int32 id, const char *name, bool save_needed = false);
  759. PlayerLanguagesList* GetPlayerLanguages() { return &player_languages_list; }
  760. bool HasLanguage(int32 id);
  761. bool HasLanguage(const char* name);
  762. bool CanReceiveQuest(int32 quest_id);
  763. float GetBoatX() { if (info) return info->GetBoatX(); return 0; }
  764. float GetBoatY() { if (info) return info->GetBoatY(); return 0; }
  765. float GetBoatZ() { if (info) return info->GetBoatZ(); return 0; }
  766. int32 GetBoatSpawn() { if (info) return info->GetBoatSpawn(); return 0; }
  767. void SetBoatX(float x) { if (info) info->SetBoatX(x); }
  768. void SetBoatY(float y) { if (info) info->SetBoatY(y); }
  769. void SetBoatZ(float z) { if (info) info->SetBoatZ(z); }
  770. void SetBoatSpawn(Spawn* boat) { if (info) info->SetBoatSpawn(boat); }
  771. Mutex* GetGroupBuffMutex();
  772. void SetPendingDeletion(bool val) { pending_deletion = val; }
  773. bool GetPendingDeletion() { return pending_deletion; }
  774. float GetPosPacketSpeed() { return pos_packet_speed; }
  775. bool ControlFlagsChanged();
  776. void SetPlayerControlFlag(int8 param, int8 param_value, bool is_active);
  777. void SendControlFlagUpdates(Client* client);
  778. /// <summary>Casts all the passive spells for the player, only call after zoning is complete.</summary>
  779. void ApplyPassiveSpells();
  780. /// <summary>Removes all passive spell effects from the player and clears the passive list</summary>
  781. void RemoveAllPassives();
  782. /// <summary>Gets the current recipie ID</summary>
  783. int32 GetCurrentRecipe() { return current_recipe; }
  784. /// <summary>Sets the current recipie ID</summary>
  785. /// <param name="val">Id of the new recipe</param>
  786. void SetCurrentRecipe(int32 val) { current_recipe = val; }
  787. /// <summary>Reset the pet window info</summary>
  788. void ResetPetInfo();
  789. void ProcessCombat();
  790. /* Character history stuff */
  791. /// <summary>Adds a new history event to the player</summary>
  792. /// <param name="type">The history type</param>
  793. /// <param name="subtype">The history sub type</param>
  794. /// <param name="value">The first history value</param>
  795. /// <param name="value2">The second history value</param>
  796. void UpdatePlayerHistory(int8 type, int8 subtype, int32 value, int32 value2 = 0);
  797. /// <summary>Checks to see if the player has discovered the location</summary>
  798. /// <param name="locationID">The ID of the location to check</param>
  799. /// <returns>True if the player has discovered the location</returns>
  800. bool DiscoveredLocation(int32 locationID);
  801. /// <summary>Load the players history from the database</summary>
  802. /// <param name="type">The history type</param>
  803. /// <param name="subtype">The history sub type</param>
  804. /// <param name="hd">The history data</param>
  805. void LoadPlayerHistory(int8 type, int8 subtype, HistoryData* hd);
  806. /// <summary>Save the player's history to the database</summary>
  807. void SaveHistory();
  808. /* New functions for spell locking and unlocking*/
  809. /// <summary>Lock all Spells, Combat arts, and Abilities (not trade skill spells)</summary>
  810. void LockAllSpells();
  811. /// <summary>Unlocks all Spells, Combat arts, and Abilities (not trade skill spells)</summary>
  812. void UnlockAllSpells(bool modify_recast = false, Spell* exception = 0);
  813. /// <summary>Locks the given spell as well as all spells with a shared timer</summary>
  814. void LockSpell(Spell* spell, int16 recast);
  815. /// <summary>Unlocks the given spell as well as all spells with shared timers</summary>
  816. void UnlockSpell(Spell* spell);
  817. /// <summary>Locks all ts spells and unlocks all normal spells</summary>
  818. void LockTSSpells();
  819. /// <summary>Unlocks all ts spells and locks all normal spells</summary>
  820. void UnlockTSSpells();
  821. /// <summary>Queue the given spell</summary>
  822. void QueueSpell(Spell* spell);
  823. /// <summary>Unqueue the given spell</summary>
  824. void UnQueueSpell(Spell* spell);
  825. ///<summary>Get all the spells the player has with the given id</summary>
  826. vector<Spell*> GetSpellBookSpellsByTimer(int32 timerID);
  827. PacketStruct* GetQuestJournalPacket(Quest* quest, int16 version, int32 crc, bool updated = true);
  828. void SetSpawnInfoStruct(PacketStruct* packet) { safe_delete(spawn_info_struct); spawn_info_struct = packet; }
  829. void SetSpawnVisStruct(PacketStruct* packet) { safe_delete(spawn_vis_struct); spawn_vis_struct = packet; }
  830. void SetSpawnPosStruct(PacketStruct* packet) { safe_delete(spawn_pos_struct); spawn_pos_struct = packet; }
  831. void SetSpawnHeaderStruct(PacketStruct* packet) { safe_delete(spawn_header_struct); spawn_header_struct = packet; }
  832. void SetSpawnFooterStruct(PacketStruct* packet) { safe_delete(spawn_footer_struct); spawn_footer_struct = packet; }
  833. void SetSignFooterStruct(PacketStruct* packet) { safe_delete(sign_footer_struct); sign_footer_struct = packet; }
  834. void SetWidgetFooterStruct(PacketStruct* packet) { safe_delete(widget_footer_struct); widget_footer_struct = packet; }
  835. PacketStruct* GetSpawnInfoStruct() { return spawn_info_struct; }
  836. PacketStruct* GetSpawnVisStruct() { return spawn_vis_struct; }
  837. PacketStruct* GetSpawnPosStruct() { return spawn_pos_struct; }
  838. PacketStruct* GetSpawnHeaderStruct() { return spawn_header_struct; }
  839. PacketStruct* GetSpawnFooterStruct() { return spawn_footer_struct; }
  840. PacketStruct* GetSignFooterStruct() { return sign_footer_struct; }
  841. PacketStruct* GetWidgetFooterStruct() { return widget_footer_struct; }
  842. Mutex info_mutex;
  843. Mutex pos_mutex;
  844. Mutex vis_mutex;
  845. Mutex index_mutex;
  846. void SetTempMount(int32 id) { tmp_mount_model = id; }
  847. int32 GetTempMount() { return tmp_mount_model; }
  848. void SetTempMountColor(EQ2_Color* color) { tmp_mount_color = *color; }
  849. EQ2_Color GetTempMountColor() { return tmp_mount_color; }
  850. void SetTempMountSaddleColor(EQ2_Color* color) { tmp_mount_saddle_color = *color; }
  851. EQ2_Color GetTempMountSaddleColor() { return tmp_mount_saddle_color; }
  852. void LoadLUAHistory(int32 event_id, LUAHistory* history);
  853. void SaveLUAHistory();
  854. void UpdateLUAHistory(int32 event_id, int32 value, int32 value2);
  855. LUAHistory* GetLUAHistory(int32 event_id);
  856. bool HasGMVision() { return gm_vision; }
  857. void SetGMVision(bool val) { gm_vision = val; }
  858. AppearanceData SavedApp;
  859. CharFeatures SavedFeatures;
  860. bool custNPC;
  861. Entity* custNPCTarget;
  862. // bot index, spawn id
  863. map<int32, int32> SpawnedBots;
  864. private:
  865. bool range_attack;
  866. int16 last_movement_activity;
  867. bool returning_from_ld;
  868. PlayerGroup* group;
  869. float test_x;
  870. float test_y;
  871. float test_z;
  872. int32 test_time;
  873. map<int32, map<int32, bool> > pending_loot_items;
  874. Mutex MSpellsBook;
  875. Mutex MRecipeBook;
  876. Mutex MPlayerQuests;
  877. map<Spawn*, bool> current_quest_flagged;
  878. PlayerFaction factions;
  879. map<int32, Quest*> completed_quests;
  880. bool charsheet_changed;
  881. map<int32, string> spawn_vis_packet_list;
  882. map<int32, string> spawn_info_packet_list;
  883. map<int32, string> spawn_pos_packet_list;
  884. uchar* movement_packet;
  885. uchar* old_movement_packet;
  886. uchar* spell_orig_packet;
  887. uchar* spell_xor_packet;
  888. int16 spell_count;
  889. //float speed;
  890. int16 target_id;
  891. Spawn* combat_target;
  892. int32 char_id;
  893. bool quickbar_updated;
  894. bool fully_logged_in;
  895. bool resurrecting;
  896. PlayerInfo* info;
  897. vector<SpellBookEntry*> spells;
  898. vector<QuickBarItem*> quickbar_items;
  899. map<int32, Statistic*> statistics;
  900. void RemovePlayerStatistics();
  901. map<string, int8> friend_list;
  902. map<string, int8> ignore_list;
  903. bool pending_deletion;
  904. float pos_packet_speed;
  905. PlayerControlFlags control_flags;
  906. map<int32, bool> target_invis_history;
  907. // JA: POI Discoveries
  908. map<int32, vector<int32> > players_poi_list;
  909. // Jabantiz: Passive spell list, just stores spell id's
  910. vector<int32> passive_spells;
  911. /// <summary>Adds a new passive spell to the list</summary>
  912. /// <param name='id'>Spell id to add</param>
  913. /// <param name='tier'>Tier of spell to add</param>
  914. void AddPassiveSpell(int32 id, int8 tier);
  915. /// <summary>Removes a passive spell from the list</summary>
  916. /// <param name='id'>Spell id to remove</param>
  917. /// <param name='tier'>Tier of spell to remove</param>
  918. /// <param name='remove_from_list'>Remove the spell from this players passive list, default true</param>
  919. void RemovePassive(int32 id, int8 tier, bool remove_from_list = true);
  920. CharacterInstances character_instances;
  921. string away_message;
  922. string biography;
  923. MutexMap<int32, Mail*> mail_list;
  924. bool is_tracking;
  925. Guild* guild;
  926. PlayerCollectionList collection_list;
  927. Collection * pending_collection_reward;
  928. vector<Item*> pending_item_rewards;
  929. map<int32, vector<Item*>> pending_selectable_item_rewards;
  930. PlayerTitlesList player_titles_list;
  931. PlayerRecipeList recipe_list;
  932. PlayerLanguagesList player_languages_list;
  933. PlayerRecipeBookList recipebook_list;
  934. PlayerAchievementList achievement_list;
  935. PlayerAchievementUpdateList achievement_update_list;
  936. // Need to keep track of the recipe the player is crafting as not all crafting packets have this info
  937. int32 current_recipe;
  938. void HandleHistoryNone(int8 subtype, int32 value, int32 value2);
  939. void HandleHistoryDeath(int8 subtype, int32 value, int32 value2);
  940. void HandleHistoryDiscovery(int8 subtype, int32 value, int32 value2);
  941. void HandleHistoryXP(int8 subtype, int32 value, int32 value2);
  942. /// <summary></summary>
  943. void ModifySpellStatus(SpellBookEntry* spell, sint16 value, bool modify_recast = true, int16 recast = 0);
  944. void AddSpellStatus(SpellBookEntry* spell, sint16 value, bool modify_recast = true, int16 recast = 0);
  945. void RemoveSpellStatus(SpellBookEntry* spell, sint16 value, bool modify_recast = true, int16 recast = 0);
  946. void InitXPTable();
  947. map<int8, int32> m_levelXPReq;
  948. //The following variables are for serializing spawn packets
  949. PacketStruct* spawn_pos_struct;
  950. PacketStruct* spawn_info_struct;
  951. PacketStruct* spawn_vis_struct;
  952. PacketStruct* spawn_header_struct;
  953. PacketStruct* spawn_footer_struct;
  954. PacketStruct* sign_footer_struct;
  955. PacketStruct* widget_footer_struct;
  956. uchar* spawn_tmp_vis_xor_packet;
  957. uchar* spawn_tmp_pos_xor_packet;
  958. uchar* spawn_tmp_info_xor_packet;
  959. int32 vis_xor_size;
  960. int32 pos_xor_size;
  961. int32 info_xor_size;
  962. // Character history, map<type, map<subtype, vector<data> > >
  963. map<int8, map<int8, vector<HistoryData*> > > m_characterHistory;
  964. map<int32, LUAHistory*> m_charLuaHistory;
  965. Mutex mLUAHistory;
  966. int32 tmp_mount_model;
  967. EQ2_Color tmp_mount_color;
  968. EQ2_Color tmp_mount_saddle_color;
  969. bool gm_vision;
  970. map<Spawn*, int16> player_spawn_index_map;
  971. map<int16, Spawn*> player_spawn_map;
  972. map<int32, Spawn*> player_spawn_id_map;
  973. map<Spawn*, int32> player_spawn_reverse_id_map;
  974. map<Spawn*, int8> player_removed_spawns;
  975. };
  976. #pragma pack()
  977. #endif