zoneserver.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011
  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 ZONESERVER_H
  17. #define ZONESERVER_H
  18. #include "../common/linked_list.h"
  19. #include "../common/timer.h"
  20. #include "../common/queue.h"
  21. #include "../common/servertalk.h"
  22. #include "../common/TCPConnection.h"
  23. #include "WorldTCPConnection.h"
  24. #include "../common/Mutex.h"
  25. #include "../common/DataBuffer.h"
  26. #include "net.h"
  27. #include "Player.h"
  28. #include "Combat.h"
  29. #include <list>
  30. #include <map>
  31. #include <set>
  32. #include "MutexList.h"
  33. #include "MutexMap.h"
  34. #include "MutexVector.h"
  35. #include "NPC.h"
  36. #include "Widget.h"
  37. #include "Object.h"
  38. #include "GroundSpawn.h"
  39. #include "Sign.h"
  40. #include "Zone/map.h"
  41. #include "Zone/pathfinder_interface.h"
  42. #include "Zone/mob_movement_manager.h"
  43. extern NetConnection net; // needs to be here or compile errors in commands.cpp
  44. class SpellProcess;
  45. class TradeskillMgr;
  46. class Bot;
  47. #define EXPANSION_UNKNOWN 1
  48. #define EXPANSION_UNKNOWN2 64
  49. #define EXPANSION_UNKNOWN3 128
  50. #define EXPANSION_UNKNOWN4 256
  51. #define EXPANSION_UNKNOWN5 512
  52. #define EXPANSION_DOF 1024
  53. #define EXPANSION_KOS 2048
  54. #define EXPANSION_EOF 4096
  55. #define EXPANSION_ROK 8192
  56. #define EXPANSION_TSO 16384
  57. #define EXPANSION_DOV 65536 // This enables DoV and CoE AA tree's lower values disable both trees
  58. // Can't verify these 3 values
  59. // 32768 - SF
  60. // 131072 - AoD
  61. #define SPAWN_SCRIPT_SPAWN 0
  62. #define SPAWN_SCRIPT_RESPAWN 1
  63. #define SPAWN_SCRIPT_ATTACKED 2
  64. #define SPAWN_SCRIPT_TARGETED 3
  65. #define SPAWN_SCRIPT_HAILED 4
  66. #define SPAWN_SCRIPT_DEATH 5
  67. #define SPAWN_SCRIPT_KILLED 6
  68. #define SPAWN_SCRIPT_AGGRO 7
  69. #define SPAWN_SCRIPT_HEALTHCHANGED 8
  70. #define SPAWN_SCRIPT_RANDOMCHAT 9
  71. #define SPAWN_SCRIPT_CONVERSATION 10
  72. #define SPAWN_SCRIPT_TIMER 11
  73. #define SPAWN_SCRIPT_CUSTOM 12
  74. #define SPAWN_SCRIPT_HAILED_BUSY 13
  75. #define SPAWN_SCRIPT_CASTED_ON 14
  76. #define SPAWN_SCRIPT_AUTO_ATTACK_TICK 15
  77. #define SPAWN_SCRIPT_COMBAT_RESET 16
  78. #define SPAWN_SCRIPT_GROUP_DEAD 17
  79. #define SPAWN_SCRIPT_HEAR_SAY 18
  80. #define SPAWN_CONDITIONAL_NONE 0
  81. #define SPAWN_CONDITIONAL_DAY 1
  82. #define SPAWN_CONDITIONAL_NIGHT 2
  83. #define SPAWN_CONDITIONAL_NOT_RAINING 4
  84. #define SPAWN_CONDITIONAL_RAINING 8
  85. #define MAX_REVIVEPOINT_DISTANCE 1000
  86. /* JA: TODO Turn into R_World Rules */
  87. #define SEND_SPAWN_DISTANCE 150 /* when spawns appear visually to the client */
  88. #define HEAR_SPAWN_DISTANCE 30 /* max distance a client can be from a spawn to 'hear' it */
  89. #define MAX_CHASE_DISTANCE 80
  90. #define REMOVE_SPAWN_DISTANCE 180
  91. #define TRACKING_STOP 0
  92. #define TRACKING_START 1
  93. #define TRACKING_UPDATE 2
  94. #define TRACKING_CLOSE_WINDOW 3
  95. #define TRACKING_TYPE_ENTITIES 1
  96. #define TRACKING_TYPE_HARVESTABLES 2
  97. #define TRACKING_SPAWN_TYPE_PC 0
  98. #define TRACKING_SPAWN_TYPE_NPC 1
  99. #define WAYPOINT_CATEGORY_GROUP 0
  100. #define WAYPOINT_CATEGORY_QUESTS 1
  101. #define WAYPOINT_CATEGORY_PEOPLE 2
  102. #define WAYPOINT_CATEGORY_PLACES 3
  103. #define WAYPOINT_CATEGORY_USER 4
  104. #define WAYPOINT_CATEGORY_DIRECTIONS 5
  105. #define WAYPOINT_CATEGORY_TRACKING 6
  106. #define WAYPOINT_CATEGORY_HOUSES 7
  107. #define WAYPOINT_CATEGORY_MAP 8
  108. struct PlayerProximity{
  109. float distance;
  110. string in_range_lua_function;
  111. string leaving_range_lua_function;
  112. map<Client*, bool> clients_in_proximity;
  113. };
  114. struct LocationProximity {
  115. float x;
  116. float y;
  117. float z;
  118. float max_variation;
  119. string in_range_lua_function;
  120. string leaving_range_lua_function;
  121. map<Client*, bool> clients_in_proximity;
  122. };
  123. struct LocationGrid {
  124. int32 id;
  125. int32 grid_id;
  126. string name;
  127. bool include_y;
  128. bool discovery;
  129. MutexList<Location*> locations;
  130. MutexMap<Player*, bool> players;
  131. };
  132. struct TrackedSpawn {
  133. Spawn* spawn;
  134. float distance;
  135. };
  136. class Widget;
  137. class Client;
  138. class Sign;
  139. class Object;
  140. class GroundSpawn;
  141. struct GroundSpawnEntry;
  142. struct GroundSpawnEntryItem;
  143. struct LootTable;
  144. struct LootDrop;
  145. struct GlobalLoot;
  146. struct TransportDestination;
  147. struct LocationTransportDestination;
  148. #ifdef WIN32
  149. void ZoneLoop(void *tmp);
  150. void SpawnLoop(void *tmp);
  151. void SendInitialSpawns(void *tmp);
  152. void SendLevelChangedSpawns(void*tmp);
  153. #else
  154. void *ZoneLoop(void *tmp);
  155. void *SpawnLoop(void *tmp);
  156. void *SendInitialSpawns(void *tmp);
  157. void *SendLevelChangedSpawns(void *tmp);
  158. #endif
  159. using namespace std;
  160. struct RevivePoint{
  161. int32 id;
  162. int32 zone_id; //usually this zone, but not always
  163. string location_name;
  164. float x;
  165. float y;
  166. float z;
  167. float heading;
  168. };
  169. struct SpawnScriptTimer {
  170. int32 timer;
  171. int32 spawn;
  172. int32 player;
  173. string function;
  174. int32 current_count;
  175. int32 max_count;
  176. };
  177. enum Instance_Type {
  178. NONE,
  179. GROUP_LOCKOUT_INSTANCE,
  180. GROUP_PERSIST_INSTANCE,
  181. RAID_LOCKOUT_INSTANCE,
  182. RAID_PERSIST_INSTANCE,
  183. SOLO_LOCKOUT_INSTANCE,
  184. SOLO_PERSIST_INSTANCE,
  185. TRADESKILL_INSTANCE, // allows anyone to enter, server searches for the first instance that is available
  186. PUBLIC_INSTANCE, // same as tradeskill, except dead spawns are tracked
  187. PERSONAL_HOUSE_INSTANCE,
  188. GUILD_HOUSE_INSTANCE,
  189. QUEST_INSTANCE
  190. };
  191. struct FlightPathInfo {
  192. float speed;
  193. bool flying;
  194. bool dismount;
  195. };
  196. struct FlightPathLocation {
  197. float X;
  198. float Y;
  199. float Z;
  200. };
  201. class SPGrid;
  202. // need to attempt to clean this up and add xml comments, remove unused code, find a logical way to sort the functions maybe by get/set/process/add etc...
  203. class ZoneServer {
  204. public:
  205. ZoneServer(const char* file);
  206. ~ZoneServer();
  207. void Init();
  208. bool Process();
  209. bool SpawnProcess();
  210. void LoadRevivePoints(vector<RevivePoint*>* revive_points);
  211. vector<RevivePoint*>* GetRevivePoints(Client* client);
  212. RevivePoint* GetRevivePoint(int32 id);
  213. void AddClient(Client* client);
  214. void SimpleMessage(int8 type, const char* message, Spawn* from, float distance);
  215. void HandleChatMessage(Spawn* from, const char* to, int16 channel, const char* message, float distance = 0, const char* channel_name = 0, bool show_bubble = true, int32 language = 0);
  216. void HandleChatMessage(Client* client, Spawn* from, const char* to, int16 channel, const char* message, float distance = 0, const char* channel_name = 0, bool show_bubble = true, int32 language = 0);
  217. void HandleBroadcast(const char* message);
  218. void HandleAnnouncement(const char* message);
  219. int16 SetSpawnTargetable(Spawn* spawn, float distance);
  220. int16 SetSpawnTargetable(int32 spawn_id);
  221. void ApplySetSpawnCommand(Client* client, Spawn* target, int8 type, char* value);
  222. void SetSpawnCommand(Spawn* spawn, int8 type, char* value, Client* client = 0);
  223. void SetSpawnCommand(int32 spawn_id, int8 type, char* value, Client* client = 0);
  224. void AddLoot(NPC* npc);
  225. NPC* AddNPCSpawn(SpawnLocation* spawnlocation, SpawnEntry* spawnentry);
  226. Object* AddObjectSpawn(SpawnLocation* spawnlocation, SpawnEntry* spawnentry);
  227. GroundSpawn* AddGroundSpawn(SpawnLocation* spawnlocation, SpawnEntry* spawnentry);
  228. Widget* AddWidgetSpawn(SpawnLocation* spawnlocation, SpawnEntry* spawnentry);
  229. Sign* AddSignSpawn(SpawnLocation* spawnlocation, SpawnEntry* spawnentry);
  230. void AddSpawn(Spawn* spawn);
  231. void RemoveDeadEnemyList(Spawn* spawn);
  232. void RemoveDeadSpawn(Spawn* spawn);
  233. void AddSpawnGroupLocation(int32 group_id, int32 location_id, int32 spawn_location_id);
  234. void AddSpawnGroupAssociation(int32 group_id1, int32 group_id2);
  235. void AddSpawnGroupChance(int32 group_id, float percent);
  236. void RemoveSpawn(bool spawnListLocked, Spawn* spawn, bool delete_spawn = true, bool respawn = true, bool lock = true);
  237. void ProcessSpawnLocations();
  238. void SendQuestUpdates(Client* client, Spawn* spawn = 0);
  239. EQ2Packet* GetZoneInfoPacket(Client* client);
  240. Spawn* FindSpawn(Player* searcher, const char* name);
  241. void CallSpawnScript(Spawn* npc, int8 type, Spawn* spawn = 0, const char* message = 0);
  242. void SendSpawnVisualState(Spawn* spawn, int16 type);
  243. void SendSpellFailedPacket(Client* client, int16 error);
  244. void SendInterruptPacket(Spawn* interrupted, LuaSpell* spell);
  245. void HandleEmote(Client* originator, string name);
  246. Client* GetClientBySpawn(Spawn* spawn);
  247. Spawn* GetSpawnByDatabaseID(int32 id);
  248. Spawn* GetSpawnByID(int32 id, bool spawnListLocked=false);
  249. void PlaySoundFile(Client* client, const char* name, float origin_x, float origin_y, float origin_z);
  250. void SendZoneSpawns(Client* client);
  251. void StartZoneInitialSpawnThread(Client* client);
  252. void SendSpawnChanges();
  253. void SendSpawnChanges(Spawn* spawn);
  254. void SendSpawnChanges(Spawn* spawn, Client* client, bool override_changes = false, bool override_vis_changes = false);
  255. void SendSpawnChanges(int32 spawn_id, Client* client, bool override_changes = false, bool override_vis_changes = false);
  256. void SendPlayerPositionChanges(Player* player);
  257. void UpdateVitality(float amount);
  258. vector<Entity*> GetPlayers();
  259. void KillSpawn(bool spawnListLocked, Spawn* dead, Spawn* killer, bool send_packet = true, int8 damage_type = 0, int16 kill_blow_type = 0);
  260. void SendDamagePacket(Spawn* attacker, Spawn* victim, int8 type1, int8 type2, int8 damage_type, int16 damage, const char* spell_name);
  261. void SendHealPacket(Spawn* caster, Spawn* target, int16 type, int32 heal_amt, const char* spell_name);
  262. void SendCastSpellPacket(LuaSpell* spell, Entity* caster);
  263. void SendCastSpellPacket(int32 spell_visual, Spawn* target);
  264. void SendCastEntityCommandPacket(EntityCommand* entity_command, int32 spawn_id, int32 target_id);
  265. void TriggerCharSheetTimer();
  266. /// <summary>Sends the game time packet to all connected clients</summary>
  267. void SendTimeUpdateToAllClients();
  268. void AddWidgetTimer(Spawn* widget, float time);
  269. bool HasWidgetTimer(Spawn* widget);
  270. void AddHeadingTimer(Spawn* spawn);
  271. void Despawn(Spawn* spawn, int32 timer);
  272. void RepopSpawns(Client* client, Spawn* spawn);
  273. bool AddCloseSpawnsToSpawnGroup(Spawn* spawn, float radius);
  274. void Depop(bool respawns = false, bool repop = false);
  275. Spawn* GetSpawnGroup(int32 id);
  276. void AddEnemyList(NPC* npc);
  277. void ReloadClientQuests();
  278. void SendAllSpawnsForLevelChange(Client* client);
  279. void AddLocationGrid(LocationGrid* grid);
  280. void RemoveLocationGrids();
  281. void DeleteTransporters();
  282. void CheckTransporters(Client* client);
  283. void WritePlayerStatistics();
  284. bool SendRadiusSpawnInfo(Client* client, float radius);
  285. volatile bool spawnthread_active;
  286. volatile bool combatthread_active;
  287. volatile int8 initial_spawn_threads_active;
  288. volatile bool client_thread_active;
  289. void AddChangedSpawn(Spawn* spawn);
  290. void AddDamagedSpawn(Spawn* spawn);
  291. void AddDrowningVictim(Player* player);
  292. void RemoveDrowningVictim(Player* player);
  293. Client* GetDrowningVictim(Player* player);
  294. void DeleteSpellProcess();
  295. void LoadSpellProcess();
  296. void LockAllSpells(Player* player);
  297. void UnlockAllSpells(Player* player);
  298. void RemoveSpellTimersFromSpawn(Spawn* spawn, bool remove_all, bool delete_recast = true);
  299. void Interrupted(Entity* caster, Spawn* interruptor, int16 error_code, bool cancel = false, bool from_movement = false);
  300. Spell* GetSpell(Entity* caster);
  301. void ProcessSpell(Spell* spell, Entity* caster, Spawn* target = 0, bool lock = true, bool harvest_spell = false);
  302. void ProcessEntityCommand(EntityCommand* entity_command, Entity* caster, Spawn* target, bool lock = true);
  303. void AddPlayerTracking(Player* player);
  304. void RemovePlayerTracking(Player* player, int8 mode);
  305. void SendUpdateTitles(Client *client, Title *suffix = 0, Title *prefix = 0);
  306. void SendUpdateTitles(Spawn *spawn, Title *suffix = 0, Title *prefix = 0);
  307. void RemoveTargetFromSpell(LuaSpell* spell, Spawn* target);
  308. /// <summary>Schedules a spawn for removal</summary>
  309. /// <param name='spawn'>The spawn to remove</param>
  310. /// <param name='time'>The delay before removing the spawn</param>
  311. void AddDelayedSpawnRemove(Spawn* spawn, int32 time);
  312. /// <summary>Removes a spawn from scheduled removal (used mainly for players returning from LD)</summary>
  313. /// <param name='spawn'>The spawn to remove from the scheduled removal</param>
  314. void RemoveDelayedSpawnRemove(Spawn* spawn);
  315. /// <summary>Set the rain levl in the zone</summary>
  316. /// <param name='val'>Level of rain in the zone 0.0 - 1.1 (rain starts at 0.76)</param>
  317. void SetRain(float val);
  318. /// <summary>Sets the wind direction</summary>
  319. /// <param name='val'>Direction in degrees to set the wind</param>
  320. void SetWind(float val);
  321. /// <summary>Handles zone-wide weather changes</summary>
  322. void ProcessWeather();
  323. Spawn* GetClosestTransportSpawn(float x, float y, float z);
  324. void ResurrectSpawn(Spawn* spawn, Client* client);
  325. void HidePrivateSpawn(Spawn* spawn);
  326. Client* GetClientByName(char* name);
  327. /// <summary>Gets spawns for a true AoE spell</summary>
  328. vector<Spawn*> GetAttackableSpawnsByDistance(Spawn* spawn, float distance);
  329. void StartZoneSpawnsForLevelThread(Client* client);
  330. void SendDispellPacket(Entity* caster, Spawn* target, string dispell_name, string spell_name, int8 dispell_type);
  331. void SetupInstance(int32 createdInstanceID=0);
  332. void SendUpdateDefaultCommand(Spawn* spawn, const char* command, float distance);
  333. map<int32, int32>* GetSpawnLocationsByGroup(int32 group_id);
  334. SPGrid* Grid;
  335. Map* zonemap;
  336. IPathfinder* pathing;
  337. MobMovementManager* movementMgr;
  338. /****************************************************
  339. Following functions are only used for LUA commands
  340. ****************************************************/
  341. int32 GetClosestLocation(Spawn* spawn);
  342. Spawn* GetClosestSpawn(Spawn* spawn, int32 spawn_id);
  343. SpawnLocation* GetSpawnLocation(int32 id);
  344. void PlayFlavor(Client* client, Spawn* spawn, const char* mp3, const char* text, const char* emote, int32 key1, int32 key2, int8 language);
  345. void PlayVoice(Client* client, Spawn* spawn, const char* mp3, int32 key1, int32 key2);
  346. void PlayFlavor(Spawn* spawn, const char* mp3, const char* text, const char* emote, int32 key1, int32 key2, int8 language);
  347. void PlayVoice(Spawn* spawn, const char* mp3, int32 key1, int32 key2);
  348. void SendThreatPacket(Spawn* caster, Spawn* target, int32 threat_amt, const char* spell_name);
  349. void KillSpawnByDistance(Spawn* spawn, float max_distance, bool include_players = false, bool send_packet = false);
  350. void SpawnSetByDistance(Spawn* spawn, float max_distance, string field, string value);
  351. void AddSpawnScriptTimer(SpawnScriptTimer* timer);
  352. Spawn* GetSpawnByLocationID(int32 location_id);
  353. void AddMovementNPC(Spawn* spawn);
  354. void AddPlayerProximity(Spawn* spawn, float distance, string in_range_function, string leaving_range_function);
  355. void AddLocationProximity(float x, float y, float z, float max_variation, string in_range_function, string leaving_range_function);
  356. void PlayAnimation(Spawn* spawn, int32 visual_state, Spawn* spawn2 = 0, int8 type = 1);
  357. void AddTransportSpawn(Spawn* spawn);
  358. vector<Spawn*> GetSpawnsByID(int32 id);
  359. bool IsDusk() { return isDusk; } // never used, probably meant for lua though
  360. /****************************************************
  361. Following functions are all contained in the header
  362. ****************************************************/
  363. inline const char* GetZoneName() { return zone_name; }
  364. void SetZoneName(char* new_zone) {
  365. if( strlen(new_zone) >= sizeof zone_name )
  366. return;
  367. strcpy(zone_name, new_zone);
  368. }
  369. inline const char* GetZoneFile() { return zone_file; }
  370. void SetZoneFile(char* zone) {
  371. if( strlen(zone) >= sizeof zone_file )
  372. return;
  373. strcpy(zone_file, zone);
  374. }
  375. inline const char* GetZoneDescription() { return zone_description; }
  376. void SetZoneDescription(char* desc) {
  377. if( strlen(desc) >= sizeof zone_description )
  378. return;
  379. strcpy(zone_description, desc);
  380. }
  381. void SetUnderWorld(float under){ underworld = under; }
  382. inline int32 GetZoneID() { return zoneID; }
  383. void SetZoneID(int32 new_id){ zoneID = new_id; }
  384. inline bool IsCityZone() { return cityzone; }
  385. inline bool AlwaysLoaded() { return always_loaded; }
  386. void SetCityZone(bool val) { cityzone = val; }
  387. void SetAlwaysLoaded(bool val) { always_loaded = val; }
  388. inline int32& NumPlayers() { return pNumPlayers; }
  389. void SetMinimumStatus(sint16 minStatus) { minimumStatus = minStatus; }
  390. sint16 GetMinimumStatus() { return minimumStatus; }
  391. void SetMinimumLevel(int16 minLevel) { minimumLevel = minLevel; }
  392. void SetMaximumLevel(int16 maxLevel) { maximumLevel = maxLevel; }
  393. void SetMinimumVersion(int16 minVersion) { minimumVersion = minVersion; }
  394. int16 GetMinimumLevel() { return minimumLevel; }
  395. int16 GetMaximumLevel() { return maximumLevel; }
  396. int16 GetMinimumVersion() { return minimumVersion; }
  397. inline bool GetZoneLockState() { return locked; } // JA: /zone lock|unlock
  398. void SetZoneLockState(bool lock_state) { locked = lock_state; } // JA: /zone lock|unlock
  399. int32 GetInstanceID() { return instanceID; }
  400. bool IsInstanceZone() { return isInstance; }
  401. void SetShutdownTimer(int val){
  402. shutdownTimer.SetTimer(val*1000);
  403. }
  404. void AddSpawnLocation(int32 id, SpawnLocation* spawnlocation) {
  405. MSpawnLocationList.writelock(__FUNCTION__, __LINE__);
  406. if (spawn_location_list.count(id) > 0)
  407. safe_delete(spawn_location_list[id]);
  408. spawn_location_list[id] = spawnlocation;
  409. MSpawnLocationList.releasewritelock(__FUNCTION__, __LINE__);
  410. }
  411. void SetInstanceType(int16 type) { InstanceType = (Instance_Type)type; if(type>0)isInstance=true; else isInstance=false; }
  412. Instance_Type GetInstanceType() { return InstanceType; }
  413. float GetSafeX(){ return safe_x; }
  414. float GetSafeY(){ return safe_y; }
  415. float GetSafeZ(){ return safe_z; }
  416. float GetSafeHeading() { return safe_heading; }
  417. void SetSafeX(float val){ safe_x = val; }
  418. void SetSafeY(float val){ safe_y = val; }
  419. void SetSafeZ(float val){ safe_z = val; }
  420. void SetSafeHeading(float val) { safe_heading = val; }
  421. float GetXPModifier() { return xp_mod; }
  422. void SetXPModifier(float val) { xp_mod = val; }
  423. void SetZoneMOTD(string z_motd) { zone_motd = z_motd; }
  424. string GetZoneMOTD() { return zone_motd; }
  425. bool isZoneShuttingDown ( ) { return zoneShuttingDown; }
  426. void Shutdown(){ zoneShuttingDown = true; }
  427. int32 GetClientCount(){ return clients.size(); }
  428. int32 GetDefaultLockoutTime() { return def_lockout_time; }
  429. int32 GetDefaultReenterTime() { return def_reenter_time; }
  430. int32 GetDefaultResetTime() { return def_reset_time; }
  431. int8 GetForceGroupZoneOption() { return group_zone_option; }
  432. void SetDefaultLockoutTime(int32 val) { def_lockout_time = val; }
  433. void SetDefaultReenterTime(int32 val) { def_reenter_time = val; }
  434. void SetDefaultResetTime(int32 val) { def_reset_time = val; }
  435. void SetForceGroupZoneOption(int8 val) { group_zone_option = val; }
  436. SpellProcess* GetSpellProcess() {return spellProcess;}
  437. bool FinishedDepop(){ return finished_depop; }
  438. /// <summary>Returns the Tradeskill Manager for this zone</summary>
  439. TradeskillMgr* GetTradeskillMgr() { return tradeskillMgr; }
  440. // had to add these to access weather from Commands
  441. bool isWeatherEnabled() { return weather_enabled; }
  442. void SetWeatherEnabled(bool val) { weather_enabled = val; }
  443. bool isWeatherAllowed() { return weather_allowed; }
  444. void SetWeatherAllowed(bool val) { weather_allowed = val; }
  445. int8 GetWeatherType() { return weather_type; }
  446. void SetWeatherType(int8 val) { weather_type = val; }
  447. int32 GetWeatherFrequency() { return weather_frequency; }
  448. void SetWeatherFrequency(int32 val) { weather_frequency = val; }
  449. float GetWeatherMinSeverity() { return weather_min_severity; }
  450. void SetWeatherMinSeverity(float val) { weather_min_severity = val; }
  451. float GetWeatherMaxSeverity() { return weather_max_severity; }
  452. void SetWeatherMaxSeverity(float val) { weather_max_severity = val; }
  453. float GetWeatherChangeAmount() { return weather_change_amount; }
  454. void SetWeatherChangeAmount(float val) { weather_change_amount = val; }
  455. float GetWeatherDynamicOffset() { return weather_dynamic_offset; }
  456. void SetWeatherDynamicOffset(float val) { weather_dynamic_offset = val; }
  457. int8 GetWeatherChance() { return weather_change_chance; }
  458. void SetWeatherChance(int8 val) { weather_change_chance = val; }
  459. float GetCurrentWeather() { return weather_current_severity; }
  460. void SetCurrentWeather(float val) { weather_current_severity = val; }
  461. int8 GetWeatherPattern() { return weather_pattern; }
  462. void SetWeatherPattern(int8 val) { weather_pattern = val; }
  463. void SetWeatherLastChangedTime(int32 val) { weather_last_changed_time = val; }
  464. void RemoveClientImmediately(Client* client);
  465. void ClearHate(Entity* entity);
  466. /****************************************************
  467. Following functions are pending deletion, left in for
  468. now just to make sure one won't be of future use.
  469. ****************************************************/
  470. //void RemoveFromRangeMap(Client* client); // never used?
  471. //void AddSpawnAssociatedGroup(vector<int32>* ret, int32 group_id); // never used, not even any code for it
  472. //inline const char* GetCAddress() { return clientaddress; } // never used?
  473. //inline int16 GetCPort() { return clientport; } // never used?
  474. //inline bool IsBootingUp() { return BootingUp; } // never used?
  475. //int32 GetShutdownTimer() {return shutdownTimer.GetTimerTime();} // never used
  476. //float GetUnderWorld(){ return underworld; } // function never used but variable is
  477. // Following were private
  478. //char clientaddress[250]; // never used
  479. //int16 clientport; // never used
  480. //bool BootingUp; // never used
  481. //bool authenticated; // never used?
  482. //int16 next_index; // never used
  483. void AddFlightPath(int32 id, FlightPathInfo* info);
  484. void AddFlightPathLocation(int32 id, FlightPathLocation* location);
  485. void DeleteFlightPaths();
  486. void SendFlightPathsPackets(Client* client);
  487. int32 GetFlightPathIndex(int32 id);
  488. float GetFlightPathSpeed(int32 id);
  489. void SendSpawn(Spawn* spawn, Client* client); // moved from private to public for bots
  490. void ProcessSpawnConditional(int8 condition);
  491. void SetSpawnStructs(Client* client);
  492. private:
  493. /* Private Functions */
  494. void AddTransporter(LocationTransportDestination* loc);
  495. void CheckDeadSpawnRemoval();
  496. void DeleteData(bool boot_clients = true);
  497. void DeleteFactionLists();
  498. void ProcessDepop(bool respawns_allowed = false, bool repop = false);
  499. /*
  500. Following functions were public but never used outside the zone server so moved them to private
  501. */
  502. void ClientProcess(); // never used outside zone server
  503. void RemoveClient(Client* client); // never used outside zone server
  504. void DeterminePosition(SpawnLocation* spawnlocation, Spawn* spawn); // never used outside zone server
  505. void AddDeadSpawn(Spawn* spawn, int32 timer = 0xFFFFFFFF); // never used outside zone server
  506. int32 CalculateSpawnGroup(SpawnLocation* spawnlocation, bool respawn = false); // never used outside zone server
  507. float GetSpawnGroupChance(int32 group_id); // never used outside zone server
  508. vector<int32>* GetAssociatedLocations(set<int32>* groups); // never used outside zone server
  509. set<int32>* GetAssociatedGroups(int32 group_id); // never used outside zone server
  510. list<int32>* GetSpawnGroupsByLocation(int32 location_id); // never used outside zone server
  511. void ProcessSpawnLocation(int32 location_id, bool respawn = false); // never used outside zone server
  512. Spawn* ProcessSpawnLocation(SpawnLocation* spawnlocation, bool respawn = false); // never used outside zone server
  513. Spawn* ProcessInstanceSpawnLocation(SpawnLocation* spawnlocation, map<int32,int32>* instNPCs, map<int32,int32>* instGroundSpawns, map<int32,int32>* instObjSpawns, map<int32,int32>* instWidgetSpawns, map<int32,int32>* instSignSpawns, bool respawn = false); // never used outside zone server
  514. void SendCharSheetChanges(); // never used outside zone server
  515. void SendCharSheetChanges(Client* client); // never used outside zone server
  516. void SaveClients(); // never used outside zone server
  517. void CheckSendSpawnToClient(); // never used outside zone server
  518. void CheckSendSpawnToClient(Client* client, bool initial_login = false); // never used outside zone server
  519. bool SendRemoveSpawn(Client* client, Spawn* spawn, PacketStruct* packet = 0, bool delete_spawn = false); // never used outside zone server
  520. void CheckRemoveSpawnFromClient(Spawn* spawn); // never used outside zone server
  521. void SaveClient(Client* client); // never used outside zone server
  522. void ProcessFaction(Spawn* spawn, Client* client); // never used outside zone server
  523. void RegenUpdate(); // never used outside zone server
  524. void SendCalculatedXP(Player* player, Spawn* victim); // never used outside zone server, might not be used at all any more
  525. void SendTimeUpdate(Client* client); // never used outside zone server
  526. void CheckWidgetTimers(); // never used outside zone server
  527. void CheckRespawns(); // never used outside zone server
  528. void CheckSpawnExpireTimers(); // never used outside zone server
  529. void AddSpawnExpireTimer(Spawn* spawn, int32 expire_time, int32 expire_offset = 0); // never used outside zone server
  530. void CheckSpawnRange(Client* client, Spawn* spawn, bool initial_login = false); // never used outside zone server
  531. void CheckSpawnRange(Spawn* spawn); // never used outside zone server
  532. void DeleteSpawnScriptTimers(Spawn* spawn, bool all = false); // never used outside zone server
  533. void DeleteSpawnScriptTimers(); // never used outside zone server
  534. void CheckSpawnScriptTimers(); // never used outside zone server
  535. void CheckHeadingTimers(); // never used outside zone server
  536. void RemoveHeadingTimer(Spawn* spawn); // never used outside zone server
  537. void PrepareSpawnID(Player* player, Spawn* spawn); // never used outside zone server
  538. void RemoveMovementNPC(Spawn* spawn); // never used outside zone server
  539. bool CheckNPCAttacks(NPC* npc, Spawn* victim, Client* client = 0); // never used outside zone server
  540. bool AggroVictim(NPC* npc, Spawn* victim, Client* client = 0); // never used outside zone server
  541. bool CheckEnemyList(NPC* npc); // never used outside zone server
  542. void RemovePlayerProximity(Spawn* spawn, bool all = false); // never used outside zone server
  543. void RemovePlayerProximity(Client* client); // never used outside zone server
  544. void CheckPlayerProximity(Spawn* spawn, Client* client); // never used outside zone server
  545. void RemoveLocationProximities(); // never used outside zone server
  546. void CheckLocationProximity(); // never used outside zone server
  547. void CheckLocationGrids(); // never used outside zone server
  548. void RemoveSpawnSupportFunctions(Spawn* spawn); // never used outside zone server
  549. void ReloadTransporters(); // never used outside zone server
  550. void DeleteSpawns(bool delete_all); // never used outside zone server
  551. void AddPendingDelete(Spawn* spawn); // never used outside zone server
  552. void ClearDeadSpawns(); // never used outside zone server
  553. void RemoveChangedSpawn(Spawn* spawn); // never used outside zone server
  554. void ProcessDrowning(); // never used outside zone server
  555. void RemoveDamagedSpawn(Spawn* spawn); // never used outside zone server
  556. void ProcessTracking(); // never used outside zone server
  557. void ProcessTracking(Client* client); // never used outside zone server
  558. void SendEpicMobDeathToGuild(Player* killer, Spawn* victim); // never used outside zone server
  559. void ProcessAggroChecks(Spawn* spawn); // never used outside zone server
  560. /// <summary>Checks to see if it is time to remove a spawn and removes it</summary>
  561. /// <param name='force_delete_all'>Forces all spawns scheduled to be removed regardless of time</param>
  562. void DelayedSpawnRemoval(bool force_delete_all); // never used outside zone server
  563. bool CombatProcess(Spawn* spawn); // never used outside zone server
  564. void InitWeather(); // never used outside zone server
  565. ///<summary>Dismiss all pets in the zone, useful when the spell process needs to be reloaded</summary>
  566. void DismissAllPets(); // never used outside zone server
  567. /* Mutex Lists */
  568. MutexList<int32> changed_spawns; // int32 = spawn id
  569. vector<Client*> clients;
  570. MutexList<Client*> connected_clients; // probably remove this list so we are not maintaining 2 client lists
  571. MutexList<int32> damaged_spawns; // int32 = spawn id
  572. MutexList<LocationProximity*> location_proximities;
  573. MutexList<LocationGrid*> location_grids;
  574. MutexList<int32> remove_movement_spawns; // int32 = spawn id
  575. set<SpawnScriptTimer*> spawn_script_timers;
  576. Mutex MSpawnScriptTimers;
  577. set<SpawnScriptTimer*> remove_spawn_script_timers_list;
  578. Mutex MRemoveSpawnScriptTimersList;
  579. list<LocationTransportDestination*> transporter_locations;
  580. /* Mutex Maps */
  581. MutexMap<Spawn*, Client*> client_spawn_map; // ok
  582. MutexMap<int32, int32> delayed_spawn_remove_list; // 1st int32 = spawn id, 2nd int32 = time
  583. MutexMap<Client*, int32> drowning_victims;
  584. MutexMap<Spawn*, int32> heading_timers;
  585. MutexMap<int32, int32> movement_spawns; // 1st int32 = spawn id
  586. MutexMap<int32, PlayerProximity*> player_proximities; // 1st int32 = spawn id
  587. MutexMap<int32, Player*> players_tracking;
  588. MutexMap<int32, int32> quick_database_id_lookup; // 1st int32 = database id, 2nd int32 = spawn id
  589. MutexMap<int32, int32> respawn_timers;
  590. map<Spawn*, int32> spawn_delete_list;
  591. MutexMap<int32, int32> spawn_expire_timers; // 1st int32 = spawn id
  592. map<int32, set<int32>* > spawn_group_associations;
  593. map<int32, float> spawn_group_chances;
  594. map<int32, map<int32, int32>* > spawn_group_locations;
  595. MutexMap<int32, MutexList<int32> > spawn_group_map; // MutexList<int32> is a list of spawn id's
  596. map<int32, list<int32>* > spawn_location_groups;
  597. map<int32, SpawnLocation*> spawn_location_list;
  598. MutexMap<Client*, MutexMap<int32, float >* > spawn_range_map; // int32 in the MutexMap<int32, float>* = spawn id, float = distance
  599. Mutex MWidgetTimers;
  600. map<int32, int32> widget_timers; // 1st int32 = spawn id
  601. /* Mutexs */
  602. Mutex m_enemy_faction_list;
  603. Mutex m_npc_faction_list;
  604. Mutex m_reverse_enemy_faction_list;
  605. Mutex MDeadSpawns;
  606. CriticalSection* MMasterZoneLock; //This needs to be a recursive lock to fix a possible /reload spells crash with multiple zones loaded - Foof
  607. Mutex MMasterSpawnLock;
  608. Mutex MPendingSpawnListAdd;
  609. Mutex MSpawnList;
  610. Mutex MTransportSpawns;
  611. Mutex MSpawnGroupAssociation;
  612. Mutex MSpawnGroupLocations;
  613. Mutex MSpawnLocationGroups;
  614. Mutex MSpawnGroupChances;
  615. Mutex MTransportLocations;
  616. Mutex MSpawnLocationList;
  617. Mutex MSpawnDeleteList;
  618. Mutex MClientList;
  619. /* Maps */
  620. map<int32, int32> dead_spawns;
  621. map<int32, vector<int32>* > enemy_faction_list;
  622. map<int32, vector<int32>* > npc_faction_list;
  623. map<int32, vector<int32>* > reverse_enemy_faction_list;
  624. map<int32, Spawn*> spawn_list;
  625. map<int32, FlightPathInfo*> m_flightPaths;
  626. map<int32, vector<FlightPathLocation*> > m_flightPathRoutes;
  627. /* Lists */
  628. list<Spawn*> pending_spawn_list_add;
  629. /* Vectors */
  630. vector<RevivePoint*>* revive_points;
  631. vector<int32> transport_spawns;
  632. /* Classes */
  633. SpellProcess* spellProcess;
  634. TradeskillMgr* tradeskillMgr;
  635. /* Timers */
  636. Timer aggro_timer;
  637. Timer charsheet_changes;
  638. Timer client_save;
  639. Timer location_prox_timer;
  640. Timer location_grid_timer;
  641. Timer movement_timer;
  642. Timer regenTimer;
  643. Timer respawn_timer;
  644. Timer shutdownTimer;
  645. Timer spawn_check_add;
  646. Timer spawn_check_remove;
  647. Timer spawn_expire_timer;
  648. Timer spawn_range;
  649. Timer spawn_update;
  650. Timer sync_game_time_timer;
  651. Timer tracking_timer;
  652. Timer weatherTimer;
  653. Timer widget_timer;
  654. /* Enums */
  655. Instance_Type InstanceType;
  656. /* Variables */
  657. volatile bool finished_depop;
  658. volatile bool depop_zone;
  659. volatile bool repop_zone;
  660. volatile bool respawns_allowed;
  661. volatile bool LoadingData;
  662. bool reloading_spellprocess;
  663. bool zoneShuttingDown;
  664. bool cityzone;
  665. bool always_loaded;
  666. bool isInstance;
  667. int32 pNumPlayers;
  668. sint16 minimumStatus;
  669. int16 minimumLevel;
  670. int16 maximumLevel;
  671. int16 minimumVersion;
  672. char zone_name[64];
  673. char zone_file[64];
  674. char zone_description[255];
  675. float underworld;
  676. float safe_x;
  677. float safe_y;
  678. float safe_z;
  679. float safe_heading;
  680. float xp_mod;
  681. volatile int32 zoneID;
  682. bool locked; // JA: implementing /zone lock|unlock commands
  683. int32 instanceID;
  684. string zone_motd;
  685. int32 def_reenter_time;
  686. int32 def_reset_time;
  687. int32 def_lockout_time;
  688. int8 group_zone_option;
  689. float rain;
  690. bool isDusk;
  691. int dusk_hour;
  692. int dawn_hour;
  693. int dusk_minute;
  694. int dawn_minute;
  695. int32 spawn_delete_timer;
  696. map<int16, PacketStruct*> versioned_pos_structs;
  697. map<int16, PacketStruct*> versioned_info_structs;
  698. map<int16, PacketStruct*> versioned_vis_structs;
  699. /* Weather Stuff */
  700. bool weather_enabled; // false = disabled, true = enabled
  701. int8 weather_type; // 0 = normal, 1 = dynamic, 2 = random, 3 = chaotic
  702. int32 weather_frequency; // how often weather changes
  703. float weather_min_severity; // minimum weather severity in a zone
  704. float weather_max_severity; // maximum weather severity in a zone
  705. float weather_change_amount; // how much does the weather change each interval (normal weather conditions)
  706. float weather_dynamic_offset; // max amount the weather change each interval (dynamic weather conditions)
  707. int8 weather_change_chance; // percentage chance the weather will change
  708. int8 weather_pattern; // 0 = decreasing severity, 1 = increasing severity, 2 = random severity
  709. int32 weather_last_changed_time; // last time weather changed (used with weather_frequency)
  710. float weather_current_severity; // current weather conditions in a zone
  711. bool weather_allowed; // from zones.weather_allowed field in database
  712. bool weather_signaled; // whether or not we told the client "it begins to rain"
  713. bool reloading;
  714. map<int32, vector<EntityCommand*>* > entity_command_list;
  715. map<int32, map<int32, int8> > npc_spell_list;
  716. map<int32, map<int32, int16> > npc_skill_list;
  717. map<int32, vector<int32> > npc_equipment_list;
  718. map<int32, NPC*> npc_list;
  719. map<int32,Object*> object_list;
  720. map<int32,Sign*> sign_list;
  721. map<int32,Widget*> widget_list;
  722. map<int32, vector<GroundSpawnEntry*> > groundspawn_entries;
  723. map<int32, vector<GroundSpawnEntryItem*> > groundspawn_items;
  724. Mutex MGroundSpawnItems;
  725. map<int32,GroundSpawn*> groundspawn_list;
  726. map<int32,LootTable*> loot_tables;
  727. map<int32, vector<LootDrop*> > loot_drops;
  728. map<int32, vector<int32> > spawn_loot_list;
  729. vector<GlobalLoot*> level_loot_list;
  730. map<int16, vector<GlobalLoot*> > racial_loot_list;
  731. map<int32, vector<GlobalLoot*> > zone_loot_list;
  732. map<int32, vector<TransportDestination*> > transporters;
  733. map<int32, MutexList<LocationTransportDestination*>* > location_transporters;
  734. Mutex MTransporters;
  735. Mutex MTransportMaps;
  736. // Map <transport if, map name>
  737. map<int32, string> m_transportMaps;
  738. public:
  739. Spawn* GetSpawn(int32 id);
  740. /* Entity Commands */
  741. map<int32, vector<EntityCommand*>*>* GetEntityCommandListAll() {return &entity_command_list;}
  742. vector<EntityCommand*>* GetEntityCommandList(int32 id);
  743. void SetEntityCommandList(int32 id, EntityCommand* command);
  744. void ClearEntityCommands();
  745. EntityCommand* GetEntityCommand(int32 id, string name);
  746. /* NPC's */
  747. void AddNPC(int32 id, NPC* npc);
  748. NPC* GetNPC(int32 id, bool override_loading = false) {
  749. if((!reloading || override_loading) && npc_list.count(id) > 0)
  750. return npc_list[id];
  751. else
  752. return 0;
  753. }
  754. NPC* GetNewNPC(int32 id) {
  755. if(!reloading && npc_list.count(id) > 0)
  756. return new NPC(npc_list[id]);
  757. else
  758. return 0;
  759. }
  760. /* NPC Spells */
  761. void AddNPCSpell(int32 list_id, int32 spell_id, int8 tier);
  762. vector<Spell*>* GetNPCSpells(int32 primary_list, int32 secondary_list);
  763. /* NPC Skills */
  764. void AddNPCSkill(int32 list_id, int32 skill_id, int16 value);
  765. map<string, Skill*>* GetNPCSkills(int32 primary_list, int32 secondary_list);
  766. /* NPC Equipment */
  767. void AddNPCEquipment(int32 list_id, int32 item_id);
  768. void SetNPCEquipment(NPC* npc);
  769. /* Objects */
  770. void AddObject(int32 id, Object* object){ object_list[id] = object; }
  771. Object* GetObject(int32 id, bool override_loading = false) {
  772. if((!reloading || override_loading) && object_list.count(id) > 0)
  773. return object_list[id];
  774. else
  775. return 0;
  776. }
  777. Object* GetNewObject(int32 id) {
  778. if(!reloading && object_list.count(id) > 0)
  779. return object_list[id]->Copy();
  780. else
  781. return 0;
  782. }
  783. /* Signs */
  784. void AddSign(int32 id, Sign* sign){ sign_list[id] = sign; }
  785. Sign* GetSign(int32 id, bool override_loading = false) {
  786. if((!reloading || override_loading) && sign_list.count(id) > 0)
  787. return sign_list[id];
  788. else
  789. return 0;
  790. }
  791. Sign* GetNewSign(int32 id) {
  792. if(!reloading && sign_list.count(id) > 0)
  793. return sign_list[id]->Copy();
  794. else
  795. return 0;
  796. }
  797. /* Widgets */
  798. void AddWidget(int32 id, Widget* widget);
  799. Widget* GetWidget(int32 id, bool override_loading = false);
  800. Widget* GetNewWidget(int32 id);
  801. /* Groundspawns */
  802. // JA: groundspawn revamp
  803. void AddGroundSpawnEntry(int32 groundspawn_id, int16 min_skill_level, int16 min_adventure_level, int8 bonus_table, float harvest1, float harvest3, float harvest5, float harvest_imbue, float harvest_rare, float harvest10, int32 harvest_coin);
  804. void AddGroundSpawnItem(int32 groundspawn_id, int32 item_id, int8 is_rare, int32 grid_id);
  805. vector<GroundSpawnEntry*>* GetGroundSpawnEntries(int32 id);
  806. vector<GroundSpawnEntryItem*>* GetGroundSpawnEntryItems(int32 id);
  807. void LoadGroundSpawnEntries();
  808. void LoadGroundSpawnItems();
  809. //
  810. void DeleteGroundSpawnItems();
  811. void AddGroundSpawn(int32 id, GroundSpawn* spawn);
  812. GroundSpawn* GetGroundSpawn(int32 id, bool override_loading = false);
  813. GroundSpawn* GetNewGroundSpawn(int32 id);
  814. /* Pet names */
  815. vector<string> pet_names;
  816. /* Loot */
  817. void AddLootTable(int32 id, LootTable* table);
  818. void AddLootDrop(int32 id, LootDrop* drop);
  819. void AddSpawnLootList(int32 spawn_id, int32 id);
  820. void ClearSpawnLootList(int32 spawn_id);
  821. void AddLevelLootList(GlobalLoot* loot);
  822. void AddRacialLootList(int16 racial_id, GlobalLoot* loot);
  823. void AddZoneLootList(int32 zone, GlobalLoot* loot);
  824. void ClearLootTables();
  825. vector<int32> GetSpawnLootList(int32 spawn_id, int32 zone_id, int8 spawn_level, int16 racial_id);
  826. vector<LootDrop*>* GetLootDrops(int32 table_id);
  827. LootTable* GetLootTable(int32 table_id);
  828. /* Transporters */
  829. void AddLocationTransporter(int32 zone_id, string message, float trigger_x, float trigger_y, float trigger_z, float trigger_radius, int32 destination_zone_id, float destination_x, float destination_y, float destination_z, float destination_heading, int32 cost, int32 unique_id);
  830. void AddTransporter(int32 transport_id, int8 type, string name, string message, int32 destination_zone_id, float destination_x, float destination_y, float destination_z, float destination_heading, int32 cost, int32 unique_id, int8 min_level, int8 max_level, int32 quest_req, int16 quest_step_req, int32 quest_complete, int32 map_x, int32 map_y);
  831. vector<TransportDestination*>* GetTransporters(int32 transport_id);
  832. MutexList<LocationTransportDestination*>* GetLocationTransporters(int32 zone_id);
  833. void DeleteGlobalTransporters();
  834. ///<summary></summary>
  835. ///<param name='id'>The transport id</param>
  836. ///<param name='name'>Name of the map</param>
  837. void AddTransportMap(int32 id, string name);
  838. ///<summary>Checks to see if the transport has a map</summary>
  839. ///<param name='id'>The transport id we want to check</param>
  840. ///<returns>True if the transport id has a map</returns>
  841. bool TransportHasMap(int32 id);
  842. ///<summary>Gets the map name for the given transport id</summary>
  843. ///<param name='id'>The transport id that we want a map for</param>
  844. ///<returns>Map name</returns>
  845. string GetTransportMap(int32 id);
  846. ///<summary>Clears the list of transporter maps</summary>
  847. void DeleteTransporterMaps();
  848. void DeleteGlobalSpawns();
  849. void ReloadSpawns();
  850. void SendStateCommand(Spawn* spawn, int32 state);
  851. };
  852. #endif