9
3

Entity.h 96 KB

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