Entity.h 71 KB

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