zoneserver.h 40 KB

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