pc.hpp 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499
  1. // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef PC_HPP
  4. #define PC_HPP
  5. #include <memory>
  6. #include <vector>
  7. #include "../common/cbasetypes.hpp"
  8. #include "../common/database.hpp"
  9. #include "../common/mmo.hpp" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus
  10. #include "../common/strlib.hpp"// StringBuf
  11. #include "../common/timer.hpp"
  12. #include "battleground.hpp"
  13. #include "buyingstore.hpp" // struct s_buyingstore
  14. #include "clif.hpp" //e_wip_block
  15. #include "itemdb.hpp" // MAX_ITEMGROUP
  16. #include "map.hpp" // RC_ALL
  17. #include "mob.hpp" //e_size
  18. #include "script.hpp" // struct script_reg, struct script_regstr
  19. #include "searchstore.hpp" // struct s_search_store_info
  20. #include "status.hpp" // unit_data
  21. #include "unit.hpp" // unit_data
  22. #include "vending.hpp" // struct s_vending
  23. enum AtCommandType : uint8;
  24. enum e_instance_mode : uint8;
  25. //enum e_log_chat_type : uint8;
  26. enum e_log_pick_type : uint32;
  27. enum sc_type : int16;
  28. #define MAX_PC_BONUS 50 /// Max bonus, usually used by item bonus
  29. #define MAX_PC_SKILL_REQUIRE 5 /// Max skill tree requirement
  30. #define MAX_PC_FEELHATE 3 /// Max feel hate info
  31. #define DAMAGELOG_SIZE_PC 100 /// Damage log
  32. #define MAX_SPIRITBALL 15 /// Max spirit balls
  33. #define MAX_DEVOTION 5 /// Max Devotion slots
  34. #define MAX_SPIRITCHARM 10 /// Max spirit charms
  35. #define MAX_SOUL_BALL 20 /// Max soul ball
  36. #define MAX_STELLAR_MARKS 5 /// Max stellar marks
  37. #define MAX_UNITED_SOULS 12 /// Max united souls
  38. #define LANGTYPE_VAR "#langtype"
  39. #define CASHPOINT_VAR "#CASHPOINTS"
  40. #define KAFRAPOINT_VAR "#KAFRAPOINTS"
  41. #define BANK_VAULT_VAR "#BANKVAULT"
  42. #define ROULETTE_BRONZE_VAR "RouletteBronze"
  43. #define ROULETTE_SILVER_VAR "RouletteSilver"
  44. #define ROULETTE_GOLD_VAR "RouletteGold"
  45. #define COOKMASTERY_VAR "COOK_MASTERY"
  46. #define PCDIECOUNTER_VAR "PC_DIE_COUNTER"
  47. #define JOBCHANGE2ND_VAR "jobchange_level"
  48. #define JOBCHANGE3RD_VAR "jobchange_level_3rd"
  49. #define TKMISSIONID_VAR "TK_MISSION_ID"
  50. #define TKMISSIONCOUNT_VAR "TK_MISSION_COUNT"
  51. #define ATTENDANCE_DATE_VAR "#AttendanceDate"
  52. #define ATTENDANCE_COUNT_VAR "#AttendanceCounter"
  53. #define ACHIEVEMENTLEVEL "AchievementLevel"
  54. //Update this max as necessary. 55 is the value needed for Super Baby currently
  55. //Raised to 105 since Expanded Super Baby needs it.
  56. #define MAX_SKILL_TREE 105
  57. //Total number of classes (for data storage)
  58. #define CLASS_COUNT (JOB_MAX - JOB_NOVICE_HIGH + JOB_MAX_BASIC)
  59. //Equip indexes constants. (eg: sd->equip_index[EQI_AMMO] returns the index
  60. //where the arrows are equipped)
  61. enum equip_index {
  62. EQI_COMPOUND_ON = -1,
  63. EQI_ACC_L = 0,
  64. EQI_ACC_R,
  65. EQI_SHOES,
  66. EQI_GARMENT,
  67. EQI_HEAD_LOW,
  68. EQI_HEAD_MID,
  69. EQI_HEAD_TOP,
  70. EQI_ARMOR,
  71. EQI_HAND_L,
  72. EQI_HAND_R,
  73. EQI_COSTUME_HEAD_TOP,
  74. EQI_COSTUME_HEAD_MID,
  75. EQI_COSTUME_HEAD_LOW,
  76. EQI_COSTUME_GARMENT,
  77. EQI_AMMO,
  78. EQI_SHADOW_ARMOR,
  79. EQI_SHADOW_WEAPON,
  80. EQI_SHADOW_SHIELD,
  81. EQI_SHADOW_SHOES,
  82. EQI_SHADOW_ACC_R,
  83. EQI_SHADOW_ACC_L,
  84. EQI_MAX
  85. };
  86. enum prevent_logout_trigger {
  87. PLT_NONE = 0,
  88. PLT_LOGIN = 1,
  89. PLT_ATTACK = 2,
  90. PLT_SKILL = 4,
  91. PLT_DAMAGE = 8
  92. };
  93. enum e_chkitem_result : uint8 {
  94. CHKADDITEM_EXIST,
  95. CHKADDITEM_NEW,
  96. CHKADDITEM_OVERAMOUNT
  97. };
  98. enum e_additem_result : uint8 {
  99. ADDITEM_SUCCESS,
  100. ADDITEM_INVALID,
  101. ADDITEM_OVERWEIGHT,
  102. ADDITEM_ITEM,
  103. ADDITEM_OVERITEM,
  104. ADDITEM_OVERAMOUNT,
  105. ADDITEM_REFUSED_TIME,
  106. ADDITEM_STACKLIMIT
  107. };
  108. struct skill_cooldown_entry {
  109. unsigned short skill_id;
  110. int timer;
  111. };
  112. #ifdef VIP_ENABLE
  113. struct vip_info {
  114. unsigned int enabled : 1;
  115. time_t time;
  116. bool disableshowrate; //State to disable clif_display_pinfo(). [Cydh]
  117. };
  118. #endif
  119. enum npc_timeout_type {
  120. NPCT_INPUT = 0,
  121. NPCT_MENU = 1,
  122. NPCT_WAIT = 2,
  123. };
  124. extern unsigned int equip_bitmask[EQI_MAX];
  125. #define equip_index_check(i) ( (i) >= EQI_ACC_L && (i) < EQI_MAX )
  126. /// Miscellaneous item bonus struct
  127. struct s_item_bonus {
  128. uint16 id;
  129. int val;
  130. };
  131. /// AddEle bonus struct
  132. struct s_addele2 {
  133. short flag, rate;
  134. unsigned char ele;
  135. };
  136. /// AddRace bonus struct
  137. struct s_addrace2 {
  138. short flag, rate;
  139. unsigned char race;
  140. };
  141. struct weapon_data {
  142. int atkmods[SZ_ALL];
  143. // all the variables except atkmods get zero'ed in each call of status_calc_pc
  144. // NOTE: if you want to add a non-zeroed variable, you need to update the memset call
  145. // in status_calc_pc as well! All the following are automatically zero'ed. [Skotlex]
  146. int overrefine;
  147. int star;
  148. int ignore_def_ele;
  149. int ignore_def_race;
  150. int ignore_def_class;
  151. int def_ratio_atk_ele;
  152. int def_ratio_atk_race;
  153. int def_ratio_atk_class;
  154. int addele[ELE_MAX];
  155. int addrace[RC_MAX];
  156. int addclass[CLASS_MAX];
  157. int addrace2[RC2_MAX];
  158. int addsize[SZ_MAX];
  159. short hp_drain_race[RC_MAX];
  160. short sp_drain_race[RC_MAX];
  161. short hp_drain_class[CLASS_MAX];
  162. short sp_drain_class[CLASS_MAX];
  163. struct drain_data {
  164. short rate; ///< Success rate 10000 = 100%
  165. short per; ///< Drain value/rate per attack
  166. } hp_drain_rate, sp_drain_rate;
  167. std::vector<s_item_bonus> add_dmg;
  168. std::vector<s_addele2> addele2;
  169. std::vector<s_addrace2> addrace3;
  170. };
  171. /// AutoSpell bonus struct
  172. struct s_autospell {
  173. uint16 id, lv, trigger_skill;
  174. short rate, battle_flag;
  175. t_itemid card_id;
  176. uint8 flag;
  177. bool lock; // bAutoSpellOnSkill: blocks autospell from triggering again, while being executed
  178. };
  179. /// AddEff and AddEff2 bonus struct
  180. struct s_addeffect {
  181. enum sc_type sc; /// SC type/effect
  182. short rate, /// Rate
  183. arrow_rate; /// Arrow rate
  184. unsigned char flag; /// Flag
  185. unsigned int duration; /// Duration the effect applied
  186. };
  187. /// AddEffOnSkill bonus struct
  188. struct s_addeffectonskill {
  189. enum sc_type sc; /// SC type/effect
  190. short rate, /// Rate
  191. skill_id; /// Skill ID
  192. unsigned char target; /// Target
  193. unsigned int duration; /// Duration the effect applied
  194. };
  195. ///Struct of add drop item/group rate
  196. struct s_add_drop {
  197. t_itemid nameid; ///Item ID
  198. unsigned short group; ///Group ID
  199. int rate; ///Rate, 1 ~ 10000, -1 ~ -100000
  200. short race; ///Target Race, bitwise value of 1<<x. if < 0 means Monster ID
  201. unsigned short class_; ///Target Class, bitwise value of 1<<x
  202. };
  203. struct s_vanish_bonus {
  204. int16 rate; // 1000 = 100%
  205. int16 per; // 100 = 100%
  206. int flag;
  207. };
  208. /// AutoBonus bonus struct
  209. struct s_autobonus {
  210. short rate;
  211. uint16 atk_type;
  212. unsigned int duration;
  213. char *bonus_script, *other_script;
  214. int active;
  215. unsigned int pos;
  216. ~s_autobonus();
  217. };
  218. /// Timed bonus 'bonus_script' struct [Cydh]
  219. struct s_bonus_script_entry {
  220. struct script_code *script;
  221. StringBuf *script_buf; //Used for comparing and storing on table
  222. t_tick tick;
  223. uint16 flag;
  224. enum efst_types icon;
  225. uint8 type; //0 - Ignore; 1 - Buff; 2 - Debuff
  226. int tid;
  227. };
  228. /// HP/SP bonus struct
  229. struct s_regen {
  230. short value;
  231. int rate;
  232. int tick;
  233. };
  234. /// Item combo struct
  235. struct s_combos {
  236. script_code *bonus;
  237. uint32 id;
  238. uint32 pos;
  239. };
  240. struct s_qi_display {
  241. bool is_active;
  242. e_questinfo_types icon;
  243. e_questinfo_markcolor color;
  244. };
  245. struct map_session_data {
  246. struct block_list bl;
  247. struct unit_data ud;
  248. struct view_data vd;
  249. struct status_data base_status, battle_status;
  250. struct status_change sc;
  251. struct regen_data regen;
  252. struct regen_data_sub sregen, ssregen;
  253. //NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in
  254. //status_calc_pc, while special_state is recalculated in each call. [Skotlex]
  255. struct s_state {
  256. unsigned int active : 1; //Marks active player (not active is logging in/out, or changing map servers)
  257. unsigned int menu_or_input : 1;// if a script is waiting for feedback from the player
  258. unsigned int dead_sit : 2;
  259. unsigned int lr_flag : 3;//1: left h. weapon; 2: arrow; 3: shield
  260. unsigned int connect_new : 1;
  261. unsigned int arrow_atk : 1;
  262. unsigned int gangsterparadise : 1;
  263. unsigned int rest : 1;
  264. unsigned int storage_flag : 3; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex], 3: Premium Storage
  265. unsigned int snovice_dead_flag : 1; //Explosion spirits on death: 0 off, 1 used.
  266. unsigned int abra_flag : 2; // Abracadabra bugfix by Aru
  267. unsigned int autocast : 1; // Autospell flag [Inkfish]
  268. unsigned int autotrade : 3; //By Fantik. &2 Requested by vending autotrade; &4 Requested by buyingstore autotrade
  269. unsigned int showdelay :1;
  270. unsigned int showexp :1;
  271. unsigned int showzeny :1;
  272. unsigned int noask :1; // [LuzZza]
  273. unsigned int trading :1; //[Skotlex] is 1 only after a trade has started.
  274. unsigned int deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE
  275. unsigned int size :2; // for tiny/large types
  276. unsigned int night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex]
  277. unsigned int using_fake_npc :1;
  278. unsigned int rewarp :1; //Signals that a player should warp as soon as he is done loading a map. [Skotlex]
  279. unsigned int killer : 1;
  280. unsigned int killable : 1;
  281. unsigned int doridori : 1;
  282. unsigned int ignoreAll : 1;
  283. unsigned int debug_remove_map : 1; // temporary state to track double remove_map's [FlavioJS]
  284. unsigned int buyingstore : 1;
  285. unsigned int lesseffect : 1;
  286. unsigned int vending : 1;
  287. unsigned int noks : 3; // [Zeph Kill Steal Protection]
  288. unsigned int changemap : 1;
  289. unsigned int callshop : 1; // flag to indicate that a script used callshop; on a shop
  290. short pmap; // Previous map on Map Change
  291. unsigned short autoloot;
  292. t_itemid autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus]
  293. unsigned short autoloottype;
  294. unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid
  295. unsigned int gmaster_flag : 1;
  296. unsigned int prevend : 1;//used to flag wheather you've spent 40sp to open the vending or not.
  297. unsigned int warping : 1;//states whether you're in the middle of a warp processing
  298. unsigned int permanent_speed : 1; // When 1, speed cannot be changed through status_calc_pc().
  299. bool hold_recalc;
  300. unsigned int banking : 1; //1 when we using the banking system 0 when closed
  301. unsigned int hpmeter_visible : 1;
  302. unsigned disable_atcommand_on_npc : 1; //Prevent to use atcommand while talking with NPC [Kichi]
  303. uint8 isBoundTrading; // Player is currently add bound item to trade list [Cydh]
  304. bool ignoretimeout; // Prevent the SECURE_NPCTIMEOUT function from closing current script.
  305. unsigned int workinprogress : 2; // See clif.hpp::e_workinprogress
  306. bool pc_loaded; // Ensure inventory data and status data is loaded before we calculate player stats
  307. bool keepshop; // Whether shop data should be removed when the player disconnects
  308. bool mail_writing; // Whether the player is currently writing a mail in RODEX or not
  309. bool cashshop_open;
  310. bool sale_open;
  311. unsigned int block_action : 10;
  312. bool refineui_open;
  313. } state;
  314. struct {
  315. unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
  316. unsigned int restart_full_recover : 1;
  317. unsigned int no_castcancel : 1;
  318. unsigned int no_castcancel2 : 1;
  319. unsigned int no_sizefix : 1;
  320. unsigned int no_gemstone : 2;
  321. unsigned int intravision : 1; // Maya Purple Card effect [DracoRPG]
  322. unsigned int perfect_hiding : 1; // [Valaris]
  323. unsigned int no_knockback : 1;
  324. unsigned int bonus_coma : 1;
  325. unsigned int no_mado_fuel : 1; // Disable Magic_Gear_Fuel consumption [Secret]
  326. unsigned int no_walk_delay : 1;
  327. } special_state;
  328. uint32 login_id1, login_id2;
  329. unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex]
  330. int group_id, group_pos, group_level;
  331. unsigned int permissions;/* group permissions */
  332. int count_rewarp; //count how many time we being rewarped
  333. int langtype;
  334. struct mmo_charstatus status;
  335. // Item Storages
  336. struct s_storage storage, premiumStorage;
  337. struct s_storage inventory;
  338. struct s_storage cart;
  339. struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups)
  340. short equip_index[EQI_MAX];
  341. short equip_switch_index[EQI_MAX];
  342. unsigned int weight,max_weight,add_max_weight;
  343. int cart_weight,cart_num,cart_weight_max;
  344. int fd;
  345. unsigned short mapindex;
  346. unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left.
  347. t_tick client_tick;
  348. int npc_id,npc_shopid; //for script follow scriptoid; ,npcid
  349. std::vector<int> areanpc, npc_ontouch_; ///< Array of OnTouch and OnTouch_ NPC ID
  350. int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse)
  351. int npc_menu; // internal variable, used in npc menu handling
  352. int npc_amount;
  353. struct script_state *st;
  354. char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine
  355. int npc_timer_id; //For player attached npc timers. [Skotlex]
  356. unsigned int chatID;
  357. time_t idletime;
  358. time_t idletime_hom;
  359. time_t idletime_mer;
  360. struct s_progressbar {
  361. int npc_id;
  362. t_tick timeout;
  363. } progressbar; //Progress Bar [Inkfish]
  364. struct s_ignore {
  365. char name[NAME_LENGTH];
  366. } ignore[MAX_IGNORE_LIST];
  367. int followtimer; // [MouseJstr]
  368. int followtarget;
  369. time_t emotionlasttime; // to limit flood with emotion packets
  370. short skillitem,skillitemlv;
  371. bool skillitem_keep_requirement;
  372. uint16 skill_id_old,skill_lv_old;
  373. uint16 skill_id_dance,skill_lv_dance;
  374. short cook_mastery; // range: [0,1999] [Inkfish]
  375. struct skill_cooldown_entry * scd[MAX_SKILLCOOLDOWN]; // Skill Cooldown
  376. uint16 cloneskill_idx, ///Stores index of copied skill by Intimidate/Plagiarism
  377. reproduceskill_idx; ///Stores index of copied skill by Reproduce
  378. int menuskill_id, menuskill_val, menuskill_val2;
  379. int invincible_timer;
  380. t_tick canlog_tick;
  381. t_tick canuseitem_tick; // [Skotlex]
  382. t_tick canusecashfood_tick;
  383. t_tick canequip_tick; // [Inkfish]
  384. t_tick cantalk_tick;
  385. t_tick canskill_tick; // used to prevent abuse from no-delay ACT files
  386. t_tick cansendmail_tick; // [Mail System Flood Protection]
  387. t_tick ks_floodprotect_tick; // [Kill Steal Protection]
  388. t_tick equipswitch_tick; // Equip switch
  389. struct s_item_delay {
  390. t_itemid nameid;
  391. t_tick tick;
  392. } item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
  393. short weapontype1,weapontype2;
  394. short disguise; // [Valaris]
  395. struct weapon_data right_weapon, left_weapon;
  396. // here start arrays to be globally zeroed at the beginning of status_calc_pc()
  397. struct s_indexed_bonus {
  398. int param_bonus[6], param_equip[6]; //Stores card/equipment bonuses.
  399. int subele[ELE_MAX];
  400. int subele_script[ELE_MAX];
  401. int subdefele[ELE_MAX];
  402. int subrace[RC_MAX];
  403. int subclass[CLASS_MAX];
  404. int subrace2[RC2_MAX];
  405. int subsize[SZ_MAX];
  406. short coma_class[CLASS_MAX];
  407. short coma_race[RC_MAX];
  408. short weapon_coma_ele[ELE_MAX];
  409. short weapon_coma_race[RC_MAX];
  410. short weapon_coma_class[CLASS_MAX];
  411. int weapon_atk[16];
  412. int weapon_damage_rate[16];
  413. int arrow_addele[ELE_MAX];
  414. int arrow_addrace[RC_MAX];
  415. int arrow_addclass[CLASS_MAX];
  416. int arrow_addsize[SZ_MAX];
  417. int magic_addele[ELE_MAX];
  418. int magic_addele_script[ELE_MAX];
  419. int magic_addrace[RC_MAX];
  420. int magic_addclass[CLASS_MAX];
  421. int magic_addsize[SZ_MAX];
  422. int magic_atk_ele[ELE_MAX];
  423. int magic_subsize[SZ_MAX];
  424. int critaddrace[RC_MAX];
  425. int expaddrace[RC_MAX];
  426. int expaddclass[CLASS_MAX];
  427. int ignore_mdef_by_race[RC_MAX];
  428. int ignore_mdef_by_class[CLASS_MAX];
  429. int ignore_def_by_race[RC_MAX];
  430. int ignore_def_by_class[CLASS_MAX];
  431. short sp_gain_race[RC_MAX];
  432. int magic_addrace2[RC2_MAX];
  433. int ignore_mdef_by_race2[RC2_MAX];
  434. int dropaddrace[RC_MAX];
  435. int dropaddclass[CLASS_MAX];
  436. int magic_subdefele[ELE_MAX];
  437. } indexed_bonus;
  438. // zeroed arrays end here.
  439. std::vector<s_autospell> autospell, autospell2, autospell3;
  440. std::vector<s_addeffect> addeff, addeff_atked;
  441. std::vector<s_addeffectonskill> addeff_onskill;
  442. std::vector<s_item_bonus> skillatk, skillusesprate, skillusesp, skillheal, skillheal2, skillblown, skillcastrate, skillfixcastrate, subskill, skillcooldown, skillfixcast,
  443. skillvarcast, skilldelay, itemhealrate, add_def, add_mdef, add_mdmg, reseff, itemgrouphealrate, itemsphealrate, itemgroupsphealrate;
  444. std::vector<s_add_drop> add_drop;
  445. std::vector<s_addele2> subele2;
  446. std::vector<s_vanish_bonus> sp_vanish, hp_vanish;
  447. std::vector<s_addrace2> subrace3;
  448. std::vector<std::shared_ptr<s_autobonus>> autobonus, autobonus2, autobonus3; //Auto script on attack, when attacked, on skill usage
  449. // zeroed structures start here
  450. struct s_regen {
  451. short value;
  452. int rate;
  453. t_tick tick;
  454. } hp_loss, sp_loss, hp_regen, sp_regen, percent_hp_regen, percent_sp_regen;
  455. struct {
  456. short value;
  457. int rate, tick;
  458. } def_set_race[RC_MAX], mdef_set_race[RC_MAX], norecover_state_race[RC_MAX];
  459. struct s_bonus_vanish_gain {
  460. short rate, ///< Success rate 0 - 1000 (100%)
  461. per; ///< % HP/SP vanished/gained
  462. } hp_vanish_race[RC_MAX], sp_vanish_race[RC_MAX];
  463. // zeroed structures end here
  464. // zeroed vars start here.
  465. struct s_bonus {
  466. int hp, sp;
  467. int atk_rate;
  468. int arrow_atk,arrow_ele,arrow_cri,arrow_hit;
  469. int nsshealhp,nsshealsp;
  470. int critical_def,double_rate;
  471. int short_attack_atk_rate; // Short range atk rate, not weapon based.
  472. int long_attack_atk_rate; //Long range atk rate, not weapon based. [Skotlex]
  473. int near_attack_def_rate,long_attack_def_rate,magic_def_rate,misc_def_rate;
  474. int ignore_mdef_ele;
  475. int ignore_mdef_race;
  476. int ignore_mdef_class;
  477. int perfect_hit;
  478. int perfect_hit_add;
  479. int get_zeny_rate;
  480. int get_zeny_num; //Added Get Zeny Rate [Skotlex]
  481. int double_add_rate;
  482. int short_weapon_damage_return,long_weapon_damage_return,reduce_damage_return;
  483. int magic_damage_return; // AppleGirl Was Here
  484. int break_weapon_rate,break_armor_rate;
  485. int crit_atk_rate;
  486. int crit_def_rate;
  487. int classchange; // [Valaris]
  488. int speed_rate, speed_add_rate, aspd_add;
  489. int itemhealrate2; // [Epoque] Increase heal rate of all healing items.
  490. int itemsphealrate2;
  491. int shieldmdef;//royal guard's
  492. unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex]
  493. short splash_range, splash_add_range;
  494. short add_steal_rate;
  495. int add_heal_rate, add_heal2_rate;
  496. int sp_gain_value, hp_gain_value, magic_sp_gain_value, magic_hp_gain_value, long_sp_gain_value, long_hp_gain_value;
  497. unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest]
  498. unsigned short unbreakable_equip; //100% break resistance on certain equipment
  499. unsigned short unstripable_equip;
  500. int fixcastrate, varcastrate, delayrate; // n/100
  501. int add_fixcast, add_varcast; // in milliseconds
  502. int ematk; // matk bonus from equipment
  503. int eatk; // atk bonus from equipment
  504. uint8 absorb_dmg_maxhp; // [Cydh]
  505. short critical_rangeatk;
  506. short weapon_atk_rate, weapon_matk_rate;
  507. } bonus;
  508. // zeroed vars end here.
  509. int castrate,hprate,sprate,dsprate;
  510. int hprecov_rate,sprecov_rate;
  511. int matk_rate;
  512. int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate;
  513. t_itemid itemid;
  514. short itemindex; //Used item's index in sd->inventory [Skotlex]
  515. uint16 catch_target_class; // pet catching, stores a pet class to catch [zzo]
  516. int8 spiritball, spiritball_old;
  517. int spirit_timer[MAX_SPIRITBALL];
  518. short spiritcharm; //No. of spirit
  519. int spiritcharm_type; //Spirit type
  520. int spiritcharm_timer[MAX_SPIRITCHARM];
  521. int8 soulball, soulball_old;
  522. unsigned char potion_success_counter; //Potion successes in row counter
  523. unsigned char mission_count; //Stores the bounty kill count for TK_MISSION
  524. short mission_mobid; //Stores the target mob_id for TK_MISSION
  525. int die_counter; //Total number of times you've died
  526. int devotion[MAX_DEVOTION]; //Stores the account IDs of chars devoted to.
  527. int stellar_mark[MAX_STELLAR_MARKS]; // Stores the account ID's of character's with a stellar mark.
  528. int united_soul[MAX_UNITED_SOULS]; // Stores the account ID's of character's who's soul is united.
  529. int trade_partner;
  530. struct s_deal {
  531. struct s_item {
  532. short index, amount;
  533. } item[10];
  534. int zeny, weight;
  535. } deal;
  536. bool party_creating; // whether the char is requesting party creation
  537. bool party_joining; // whether the char is accepting party invitation
  538. int party_invite, party_invite_account; // for handling party invitation (holds party id and account id)
  539. int adopt_invite; // Adoption
  540. struct guild *guild; // [Ind] speed everything up
  541. int guild_invite,guild_invite_account;
  542. int guild_emblem_id,guild_alliance,guild_alliance_account;
  543. short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo]
  544. int guildspy; // [Syrus22]
  545. int partyspy; // [Syrus22]
  546. int clanspy;
  547. struct clan *clan;
  548. int vended_id;
  549. int vender_id;
  550. int vend_num;
  551. uint16 vend_skill_lv;
  552. char message[MESSAGE_SIZE];
  553. struct s_vending vending[MAX_VENDING];
  554. unsigned int buyer_id; // uid of open buying store
  555. struct s_buyingstore buyingstore;
  556. struct s_search_store_info searchstore;
  557. struct pet_data *pd;
  558. struct homun_data *hd; // [blackhole89]
  559. struct mercenary_data *md;
  560. struct elemental_data *ed;
  561. struct s_hate_mob {
  562. int m; //-1 - none, other: map index corresponding to map name.
  563. unsigned short index; //map index
  564. } feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars
  565. short hate_mob[3];
  566. int pvp_timer;
  567. short pvp_point;
  568. unsigned short pvp_rank, pvp_lastusers;
  569. unsigned short pvp_won, pvp_lost;
  570. char eventqueue[MAX_EVENTQUEUE][EVENT_NAME_LENGTH];
  571. int eventtimer[MAX_EVENTTIMER];
  572. unsigned short eventcount; // [celest]
  573. unsigned char change_level_2nd; // job level when changing from 1st to 2nd class [jobchange_level in global_reg_value]
  574. unsigned char change_level_3rd; // job level when changing from 2nd to 3rd class [jobchange_level_3rd in global_reg_value]
  575. char fakename[NAME_LENGTH]; // fake names [Valaris]
  576. size_t duel_group; // duel vars [LuzZza]
  577. size_t duel_invite;
  578. int killerrid, killedrid, killedgid;
  579. int cashPoints, kafraPoints;
  580. int rental_timer;
  581. // Auction System [Zephyrus]
  582. struct s_auction{
  583. int index, amount;
  584. } auction;
  585. // Mail System [Zephyrus]
  586. struct s_mail {
  587. struct {
  588. t_itemid nameid;
  589. int index, amount;
  590. } item[MAIL_MAX_ITEM];
  591. int zeny;
  592. struct mail_data inbox;
  593. bool changed; // if true, should sync with charserver on next mailbox request
  594. uint32 pending_weight;
  595. uint32 pending_zeny;
  596. uint16 pending_slots;
  597. } mail;
  598. //Quest log system
  599. int num_quests; ///< Number of entries in quest_log
  600. int avail_quests; ///< Number of Q_ACTIVE and Q_INACTIVE entries in quest log (index of the first Q_COMPLETE entry)
  601. struct quest *quest_log; ///< Quest log entries (note: Q_COMPLETE quests follow the first <avail_quests>th enties
  602. bool save_quest; ///< Whether the quest_log entries were modified and are waitin to be saved
  603. // Achievement log system
  604. struct s_achievement_data {
  605. int total_score; ///< Total achievement points
  606. int level; ///< Achievement level
  607. bool save; ///< Flag to know if achievements need to be saved
  608. uint16 count; ///< Total achievements in log
  609. uint16 incompleteCount; ///< Total incomplete achievements in log
  610. struct achievement *achievements; ///< Achievement log entries
  611. } achievement_data;
  612. // Title system
  613. std::vector<int> titles;
  614. std::vector<int> cloaked_npc;
  615. /* ShowEvent Data Cache flags from map */
  616. std::vector<s_qi_display> qi_display;
  617. // temporary debug [flaviojs]
  618. const char* debug_file;
  619. int debug_line;
  620. const char* debug_func;
  621. // Battlegrounds queue system [MasterOfMuppets]
  622. int bg_id, bg_queue_id;
  623. int tid_queue_active; ///< Timer ID associated with players joining an active BG
  624. #ifdef SECURE_NPCTIMEOUT
  625. /**
  626. * ID of the timer
  627. * @info
  628. * - value is -1 (INVALID_TIMER constant) when not being used
  629. * - timer is cancelled upon closure of the current npc's instance
  630. **/
  631. int npc_idle_timer;
  632. /**
  633. * Tick on the last recorded NPC iteration (next/menu/whatever)
  634. * @info
  635. * - It is updated on every NPC iteration as mentioned above
  636. **/
  637. t_tick npc_idle_tick;
  638. /* */
  639. enum npc_timeout_type npc_idle_type;
  640. #endif
  641. std::vector<std::shared_ptr<s_combos>> combos;
  642. /**
  643. * Guarantees your friend request is legit (for bugreport:4629)
  644. **/
  645. int friend_req;
  646. int shadowform_id;
  647. /* Channel System [Ind] */
  648. struct Channel **channels;
  649. unsigned char channel_count;
  650. struct Channel *gcbind;
  651. bool stealth;
  652. unsigned char fontcolor;
  653. t_tick *channel_tick;
  654. /* [Ind] */
  655. struct sc_display_entry **sc_display;
  656. unsigned char sc_display_count;
  657. unsigned char delayed_damage; //[Ind]
  658. /**
  659. * Account/Char variables & array control of those variables
  660. **/
  661. struct reg_db regs;
  662. unsigned char vars_received; // char loading is only complete when you get it all.
  663. bool vars_ok;
  664. bool vars_dirty;
  665. uint16 dmglog[DAMAGELOG_SIZE_PC]; ///target ids
  666. int c_marker[MAX_SKILL_CRIMSON_MARKER]; /// Store target that marked by Crimson Marker [Cydh]
  667. bool flicker; /// Check RL_FLICKER usage status [Cydh]
  668. #ifdef VIP_ENABLE
  669. struct vip_info vip;
  670. #endif
  671. /// Bonus Script [Cydh]
  672. struct s_bonus_script_list {
  673. struct linkdb_node *head; ///< Bonus script head node. data: struct s_bonus_script_entry *entry, key: (intptr_t)entry
  674. uint16 count;
  675. } bonus_script;
  676. /* Expiration Timer ID */
  677. int expiration_tid;
  678. time_t expiration_time;
  679. short last_addeditem_index; /// Index of latest item added
  680. int autotrade_tid;
  681. int respawn_tid;
  682. int bank_vault; ///< Bank Vault
  683. #ifdef PACKET_OBFUSCATION
  684. unsigned int cryptKey; ///< Packet obfuscation key to be used for the next received packet
  685. #endif
  686. struct {
  687. int bronze, silver, gold; ///< Roulette Coin
  688. } roulette_point;
  689. struct {
  690. short stage;
  691. int8 prizeIdx;
  692. short prizeStage;
  693. bool claimPrize;
  694. t_tick tick;
  695. } roulette;
  696. int instance_id;
  697. e_instance_mode instance_mode; ///< Mode of instance player last leaves from (used for instance destruction button)
  698. short setlook_head_top, setlook_head_mid, setlook_head_bottom, setlook_robe; ///< Stores 'setlook' script command values.
  699. #if PACKETVER_MAIN_NUM >= 20150507 || PACKETVER_RE_NUM >= 20150429 || defined(PACKETVER_ZERO)
  700. std::vector<int16> hatEffects;
  701. #endif
  702. struct{
  703. int tid;
  704. uint16 skill_id;
  705. uint16 level;
  706. int target;
  707. } skill_keep_using;
  708. };
  709. extern struct eri *pc_sc_display_ers; /// Player's SC display table
  710. /**
  711. * ERS for the bulk of pc vars
  712. **/
  713. extern struct eri *num_reg_ers;
  714. extern struct eri *str_reg_ers;
  715. /* Global Expiration Timer ID */
  716. extern int pc_expiration_tid;
  717. enum weapon_type : uint8 {
  718. W_FIST, //Bare hands
  719. W_DAGGER, //1
  720. W_1HSWORD, //2
  721. W_2HSWORD, //3
  722. W_1HSPEAR, //4
  723. W_2HSPEAR, //5
  724. W_1HAXE, //6
  725. W_2HAXE, //7
  726. W_MACE, //8
  727. W_2HMACE, //9 (unused)
  728. W_STAFF, //10
  729. W_BOW, //11
  730. W_KNUCKLE, //12
  731. W_MUSICAL, //13
  732. W_WHIP, //14
  733. W_BOOK, //15
  734. W_KATAR, //16
  735. W_REVOLVER, //17
  736. W_RIFLE, //18
  737. W_GATLING, //19
  738. W_SHOTGUN, //20
  739. W_GRENADE, //21
  740. W_HUUMA, //22
  741. W_2HSTAFF, //23
  742. MAX_WEAPON_TYPE,
  743. // dual-wield constants
  744. W_DOUBLE_DD, // 2 daggers
  745. W_DOUBLE_SS, // 2 swords
  746. W_DOUBLE_AA, // 2 axes
  747. W_DOUBLE_DS, // dagger + sword
  748. W_DOUBLE_DA, // dagger + axe
  749. W_DOUBLE_SA, // sword + axe
  750. MAX_WEAPON_TYPE_ALL,
  751. };
  752. #define WEAPON_TYPE_ALL ((1<<MAX_WEAPON_TYPE)-1)
  753. enum e_ammo_type : uint8 {
  754. AMMO_NONE = 0,
  755. AMMO_ARROW,
  756. AMMO_DAGGER,
  757. AMMO_BULLET,
  758. AMMO_SHELL,
  759. AMMO_GRENADE,
  760. AMMO_SHURIKEN,
  761. AMMO_KUNAI,
  762. AMMO_CANNONBALL,
  763. AMMO_THROWWEAPON,
  764. MAX_AMMO_TYPE
  765. };
  766. enum idletime_option {
  767. IDLE_WALK = 0x0001,
  768. IDLE_USESKILLTOID = 0x0002,
  769. IDLE_USESKILLTOPOS = 0x0004,
  770. IDLE_USEITEM = 0x0008,
  771. IDLE_ATTACK = 0x0010,
  772. IDLE_CHAT = 0x0020,
  773. IDLE_SIT = 0x0040,
  774. IDLE_EMOTION = 0x0080,
  775. IDLE_DROPITEM = 0x0100,
  776. IDLE_ATCOMMAND = 0x0200,
  777. IDLE_NPC_CLOSE = 0x0400,
  778. IDLE_NPC_INPUT = 0x0800,
  779. IDLE_NPC_MENU = 0x1000,
  780. IDLE_NPC_NEXT = 0x2000,
  781. IDLE_NPC_PROGRESS = 0x4000,
  782. };
  783. enum adopt_responses {
  784. ADOPT_ALLOWED = 0,
  785. ADOPT_ALREADY_ADOPTED,
  786. ADOPT_MARRIED_AND_PARTY,
  787. ADOPT_EQUIP_RINGS,
  788. ADOPT_NOT_NOVICE,
  789. ADOPT_CHARACTER_NOT_FOUND,
  790. ADOPT_MORE_CHILDREN,
  791. ADOPT_LEVEL_70,
  792. ADOPT_MARRIED,
  793. };
  794. enum item_check {
  795. ITMCHK_NONE = 0x0,
  796. ITMCHK_INVENTORY = 0x1,
  797. ITMCHK_CART = 0x2,
  798. ITMCHK_STORAGE = 0x4,
  799. ITMCHK_ALL = ITMCHK_INVENTORY|ITMCHK_CART|ITMCHK_STORAGE,
  800. };
  801. enum e_penalty_type : uint16{
  802. PENALTY_NONE,
  803. PENALTY_EXP,
  804. PENALTY_DROP,
  805. PENALTY_MVP_EXP,
  806. PENALTY_MVP_DROP,
  807. PENALTY_MAX
  808. };
  809. struct s_penalty{
  810. e_penalty_type type;
  811. uint16 rate[MAX_LEVEL * 2 - 1];
  812. };
  813. class PenaltyDatabase : public TypesafeYamlDatabase<uint16, s_penalty> {
  814. public:
  815. PenaltyDatabase() : TypesafeYamlDatabase( "PENALTY_DB", 1 ){
  816. }
  817. const std::string getDefaultLocation();
  818. uint64 parseBodyNode(const YAML::Node& node);
  819. void loadingFinished();
  820. };
  821. struct s_job_info {
  822. unsigned int base_hp[MAX_LEVEL], base_sp[MAX_LEVEL]; //Storage for the first calculation with hp/sp factor and multiplicator
  823. int hp_factor, hp_multiplicator, sp_factor;
  824. int max_weight_base;
  825. char job_bonus[MAX_LEVEL];
  826. #ifdef RENEWAL_ASPD
  827. int aspd_base[MAX_WEAPON_TYPE+1];
  828. #else
  829. int aspd_base[MAX_WEAPON_TYPE]; //[blackhole89]
  830. #endif
  831. t_exp exp_table[2][MAX_LEVEL];
  832. uint32 max_level[2];
  833. struct s_params {
  834. uint16 str, agi, vit, int_, dex, luk;
  835. } max_param;
  836. struct s_job_noenter_map {
  837. uint32 zone;
  838. uint8 group_lv;
  839. } noenter_map;
  840. };
  841. extern struct s_job_info job_info[CLASS_COUNT];
  842. #define EQP_WEAPON EQP_HAND_R
  843. #define EQP_SHIELD EQP_HAND_L
  844. #define EQP_ARMS (EQP_HAND_R|EQP_HAND_L)
  845. #define EQP_HELM (EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)
  846. #define EQP_ACC (EQP_ACC_L|EQP_ACC_R)
  847. #define EQP_COSTUME (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)
  848. #define EQP_COSTUME_HELM (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW)
  849. #define EQP_SHADOW_GEAR (EQP_SHADOW_ARMOR|EQP_SHADOW_WEAPON|EQP_SHADOW_SHIELD|EQP_SHADOW_SHOES|EQP_SHADOW_ACC_R|EQP_SHADOW_ACC_L)
  850. #define EQP_SHADOW_ACC (EQP_SHADOW_ACC_R|EQP_SHADOW_ACC_L)
  851. #define EQP_SHADOW_ARMS (EQP_SHADOW_WEAPON|EQP_SHADOW_SHIELD)
  852. /// Equip positions that use a visible sprite
  853. #if PACKETVER < 20110111
  854. #define EQP_VISIBLE EQP_HELM
  855. #else
  856. #define EQP_VISIBLE (EQP_HELM|EQP_GARMENT|EQP_COSTUME)
  857. #endif
  858. #define pc_setdead(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 )
  859. #define pc_setsit(sd) { pc_stop_walking((sd), 1|4); pc_stop_attack((sd)); (sd)->state.dead_sit = (sd)->vd.dead_sit = 2; }
  860. #define pc_isdead(sd) ( (sd)->state.dead_sit == 1 )
  861. #define pc_issit(sd) ( (sd)->vd.dead_sit == 2 )
  862. #define pc_isidle_party(sd) ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(last_tick, (sd)->idletime) >= battle_config.idle_no_share )
  863. #define pc_isidle_hom(sd) ( (sd)->hd && ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(last_tick, (sd)->idletime_hom) >= battle_config.hom_idle_no_share ) )
  864. #define pc_isidle_mer(sd) ( (sd)->md && ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(last_tick, (sd)->idletime_mer) >= battle_config.mer_idle_no_share ) )
  865. #define pc_istrading(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )
  866. // equals pc_cant_act2 and additionally checks for chat rooms and npcs
  867. #define pc_cant_act(sd) ( (sd)->npc_id || (sd)->chatID || pc_cant_act2( (sd) ) )
  868. #define pc_cant_act2(sd) ( (sd)->state.vending || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend || (sd)->state.refineui_open )
  869. #define pc_setdir(sd,b,h) ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) )
  870. #define pc_setchatid(sd,n) ( (sd)->chatID = n )
  871. #define pc_ishiding(sd) ( (sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) )
  872. #define pc_iscloaking(sd) ( !((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK) )
  873. #define pc_ischasewalk(sd) ( (sd)->sc.option&OPTION_CHASEWALK )
  874. #ifdef VIP_ENABLE
  875. #define pc_isvip(sd) ( sd->vip.enabled ? true : false )
  876. #else
  877. #define pc_isvip(sd) ( false )
  878. #endif
  879. #ifdef NEW_CARTS
  880. #define pc_iscarton(sd) ( (sd)->sc.data[SC_PUSH_CART] )
  881. #else
  882. #define pc_iscarton(sd) ( (sd)->sc.option&OPTION_CART )
  883. #endif
  884. #define pc_isfalcon(sd) ( (sd)->sc.option&OPTION_FALCON )
  885. #define pc_isriding(sd) ( (sd)->sc.option&OPTION_RIDING )
  886. #define pc_isinvisible(sd) ( (sd)->sc.option&OPTION_INVISIBLE )
  887. #define pc_is50overweight(sd) ( (sd)->weight * 100 >= (sd)->max_weight * battle_config.natural_heal_weight_rate )
  888. #define pc_is70overweight(sd) ( (sd)->weight * 100 >= (sd)->max_weight * battle_config.natural_heal_weight_rate_renewal )
  889. #define pc_is90overweight(sd) ( (sd)->weight * 10 >= (sd)->max_weight * 9 )
  890. static inline bool pc_hasprogress(struct map_session_data *sd, enum e_wip_block progress) {
  891. return sd == NULL || (sd->state.workinprogress&progress) == progress;
  892. }
  893. /// Enum of Player's Parameter
  894. enum e_params {
  895. PARAM_STR = 0,
  896. PARAM_AGI,
  897. PARAM_VIT,
  898. PARAM_INT,
  899. PARAM_DEX,
  900. PARAM_LUK,
  901. PARAM_MAX
  902. };
  903. short pc_maxparameter(struct map_session_data *sd, enum e_params param);
  904. short pc_maxaspd(struct map_session_data *sd);
  905. /**
  906. * Ranger
  907. **/
  908. #define pc_iswug(sd) ( (sd)->sc.option&OPTION_WUG )
  909. #define pc_isridingwug(sd) ( (sd)->sc.option&OPTION_WUGRIDER )
  910. // Mechanic Magic Gear
  911. enum e_mado_type : uint16 {
  912. MADO_ROBOT = 0x00,
  913. MADO_UNUSED,
  914. MADO_SUIT,
  915. MADO_MAX
  916. };
  917. #define pc_ismadogear(sd) ( (sd)->sc.option&OPTION_MADOGEAR )
  918. // Rune Knight Dragon
  919. #define pc_isridingdragon(sd) ( (sd)->sc.option&OPTION_DRAGON )
  920. #define pc_stop_walking(sd, type) unit_stop_walking(&(sd)->bl, type)
  921. #define pc_stop_attack(sd) unit_stop_attack(&(sd)->bl)
  922. //Weapon check considering dual wielding.
  923. #define pc_check_weapontype(sd, type) ((type)&((sd)->status.weapon < MAX_WEAPON_TYPE? \
  924. 1<<(sd)->status.weapon:(1<<(sd)->weapontype1)|(1<<(sd)->weapontype2)|(1<<(sd)->status.weapon)))
  925. //Checks if the given class value corresponds to a player class. [Skotlex]
  926. //JOB_NOVICE isn't checked for class_ is supposed to be unsigned
  927. #define pcdb_checkid_sub(class_) ( \
  928. ( (class_) < JOB_MAX_BASIC ) || \
  929. ( (class_) >= JOB_NOVICE_HIGH && (class_) <= JOB_DARK_COLLECTOR ) || \
  930. ( (class_) >= JOB_RUNE_KNIGHT && (class_) <= JOB_MECHANIC_T2 ) || \
  931. ( (class_) >= JOB_BABY_RUNE_KNIGHT && (class_) <= JOB_BABY_MECHANIC2 ) || \
  932. ( (class_) >= JOB_SUPER_NOVICE_E && (class_) <= JOB_SUPER_BABY_E ) || \
  933. ( (class_) >= JOB_KAGEROU && (class_) <= JOB_OBORO ) || \
  934. (class_) == JOB_REBELLION || (class_) == JOB_SUMMONER || \
  935. (class_) == JOB_BABY_SUMMONER || \
  936. ( (class_) >= JOB_BABY_NINJA && (class_) <= JOB_BABY_REBELLION ) || \
  937. ( (class_) >= JOB_BABY_STAR_GLADIATOR2 && (class_) <= JOB_BABY_STAR_EMPEROR2 ) \
  938. )
  939. #define pcdb_checkid(class_) pcdb_checkid_sub((unsigned int)class_)
  940. // clientside display macros (values to the left/right of the "+")
  941. #ifdef RENEWAL
  942. #define pc_leftside_atk(sd) ((sd)->battle_status.batk)
  943. #define pc_rightside_atk(sd) ((sd)->battle_status.watk + (sd)->battle_status.watk2 + (sd)->battle_status.eatk)
  944. #define pc_leftside_def(sd) ((sd)->battle_status.def2)
  945. #define pc_rightside_def(sd) ((sd)->battle_status.def)
  946. #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef2)
  947. #define pc_rightside_mdef(sd) ((sd)->battle_status.mdef)
  948. #define pc_leftside_matk(sd) (status_base_matk_min(&(sd)->bl, status_get_status_data(&(sd)->bl), (sd)->status.base_level))
  949. #define pc_rightside_matk(sd) ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk)
  950. #else
  951. #define pc_leftside_atk(sd) ((sd)->battle_status.batk + (sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk)
  952. #define pc_rightside_atk(sd) ((sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2)
  953. #define pc_leftside_def(sd) ((sd)->battle_status.def)
  954. #define pc_rightside_def(sd) ((sd)->battle_status.def2)
  955. #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef)
  956. #define pc_rightside_mdef(sd) ( (sd)->battle_status.mdef2 - ((sd)->battle_status.vit>>1) )
  957. #define pc_leftside_matk(sd) \
  958. (\
  959. ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \
  960. ?((sd)->battle_status.matk_min * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \
  961. :(sd)->battle_status.matk_min \
  962. )
  963. #define pc_rightside_matk(sd) \
  964. (\
  965. ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \
  966. ?((sd)->battle_status.matk_max * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \
  967. :(sd)->battle_status.matk_max \
  968. )
  969. #endif
  970. struct s_attendance_reward {
  971. t_itemid item_id;
  972. uint16 amount;
  973. };
  974. struct s_attendance_period {
  975. uint32 start;
  976. uint32 end;
  977. std::map<uint32, std::shared_ptr<struct s_attendance_reward>> rewards;
  978. };
  979. class AttendanceDatabase : public TypesafeYamlDatabase<uint32, s_attendance_period> {
  980. public:
  981. AttendanceDatabase() : TypesafeYamlDatabase("ATTENDANCE_DB", 1) {
  982. }
  983. const std::string getDefaultLocation();
  984. uint64 parseBodyNode(const YAML::Node &node);
  985. };
  986. extern AttendanceDatabase attendance_db;
  987. class PlayerStatPointDatabase : public YamlDatabase {
  988. private:
  989. std::unordered_map<uint16, uint32> statpoint_table;
  990. public:
  991. PlayerStatPointDatabase() : YamlDatabase("STATPOINT_DB", 1) {
  992. }
  993. void clear(){
  994. statpoint_table.clear();
  995. }
  996. const std::string getDefaultLocation();
  997. uint64 parseBodyNode(const YAML::Node& node);
  998. void loadingFinished();
  999. uint32 pc_gets_status_point(uint16 level);
  1000. uint32 get_table_point(uint16 level);
  1001. };
  1002. extern PlayerStatPointDatabase statpoint_db;
  1003. /// Enum of Summoner Power of
  1004. enum e_summoner_power_type {
  1005. SUMMONER_POWER_LAND = 0,
  1006. SUMMONER_POWER_LIFE,
  1007. SUMMONER_POWER_SEA,
  1008. };
  1009. void pc_set_reg_load(bool val);
  1010. int pc_split_atoi(char* str, int* val, char sep, int max);
  1011. int pc_class2idx(int class_);
  1012. int pc_get_group_level(struct map_session_data *sd);
  1013. int pc_get_group_id(struct map_session_data *sd);
  1014. bool pc_can_sell_item(struct map_session_data* sd, struct item * item, enum npc_subtype shoptype);
  1015. bool pc_can_give_items(struct map_session_data *sd);
  1016. bool pc_can_give_bounded_items(struct map_session_data *sd);
  1017. bool pc_can_trade_item(map_session_data *sd, int index);
  1018. bool pc_can_use_command(struct map_session_data *sd, const char *command, AtCommandType type);
  1019. #define pc_has_permission(sd, permission) ( ((sd)->permissions&permission) != 0 )
  1020. bool pc_should_log_commands(struct map_session_data *sd);
  1021. void pc_setrestartvalue(struct map_session_data *sd, char type);
  1022. void pc_makesavestatus(struct map_session_data *sd);
  1023. void pc_respawn(struct map_session_data* sd, clr_type clrtype);
  1024. void pc_setnewpc(struct map_session_data *sd, uint32 account_id, uint32 char_id, int login_id1, t_tick client_tick, int sex, int fd);
  1025. bool pc_authok(struct map_session_data *sd, uint32 login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers);
  1026. void pc_authfail(struct map_session_data *sd);
  1027. void pc_reg_received(struct map_session_data *sd);
  1028. void pc_close_npc(struct map_session_data *sd,int flag);
  1029. TIMER_FUNC(pc_close_npc_timer);
  1030. void pc_setequipindex(struct map_session_data *sd);
  1031. uint8 pc_isequip(struct map_session_data *sd,int n);
  1032. int pc_equippoint(struct map_session_data *sd,int n);
  1033. int pc_equippoint_sub(struct map_session_data *sd, struct item_data* id);
  1034. void pc_setinventorydata(struct map_session_data *sd);
  1035. int pc_get_skillcooldown(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
  1036. uint8 pc_checkskill(struct map_session_data *sd,uint16 skill_id);
  1037. uint8 pc_checkskill_summoner(map_session_data *sd, e_summoner_power_type type);
  1038. short pc_checkequip(struct map_session_data *sd,int pos,bool checkall=false);
  1039. bool pc_checkequip2(struct map_session_data *sd, t_itemid nameid, int min, int max);
  1040. void pc_scdata_received(struct map_session_data *sd);
  1041. void pc_check_expiration(struct map_session_data *sd);
  1042. TIMER_FUNC(pc_expiration_timer);
  1043. TIMER_FUNC(pc_global_expiration_timer);
  1044. void pc_expire_check(struct map_session_data *sd);
  1045. void pc_calc_skilltree(struct map_session_data *sd);
  1046. int pc_calc_skilltree_normalize_job(struct map_session_data *sd);
  1047. void pc_clean_skilltree(struct map_session_data *sd);
  1048. #define pc_checkoverhp(sd) ((sd)->battle_status.hp == (sd)->battle_status.max_hp)
  1049. #define pc_checkoversp(sd) ((sd)->battle_status.sp == (sd)->battle_status.max_sp)
  1050. enum e_setpos{
  1051. SETPOS_OK = 0,
  1052. SETPOS_MAPINDEX = 1,
  1053. SETPOS_NO_MAPSERVER = 2,
  1054. SETPOS_AUTOTRADE = 3
  1055. };
  1056. enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype);
  1057. void pc_setsavepoint(struct map_session_data *sd, short mapindex,int x,int y);
  1058. char pc_randomwarp(struct map_session_data *sd,clr_type type,bool ignore_mapflag = false);
  1059. bool pc_memo(struct map_session_data* sd, int pos);
  1060. char pc_checkadditem(struct map_session_data *sd, t_itemid nameid, int amount);
  1061. uint8 pc_inventoryblank(struct map_session_data *sd);
  1062. short pc_search_inventory(struct map_session_data *sd, t_itemid nameid);
  1063. char pc_payzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
  1064. enum e_additem_result pc_additem(struct map_session_data *sd, struct item *item, int amount, e_log_pick_type log_type);
  1065. char pc_getzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
  1066. char pc_delitem(struct map_session_data *sd, int n, int amount, int type, short reason, e_log_pick_type log_type);
  1067. uint64 pc_generate_unique_id(struct map_session_data *sd);
  1068. //Bound items
  1069. int pc_bound_chk(TBL_PC *sd,enum bound_type type,int *idxlist);
  1070. // Special Shop System
  1071. int pc_paycash( struct map_session_data *sd, int price, int points, e_log_pick_type type );
  1072. int pc_getcash( struct map_session_data *sd, int cash, int points, e_log_pick_type type );
  1073. enum e_additem_result pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type);
  1074. void pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type);
  1075. void pc_putitemtocart(struct map_session_data *sd,int idx,int amount);
  1076. void pc_getitemfromcart(struct map_session_data *sd,int idx,int amount);
  1077. int pc_cartitem_amount(struct map_session_data *sd,int idx,int amount);
  1078. bool pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem);
  1079. bool pc_dropitem(struct map_session_data *sd,int n,int amount);
  1080. bool pc_isequipped(struct map_session_data *sd, t_itemid nameid);
  1081. enum adopt_responses pc_try_adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
  1082. bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
  1083. void pc_updateweightstatus(struct map_session_data *sd);
  1084. bool pc_addautobonus(std::vector<std::shared_ptr<s_autobonus>> &bonus, const char *script, short rate, unsigned int dur, uint16 atk_type, const char *o_script, unsigned int pos, bool onskill);
  1085. void pc_exeautobonus(struct map_session_data &sd, std::vector<std::shared_ptr<s_autobonus>> *bonus, std::shared_ptr<s_autobonus> autobonus);
  1086. TIMER_FUNC(pc_endautobonus);
  1087. void pc_delautobonus(struct map_session_data &sd, std::vector<std::shared_ptr<s_autobonus>> &bonus, bool restore);
  1088. void pc_bonus(struct map_session_data *sd, int type, int val);
  1089. void pc_bonus2(struct map_session_data *sd, int type, int type2, int val);
  1090. void pc_bonus3(struct map_session_data *sd, int type, int type2, int type3, int val);
  1091. void pc_bonus4(struct map_session_data *sd, int type, int type2, int type3, int type4, int val);
  1092. void pc_bonus5(struct map_session_data *sd, int type, int type2, int type3, int type4, int type5, int val);
  1093. enum e_addskill_type {
  1094. ADDSKILL_PERMANENT = 0, ///< Permanent skill. Remove the skill if level is 0
  1095. ADDSKILL_TEMP = 1, ///< Temporary skill. If player learned the skill and the given level is higher, level will be replaced and learned level will be palced in skill flag. `flag = learned + SKILL_FLAG_REPLACED_LV_0; learned_level = level;`
  1096. ADDSKILL_TEMP_ADDLEVEL = 2, ///< Like PCSKILL_TEMP, except the level will be stacked. `learned_level += level`. The flag is used to store original learned level
  1097. ADDSKILL_PERMANENT_GRANTED = 3, ///< Grant permanent skill, ignore skill tree and learned level
  1098. };
  1099. bool pc_skill(struct map_session_data *sd, uint16 skill_id, int level, enum e_addskill_type type);
  1100. int pc_insert_card(struct map_session_data *sd,int idx_card,int idx_equip);
  1101. int pc_identifyall(struct map_session_data *sd, bool identify_item);
  1102. bool pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skill_lv);
  1103. int pc_steal_coin(struct map_session_data *sd,struct block_list *bl);
  1104. int pc_modifybuyvalue(struct map_session_data*,int);
  1105. int pc_modifysellvalue(struct map_session_data*,int);
  1106. int pc_follow(struct map_session_data*, int); // [MouseJstr]
  1107. int pc_stop_following(struct map_session_data*);
  1108. unsigned int pc_maxbaselv(struct map_session_data *sd);
  1109. unsigned int pc_maxjoblv(struct map_session_data *sd);
  1110. bool pc_is_maxbaselv(struct map_session_data *sd);
  1111. bool pc_is_maxjoblv(struct map_session_data *sd);
  1112. int pc_checkbaselevelup(struct map_session_data *sd);
  1113. int pc_checkjoblevelup(struct map_session_data *sd);
  1114. void pc_gainexp(struct map_session_data *sd, struct block_list *src, t_exp base_exp, t_exp job_exp, uint8 exp_flag);
  1115. void pc_gainexp_disp(struct map_session_data *sd, t_exp base_exp, t_exp next_base_exp, t_exp job_exp, t_exp next_job_exp, bool lost);
  1116. void pc_lostexp(struct map_session_data *sd, t_exp base_exp, t_exp job_exp);
  1117. t_exp pc_nextbaseexp(struct map_session_data *sd);
  1118. t_exp pc_nextjobexp(struct map_session_data *sd);
  1119. int pc_need_status_point(struct map_session_data *,int,int);
  1120. int pc_maxparameterincrease(struct map_session_data*,int);
  1121. bool pc_statusup(struct map_session_data*,int,int);
  1122. int pc_statusup2(struct map_session_data*,int,int);
  1123. void pc_skillup(struct map_session_data*,uint16 skill_id);
  1124. int pc_allskillup(struct map_session_data*);
  1125. int pc_resetlvl(struct map_session_data*,int type);
  1126. int pc_resetstate(struct map_session_data*);
  1127. int pc_resetskill(struct map_session_data*, int);
  1128. int pc_resetfeel(struct map_session_data*);
  1129. int pc_resethate(struct map_session_data*);
  1130. bool pc_equipitem(struct map_session_data *sd, short n, int req_pos, bool equipswitch=false);
  1131. bool pc_unequipitem(struct map_session_data*,int,int);
  1132. int pc_equipswitch( struct map_session_data* sd, int index );
  1133. void pc_equipswitch_remove( struct map_session_data* sd, int index );
  1134. void pc_checkitem(struct map_session_data*);
  1135. void pc_check_available_item(struct map_session_data *sd, uint8 type);
  1136. int pc_useitem(struct map_session_data*,int);
  1137. int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id);
  1138. int pc_sub_skillatk_bonus(struct map_session_data *sd, uint16 skill_id);
  1139. int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id);
  1140. int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id);
  1141. void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp);
  1142. int pc_dead(struct map_session_data *sd,struct block_list *src);
  1143. void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp);
  1144. bool pc_revive_item(struct map_session_data *sd);
  1145. void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int type);
  1146. int pc_itemheal(struct map_session_data *sd, t_itemid itemid, int hp,int sp);
  1147. int pc_percentheal(struct map_session_data *sd,int,int);
  1148. bool pc_jobchange(struct map_session_data *sd, int job, char upper);
  1149. void pc_setoption(struct map_session_data *,int type, int subtype = 0);
  1150. bool pc_setcart(struct map_session_data* sd, int type);
  1151. void pc_setfalcon(struct map_session_data* sd, int flag);
  1152. void pc_setriding(struct map_session_data* sd, int flag);
  1153. void pc_setmadogear(struct map_session_data* sd, bool flag, e_mado_type type = MADO_ROBOT);
  1154. void pc_changelook(struct map_session_data *,int,int);
  1155. void pc_equiplookall(struct map_session_data *sd);
  1156. void pc_set_costume_view(struct map_session_data *sd);
  1157. int64 pc_readparam(struct map_session_data *sd, int64 type);
  1158. bool pc_setparam(struct map_session_data *sd, int64 type, int64 val);
  1159. int64 pc_readreg(struct map_session_data *sd, int64 reg);
  1160. bool pc_setreg(struct map_session_data *sd, int64 reg, int64 val);
  1161. char *pc_readregstr(struct map_session_data *sd, int64 reg);
  1162. bool pc_setregstr(struct map_session_data *sd, int64 reg, const char *str);
  1163. int64 pc_readregistry(struct map_session_data *sd, int64 reg);
  1164. bool pc_setregistry(struct map_session_data *sd, int64 reg, int64 val);
  1165. char *pc_readregistry_str(struct map_session_data *sd, int64 reg);
  1166. bool pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val);
  1167. #define pc_readglobalreg(sd,reg) pc_readregistry(sd,reg)
  1168. #define pc_setglobalreg(sd,reg,val) pc_setregistry(sd,reg,val)
  1169. #define pc_readglobalreg_str(sd,reg) pc_readregistry_str(sd,reg)
  1170. #define pc_setglobalreg_str(sd,reg,val) pc_setregistry_str(sd,reg,val)
  1171. #define pc_readaccountreg(sd,reg) pc_readregistry(sd,reg)
  1172. #define pc_setaccountreg(sd,reg,val) pc_setregistry(sd,reg,val)
  1173. #define pc_readaccountregstr(sd,reg) pc_readregistry_str(sd,reg)
  1174. #define pc_setaccountregstr(sd,reg,val) pc_setregistry_str(sd,reg,val)
  1175. #define pc_readaccountreg2(sd,reg) pc_readregistry(sd,reg)
  1176. #define pc_setaccountreg2(sd,reg,val) pc_setregistry(sd,reg,val)
  1177. #define pc_readaccountreg2str(sd,reg) pc_readregistry_str(sd,reg)
  1178. #define pc_setaccountreg2str(sd,reg,val) pc_setregistry_str(sd,reg,val)
  1179. bool pc_setreg2(struct map_session_data *sd, const char *reg, int64 val);
  1180. int64 pc_readreg2(struct map_session_data *sd, const char *reg);
  1181. bool pc_addeventtimer(struct map_session_data *sd,int tick,const char *name);
  1182. bool pc_deleventtimer(struct map_session_data *sd,const char *name);
  1183. void pc_cleareventtimer(struct map_session_data *sd);
  1184. void pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick);
  1185. int pc_calc_pvprank(struct map_session_data *sd);
  1186. TIMER_FUNC(pc_calc_pvprank_timer);
  1187. int pc_ismarried(struct map_session_data *sd);
  1188. bool pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd);
  1189. bool pc_divorce(struct map_session_data *sd);
  1190. struct map_session_data *pc_get_partner(struct map_session_data *sd);
  1191. struct map_session_data *pc_get_father(struct map_session_data *sd);
  1192. struct map_session_data *pc_get_mother(struct map_session_data *sd);
  1193. struct map_session_data *pc_get_child(struct map_session_data *sd);
  1194. void pc_bleeding (struct map_session_data *sd, t_tick diff_tick);
  1195. void pc_regen (struct map_session_data *sd, t_tick diff_tick);
  1196. bool pc_setstand(struct map_session_data *sd, bool force);
  1197. bool pc_candrop(struct map_session_data *sd,struct item *item);
  1198. bool pc_can_attack(struct map_session_data *sd, int target_id);
  1199. int pc_jobid2mapid(unsigned short b_class); // Skotlex
  1200. int pc_mapid2jobid(unsigned short class_, int sex); // Skotlex
  1201. const char * job_name(int class_);
  1202. struct skill_tree_entry {
  1203. uint16 skill_id, skill_lv;
  1204. uint32 baselv, joblv;
  1205. struct {
  1206. uint16 skill_id, skill_lv;
  1207. } need[MAX_PC_SKILL_REQUIRE];
  1208. }; // Celest
  1209. extern struct skill_tree_entry skill_tree[CLASS_COUNT][MAX_SKILL_TREE];
  1210. struct sg_data {
  1211. short anger_id;
  1212. short bless_id;
  1213. short comfort_id;
  1214. char feel_var[NAME_LENGTH];
  1215. char hate_var[NAME_LENGTH];
  1216. bool (*day_func)(void);
  1217. };
  1218. extern const struct sg_data sg_info[MAX_PC_FEELHATE];
  1219. void pc_set_bg_queue_timer(map_session_data *sd);
  1220. void pc_delete_bg_queue_timer(map_session_data *sd);
  1221. void pc_setinvincibletimer(struct map_session_data* sd, int val);
  1222. void pc_delinvincibletimer(struct map_session_data* sd);
  1223. void pc_addspiritball(struct map_session_data *sd,int interval,int max);
  1224. void pc_delspiritball(struct map_session_data *sd,int count,int type);
  1225. int pc_addsoulball(map_session_data *sd, int max);
  1226. int pc_delsoulball(map_session_data *sd, int count, bool type);
  1227. void pc_addfame(struct map_session_data *sd,int count);
  1228. unsigned char pc_famerank(uint32 char_id, int job);
  1229. bool pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl);
  1230. extern struct fame_list smith_fame_list[MAX_FAME_LIST];
  1231. extern struct fame_list chemist_fame_list[MAX_FAME_LIST];
  1232. extern struct fame_list taekwon_fame_list[MAX_FAME_LIST];
  1233. void pc_readdb(void);
  1234. void do_init_pc(void);
  1235. void do_final_pc(void);
  1236. // timer for night.day
  1237. extern int day_timer_tid;
  1238. extern int night_timer_tid;
  1239. TIMER_FUNC(map_day_timer); // by [yor]
  1240. TIMER_FUNC(map_night_timer); // by [yor]
  1241. // Rental System
  1242. void pc_inventory_rentals(struct map_session_data *sd);
  1243. void pc_inventory_rental_clear(struct map_session_data *sd);
  1244. void pc_inventory_rental_add(struct map_session_data *sd, unsigned int seconds);
  1245. int pc_read_motd(void); // [Valaris]
  1246. int pc_disguise(struct map_session_data *sd, int class_);
  1247. bool pc_isautolooting(struct map_session_data *sd, t_itemid nameid);
  1248. void pc_overheat(struct map_session_data *sd, int16 heat);
  1249. void pc_itemcd_do(struct map_session_data *sd, bool load);
  1250. uint8 pc_itemcd_add(struct map_session_data *sd, struct item_data *id, t_tick tick, unsigned short n);
  1251. uint8 pc_itemcd_check(struct map_session_data *sd, struct item_data *id, t_tick tick, unsigned short n);
  1252. int pc_load_combo(struct map_session_data *sd);
  1253. void pc_addspiritcharm(struct map_session_data *sd, int interval, int max, int type);
  1254. void pc_delspiritcharm(struct map_session_data *sd, int count, int type);
  1255. void pc_baselevelchanged(struct map_session_data *sd);
  1256. void pc_damage_log_add(struct map_session_data *sd, int id);
  1257. void pc_damage_log_clear(struct map_session_data *sd, int id);
  1258. enum e_BANKING_DEPOSIT_ACK : uint8;
  1259. enum e_BANKING_WITHDRAW_ACK : uint8;
  1260. enum e_BANKING_DEPOSIT_ACK pc_bank_deposit(struct map_session_data *sd, int money);
  1261. enum e_BANKING_WITHDRAW_ACK pc_bank_withdraw(struct map_session_data *sd, int money);
  1262. void pc_crimson_marker_clear(struct map_session_data *sd);
  1263. void pc_show_version(struct map_session_data *sd);
  1264. TIMER_FUNC(pc_bonus_script_timer);
  1265. void pc_bonus_script(struct map_session_data *sd);
  1266. struct s_bonus_script_entry *pc_bonus_script_add(struct map_session_data *sd, const char *script_str, t_tick dur, enum efst_types icon, uint16 flag, uint8 type);
  1267. void pc_bonus_script_clear(struct map_session_data *sd, uint16 flag);
  1268. void pc_cell_basilica(struct map_session_data *sd);
  1269. short pc_get_itemgroup_bonus(struct map_session_data* sd, t_itemid nameid, std::vector<s_item_bonus>& bonuses);
  1270. short pc_get_itemgroup_bonus_group(struct map_session_data* sd, uint16 group_id, std::vector<s_item_bonus>& bonuses);
  1271. bool pc_is_same_equip_index(enum equip_index eqi, short *equip_index, short index);
  1272. /// Check if player is Taekwon Ranker and the level is >= 90 (battle_config.taekwon_ranker_min_lv)
  1273. #define pc_is_taekwon_ranker(sd) (((sd)->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && (sd)->status.base_level >= battle_config.taekwon_ranker_min_lv && pc_famerank((sd)->status.char_id,MAPID_TAEKWON))
  1274. TIMER_FUNC(pc_autotrade_timer);
  1275. void pc_validate_skill(struct map_session_data *sd);
  1276. void pc_show_questinfo(struct map_session_data *sd);
  1277. void pc_show_questinfo_reinit(struct map_session_data *sd);
  1278. bool pc_job_can_entermap(enum e_job jobid, int m, int group_lv);
  1279. #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
  1280. uint16 pc_level_penalty_mod( struct map_session_data* sd, e_penalty_type type, std::shared_ptr<s_mob_db> mob, mob_data* md = nullptr );
  1281. #endif
  1282. bool pc_attendance_enabled();
  1283. int32 pc_attendance_counter( struct map_session_data* sd );
  1284. void pc_attendance_claim_reward( struct map_session_data* sd );
  1285. #endif /* PC_HPP */