World.h 22 KB

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