Entity.h 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758
  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_ENTITY__
  17. #define __EQ2_ENTITY__
  18. #include "Spawn.h"
  19. #include "../common/Mutex.h"
  20. #include "Skills.h"
  21. #include "MutexList.h"
  22. #include "MutexVector.h"
  23. #include <set>
  24. #include <mutex>
  25. #include <vector>
  26. #include <boost/function.hpp>
  27. #include <boost/lambda/bind.hpp>
  28. namespace l = boost::lambda;
  29. class Entity;
  30. class NPC;
  31. class Trade;
  32. struct LuaSpell;
  33. struct GroupMemberInfo;
  34. struct BonusValues{
  35. int32 spell_id;
  36. int8 tier;
  37. int16 type;
  38. sint32 value;
  39. int64 class_req;
  40. vector<int16> race_req;
  41. vector<int16> faction_req;
  42. LuaSpell* luaspell;
  43. };
  44. struct MaintainedEffects{
  45. char name[60]; //name of the spell
  46. int32 target;
  47. int8 target_type;
  48. int32 spell_id;
  49. int32 slot_pos;
  50. int16 icon;
  51. int16 icon_backdrop;
  52. int8 conc_used;
  53. int8 tier;
  54. float total_time;
  55. int32 expire_timestamp;
  56. LuaSpell* spell;
  57. };
  58. struct SpellEffects{
  59. int32 spell_id;
  60. Entity* caster;
  61. float total_time;
  62. int32 expire_timestamp;
  63. int16 icon;
  64. int16 icon_backdrop;
  65. int8 tier;
  66. LuaSpell* spell;
  67. };
  68. struct DetrimentalEffects {
  69. int32 spell_id;
  70. Entity* caster;
  71. int32 expire_timestamp;
  72. int16 icon;
  73. int16 icon_backdrop;
  74. int8 tier;
  75. int8 det_type;
  76. bool incurable;
  77. LuaSpell* spell;
  78. int8 control_effect;
  79. float total_time;
  80. };
  81. struct CombatData{
  82. int32 range_last_attack_time;
  83. int32 primary_last_attack_time;
  84. int32 secondary_last_attack_time;
  85. int16 primary_attack_delay;
  86. int16 secondary_attack_delay;
  87. int16 ranged_attack_delay;
  88. int8 primary_weapon_type;
  89. int8 secondary_weapon_type;
  90. int8 ranged_weapon_type;
  91. int32 primary_weapon_damage_low;
  92. int32 primary_weapon_damage_high;
  93. int32 secondary_weapon_damage_low;
  94. int32 secondary_weapon_damage_high;
  95. int32 ranged_weapon_damage_low;
  96. int32 ranged_weapon_damage_high;
  97. int8 wield_type;
  98. int16 primary_weapon_delay;
  99. int16 secondary_weapon_delay;
  100. int16 ranged_weapon_delay;
  101. };
  102. struct InfoStruct{
  103. InfoStruct()
  104. {
  105. name_ = std::string("");
  106. class1_ = 0;
  107. class2_ = 0;
  108. class3_ = 0;
  109. race_ = 0;
  110. gender_ = 0;
  111. level_ = 0;
  112. max_level_ = 0;
  113. effective_level_ = 0;
  114. tradeskill_level_ = 0;
  115. tradeskill_max_level_ = 0;
  116. cur_concentration_ = 0;
  117. max_concentration_ = 0;
  118. cur_attack_ = 0;
  119. attack_base_ = 0;
  120. cur_mitigation_ = 0;
  121. max_mitigation_ = 0;
  122. mitigation_base_ = 0;
  123. avoidance_display_ = 0;
  124. cur_avoidance_ = 0.0f;
  125. base_avoidance_pct_ = 0;
  126. avoidance_base_ = 0;
  127. max_avoidance_ = 0;
  128. parry_ = 0.0f;
  129. parry_base_ = 0.0f;
  130. deflection_ = 0;
  131. deflection_base_ = 0;
  132. block_ = 0;
  133. block_base_ = 0;
  134. str_ = 0.0f;
  135. sta_ = 0.0f;
  136. agi_ = 0.0f;
  137. wis_ = 0.0f;
  138. intel_ = 0.0f;
  139. str_base_ = 0.0f;
  140. sta_base_ = 0.0f;
  141. agi_base_ = 0.0f;
  142. wis_base_ = 0.0f;
  143. intel_base_ = 0.0f;
  144. heat_ = 0;
  145. cold_ = 0;
  146. magic_ = 0;
  147. mental_ = 0;
  148. divine_ = 0;
  149. disease_ = 0;
  150. poison_ = 0;
  151. disease_base_ = 0;
  152. cold_base_ = 0;
  153. divine_base_ = 0;
  154. magic_base_ = 0;
  155. mental_base_ = 0;
  156. heat_base_ = 0;
  157. poison_base_ = 0;
  158. elemental_base_ = 0;
  159. noxious_base_ = 0;
  160. arcane_base_ = 0;
  161. coin_copper_ = 0;
  162. coin_silver_ = 0;
  163. coin_gold_ = 0;
  164. coin_plat_ = 0;
  165. bank_coin_copper_ = 0;
  166. bank_coin_silver_ = 0;
  167. bank_coin_gold_ = 0;
  168. bank_coin_plat_ = 0;
  169. status_points_ = 0;
  170. deity_ = std::string("");
  171. weight_ = 0;
  172. max_weight_ = 0;
  173. tradeskill_class1_ = 0;
  174. tradeskill_class2_ = 0;
  175. tradeskill_class3_ = 0;
  176. account_age_base_ = 0;
  177. memset(account_age_bonus_,0,19);
  178. absorb_ = 0;
  179. xp_ = 0;
  180. xp_needed_ = 0;
  181. xp_debt_ = 0.0f;
  182. xp_yellow_ = 0;
  183. xp_yellow_vitality_bar_ = 0;
  184. xp_blue_vitality_bar_ = 0;
  185. xp_blue_ = 0;
  186. ts_xp_ = 0;
  187. ts_xp_needed_ = 0;
  188. tradeskill_exp_yellow_ = 0;
  189. tradeskill_exp_blue_ = 0;
  190. flags_ = 0;
  191. flags2_ = 0;
  192. xp_vitality_ = 0;
  193. tradeskill_xp_vitality_ = 0;
  194. mitigation_skill1_ = 0;
  195. mitigation_skill2_ = 0;
  196. mitigation_skill3_ = 0;
  197. ability_modifier_ = 0;
  198. critical_mitigation_ = 0;
  199. block_chance_ = 0;
  200. uncontested_parry_ = 0;
  201. uncontested_block_ = 0;
  202. uncontested_dodge_ = 0;
  203. uncontested_riposte_ = 0;
  204. crit_chance_ = 0;
  205. crit_bonus_ = 0;
  206. potency_ = 0;
  207. hate_mod_ = 0;
  208. reuse_speed_ = 0;
  209. casting_speed_ = 0;
  210. recovery_speed_ = 0;
  211. spell_reuse_speed_ = 0;
  212. spell_multi_attack_ = 0;
  213. dps_ = 0;
  214. dps_multiplier_ = 0;
  215. attackspeed_ = 0;
  216. haste_ = 0;
  217. multi_attack_ = 0;
  218. flurry_ = 0;
  219. melee_ae_ = 0;
  220. strikethrough_ = 0;
  221. accuracy_ = 0;
  222. offensivespeed_ = 0;
  223. rain_ = 0;
  224. wind_ = 0;
  225. alignment_ = 0;
  226. pet_id_ = 0;
  227. pet_name_ = std::string("");
  228. pet_health_pct_ = 0;
  229. pet_power_pct_ = 0;
  230. pet_movement_ = 0;
  231. pet_behavior_ = 0;
  232. vision_ = 0;
  233. breathe_underwater_ = 0;
  234. biography_ = std::string("");
  235. drunk_ = 0;
  236. power_regen_ = 0;
  237. hp_regen_ = 0;
  238. power_regen_override_ = 0;
  239. hp_regen_override_ = 0;
  240. water_type_ = 0;
  241. flying_type_ = 0;
  242. no_interrupt_ = 0;
  243. }
  244. void SetInfoStruct(InfoStruct* oldStruct)
  245. {
  246. if(!oldStruct)
  247. return;
  248. std::lock_guard<std::mutex> lk(classMutex);
  249. name_ = std::string(oldStruct->get_name());
  250. class1_ = oldStruct->get_class1();
  251. class2_ = oldStruct->get_class2();
  252. class3_ = oldStruct->get_class3();
  253. race_ = oldStruct->get_race();
  254. gender_ = oldStruct->get_gender();
  255. level_ = oldStruct->get_level();
  256. max_level_ = oldStruct->get_max_level();
  257. effective_level_ = oldStruct->get_effective_level();
  258. tradeskill_level_ = oldStruct->get_tradeskill_level();
  259. tradeskill_max_level_ = oldStruct->get_tradeskill_max_level();
  260. cur_concentration_ = oldStruct->get_cur_concentration();
  261. max_concentration_ = oldStruct->get_max_concentration();
  262. cur_attack_ = oldStruct->get_cur_attack();
  263. attack_base_ = oldStruct->get_attack_base();
  264. cur_mitigation_ = oldStruct->get_cur_mitigation();
  265. max_mitigation_ = oldStruct->get_max_mitigation();
  266. mitigation_base_ = oldStruct->get_mitigation_base();
  267. avoidance_display_ = oldStruct->get_avoidance_display();
  268. cur_avoidance_ = oldStruct->get_cur_avoidance();
  269. base_avoidance_pct_ = oldStruct->get_base_avoidance_pct();
  270. avoidance_base_ = oldStruct->get_avoidance_base();
  271. max_avoidance_ = oldStruct->get_max_avoidance();
  272. parry_ = oldStruct->get_parry();
  273. parry_base_ = oldStruct->get_parry_base();
  274. deflection_ = oldStruct->get_deflection();
  275. deflection_base_ = oldStruct->get_deflection_base();
  276. block_ = oldStruct->get_block();
  277. block_base_ = oldStruct->get_block_base();
  278. str_ = oldStruct->get_str();
  279. sta_ = oldStruct->get_sta();
  280. agi_ = oldStruct->get_agi();
  281. wis_ = oldStruct->get_wis();
  282. intel_ = oldStruct->get_intel();
  283. str_base_ = oldStruct->get_str_base();
  284. sta_base_ = oldStruct->get_sta_base();
  285. agi_base_ = oldStruct->get_agi_base();
  286. wis_base_ = oldStruct->get_wis_base();
  287. intel_base_ = oldStruct->get_intel_base();
  288. heat_ = oldStruct->get_heat();
  289. cold_ = oldStruct->get_cold();
  290. magic_ = oldStruct->get_magic();
  291. mental_ = oldStruct->get_mental();
  292. divine_ = oldStruct->get_divine();
  293. disease_ = oldStruct->get_disease();
  294. poison_ = oldStruct->get_poison();
  295. disease_base_ = oldStruct->get_disease_base();
  296. cold_base_ = oldStruct->get_cold_base();
  297. divine_base_ = oldStruct->get_divine_base();
  298. magic_base_ = oldStruct->get_magic_base();
  299. mental_base_ = oldStruct->get_mental_base();
  300. heat_base_ = oldStruct->get_heat_base();
  301. poison_base_ = oldStruct->get_poison_base();
  302. elemental_base_ = oldStruct->get_elemental_base();
  303. noxious_base_ = oldStruct->get_noxious_base();
  304. arcane_base_ = oldStruct->get_arcane_base();
  305. coin_copper_ = oldStruct->get_coin_copper();
  306. coin_silver_ = oldStruct->get_coin_silver();
  307. coin_gold_ = oldStruct->get_coin_gold();
  308. coin_plat_ = oldStruct->get_coin_plat();
  309. bank_coin_copper_ = oldStruct->get_bank_coin_copper();
  310. bank_coin_silver_ = oldStruct->get_bank_coin_silver();
  311. bank_coin_gold_ = oldStruct->get_bank_coin_gold();
  312. bank_coin_plat_ = oldStruct->get_bank_coin_plat();
  313. status_points_ = oldStruct->get_status_points();
  314. deity_ = std::string("");
  315. weight_ = oldStruct->get_weight();
  316. max_weight_ = oldStruct->get_max_weight();
  317. tradeskill_class1_ = oldStruct->get_tradeskill_class1();
  318. tradeskill_class2_ = oldStruct->get_tradeskill_class2();
  319. tradeskill_class3_ = oldStruct->get_tradeskill_class3();
  320. account_age_base_ = oldStruct->get_account_age_base();
  321. memset(account_age_bonus_,0,19);
  322. absorb_ = oldStruct->get_absorb();
  323. xp_ = oldStruct->get_xp();
  324. xp_needed_ = oldStruct->get_xp_needed();
  325. xp_debt_ = oldStruct->get_xp_debt();
  326. xp_yellow_ = oldStruct->get_xp_yellow();
  327. xp_yellow_vitality_bar_ = oldStruct->get_xp_yellow_vitality_bar();
  328. xp_blue_vitality_bar_ = oldStruct->get_xp_blue_vitality_bar();
  329. xp_blue_ = oldStruct->get_xp_blue();
  330. ts_xp_ = oldStruct->get_ts_xp();
  331. ts_xp_needed_ = oldStruct->get_ts_xp_needed();
  332. tradeskill_exp_yellow_ = oldStruct->get_tradeskill_exp_yellow();
  333. tradeskill_exp_blue_ = oldStruct->get_tradeskill_exp_blue();
  334. flags_ = oldStruct->get_flags();
  335. flags2_ = oldStruct->get_flags2();
  336. xp_vitality_ = oldStruct->get_xp_vitality();
  337. tradeskill_xp_vitality_ = oldStruct->get_tradeskill_xp_vitality();
  338. mitigation_skill1_ = oldStruct->get_mitigation_skill1();
  339. mitigation_skill2_ = oldStruct->get_mitigation_skill2();
  340. mitigation_skill3_ = oldStruct->get_mitigation_skill3();
  341. ability_modifier_ = oldStruct->get_ability_modifier();
  342. critical_mitigation_ = oldStruct->get_critical_mitigation();
  343. block_chance_ = oldStruct->get_block_chance();
  344. uncontested_parry_ = oldStruct->get_uncontested_parry();
  345. uncontested_block_ = oldStruct->get_uncontested_block();
  346. uncontested_dodge_ = oldStruct->get_uncontested_dodge();
  347. uncontested_riposte_ = oldStruct->get_uncontested_riposte();
  348. crit_chance_ = oldStruct->get_crit_chance();
  349. crit_bonus_ = oldStruct->get_crit_bonus();
  350. potency_ = oldStruct->get_potency();
  351. hate_mod_ = oldStruct->get_hate_mod();
  352. reuse_speed_ = oldStruct->get_reuse_speed();
  353. casting_speed_ = oldStruct->get_casting_speed();
  354. recovery_speed_ = oldStruct->get_recovery_speed();
  355. spell_reuse_speed_ = oldStruct->get_spell_reuse_speed();
  356. spell_multi_attack_ = oldStruct->get_spell_multi_attack();
  357. dps_ = oldStruct->get_dps();
  358. dps_multiplier_ = oldStruct->get_dps_multiplier();
  359. attackspeed_ = oldStruct->get_attackspeed();
  360. haste_ = oldStruct->get_haste();
  361. multi_attack_ = oldStruct->get_multi_attack();
  362. flurry_ = oldStruct->get_flurry();
  363. melee_ae_ = oldStruct->get_melee_ae();
  364. strikethrough_ = oldStruct->get_strikethrough();
  365. accuracy_ = oldStruct->get_accuracy();
  366. offensivespeed_ = oldStruct->get_offensivespeed();
  367. rain_ = oldStruct->get_rain();
  368. wind_ = oldStruct->get_wind();
  369. alignment_ = oldStruct->get_alignment();
  370. pet_id_ = oldStruct->get_pet_id();
  371. pet_name_ = std::string(oldStruct->get_pet_name());
  372. pet_health_pct_ = oldStruct->get_pet_health_pct();
  373. pet_power_pct_ = oldStruct->get_pet_power_pct();
  374. pet_movement_ = oldStruct->get_pet_movement();
  375. pet_behavior_ = oldStruct->get_pet_behavior();
  376. vision_ = oldStruct->get_vision();
  377. breathe_underwater_ = oldStruct->get_breathe_underwater();
  378. biography_ = std::string(oldStruct->get_biography());
  379. drunk_ = oldStruct->get_drunk();
  380. power_regen_ = oldStruct->get_power_regen();
  381. hp_regen_ = oldStruct->get_hp_regen();
  382. power_regen_override_ = oldStruct->get_power_regen_override();
  383. hp_regen_override_ = oldStruct->get_hp_regen_override();
  384. water_type_ = oldStruct->get_water_type();
  385. flying_type_ = oldStruct->get_flying_type();
  386. no_interrupt_ = oldStruct->get_no_interrupt();
  387. }
  388. //mutable std::shared_mutex mutex_;
  389. std::string get_name() { std::lock_guard<std::mutex> lk(classMutex); return name_; }
  390. int8 get_class1() { std::lock_guard<std::mutex> lk(classMutex); return class1_; }
  391. int8 get_class2() { std::lock_guard<std::mutex> lk(classMutex); return class2_; }
  392. int8 get_class3() { std::lock_guard<std::mutex> lk(classMutex); return class3_; }
  393. int8 get_race() { std::lock_guard<std::mutex> lk(classMutex); return race_; }
  394. int8 get_gender() { std::lock_guard<std::mutex> lk(classMutex); return gender_; }
  395. int16 get_level() { std::lock_guard<std::mutex> lk(classMutex); return level_; }
  396. int16 get_max_level() { std::lock_guard<std::mutex> lk(classMutex); return max_level_; }
  397. int16 get_effective_level() { std::lock_guard<std::mutex> lk(classMutex); return effective_level_; }
  398. int16 get_tradeskill_level() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_level_; }
  399. int16 get_tradeskill_max_level() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_max_level_; }
  400. int8 get_cur_concentration() { std::lock_guard<std::mutex> lk(classMutex); return cur_concentration_; }
  401. int8 get_max_concentration() { std::lock_guard<std::mutex> lk(classMutex); return max_concentration_; }
  402. int16 get_cur_attack() { std::lock_guard<std::mutex> lk(classMutex); return cur_attack_; }
  403. int16 get_attack_base() { std::lock_guard<std::mutex> lk(classMutex); return attack_base_; }
  404. int16 get_cur_mitigation() { std::lock_guard<std::mutex> lk(classMutex); return cur_mitigation_; }
  405. int16 get_max_mitigation() { std::lock_guard<std::mutex> lk(classMutex); return max_mitigation_; }
  406. int16 get_mitigation_base() { std::lock_guard<std::mutex> lk(classMutex); return mitigation_base_; }
  407. int16 get_avoidance_display() { std::lock_guard<std::mutex> lk(classMutex); return avoidance_display_; }
  408. float get_cur_avoidance() { std::lock_guard<std::mutex> lk(classMutex); return cur_avoidance_; }
  409. int16 get_base_avoidance_pct() { std::lock_guard<std::mutex> lk(classMutex); return base_avoidance_pct_; }
  410. int16 get_avoidance_base() { std::lock_guard<std::mutex> lk(classMutex); return avoidance_base_; }
  411. float get_parry() { std::lock_guard<std::mutex> lk(classMutex); return parry_; }
  412. float get_parry_base() { std::lock_guard<std::mutex> lk(classMutex); return parry_base_; }
  413. int16 get_max_avoidance() { std::lock_guard<std::mutex> lk(classMutex); return max_avoidance_; }
  414. float get_deflection() { std::lock_guard<std::mutex> lk(classMutex); return deflection_; }
  415. int16 get_deflection_base() { std::lock_guard<std::mutex> lk(classMutex); return deflection_base_; }
  416. float get_block() { std::lock_guard<std::mutex> lk(classMutex); return block_; }
  417. int16 get_block_base() { std::lock_guard<std::mutex> lk(classMutex); return block_base_; }
  418. float get_str() { std::lock_guard<std::mutex> lk(classMutex); return str_; }
  419. float get_sta() { std::lock_guard<std::mutex> lk(classMutex); return sta_; }
  420. float get_agi() { std::lock_guard<std::mutex> lk(classMutex); return agi_; }
  421. float get_wis() { std::lock_guard<std::mutex> lk(classMutex); return wis_; }
  422. float get_intel() { std::lock_guard<std::mutex> lk(classMutex); return intel_; }
  423. float get_str_base() { std::lock_guard<std::mutex> lk(classMutex); return str_base_; }
  424. float get_sta_base() { std::lock_guard<std::mutex> lk(classMutex); return sta_base_; }
  425. float get_agi_base() { std::lock_guard<std::mutex> lk(classMutex); return agi_base_; }
  426. float get_wis_base() { std::lock_guard<std::mutex> lk(classMutex); return wis_base_; }
  427. float get_intel_base() { std::lock_guard<std::mutex> lk(classMutex); return intel_base_; }
  428. int16 get_heat() { std::lock_guard<std::mutex> lk(classMutex); return heat_; }
  429. int16 get_cold() { std::lock_guard<std::mutex> lk(classMutex); return cold_; }
  430. int16 get_magic() { std::lock_guard<std::mutex> lk(classMutex); return magic_; }
  431. int16 get_mental() { std::lock_guard<std::mutex> lk(classMutex); return mental_; }
  432. int16 get_divine() { std::lock_guard<std::mutex> lk(classMutex); return divine_; }
  433. int16 get_disease() { std::lock_guard<std::mutex> lk(classMutex); return disease_; }
  434. int16 get_poison() { std::lock_guard<std::mutex> lk(classMutex); return poison_; }
  435. int16 get_disease_base() { std::lock_guard<std::mutex> lk(classMutex); return disease_base_; }
  436. int16 get_cold_base() { std::lock_guard<std::mutex> lk(classMutex); return cold_base_; }
  437. int16 get_divine_base() { std::lock_guard<std::mutex> lk(classMutex); return divine_base_; }
  438. int16 get_magic_base() { std::lock_guard<std::mutex> lk(classMutex); return magic_base_; }
  439. int16 get_mental_base() { std::lock_guard<std::mutex> lk(classMutex); return mental_base_; }
  440. int16 get_heat_base() { std::lock_guard<std::mutex> lk(classMutex); return heat_base_; }
  441. int16 get_poison_base() { std::lock_guard<std::mutex> lk(classMutex); return poison_base_; }
  442. int16 get_elemental_base() { std::lock_guard<std::mutex> lk(classMutex); return elemental_base_; }
  443. int16 get_noxious_base() { std::lock_guard<std::mutex> lk(classMutex); return noxious_base_; }
  444. int16 get_arcane_base() { std::lock_guard<std::mutex> lk(classMutex); return arcane_base_; }
  445. int32 get_coin_copper() { std::lock_guard<std::mutex> lk(classMutex); return coin_copper_; }
  446. int32 get_coin_silver() { std::lock_guard<std::mutex> lk(classMutex); return coin_silver_; }
  447. int32 get_coin_gold() { std::lock_guard<std::mutex> lk(classMutex); return coin_gold_; }
  448. int32 get_coin_plat() { std::lock_guard<std::mutex> lk(classMutex); return coin_plat_; }
  449. int32 get_bank_coin_copper() { std::lock_guard<std::mutex> lk(classMutex); return bank_coin_copper_; }
  450. int32 get_bank_coin_silver() { std::lock_guard<std::mutex> lk(classMutex); return bank_coin_silver_; }
  451. int32 get_bank_coin_gold() { std::lock_guard<std::mutex> lk(classMutex); return bank_coin_gold_; }
  452. int32 get_bank_coin_plat() { std::lock_guard<std::mutex> lk(classMutex); return bank_coin_plat_; }
  453. int32 get_status_points() { std::lock_guard<std::mutex> lk(classMutex); return status_points_; }
  454. std::string get_deity() { std::lock_guard<std::mutex> lk(classMutex); return deity_; }
  455. int32 get_weight() { std::lock_guard<std::mutex> lk(classMutex); return weight_; }
  456. int32 get_max_weight() { std::lock_guard<std::mutex> lk(classMutex); return max_weight_; }
  457. //SpellEffects* & get_spell_effects() { std::lock_guard<std::mutex> lk(classMutex); return spell_effects_; }
  458. //MaintainedEffects* & get_maintained_effects() { std::lock_guard<std::mutex> lk(classMutex); return maintained_effects_; }
  459. int8 get_tradeskill_class1() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_class1_; }
  460. int8 get_tradeskill_class2() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_class2_; }
  461. int8 get_tradeskill_class3() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_class3_; }
  462. int16 get_account_age_base() { std::lock_guard<std::mutex> lk(classMutex); return account_age_base_; }
  463. int8 get_account_age_bonus(int8 field) { std::lock_guard<std::mutex> lk(classMutex); return account_age_bonus_[field]; }
  464. int16 get_absorb() { std::lock_guard<std::mutex> lk(classMutex); return absorb_; }
  465. int32 get_xp() { std::lock_guard<std::mutex> lk(classMutex); return xp_; }
  466. int32 get_xp_needed() { std::lock_guard<std::mutex> lk(classMutex); return xp_needed_; }
  467. float get_xp_debt() { std::lock_guard<std::mutex> lk(classMutex); return xp_debt_; }
  468. int16 get_xp_yellow() { std::lock_guard<std::mutex> lk(classMutex); return xp_yellow_; }
  469. int16 get_xp_yellow_vitality_bar() { std::lock_guard<std::mutex> lk(classMutex); return xp_yellow_vitality_bar_; }
  470. int16 get_xp_blue_vitality_bar() { std::lock_guard<std::mutex> lk(classMutex); return xp_blue_vitality_bar_; }
  471. int16 get_xp_blue() { std::lock_guard<std::mutex> lk(classMutex); return xp_blue_; }
  472. int32 get_ts_xp() { std::lock_guard<std::mutex> lk(classMutex); return ts_xp_; }
  473. int32 get_ts_xp_needed() { std::lock_guard<std::mutex> lk(classMutex); return ts_xp_needed_; }
  474. int16 get_tradeskill_exp_yellow() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_exp_yellow_; }
  475. int16 get_tradeskill_exp_blue() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_exp_blue_; }
  476. int32 get_flags() { std::lock_guard<std::mutex> lk(classMutex); return flags_; }
  477. int32 get_flags2() { std::lock_guard<std::mutex> lk(classMutex); return flags2_; }
  478. float get_xp_vitality() { std::lock_guard<std::mutex> lk(classMutex); return xp_vitality_; }
  479. float get_tradeskill_xp_vitality() { std::lock_guard<std::mutex> lk(classMutex); return tradeskill_xp_vitality_; }
  480. int16 get_mitigation_skill1() { std::lock_guard<std::mutex> lk(classMutex); return mitigation_skill1_; }
  481. int16 get_mitigation_skill2() { std::lock_guard<std::mutex> lk(classMutex); return mitigation_skill2_; }
  482. int16 get_mitigation_skill3() { std::lock_guard<std::mutex> lk(classMutex); return mitigation_skill3_; }
  483. float get_ability_modifier() { std::lock_guard<std::mutex> lk(classMutex); return ability_modifier_; }
  484. float get_critical_mitigation() { std::lock_guard<std::mutex> lk(classMutex); return critical_mitigation_; }
  485. float get_block_chance() { std::lock_guard<std::mutex> lk(classMutex); return block_chance_; }
  486. float get_uncontested_parry() { std::lock_guard<std::mutex> lk(classMutex); return uncontested_parry_; }
  487. float get_uncontested_block() { std::lock_guard<std::mutex> lk(classMutex); return uncontested_block_; }
  488. float get_uncontested_dodge() { std::lock_guard<std::mutex> lk(classMutex); return uncontested_dodge_; }
  489. float get_uncontested_riposte() { std::lock_guard<std::mutex> lk(classMutex); return uncontested_riposte_; }
  490. float get_crit_chance() { std::lock_guard<std::mutex> lk(classMutex); return crit_chance_; }
  491. float get_crit_bonus() { std::lock_guard<std::mutex> lk(classMutex); return crit_bonus_; }
  492. float get_potency() { std::lock_guard<std::mutex> lk(classMutex); return potency_; }
  493. float get_hate_mod() { std::lock_guard<std::mutex> lk(classMutex); return hate_mod_; }
  494. float get_reuse_speed() { std::lock_guard<std::mutex> lk(classMutex); return reuse_speed_; }
  495. float get_casting_speed() { std::lock_guard<std::mutex> lk(classMutex); return casting_speed_; }
  496. float get_recovery_speed() { std::lock_guard<std::mutex> lk(classMutex); return recovery_speed_; }
  497. float get_spell_reuse_speed() { std::lock_guard<std::mutex> lk(classMutex); return spell_reuse_speed_; }
  498. float get_spell_multi_attack() { std::lock_guard<std::mutex> lk(classMutex); return spell_multi_attack_; }
  499. float get_dps() { std::lock_guard<std::mutex> lk(classMutex); return dps_; }
  500. float get_dps_multiplier() { std::lock_guard<std::mutex> lk(classMutex); return dps_multiplier_; }
  501. float get_attackspeed() { std::lock_guard<std::mutex> lk(classMutex); return attackspeed_; }
  502. float get_haste() { std::lock_guard<std::mutex> lk(classMutex); return haste_; }
  503. float get_multi_attack() { std::lock_guard<std::mutex> lk(classMutex); return multi_attack_; }
  504. float get_flurry() { std::lock_guard<std::mutex> lk(classMutex); return flurry_; }
  505. float get_melee_ae() { std::lock_guard<std::mutex> lk(classMutex); return melee_ae_; }
  506. float get_strikethrough() { std::lock_guard<std::mutex> lk(classMutex); return strikethrough_; }
  507. float get_accuracy() { std::lock_guard<std::mutex> lk(classMutex); return accuracy_; }
  508. float get_offensivespeed() { std::lock_guard<std::mutex> lk(classMutex); return offensivespeed_; }
  509. float get_rain() { std::lock_guard<std::mutex> lk(classMutex); return rain_; }
  510. float get_wind() { std::lock_guard<std::mutex> lk(classMutex); return wind_; }
  511. sint8 get_alignment() { std::lock_guard<std::mutex> lk(classMutex); return alignment_; }
  512. int32 get_pet_id() { std::lock_guard<std::mutex> lk(classMutex); return pet_id_; }
  513. std::string get_pet_name() { std::lock_guard<std::mutex> lk(classMutex); return pet_name_; }
  514. float get_pet_health_pct() { std::lock_guard<std::mutex> lk(classMutex); return pet_health_pct_; }
  515. float get_pet_power_pct() { std::lock_guard<std::mutex> lk(classMutex); return pet_power_pct_; }
  516. int8 get_pet_movement() { std::lock_guard<std::mutex> lk(classMutex); return pet_movement_; }
  517. int8 get_pet_behavior() { std::lock_guard<std::mutex> lk(classMutex); return pet_behavior_; }
  518. int8 get_vision() { std::lock_guard<std::mutex> lk(classMutex); return vision_; }
  519. int8 get_breathe_underwater() { std::lock_guard<std::mutex> lk(classMutex); return breathe_underwater_; }
  520. std::string get_biography() { std::lock_guard<std::mutex> lk(classMutex); return biography_; }
  521. float get_drunk() { std::lock_guard<std::mutex> lk(classMutex); return drunk_; }
  522. sint16 get_power_regen() { std::lock_guard<std::mutex> lk(classMutex); return power_regen_; }
  523. sint16 get_hp_regen() { std::lock_guard<std::mutex> lk(classMutex); return hp_regen_; }
  524. int8 get_power_regen_override() { std::lock_guard<std::mutex> lk(classMutex); return power_regen_override_; }
  525. int8 get_hp_regen_override() { std::lock_guard<std::mutex> lk(classMutex); return hp_regen_override_; }
  526. int8 get_water_type() { std::lock_guard<std::mutex> lk(classMutex); return water_type_; }
  527. int8 get_flying_type() { std::lock_guard<std::mutex> lk(classMutex); return flying_type_; }
  528. int8 get_no_interrupt() { std::lock_guard<std::mutex> lk(classMutex); return no_interrupt_; }
  529. void set_name(std::string value) { std::lock_guard<std::mutex> lk(classMutex); name_ = value; }
  530. void set_deity(std::string value) { std::lock_guard<std::mutex> lk(classMutex); deity_ = value; }
  531. void set_class1(int8 value) { std::lock_guard<std::mutex> lk(classMutex); class1_ = value; }
  532. void set_class2(int8 value) { std::lock_guard<std::mutex> lk(classMutex); class2_ = value; }
  533. void set_class3(int8 value) { std::lock_guard<std::mutex> lk(classMutex); class3_ = value; }
  534. void set_race(int8 value) { std::lock_guard<std::mutex> lk(classMutex); race_ = value; }
  535. void set_gender(int8 value) { std::lock_guard<std::mutex> lk(classMutex); gender_ = value; }
  536. void set_level(int16 value) { std::lock_guard<std::mutex> lk(classMutex); level_ = value; }
  537. void set_max_level(int16 value) { std::lock_guard<std::mutex> lk(classMutex); max_level_ = value; }
  538. void set_effective_level(int16 value) { std::lock_guard<std::mutex> lk(classMutex); effective_level_ = value; }
  539. void set_cur_concentration(int8 value) { std::lock_guard<std::mutex> lk(classMutex); cur_concentration_ = value; }
  540. void set_max_concentration(int8 value) { std::lock_guard<std::mutex> lk(classMutex); max_concentration_ = value; }
  541. void add_cur_concentration(int8 value) { std::lock_guard<std::mutex> lk(classMutex); cur_concentration_ += value; }
  542. void add_max_concentration(int8 value) { std::lock_guard<std::mutex> lk(classMutex); max_concentration_ += value; }
  543. void set_cur_attack(int16 value) { std::lock_guard<std::mutex> lk(classMutex); cur_attack_ = value; }
  544. void set_attack_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); attack_base_ = value; }
  545. void set_cur_mitigation(int16 value) { std::lock_guard<std::mutex> lk(classMutex); cur_mitigation_ = value; }
  546. void set_max_mitigation(int16 value) { std::lock_guard<std::mutex> lk(classMutex); max_mitigation_ = value; }
  547. void set_mitigation_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_base_ = value; }
  548. void add_mitigation_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_base_ += value; }
  549. void set_avoidance_display(int16 value) { std::lock_guard<std::mutex> lk(classMutex); avoidance_display_ = value; }
  550. void set_cur_avoidance(float value) { std::lock_guard<std::mutex> lk(classMutex); cur_avoidance_ = value; }
  551. void set_base_avoidance_pct(int16 value) { std::lock_guard<std::mutex> lk(classMutex); base_avoidance_pct_ = value; }
  552. void set_avoidance_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); avoidance_base_ = value; }
  553. void set_max_avoidance(int16 value) { std::lock_guard<std::mutex> lk(classMutex); max_avoidance_ = value; }
  554. void set_parry(float value) { std::lock_guard<std::mutex> lk(classMutex); parry_ = value; }
  555. void set_parry_base(float value) { std::lock_guard<std::mutex> lk(classMutex); parry_base_ = value; }
  556. void set_deflection(int16 value) { std::lock_guard<std::mutex> lk(classMutex); deflection_ = value; }
  557. void set_deflection_base(float value) { std::lock_guard<std::mutex> lk(classMutex); deflection_base_ = value; }
  558. void set_block(float value) { std::lock_guard<std::mutex> lk(classMutex); block_ = value; }
  559. void set_block_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); block_base_ = value; }
  560. void set_str(float value) { std::lock_guard<std::mutex> lk(classMutex); str_ = value; }
  561. void set_sta(float value) { std::lock_guard<std::mutex> lk(classMutex); sta_ = value; }
  562. void set_agi(float value) { std::lock_guard<std::mutex> lk(classMutex); agi_ = value; }
  563. void set_wis(float value) { std::lock_guard<std::mutex> lk(classMutex); wis_ = value; }
  564. void set_intel(float value) { std::lock_guard<std::mutex> lk(classMutex); intel_ = value; }
  565. void add_str(float value) { std::lock_guard<std::mutex> lk(classMutex); str_ += value; }
  566. void add_sta(float value) { std::lock_guard<std::mutex> lk(classMutex); sta_ += value; }
  567. void add_agi(float value) { std::lock_guard<std::mutex> lk(classMutex); agi_ += value; }
  568. void add_wis(float value) { std::lock_guard<std::mutex> lk(classMutex); wis_ += value; }
  569. void add_intel(float value) { std::lock_guard<std::mutex> lk(classMutex); intel_ += value; }
  570. void set_str_base(float value) { std::lock_guard<std::mutex> lk(classMutex); str_base_ = value; }
  571. void set_sta_base(float value) { std::lock_guard<std::mutex> lk(classMutex); sta_base_ = value; }
  572. void set_agi_base(float value) { std::lock_guard<std::mutex> lk(classMutex); agi_base_ = value; }
  573. void set_wis_base(float value) { std::lock_guard<std::mutex> lk(classMutex); wis_base_ = value; }
  574. void set_intel_base(float value) { std::lock_guard<std::mutex> lk(classMutex); intel_base_ = value; }
  575. void set_heat(int16 value) { std::lock_guard<std::mutex> lk(classMutex); heat_ = value; }
  576. void set_cold(int16 value) { std::lock_guard<std::mutex> lk(classMutex); cold_ = value; }
  577. void set_magic(int16 value) { std::lock_guard<std::mutex> lk(classMutex); magic_ = value; }
  578. void set_mental(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mental_ = value; }
  579. void set_divine(int16 value) { std::lock_guard<std::mutex> lk(classMutex); divine_ = value; }
  580. void set_disease(int16 value) { std::lock_guard<std::mutex> lk(classMutex); disease_ = value; }
  581. void set_poison(int16 value) { std::lock_guard<std::mutex> lk(classMutex); poison_ = value; }
  582. void add_heat(int16 value) { std::lock_guard<std::mutex> lk(classMutex); heat_ += value; }
  583. void add_cold(int16 value) { std::lock_guard<std::mutex> lk(classMutex); cold_ += value; }
  584. void add_magic(int16 value) { std::lock_guard<std::mutex> lk(classMutex); magic_ += value; }
  585. void add_mental(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mental_ += value; }
  586. void add_divine(int16 value) { std::lock_guard<std::mutex> lk(classMutex); divine_ += value; }
  587. void add_disease(int16 value) { std::lock_guard<std::mutex> lk(classMutex); disease_ += value; }
  588. void add_poison(int16 value) { std::lock_guard<std::mutex> lk(classMutex); poison_ += value; }
  589. void set_disease_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); disease_base_ = value; }
  590. void set_cold_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); cold_base_ = value; }
  591. void set_divine_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); divine_base_ = value; }
  592. void set_magic_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); magic_base_ = value; }
  593. void set_mental_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mental_base_ = value; }
  594. void set_heat_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); heat_base_ = value; }
  595. void set_poison_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); poison_base_ = value; }
  596. void set_elemental_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); elemental_base_ = value; }
  597. void set_noxious_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); noxious_base_ = value; }
  598. void set_arcane_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); arcane_base_ = value; }
  599. void set_tradeskill_level(int16 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_level_ = value; }
  600. void set_tradeskill_max_level(int16 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_max_level_ = value; }
  601. void set_tradeskill_class1(int8 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_class1_ = value; }
  602. void set_tradeskill_class2(int8 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_class2_ = value; }
  603. void set_tradeskill_class3(int8 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_class3_ = value; }
  604. void set_account_age_base(int16 value) { std::lock_guard<std::mutex> lk(classMutex); account_age_base_ = value; }
  605. void set_xp_vitality(float value) { std::lock_guard<std::mutex> lk(classMutex); xp_vitality_ = value; }
  606. void add_xp_vitality(float value) { std::lock_guard<std::mutex> lk(classMutex); xp_vitality_ += value; }
  607. void set_tradeskill_xp_vitality(float value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_xp_vitality_ = value; }
  608. void set_absorb(int16 value) { std::lock_guard<std::mutex> lk(classMutex); absorb_ = value; }
  609. void set_xp(int32 value) { std::lock_guard<std::mutex> lk(classMutex); xp_ = value; }
  610. void set_xp_needed(int32 value) { std::lock_guard<std::mutex> lk(classMutex); xp_needed_ = value; }
  611. void set_xp_debt(float value) { std::lock_guard<std::mutex> lk(classMutex); xp_debt_ = value; }
  612. void set_xp_yellow(int16 value) { std::lock_guard<std::mutex> lk(classMutex); xp_yellow_ = value; }
  613. void set_xp_blue(int16 value) { std::lock_guard<std::mutex> lk(classMutex); xp_blue_ = value; }
  614. void set_xp_yellow_vitality_bar(int16 value) { std::lock_guard<std::mutex> lk(classMutex); xp_yellow_vitality_bar_ = value; }
  615. void set_xp_blue_vitality_bar(int16 value) { std::lock_guard<std::mutex> lk(classMutex); xp_blue_vitality_bar_ = value; }
  616. void set_ts_xp(int32 value) { std::lock_guard<std::mutex> lk(classMutex); ts_xp_ = value; }
  617. void set_ts_xp_needed(int32 value) { std::lock_guard<std::mutex> lk(classMutex); ts_xp_needed_ = value; }
  618. void set_tradeskill_exp_yellow(int16 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_exp_yellow_ = value; }
  619. void set_tradeskill_exp_blue(int16 value) { std::lock_guard<std::mutex> lk(classMutex); tradeskill_exp_blue_ = value; }
  620. void set_flags(int32 value) { std::lock_guard<std::mutex> lk(classMutex); flags_ = value; }
  621. void set_flags2(int32 value) { std::lock_guard<std::mutex> lk(classMutex); flags2_ = value; }
  622. void set_coin_plat(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_plat_ = value; }
  623. void set_coin_gold(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_gold_ = value; }
  624. void set_coin_silver(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_silver_ = value; }
  625. void set_coin_copper(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_copper_ = value; }
  626. void add_coin_plat(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_plat_ += value; }
  627. void add_coin_gold(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_gold_ += value; }
  628. void add_coin_silver(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_silver_ += value; }
  629. void add_coin_copper(int32 value) { std::lock_guard<std::mutex> lk(classMutex); coin_copper_ += value; }
  630. void set_bank_coin_plat(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_plat_ = value; }
  631. void set_bank_coin_gold(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_gold_ = value; }
  632. void set_bank_coin_silver(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_silver_ = value; }
  633. void set_bank_coin_copper(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_copper_ = value; }
  634. void add_bank_coin_plat(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_plat_ += value; }
  635. void add_bank_coin_gold(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_gold_ += value; }
  636. void add_bank_coin_silver(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_silver_ += value; }
  637. void add_bank_coin_copper(int32 value) { std::lock_guard<std::mutex> lk(classMutex); bank_coin_copper_ += value; }
  638. void set_status_points(int32 value) { std::lock_guard<std::mutex> lk(classMutex); status_points_ = value; }
  639. void add_status_points(int32 value) { std::lock_guard<std::mutex> lk(classMutex); status_points_ += value; }
  640. bool subtract_status_points(int32 value) { std::lock_guard<std::mutex> lk(classMutex); if(value > status_points_) return false; status_points_ -= value; return true; }
  641. void set_mitigation_skill1(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill1_ = value; }
  642. void set_mitigation_skill2(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill2_ = value; }
  643. void set_mitigation_skill3(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill3_ = value; }
  644. void add_mitigation_skill1(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill1_ += value; }
  645. void add_mitigation_skill2(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill2_ += value; }
  646. void add_mitigation_skill3(int16 value) { std::lock_guard<std::mutex> lk(classMutex); mitigation_skill3_ += value; }
  647. void set_ability_modifier(float value) { std::lock_guard<std::mutex> lk(classMutex); ability_modifier_ = value; }
  648. void add_ability_modifier(float value) { std::lock_guard<std::mutex> lk(classMutex); ability_modifier_ += value; }
  649. void set_critical_mitigation(float value) { std::lock_guard<std::mutex> lk(classMutex); critical_mitigation_ = value; }
  650. void add_critical_mitigation(float value) { std::lock_guard<std::mutex> lk(classMutex); critical_mitigation_ += value; }
  651. void set_block_chance(float value) { std::lock_guard<std::mutex> lk(classMutex); block_chance_ = value; }
  652. void set_uncontested_parry(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_parry_ = value; }
  653. void set_uncontested_block(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_block_ = value; }
  654. void set_uncontested_dodge(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_dodge_ = value; }
  655. void set_uncontested_riposte(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_riposte_ = value; }
  656. void set_crit_chance(float value) { std::lock_guard<std::mutex> lk(classMutex); crit_chance_ = value; }
  657. void set_crit_bonus(float value) { std::lock_guard<std::mutex> lk(classMutex); crit_bonus_ = value; }
  658. void set_potency(float value) { std::lock_guard<std::mutex> lk(classMutex); potency_ = value; }
  659. void set_hate_mod(float value) { std::lock_guard<std::mutex> lk(classMutex); hate_mod_ = value; }
  660. void set_reuse_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); reuse_speed_ = value; }
  661. void set_casting_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); casting_speed_ = value; }
  662. void set_recovery_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); recovery_speed_ = value; }
  663. void set_spell_reuse_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); spell_reuse_speed_ = value; }
  664. void set_spell_multi_attack(float value) { std::lock_guard<std::mutex> lk(classMutex); spell_multi_attack_ = value; }
  665. void set_dps(float value) { std::lock_guard<std::mutex> lk(classMutex); dps_ = value; }
  666. void set_dps_multiplier(float value) { std::lock_guard<std::mutex> lk(classMutex); dps_multiplier_ = value; }
  667. void set_attackspeed(float value) { std::lock_guard<std::mutex> lk(classMutex); attackspeed_ = value; }
  668. void set_haste(float value) { std::lock_guard<std::mutex> lk(classMutex); haste_ = value; }
  669. void set_multi_attack(float value) { std::lock_guard<std::mutex> lk(classMutex); multi_attack_ = value; }
  670. void set_flurry(float value) { std::lock_guard<std::mutex> lk(classMutex); flurry_ = value; }
  671. void set_melee_ae(float value) { std::lock_guard<std::mutex> lk(classMutex); melee_ae_ = value; }
  672. void set_strikethrough(float value) { std::lock_guard<std::mutex> lk(classMutex); strikethrough_ = value; }
  673. void set_accuracy(float value) { std::lock_guard<std::mutex> lk(classMutex); accuracy_ = value; }
  674. void set_offensivespeed(float value) { std::lock_guard<std::mutex> lk(classMutex); offensivespeed_ = value; }
  675. void set_rain(float value) { std::lock_guard<std::mutex> lk(classMutex); rain_ = value; }
  676. void set_wind(float value) { std::lock_guard<std::mutex> lk(classMutex); wind_ = value; }
  677. void add_block_chance(float value) { std::lock_guard<std::mutex> lk(classMutex); block_chance_ += value; }
  678. void add_uncontested_parry(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_parry_ += value; }
  679. void add_uncontested_block(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_block_ += value; }
  680. void add_uncontested_dodge(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_dodge_ += value; }
  681. void add_uncontested_riposte(float value) { std::lock_guard<std::mutex> lk(classMutex); uncontested_riposte_ += value; }
  682. void add_crit_chance(float value) { std::lock_guard<std::mutex> lk(classMutex); crit_chance_ += value; }
  683. void add_crit_bonus(float value) { std::lock_guard<std::mutex> lk(classMutex); crit_bonus_ += value; }
  684. void add_potency(float value) { std::lock_guard<std::mutex> lk(classMutex); potency_ += value; }
  685. void add_hate_mod(float value) { std::lock_guard<std::mutex> lk(classMutex); hate_mod_ += value; }
  686. void add_reuse_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); reuse_speed_ += value; }
  687. void add_casting_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); casting_speed_ += value; }
  688. void add_recovery_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); recovery_speed_ += value; }
  689. void add_spell_reuse_speed(float value) { std::lock_guard<std::mutex> lk(classMutex); spell_reuse_speed_ += value; }
  690. void add_spell_multi_attack(float value) { std::lock_guard<std::mutex> lk(classMutex); spell_multi_attack_ += value; }
  691. void add_dps(float value) { std::lock_guard<std::mutex> lk(classMutex); dps_ += value; }
  692. void add_dps_multiplier(float value) { std::lock_guard<std::mutex> lk(classMutex); dps_multiplier_ += value; }
  693. void add_attackspeed(float value) { std::lock_guard<std::mutex> lk(classMutex); attackspeed_ += value; }
  694. void add_haste(float value) { std::lock_guard<std::mutex> lk(classMutex); haste_ += value; }
  695. void add_multi_attack(float value) { std::lock_guard<std::mutex> lk(classMutex); multi_attack_ += value; }
  696. void add_flurry(float value) { std::lock_guard<std::mutex> lk(classMutex); flurry_ += value; }
  697. void add_melee_ae(float value) { std::lock_guard<std::mutex> lk(classMutex); melee_ae_ += value; }
  698. void add_strikethrough(float value) { std::lock_guard<std::mutex> lk(classMutex); strikethrough_ += value; }
  699. void add_accuracy(float value) { std::lock_guard<std::mutex> lk(classMutex); accuracy_ += value; }
  700. void add_offensivespeed(float value) { std::lock_guard<std::mutex> lk(classMutex); offensivespeed_ += value; }
  701. void add_rain(float value) { std::lock_guard<std::mutex> lk(classMutex); rain_ += value; }
  702. void add_wind(float value) { std::lock_guard<std::mutex> lk(classMutex); wind_ += value; }
  703. void set_alignment(int8 value) { std::lock_guard<std::mutex> lk(classMutex); alignment_ = value; }
  704. void set_pet_id(int32 value) { std::lock_guard<std::mutex> lk(classMutex); pet_id_ = value; }
  705. void set_pet_name(std::string value) { std::lock_guard<std::mutex> lk(classMutex); pet_name_ = value; }
  706. void set_pet_movement(int8 value) { std::lock_guard<std::mutex> lk(classMutex); pet_movement_ = value; }
  707. void set_pet_behavior(int8 value) { std::lock_guard<std::mutex> lk(classMutex); pet_behavior_ = value; }
  708. void set_pet_health_pct(float value) { std::lock_guard<std::mutex> lk(classMutex); pet_health_pct_ = value; }
  709. void set_pet_power_pct(float value) { std::lock_guard<std::mutex> lk(classMutex); pet_power_pct_ = value; }
  710. void set_weight(int32 value) { std::lock_guard<std::mutex> lk(classMutex); weight_ = value; }
  711. void set_max_weight(int32 value) { std::lock_guard<std::mutex> lk(classMutex); max_weight_ = value; }
  712. void set_vision(int8 value) { std::lock_guard<std::mutex> lk(classMutex); vision_ = value; }
  713. void set_breathe_underwater(int8 value) { std::lock_guard<std::mutex> lk(classMutex); breathe_underwater_ = value; }
  714. void set_drunk(float value) { std::lock_guard<std::mutex> lk(classMutex); drunk_ = value; }
  715. void set_biography(std::string value) { std::lock_guard<std::mutex> lk(classMutex); biography_ = value; }
  716. void set_power_regen(sint16 value) { std::lock_guard<std::mutex> lk(classMutex); power_regen_ = value; }
  717. void set_hp_regen(sint16 value) { std::lock_guard<std::mutex> lk(classMutex); hp_regen_ = value; }
  718. void set_power_regen_override(int8 value) { std::lock_guard<std::mutex> lk(classMutex); power_regen_override_ = value; }
  719. void set_hp_regen_override(int8 value) { std::lock_guard<std::mutex> lk(classMutex); hp_regen_override_ = value; }
  720. void set_water_type(int8 value) { std::lock_guard<std::mutex> lk(classMutex); water_type_ = value; }
  721. void set_flying_type(int8 value) { std::lock_guard<std::mutex> lk(classMutex); flying_type_ = value; }
  722. void set_no_interrupt(int8 value) { std::lock_guard<std::mutex> lk(classMutex); no_interrupt_ = value; }
  723. void ResetEffects(Spawn* spawn)
  724. {
  725. for(int i=0;i<45;i++){
  726. if(i<30){
  727. maintained_effects[i].spell_id = 0xFFFFFFFF;
  728. if (spawn->IsPlayer())
  729. maintained_effects[i].icon = 0xFFFF;
  730. maintained_effects[i].spell = nullptr;
  731. }
  732. spell_effects[i].spell_id = 0xFFFFFFFF;
  733. spell_effects[i].spell = nullptr;
  734. }
  735. }
  736. // maintained via their own mutex
  737. SpellEffects spell_effects[45];
  738. MaintainedEffects maintained_effects[30];
  739. private:
  740. std::string name_;
  741. int8 class1_;
  742. int8 class2_;
  743. int8 class3_;
  744. int8 race_;
  745. int8 gender_;
  746. int16 level_;
  747. int16 max_level_;
  748. int16 effective_level_;
  749. int16 tradeskill_level_;
  750. int16 tradeskill_max_level_;
  751. int8 cur_concentration_;
  752. int8 max_concentration_;
  753. int16 cur_attack_;
  754. int16 attack_base_;
  755. int16 cur_mitigation_;
  756. int16 max_mitigation_;
  757. int16 mitigation_base_;
  758. int16 avoidance_display_;
  759. float cur_avoidance_;
  760. int16 base_avoidance_pct_;
  761. int16 avoidance_base_;
  762. int16 max_avoidance_;
  763. float parry_;
  764. float parry_base_;
  765. float deflection_;
  766. int16 deflection_base_;
  767. float block_;
  768. int16 block_base_;
  769. float riposte_;
  770. float riposte_base_;
  771. float str_; //int16
  772. float sta_; //int16
  773. float agi_;//int16
  774. float wis_;//int16
  775. float intel_;//int16
  776. float str_base_;//int16
  777. float sta_base_;//int16
  778. float agi_base_;//int16
  779. float wis_base_;//int16
  780. float intel_base_;//int16
  781. int16 heat_;
  782. int16 cold_;
  783. int16 magic_;
  784. int16 mental_;
  785. int16 divine_;
  786. int16 disease_;
  787. int16 poison_;
  788. int16 disease_base_;
  789. int16 cold_base_;
  790. int16 divine_base_;
  791. int16 magic_base_;
  792. int16 mental_base_;
  793. int16 heat_base_;
  794. int16 poison_base_;
  795. int16 elemental_base_;
  796. int16 noxious_base_;
  797. int16 arcane_base_;
  798. int32 coin_copper_;
  799. int32 coin_silver_;
  800. int32 coin_gold_;
  801. int32 coin_plat_;
  802. int32 bank_coin_copper_;
  803. int32 bank_coin_silver_;
  804. int32 bank_coin_gold_;
  805. int32 bank_coin_plat_;
  806. int32 status_points_;
  807. std::string deity_;
  808. int32 weight_;
  809. int32 max_weight_;
  810. int8 tradeskill_class1_;
  811. int8 tradeskill_class2_;
  812. int8 tradeskill_class3_;
  813. int16 account_age_base_;
  814. int8 account_age_bonus_[19];
  815. int16 absorb_;
  816. int32 xp_;
  817. int32 xp_needed_;
  818. float xp_debt_;
  819. int16 xp_yellow_;
  820. int16 xp_yellow_vitality_bar_;
  821. int16 xp_blue_vitality_bar_;
  822. int16 xp_blue_;
  823. int32 ts_xp_;
  824. int32 ts_xp_needed_;
  825. int16 tradeskill_exp_yellow_;
  826. int16 tradeskill_exp_blue_;
  827. int32 flags_;
  828. int32 flags2_;
  829. float xp_vitality_;
  830. float tradeskill_xp_vitality_;
  831. int16 mitigation_skill1_;
  832. int16 mitigation_skill2_;
  833. int16 mitigation_skill3_;
  834. float ability_modifier_;
  835. float critical_mitigation_;
  836. float block_chance_;
  837. float uncontested_parry_;
  838. float uncontested_block_;
  839. float uncontested_dodge_;
  840. float uncontested_riposte_;
  841. float crit_chance_;
  842. float crit_bonus_;
  843. float potency_;
  844. float hate_mod_;
  845. float reuse_speed_;
  846. float casting_speed_;
  847. float recovery_speed_;
  848. float spell_reuse_speed_;
  849. float spell_multi_attack_;
  850. float dps_;
  851. float dps_multiplier_;
  852. float attackspeed_;
  853. float haste_;
  854. float multi_attack_;
  855. float flurry_;
  856. float melee_ae_;
  857. float strikethrough_;
  858. float accuracy_;
  859. float offensivespeed_;
  860. float rain_;
  861. float wind_;
  862. sint8 alignment_;
  863. int32 pet_id_;
  864. std::string pet_name_;
  865. float pet_health_pct_;
  866. float pet_power_pct_;
  867. int8 pet_movement_;
  868. int8 pet_behavior_;
  869. int8 vision_;
  870. int8 breathe_underwater_;
  871. std::string biography_;
  872. float drunk_;
  873. sint16 power_regen_;
  874. sint16 hp_regen_;
  875. int8 power_regen_override_;
  876. int8 hp_regen_override_;
  877. int8 water_type_;
  878. int8 flying_type_;
  879. int8 no_interrupt_;
  880. // when PacketStruct is fixed for C++17 this should become a shared_mutex and handle read/write lock
  881. std::mutex classMutex;
  882. };
  883. struct WardInfo {
  884. LuaSpell* Spell;
  885. int32 BaseDamage;
  886. int32 DamageLeft;
  887. int8 WardType;
  888. int8 DamageType;
  889. bool keepWard;
  890. int32 DamageAbsorptionPercentage;
  891. int32 DamageAbsorptionMaxHealthPercent;
  892. int32 RedirectDamagePercent;
  893. int32 LastRedirectDamage;
  894. int32 LastAbsorbedDamage;
  895. int32 HitCount;
  896. int32 MaxHitCount;
  897. bool AbsorbAllDamage; // damage is always absorbed, usually spells based on hits, when we pass damage in AddWard as 0 this will be set to true
  898. };
  899. #define WARD_TYPE_ALL 0
  900. #define WARD_TYPE_PHYSICAL 1
  901. #define WARD_TYPE_MAGICAL 2
  902. struct Proc {
  903. LuaSpell* spell;
  904. Item* item;
  905. float chance;
  906. int32 spellid;
  907. };
  908. #define PROC_TYPE_OFFENSIVE 1
  909. #define PROC_TYPE_DEFENSIVE 2
  910. #define PROC_TYPE_PHYSICAL_OFFENSIVE 3
  911. #define PROC_TYPE_PHYSICAL_DEFENSIVE 4
  912. #define PROC_TYPE_MAGICAL_OFFENSIVE 5
  913. #define PROC_TYPE_MAGICAL_DEFENSIVE 6
  914. #define PROC_TYPE_BLOCK 7
  915. #define PROC_TYPE_PARRY 8
  916. #define PROC_TYPE_RIPOSTE 9
  917. #define PROC_TYPE_EVADE 10
  918. #define PROC_TYPE_HEALING 11
  919. #define PROC_TYPE_BENEFICIAL 12
  920. #define PROC_TYPE_DEATH 13
  921. #define PROC_TYPE_KILL 14
  922. #define PROC_TYPE_DAMAGED 15
  923. #define PROC_TYPE_DAMAGED_MELEE 16
  924. #define PROC_TYPE_DAMAGED_MAGIC 17
  925. #define PROC_TYPE_RANGED_ATTACK 18
  926. #define PROC_TYPE_RANGED_DEFENSE 19
  927. struct ThreatTransfer {
  928. int32 Target;
  929. float Amount;
  930. LuaSpell* Spell;
  931. };
  932. #define DET_TYPE_TRAUMA 1
  933. #define DET_TYPE_ARCANE 2
  934. #define DET_TYPE_NOXIOUS 3
  935. #define DET_TYPE_ELEMENTAL 4
  936. #define DET_TYPE_CURSE 5
  937. #define DISPELL_TYPE_CURE 0
  938. #define DISPELL_TYPE_DISPELL 1
  939. #define CONTROL_EFFECT_TYPE_MEZ 1
  940. #define CONTROL_EFFECT_TYPE_STIFLE 2
  941. #define CONTROL_EFFECT_TYPE_DAZE 3
  942. #define CONTROL_EFFECT_TYPE_STUN 4
  943. #define CONTROL_EFFECT_TYPE_ROOT 5
  944. #define CONTROL_EFFECT_TYPE_FEAR 6
  945. #define CONTROL_EFFECT_TYPE_WALKUNDERWATER 7
  946. #define CONTROL_EFFECT_TYPE_JUMPUNDERWATER 8
  947. #define CONTROL_EFFECT_TYPE_INVIS 9
  948. #define CONTROL_EFFECT_TYPE_STEALTH 10
  949. #define CONTROL_EFFECT_TYPE_SNARE 11
  950. #define CONTROL_EFFECT_TYPE_FLIGHT 12
  951. #define CONTROL_EFFECT_TYPE_GLIDE 13
  952. #define CONTROL_EFFECT_TYPE_SAFEFALL 14
  953. #define CONTROL_MAX_EFFECTS 15 // always +1 to highest control effect
  954. #define IMMUNITY_TYPE_MEZ 1
  955. #define IMMUNITY_TYPE_STIFLE 2
  956. #define IMMUNITY_TYPE_DAZE 3
  957. #define IMMUNITY_TYPE_STUN 4
  958. #define IMMUNITY_TYPE_ROOT 5
  959. #define IMMUNITY_TYPE_FEAR 6
  960. #define IMMUNITY_TYPE_AOE 7
  961. #define IMMUNITY_TYPE_TAUNT 8
  962. #define IMMUNITY_TYPE_RIPOSTE 9
  963. //class Spell;
  964. //class ZoneServer;
  965. //The entity class is for NPCs and Players, spawns which are able to fight
  966. class Entity : public Spawn{
  967. public:
  968. Entity();
  969. virtual ~Entity();
  970. void MapInfoStruct();
  971. virtual float GetDodgeChance();
  972. virtual void AddMaintainedSpell(LuaSpell* spell);
  973. virtual void AddSpellEffect(LuaSpell* spell);
  974. virtual void RemoveMaintainedSpell(LuaSpell* spell);
  975. virtual void RemoveSpellEffect(LuaSpell* spell);
  976. virtual bool HasActiveMaintainedSpell(Spell* spell, Spawn* target);
  977. virtual bool HasActiveSpellEffect(Spell* spell, Spawn* target);
  978. virtual void AddSkillBonus(int32 spell_id, int32 skill_id, float value);
  979. void AddDetrimentalSpell(LuaSpell* spell);
  980. DetrimentalEffects* GetDetrimentalEffect(int32 spell_id, Entity* caster);
  981. virtual MaintainedEffects* GetMaintainedSpell(int32 spell_id);
  982. void RemoveDetrimentalSpell(LuaSpell* spell);
  983. void SetDeity(int8 new_deity){
  984. deity = new_deity;
  985. }
  986. int8 GetDeity(){ return deity; }
  987. EquipmentItemList* GetEquipmentList();
  988. bool IsEntity(){ return true; }
  989. float CalculateSkillStatChance(char* skill, int16 item_stat, float max_cap = 0.0f, float modifier = 0.0f, bool add_to_skill = false);
  990. void CalculateBonuses();
  991. void SetRegenValues(int16 effective_level);
  992. float CalculateBonusMod();
  993. float CalculateDPSMultiplier();
  994. float CalculateCastingSpeedMod();
  995. InfoStruct* GetInfoStruct();
  996. int16 GetStr();
  997. int16 GetSta();
  998. int16 GetInt();
  999. int16 GetWis();
  1000. int16 GetAgi();
  1001. int16 GetPrimaryStat();
  1002. int16 GetHeatResistance();
  1003. int16 GetColdResistance();
  1004. int16 GetMagicResistance();
  1005. int16 GetMentalResistance();
  1006. int16 GetDivineResistance();
  1007. int16 GetDiseaseResistance();
  1008. int16 GetPoisonResistance();
  1009. int16 GetStrBase();
  1010. int16 GetStaBase();
  1011. int16 GetIntBase();
  1012. int16 GetWisBase();
  1013. int16 GetAgiBase();
  1014. int16 GetHeatResistanceBase();
  1015. int16 GetColdResistanceBase();
  1016. int16 GetMagicResistanceBase();
  1017. int16 GetMentalResistanceBase();
  1018. int16 GetDivineResistanceBase();
  1019. int16 GetDiseaseResistanceBase();
  1020. int16 GetPoisonResistanceBase();
  1021. int8 GetConcentrationCurrent();
  1022. int8 GetConcentrationMax();
  1023. sint8 GetAlignment();
  1024. void SetAlignment(sint8 new_value);
  1025. bool HasMoved(bool include_heading);
  1026. void SetHPRegen(int16 new_val);
  1027. int16 GetHPRegen();
  1028. void DoRegenUpdate();
  1029. MaintainedEffects* GetFreeMaintainedSpellSlot();
  1030. SpellEffects* GetFreeSpellEffectSlot();
  1031. SpellEffects* GetSpellEffect(int32 id, Entity* caster = 0);
  1032. //flags
  1033. int32 GetFlags() { return info_struct.get_flags(); }
  1034. int32 GetFlags2() { return info_struct.get_flags2(); }
  1035. bool query_flags(int flag) {
  1036. if (flag > 63) return false;
  1037. if (flag < 32) return ((info_struct.get_flags() & (1 << flag))?true:false);
  1038. return ((info_struct.get_flags2() & (1 << (flag - 32)))?true:false);
  1039. }
  1040. float GetMaxSpeed();
  1041. void SetMaxSpeed(float val);
  1042. //combat stuff:
  1043. int32 GetRangeLastAttackTime();
  1044. void SetRangeLastAttackTime(int32 time);
  1045. int16 GetRangeAttackDelay();
  1046. int16 GetRangeWeaponDelay() {return ranged_combat_data.ranged_weapon_delay;}
  1047. void SetRangeWeaponDelay(int16 new_delay) {ranged_combat_data.ranged_weapon_delay = new_delay * 100;}
  1048. void SetRangeAttackDelay(int16 new_delay) {ranged_combat_data.ranged_attack_delay = new_delay;}
  1049. int32 GetPrimaryLastAttackTime();
  1050. int16 GetPrimaryAttackDelay();
  1051. void SetPrimaryAttackDelay(int16 new_delay);
  1052. void SetPrimaryLastAttackTime(int32 new_time);
  1053. void SetPrimaryWeaponDelay(int16 new_delay) {melee_combat_data.primary_weapon_delay = new_delay * 100;}
  1054. int32 GetSecondaryLastAttackTime();
  1055. int16 GetSecondaryAttackDelay();
  1056. void SetSecondaryAttackDelay(int16 new_delay);
  1057. void SetSecondaryLastAttackTime(int32 new_time);
  1058. void SetSecondaryWeaponDelay(int16 new_delay) {melee_combat_data.primary_weapon_delay = new_delay * 100;}
  1059. int32 GetPrimaryWeaponMinDamage();
  1060. int32 GetPrimaryWeaponMaxDamage();
  1061. int32 GetSecondaryWeaponMinDamage();
  1062. int32 GetSecondaryWeaponMaxDamage();
  1063. int32 GetRangedWeaponMinDamage();
  1064. int32 GetRangedWeaponMaxDamage();
  1065. int8 GetPrimaryWeaponType();
  1066. int8 GetSecondaryWeaponType();
  1067. int8 GetRangedWeaponType();
  1068. int8 GetWieldType();
  1069. int16 GetPrimaryWeaponDelay() {return melee_combat_data.primary_weapon_delay;}
  1070. int16 GetSecondaryWeaponDelay() {return melee_combat_data.secondary_weapon_delay;}
  1071. bool IsDualWield();
  1072. bool BehindTarget(Spawn* target);
  1073. bool FlankingTarget(Spawn* target);
  1074. void ChangePrimaryWeapon();
  1075. void ChangeSecondaryWeapon();
  1076. void ChangeRangedWeapon();
  1077. virtual Skill* GetSkillByName(const char* name, bool check_update = false);
  1078. bool AttackAllowed(Entity* target, float distance = 0, bool range_attack = false);
  1079. bool PrimaryWeaponReady();
  1080. bool SecondaryWeaponReady();
  1081. bool RangeWeaponReady();
  1082. void MeleeAttack(Spawn* victim, float distance, bool primary, bool multi_attack = false);
  1083. void RangeAttack(Spawn* victim, float distance, Item* weapon, Item* ammo, bool multi_attack = false);
  1084. bool SpellAttack(Spawn* victim, float distance, LuaSpell* luaspell, int8 damage_type, int32 low_damage, int32 high_damage, int8 crit_mod = 0, bool no_calcs = false);
  1085. bool ProcAttack(Spawn* victim, int8 damage_type, int32 low_damage, int32 high_damage, string name, string success_msg, string effect_msg);
  1086. bool SpellHeal(Spawn* target, float distance, LuaSpell* luaspell, string heal_type, int32 low_heal, int32 high_heal, int8 crit_mod = 0, bool no_calcs = false, string custom_spell_name="");
  1087. int8 DetermineHit(Spawn* victim, int8 damage_type, float ToHitBonus, bool spell);
  1088. float GetDamageTypeResistPercentage(int8 damage_type);
  1089. Skill* GetSkillByWeaponType(int8 type, bool update);
  1090. bool DamageSpawn(Entity* victim, int8 type, int8 damage_type, int32 low_damage, int32 high_damage, const char* spell_name, int8 crit_mod = 0, bool is_tick = false, bool no_damage_calcs = false, bool ignore_attacker = false);
  1091. void AddHate(Entity* attacker, sint32 hate);
  1092. bool CheckInterruptSpell(Entity* attacker);
  1093. void KillSpawn(Spawn* dead, int8 damage_type = 0, int16 kill_blow_type = 0);
  1094. void HandleDeathExperienceDebt(Spawn* killer);
  1095. void SetAttackDelay(bool primary = false, bool ranged = false);
  1096. float CalculateAttackSpeedMod();
  1097. virtual void ProcessCombat();
  1098. bool EngagedInCombat();
  1099. virtual void InCombat(bool val);
  1100. bool IsCasting();
  1101. void IsCasting(bool val);
  1102. void SetMount(int16 mount_id, int8 red = 0xFF, int8 green = 0xFF, int8 blue = 0xFF, bool setUpdateFlags = true)
  1103. {
  1104. if (mount_id == 0) {
  1105. EQ2_Color color;
  1106. color.red = 0;
  1107. color.green = 0;
  1108. color.blue = 0;
  1109. SetMountColor(&color);
  1110. SetMountSaddleColor(&color);
  1111. }
  1112. else
  1113. {
  1114. EQ2_Color color;
  1115. color.red = red;
  1116. color.green = green;
  1117. color.blue = blue;
  1118. SetMountColor(&color);
  1119. SetMountSaddleColor(&color);
  1120. }
  1121. SetInfo(&features.mount_model_type, mount_id, setUpdateFlags);
  1122. }
  1123. void SetEquipment(Item* item, int8 slot = 255);
  1124. void SetEquipment(int8 slot, int16 type, int8 red, int8 green, int8 blue, int8 h_r, int8 h_g, int8 h_b){
  1125. std::lock_guard<std::mutex> lk(MEquipment);
  1126. if(slot >= NUM_SLOTS)
  1127. return;
  1128. SetInfo(&equipment.equip_id[slot], type);
  1129. SetInfo(&equipment.color[slot].red, red);
  1130. SetInfo(&equipment.color[slot].green, green);
  1131. SetInfo(&equipment.color[slot].blue, blue);
  1132. SetInfo(&equipment.highlight[slot].red, h_r);
  1133. SetInfo(&equipment.highlight[slot].green, h_g);
  1134. SetInfo(&equipment.highlight[slot].blue, h_b);
  1135. }
  1136. void SetHairType(int16 new_val, bool setUpdateFlags = true){
  1137. SetInfo(&features.hair_type, new_val, setUpdateFlags);
  1138. }
  1139. void SetHairColor1(EQ2_Color new_val, bool setUpdateFlags = true){
  1140. SetInfo(&features.hair_color1, new_val, setUpdateFlags);
  1141. }
  1142. void SetHairColor2(EQ2_Color new_val, bool setUpdateFlags = true){
  1143. SetInfo(&features.hair_color2, new_val, setUpdateFlags);
  1144. }
  1145. void SetSogaHairColor1(EQ2_Color new_val, bool setUpdateFlags = true){
  1146. SetInfo(&features.soga_hair_color1, new_val, setUpdateFlags);
  1147. }
  1148. void SetSogaHairColor2(EQ2_Color new_val, bool setUpdateFlags = true){
  1149. SetInfo(&features.soga_hair_color2, new_val, setUpdateFlags);
  1150. }
  1151. void SetHairHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
  1152. SetInfo(&features.hair_highlight_color, new_val, setUpdateFlags);
  1153. }
  1154. void SetSogaHairHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
  1155. SetInfo(&features.soga_hair_highlight_color, new_val, setUpdateFlags);
  1156. }
  1157. void SetHairColor(EQ2_Color new_val, bool setUpdateFlags = true){
  1158. SetInfo(&features.hair_type_color, new_val, setUpdateFlags);
  1159. }
  1160. void SetSogaHairColor(EQ2_Color new_val, bool setUpdateFlags = true){
  1161. SetInfo(&features.soga_hair_type_color, new_val, setUpdateFlags);
  1162. }
  1163. void SetHairTypeHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
  1164. SetInfo(&features.hair_type_highlight_color, new_val, setUpdateFlags);
  1165. }
  1166. void SetSogaHairTypeHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
  1167. SetInfo(&features.soga_hair_type_highlight_color, new_val, setUpdateFlags);
  1168. }
  1169. void SetFacialHairType(int16 new_val, bool setUpdateFlags = true){
  1170. SetInfo(&features.hair_face_type, new_val, setUpdateFlags);
  1171. }
  1172. void SetFacialHairColor(EQ2_Color new_val, bool setUpdateFlags = true){
  1173. SetInfo(&features.hair_face_color, new_val, setUpdateFlags);
  1174. }
  1175. void SetSogaFacialHairColor(EQ2_Color new_val, bool setUpdateFlags = true){
  1176. SetInfo(&features.soga_hair_face_color, new_val, setUpdateFlags);
  1177. }
  1178. void SetFacialHairHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
  1179. SetInfo(&features.hair_face_highlight_color, new_val, setUpdateFlags);
  1180. }
  1181. void SetSogaFacialHairHighlightColor(EQ2_Color new_val, bool setUpdateFlags = true){
  1182. SetInfo(&features.soga_hair_face_highlight_color, new_val, setUpdateFlags);
  1183. }
  1184. void SetWingType(int16 new_val, bool setUpdateFlags = true){
  1185. SetInfo(&features.wing_type, new_val, setUpdateFlags);
  1186. }
  1187. void SetWingColor1(EQ2_Color new_val, bool setUpdateFlags = true){
  1188. SetInfo(&features.wing_color1, new_val, setUpdateFlags);
  1189. }
  1190. void SetWingColor2(EQ2_Color new_val, bool setUpdateFlags = true){
  1191. SetInfo(&features.wing_color2, new_val, setUpdateFlags);
  1192. }
  1193. void SetChestType(int16 new_val, bool setUpdateFlags = true){
  1194. SetInfo(&features.chest_type, new_val, setUpdateFlags);
  1195. }
  1196. void SetLegsType(int16 new_val, bool setUpdateFlags = true){
  1197. SetInfo(&features.legs_type, new_val, setUpdateFlags);
  1198. }
  1199. void SetSogaHairType(int16 new_val, bool setUpdateFlags = true){
  1200. SetInfo(&features.soga_hair_type, new_val, setUpdateFlags);
  1201. }
  1202. void SetSogaFacialHairType(int16 new_val, bool setUpdateFlags = true){
  1203. SetInfo(&features.soga_hair_face_type, new_val, setUpdateFlags);
  1204. }
  1205. void SetSogaChestType(int16 new_val, bool setUpdateFlags = true){
  1206. SetInfo(&features.soga_chest_type, new_val, setUpdateFlags);
  1207. }
  1208. void SetSogaLegType(int16 new_val, bool setUpdateFlags = true){
  1209. SetInfo(&features.soga_legs_type, new_val, setUpdateFlags);
  1210. }
  1211. void SetSkinColor(EQ2_Color color){
  1212. SetInfo(&features.skin_color, color);
  1213. }
  1214. void SetSogaSkinColor(EQ2_Color color){
  1215. SetInfo(&features.soga_skin_color, color);
  1216. }
  1217. void SetModelColor(EQ2_Color color){
  1218. SetInfo(&features.model_color, color);
  1219. }
  1220. void SetSogaModelColor(EQ2_Color color){
  1221. SetInfo(&features.soga_model_color, color);
  1222. }
  1223. void SetCombatVoice(int16 val, bool setUpdateFlags = true) {
  1224. SetInfo(&features.combat_voice, val, setUpdateFlags);
  1225. }
  1226. void SetEmoteVoice(int16 val, bool setUpdateFlags = true) {
  1227. SetInfo(&features.emote_voice, val, setUpdateFlags);
  1228. }
  1229. int16 GetCombatVoice(){ return features.combat_voice; }
  1230. int16 GetEmoteVoice(){ return features.emote_voice; }
  1231. int16 GetMount(){ return features.mount_model_type; }
  1232. void SetMountSaddleColor(EQ2_Color* color){
  1233. SetInfo(&features.mount_saddle_color, *color);
  1234. }
  1235. void SetMountColor(EQ2_Color* color){
  1236. SetInfo(&features.mount_color, *color);
  1237. }
  1238. void SetEyeColor(EQ2_Color eye_color){
  1239. SetInfo(&features.eye_color, eye_color);
  1240. }
  1241. void SetSogaEyeColor(EQ2_Color eye_color){
  1242. SetInfo(&features.soga_eye_color, eye_color);
  1243. }
  1244. int16 GetHairType(){
  1245. return features.hair_type;
  1246. }
  1247. int16 GetFacialHairType(){
  1248. return features.hair_face_type;
  1249. }
  1250. int16 GetWingType(){
  1251. return features.wing_type;
  1252. }
  1253. int16 GetChestType(){
  1254. return features.chest_type;
  1255. }
  1256. int16 GetLegsType(){
  1257. return features.legs_type;
  1258. }
  1259. int16 GetSogaHairType(){
  1260. return features.soga_hair_type;
  1261. }
  1262. int16 GetSogaFacialHairType(){
  1263. return features.soga_hair_face_type;
  1264. }
  1265. int16 GetSogaChestType(){
  1266. return features.soga_chest_type;
  1267. }
  1268. int16 GetSogaLegType(){
  1269. return features.soga_legs_type;
  1270. }
  1271. EQ2_Color* GetSkinColor(){
  1272. return &features.skin_color;
  1273. }
  1274. EQ2_Color* GetModelColor(){
  1275. return &features.model_color;
  1276. }
  1277. EQ2_Color* GetSogaModelColor(){
  1278. return &features.soga_model_color;
  1279. }
  1280. EQ2_Color* GetEyeColor(){
  1281. return &features.eye_color;
  1282. }
  1283. EQ2_Color* GetMountSaddleColor(){
  1284. return &features.mount_saddle_color;
  1285. }
  1286. EQ2_Color* GetMountColor(){
  1287. return &features.mount_color;
  1288. }
  1289. // should only be accessed through MEquipment mutex
  1290. EQ2_Equipment equipment;
  1291. CharFeatures features;
  1292. void AddSpellBonus(LuaSpell* spell, int16 type, float value, int64 class_req =0, vector<int16> race_req = vector<int16>(), vector<int16> faction_req = vector<int16>());
  1293. BonusValues* GetSpellBonus(int32 spell_id);
  1294. vector<BonusValues*>* GetAllSpellBonuses(LuaSpell* spell);
  1295. bool CheckSpellBonusRemoval(LuaSpell* spell, int16 type);
  1296. void RemoveSpellBonus(const LuaSpell* spell);
  1297. void CalculateSpellBonuses(ItemStatsValues* stats);
  1298. void AddMezSpell(LuaSpell* spell);
  1299. void RemoveMezSpell(LuaSpell* spell);
  1300. void RemoveAllMezSpells();
  1301. bool IsMezzed();
  1302. void AddStifleSpell(LuaSpell* spell);
  1303. void RemoveStifleSpell(LuaSpell* spell);
  1304. bool IsStifled();
  1305. void AddDazeSpell(LuaSpell* spell);
  1306. void RemoveDazeSpell(LuaSpell* spell);
  1307. bool IsDazed();
  1308. void AddStunSpell(LuaSpell* spell);
  1309. void RemoveStunSpell(LuaSpell* spell);
  1310. bool IsStunned();
  1311. bool IsMezzedOrStunned() {return IsMezzed() || IsStunned();}
  1312. void AddRootSpell(LuaSpell* spell);
  1313. void RemoveRootSpell(LuaSpell* spell);
  1314. bool IsRooted();
  1315. void AddFearSpell(LuaSpell* spell);
  1316. void RemoveFearSpell(LuaSpell* spell);
  1317. bool IsFeared();
  1318. void AddSnareSpell(LuaSpell* spell);
  1319. void RemoveSnareSpell(LuaSpell* spell);
  1320. void SetSnareValue(LuaSpell* spell, float snare_val);
  1321. bool IsSnared();
  1322. float GetHighestSnare();
  1323. bool HasControlEffect(int8 type);
  1324. void HaltMovement();
  1325. void SetCombatPet(Entity* pet) { this->pet = pet; }
  1326. void SetCharmedPet(Entity* pet) { charmedPet = pet; }
  1327. void SetDeityPet(Entity* pet) { deityPet = pet; }
  1328. void SetCosmeticPet(Entity* pet) { cosmeticPet = pet; }
  1329. Entity* GetPet() { return pet; }
  1330. Entity* GetCharmedPet() { return charmedPet; }
  1331. Entity* GetDeityPet() { return deityPet; }
  1332. Entity* GetCosmeticPet() { return cosmeticPet; }
  1333. /// <summary>Check to see if the entity has a combat pet</summary>
  1334. /// <returns>True if the entity has a combat pet</returns>
  1335. bool HasPet() { return (pet || charmedPet) ? true : false; }
  1336. void HideDeityPet(bool val);
  1337. void HideCosmeticPet(bool val);
  1338. void DismissPet(Entity* pet, bool from_death = false, bool spawnListLocked = false);
  1339. void DismissAllPets(bool from_death = false, bool spawnListLocked = false);
  1340. void SetOwner(Entity* owner) { if (owner) { this->owner = owner->GetID(); } else { owner = 0; } }
  1341. Entity* GetOwner();
  1342. int8 GetPetType() { return m_petType; }
  1343. void SetPetType(int8 val) { m_petType = val; }
  1344. void SetPetSpellID(int32 val) { m_petSpellID = val; }
  1345. int32 GetPetSpellID() { return m_petSpellID; }
  1346. void SetPetSpellTier(int8 val) { m_petSpellTier = val; }
  1347. int8 GetPetSpellTier() { return m_petSpellTier; }
  1348. bool IsDismissing() { return m_petDismissing; }
  1349. void SetDismissing(bool val) { m_petDismissing = val; }
  1350. /// <summary>Creates a loot chest to drop in the world</summary>
  1351. /// <returns>Pointer to the chest</returns>
  1352. NPC* DropChest();
  1353. /// <summary>Add a ward to the entities ward list</summary>
  1354. /// <param name='spellID'>Spell id of the ward to add</param>
  1355. /// <param name='ward'>WardInfo* of the ward we are adding</parma>
  1356. void AddWard(int32 spellID, WardInfo* ward);
  1357. /// <summary>Gets ward info for the given spell id</summary>
  1358. /// <param name='spellID'>The spell id of the ward we want to get</param>
  1359. /// <returns>WardInfo for the given spell id</returns>
  1360. WardInfo* GetWard(int32 spellID);
  1361. /// <summary>Removes the ward with the given spell id</summary>
  1362. /// <param name='spellID'>The spell id of the ward to remove</param>
  1363. void RemoveWard(int32 spellID);
  1364. /// <summary>Subtracts the given damage from the wards</summary>
  1365. /// <param name='damage'>The damage to subtract from the wards</param>
  1366. /// <returns>The amount of damage left after wards</returns>
  1367. int32 CheckWards(Entity* attacker, int32 damage, int8 damage_type);
  1368. map<int16, float> stats;
  1369. /// <summary>Adds a proc to the list of current procs</summary>
  1370. /// <param name='type'>The type of proc to add</param>
  1371. /// <param name='chance'>The percent chance the proc has to go off</param>
  1372. /// <param name='item'>The item the proc is coming from if any</param>
  1373. /// <param name='spell'>The spell the proc is coming from if any</param>
  1374. void AddProc(int8 type, float chance, Item* item = 0, LuaSpell* spell = 0);
  1375. /// <summary>Removes a proc from the list of current procs</summary>
  1376. /// <param name='item'>Item the proc is from</param>
  1377. /// <param name='spell'>Spell the proc is from</param>
  1378. void RemoveProc(Item* item = 0, LuaSpell* spell = 0);
  1379. /// <summary>Cycles through the proc list and executes them if they can go off</summary>
  1380. /// <param name='type'>The proc type to check</param>
  1381. /// <param name='target'>The target of the proc if it goes off</param>
  1382. void CheckProcs(int8 type, Spawn* target);
  1383. /// <summary>Clears the entire proc list</summary>
  1384. void ClearProcs();
  1385. float GetSpeed();
  1386. float GetAirSpeed();
  1387. float GetBaseSpeed() { return base_speed; }
  1388. void SetSpeed(float val, bool override_ = false) { if ((base_speed == 0.0f && val > 0.0f) || override_) base_speed = val; speed = val; }
  1389. void SetSpeedMultiplier(float val) { speed_multiplier = val; }
  1390. void SetThreatTransfer(ThreatTransfer* transfer) { m_threatTransfer = transfer; }
  1391. ThreatTransfer* GetThreatTransfer() { return m_threatTransfer; }
  1392. int8 GetTraumaCount();
  1393. int8 GetArcaneCount();
  1394. int8 GetNoxiousCount();
  1395. int8 GetElementalCount();
  1396. int8 GetCurseCount();
  1397. int8 GetDetTypeCount(int8 det_type);
  1398. int8 GetDetCount();
  1399. bool HasCurableDetrimentType(int8 det_type);
  1400. Mutex* GetDetrimentMutex();
  1401. Mutex* GetMaintainedMutex();
  1402. Mutex* GetSpellEffectMutex();
  1403. void ClearAllDetriments();
  1404. void CureDetrimentByType(int8 cure_count, int8 det_type, string cure_name, Entity* caster, int8 cure_level = 0);
  1405. void CureDetrimentByControlEffect(int8 cure_count, int8 det_type, string cure_name, Entity* caster, int8 cure_level = 0);
  1406. vector<DetrimentalEffects>* GetDetrimentalSpellEffects();
  1407. void RemoveEffectsFromLuaSpell(LuaSpell* spell);
  1408. virtual void RemoveSkillBonus(int32 spell_id);
  1409. virtual bool CanSeeInvis(Entity* target);
  1410. void CancelAllStealth();
  1411. bool IsStealthed();
  1412. bool IsInvis();
  1413. void AddInvisSpell(LuaSpell* spell);
  1414. void AddStealthSpell(LuaSpell* spell);
  1415. void RemoveStealthSpell(LuaSpell* spell);
  1416. void RemoveInvisSpell(LuaSpell* spell);
  1417. void AddWaterwalkSpell(LuaSpell* spell);
  1418. void AddWaterjumpSpell(LuaSpell* spell);
  1419. void RemoveWaterwalkSpell(LuaSpell* spell);
  1420. void RemoveWaterjumpSpell(LuaSpell* spell);
  1421. void AddAOEImmunity(LuaSpell* spell);
  1422. bool IsAOEImmune();
  1423. void RemoveAOEImmunity(LuaSpell* spell);
  1424. void AddStunImmunity(LuaSpell* spell);
  1425. void RemoveStunImmunity(LuaSpell* spell);
  1426. bool IsStunImmune();
  1427. void AddStifleImmunity(LuaSpell* spell);
  1428. void RemoveStifleImmunity(LuaSpell* spell);
  1429. bool IsStifleImmune();
  1430. void AddMezImmunity(LuaSpell* spell);
  1431. void RemoveMezImmunity(LuaSpell* spell);
  1432. bool IsMezImmune();
  1433. void AddRootImmunity(LuaSpell* spell);
  1434. void RemoveRootImmunity(LuaSpell* spell);
  1435. bool IsRootImmune();
  1436. void AddFearImmunity(LuaSpell* spell);
  1437. void RemoveFearImmunity(LuaSpell* spell);
  1438. bool IsFearImmune();
  1439. void AddDazeImmunity(LuaSpell* spell);
  1440. void RemoveDazeImmunity(LuaSpell* spell);
  1441. bool IsDazeImmune();
  1442. void AddImmunity(LuaSpell* spell, int16 type);
  1443. void RemoveImmunity(LuaSpell* spell, int16 type);
  1444. bool IsImmune(int16 type);
  1445. void AddFlightSpell(LuaSpell* spell);
  1446. void RemoveFlightSpell(LuaSpell* spell);
  1447. void AddSafefallSpell(LuaSpell* spell);
  1448. void RemoveSafefallSpell(LuaSpell* spell);
  1449. void AddGlideSpell(LuaSpell* spell);
  1450. void RemoveGlideSpell(LuaSpell* spell);
  1451. GroupMemberInfo* GetGroupMemberInfo() { return group_member_info; }
  1452. void SetGroupMemberInfo(GroupMemberInfo* info) { group_member_info = info; }
  1453. void UpdateGroupMemberInfo(bool inGroupMgrLock=false, bool groupMembersLocked=false);
  1454. void CustomizeAppearance(PacketStruct* packet);
  1455. Trade* trade;
  1456. // Keep track of entities that hate this spawn.
  1457. set<int32> HatedBy;
  1458. std::mutex MHatedBy;
  1459. bool IsAggroed() {
  1460. int32 size = 0;
  1461. MHatedBy.lock();
  1462. size = HatedBy.size();
  1463. MHatedBy.unlock();
  1464. return size > 0;
  1465. }
  1466. Mutex MCommandMutex;
  1467. bool HasSeeInvisSpell() { return hasSeeInvisSpell; }
  1468. void SetSeeInvisSpell(bool val) { hasSeeInvisSpell = val; }
  1469. bool HasSeeHideSpell() { return hasSeeHideSpell; }
  1470. void SetSeeHideSpell(bool val) { hasSeeHideSpell = val; }
  1471. void SetInfoStruct(InfoStruct* struct_) { info_struct.SetInfoStruct(struct_); }
  1472. std::string GetInfoStructString(std::string field);
  1473. int8 GetInfoStructInt8(std::string field);
  1474. int16 GetInfoStructInt16(std::string field);
  1475. int32 GetInfoStructInt32(std::string field);
  1476. int64 GetInfoStructInt64(std::string field);
  1477. sint8 GetInfoStructSInt8(std::string field);
  1478. sint16 GetInfoStructSInt16(std::string field);
  1479. sint32 GetInfoStructSInt32(std::string field);
  1480. sint64 GetInfoStructSInt64(std::string field);
  1481. int64 GetInfoStructUInt(std::string field);
  1482. sint64 GetInfoStructSInt(std::string field);
  1483. float GetInfoStructFloat(std::string field);
  1484. bool SetInfoStructString(std::string field, std::string value);
  1485. bool SetInfoStructInt8(std::string field, int8 value);
  1486. bool SetInfoStructInt16(std::string field, int16 value);
  1487. bool SetInfoStructInt32(std::string field, int32 value);
  1488. bool SetInfoStructInt64(std::string field, int64 value);
  1489. bool SetInfoStructSInt8(std::string field, sint8 value);
  1490. bool SetInfoStructSInt16(std::string field, sint16 value);
  1491. bool SetInfoStructSInt32(std::string field, sint32 value);
  1492. bool SetInfoStructSInt64(std::string field, sint64 value);
  1493. bool SetInfoStructUInt(std::string field, int64 value);
  1494. bool SetInfoStructSInt(std::string field, sint64 value);
  1495. bool SetInfoStructFloat(std::string field, float value);
  1496. // when PacketStruct is fixed for C++17 this should become a shared_mutex and handle read/write lock
  1497. std::mutex MEquipment;
  1498. std::mutex MStats;
  1499. protected:
  1500. bool in_combat;
  1501. int8 m_petType;
  1502. int32 owner;
  1503. // m_petSpellID holds the spell id used to create/control this pet
  1504. int32 m_petSpellID;
  1505. int8 m_petSpellTier;
  1506. bool m_petDismissing;
  1507. private:
  1508. MutexList<BonusValues*> bonus_list;
  1509. map<int8, MutexList<LuaSpell*>*> control_effects;
  1510. map<int8, MutexList<LuaSpell*>*> immunities;
  1511. float max_speed;
  1512. int8 deity;
  1513. sint16 regen_hp_rate;
  1514. sint16 regen_power_rate;
  1515. float last_x;
  1516. float last_y;
  1517. float last_z;
  1518. float last_heading;
  1519. bool casting;
  1520. InfoStruct info_struct;
  1521. CombatData melee_combat_data;
  1522. CombatData ranged_combat_data;
  1523. map<int8, int8> det_count_list;
  1524. Mutex MDetriments;
  1525. Mutex MMaintainedSpells;
  1526. Mutex MSpellEffects;
  1527. vector<DetrimentalEffects> detrimental_spell_effects;
  1528. // Pointers for the 4 types of pets (Summon, Charm, Deity, Cosmetic)
  1529. Entity* pet;
  1530. Entity* charmedPet;
  1531. Entity* deityPet;
  1532. Entity* cosmeticPet;
  1533. // int32 = spell id, WardInfo* = pointer to ward info
  1534. map<int32, WardInfo*> m_wardList;
  1535. // int8 = type, vector<Proc*> = list of pointers to proc info
  1536. map <int8, vector<Proc*> > m_procList;
  1537. Mutex MProcList;
  1538. /// <summary>Actually calls the lua script to cast the proc</summary>
  1539. /// <param name='proc'>Proc to be cast</param>
  1540. /// <param name='type'>Type of proc going off</type>
  1541. /// <param name='target'>Target of the proc</param>
  1542. bool CastProc(Proc* proc, int8 type, Spawn* target);
  1543. float base_speed;
  1544. float speed;
  1545. float speed_multiplier;
  1546. map<LuaSpell*, float> snare_values;
  1547. ThreatTransfer* m_threatTransfer;
  1548. GroupMemberInfo* group_member_info;
  1549. bool hasSeeInvisSpell;
  1550. bool hasSeeHideSpell;
  1551. // GETs
  1552. map<string, boost::function<float()> > get_float_funcs;
  1553. map<string, boost::function<int64()> > get_int64_funcs;
  1554. map<string, boost::function<int32()> > get_int32_funcs;
  1555. map<string, boost::function<int16()> > get_int16_funcs;
  1556. map<string, boost::function<int8()> > get_int8_funcs;
  1557. map<string, boost::function<sint64()> > get_sint64_funcs;
  1558. map<string, boost::function<sint32()> > get_sint32_funcs;
  1559. map<string, boost::function<sint16()> > get_sint16_funcs;
  1560. map<string, boost::function<sint8()> > get_sint8_funcs;
  1561. map<string, boost::function<std::string()> > get_string_funcs;
  1562. // SETs
  1563. map<string, boost::function<void(float)> > set_float_funcs;
  1564. map<string, boost::function<void(int64)> > set_int64_funcs;
  1565. map<string, boost::function<void(int32)> > set_int32_funcs;
  1566. map<string, boost::function<void(int16)> > set_int16_funcs;
  1567. map<string, boost::function<void(int8)> > set_int8_funcs;
  1568. map<string, boost::function<void(sint64)> > set_sint64_funcs;
  1569. map<string, boost::function<void(sint32)> > set_sint32_funcs;
  1570. map<string, boost::function<void(sint16)> > set_sint16_funcs;
  1571. map<string, boost::function<void(sint8)> > set_sint8_funcs;
  1572. map<string, boost::function<void(std::string)> > set_string_funcs;
  1573. };
  1574. #endif