9
3

Player.h 41 KB

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