Player.h 42 KB

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