Entity.h 70 KB

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