World.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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_WORLD_H
  17. #define EQ2_WORLD_H
  18. #include <string>
  19. #include <vector>
  20. #include <map>
  21. #include <list>
  22. #include "SpawnLists.h"
  23. #include "zoneserver.h"
  24. #include "NPC.h"
  25. #include "Widget.h"
  26. #include "Object.h"
  27. #include "GroundSpawn.h"
  28. #include "Sign.h"
  29. #include "Variables.h"
  30. #include "MutexList.h"
  31. #include "PlayerGroups.h"
  32. using namespace std;
  33. struct MerchantInfo{
  34. vector<int32> inventory_ids;
  35. /*int32 faction_id;
  36. sint32 faction_min;
  37. sint32 faction_max;
  38. float low_buy_multiplier;
  39. float high_buy_multiplier;
  40. float low_sell_multiplier;
  41. float high_sell_multiplier;*/
  42. };
  43. struct MerchantItemInfo{
  44. int32 item_id;
  45. int16 quantity;
  46. int32 price_item_id;
  47. int32 price_item2_id;
  48. int16 price_item_qty;
  49. int16 price_item2_qty;
  50. int32 price_status;
  51. int64 price_coins;
  52. int32 price_stationcash;
  53. };
  54. struct LootTable{
  55. string name;
  56. int32 mincoin;
  57. int32 maxcoin;
  58. int16 maxlootitems;
  59. float lootdrop_probability;
  60. float coin_probability;
  61. };
  62. struct LootDrop{
  63. int32 item_id;
  64. int16 item_charges;
  65. bool equip_item;
  66. float probability;
  67. };
  68. struct GroundSpawnEntry {
  69. int16 min_skill_level;
  70. int16 min_adventure_level;
  71. int8 bonus_table;
  72. float harvest1;
  73. float harvest3;
  74. float harvest5;
  75. float harvest_imbue;
  76. float harvest_rare;
  77. float harvest10;
  78. int32 harvest_coin;
  79. };
  80. struct GroundSpawnEntryItem {
  81. int32 item_id;
  82. int8 is_rare;
  83. int32 grid_id;
  84. };
  85. struct TransportDestination{
  86. int32 unique_id;
  87. int8 type;
  88. string display_name;
  89. string message;
  90. int32 destination_zone_id;
  91. float destination_x;
  92. float destination_y;
  93. float destination_z;
  94. float destination_heading;
  95. int32 cost;
  96. int8 min_level;
  97. int8 max_level;
  98. int32 req_quest;
  99. int16 req_quest_step;
  100. int32 req_quest_complete;
  101. int32 map_x;
  102. int32 map_y;
  103. int32 faction_id;
  104. int32 faction_value;
  105. int32 expansion_flag;
  106. int32 min_client_version;
  107. int32 max_client_version;
  108. int32 flight_path_id;
  109. int16 mount_id;
  110. int8 mount_red_color;
  111. int8 mount_green_color;
  112. int8 mount_blue_color;
  113. };
  114. struct LocationTransportDestination{
  115. int32 unique_id;
  116. string message;
  117. int32 destination_zone_id;
  118. float destination_x;
  119. float destination_y;
  120. float destination_z;
  121. float destination_heading;
  122. float trigger_x;
  123. float trigger_y;
  124. float trigger_z;
  125. float trigger_radius;
  126. int32 cost;
  127. int32 faction_id;
  128. int32 faction_value;
  129. };
  130. //ideally we wouldn't need to store this information as we could get it from the Client object,
  131. //however since the client object disconnects from the server when zoning we can't count on it being available
  132. /*struct PlayerGroup;
  133. struct GroupOptions{
  134. int8 loot_method;
  135. int8 loot_items_rarity;
  136. int8 auto_split;
  137. int8 default_yell;
  138. int8 group_autolock;
  139. int8 solo_autolock;
  140. };
  141. struct GroupMemberInfo{
  142. string name;
  143. string zone;
  144. sint32 hp_current;
  145. sint32 hp_max;
  146. sint32 power_current;
  147. sint32 power_max;
  148. int16 level_current;
  149. int16 level_max;
  150. int8 race_id;
  151. int8 class_id;
  152. Client* client;
  153. PlayerGroup* group;
  154. };
  155. struct PlayerGroup{
  156. deque<GroupMemberInfo*> members;
  157. GroupOptions options;
  158. };*/
  159. struct LottoPlayer {
  160. int32 end_time;
  161. int8 num_matches;
  162. bool set;
  163. };
  164. struct HouseZone {
  165. int32 id;
  166. string name;
  167. int64 cost_coin;
  168. int32 cost_status;
  169. int64 upkeep_coin;
  170. int32 upkeep_status;
  171. int8 vault_slots;
  172. int8 alignment;
  173. int8 guild_level;
  174. int32 zone_id;
  175. int32 exit_zone_id;
  176. float exit_x;
  177. float exit_y;
  178. float exit_z;
  179. float exit_heading;
  180. };
  181. struct Deposit {
  182. int32 timestamp;
  183. int64 amount;
  184. int64 last_amount;
  185. int32 status;
  186. int32 last_status;
  187. string name;
  188. };
  189. struct HouseHistory {
  190. HouseHistory()
  191. {
  192. timestamp = 0;
  193. amount = 0;
  194. name = string("");
  195. reason = string("");
  196. status = 0;
  197. pos_flag = 0;
  198. }
  199. HouseHistory(int32 in_timestamp, int64 in_amount, string in_name, string in_reason, int32 in_status, int8 in_pos_flag)
  200. {
  201. timestamp = in_timestamp;
  202. amount = in_amount;
  203. name = in_name;
  204. reason = in_reason;
  205. status = in_status;
  206. pos_flag = in_pos_flag;
  207. }
  208. int32 timestamp;
  209. int64 amount;
  210. string name;
  211. string reason;
  212. int32 status;
  213. int8 pos_flag;
  214. };
  215. struct PlayerHouse {
  216. int32 house_id;
  217. int64 unique_id;
  218. int32 instance_id;
  219. int32 upkeep_due;
  220. int64 escrow_coins;
  221. int32 escrow_status;
  222. string player_name;
  223. list<Deposit> deposits;
  224. map<string, Deposit> depositsMap;
  225. list<HouseHistory> history;
  226. };
  227. // Constants for STATs counters
  228. // Server Utilization
  229. #define STAT_SERVER_OS_TYPE 1 // what OS this server is running on
  230. #define STAT_SERVER_CPU_TYPE 2 // cpu type/speed (ie., Intel P4 3.0GHz)
  231. #define STAT_SERVER_CPU_CURRENT 3 // current CPU usage by EQ2World.exe process
  232. #define STAT_SERVER_CPU_PEAK 4 // highest CPU usage by EQ2World.exe this session
  233. #define STAT_SERVER_PHYSICAL_RAM_TOTAL 5 // total RAM in server
  234. #define STAT_SERVER_PHYSICAL_RAM_CURRENT 6 // current RAM usage by EQ2World.exe
  235. #define STAT_SERVER_PHYSICAL_RAM_PEAK 7 // highest RAM usage by EQ2World.exe this session
  236. #define STAT_SERVER_VIRTUAL_RAM_TOTAL 8 // total vRAM in server
  237. #define STAT_SERVER_VIRTUAL_RAM_CURRENT 9 // current vRAM usage by EQ2World.exe
  238. #define STAT_SERVER_VIRTUAL_RAM_PEAK 10 // highest vRAM usage by EQ2World.exe this session
  239. #define STAT_SERVER_DISK_USAGE 11 // size of /eq2emulator folder and contents
  240. #define STAT_SERVER_THREAD_COUNT 12 // thread count of EQ2World.exe process
  241. #define STAT_SERVER_AVG_LATENCY 13 // network latency between world and loginserver
  242. // Server Stats
  243. #define STAT_SERVER_CREATED 100 // unix_timestamp of date server first came online
  244. #define STAT_SERVER_START_TIME 101 // unix_timestamp of date/time server booted up
  245. #define STAT_SERVER_ACCEPTED_CONNECTION 102 // successful connections since server startup
  246. #define STAT_SERVER_MOST_CONNECTIONS 103 // most players online in history of server
  247. #define STAT_SERVER_NUM_ACCOUNTS 104 // total number of unique accounts
  248. #define STAT_SERVER_NUM_CHARACTERS 105 // total number of player characters
  249. #define STAT_SERVER_AVG_CHAR_LEVEL 106 // average level of player characters
  250. #define STAT_SERVER_NUM_ACTIVE_ZONES 107 // number of currently running/loaded zones
  251. #define STAT_SERVER_NUM_ACTIVE_INSTANCES 108 // number of active zones that are "instances"
  252. // Player PvE counters
  253. #define STAT_PLAYER_TOTAL_NPC_KILLS 1000 // total NPC kills by player
  254. #define STAT_PLAYER_TOTAL_DEATHS 1001 // total non-PvP deaths of player
  255. #define STAT_PLAYER_KVD_RATIO 1002 // kill-versus-death ratio of player
  256. #define STAT_PLAYER_HIGHEST_MELEE_HIT 1003 // players highest melee hit to date
  257. #define STAT_PLAYER_HIGHEST_MAGIC_HIT 1004 // players highest magic hit to date
  258. #define STAT_PLAYER_HIGHEST_HO_HIT 1005 // players highest heroic opportunity hit
  259. #define STAT_PLAYER_TOTAL_STATUS 1006 // player total status
  260. #define STAT_PLAYER_TOTAL_WEALTH 1007 // player total wealth
  261. #define STAT_PLAYER_QUESTS_COMPLETED 1008 // total quests completed
  262. #define STAT_PLAYER_RECIPES_KNOWN 1009 // total recipes player knows
  263. #define STAT_PLAYER_TOTAL_CRAFTED_ITEMS 1010 // total items crafted by player
  264. #define STAT_PLAYER_ITEMS_DISCOVERED 1011 // total items discovered by player
  265. #define STAT_PLAYER_RARES_HARVESTED 1012 // total rare harvests by player
  266. #define STAT_PLAYER_ITEMS_HARVESTED 1013 // total rare harvests by player
  267. #define STAT_PLAYER_MASTER_ABILITIES 1014 // total master abilities player has
  268. #define STAT_PLAYER_HIGHEST_FALLING_HIT 1015 // player's highest damage amount taken from falling
  269. // Player PvP counters
  270. #define STAT_PLAYER_TOTAL_PVP_KILLS 1100 // total PVP kills by player
  271. #define STAT_PLAYER_PVP_KILL_STREAK 1101 // longest PVP kill streak of player
  272. #define STAT_PLAYER_TOTAL_PVP_DEATHS 1102 // total PVP deaths of player
  273. #define STAT_PLAYER_PVP_DEATH_STREAK 1103 // longest PVP death streak of player
  274. #define STAT_PLAYER_PVP_KVD_RATIO 1104 // PVP kill-versus-death ratio of player
  275. #define STAT_PLAYER_TOTAL_ARENA_KILLS 1105 // total Arena kills of player
  276. // MOST stats for players
  277. #define STAT_PLAYER_MOST_NPC_KILLS 1200 // IPvP: Player with most NPC kills
  278. #define STAT_PLAYER_MOST_NPC_DEATHS 1201 // IPvP: Player with most non-PVP deaths
  279. #define STAT_PLAYER_MOST_PVP_KILLS 1202 // IPvP: Player with most PvP kills
  280. #define STAT_PLAYER_MOST_PVP_DEATHS 1203 // IPvP: Player with most PvP deaths
  281. #define STAT_PLAYER_MOST_ARENA_KILLS 1204 // IPvP: Player with most Arena kills
  282. #define STAT_PLAYER_MOST_STATUS 1205 // IPvP: Player with most Status
  283. #define STAT_PLAYER_MOST_WEALTH 1206 // IPvP: Player with most Wealth
  284. // HIGHEST stats for players
  285. #define STAT_PLAYER_HIGHEST_NPC_KVD_RATIO 1300 // IPvP: Player with highest NPC kill-versus-death ratio
  286. #define STAT_PLAYER_HIGHEST_PVP_KILL_STREAK 1301 // IPvP: Player with longest PvP kill streak
  287. #define STAT_PLAYER_HIGHEST_PVP_DEATH_STREAK 1302 // IPvP: Player with longest PvP death streak
  288. #define STAT_PLAYER_HIGHEST_PVP_KVD_RATIO 1303 // IPvP: Player with highest PvP kill-versus-death ratio
  289. #define STAT_PLAYER_HIGHEST_HP 1304 // IPvP: Player with highest HP on server
  290. #define STAT_PLAYER_HIGHEST_POWER 1305 // IPvP: Player with highest Power on server
  291. #define STAT_PLAYER_HIGHEST_RESISTS 1306 // IPvP: Player with highest Resists on server
  292. struct Statistic {
  293. int32 stat_id;
  294. sint32 stat_value;
  295. int32 stat_date;
  296. bool save_needed;
  297. };
  298. // Player EVENT defines
  299. // Some EVENTs are single occurrance (S), while others are cummulative throughout the life of the player (C)
  300. #define PLAYER_EVENT_NEW_ADV_LEVEL 2000 // (C) player achieves a new adventure level
  301. #define PLAYER_EVENT_NEW_TS_LEVEL 2001 // (C) player achieves a new tradeskill level
  302. #define PLAYER_EVENT_NEW_AA 2002 // (C) player earns AA pt
  303. #define PLAYER_EVENT_NEW_ACHIEVEMENT 2003 // (C) player new achievement
  304. #define PLAYER_EVENT_LAST_DEATH 2004 // (S) player was last killed
  305. #define PLAYER_EVENT_LAST_KILL 2005 // (S) player last killed spawn_id
  306. #define PLAYER_EVENT_DISCOVER_POI 2006 // (C) player discovers location_id
  307. // These maybe should be World stat events, since it is about 1 player discovering a new item?
  308. #define PLAYER_EVENT_DISCOVER_ITEM 2007 // (C) player discovers item_id
  309. #define PLAYER_EVENT_DISCOVER_RECIPE 2008 // (C) player discovers recipe_id
  310. struct PlayerHistory {
  311. int32 history_zone;
  312. int32 history_id;
  313. sint32 history_value;
  314. int32 history_date;
  315. bool save_needed;
  316. };
  317. struct GlobalLoot {
  318. int8 minLevel;
  319. int8 maxLevel;
  320. int32 table_id;
  321. };
  322. #define TRANSPORT_TYPE_LOCATION 0
  323. #define TRANSPORT_TYPE_ZONE 1
  324. #define TRANSPORT_TYPE_GENERIC 2
  325. #define TRANSPORT_TYPE_FLIGHT 3
  326. class ZoneList {
  327. public:
  328. ZoneList();
  329. ~ZoneList();
  330. void Add(ZoneServer* zone);
  331. void Remove(ZoneServer* zone);
  332. ZoneServer* Get(int32 id, bool loadZone = true);
  333. ZoneServer* Get(const char* zone_name, bool loadZone=true);
  334. ZoneServer* GetByInstanceID(int32 id, int32 zone_id=0);
  335. /// <summary>Get the instance for the given zone id with the lowest population</summary>
  336. /// <param name='zone_id'>The id of the zone to look up</param>
  337. /// <returns>ZoneServer* of an active zone with the given id</returns>
  338. ZoneServer* GetByLowestPopulation(int32 zone_id);
  339. void AddClientToMap(string name, Client* client){
  340. name = ToLower(name);
  341. MClientList.lock();
  342. client_map[name] = client;
  343. MClientList.unlock();
  344. }
  345. void CheckFriendList(Client* client);
  346. void CheckFriendZoned(Client* client);
  347. // move to Chat/Chat.h?
  348. bool HandleGlobalChatMessage(Client* from, char* to, int16 channel, const char* message, const char* channel_name = 0);
  349. void HandleGlobalBroadcast(const char* message);
  350. void HandleGlobalAnnouncement(const char* message);
  351. //
  352. int32 Count();
  353. Client* GetClientByCharName(string name){
  354. name = ToLower(name);
  355. Client* ret = 0;
  356. MClientList.lock();
  357. if(client_map.count(name) > 0)
  358. ret = client_map[name];
  359. MClientList.unlock();
  360. return ret;
  361. }
  362. Client* GetClientByCharID(int32 id) {
  363. Client* ret = 0;
  364. MClientList.lock();
  365. map<string, Client*>::iterator itr;
  366. for (itr = client_map.begin(); itr != client_map.end(); itr++) {
  367. if (itr->second->GetCharacterID() == id) {
  368. ret = itr->second;
  369. break;
  370. }
  371. }
  372. MClientList.unlock();
  373. return ret;
  374. }
  375. Client* GetClientByEQStream(EQStream* eqs) {
  376. Client* ret = 0;
  377. if (eqs) {
  378. MClientList.lock();
  379. map<string, Client*>::iterator itr;
  380. for (itr = client_map.begin(); itr != client_map.end(); itr++) {
  381. if (itr->second->getConnection() == eqs) {
  382. ret = itr->second;
  383. break;
  384. }
  385. }
  386. MClientList.unlock();
  387. }
  388. return ret;
  389. }
  390. void UpdateVitality(float amount);
  391. void RemoveClientFromMap(string name, Client* client){
  392. name = ToLower(name);
  393. MClientList.lock();
  394. if(client_map.count(name) > 0 && client_map[name] == client)
  395. client_map.erase(name);
  396. MClientList.unlock();
  397. }
  398. bool ClientConnected(int32 account_id);
  399. void ReloadClientQuests();
  400. bool DepopFinished();
  401. void Depop();
  402. void Repop();
  403. void DeleteSpellProcess();
  404. void LoadSpellProcess();
  405. void ProcessWhoQuery(const char* query, Client* client);
  406. void ProcessWhoQuery(vector<string>* queries, ZoneServer* zone, vector<Entity*>* players, bool isGM);
  407. void SendZoneList(Client* client);
  408. void WritePlayerStatistics();
  409. void ShutDownZones();
  410. void ReloadMail();
  411. void ReloadSpawns();
  412. private:
  413. Mutex MClientList;
  414. Mutex MZoneList;
  415. map<ZoneServer*, int32> removed_zoneservers;
  416. map<string,Client*> client_map;
  417. list<ZoneServer*> zlist;
  418. };
  419. class World {
  420. public:
  421. World();
  422. ~World();
  423. int8 GetClassID(const char* name);
  424. void Process();
  425. void init();
  426. PacketStruct* GetWorldTime(int16 version);
  427. void WorldTimeTick();
  428. float GetXPRate();
  429. float GetTSXPRate();
  430. void LoadVitalityInformation();
  431. void UpdateVitality();
  432. WorldTime* GetWorldTimeStruct(){
  433. return &world_time;
  434. }
  435. ulong GetCurrentThreadID();
  436. int64 GetThreadUsageCPUTime();
  437. // These 2 functions are never used. What was their purpose? Should they be removed?
  438. void AddNPCAppearance(int32 id, AppearanceData* appearance){ npc_appearance_list[id] = appearance; }
  439. AppearanceData* GetNPCAppearance(int32 id) { return npc_appearance_list[id]; }
  440. void ReloadGuilds();
  441. bool ReportBug(string data, char* player_name, int32 account_id, const char* spawn_name, int32 spawn_id, int32 zone_id);
  442. void AddSpawnScript(int32 id, const char* name);
  443. void AddSpawnEntryScript(int32 id, const char* name);
  444. void AddSpawnLocationScript(int32 id, const char* name);
  445. void AddZoneScript(int32 id, const char* name);
  446. const char* GetSpawnScript(int32 id);
  447. const char* GetSpawnEntryScript(int32 id);
  448. const char* GetSpawnLocationScript(int32 id);
  449. const char* GetZoneScript(int32 id);
  450. void ResetSpawnScripts();
  451. void ResetZoneScripts();
  452. int16 GetMerchantItemQuantity(int32 merchant_id, int32 item_id);
  453. void DecreaseMerchantQuantity(int32 merchant_id, int32 item_id, int16 amount);
  454. int32 GetInventoryID(int32 merchant_id, int32 item_id);
  455. void AddMerchantItem(int32 inventory_id, MerchantItemInfo ItemInfo);
  456. void RemoveMerchantItem(int32 inventory_id, int32 item_id);
  457. vector<MerchantItemInfo>* GetMerchantList(int32 merchant_id);
  458. vector<MerchantItemInfo>* GetMerchantItemList(int32 merchant_id, int8 merchant_type, Player* player);
  459. MerchantInfo* GetMerchantInfo(int32 merchant_id);
  460. map<int32, MerchantInfo*>* GetMerchantInfo();
  461. void AddMerchantInfo(int32 merchant_id, MerchantInfo* multiplier);
  462. void DeleteMerchantsInfo();
  463. void DeleteMerchantItems();
  464. void DeleteSpawns();
  465. vector<Variable*>* GetClientVariables();
  466. void WritePlayerStatistics();
  467. void WriteServerStatistics();
  468. void AddServerStatistic(int32 stat_id, sint32 stat_value, int32 stat_date);
  469. void UpdateServerStatistic(int32 stat_id, sint32 stat_value, bool overwrite = false);
  470. sint32 GetServerStatisticValue(int32 stat_id);
  471. void RemoveServerStatistics();
  472. //PlayerGroup* AddGroup(Client* leader);
  473. //void AddGroupMember(PlayerGroup* group, Client* member);
  474. //void RemoveGroupMember(Client* member, bool immediate = false);
  475. //void DisbandGroup(PlayerGroup* group, bool lock = true);
  476. void SendGroupQuests(PlayerGroup* group, Client* client);
  477. //void UpdateGroupBuffs();
  478. //void RemoveGroupBuffs(PlayerGroup *group, Client *client);
  479. //void SetPendingGroup(char* name, char* leader);
  480. //void GroupMessage(PlayerGroup* group, const char* message, ...);
  481. //void SimpleGroupMessage(PlayerGroup* group, const char* message);
  482. //void GroupChatMessage(PlayerGroup* group, Spawn* from, const char* message);
  483. //const char* GetPendingGroup(string name);
  484. //void GroupReadLock();
  485. //void GroupReadUnLock();
  486. //void CheckRemoveGroupedPlayer();
  487. //void SendGroupUpdate(PlayerGroup* group, Client* exclude = 0);
  488. void RejoinGroup(Client* client);
  489. //bool MakeLeader(Client* leader, string new_leader);
  490. void AddBonuses(ItemStatsValues* values, int16 type, sint32 value, Entity* entity);
  491. void CreateGuild(const char* guild_name, Client* leader = 0, int32 group_id = 0);
  492. void SaveGuilds();
  493. void PickRandomLottoDigits(int32* digits);
  494. void AddLottoPlayer(int32 character_id, int32 end_time);
  495. void RemoveLottoPlayer(int32 character_id);
  496. void SetLottoPlayerNumMatches(int32 character_id, int8 num_matches);
  497. void CheckLottoPlayers();
  498. void PopulateTOVStatMap();
  499. int32 LoadItemBlueStats();
  500. sint16 GetItemStatTOVValue(sint16 subtype);
  501. sint16 GetItemStatDOVValue(sint16 subtype);
  502. sint16 GetItemStatCOEValue(sint16 subtype);
  503. sint16 GetItemStatKAValue(sint16 subtype);
  504. sint16 GetItemStatTESTValue(sint16 subtype);
  505. vector<string> biography;
  506. volatile bool items_loaded;
  507. volatile bool spells_loaded;
  508. volatile bool achievments_loaded;
  509. void AddHouseZone(int32 id, string name, int64 cost_coins, int32 cost_status, int64 upkeep_coins, int32 upkeep_status, int8 vault_slots, int8 alignment, int8 guild_level, int32 zone_id, int32 exit_zone_id, float exit_x, float exit_y, float exit_z, float exit_heading);
  510. HouseZone* GetHouseZone(int32 id);
  511. void AddPlayerHouse(int32 char_id, int32 house_id, int64 unique_id, int32 instance_id, int32 upkeep_due, int64 escrow_coins, int32 escrow_status, string player_name);
  512. PlayerHouse* GetPlayerHouseByHouseID(int32 char_id, int32 house_id);
  513. PlayerHouse* GetPlayerHouseByUniqueID(int64 unique_id);
  514. PlayerHouse* GetPlayerHouseByInstanceID(int32 instance_id);
  515. vector<PlayerHouse*> GetAllPlayerHouses(int32 char_id);
  516. vector<PlayerHouse*> GetAllPlayerHousesByHouseID(int32 house_id);
  517. void ReloadHouseData(PlayerHouse* ph);
  518. PlayerGroupManager* GetGroupManager() { return &m_playerGroupManager; }
  519. bool CheckTempBugCRC(char* msg);
  520. private:
  521. //void RemovePlayerFromGroup(PlayerGroup* group, GroupMemberInfo* info, bool erase = true);
  522. //void DeleteGroupMember(GroupMemberInfo* info);
  523. Mutex MMerchantList;
  524. Mutex MSpawnScripts;
  525. Mutex MZoneScripts;
  526. //Mutex MGroups;
  527. map<int32, MerchantInfo*> merchant_info;
  528. map<int32, vector<MerchantItemInfo> > merchant_inventory_items;
  529. int32 vitality_frequency;
  530. float vitality_amount;
  531. float xp_rate;
  532. float ts_xp_rate; // JA
  533. WorldTime world_time;
  534. map<int32,AppearanceData*> npc_appearance_list;
  535. map<int32, string> spawn_scripts;
  536. map<int32, string> spawnentry_scripts;
  537. map<int32, string> spawnlocation_scripts;
  538. map<int32, string> zone_scripts;
  539. //vector<PlayerGroup*> player_groups;
  540. //map<GroupMemberInfo*, int32> group_removal_pending;
  541. //map<string, string> pending_groups;
  542. map<int32, Statistic*> server_statistics;
  543. MutexMap<int32, LottoPlayer*> lotto_players;
  544. int32 last_checked_time;
  545. Timer save_time_timer;
  546. Timer time_tick_timer;
  547. Timer vitality_timer;
  548. Timer player_stats_timer;
  549. Timer server_stats_timer;
  550. //Timer remove_grouped_player;
  551. Timer guilds_timer;
  552. Timer lotto_players_timer;
  553. Timer group_buff_updates;
  554. map<int32, HouseZone*> m_houseZones;
  555. // Map <house id, map<char id, player house>>
  556. map<int32, map<int32, PlayerHouse*> > m_playerHouses;
  557. Mutex MHouseZones;
  558. Mutex MPlayerHouses;
  559. map<int16,int16> tov_itemstat_conversion;
  560. map<int16,int16> dov_itemstat_conversion;
  561. map<int16,int16> coe_itemstat_conversion;
  562. map<int16,int16> ka_itemstat_conversion;
  563. PlayerGroupManager m_playerGroupManager;
  564. Mutex MBugReport;
  565. map<sint32, bool> bug_report_crc;
  566. };
  567. #endif