Spawn.h 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. EQ2Emulator is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef __EQ2_SPAWN__
  17. #define __EQ2_SPAWN__
  18. #include <atomic>
  19. #include "../common/types.h"
  20. #include "../common/EQPacket.h"
  21. #include "../common/EQ2_Common_Structs.h"
  22. #include "../common/MiscFunctions.h"
  23. #include "../common/opcodemgr.h"
  24. #include "../common/timer.h"
  25. #include "Commands/Commands.h"
  26. #include "Zone/position.h"
  27. #include "SpawnLists.h"
  28. #include <vector>
  29. #include "../common/ConfigReader.h"
  30. #include "Items/Items.h"
  31. #include "Zone/map.h"
  32. #include "Zone/region_map.h"
  33. #include "Zone/region_map_v1.h"
  34. #include "../common/Mutex.h"
  35. #include "MutexList.h"
  36. #include <deque>
  37. #include <memory> // needed for LS to compile properly on linux
  38. #include <mutex>
  39. #include <algorithm>
  40. #define DAMAGE_PACKET_TYPE_SIPHON_SPELL 0x41
  41. #define DAMAGE_PACKET_TYPE_SIPHON_SPELL2 0x49
  42. #define DAMAGE_PACKET_TYPE_MULTIPLE_DAMAGE 0x80
  43. #define DAMAGE_PACKET_TYPE_SIMPLE_DAMAGE 0xC0
  44. #define DAMAGE_PACKET_TYPE_SPELL_DAMAGE 0xC1
  45. #define DAMAGE_PACKET_TYPE_SIMPLE_CRIT_DMG 0xC4
  46. #define DAMAGE_PACKET_TYPE_SPELL_CRIT_DMG 0xC5
  47. #define DAMAGE_PACKET_TYPE_SPELL_DAMAGE2 0xC8
  48. #define DAMAGE_PACKET_TYPE_SPELL_DAMAGE3 0xC9
  49. #define DAMAGE_PACKET_TYPE_RANGE_DAMAGE 0xE2
  50. #define DAMAGE_PACKET_TYPE_RANGE_SPELL_DMG 0xE3
  51. #define DAMAGE_PACKET_TYPE_RANGE_SPELL_DMG2 0xEA
  52. #define DAMAGE_PACKET_RESULT_NO_DAMAGE 0
  53. #define DAMAGE_PACKET_RESULT_SUCCESSFUL 1
  54. #define DAMAGE_PACKET_RESULT_MISS 4
  55. #define DAMAGE_PACKET_RESULT_DODGE 8
  56. #define DAMAGE_PACKET_RESULT_PARRY 12
  57. #define DAMAGE_PACKET_RESULT_RIPOSTE 16
  58. #define DAMAGE_PACKET_RESULT_BLOCK 20
  59. #define DAMAGE_PACKET_RESULT_DEATH_BLOW 24
  60. #define DAMAGE_PACKET_RESULT_INVULNERABLE 28
  61. #define DAMAGE_PACKET_RESULT_RESIST 36
  62. #define DAMAGE_PACKET_RESULT_REFLECT 40
  63. #define DAMAGE_PACKET_RESULT_IMMUNE 44
  64. #define DAMAGE_PACKET_RESULT_DEFLECT 48
  65. #define DAMAGE_PACKET_RESULT_COUNTER 52
  66. #define DAMAGE_PACKET_RESULT_FOCUS 56 // focus damage
  67. #define DAMAGE_PACKET_RESULT_COUNTER_STRIKE 60
  68. #define DAMAGE_PACKET_RESULT_BASH 64
  69. #define DAMAGE_PACKET_DAMAGE_TYPE_SLASH 0
  70. #define DAMAGE_PACKET_DAMAGE_TYPE_CRUSH 1
  71. #define DAMAGE_PACKET_DAMAGE_TYPE_PIERCE 2
  72. #define DAMAGE_PACKET_DAMAGE_TYPE_HEAT 3
  73. #define DAMAGE_PACKET_DAMAGE_TYPE_COLD 4
  74. #define DAMAGE_PACKET_DAMAGE_TYPE_MAGIC 5
  75. #define DAMAGE_PACKET_DAMAGE_TYPE_MENTAL 6
  76. #define DAMAGE_PACKET_DAMAGE_TYPE_DIVINE 7
  77. #define DAMAGE_PACKET_DAMAGE_TYPE_DISEASE 8
  78. #define DAMAGE_PACKET_DAMAGE_TYPE_POISON 9
  79. #define DAMAGE_PACKET_DAMAGE_TYPE_DROWN 10
  80. #define DAMAGE_PACKET_DAMAGE_TYPE_FALLING 11
  81. #define DAMAGE_PACKET_DAMAGE_TYPE_PAIN 12
  82. #define DAMAGE_PACKET_DAMAGE_TYPE_HIT 13
  83. #define DAMAGE_PACKET_DAMAGE_TYPE_FOCUS 14 // used as a placeholder to translate over to focus from LUA functions and weapons
  84. #define HEAL_PACKET_TYPE_SIMPLE_HEAL 0
  85. #define HEAL_PACKET_TYPE_CRIT_HEAL 1
  86. #define HEAL_PACKET_TYPE_ABSORB 2
  87. #define HEAL_PACKET_TYPE_REGEN_ABSORB 4
  88. #define HEAL_PACKET_TYPE_SIMPLE_MANA 8
  89. #define HEAL_PACKET_TYPE_CRIT_MANA 9
  90. #define HEAL_PACKET_TYPE_SAVAGERY 16
  91. #define HEAL_PACKET_TYPE_CRIT_SAVAGERY 17
  92. #define HEAL_PACKET_TYPE_REPAIR 64
  93. #define HEAL_PACKET_TYPE_CRIT_REPAIR 65
  94. #define ARROW_COLOR_GRAY 0 // 3
  95. #define ARROW_COLOR_GREEN 1 // 1
  96. #define ARROW_COLOR_BLUE 2
  97. #define ARROW_COLOR_WHITE 3 // 3
  98. #define ARROW_COLOR_YELLOW 4 // 4
  99. #define ARROW_COLOR_ORANGE 5 // 5
  100. #define ARROW_COLOR_RED 6
  101. #define ACTIVITY_STATUS_ROLEPLAYING 1
  102. #define ACTIVITY_STATUS_ANONYMOUS 2
  103. #define ACTIVITY_STATUS_LINKDEAD 4
  104. #define ACTIVITY_STATUS_CAMPING 8
  105. #define ACTIVITY_STATUS_LFG 16
  106. #define ACTIVITY_STATUS_LFW 32
  107. #define ACTIVITY_STATUS_SOLID 64 //used by zone objects to remain solid
  108. #define ACTIVITY_STATUS_IMMUNITY_GAINED 8192
  109. #define ACTIVITY_STATUS_IMMUNITY_REMAINING 16384
  110. // WE ARE UNSURE OF THESE OLD CLIENT VALUES USED AS TEMP PLACEHOLDERS FOR NEWER CLIENTS
  111. #define ACTIVITY_STATUS_AFK 32768 // whats the real one?
  112. #define ACTIVITY_STATUS_CORPSE_561 1
  113. #define ACTIVITY_STATUS_NPC_561 1<<1
  114. #define ACTIVITY_STATUS_STATICOBJECT_561 1<<2
  115. #define ACTIVITY_STATUS_MERCHANT_561 1<<4
  116. #define ACTIVITY_STATUS_HIDEICON_561 1<<8
  117. #define ACTIVITY_STATUS_INTERACTABLE_561 1<<9
  118. #define ACTIVITY_STATUS_NOTARGET_561 1<<10
  119. #define ACTIVITY_STATUS_ISTRANSPORT_561 1<<11
  120. #define ACTIVITY_STATUS_SHOWHOUSEICON_561 1<<12
  121. #define ACTIVITY_STATUS_LOOTABLE_561 1<<13
  122. #define ACTIVITY_STATUS_INCOMBAT_561 1<<14
  123. #define ACTIVITY_STATUS_AFK_561 1<<15
  124. #define ACTIVITY_STATUS_ROLEPLAYING_561 1<<16
  125. #define ACTIVITY_STATUS_ANONYMOUS_561 1<<17
  126. #define ACTIVITY_STATUS_LINKDEAD_561 1<<18
  127. #define ACTIVITY_STATUS_CAMPING_561 1<<19
  128. #define ACTIVITY_STATUS_LFG_561 1<<20
  129. #define ACTIVITY_STATUS_LFW_561 1<<21
  130. #define ACTIVITY_STATUS_SOLID_561 1<<22 //used by zone objects to remain solid
  131. #define ACTIVITY_STATUS_MENTORING_561 1<<28
  132. #define ACTIVITY_STATUS_IMMUNITY_GAINED_561 1<<30
  133. #define ACTIVITY_STATUS_IMMUNITY_REMAINING_561 1<<31
  134. #define ACTIVITY_STATUS_MERCENARY_1188 1<<2
  135. #define ACTIVITY_STATUS_STATICOBJECT_1188 1<<3
  136. #define ACTIVITY_STATUS_MERCHANT_1188 1<<4
  137. #define ACTIVITY_STATUS_HIDEICON_1188 1<<9
  138. #define ACTIVITY_STATUS_INTERACTABLE_1188 1<<10
  139. #define ACTIVITY_STATUS_NOTARGET_1188 1<<11
  140. #define ACTIVITY_STATUS_ISTRANSPORT_1188 1<<12
  141. #define ACTIVITY_STATUS_SHOWHOUSEICON_1188 1<<13
  142. #define ACTIVITY_STATUS_LOOTABLE_1188 1<<14
  143. #define ACTIVITY_STATUS_INCOMBAT_1188 1<<15
  144. #define ACTIVITY_STATUS_AFK_1188 1<<16
  145. #define ACTIVITY_STATUS_ROLEPLAYING_1188 1<<17
  146. #define ACTIVITY_STATUS_ANONYMOUS_1188 1<<18
  147. #define ACTIVITY_STATUS_LINKDEAD_1188 1<<19
  148. #define ACTIVITY_STATUS_CAMPING_1188 1<<20
  149. #define ACTIVITY_STATUS_LFG_1188 1<<21
  150. #define ACTIVITY_STATUS_LFW_1188 1<<22
  151. #define ACTIVITY_STATUS_SOLID_1188 1<<23 //used by zone objects to remain solid
  152. #define ACTIVITY_STATUS_MENTORING_1188 1<<28
  153. #define ACTIVITY_STATUS_IMMUNITY_GAINED_1188 1<<30
  154. #define ACTIVITY_STATUS_IMMUNITY_REMAINING_1188 1<<31
  155. #define POS_STATE_KNEELING 64
  156. #define POS_STATE_SOLID 128 //used by most mobs to remaind solid (cant walk through them)
  157. #define POS_STATE_NOTARGET_CURSOR 256 //cant target and no cursor is displayed
  158. #define POS_STATE_CROUCHING 512
  159. #define MERCHANT_TYPE_NO_BUY 1
  160. #define MERCHANT_TYPE_NO_BUY_BACK 2
  161. #define MERCHANT_TYPE_SPELLS 4
  162. #define MERCHANT_TYPE_CRAFTING 8
  163. #define MERCHANT_TYPE_REPAIR 16
  164. #define MERCHANT_TYPE_LOTTO 32
  165. #define MERCHANT_TYPE_CITYMERCHANT 64
  166. #define INFO_VIS_FLAG_INVIS 1
  167. #define INFO_VIS_FLAG_HIDE_HOOD 2
  168. #define INFO_VIS_FLAG_MOUNTED 4
  169. #define INFO_VIS_FLAG_CROUCH 8
  170. #define ENCOUNTER_STATE_NONE 0
  171. #define ENCOUNTER_STATE_AVAILABLE 1
  172. #define ENCOUNTER_STATE_BROKEN 2
  173. #define ENCOUNTER_STATE_LOCKED 3
  174. #define ENCOUNTER_STATE_OVERMATCHED 4
  175. #define ENCOUNTER_STATE_NO_REWARD 5
  176. #define VISUAL_STATE_COLLECTION_TURN_IN 6674
  177. #define VISUAL_STATE_IDLE_AFRAID 17953
  178. #define INFO_CLASSIC_FLAG_INVIS 1
  179. #define INFO_CLASSIC_FLAG_SHOW_HOOD 2
  180. #define INFO_CLASSIC_FLAG_NOLOOK 4
  181. #define INFO_CLASSIC_FLAG_CROUCH 8
  182. using namespace std;
  183. class Spell;
  184. class ZoneServer;
  185. class Quest;
  186. struct LUAHistory;
  187. struct Cell;
  188. struct CellInfo {
  189. Cell* CurrentCell;
  190. int CellListIndex;
  191. };
  192. struct MovementData{
  193. float x;
  194. float y;
  195. float z;
  196. float speed;
  197. int32 delay;
  198. string lua_function;
  199. float heading;
  200. bool use_movement_location_heading;
  201. };
  202. struct BasicInfoStruct{
  203. sint32 cur_hp;
  204. sint32 max_hp;
  205. sint32 hp_base;
  206. sint32 hp_base_instance;
  207. sint32 cur_power;
  208. sint32 max_power;
  209. sint32 power_base;
  210. sint32 power_base_instance;
  211. sint32 cur_savagery;
  212. sint32 max_savagery;
  213. sint32 savagery_base;
  214. sint32 cur_dissonance;
  215. sint32 max_dissonance;
  216. sint32 dissonance_base;
  217. sint16 assigned_aa;
  218. sint16 unassigned_aa;
  219. sint16 tradeskill_aa;
  220. sint16 unassigned_tradeskill_aa;
  221. sint16 prestige_aa;
  222. sint16 unassigned_prestige_aa;
  223. sint16 tradeskill_prestige_aa;
  224. sint16 unassigned_tradeskill_prestige_aa;
  225. int32 aaxp_rewards;
  226. };
  227. struct MovementLocation{
  228. float x;
  229. float y;
  230. float z;
  231. float speed;
  232. //int32 start_time;
  233. //int32 end_time;
  234. bool attackable;
  235. string lua_function;
  236. bool mapped;
  237. int32 gridid;
  238. int8 stage;
  239. bool reset_hp_on_runback;
  240. };
  241. struct SpawnUpdate {
  242. int32 spawn_id;
  243. bool info_changed;
  244. bool vis_changed;
  245. bool pos_changed;
  246. shared_ptr<Client> client;
  247. };
  248. struct SpawnData {
  249. Spawn* spawn;
  250. uchar* data;
  251. int32 size;
  252. };
  253. struct TimedGridData {
  254. int32 timestamp;
  255. int32 grid_id;
  256. float x;
  257. float y;
  258. float z;
  259. float offset_y;
  260. float zone_ground_y;
  261. bool npc_save;
  262. int32 widget_id;
  263. };
  264. enum GroupLootMethod {
  265. METHOD_LEADER=0,
  266. METHOD_FFA=1,
  267. METHOD_LOTTO=2,
  268. METHOD_NEED_BEFORE_GREED=3,
  269. METHOD_ROUND_ROBIN=4
  270. };
  271. enum AutoLootMode {
  272. METHOD_DISABLED=0,
  273. METHOD_ACCEPT=1,
  274. METHOD_DECLINE=2
  275. };
  276. enum LootTier {
  277. ITEMS_ALL=0,
  278. ITEMS_TREASURED_PLUS=1,
  279. ITEMS_LEGENDARY_PLUS=2,
  280. ITEMS_FABLED_PLUS=3
  281. };
  282. class Spawn {
  283. public:
  284. Spawn();
  285. virtual ~Spawn();
  286. template <class Field, class Value> void Set(Field* field, Value value, bool setUpdateFlags = true){
  287. if (setUpdateFlags) {
  288. changed = true;
  289. AddChangedZoneSpawn();
  290. }
  291. *field = value;
  292. }
  293. template <class Field> void Set(Field* field, const char* value, bool setUpdateFlags = true){
  294. if (setUpdateFlags) {
  295. changed = true;
  296. AddChangedZoneSpawn();
  297. }
  298. strcpy(field, value);
  299. }
  300. template <class Field, class Value> void SetPos(Field* field, Value value, bool setUpdateFlags = true){
  301. if(setUpdateFlags){
  302. position_changed = true;
  303. }
  304. Set(field, value, setUpdateFlags);
  305. }
  306. template <class Field, class Value> void SetInfo(Field* field, Value value, bool setUpdateFlags = true){
  307. if(setUpdateFlags){
  308. info_changed = true;
  309. }
  310. Set(field, value);
  311. }
  312. template <class Field, class Value> void SetVis(Field* field, Value value, bool setUpdateFlags = true){
  313. if(setUpdateFlags)
  314. vis_changed = true;
  315. Set(field, value);
  316. }
  317. template <class Field> void SetPos(Field* field, char* value, bool setUpdateFlags = true){
  318. if(setUpdateFlags){
  319. position_changed = true;
  320. }
  321. Set(field, value, setUpdateFlags);
  322. }
  323. template <class Field> void SetInfo(Field* field, char* value, bool setUpdateFlags = true){
  324. if(setUpdateFlags){
  325. info_changed = true;
  326. }
  327. Set(field, value);
  328. }
  329. EntityCommand* CreateEntityCommand(EntityCommand* old_command){
  330. EntityCommand* entity_command = new EntityCommand;
  331. entity_command->name = old_command->name;
  332. entity_command->distance = old_command->distance;
  333. entity_command->command = old_command->command;
  334. entity_command->error_text = old_command->error_text;
  335. entity_command->cast_time = old_command->cast_time;
  336. entity_command->spell_visual = old_command->spell_visual;
  337. entity_command->default_allow_list = old_command->default_allow_list;
  338. return entity_command;
  339. }
  340. EntityCommand* CreateEntityCommand(const char* name, float distance, const char* command, const char* error_text, int16 cast_time, int32 spell_visual, bool default_allow_list=true){
  341. EntityCommand* entity_command = new EntityCommand;
  342. entity_command->name = name;
  343. entity_command->distance = distance;
  344. entity_command->command = command;
  345. entity_command->error_text = error_text;
  346. entity_command->cast_time = cast_time;
  347. entity_command->spell_visual = spell_visual;
  348. entity_command->default_allow_list = default_allow_list;
  349. return entity_command;
  350. }
  351. virtual Client* GetClient() { return 0; }
  352. void AddChangedZoneSpawn();
  353. void AddPrimaryEntityCommand(const char* name, float distance, const char* command, const char* error_text, int16 cast_time, int32 spell_visual, bool defaultDenyList = false, Player* player = NULL);
  354. void RemovePrimaryEntityCommand(const char* command);
  355. bool SetPermissionToEntityCommand(EntityCommand* command, Player* player, bool permissionValue);
  356. bool SetPermissionToEntityCommandByCharID(EntityCommand* command, int32 charID, bool permissionValue);
  357. void RemoveSpawnFromPlayer(Player* player);
  358. void AddSecondaryEntityCommand(const char* name, float distance, const char* command, const char* error_text, int16 cast_time, int32 spell_visual){
  359. secondary_command_list.push_back(CreateEntityCommand(name, distance, command, error_text, cast_time, spell_visual));
  360. }
  361. int8 GetLockedNoLoot(){
  362. return appearance.locked_no_loot;
  363. }
  364. int16 GetEmoteState(){
  365. return appearance.emote_state;
  366. }
  367. int8 GetHideHood(){
  368. return appearance.hide_hood;
  369. }
  370. void SetLockedNoLoot(int8 new_val, bool updateFlags = true){
  371. SetVis(&appearance.locked_no_loot, new_val, updateFlags);
  372. }
  373. void SetHandFlag(int8 new_val, bool updateFlags = true){
  374. SetVis(&appearance.display_hand_icon, new_val, updateFlags);
  375. }
  376. void SetHideHood(int8 new_val, bool updateFlags = true){
  377. SetInfo(&appearance.hide_hood, new_val, updateFlags);
  378. }
  379. void SetEmoteState(int8 new_val, bool updateFlags = true){
  380. SetInfo(&appearance.emote_state, new_val, updateFlags);
  381. }
  382. void SetName(const char* new_name, bool updateFlags = true){
  383. SetInfo(appearance.name, new_name, updateFlags);
  384. }
  385. void SetPrefixTitle(const char* new_prefix_title, bool updateFlags = true) {
  386. SetInfo(appearance.prefix_title, new_prefix_title, updateFlags);
  387. }
  388. void SetSuffixTitle(const char* new_suffix_title, bool updateFlags = true) {
  389. SetInfo(appearance.suffix_title, new_suffix_title, updateFlags);
  390. }
  391. void SetSubTitle(const char* new_sub_title, bool updateFlags = true) {
  392. SetInfo(appearance.sub_title, new_sub_title, updateFlags);
  393. }
  394. void SetLastName(const char* new_last_name, bool updateFlags = true) {
  395. SetInfo(appearance.last_name, new_last_name, updateFlags);
  396. }
  397. void SetAdventureClass(int8 new_class, bool updateFlags = true) {
  398. SetInfo(&appearance.adventure_class, new_class, updateFlags);
  399. }
  400. void SetTradeskillClass(int8 new_class, bool updateFlags = true) {
  401. SetInfo(&appearance.tradeskill_class, new_class, updateFlags);
  402. }
  403. void SetSize(int16 new_size, bool updateFlags = true) {
  404. SetPos(&size, new_size, updateFlags);
  405. }
  406. void SetSpeedX(float speed_x, bool updateFlags = true) {
  407. SetPos(&appearance.pos.SpeedX, speed_x, updateFlags);
  408. }
  409. void SetSpeedY(float speed_y, bool updateFlags = true) {
  410. SetPos(&appearance.pos.SpeedY, speed_y, updateFlags);
  411. }
  412. void SetSpeedZ(float speed_z, bool updateFlags = true) {
  413. SetPos(&appearance.pos.SpeedZ, speed_z, updateFlags);
  414. }
  415. void SetX(float x, bool updateFlags = true){
  416. SetPos(&appearance.pos.X, x, updateFlags);
  417. }
  418. void SetY(float y, bool updateFlags = true, bool disableYMapFix = false);
  419. void SetZ(float z, bool updateFlags = true){
  420. SetPos(&appearance.pos.Z, z, updateFlags);
  421. }
  422. void SetHeading(sint16 dir1, sint16 dir2, bool updateFlags = true){
  423. SetPos(&appearance.pos.Dir1, dir1, updateFlags);
  424. SetPos(&appearance.pos.Dir2, dir2, updateFlags);
  425. }
  426. void SetHeading(float heading, bool updateFlags = true){
  427. last_heading_angle = heading;
  428. if (heading != 180)
  429. heading = (heading - 180) * 64;
  430. SetHeading((sint16)heading, (sint16)heading, updateFlags);
  431. }
  432. void SetPitch(sint16 pitch1, sint16 pitch2, bool updateFlags = true){
  433. SetPos(&appearance.pos.Pitch1, (sint16)pitch1, updateFlags);
  434. SetPos(&appearance.pos.Pitch2, (sint16)pitch2, updateFlags);
  435. }
  436. void SetPitch(float pitch, bool updateFlags = true){
  437. if (pitch == 0){
  438. SetPos(&appearance.pos.Pitch1, (sint16)0, updateFlags);
  439. SetPos(&appearance.pos.Pitch2, (sint16)0, updateFlags);
  440. return;
  441. }
  442. if (pitch != 180)
  443. pitch = (pitch - 180) * 64;
  444. SetPos(&appearance.pos.Pitch1, (sint16)pitch, updateFlags);
  445. SetPos(&appearance.pos.Pitch2, (sint16)pitch, updateFlags);
  446. }
  447. void SetRoll(float roll, bool updateFlags = true){
  448. if (roll == 0){
  449. SetPos(&appearance.pos.Roll, (sint16)0, updateFlags);
  450. return;
  451. }
  452. else if (roll != 180)
  453. roll = (roll - 180) * 64;
  454. SetPos(&appearance.pos.Roll, (sint16)roll, updateFlags);
  455. }
  456. void SetVisualState(int16 state, bool updateFlags = true){
  457. SetInfo(&appearance.visual_state, state, updateFlags);
  458. }
  459. void SetActionState(int16 state, bool updateFlags = true){
  460. SetInfo(&appearance.action_state, state, updateFlags);
  461. }
  462. void SetMoodState(int16 state, bool updateFlags = true){
  463. SetInfo(&appearance.mood_state, state, updateFlags);
  464. }
  465. void SetInitialState(int16 state, bool updateFlags = true){
  466. SetPos(&appearance.pos.state, state, updateFlags);
  467. }
  468. void SetActivityStatus(int16 state, bool updateFlags = true){
  469. SetInfo(&appearance.activity_status, state, updateFlags);
  470. }
  471. void SetCollisionRadius(int32 radius, bool updateFlags = true){
  472. SetPos(&appearance.pos.collision_radius, radius, updateFlags);
  473. }
  474. int16 GetCollisionRadius(){
  475. return appearance.pos.collision_radius;
  476. }
  477. int16 GetVisualState(){
  478. return appearance.visual_state;
  479. }
  480. int16 GetActionState(){
  481. return appearance.action_state;
  482. }
  483. int16 GetMoodState(){
  484. return appearance.mood_state;
  485. }
  486. int16 GetInitialState(){
  487. return appearance.pos.state;
  488. }
  489. int16 GetActivityStatus(){
  490. return appearance.activity_status;
  491. }
  492. int32 GetPrimaryCommandListID(){
  493. return primary_command_list_id;
  494. }
  495. int32 GetSecondaryCommandListID(){
  496. return secondary_command_list_id;
  497. }
  498. void SetID(int32 in_id){
  499. Set(&id, in_id);
  500. }
  501. void SetDifficulty(int8 difficulty, bool setUpdateFlags = true){
  502. SetInfo(&appearance.difficulty, difficulty, setUpdateFlags);
  503. }
  504. virtual void SetLevel(int16 level, bool setUpdateFlags = true){
  505. SetInfo(&appearance.level, level, setUpdateFlags);
  506. }
  507. void SetTSLevel(int16 tradeskill_level, bool setUpdateFlags = true){
  508. SetInfo(&appearance.tradeskill_level, tradeskill_level, setUpdateFlags);
  509. }
  510. void SetGender(int8 gender, bool setUpdateFlags = true){
  511. SetInfo(&appearance.gender, gender, setUpdateFlags);
  512. }
  513. void SetShowName(int8 new_val, bool setUpdateFlags = true){
  514. SetVis(&appearance.display_name, new_val, setUpdateFlags);
  515. }
  516. void SetShowLevel(int8 new_val, bool setUpdateFlags = true){
  517. SetVis(&appearance.show_level, new_val, setUpdateFlags);
  518. }
  519. void SetHeroic(int8 new_val, bool setUpdateFlags = true){
  520. SetInfo(&appearance.heroic_flag, new_val, setUpdateFlags);
  521. }
  522. void SetTargetable(int8 new_val, bool setUpdateFlags = true){
  523. SetVis(&appearance.targetable, new_val, setUpdateFlags);
  524. }
  525. void SetShowCommandIcon(int8 new_val, bool setUpdateFlags = true){
  526. SetVis(&appearance.show_command_icon, new_val, setUpdateFlags);
  527. }
  528. void SetShowHandIcon(int8 new_val, bool setUpdateFlags = true){
  529. SetVis(&appearance.display_hand_icon, new_val, setUpdateFlags);
  530. }
  531. void SetAttackable(int8 new_val, bool setUpdateFlags = true){
  532. SetInfo(&appearance.attackable, new_val, setUpdateFlags);
  533. }
  534. void SetLocation(int32 id, bool setUpdateFlags = true);
  535. void SetRace(int8 race, bool setUpdateFlags = true){
  536. SetInfo(&appearance.race, race, setUpdateFlags);
  537. }
  538. void SetIcon(int8 icon, bool setUpdateFlags = true){
  539. SetInfo(&appearance.icon, icon, setUpdateFlags);
  540. }
  541. void AddIconValue(int8 val){
  542. if(!(appearance.icon & val))
  543. SetIcon(appearance.icon+val);
  544. }
  545. void RemoveIconValue(int8 val){
  546. if((appearance.icon & val))
  547. SetIcon(appearance.icon-val);
  548. }
  549. int8 GetIconValue(){
  550. return appearance.icon;
  551. }
  552. virtual void SetSpeed(float speed){
  553. SetPos(&appearance.pos.Speed1, (int8)speed);
  554. }
  555. virtual float GetSpeed(){
  556. return (float)appearance.pos.Speed1;
  557. }
  558. virtual float GetBaseSpeed(){
  559. return (float)appearance.pos.Speed1;
  560. }
  561. void SetSpawnType(int8 new_type){
  562. SetInfo(&spawn_type, new_type);
  563. }
  564. int8 GetSpawnType(){
  565. return spawn_type;
  566. }
  567. void SetDatabaseID(int32 new_id){
  568. database_id = new_id;
  569. }
  570. int32 GetDatabaseID(){
  571. return database_id;
  572. }
  573. int8 GetShowHandIcon(){
  574. return appearance.display_hand_icon;
  575. }
  576. int32 GetLocation(){
  577. return appearance.pos.grid_id;
  578. }
  579. int8 GetAttackable(){
  580. return appearance.attackable;
  581. }
  582. int8 GetShowName(){
  583. return appearance.display_name;
  584. }
  585. int8 GetShowLevel(){
  586. return appearance.show_level;
  587. }
  588. int8 GetHeroic(){
  589. return appearance.heroic_flag;
  590. }
  591. int8 GetTargetable(){
  592. return appearance.targetable;
  593. }
  594. int8 GetShowCommandIcon(){
  595. return appearance.show_command_icon;
  596. }
  597. char* GetName(){
  598. return appearance.name;
  599. }
  600. char* GetPrefixTitle(){
  601. return appearance.prefix_title;
  602. }
  603. char* GetSuffixTitle(){
  604. return appearance.suffix_title;
  605. }
  606. char* GetSubTitle() {
  607. return appearance.sub_title;
  608. }
  609. char* GetLastName() {
  610. return appearance.last_name;
  611. }
  612. int8 GetAdventureClass() {
  613. return appearance.adventure_class;
  614. }
  615. int8 GetTradeskillClass() {
  616. return appearance.tradeskill_class;
  617. }
  618. float GetDestinationX(){
  619. return appearance.pos.X2;
  620. }
  621. float GetX() {
  622. return appearance.pos.X;
  623. }
  624. float GetSpeedX() {
  625. return appearance.pos.SpeedX;
  626. }
  627. float GetSpeedY() {
  628. return appearance.pos.SpeedY;
  629. }
  630. float GetSpeedZ() {
  631. return appearance.pos.SpeedZ;
  632. }
  633. float GetDestinationY(){
  634. return appearance.pos.Y2;
  635. }
  636. float GetY(){
  637. return appearance.pos.Y;
  638. }
  639. float GetDestinationZ(){
  640. return appearance.pos.Z2;
  641. }
  642. float GetZ(){
  643. return appearance.pos.Z;
  644. }
  645. float GetHeading(){
  646. float heading = 0;
  647. if(appearance.pos.Dir1 != 0){
  648. heading = ((float)appearance.pos.Dir1)/((float)64);
  649. if(heading >= 180)
  650. heading -= 180;
  651. else
  652. heading += 180;
  653. }
  654. return heading;
  655. }
  656. float GetPitch(){
  657. float pitch = 0;
  658. if(appearance.pos.Pitch1 != 0){
  659. pitch = ((float)appearance.pos.Pitch1)/((float)64);
  660. if(pitch >= 180)
  661. pitch -= 180;
  662. else
  663. pitch += 180;
  664. }
  665. return pitch;
  666. }
  667. float GetRoll(){
  668. float roll = 0;
  669. if(appearance.pos.Roll != 0){
  670. roll = ((float)appearance.pos.Roll)/((float)64);
  671. if(roll >= 180)
  672. roll -= 180;
  673. else
  674. roll += 180;
  675. }
  676. return roll;
  677. }
  678. int32 GetID(){
  679. return id;
  680. }
  681. float GetDistance(float x1, float y1, float z1, float x2, float y2, float z2);
  682. float GetDistance(float x, float y, float z, float radius, bool ignore_y = false);
  683. float GetDistance(float x, float y, float z, bool ignore_y = false);
  684. float GetDistance(Spawn* spawn, bool ignore_y = false, bool includeRadius=true);
  685. float GetDistance(Spawn* spawn, float x1, float y1, float z1, bool includeRadius=true);
  686. float CalculateRadius(Spawn* target);
  687. int8 GetDifficulty(){
  688. return appearance.difficulty;
  689. }
  690. sint32 GetTotalPower();
  691. sint32 GetPower();
  692. sint32 GetTotalHP();
  693. sint32 GetHP();
  694. sint32 GetTotalHPBase();
  695. sint32 GetTotalHPBaseInstance();
  696. sint32 GetTotalPowerBase();
  697. sint32 GetTotalPowerBaseInstance();
  698. float GetHPRatio() { return GetHP() == 0 || GetTotalHP() == 0 ? 0 : ((float) GetHP() / GetTotalHP() * 100); }
  699. int GetIntHPRatio() { return GetTotalHP() == 0 ? 0 : static_cast<int>(GetHPRatio()); }
  700. sint32 GetTotalSavagery();
  701. sint32 GetSavagery();
  702. sint32 GetTotalDissonance();
  703. sint32 GetDissonance();
  704. sint32 GetTotalSavageryBase();
  705. sint32 GetTotalDissonanceBase();
  706. sint16 GetAssignedAA();
  707. sint16 GetUnassignedAA();
  708. sint16 GetTradeskillAA();
  709. sint16 GetUnassignedTradeskillAA();
  710. sint16 GetPrestigeAA();
  711. sint16 GetUnassignedPretigeAA();
  712. sint16 GetTradeskillPrestigeAA();
  713. sint16 GetUnassignedTradeskillPrestigeAA();
  714. int32 GetAAXPRewards();
  715. void SetTotalPower(sint32 new_val);
  716. void SetTotalHP(sint32 new_val);
  717. void SetTotalSavagery(sint32 new_val);
  718. void SetTotalDissonance(sint32 new_val);
  719. void SetTotalPowerBase(sint32 new_val);
  720. void SetTotalPowerBaseInstance(sint32 new_val);
  721. void SetTotalHPBase(sint32 new_val);
  722. void SetTotalHPBaseInstance(sint32 new_val);
  723. void SetTotalSavageryBase(sint32 new_val);
  724. void SetTotalDissonanceBase(sint32 new_val);
  725. void SetPower(sint32 power, bool setUpdateFlags = true);
  726. void SetHP(sint32 new_val, bool setUpdateFlags = true);
  727. void SetSavagery(sint32 savagery, bool setUpdateFlags = true);
  728. void SetDissonance(sint32 dissonance, bool setUpdateFlags = true);
  729. void SetAssignedAA(sint16 new_val);
  730. void SetUnassignedAA(sint16 new_val);
  731. void SetTradeskillAA(sint16 new_val);
  732. void SetUnassignedTradeskillAA(sint16 new_val);
  733. void SetPrestigeAA(sint16 new_val);
  734. void SetUnassignedPrestigeAA(sint16 new_val);
  735. void SetTradeskillPrestigeAA(sint16 new_val);
  736. void SetUnassignedTradeskillPrestigeAA(sint16 new_val);
  737. void SetAAXPRewards(int32 amount);
  738. void SetPrivateQuestSpawn(bool val) {req_quests_private = val;}
  739. void SetQuestsRequiredOverride(int16 val) {req_quests_override = val;}
  740. void SetQuestsRequiredContinuedAccess(bool val) {req_quests_continued_access = val;}
  741. bool GetPrivateQuestSpawn() {return req_quests_private;}
  742. int16 GetQuestsRequiredOverride() {return req_quests_override;}
  743. bool GetQuestsRequiredContinuedAccess() {return req_quests_continued_access;}
  744. bool Alive(){ return is_alive; }
  745. void SetAlive(bool val) { is_alive = val; }
  746. int16 GetLevel(){
  747. return appearance.level;
  748. }
  749. int16 GetTSLevel(){
  750. return appearance.tradeskill_level;
  751. }
  752. int8 GetGender(){
  753. return appearance.gender;
  754. }
  755. int8 GetRace(){
  756. return appearance.race;
  757. }
  758. int32 GetSize(){
  759. return size;
  760. }
  761. int32 GetDeviation(){
  762. return deviation;
  763. }
  764. void SetDeviation(int32 in_dev){
  765. deviation = in_dev;
  766. }
  767. float GetSpawnOrigHeading(){
  768. return appearance.pos.SpawnOrigHeading;
  769. }
  770. void SetSpawnOrigHeading(float val){
  771. appearance.pos.SpawnOrigHeading = val;
  772. }
  773. float GetSpawnOrigX(){
  774. return appearance.pos.SpawnOrigX;
  775. }
  776. float GetSpawnOrigY(){
  777. return appearance.pos.SpawnOrigY;
  778. }
  779. float GetSpawnOrigZ(){
  780. return appearance.pos.SpawnOrigZ;
  781. }
  782. float GetSpawnOrigPitch(){
  783. return appearance.pos.SpawnOrigPitch;
  784. }
  785. float GetSpawnOrigRoll(){
  786. return appearance.pos.SpawnOrigRoll;
  787. }
  788. void SetSpawnOrigX(float val){
  789. appearance.pos.SpawnOrigX = val;
  790. }
  791. void SetSpawnOrigY(float val){
  792. appearance.pos.SpawnOrigY = val;
  793. }
  794. void SetSpawnOrigZ(float val){
  795. appearance.pos.SpawnOrigZ = val;
  796. }
  797. void SetSpawnOrigRoll(float val){
  798. appearance.pos.SpawnOrigRoll = val;
  799. }
  800. void SetSpawnOrigPitch(float val){
  801. appearance.pos.SpawnOrigPitch = val;
  802. }
  803. void SetSogaModelType(int16 new_val, bool setUpdateFlags = true){
  804. SetInfo(&appearance.soga_model_type, new_val, setUpdateFlags);
  805. }
  806. void SetModelType(int16 model_type, bool setUpdateFlags = true){
  807. SetInfo(&appearance.model_type, model_type, setUpdateFlags);
  808. SetInfo(&appearance.soga_model_type, model_type, setUpdateFlags);
  809. SetFlyingCreature();
  810. SetWaterCreature();
  811. }
  812. int16 GetSogaModelType(){
  813. return appearance.soga_model_type;
  814. }
  815. int16 GetModelType(){
  816. return appearance.model_type;
  817. }
  818. bool IsFlyingCreature();
  819. bool IsWaterCreature();
  820. bool InWater();
  821. bool InLava();
  822. void SetFlyingCreature();
  823. void SetWaterCreature();
  824. void SetPrimaryCommand(const char* name, const char* command, float distance = 10);
  825. void SetPrimaryCommands(vector<EntityCommand*>* commands);
  826. void SetSecondaryCommands(vector<EntityCommand*>* commands);
  827. vector<EntityCommand*>* GetPrimaryCommands() {return &primary_command_list;}
  828. vector<EntityCommand*>* GetSecondaryCommands() {return &secondary_command_list;}
  829. EntityCommand* FindEntityCommand(string command, bool primaryOnly=false);
  830. virtual EQ2Packet* serialize(Player* player, int16 version);
  831. EQ2Packet* spawn_serialize(Player* player, int16 version, int16 offset = 0, int32 value = 0, int16 offset2 = 0, int16 offset3 = 0, int16 offset4 = 0, int32 value2 = 0);
  832. EQ2Packet* spawn_update_packet(Player* player, int16 version, bool override_changes = false, bool override_vis_changes = false);
  833. EQ2Packet* player_position_update_packet(Player* player, int16 version, bool override_ = false);
  834. uchar* spawn_info_changes(Player* spawn, int16 version, int16* info_packet_size);
  835. uchar* spawn_pos_changes(Player* spawn, int16 version, int16* pos_packet_size, bool override_ = false);
  836. uchar* spawn_vis_changes(Player* spawn, int16 version, int16* vis_packet_size);
  837. uchar* spawn_info_changes_ex(Player* spawn, int16 version, int16* info_packet_size);
  838. uchar* spawn_pos_changes_ex(Player* spawn, int16 version, int16* pos_packet_size);
  839. uchar* spawn_vis_changes_ex(Player* spawn, int16 version, int16* vis_packet_size);
  840. virtual bool EngagedInCombat(){ return false; }
  841. virtual bool IsObject(){ return false; }
  842. virtual bool IsGroundSpawn(){ return false; }
  843. virtual bool IsNPC(){ return false; }
  844. virtual bool IsEntity(){ return false; }
  845. virtual bool IsPlayer(){ return false; }
  846. virtual bool IsWidget(){ return false; }
  847. virtual bool IsSign(){ return false; }
  848. virtual bool IsBot() { return false; }
  849. bool HasInfoChanged(){ return info_changed; }
  850. bool HasPositionChanged(){ return position_changed; }
  851. bool HasTarget(){ return target ? true : false; }
  852. int32 GetRespawnTime();
  853. void SetRespawnTime(int32 time);
  854. int32 GetExpireTime() { return expire_time; }
  855. void SetExpireTime(int32 new_expire_time) { expire_time = new_expire_time; }
  856. int32 GetExpireOffsetTime();
  857. void SetExpireOffsetTime(int32 time);
  858. int32 GetSpawnLocationID();
  859. void SetSpawnLocationID(int32 id);
  860. int32 GetSpawnEntryID();
  861. void SetSpawnEntryID(int32 id);
  862. int32 GetSpawnLocationPlacementID();
  863. void SetSpawnLocationPlacementID(int32 id);
  864. float GetXOffset() { return x_offset; }
  865. void SetXOffset(float new_x_offset) { x_offset = new_x_offset; }
  866. float GetYOffset() { return y_offset; }
  867. void SetYOffset(float new_y_offset) { y_offset = new_y_offset; }
  868. float GetZOffset() { return z_offset; }
  869. void SetZOffset(float new_z_offset) { z_offset = new_z_offset; }
  870. bool HasTrapTriggered() {
  871. return trap_triggered;
  872. }
  873. int32 GetTrapState() {
  874. return trap_state;
  875. }
  876. void SetChestDropTime() {
  877. chest_drop_time = Timer::GetCurrentTime2();
  878. trap_opened_time = 0;
  879. }
  880. void SetTrapTriggered(bool triggered, int32 state) {
  881. if(!trap_triggered && triggered)
  882. trap_opened_time = Timer::GetCurrentTime2();
  883. trap_triggered = triggered;
  884. trap_state = state;
  885. }
  886. int32 GetChestDropTime() {
  887. return chest_drop_time;
  888. }
  889. int32 GetTrapOpenedTime() {
  890. return trap_opened_time;
  891. }
  892. void AddLootItem(int32 id, int16 charges = 1) {
  893. Item* master_item = master_item_list.GetItem(id);
  894. if (master_item) {
  895. Item* item = new Item(master_item);
  896. item->details.count = charges;
  897. LockLoot();
  898. loot_items.push_back(item);
  899. UnlockLoot();
  900. }
  901. }
  902. void AddLootItem(Item* item) {
  903. if(item) {
  904. LockLoot();
  905. loot_items.push_back(item);
  906. UnlockLoot();
  907. }
  908. }
  909. bool HasLoot() {
  910. LockLoot();
  911. if (loot_items.size() == 0 && loot_coins == 0) {
  912. UnlockLoot();
  913. return false;
  914. }
  915. UnlockLoot();
  916. return true;
  917. }
  918. void TransferLoot(Spawn* spawn);
  919. bool HasLootItemID(int32 id);
  920. int32 GetLootItemID();
  921. Item* LootItem(int32 id);
  922. vector<Item*>* GetLootItems() {
  923. return &loot_items;
  924. }
  925. void LockLoot() {
  926. MLootItems.lock();
  927. }
  928. void UnlockLoot() {
  929. MLootItems.unlock();
  930. }
  931. void ClearLoot() {
  932. MLootItems.lock();
  933. vector<Item*>::iterator itr;
  934. for (itr = loot_items.begin(); itr != loot_items.end();) {
  935. Item* itm = *itr;
  936. itr++;
  937. safe_delete(itm);
  938. }
  939. loot_items.clear();
  940. MLootItems.unlock();
  941. }
  942. int32 GetLootCount() {
  943. int32 loot_item_count = 0;
  944. MLootItems.lock();
  945. loot_item_count = loot_items.size();
  946. MLootItems.unlock();
  947. return loot_item_count;
  948. }
  949. void ClearNonBodyLoot() {
  950. MLootItems.lock();
  951. vector<Item*>::iterator itr;
  952. for (itr = loot_items.begin(); itr != loot_items.end();) {
  953. Item* itm = *itr;
  954. if(!itm->IsBodyDrop())
  955. {
  956. itr = loot_items.erase(itr);
  957. safe_delete(itm);
  958. }
  959. else
  960. itr++;
  961. }
  962. MLootItems.unlock();
  963. }
  964. int32 GetLootCoins() {
  965. LockLoot();
  966. int32 coins = loot_coins;
  967. UnlockLoot();
  968. return coins;
  969. }
  970. void SetLootCoins(int32 val, bool lockloot = true) {
  971. if(lockloot)
  972. LockLoot();
  973. loot_coins = val;
  974. if(lockloot)
  975. UnlockLoot();
  976. }
  977. void AddLootCoins(int32 coins) {
  978. LockLoot();
  979. loot_coins += coins;
  980. UnlockLoot();
  981. }
  982. Spawn* GetTarget();
  983. void SetTarget(Spawn* spawn);
  984. Spawn* GetLastAttacker();
  985. void SetLastAttacker(Spawn* spawn);
  986. bool TakeDamage(int32 damage);
  987. ZoneServer* GetZone();
  988. virtual void SetZone(ZoneServer* in_zone, int32 version=0);
  989. void SetFactionID(int32 val) { faction_id = val; }
  990. int32 GetFactionID(){
  991. return faction_id;
  992. }
  993. static int32 NextID() {
  994. static CriticalSection id_lock;
  995. id_lock.lock();
  996. int32 ret = ++next_id;
  997. if (next_id == 0xFFFFFFFE)
  998. next_id = 1;
  999. else if ((next_id - 255) % 256 == 0) { //we dont want it to end in 255, it will confuse/crash the client
  1000. id_lock.unlock();
  1001. return NextID();
  1002. }
  1003. id_lock.unlock();
  1004. return ret;
  1005. }
  1006. void AddProvidedQuest(int32 val){
  1007. quest_ids.push_back(val);
  1008. }
  1009. vector<int32>* GetProvidedQuests(){
  1010. return &quest_ids;
  1011. }
  1012. bool HasProvidedQuests(){
  1013. return (quest_ids.size() > 0);
  1014. }
  1015. void SetSpawnScript(string name);
  1016. const char* GetSpawnScript();
  1017. vector<Spawn*>* GetSpawnGroup();
  1018. bool HasSpawnGroup();
  1019. bool IsInSpawnGroup(Spawn* spawn);
  1020. Spawn* IsSpawnGroupMembersAlive(Spawn* ignore_spawn=nullptr, bool npc_only = true);
  1021. void UpdateEncounterState(int8 new_state);
  1022. void CheckEncounterState(Entity* victim, bool test_auto_lock = false);
  1023. void AddTargetToEncounter(Entity* entity);
  1024. void SendSpawnChanges(bool val){ send_spawn_changes = val; }
  1025. void SetSpawnGroupID(int32 id);
  1026. int32 GetSpawnGroupID();
  1027. void AddSpawnToGroup(Spawn* spawn);
  1028. void SetSpawnGroupList(vector<Spawn*>* list, Mutex* mutex);
  1029. void RemoveSpawnFromGroup(bool erase_all = false);
  1030. void SetRunningTo(Spawn* spawn){ running_to = spawn->GetID(); }
  1031. Spawn* GetRunningTo();
  1032. void SetTempVisualState(int val, bool update = true) { SetInfo(&tmp_visual_state, val, update); }
  1033. int GetTempVisualState(){ return tmp_visual_state; }
  1034. void SetTempActionState(int val, bool update = true) { SetInfo(&tmp_action_state, val, update); }
  1035. int GetTempActionState(){ return tmp_action_state; }
  1036. void AddAllowAccessSpawn(Spawn* spawn){ allowed_access[spawn->GetID()] = 1; }
  1037. void RemoveSpawnAccess(Spawn* spawn);
  1038. bool IsPrivateSpawn(){ return allowed_access.size() > 0 ;}
  1039. bool AllowedAccess(Spawn* spawn){ return allowed_access.count(spawn->GetID()) > 0; }
  1040. void MakeSpawnPublic() { allowed_access.clear(); }
  1041. void SetSizeOffset(int8 offset);
  1042. int8 GetSizeOffset();
  1043. void SetMerchantID(int32 val);
  1044. int32 GetMerchantID();
  1045. void SetMerchantType(int8 val);
  1046. int8 GetMerchantType();
  1047. void SetCollector(bool is_it) { is_collector = is_it; }
  1048. bool IsCollector() { return is_collector; }
  1049. void SetMerchantLevelRange(int32 minLvl = 0, int32 maxLvl = 0);
  1050. bool IsClientInMerchantLevelRange(Client* ent, bool sendMessageIfDenied = true);
  1051. int32 GetMerchantMinLevel();
  1052. int32 GetMerchantMaxLevel();
  1053. void SetQuestsRequired(Spawn* new_spawn);
  1054. void SetQuestsRequired(int32 quest_id, int16 quest_step);
  1055. bool HasQuestsRequired();
  1056. bool HasHistoryRequired();
  1057. void SetRequiredHistory(int32 event_id, int32 value1, int32 value2);
  1058. void SetTransporterID(int32 id);
  1059. int32 GetTransporterID();
  1060. bool MeetsSpawnAccessRequirements(Player* player);
  1061. void RemovePrimaryCommands();
  1062. void InitializePosPacketData(Player* player, PacketStruct* packet, bool bSpawnUpdate = false);
  1063. void InitializeInfoPacketData(Player* player, PacketStruct* packet);
  1064. void InitializeVisPacketData(Player* player, PacketStruct* packet);
  1065. void InitializeHeaderPacketData(Player* player, PacketStruct* packet, int16 index);
  1066. void InitializeFooterPacketData(Player* player, PacketStruct* packet);
  1067. void MoveToLocation(Spawn* spawn, float distance, bool immediate = true, bool isMappedLocation = false);
  1068. void AddMovementLocation(float x, float y, float z, float speed, int16 delay, const char* lua_function, float heading, bool include_heading = false);
  1069. void ProcessMovement(bool isSpawnListLocked=false);
  1070. void ResetMovement();
  1071. bool ValidateRunning(bool lockMovementLocation, bool lockMovementLoop);
  1072. bool IsRunning();
  1073. void CalculateRunningLocation(bool stop = false);
  1074. void RunToLocation(float x, float y, float z, float following_x = 0, float following_y = 0, float following_z = 0);
  1075. MovementLocation* GetCurrentRunningLocation();
  1076. MovementLocation* GetLastRunningLocation();
  1077. void NewWaypointChange(MovementLocation* data);
  1078. bool CalculateChange();
  1079. void AddRunningLocation(float x, float y, float z, float speed, float distance_away = 0, bool attackable = true, bool finished_adding_locations = true, string lua_function = "", bool isMapped=false);
  1080. bool RemoveRunningLocation();
  1081. void ClearRunningLocations();
  1082. void CopySpawnAppearance(Spawn* spawn);
  1083. bool MovementInterrupted(){ return movement_interrupted; }
  1084. void MovementInterrupted(bool val) { movement_interrupted = val; }
  1085. bool NeedsToResumeMovement(){ return attack_resume_needed; }
  1086. void NeedsToResumeMovement(bool val) { attack_resume_needed = val; }
  1087. bool HasMovementLoop(){ return movement_loop.size() > 0; }
  1088. bool HasMovementLocations() {
  1089. bool hasLocations = false;
  1090. MMovementLocations.lock_shared();
  1091. hasLocations = movement_locations ? movement_locations->size() > 0 : false;
  1092. MMovementLocations.unlock_shared();
  1093. return hasLocations;
  1094. }
  1095. Timer* GetRunningTimer();
  1096. float GetFaceTarget(float x, float z);
  1097. void FaceTarget(float x, float z);
  1098. void FaceTarget(Spawn* target, bool disable_action_state = true);
  1099. void SetInvulnerable(bool val);
  1100. bool GetInvulnerable();
  1101. void SetScaredByStrongPlayers(bool val) { scared_by_strong_players = val; }
  1102. bool IsScaredByStrongPlayers() { return scared_by_strong_players; }
  1103. std::atomic<bool> changed;
  1104. std::atomic<bool> position_changed;
  1105. std::atomic<bool> info_changed;
  1106. std::atomic<bool> vis_changed;
  1107. std::atomic<bool> is_running;
  1108. int16 size;
  1109. int32 faction_id;
  1110. int8 oversized_packet; //0xff
  1111. int32 id;
  1112. int8 unknown1;
  1113. int32 unknown2;
  1114. int32 primary_command_list_id;
  1115. int32 secondary_command_list_id;
  1116. vector<EntityCommand*> primary_command_list;
  1117. vector<EntityCommand*> secondary_command_list;
  1118. int32 group_id;
  1119. int8 group_len;
  1120. vector<Spawn*>* spawn_group_list;
  1121. AppearanceData appearance;
  1122. int32 last_movement_update;
  1123. int32 last_location_update;
  1124. bool forceMapCheck;
  1125. bool is_water_creature;
  1126. bool is_flying_creature;
  1127. int32 trigger_widget_id;
  1128. std::atomic<bool> following;
  1129. bool IsPet() { return is_pet; }
  1130. void SetPet(bool val) { is_pet = val; }
  1131. Mutex m_requiredQuests;
  1132. Mutex m_requiredHistory;
  1133. void SetFollowTarget(Spawn* spawn, int32 followDistance=0);
  1134. Spawn* GetFollowTarget();
  1135. /// <summary>Sets a user defined variable</summary>
  1136. /// <param name='var'>Variable we are setting</param>
  1137. /// <param name='val'>Value to set the variable to</param>
  1138. void AddTempVariable(string var, string val);
  1139. void AddTempVariable(string var, Spawn* val);
  1140. void AddTempVariable(string var, ZoneServer* val);
  1141. void AddTempVariable(string var, Quest* val);
  1142. void AddTempVariable(string var, Item* val);
  1143. /// <summary>Gets the value for the given variable</summary>
  1144. /// <param name='var'>Variable to check</param>
  1145. /// <returns>The value for the given variable, "" if variable was not set</returns>
  1146. string GetTempVariable(string var);
  1147. Spawn* GetTempVariableSpawn(string var);
  1148. ZoneServer* GetTempVariableZone(string var);
  1149. Item* GetTempVariableItem(string var);
  1150. Quest* GetTempVariableQuest(string var);
  1151. int8 GetTempVariableType(string var);
  1152. void DeleteTempVariable(string var);
  1153. void SetIllusionModel(int16 val, bool setUpdateFlags = true) {
  1154. SetInfo(&m_illusionModel, val, setUpdateFlags);
  1155. }
  1156. int16 GetIllusionModel() { return m_illusionModel; }
  1157. CellInfo Cell_Info;
  1158. int32 GetSpawnAnim() { return m_spawnAnim; }
  1159. void SetSpawnAnim(int32 value) { m_spawnAnim = value; }
  1160. int32 GetAddedToWorldTimestamp() { return m_addedToWorldTimestamp; }
  1161. void SetAddedToWorldTimestamp(int32 value) { m_addedToWorldTimestamp = value; }
  1162. int16 GetSpawnAnimLeeway() { return m_spawnAnimLeeway; }
  1163. void SetSpawnAnimLeeway(int16 value) { m_spawnAnimLeeway = value; }
  1164. float FindDestGroundZ(glm::vec3 dest, float z_offset);
  1165. float FindBestZ(glm::vec3 loc, glm::vec3* result=nullptr, int32* new_grid_id=nullptr, int32* new_widget_id=nullptr);
  1166. float GetFixedZ(const glm::vec3& destination, int32 z_find_offset = 1);
  1167. void FixZ(bool forceUpdate=false);
  1168. bool CheckLoS(Spawn* target);
  1169. bool CheckLoS(glm::vec3 myloc, glm::vec3 oloc);
  1170. void CalculateNewFearpoint();
  1171. enum SpawnProximityType {
  1172. SPAWNPROXIMITY_DATABASE_ID = 0,
  1173. SPAWNPROXIMITY_LOCATION_ID = 1
  1174. };
  1175. struct SpawnProximity {
  1176. float x;
  1177. float y;
  1178. float z;
  1179. int32 spawn_value;
  1180. int8 spawn_type;
  1181. float distance;
  1182. string in_range_lua_function;
  1183. string leaving_range_lua_function;
  1184. map<int32, bool> spawns_in_proximity;
  1185. };
  1186. void AddSpawnToProximity(int32 spawnValue, SpawnProximityType type);
  1187. void RemoveSpawnFromProximity(int32 spawnValue, SpawnProximityType type);
  1188. SpawnProximity* AddLUASpawnProximity(int32 spawnValue, SpawnProximityType type, float distance, string in_range_function, string leaving_range_function) {
  1189. SpawnProximity* prox = new SpawnProximity;
  1190. prox->spawn_value = spawnValue;
  1191. prox->spawn_type = type;
  1192. prox->distance = distance;
  1193. prox->in_range_lua_function = in_range_function;
  1194. prox->leaving_range_lua_function = leaving_range_function;
  1195. spawn_proximities.Add(prox);
  1196. has_spawn_proximities = true;
  1197. return prox;
  1198. }
  1199. void RemoveSpawnProximities() {
  1200. MutexList<SpawnProximity*>::iterator itr = spawn_proximities.begin();
  1201. while (itr.Next()) {
  1202. safe_delete(itr->value);
  1203. }
  1204. spawn_proximities.clear();
  1205. has_spawn_proximities = false;
  1206. }
  1207. Mutex MCommandMutex;
  1208. bool has_spawn_proximities;
  1209. void SetPickupItemID(int32 itemid)
  1210. {
  1211. pickup_item_id = itemid;
  1212. }
  1213. void SetPickupUniqueItemID(int32 uniqueid)
  1214. {
  1215. pickup_unique_item_id = uniqueid;
  1216. }
  1217. int32 GetPickupItemID() { return pickup_item_id; }
  1218. int32 GetPickupUniqueItemID() { return pickup_unique_item_id; }
  1219. bool IsSoundsDisabled() { return disable_sounds; }
  1220. void SetSoundsDisabled(bool val) { disable_sounds = val; }
  1221. RegionMap* GetRegionMap() { return region_map; }
  1222. Map* GetMap() { return current_map; }
  1223. std::map<int32,TimedGridData> established_grid_id;
  1224. void DeleteRegion(Region_Node* inNode, ZBSP_Node* rootNode);
  1225. bool InRegion(Region_Node* inNode, ZBSP_Node* rootNode);
  1226. int32 GetRegionType(Region_Node* inNode, ZBSP_Node* rootNode);
  1227. float SpawnAngle(Spawn* target, float selfx, float selfz);
  1228. bool BehindSpawn(Spawn *target, float selfx, float selfz)
  1229. { return (!target || target == this) ? false : SpawnAngle(target, selfx, selfz) > 90.0f; }
  1230. bool InFrontSpawn(Spawn *target, float selfx, float selfz)
  1231. { return (!target || target == this) ? false : SpawnAngle(target, selfx, selfz) < 63.0f; }
  1232. bool IsFlankingSpawn(Spawn *target, float selfx, float selfz)
  1233. { return (!target || target == this) ? false : SpawnAngle(target, selfx, selfz) > 63.0f; }
  1234. std::map<std::map<Region_Node*, ZBSP_Node*>, Region_Status> Regions;
  1235. Mutex RegionMutex;
  1236. virtual void StopMovement();
  1237. virtual bool PauseMovement(int32 period_of_time_ms);
  1238. virtual bool IsPauseMovementTimerActive();
  1239. bool IsTransportSpawn() { return is_transport_spawn; }
  1240. void SetTransportSpawn(bool val) { is_transport_spawn = val; }
  1241. sint64 GetRailID() { return rail_id; }
  1242. void SetRailID(sint64 val) { rail_id = val; }
  1243. void AddRailPassenger(int32 char_id);
  1244. void RemoveRailPassenger(int32 char_id);
  1245. vector<Spawn*> GetPassengersOnRail();
  1246. void SetAppearancePosition(float x, float y, float z);
  1247. void SetOmittedByDBFlag(bool val) { is_omitted_by_db_flag = val; }
  1248. bool IsOmittedByDBFlag() { return is_omitted_by_db_flag; }
  1249. int32 GetLootTier() { return loot_tier; }
  1250. void SetLootTier(int32 tier) { loot_tier = tier; }
  1251. int32 GetLootDropType() { return loot_drop_type; }
  1252. void SetLootDropType(int32 type) { loot_drop_type = type; }
  1253. void SetDeletedSpawn(bool val) { deleted_spawn = val; }
  1254. bool IsDeletedSpawn() { return deleted_spawn; }
  1255. int32 InsertRegionToSpawn(Region_Node* node, ZBSP_Node* bsp_root, WaterRegionType regionType, bool in_region = true);
  1256. bool HasRegionTracked(Region_Node* node, ZBSP_Node* bsp_root, bool in_region);
  1257. int8 GetArrowColor(int8 spawn_level);
  1258. void AddIgnoredWidget(int32 id);
  1259. void SendGroupUpdate();
  1260. void OverrideLootMethod(GroupLootMethod newMethod) { loot_method = newMethod; }
  1261. void SetLootMethod(GroupLootMethod method, int8 item_rarity = 0, int32 group_id = 0);
  1262. int32 GetLootGroupID() { return loot_group_id; }
  1263. GroupLootMethod GetLootMethod() { return loot_method; }
  1264. int8 GetLootRarity() { return loot_rarity; }
  1265. int32 GetLootTimeRemaining() { return loot_timer.GetRemainingTime(); }
  1266. bool IsLootTimerRunning() { return loot_timer.Enabled(); }
  1267. bool CheckLootTimer() { return loot_timer.Check(); }
  1268. void DisableLootTimer() { return loot_timer.Disable(); }
  1269. int32 GetLooterSpawnID() { return looter_spawn_id; }
  1270. void SetLooterSpawnID(int32 id) { looter_spawn_id = id; }
  1271. bool AddNeedGreedItemRequest(int32 item_id, int32 spawn_id, bool need_item);
  1272. bool AddLottoItemRequest(int32 item_id, int32 spawn_id);
  1273. void AddSpawnLootWindowCompleted(int32 spawn_id, bool status_);
  1274. bool SetSpawnLootWindowCompleted(int32 spawn_id);
  1275. bool HasSpawnLootWindowCompleted(int32 spawn_id);
  1276. bool HasSpawnNeedGreedEntry(int32 item_id, int32 spawn_id);
  1277. bool HasSpawnLottoEntry(int32 item_id, int32 spawn_id);
  1278. void GetSpawnLottoEntries(int32 item_id, std::map<int32, int32>* out_entries);
  1279. void GetLootItemsList(std::vector<int32>* out_entries);
  1280. void GetSpawnNeedGreedEntries(int32 item_id, bool need_item, std::map<int32, int32>* out_entries);
  1281. bool HasLootWindowCompleted();
  1282. bool IsLootWindowComplete() { return is_loot_complete; }
  1283. void SetLootDispensed() { is_loot_dispensed = true; }
  1284. bool IsLootDispensed() { return is_loot_dispensed; }
  1285. std::map<int32, bool>* GetLootWindowList() { return &loot_complete; }
  1286. void StartLootTimer(Spawn* looter);
  1287. void CloseLoot(Spawn* sender);
  1288. void SetLootName(char* name) {
  1289. if(name != nullptr) {
  1290. loot_name = std::string(name);
  1291. }
  1292. }
  1293. const char* GetLootName() { return loot_name.c_str(); }
  1294. bool IsItemInLootTier(Item* item);
  1295. void DistributeGroupLoot_RoundRobin(std::vector<int32>* item_list, bool roundRobinTrashLoot = false); // trash loot is what falls under the item tier requirement by group options
  1296. void CalculateInitialVelocity(float heading, float distanceHorizontal, float distanceVertical, float distanceDepth, float duration);
  1297. glm::vec3 CalculateProjectilePosition(glm::vec3 initialVelocity, float time);
  1298. bool CalculateSpawnProjectilePosition(float x, float y, float z);
  1299. void SetKnockback(Spawn* target, int32 duration, float vertical, float horizontal);
  1300. void ResetKnockedBack();
  1301. mutable std::shared_mutex MIgnoredWidgets;
  1302. std::map<int32, bool> ignored_widgets;
  1303. EquipmentItemList equipment_list;
  1304. EquipmentItemList appearance_equipment_list;
  1305. protected:
  1306. bool has_quests_required;
  1307. bool has_history_required;
  1308. bool send_spawn_changes;
  1309. bool invulnerable;
  1310. bool attack_resume_needed;
  1311. bool resume_movement;
  1312. bool movement_interrupted;
  1313. int32 running_timer_begin;
  1314. int32 running_timer_end;
  1315. vector<MovementData*> movement_loop;
  1316. bool running_timer_updated;
  1317. int16 movement_index;
  1318. int32 last_grid_update;
  1319. int32 movement_start_time;
  1320. Mutex MMovementLoop;
  1321. map<int32, int8> allowed_access;
  1322. vector<int32> quest_ids;
  1323. int32 database_id;
  1324. int32 packet_num;
  1325. int32 target;
  1326. int8 spawn_type;
  1327. int32 last_attacker;
  1328. int32 merchant_id;
  1329. int8 merchant_type;
  1330. int32 merchant_min_level;
  1331. int32 merchant_max_level;
  1332. int32 transporter_id;
  1333. int32 pickup_item_id;
  1334. int32 pickup_unique_item_id;
  1335. map<int32, vector<int16>* > required_quests;
  1336. map<int32, LUAHistory*> required_history;
  1337. MutexList<SpawnProximity*> spawn_proximities;
  1338. void CheckProximities();
  1339. Timer pause_timer;
  1340. bool IsKnockedBack() { return knocked_back; }
  1341. private:
  1342. int32 loot_group_id;
  1343. GroupLootMethod loot_method;
  1344. int8 loot_rarity;
  1345. Timer loot_timer;
  1346. int32 looter_spawn_id;
  1347. vector<Item*> loot_items;
  1348. int32 loot_coins;
  1349. std::multimap<int32, int32> lotto_items;
  1350. std::multimap<int32, std::pair<int32, bool>> need_greed_items;
  1351. std::map<int32, bool> loot_complete;
  1352. bool is_loot_complete;
  1353. bool is_loot_dispensed;
  1354. std::string loot_name;
  1355. bool trap_triggered;
  1356. int32 trap_state;
  1357. int32 chest_drop_time;
  1358. int32 trap_opened_time;
  1359. deque<MovementLocation*>* movement_locations;
  1360. Mutex MLootItems;
  1361. mutable std::shared_mutex MMovementLocations;
  1362. Mutex* MSpawnGroup;
  1363. int8 size_offset;
  1364. int tmp_visual_state;
  1365. int tmp_action_state;
  1366. int32 running_to;
  1367. string spawn_script;
  1368. static int32 next_id;
  1369. ZoneServer* zone;
  1370. int32 spawn_location_id;
  1371. int32 spawn_entry_id;
  1372. int32 spawn_location_spawns_id;
  1373. int32 respawn;
  1374. int32 expire_time;
  1375. int32 expire_offset;
  1376. float x_offset;
  1377. float y_offset;
  1378. float z_offset;
  1379. int32 deviation;
  1380. BasicInfoStruct basic_info;
  1381. //string data;
  1382. bool is_pet;
  1383. // m_followTarget = spawn to follow around
  1384. int32 m_followTarget;
  1385. int32 m_followDistance;
  1386. bool req_quests_private;
  1387. int16 req_quests_override;
  1388. bool req_quests_continued_access;
  1389. float last_heading_angle;
  1390. map<string, int8> m_tempVariableTypes;
  1391. map<string, int32> m_tempVariableSpawn;
  1392. map<string, ZoneServer*> m_tempVariableZone;
  1393. map<string, Item*> m_tempVariableItem;
  1394. map<string, Quest*> m_tempVariableQuest;
  1395. // m_tempVariables = stores user defined variables from lua, will not persist through a zone
  1396. map<string, string> m_tempVariables;
  1397. int16 m_illusionModel;
  1398. int32 m_spawnAnim;
  1399. int32 m_addedToWorldTimestamp;
  1400. int16 m_spawnAnimLeeway;
  1401. Mutex m_Update;
  1402. Mutex m_SpawnMutex;
  1403. bool disable_sounds;
  1404. RegionMap* region_map;
  1405. Map* current_map;
  1406. bool is_transport_spawn;
  1407. sint64 rail_id;
  1408. map<int32, bool> rail_passengers;
  1409. mutex m_RailMutex;
  1410. bool is_omitted_by_db_flag; // this particular spawn is omitted by an expansion or holiday flag
  1411. int32 loot_tier;
  1412. int32 loot_drop_type;
  1413. std::atomic<bool> deleted_spawn;
  1414. std::atomic<bool> reset_movement;
  1415. Mutex m_GridMutex;
  1416. bool is_collector;
  1417. bool scared_by_strong_players;
  1418. std::atomic<bool> is_alive;
  1419. std::atomic<bool> knocked_back;
  1420. float knocked_back_time_step;
  1421. float knocked_back_h_distance;
  1422. float knocked_back_v_distance;
  1423. float knocked_back_duration;
  1424. float knocked_back_start_x;
  1425. float knocked_back_start_y;
  1426. float knocked_back_start_z;
  1427. int32 knocked_back_end_time;
  1428. float knocked_angle;
  1429. glm::vec3 knocked_velocity;
  1430. };
  1431. #endif