9
3

zoneserver.h 40 KB

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