Entity.h 95 KB

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