client.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  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 CLIENT_H
  17. #define CLIENT_H
  18. #include "../common/EQStream.h"
  19. #include <list>
  20. #include "../common/timer.h"
  21. #include "Items/Items.h"
  22. #include "zoneserver.h"
  23. #include "Player.h"
  24. #include "Quests.h"
  25. using namespace std;
  26. #define CLIENT_TIMEOUT 60000
  27. struct TransportDestination;
  28. struct ConversationOption;
  29. #define MAIL_SEND_RESULT_SUCCESS 0
  30. #define MAIL_SEND_RESULT_UNKNOWN_PLAYER 1
  31. #define MAIL_SEND_RESULT_CANNOT_SEND_TO_PLAYER 2
  32. #define MAIL_SEND_RESULT_GIFT_WRONG_SERVER 3 /* Cannot send gifts across worlds */
  33. #define MAIL_SEND_RESULT_CANNOT_SEND_TO_SELF 4
  34. #define MAIL_SEND_RESULT_MAILBOX_FULL 5
  35. #define MAIL_SEND_RESULT_NOT_ENOUGH_COIN 6
  36. #define MAIL_SEND_RESULT_ITEM_IN_BAG 7 /* Cannot send non-empty bags as gifts */
  37. #define MAIL_SEND_RESULT_NOT_IN_GUILD 8
  38. #define MAIL_SEND_RESULT_GUILD_ACCESS_DENIED 9
  39. #define MAIL_SEND_RESULT_GIFTS_TO_GUILD 10 /* Cannot send gifts to entire guild */
  40. #define MAIL_SEND_RESULT_EMPTY_TO_LIST 11 /* Empty recipient list */
  41. #define MAIL_SEND_RESULT_TRIAL_PLAYERS 12 /* Cannot send mail to trial players */
  42. #define MAIL_SEND_RESULT_MAIL_WRONG_SERVER 13 /* Cannot send mail across worlds */
  43. #define MAIL_SEND_RESULT_UNKNOWN_ERROR 14
  44. #define MAIL_TYPE_REGULAR 0
  45. #define MAIL_TYPE_SPAM 1
  46. #define MAIL_TYPE_GM 2
  47. struct QueuedQuest{
  48. Quest* quest;
  49. int32 step;
  50. bool display_quest_helper;
  51. };
  52. struct BuyBackItem{
  53. int32 item_id;
  54. int32 unique_id;
  55. int16 quantity;
  56. int32 price;
  57. bool save_needed;
  58. };
  59. struct MacroData{
  60. string name;
  61. string text;
  62. int16 icon;
  63. };
  64. struct Mail {
  65. int32 mail_id;
  66. int32 player_to_id;
  67. string player_from;
  68. string subject;
  69. string mail_body;
  70. int8 already_read;
  71. int8 mail_type;
  72. int32 coin_copper;
  73. int32 coin_silver;
  74. int32 coin_gold;
  75. int32 coin_plat;
  76. int16 stack;
  77. int32 postage_cost;
  78. int32 attachment_cost;
  79. int32 char_item_id;
  80. int32 time_sent;
  81. int32 expire_time;
  82. int8 save_needed;
  83. };
  84. struct MailWindow {
  85. int32 coin_copper;
  86. int32 coin_silver;
  87. int32 coin_gold;
  88. int32 coin_plat;
  89. int32 char_item_id;
  90. };
  91. struct PendingGuildInvite {
  92. Guild* guild;
  93. Player* invited_by;
  94. };
  95. struct PendingResurrection {
  96. Spawn* caster;
  97. Timer* expire_timer;
  98. string spell_name;
  99. string heal_name;
  100. bool active;
  101. float hp_perc;
  102. float mp_perc;
  103. float range;
  104. int8 crit_mod;
  105. bool no_calcs;
  106. int32 subspell;
  107. bool crit;
  108. bool should_delete;
  109. int32 spell_visual;
  110. };
  111. #define PAPERDOLL_TYPE_FULL 0
  112. #define PAPERDOLL_TYPE_HEAD 1
  113. struct IncomingPaperdollImage {
  114. uchar* image_bytes;
  115. int32 current_size_bytes;
  116. int8 image_num_packets;
  117. int8 last_received_packet_index;
  118. int8 image_type;
  119. };
  120. class Client {
  121. public:
  122. Client(EQStream* ieqs);
  123. ~Client();
  124. bool Process(bool zone_process = false);
  125. void Disconnect(bool send_disconnect = true);
  126. void SetConnected(bool val){ connected = val; }
  127. bool IsConnected(){ return connected; }
  128. bool IsReadyForSpawns(){ return ready_for_spawns; }
  129. bool IsReadyForUpdates() { return ready_for_updates; }
  130. bool IsZoning(){ return client_zoning; }
  131. void SetReadyForUpdates();
  132. void SetReadyForSpawns(bool val);
  133. void QueuePacket(EQ2Packet* app, bool attemptedCombine=false);
  134. void SendLoginInfo();
  135. int8 GetMessageChannelColor(int8 channel_type);
  136. void HandleTellMessage(Client* from, const char* message);
  137. void SimpleMessage(int8 color, const char* message);
  138. void Message(int8 type, const char* message, ...);
  139. void SendSpellUpdate(Spell* spell);
  140. void Zone(ZoneServer* new_zone, bool set_coords = true);
  141. void Zone(const char* new_zone, bool set_coords = true);
  142. void Zone(int32 zoneid, bool set_coords = true);
  143. void Zone(int32 instanceid, bool set_coords = true, bool byInstanceID=false);
  144. void SendZoneInfo();
  145. void SendZoneSpawns();
  146. void HandleVerbRequest(EQApplicationPacket* app);
  147. void SendCharInfo();
  148. void SendLoginDeniedBadVersion();
  149. void SendCharPOVGhost();
  150. void SendPlayerDeathWindow();
  151. float DistanceFrom(Client* client);
  152. void SendDefaultGroupOptions();
  153. bool HandleLootItem(Spawn* entity, int32 item_id);
  154. bool HandleLootItem(Spawn* entity, Item* item);
  155. void HandleLoot(EQApplicationPacket* app);
  156. void HandleSkillInfoRequest(EQApplicationPacket* app);
  157. void HandleExamineInfoRequest(EQApplicationPacket* app);
  158. void HandleQuickbarUpdateRequest(EQApplicationPacket* app);
  159. void SendPopupMessage(int8 unknown, const char* text, const char* type, float size, int8 red, int8 green, int8 blue);
  160. void PopulateSkillMap();
  161. void ChangeLevel(int16 old_level, int16 new_level);
  162. void ChangeTSLevel(int16 old_level, int16 new_level);
  163. bool Summon(const char* search_name);
  164. bool TryZoneInstance(int32 zoneID, bool zone_coords_valid=false);
  165. bool GotoSpawn(const char* search_name, bool forceTarget=false);
  166. void DisplayDeadWindow();
  167. void HandlePlayerRevive(int32 point_id);
  168. void Bank(Spawn* banker, bool cancel = false);
  169. void BankWithdrawal(int64 amount);
  170. void BankDeposit(int64 amount);
  171. Spawn* GetBanker();
  172. void SetBanker(Spawn* in_banker);
  173. bool AddItem(int32 item_id, int16 quantity = 0);
  174. bool AddItem(Item* item);
  175. bool AddItemToBank(int32 item_id, int16 quantity = 0);
  176. bool AddItemToBank(Item* item);
  177. bool RemoveItem(Item *item, int16 quantity);
  178. void ProcessTeleport(Spawn* spawn, vector<TransportDestination*>* destinations, int32 transport_id = 0);
  179. void ProcessTeleportLocation(EQApplicationPacket* app);
  180. void UpdateCharacterInstances();
  181. void SetLastSavedTimeStamp(int32 unixts) { last_saved_timestamp = unixts; }
  182. int32 GetLastSavedTimeStamp() { return last_saved_timestamp; }
  183. bool CheckZoneAccess(const char* zoneName);
  184. ZoneServer* GetCurrentZone();
  185. void SetCurrentZoneByInstanceID(int32 id, int32 zoneid);
  186. //void SetCurrentZoneByInstanceID(instanceid, zoneid);
  187. void SetCurrentZone(int32 id);
  188. void SetCurrentZone(ZoneServer* zone) {
  189. current_zone = zone;
  190. player->SetZone(zone);
  191. }
  192. Player* GetPlayer(){ return player; }
  193. EQStream* getConnection(){ return eqs; }
  194. inline int32 GetIP() { return ip; }
  195. inline int16 GetPort() { return port; }
  196. inline int32 WaitingForBootup() { return pwaitingforbootup; }
  197. inline int32 GetCharacterID() { return character_id; }
  198. inline int32 GetAccountID() { return account_id; }
  199. inline const char* GetAccountName() { return account_name; }
  200. inline sint16 GetAdminStatus() { return admin_status; }
  201. inline int16 GetVersion() { return version; }
  202. void SetNameCRC(int32 val){ name_crc = val; }
  203. int32 GetNameCRC(){ return name_crc; }
  204. void SetVersion(int16 new_version){ version = new_version; }
  205. void SetAccountID(int32 in_accountid) { account_id = in_accountid; }
  206. void SetCharacterID(int32 in_characterid) { character_id = in_characterid; }
  207. void SetAdminStatus(sint16 in_status) { admin_status = in_status; }
  208. void DetermineCharacterUpdates ( );
  209. void UpdateTimeStampFlag ( int8 flagType )
  210. {
  211. if(! (timestamp_flag & flagType ) )
  212. timestamp_flag |= flagType;
  213. }
  214. int8 GetTimeStampFlag ( ) { return timestamp_flag; }
  215. bool UpdateQuickbarNeeded();
  216. void Save();
  217. bool remove_from_list;
  218. void CloseLoot(int32 spawn_id);
  219. void SendPendingLoot(int32 total_coins, Spawn* entity);
  220. void Loot(int32 total_coins, vector<Item*>* items, Spawn* entity);
  221. void Loot(Spawn* entity, bool attemptDisarm=true);
  222. void OpenChest(Spawn* entity, bool attemptDisarm=true);
  223. void CastGroupOrSelf(Entity* source, uint32 spellID, uint32 spellTier=1, float restrictiveRadius=0.0f);
  224. void CheckPlayerQuestsKillUpdate(Spawn* spawn);
  225. void CheckPlayerQuestsChatUpdate(Spawn* spawn);
  226. void CheckPlayerQuestsItemUpdate(Item* item);
  227. void CheckPlayerQuestsSpellUpdate(Spell* spell);
  228. void CheckPlayerQuestsLocationUpdate();
  229. void AddPendingQuest(Quest* quest, bool forced = false);
  230. void AcceptQuest(int32 id);
  231. Quest* GetPendingQuest(int32 id);
  232. void RemovePendingQuest(Quest* quest);
  233. void SetPlayerQuest(Quest* quest, map<int32, int32>* progress);
  234. void AddPlayerQuest(Quest* quest, bool call_accepted = true, bool send_packets = true);
  235. void RemovePlayerQuest(int32 id, bool send_update = true, bool delete_quest = true);
  236. void SendQuestJournal(bool all_quests = false, Client* client = 0, bool updated = true);
  237. void SendQuestUpdate(Quest* quest);
  238. void SendQuestFailure(Quest* quest);
  239. void SendQuestUpdateStep(Quest* quest, int32 step, bool display_quest_helper = true);
  240. void SendQuestUpdateStepImmediately(Quest* quest, int32 step, bool display_quest_helper = true);
  241. void DisplayQuestRewards(Quest* quest, int64 coin, vector<Item*>* rewards=0, vector<Item*>* selectable_rewards=0, map<int32, sint32>* factions=0, const char* header="Quest Reward!", int32 status_points=0, const char* text=0);
  242. void DisplayQuestComplete(Quest* quest);
  243. void DisplayRandomizeFeatures(int32 features);
  244. void AcceptQuestReward(Quest* quest, int32 item_id);
  245. Quest* GetPendingQuestAcceptance(int32 item_id);
  246. Quest* GetActiveQuest(int32 quest_id);
  247. void DisplayConversation(int32 conversation_id, int32 spawn_id, vector<ConversationOption>* conversations, const char* text, const char* mp3, int32 key1, int32 key2);
  248. void DisplayConversation(Item* item, vector<ConversationOption>* conversations, const char* text, int8 type, const char* mp3 = 0, int32 key1 = 0, int32 key2 = 0);
  249. void DisplayConversation(Entity* npc, int8 type, vector<ConversationOption>* conversations, const char* text, const char* mp3 = 0, int32 key1 = 0, int32 key2 = 0);
  250. void CloseDialog(int32 conversation_id);
  251. int32 GetConversationID(Spawn* spawn, Item* item);
  252. void CombineSpawns(float radius, Spawn* spawn);
  253. void AddCombineSpawn(Spawn* spawn);
  254. void RemoveCombineSpawn(Spawn* spawn);
  255. void SaveCombineSpawns(const char* name = 0);
  256. Spawn* GetCombineSpawn();
  257. bool ShouldTarget();
  258. void TargetSpawn(Spawn* spawn);
  259. void ReloadQuests();
  260. int32 GetCurrentQuestID(){ return current_quest_id; }
  261. void SetLuaDebugClient(bool val);
  262. void SetMerchantTransaction(Spawn* spawn);
  263. Spawn* GetMerchantTransaction();
  264. void SetMailTransaction(Spawn* spawn);
  265. Spawn* GetMailTransaction();
  266. void PlaySound(const char* name);
  267. void SendBuyMerchantList(bool sell = false);
  268. void SendSellMerchantList(bool sell = false);
  269. void SendBuyBackList(bool sell = false);
  270. void SendRepairList();
  271. void ShowLottoWindow();
  272. void PlayLotto(int32 price, int32 ticket_item_id);
  273. void SendGuildCreateWindow();
  274. float CalculateBuyMultiplier(int32 merchant_id);
  275. float CalculateSellMultiplier(int32 merchant_id);
  276. void BuyItem(int32 item_id, int16 quantity);
  277. void SellItem(int32 item_id, int16 quantity, int32 unique_id = 0);
  278. void BuyBack(int32 item_id, int16 quantity);
  279. void RepairItem(int32 item_id);
  280. void RepairAllItems();
  281. void AddBuyBack(int32 unique_id, int32 item_id, int16 quantity, int32 price, bool save_needed = true);
  282. deque<BuyBackItem*>* GetBuyBacks();
  283. vector<Item*>* GetRepairableItems();
  284. void SendMailList();
  285. void DisplayMailMessage(int32 mail_id);
  286. void HandleSentMail(EQApplicationPacket* app);
  287. void DeleteMail(int32 mail_id, bool from_database = false);
  288. bool AddMailCoin(int32 copper, int32 silver = 0, int32 gold = 0, int32 plat = 0);
  289. bool RemoveMailCoin(int32 copper, int32 silver = 0, int32 gold = 0, int32 plat = 0);
  290. void TakeMailAttachments(int32 mail_id);
  291. void CancelSendMail();
  292. bool GateAllowed();
  293. bool BindAllowed();
  294. bool Bind();
  295. bool Gate();
  296. void SendChatRelationship(int8 type, const char* name);
  297. void SendFriendList();
  298. void SendIgnoreList();
  299. void SendNewSpells(int8 class_id);
  300. string GetCoinMessage(int32 total_coins);
  301. void SetItemSearch(vector<Item*>* items);
  302. vector<Item*>* GetSearchItems();
  303. void SearchStore(int32 page);
  304. void SetPlayer(Player* new_player){
  305. player = new_player;
  306. player->SetClient(this);
  307. }
  308. void AddPendingQuestReward(Quest* quest);
  309. void AddPendingQuestUpdate(int32 quest_id, int32 step_id, int32 progress = 0xFFFFFFFF);
  310. void ProcessQuestUpdates();
  311. void AddWaypoint(const char* waypoint_name, int8 waypoint_category, int32 spawn_id);
  312. void BeginWaypoint(const char* waypoint_name, float x, float y, float z);
  313. void InspectPlayer(Player* player_to_inspect);
  314. void SetPendingGuildInvite(Guild* guild, Player* invited_by = 0);
  315. PendingGuildInvite* GetPendingGuildInvite() {return &pending_guild_invite;}
  316. void ShowClaimWindow();
  317. void ShowGuildSearchWindow();
  318. void CheckQuestQueue();
  319. void ShowDressingRoom(Item *item, sint32 crc);
  320. void SendCollectionList();
  321. bool SendCollectionsForItem(Item *item);
  322. void HandleCollectionAddItem(int32 collection_id, Item *item);
  323. void DisplayCollectionComplete(Collection *collection);
  324. void HandInCollections();
  325. void AcceptCollectionRewards(Collection *collection, int32 selectable_item_id = 0);
  326. void SendRecipeList();
  327. void SendTitleUpdate();
  328. void SendUpdateTitles(sint16 prefix, sint16 suffix);
  329. void SendLanguagesUpdate(int32 id);
  330. void SendAchievementsList();
  331. void SendAchievementUpdate(bool first_login = false);
  332. ///<summary>Send the pet options window to the client</summary>
  333. ///<param name="type">Type of pet, 1 = combat 0 = non combat</param>
  334. void SendPetOptionsWindow(const char* pet_name, int8 type = 1);
  335. void SendBiography();
  336. bool IsCrafting();
  337. void SetRecipeListSent(bool val) {m_recipeListSent = val; }
  338. bool GetRecipeListSent() { return m_recipeListSent; }
  339. void ShowRecipeBook();
  340. PendingResurrection* GetCurrentRez();
  341. void SendResurrectionWindow();
  342. void AcceptResurrection();
  343. Mutex m_resurrect;
  344. Mutex* GetResurrectMutex();
  345. void SetPendingLastName(string last_name);
  346. void RemovePendingLastName();
  347. string* GetPendingLastName();
  348. void SendLastNameConfirmation();
  349. void SetInitialSpawnsSent(bool val) { initial_spawns_sent = val; }
  350. bool GetInitialSpawnsSent() { return initial_spawns_sent; }
  351. void SendQuestJournalUpdate(Quest* quest, bool updated=true);
  352. void AddQuestTimer(int32 quest_id);
  353. void RemoveQuestTimer(int32 quest_id);
  354. void SetPendingFlightPath(int32 val) { pending_flight_path = val; }
  355. int32 GetPendingFlightPath() { return pending_flight_path; }
  356. void EndAutoMount();
  357. bool GetOnAutoMount() { return on_auto_mount; }
  358. bool IsCurrentTransmuteID(int32 trans_id);
  359. void SetTransmuteID(int32 trans_id);
  360. int32 GetTransmuteID();
  361. enum ServerSpawnPlacementMode { DEFAULT, OPEN_HEADING, CLOSE_HEADING };
  362. void SetSpawnPlacementMode(ServerSpawnPlacementMode mode) { spawnPlacementMode = mode; }
  363. ServerSpawnPlacementMode GetSpawnPlacementMode() { return spawnPlacementMode; }
  364. bool HandleNewLogin(int32 account_id, int32 access_code);
  365. void SendSpawnChanges(set<Spawn*>& spawns);
  366. void MakeSpawnChangePacket(map<int32, SpawnData> info_changes, map<int32, SpawnData> pos_changes, map<int32, SpawnData> vis_changes, int32 info_size, int32 pos_size, int32 vis_size);
  367. bool IsZonedIn() { return connected_to_zone; }
  368. void SendHailCommand(Spawn* target);
  369. void SendDefaultCommand(Spawn* spawn, const char* command, float distance);
  370. void SetTempPlacementSpawn(Spawn* tmp) { tempPlacementSpawn = tmp; }
  371. Spawn* GetTempPlacementSpawn() { return tempPlacementSpawn; }
  372. void SetPlacementUniqueItemID(int32 id) { placement_unique_item_id = id; }
  373. int32 GetPlacementUniqueItemID() { return placement_unique_item_id; }
  374. void SetHasOwnerOrEditAccess(bool val) { hasOwnerOrEditAccess = val; }
  375. bool HasOwnerOrEditAccess() { return hasOwnerOrEditAccess; }
  376. bool HandleHouseEntityCommands(Spawn* spawn, int32 spawnid, string command);
  377. // find an appropriate spawn to use for the house object, save spawn location/entry data to DB
  378. bool PopulateHouseSpawn(PacketStruct* place_object);
  379. // finalize the spawn-in of the object in world, remove the item from player inventory, set the spawned in object item id (for future pickup)
  380. bool PopulateHouseSpawnFinalize();
  381. void SendMoveObjectMode(Spawn* spawn, uint8 placementMode, float unknown2_3=0.0f);
  382. void SendFlightAutoMount(int32 path_id, int16 mount_id = 0, int8 mount_red_color = 0xFF, int8 mount_green_color = 0xFF, int8 mount_blue_color=0xFF);
  383. void SendShowBook(Spawn* sender, string title, int8 num_pages, ...);
  384. void SendShowBook(Spawn* sender, string title, vector<Item::BookPage*> pages);
  385. void SetTemporaryTransportID(int32 id) { temporary_transport_id = id; }
  386. int32 GetTemporaryTransportID() { return temporary_transport_id; }
  387. void SetRejoinGroupID(int32 id) { rejoin_group_id = id; }
  388. void TempRemoveGroup();
  389. private:
  390. void SavePlayerImages();
  391. void SkillChanged(Skill* skill, int16 previous_value, int16 new_value);
  392. void GiveQuestReward(Quest* quest);
  393. void SetStepComplete(int32 quest_id, int32 step);
  394. void AddStepProgress(int32 quest_id, int32 step, int32 progress);
  395. map<int32, map<int32, int32> > quest_pending_updates;
  396. vector<QueuedQuest*> quest_queue;
  397. vector<Quest*> quest_pending_reward;
  398. volatile bool quest_updates;
  399. Mutex MQuestPendingUpdates;
  400. Mutex MQuestQueue;
  401. Mutex MDeletePlayer;
  402. vector<Item*>* search_items;
  403. Spawn* transport_spawn;
  404. Mutex MBuyBack;
  405. deque<BuyBackItem*> buy_back_items;
  406. Spawn* merchant_transaction;
  407. Spawn* mail_transaction;
  408. Mutex MPendingQuestAccept;
  409. vector<Quest*> pending_quest_accept;
  410. bool lua_debug;
  411. bool should_target;
  412. Spawn* combine_spawn;
  413. int8 num_active_failures;
  414. int32 next_conversation_id;
  415. map<int32, Spawn*> conversation_spawns;
  416. map<int32, Item*> conversation_items;
  417. map<int32, map<int8, string> > conversation_map;
  418. int32 current_quest_id;
  419. Spawn* banker;
  420. map<int32, bool> sent_spell_details;
  421. map<int32, bool> sent_item_details;
  422. Player* player;
  423. int16 version;
  424. int8 timestamp_flag;
  425. int32 ip;
  426. int16 port;
  427. int32 account_id;
  428. int32 character_id;
  429. sint16 admin_status; // -2 Banned, -1 Suspended, 0 User, etc.
  430. char account_name[64];
  431. char zone_name[64];
  432. int32 zoneID;
  433. int32 instanceID;
  434. Timer* autobootup_timeout;
  435. int32 pwaitingforbootup;
  436. int32 last_update_time;
  437. int32 last_saved_timestamp;
  438. Timer* CLE_keepalive_timer;
  439. Timer* connect;
  440. Timer* camp_timer;
  441. Timer* disconnect_timer;
  442. bool connected;
  443. bool ready_for_spawns;
  444. bool ready_for_updates;
  445. bool seencharsel;
  446. bool connected_to_zone;
  447. bool client_zoning;
  448. bool firstlogin;
  449. bool new_client_login;
  450. Timer pos_update;
  451. Timer quest_pos_timer;
  452. Timer lua_debug_timer;
  453. bool player_pos_changed;
  454. bool HandlePacket(EQApplicationPacket *app);
  455. EQStream* eqs;
  456. bool quickbar_changed;
  457. ZoneServer* current_zone;
  458. int32 name_crc;
  459. MailWindow mail_window;
  460. PendingGuildInvite pending_guild_invite;
  461. PendingResurrection current_rez;
  462. string* pending_last_name;
  463. IncomingPaperdollImage incoming_paperdoll;
  464. int32 transmuteID;
  465. bool m_recipeListSent;
  466. bool initial_spawns_sent;
  467. bool should_load_spells;
  468. // int32 = quest id
  469. vector<int32> quest_timers;
  470. Mutex MQuestTimers;
  471. int32 pending_flight_path;
  472. ServerSpawnPlacementMode spawnPlacementMode;
  473. bool on_auto_mount;
  474. bool EntityCommandPrecheck(Spawn* spawn, const char* command);
  475. bool delayedLogin;
  476. int32 delayedAccountID;
  477. int32 delayedAccessKey;
  478. Timer delayTimer;
  479. Spawn* tempPlacementSpawn;
  480. int32 placement_unique_item_id;
  481. bool hasOwnerOrEditAccess;
  482. int32 temporary_transport_id;
  483. int32 rejoin_group_id;
  484. };
  485. class ClientList {
  486. public:
  487. ClientList();
  488. ~ClientList();
  489. bool ContainsStream(EQStream* eqs);
  490. void Add(Client* client);
  491. Client* Get(int32 ip, int16 port);
  492. Client* FindByAccountID(int32 account_id);
  493. Client* FindByName(char* charname);
  494. void Remove(Client* client, bool delete_data = false);
  495. void RemoveConnection(EQStream* eqs);
  496. void Process();
  497. int32 Count();
  498. void ReloadQuests();
  499. void CheckPlayersInvisStatus(Client* owner);
  500. void RemovePlayerFromInvisHistory(int32 spawnID);
  501. private:
  502. Mutex MClients;
  503. list<Client*> client_list;
  504. };
  505. #endif