zoneserver.h 41 KB

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