pc.hpp 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501
  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 lapine_ui : 3; // Lapine Synthesis/Upgrade UI is opened
  312. unsigned int block_action : 10;
  313. bool refineui_open;
  314. } state;
  315. struct {
  316. unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
  317. unsigned int restart_full_recover : 1;
  318. unsigned int no_castcancel : 1;
  319. unsigned int no_castcancel2 : 1;
  320. unsigned int no_sizefix : 1;
  321. unsigned int no_gemstone : 2;
  322. unsigned int intravision : 1; // Maya Purple Card effect [DracoRPG]
  323. unsigned int perfect_hiding : 1; // [Valaris]
  324. unsigned int no_knockback : 1;
  325. unsigned int bonus_coma : 1;
  326. unsigned int no_mado_fuel : 1; // Disable Magic_Gear_Fuel consumption [Secret]
  327. unsigned int no_walk_delay : 1;
  328. } special_state;
  329. uint32 login_id1, login_id2;
  330. unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex]
  331. int group_id, group_pos, group_level;
  332. unsigned int permissions;/* group permissions */
  333. int count_rewarp; //count how many time we being rewarped
  334. int langtype;
  335. struct mmo_charstatus status;
  336. // Item Storages
  337. struct s_storage storage, premiumStorage;
  338. struct s_storage inventory;
  339. struct s_storage cart;
  340. struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups)
  341. short equip_index[EQI_MAX];
  342. short equip_switch_index[EQI_MAX];
  343. unsigned int weight,max_weight,add_max_weight;
  344. int cart_weight,cart_num,cart_weight_max;
  345. int fd;
  346. unsigned short mapindex;
  347. unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left.
  348. t_tick client_tick;
  349. int npc_id,npc_shopid; //for script follow scriptoid; ,npcid
  350. std::vector<int> areanpc, npc_ontouch_; ///< Array of OnTouch and OnTouch_ NPC ID
  351. int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse)
  352. int npc_menu; // internal variable, used in npc menu handling
  353. int npc_amount;
  354. struct script_state *st;
  355. char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine
  356. int npc_timer_id; //For player attached npc timers. [Skotlex]
  357. unsigned int chatID;
  358. time_t idletime;
  359. time_t idletime_hom;
  360. time_t idletime_mer;
  361. struct s_progressbar {
  362. int npc_id;
  363. t_tick timeout;
  364. } progressbar; //Progress Bar [Inkfish]
  365. struct s_ignore {
  366. char name[NAME_LENGTH];
  367. } ignore[MAX_IGNORE_LIST];
  368. int followtimer; // [MouseJstr]
  369. int followtarget;
  370. time_t emotionlasttime; // to limit flood with emotion packets
  371. short skillitem,skillitemlv;
  372. bool skillitem_keep_requirement;
  373. uint16 skill_id_old,skill_lv_old;
  374. uint16 skill_id_dance,skill_lv_dance;
  375. short cook_mastery; // range: [0,1999] [Inkfish]
  376. struct skill_cooldown_entry * scd[MAX_SKILLCOOLDOWN]; // Skill Cooldown
  377. uint16 cloneskill_idx, ///Stores index of copied skill by Intimidate/Plagiarism
  378. reproduceskill_idx; ///Stores index of copied skill by Reproduce
  379. int menuskill_id, menuskill_val, menuskill_val2;
  380. int invincible_timer;
  381. t_tick canlog_tick;
  382. t_tick canuseitem_tick; // [Skotlex]
  383. t_tick canusecashfood_tick;
  384. t_tick canequip_tick; // [Inkfish]
  385. t_tick cantalk_tick;
  386. t_tick canskill_tick; // used to prevent abuse from no-delay ACT files
  387. t_tick cansendmail_tick; // [Mail System Flood Protection]
  388. t_tick ks_floodprotect_tick; // [Kill Steal Protection]
  389. t_tick equipswitch_tick; // Equip switch
  390. struct s_item_delay {
  391. t_itemid nameid;
  392. t_tick tick;
  393. } item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
  394. short weapontype1,weapontype2;
  395. short disguise; // [Valaris]
  396. struct weapon_data right_weapon, left_weapon;
  397. // here start arrays to be globally zeroed at the beginning of status_calc_pc()
  398. struct s_indexed_bonus {
  399. int param_bonus[6], param_equip[6]; //Stores card/equipment bonuses.
  400. int subele[ELE_MAX];
  401. int subele_script[ELE_MAX];
  402. int subdefele[ELE_MAX];
  403. int subrace[RC_MAX];
  404. int subclass[CLASS_MAX];
  405. int subrace2[RC2_MAX];
  406. int subsize[SZ_MAX];
  407. short coma_class[CLASS_MAX];
  408. short coma_race[RC_MAX];
  409. short weapon_coma_ele[ELE_MAX];
  410. short weapon_coma_race[RC_MAX];
  411. short weapon_coma_class[CLASS_MAX];
  412. int weapon_atk[16];
  413. int weapon_damage_rate[16];
  414. int arrow_addele[ELE_MAX];
  415. int arrow_addrace[RC_MAX];
  416. int arrow_addclass[CLASS_MAX];
  417. int arrow_addsize[SZ_MAX];
  418. int magic_addele[ELE_MAX];
  419. int magic_addele_script[ELE_MAX];
  420. int magic_addrace[RC_MAX];
  421. int magic_addclass[CLASS_MAX];
  422. int magic_addsize[SZ_MAX];
  423. int magic_atk_ele[ELE_MAX];
  424. int magic_subsize[SZ_MAX];
  425. int critaddrace[RC_MAX];
  426. int expaddrace[RC_MAX];
  427. int expaddclass[CLASS_MAX];
  428. int ignore_mdef_by_race[RC_MAX];
  429. int ignore_mdef_by_class[CLASS_MAX];
  430. int ignore_def_by_race[RC_MAX];
  431. int ignore_def_by_class[CLASS_MAX];
  432. short sp_gain_race[RC_MAX];
  433. int magic_addrace2[RC2_MAX];
  434. int ignore_mdef_by_race2[RC2_MAX];
  435. int dropaddrace[RC_MAX];
  436. int dropaddclass[CLASS_MAX];
  437. int magic_subdefele[ELE_MAX];
  438. } indexed_bonus;
  439. // zeroed arrays end here.
  440. std::vector<s_autospell> autospell, autospell2, autospell3;
  441. std::vector<s_addeffect> addeff, addeff_atked;
  442. std::vector<s_addeffectonskill> addeff_onskill;
  443. std::vector<s_item_bonus> skillatk, skillusesprate, skillusesp, skillheal, skillheal2, skillblown, skillcastrate, skillfixcastrate, subskill, skillcooldown, skillfixcast,
  444. skillvarcast, skilldelay, itemhealrate, add_def, add_mdef, add_mdmg, reseff, itemgrouphealrate, itemsphealrate, itemgroupsphealrate;
  445. std::vector<s_add_drop> add_drop;
  446. std::vector<s_addele2> subele2;
  447. std::vector<s_vanish_bonus> sp_vanish, hp_vanish;
  448. std::vector<s_addrace2> subrace3;
  449. std::vector<std::shared_ptr<s_autobonus>> autobonus, autobonus2, autobonus3; //Auto script on attack, when attacked, on skill usage
  450. // zeroed structures start here
  451. struct s_regen {
  452. short value;
  453. int rate;
  454. t_tick tick;
  455. } hp_loss, sp_loss, hp_regen, sp_regen, percent_hp_regen, percent_sp_regen;
  456. struct {
  457. short value;
  458. int rate, tick;
  459. } def_set_race[RC_MAX], mdef_set_race[RC_MAX], norecover_state_race[RC_MAX];
  460. struct s_bonus_vanish_gain {
  461. short rate, ///< Success rate 0 - 1000 (100%)
  462. per; ///< % HP/SP vanished/gained
  463. } hp_vanish_race[RC_MAX], sp_vanish_race[RC_MAX];
  464. // zeroed structures end here
  465. // zeroed vars start here.
  466. struct s_bonus {
  467. int hp, sp;
  468. int atk_rate;
  469. int arrow_atk,arrow_ele,arrow_cri,arrow_hit;
  470. int nsshealhp,nsshealsp;
  471. int critical_def,double_rate;
  472. int short_attack_atk_rate; // Short range atk rate, not weapon based.
  473. int long_attack_atk_rate; //Long range atk rate, not weapon based. [Skotlex]
  474. int near_attack_def_rate,long_attack_def_rate,magic_def_rate,misc_def_rate;
  475. int ignore_mdef_ele;
  476. int ignore_mdef_race;
  477. int ignore_mdef_class;
  478. int perfect_hit;
  479. int perfect_hit_add;
  480. int get_zeny_rate;
  481. int get_zeny_num; //Added Get Zeny Rate [Skotlex]
  482. int double_add_rate;
  483. int short_weapon_damage_return,long_weapon_damage_return,reduce_damage_return;
  484. int magic_damage_return; // AppleGirl Was Here
  485. int break_weapon_rate,break_armor_rate;
  486. int crit_atk_rate;
  487. int crit_def_rate;
  488. int classchange; // [Valaris]
  489. int speed_rate, speed_add_rate, aspd_add;
  490. int itemhealrate2; // [Epoque] Increase heal rate of all healing items.
  491. int itemsphealrate2;
  492. int shieldmdef;//royal guard's
  493. unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex]
  494. short splash_range, splash_add_range;
  495. short add_steal_rate;
  496. int add_heal_rate, add_heal2_rate;
  497. int sp_gain_value, hp_gain_value, magic_sp_gain_value, magic_hp_gain_value, long_sp_gain_value, long_hp_gain_value;
  498. unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest]
  499. unsigned short unbreakable_equip; //100% break resistance on certain equipment
  500. unsigned short unstripable_equip;
  501. int fixcastrate, varcastrate, delayrate; // n/100
  502. int add_fixcast, add_varcast; // in milliseconds
  503. int ematk; // matk bonus from equipment
  504. int eatk; // atk bonus from equipment
  505. uint8 absorb_dmg_maxhp; // [Cydh]
  506. short critical_rangeatk;
  507. short weapon_atk_rate, weapon_matk_rate;
  508. } bonus;
  509. // zeroed vars end here.
  510. int castrate,hprate,sprate,dsprate;
  511. int hprecov_rate,sprecov_rate;
  512. int matk_rate;
  513. int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate;
  514. t_itemid itemid;
  515. short itemindex; //Used item's index in sd->inventory [Skotlex]
  516. uint16 catch_target_class; // pet catching, stores a pet class to catch [zzo]
  517. int8 spiritball, spiritball_old;
  518. int spirit_timer[MAX_SPIRITBALL];
  519. short spiritcharm; //No. of spirit
  520. int spiritcharm_type; //Spirit type
  521. int spiritcharm_timer[MAX_SPIRITCHARM];
  522. int8 soulball, soulball_old;
  523. unsigned char potion_success_counter; //Potion successes in row counter
  524. unsigned char mission_count; //Stores the bounty kill count for TK_MISSION
  525. short mission_mobid; //Stores the target mob_id for TK_MISSION
  526. int die_counter; //Total number of times you've died
  527. int devotion[MAX_DEVOTION]; //Stores the account IDs of chars devoted to.
  528. int stellar_mark[MAX_STELLAR_MARKS]; // Stores the account ID's of character's with a stellar mark.
  529. int united_soul[MAX_UNITED_SOULS]; // Stores the account ID's of character's who's soul is united.
  530. int trade_partner;
  531. struct s_deal {
  532. struct s_item {
  533. short index, amount;
  534. } item[10];
  535. int zeny, weight;
  536. } deal;
  537. bool party_creating; // whether the char is requesting party creation
  538. bool party_joining; // whether the char is accepting party invitation
  539. int party_invite, party_invite_account; // for handling party invitation (holds party id and account id)
  540. int adopt_invite; // Adoption
  541. struct guild *guild; // [Ind] speed everything up
  542. int guild_invite,guild_invite_account;
  543. int guild_emblem_id,guild_alliance,guild_alliance_account;
  544. short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo]
  545. int guildspy; // [Syrus22]
  546. int partyspy; // [Syrus22]
  547. int clanspy;
  548. struct clan *clan;
  549. int vended_id;
  550. int vender_id;
  551. int vend_num;
  552. uint16 vend_skill_lv;
  553. char message[MESSAGE_SIZE];
  554. struct s_vending vending[MAX_VENDING];
  555. unsigned int buyer_id; // uid of open buying store
  556. struct s_buyingstore buyingstore;
  557. struct s_search_store_info searchstore;
  558. struct pet_data *pd;
  559. struct homun_data *hd; // [blackhole89]
  560. struct mercenary_data *md;
  561. struct elemental_data *ed;
  562. struct s_hate_mob {
  563. int m; //-1 - none, other: map index corresponding to map name.
  564. unsigned short index; //map index
  565. } feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars
  566. short hate_mob[3];
  567. int pvp_timer;
  568. short pvp_point;
  569. unsigned short pvp_rank, pvp_lastusers;
  570. unsigned short pvp_won, pvp_lost;
  571. char eventqueue[MAX_EVENTQUEUE][EVENT_NAME_LENGTH];
  572. int eventtimer[MAX_EVENTTIMER];
  573. unsigned short eventcount; // [celest]
  574. unsigned char change_level_2nd; // job level when changing from 1st to 2nd class [jobchange_level in global_reg_value]
  575. unsigned char change_level_3rd; // job level when changing from 2nd to 3rd class [jobchange_level_3rd in global_reg_value]
  576. char fakename[NAME_LENGTH]; // fake names [Valaris]
  577. size_t duel_group; // duel vars [LuzZza]
  578. size_t duel_invite;
  579. int killerrid, killedrid, killedgid;
  580. int cashPoints, kafraPoints;
  581. int rental_timer;
  582. // Auction System [Zephyrus]
  583. struct s_auction{
  584. int index, amount;
  585. } auction;
  586. // Mail System [Zephyrus]
  587. struct s_mail {
  588. struct {
  589. t_itemid nameid;
  590. int index, amount;
  591. } item[MAIL_MAX_ITEM];
  592. int zeny;
  593. struct mail_data inbox;
  594. bool changed; // if true, should sync with charserver on next mailbox request
  595. uint32 pending_weight;
  596. uint32 pending_zeny;
  597. uint16 pending_slots;
  598. } mail;
  599. //Quest log system
  600. int num_quests; ///< Number of entries in quest_log
  601. int avail_quests; ///< Number of Q_ACTIVE and Q_INACTIVE entries in quest log (index of the first Q_COMPLETE entry)
  602. struct quest *quest_log; ///< Quest log entries (note: Q_COMPLETE quests follow the first <avail_quests>th enties
  603. bool save_quest; ///< Whether the quest_log entries were modified and are waitin to be saved
  604. // Achievement log system
  605. struct s_achievement_data {
  606. int total_score; ///< Total achievement points
  607. int level; ///< Achievement level
  608. bool save; ///< Flag to know if achievements need to be saved
  609. uint16 count; ///< Total achievements in log
  610. uint16 incompleteCount; ///< Total incomplete achievements in log
  611. struct achievement *achievements; ///< Achievement log entries
  612. } achievement_data;
  613. // Title system
  614. std::vector<int> titles;
  615. std::vector<int> cloaked_npc;
  616. /* ShowEvent Data Cache flags from map */
  617. std::vector<s_qi_display> qi_display;
  618. // temporary debug [flaviojs]
  619. const char* debug_file;
  620. int debug_line;
  621. const char* debug_func;
  622. // Battlegrounds queue system [MasterOfMuppets]
  623. int bg_id, bg_queue_id;
  624. int tid_queue_active; ///< Timer ID associated with players joining an active BG
  625. #ifdef SECURE_NPCTIMEOUT
  626. /**
  627. * ID of the timer
  628. * @info
  629. * - value is -1 (INVALID_TIMER constant) when not being used
  630. * - timer is cancelled upon closure of the current npc's instance
  631. **/
  632. int npc_idle_timer;
  633. /**
  634. * Tick on the last recorded NPC iteration (next/menu/whatever)
  635. * @info
  636. * - It is updated on every NPC iteration as mentioned above
  637. **/
  638. t_tick npc_idle_tick;
  639. /* */
  640. enum npc_timeout_type npc_idle_type;
  641. #endif
  642. std::vector<std::shared_ptr<s_combos>> combos;
  643. /**
  644. * Guarantees your friend request is legit (for bugreport:4629)
  645. **/
  646. int friend_req;
  647. int shadowform_id;
  648. /* Channel System [Ind] */
  649. struct Channel **channels;
  650. unsigned char channel_count;
  651. struct Channel *gcbind;
  652. bool stealth;
  653. unsigned char fontcolor;
  654. t_tick *channel_tick;
  655. /* [Ind] */
  656. struct sc_display_entry **sc_display;
  657. unsigned char sc_display_count;
  658. unsigned char delayed_damage; //[Ind]
  659. /**
  660. * Account/Char variables & array control of those variables
  661. **/
  662. struct reg_db regs;
  663. unsigned char vars_received; // char loading is only complete when you get it all.
  664. bool vars_ok;
  665. bool vars_dirty;
  666. uint16 dmglog[DAMAGELOG_SIZE_PC]; ///target ids
  667. int c_marker[MAX_SKILL_CRIMSON_MARKER]; /// Store target that marked by Crimson Marker [Cydh]
  668. bool flicker; /// Check RL_FLICKER usage status [Cydh]
  669. #ifdef VIP_ENABLE
  670. struct vip_info vip;
  671. #endif
  672. /// Bonus Script [Cydh]
  673. struct s_bonus_script_list {
  674. struct linkdb_node *head; ///< Bonus script head node. data: struct s_bonus_script_entry *entry, key: (intptr_t)entry
  675. uint16 count;
  676. } bonus_script;
  677. /* Expiration Timer ID */
  678. int expiration_tid;
  679. time_t expiration_time;
  680. short last_addeditem_index; /// Index of latest item added
  681. int autotrade_tid;
  682. int respawn_tid;
  683. int bank_vault; ///< Bank Vault
  684. #ifdef PACKET_OBFUSCATION
  685. unsigned int cryptKey; ///< Packet obfuscation key to be used for the next received packet
  686. #endif
  687. struct {
  688. int bronze, silver, gold; ///< Roulette Coin
  689. } roulette_point;
  690. struct {
  691. short stage;
  692. int8 prizeIdx;
  693. short prizeStage;
  694. bool claimPrize;
  695. t_tick tick;
  696. } roulette;
  697. int instance_id;
  698. e_instance_mode instance_mode; ///< Mode of instance player last leaves from (used for instance destruction button)
  699. short setlook_head_top, setlook_head_mid, setlook_head_bottom, setlook_robe; ///< Stores 'setlook' script command values.
  700. t_itemid last_lapine_box;
  701. #if PACKETVER_MAIN_NUM >= 20150507 || PACKETVER_RE_NUM >= 20150429 || defined(PACKETVER_ZERO)
  702. std::vector<int16> hatEffects;
  703. #endif
  704. struct{
  705. int tid;
  706. uint16 skill_id;
  707. uint16 level;
  708. int target;
  709. } skill_keep_using;
  710. };
  711. extern struct eri *pc_sc_display_ers; /// Player's SC display table
  712. /**
  713. * ERS for the bulk of pc vars
  714. **/
  715. extern struct eri *num_reg_ers;
  716. extern struct eri *str_reg_ers;
  717. /* Global Expiration Timer ID */
  718. extern int pc_expiration_tid;
  719. enum weapon_type : uint8 {
  720. W_FIST, //Bare hands
  721. W_DAGGER, //1
  722. W_1HSWORD, //2
  723. W_2HSWORD, //3
  724. W_1HSPEAR, //4
  725. W_2HSPEAR, //5
  726. W_1HAXE, //6
  727. W_2HAXE, //7
  728. W_MACE, //8
  729. W_2HMACE, //9 (unused)
  730. W_STAFF, //10
  731. W_BOW, //11
  732. W_KNUCKLE, //12
  733. W_MUSICAL, //13
  734. W_WHIP, //14
  735. W_BOOK, //15
  736. W_KATAR, //16
  737. W_REVOLVER, //17
  738. W_RIFLE, //18
  739. W_GATLING, //19
  740. W_SHOTGUN, //20
  741. W_GRENADE, //21
  742. W_HUUMA, //22
  743. W_2HSTAFF, //23
  744. MAX_WEAPON_TYPE,
  745. // dual-wield constants
  746. W_DOUBLE_DD, // 2 daggers
  747. W_DOUBLE_SS, // 2 swords
  748. W_DOUBLE_AA, // 2 axes
  749. W_DOUBLE_DS, // dagger + sword
  750. W_DOUBLE_DA, // dagger + axe
  751. W_DOUBLE_SA, // sword + axe
  752. MAX_WEAPON_TYPE_ALL,
  753. };
  754. #define WEAPON_TYPE_ALL ((1<<MAX_WEAPON_TYPE)-1)
  755. enum e_ammo_type : uint8 {
  756. AMMO_NONE = 0,
  757. AMMO_ARROW,
  758. AMMO_DAGGER,
  759. AMMO_BULLET,
  760. AMMO_SHELL,
  761. AMMO_GRENADE,
  762. AMMO_SHURIKEN,
  763. AMMO_KUNAI,
  764. AMMO_CANNONBALL,
  765. AMMO_THROWWEAPON,
  766. MAX_AMMO_TYPE
  767. };
  768. enum idletime_option {
  769. IDLE_WALK = 0x0001,
  770. IDLE_USESKILLTOID = 0x0002,
  771. IDLE_USESKILLTOPOS = 0x0004,
  772. IDLE_USEITEM = 0x0008,
  773. IDLE_ATTACK = 0x0010,
  774. IDLE_CHAT = 0x0020,
  775. IDLE_SIT = 0x0040,
  776. IDLE_EMOTION = 0x0080,
  777. IDLE_DROPITEM = 0x0100,
  778. IDLE_ATCOMMAND = 0x0200,
  779. IDLE_NPC_CLOSE = 0x0400,
  780. IDLE_NPC_INPUT = 0x0800,
  781. IDLE_NPC_MENU = 0x1000,
  782. IDLE_NPC_NEXT = 0x2000,
  783. IDLE_NPC_PROGRESS = 0x4000,
  784. };
  785. enum adopt_responses {
  786. ADOPT_ALLOWED = 0,
  787. ADOPT_ALREADY_ADOPTED,
  788. ADOPT_MARRIED_AND_PARTY,
  789. ADOPT_EQUIP_RINGS,
  790. ADOPT_NOT_NOVICE,
  791. ADOPT_CHARACTER_NOT_FOUND,
  792. ADOPT_MORE_CHILDREN,
  793. ADOPT_LEVEL_70,
  794. ADOPT_MARRIED,
  795. };
  796. enum item_check {
  797. ITMCHK_NONE = 0x0,
  798. ITMCHK_INVENTORY = 0x1,
  799. ITMCHK_CART = 0x2,
  800. ITMCHK_STORAGE = 0x4,
  801. ITMCHK_ALL = ITMCHK_INVENTORY|ITMCHK_CART|ITMCHK_STORAGE,
  802. };
  803. enum e_penalty_type : uint16{
  804. PENALTY_NONE,
  805. PENALTY_EXP,
  806. PENALTY_DROP,
  807. PENALTY_MVP_EXP,
  808. PENALTY_MVP_DROP,
  809. PENALTY_MAX
  810. };
  811. struct s_penalty{
  812. e_penalty_type type;
  813. uint16 rate[MAX_LEVEL * 2 - 1];
  814. };
  815. class PenaltyDatabase : public TypesafeYamlDatabase<uint16, s_penalty> {
  816. public:
  817. PenaltyDatabase() : TypesafeYamlDatabase( "PENALTY_DB", 1 ){
  818. }
  819. const std::string getDefaultLocation();
  820. uint64 parseBodyNode(const YAML::Node& node);
  821. void loadingFinished();
  822. };
  823. struct s_job_info {
  824. unsigned int base_hp[MAX_LEVEL], base_sp[MAX_LEVEL]; //Storage for the first calculation with hp/sp factor and multiplicator
  825. int hp_factor, hp_multiplicator, sp_factor;
  826. int max_weight_base;
  827. char job_bonus[MAX_LEVEL];
  828. #ifdef RENEWAL_ASPD
  829. int aspd_base[MAX_WEAPON_TYPE+1];
  830. #else
  831. int aspd_base[MAX_WEAPON_TYPE]; //[blackhole89]
  832. #endif
  833. t_exp exp_table[2][MAX_LEVEL];
  834. uint32 max_level[2];
  835. struct s_params {
  836. uint16 str, agi, vit, int_, dex, luk;
  837. } max_param;
  838. struct s_job_noenter_map {
  839. uint32 zone;
  840. uint8 group_lv;
  841. } noenter_map;
  842. };
  843. extern struct s_job_info job_info[CLASS_COUNT];
  844. #define EQP_WEAPON EQP_HAND_R
  845. #define EQP_SHIELD EQP_HAND_L
  846. #define EQP_ARMS (EQP_HAND_R|EQP_HAND_L)
  847. #define EQP_HELM (EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)
  848. #define EQP_ACC (EQP_ACC_L|EQP_ACC_R)
  849. #define EQP_COSTUME (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)
  850. #define EQP_COSTUME_HELM (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW)
  851. #define EQP_SHADOW_GEAR (EQP_SHADOW_ARMOR|EQP_SHADOW_WEAPON|EQP_SHADOW_SHIELD|EQP_SHADOW_SHOES|EQP_SHADOW_ACC_R|EQP_SHADOW_ACC_L)
  852. #define EQP_SHADOW_ACC (EQP_SHADOW_ACC_R|EQP_SHADOW_ACC_L)
  853. #define EQP_SHADOW_ARMS (EQP_SHADOW_WEAPON|EQP_SHADOW_SHIELD)
  854. /// Equip positions that use a visible sprite
  855. #if PACKETVER < 20110111
  856. #define EQP_VISIBLE EQP_HELM
  857. #else
  858. #define EQP_VISIBLE (EQP_HELM|EQP_GARMENT|EQP_COSTUME)
  859. #endif
  860. #define pc_setdead(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 )
  861. #define pc_setsit(sd) { pc_stop_walking((sd), 1|4); pc_stop_attack((sd)); (sd)->state.dead_sit = (sd)->vd.dead_sit = 2; }
  862. #define pc_isdead(sd) ( (sd)->state.dead_sit == 1 )
  863. #define pc_issit(sd) ( (sd)->vd.dead_sit == 2 )
  864. #define pc_isidle_party(sd) ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(last_tick, (sd)->idletime) >= battle_config.idle_no_share )
  865. #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 ) )
  866. #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 ) )
  867. #define pc_istrading(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )
  868. // equals pc_cant_act2 and additionally checks for chat rooms and npcs
  869. #define pc_cant_act(sd) ( (sd)->npc_id || (sd)->chatID || pc_cant_act2( (sd) ) )
  870. #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 || (sd)->state.lapine_ui )
  871. #define pc_setdir(sd,b,h) ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) )
  872. #define pc_setchatid(sd,n) ( (sd)->chatID = n )
  873. #define pc_ishiding(sd) ( (sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) )
  874. #define pc_iscloaking(sd) ( !((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK) )
  875. #define pc_ischasewalk(sd) ( (sd)->sc.option&OPTION_CHASEWALK )
  876. #ifdef VIP_ENABLE
  877. #define pc_isvip(sd) ( sd->vip.enabled ? true : false )
  878. #else
  879. #define pc_isvip(sd) ( false )
  880. #endif
  881. #ifdef NEW_CARTS
  882. #define pc_iscarton(sd) ( (sd)->sc.data[SC_PUSH_CART] )
  883. #else
  884. #define pc_iscarton(sd) ( (sd)->sc.option&OPTION_CART )
  885. #endif
  886. #define pc_isfalcon(sd) ( (sd)->sc.option&OPTION_FALCON )
  887. #define pc_isriding(sd) ( (sd)->sc.option&OPTION_RIDING )
  888. #define pc_isinvisible(sd) ( (sd)->sc.option&OPTION_INVISIBLE )
  889. #define pc_is50overweight(sd) ( (sd)->weight * 100 >= (sd)->max_weight * battle_config.natural_heal_weight_rate )
  890. #define pc_is70overweight(sd) ( (sd)->weight * 100 >= (sd)->max_weight * battle_config.natural_heal_weight_rate_renewal )
  891. #define pc_is90overweight(sd) ( (sd)->weight * 10 >= (sd)->max_weight * 9 )
  892. static inline bool pc_hasprogress(struct map_session_data *sd, enum e_wip_block progress) {
  893. return sd == NULL || (sd->state.workinprogress&progress) == progress;
  894. }
  895. /// Enum of Player's Parameter
  896. enum e_params {
  897. PARAM_STR = 0,
  898. PARAM_AGI,
  899. PARAM_VIT,
  900. PARAM_INT,
  901. PARAM_DEX,
  902. PARAM_LUK,
  903. PARAM_MAX
  904. };
  905. short pc_maxparameter(struct map_session_data *sd, enum e_params param);
  906. short pc_maxaspd(struct map_session_data *sd);
  907. /**
  908. * Ranger
  909. **/
  910. #define pc_iswug(sd) ( (sd)->sc.option&OPTION_WUG )
  911. #define pc_isridingwug(sd) ( (sd)->sc.option&OPTION_WUGRIDER )
  912. // Mechanic Magic Gear
  913. enum e_mado_type : uint16 {
  914. MADO_ROBOT = 0x00,
  915. MADO_UNUSED,
  916. MADO_SUIT,
  917. MADO_MAX
  918. };
  919. #define pc_ismadogear(sd) ( (sd)->sc.option&OPTION_MADOGEAR )
  920. // Rune Knight Dragon
  921. #define pc_isridingdragon(sd) ( (sd)->sc.option&OPTION_DRAGON )
  922. #define pc_stop_walking(sd, type) unit_stop_walking(&(sd)->bl, type)
  923. #define pc_stop_attack(sd) unit_stop_attack(&(sd)->bl)
  924. //Weapon check considering dual wielding.
  925. #define pc_check_weapontype(sd, type) ((type)&((sd)->status.weapon < MAX_WEAPON_TYPE? \
  926. 1<<(sd)->status.weapon:(1<<(sd)->weapontype1)|(1<<(sd)->weapontype2)|(1<<(sd)->status.weapon)))
  927. //Checks if the given class value corresponds to a player class. [Skotlex]
  928. //JOB_NOVICE isn't checked for class_ is supposed to be unsigned
  929. #define pcdb_checkid_sub(class_) ( \
  930. ( (class_) < JOB_MAX_BASIC ) || \
  931. ( (class_) >= JOB_NOVICE_HIGH && (class_) <= JOB_DARK_COLLECTOR ) || \
  932. ( (class_) >= JOB_RUNE_KNIGHT && (class_) <= JOB_MECHANIC_T2 ) || \
  933. ( (class_) >= JOB_BABY_RUNE_KNIGHT && (class_) <= JOB_BABY_MECHANIC2 ) || \
  934. ( (class_) >= JOB_SUPER_NOVICE_E && (class_) <= JOB_SUPER_BABY_E ) || \
  935. ( (class_) >= JOB_KAGEROU && (class_) <= JOB_OBORO ) || \
  936. (class_) == JOB_REBELLION || (class_) == JOB_SUMMONER || \
  937. (class_) == JOB_BABY_SUMMONER || \
  938. ( (class_) >= JOB_BABY_NINJA && (class_) <= JOB_BABY_REBELLION ) || \
  939. ( (class_) >= JOB_BABY_STAR_GLADIATOR2 && (class_) <= JOB_BABY_STAR_EMPEROR2 ) \
  940. )
  941. #define pcdb_checkid(class_) pcdb_checkid_sub((unsigned int)class_)
  942. // clientside display macros (values to the left/right of the "+")
  943. #ifdef RENEWAL
  944. #define pc_leftside_atk(sd) ((sd)->battle_status.batk)
  945. #define pc_rightside_atk(sd) ((sd)->battle_status.watk + (sd)->battle_status.watk2 + (sd)->battle_status.eatk)
  946. #define pc_leftside_def(sd) ((sd)->battle_status.def2)
  947. #define pc_rightside_def(sd) ((sd)->battle_status.def)
  948. #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef2)
  949. #define pc_rightside_mdef(sd) ((sd)->battle_status.mdef)
  950. #define pc_leftside_matk(sd) (status_base_matk_min(&(sd)->bl, status_get_status_data(&(sd)->bl), (sd)->status.base_level))
  951. #define pc_rightside_matk(sd) ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk)
  952. #else
  953. #define pc_leftside_atk(sd) ((sd)->battle_status.batk + (sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk)
  954. #define pc_rightside_atk(sd) ((sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2)
  955. #define pc_leftside_def(sd) ((sd)->battle_status.def)
  956. #define pc_rightside_def(sd) ((sd)->battle_status.def2)
  957. #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef)
  958. #define pc_rightside_mdef(sd) ( (sd)->battle_status.mdef2 - ((sd)->battle_status.vit>>1) )
  959. #define pc_leftside_matk(sd) \
  960. (\
  961. ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \
  962. ?((sd)->battle_status.matk_min * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \
  963. :(sd)->battle_status.matk_min \
  964. )
  965. #define pc_rightside_matk(sd) \
  966. (\
  967. ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \
  968. ?((sd)->battle_status.matk_max * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \
  969. :(sd)->battle_status.matk_max \
  970. )
  971. #endif
  972. struct s_attendance_reward {
  973. t_itemid item_id;
  974. uint16 amount;
  975. };
  976. struct s_attendance_period {
  977. uint32 start;
  978. uint32 end;
  979. std::map<uint32, std::shared_ptr<struct s_attendance_reward>> rewards;
  980. };
  981. class AttendanceDatabase : public TypesafeYamlDatabase<uint32, s_attendance_period> {
  982. public:
  983. AttendanceDatabase() : TypesafeYamlDatabase("ATTENDANCE_DB", 1) {
  984. }
  985. const std::string getDefaultLocation();
  986. uint64 parseBodyNode(const YAML::Node &node);
  987. };
  988. extern AttendanceDatabase attendance_db;
  989. class PlayerStatPointDatabase : public YamlDatabase {
  990. private:
  991. std::unordered_map<uint16, uint32> statpoint_table;
  992. public:
  993. PlayerStatPointDatabase() : YamlDatabase("STATPOINT_DB", 1) {
  994. }
  995. void clear(){
  996. statpoint_table.clear();
  997. }
  998. const std::string getDefaultLocation();
  999. uint64 parseBodyNode(const YAML::Node& node);
  1000. void loadingFinished();
  1001. uint32 pc_gets_status_point(uint16 level);
  1002. uint32 get_table_point(uint16 level);
  1003. };
  1004. extern PlayerStatPointDatabase statpoint_db;
  1005. /// Enum of Summoner Power of
  1006. enum e_summoner_power_type {
  1007. SUMMONER_POWER_LAND = 0,
  1008. SUMMONER_POWER_LIFE,
  1009. SUMMONER_POWER_SEA,
  1010. };
  1011. void pc_set_reg_load(bool val);
  1012. int pc_split_atoi(char* str, int* val, char sep, int max);
  1013. int pc_class2idx(int class_);
  1014. int pc_get_group_level(struct map_session_data *sd);
  1015. int pc_get_group_id(struct map_session_data *sd);
  1016. bool pc_can_sell_item(struct map_session_data* sd, struct item * item, enum npc_subtype shoptype);
  1017. bool pc_can_give_items(struct map_session_data *sd);
  1018. bool pc_can_give_bounded_items(struct map_session_data *sd);
  1019. bool pc_can_trade_item(map_session_data *sd, int index);
  1020. bool pc_can_use_command(struct map_session_data *sd, const char *command, AtCommandType type);
  1021. #define pc_has_permission(sd, permission) ( ((sd)->permissions&permission) != 0 )
  1022. bool pc_should_log_commands(struct map_session_data *sd);
  1023. void pc_setrestartvalue(struct map_session_data *sd, char type);
  1024. void pc_makesavestatus(struct map_session_data *sd);
  1025. void pc_respawn(struct map_session_data* sd, clr_type clrtype);
  1026. 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);
  1027. 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);
  1028. void pc_authfail(struct map_session_data *sd);
  1029. void pc_reg_received(struct map_session_data *sd);
  1030. void pc_close_npc(struct map_session_data *sd,int flag);
  1031. TIMER_FUNC(pc_close_npc_timer);
  1032. void pc_setequipindex(struct map_session_data *sd);
  1033. uint8 pc_isequip(struct map_session_data *sd,int n);
  1034. int pc_equippoint(struct map_session_data *sd,int n);
  1035. int pc_equippoint_sub(struct map_session_data *sd, struct item_data* id);
  1036. void pc_setinventorydata(struct map_session_data *sd);
  1037. int pc_get_skillcooldown(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
  1038. uint8 pc_checkskill(struct map_session_data *sd,uint16 skill_id);
  1039. uint8 pc_checkskill_summoner(map_session_data *sd, e_summoner_power_type type);
  1040. short pc_checkequip(struct map_session_data *sd,int pos,bool checkall=false);
  1041. bool pc_checkequip2(struct map_session_data *sd, t_itemid nameid, int min, int max);
  1042. void pc_scdata_received(struct map_session_data *sd);
  1043. void pc_check_expiration(struct map_session_data *sd);
  1044. TIMER_FUNC(pc_expiration_timer);
  1045. TIMER_FUNC(pc_global_expiration_timer);
  1046. void pc_expire_check(struct map_session_data *sd);
  1047. void pc_calc_skilltree(struct map_session_data *sd);
  1048. int pc_calc_skilltree_normalize_job(struct map_session_data *sd);
  1049. void pc_clean_skilltree(struct map_session_data *sd);
  1050. #define pc_checkoverhp(sd) ((sd)->battle_status.hp == (sd)->battle_status.max_hp)
  1051. #define pc_checkoversp(sd) ((sd)->battle_status.sp == (sd)->battle_status.max_sp)
  1052. enum e_setpos{
  1053. SETPOS_OK = 0,
  1054. SETPOS_MAPINDEX = 1,
  1055. SETPOS_NO_MAPSERVER = 2,
  1056. SETPOS_AUTOTRADE = 3
  1057. };
  1058. enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype);
  1059. void pc_setsavepoint(struct map_session_data *sd, short mapindex,int x,int y);
  1060. char pc_randomwarp(struct map_session_data *sd,clr_type type,bool ignore_mapflag = false);
  1061. bool pc_memo(struct map_session_data* sd, int pos);
  1062. char pc_checkadditem(struct map_session_data *sd, t_itemid nameid, int amount);
  1063. uint8 pc_inventoryblank(struct map_session_data *sd);
  1064. short pc_search_inventory(struct map_session_data *sd, t_itemid nameid);
  1065. char pc_payzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
  1066. enum e_additem_result pc_additem(struct map_session_data *sd, struct item *item, int amount, e_log_pick_type log_type);
  1067. char pc_getzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
  1068. char pc_delitem(struct map_session_data *sd, int n, int amount, int type, short reason, e_log_pick_type log_type);
  1069. uint64 pc_generate_unique_id(struct map_session_data *sd);
  1070. //Bound items
  1071. int pc_bound_chk(TBL_PC *sd,enum bound_type type,int *idxlist);
  1072. // Special Shop System
  1073. int pc_paycash( struct map_session_data *sd, int price, int points, e_log_pick_type type );
  1074. int pc_getcash( struct map_session_data *sd, int cash, int points, e_log_pick_type type );
  1075. enum e_additem_result pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type);
  1076. void pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type);
  1077. void pc_putitemtocart(struct map_session_data *sd,int idx,int amount);
  1078. void pc_getitemfromcart(struct map_session_data *sd,int idx,int amount);
  1079. int pc_cartitem_amount(struct map_session_data *sd,int idx,int amount);
  1080. bool pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem);
  1081. bool pc_dropitem(struct map_session_data *sd,int n,int amount);
  1082. bool pc_isequipped(struct map_session_data *sd, t_itemid nameid);
  1083. enum adopt_responses pc_try_adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
  1084. bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
  1085. void pc_updateweightstatus(struct map_session_data *sd);
  1086. 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);
  1087. void pc_exeautobonus(struct map_session_data &sd, std::vector<std::shared_ptr<s_autobonus>> *bonus, std::shared_ptr<s_autobonus> autobonus);
  1088. TIMER_FUNC(pc_endautobonus);
  1089. void pc_delautobonus(struct map_session_data &sd, std::vector<std::shared_ptr<s_autobonus>> &bonus, bool restore);
  1090. void pc_bonus(struct map_session_data *sd, int type, int val);
  1091. void pc_bonus2(struct map_session_data *sd, int type, int type2, int val);
  1092. void pc_bonus3(struct map_session_data *sd, int type, int type2, int type3, int val);
  1093. void pc_bonus4(struct map_session_data *sd, int type, int type2, int type3, int type4, int val);
  1094. void pc_bonus5(struct map_session_data *sd, int type, int type2, int type3, int type4, int type5, int val);
  1095. enum e_addskill_type {
  1096. ADDSKILL_PERMANENT = 0, ///< Permanent skill. Remove the skill if level is 0
  1097. 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;`
  1098. 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
  1099. ADDSKILL_PERMANENT_GRANTED = 3, ///< Grant permanent skill, ignore skill tree and learned level
  1100. };
  1101. bool pc_skill(struct map_session_data *sd, uint16 skill_id, int level, enum e_addskill_type type);
  1102. int pc_insert_card(struct map_session_data *sd,int idx_card,int idx_equip);
  1103. int pc_identifyall(struct map_session_data *sd, bool identify_item);
  1104. bool pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skill_lv);
  1105. int pc_steal_coin(struct map_session_data *sd,struct block_list *bl);
  1106. int pc_modifybuyvalue(struct map_session_data*,int);
  1107. int pc_modifysellvalue(struct map_session_data*,int);
  1108. int pc_follow(struct map_session_data*, int); // [MouseJstr]
  1109. int pc_stop_following(struct map_session_data*);
  1110. unsigned int pc_maxbaselv(struct map_session_data *sd);
  1111. unsigned int pc_maxjoblv(struct map_session_data *sd);
  1112. bool pc_is_maxbaselv(struct map_session_data *sd);
  1113. bool pc_is_maxjoblv(struct map_session_data *sd);
  1114. int pc_checkbaselevelup(struct map_session_data *sd);
  1115. int pc_checkjoblevelup(struct map_session_data *sd);
  1116. void pc_gainexp(struct map_session_data *sd, struct block_list *src, t_exp base_exp, t_exp job_exp, uint8 exp_flag);
  1117. 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);
  1118. void pc_lostexp(struct map_session_data *sd, t_exp base_exp, t_exp job_exp);
  1119. t_exp pc_nextbaseexp(struct map_session_data *sd);
  1120. t_exp pc_nextjobexp(struct map_session_data *sd);
  1121. int pc_need_status_point(struct map_session_data *,int,int);
  1122. int pc_maxparameterincrease(struct map_session_data*,int);
  1123. bool pc_statusup(struct map_session_data*,int,int);
  1124. int pc_statusup2(struct map_session_data*,int,int);
  1125. void pc_skillup(struct map_session_data*,uint16 skill_id);
  1126. int pc_allskillup(struct map_session_data*);
  1127. int pc_resetlvl(struct map_session_data*,int type);
  1128. int pc_resetstate(struct map_session_data*);
  1129. int pc_resetskill(struct map_session_data*, int);
  1130. int pc_resetfeel(struct map_session_data*);
  1131. int pc_resethate(struct map_session_data*);
  1132. bool pc_equipitem(struct map_session_data *sd, short n, int req_pos, bool equipswitch=false);
  1133. bool pc_unequipitem(struct map_session_data*,int,int);
  1134. int pc_equipswitch( struct map_session_data* sd, int index );
  1135. void pc_equipswitch_remove( struct map_session_data* sd, int index );
  1136. void pc_checkitem(struct map_session_data*);
  1137. void pc_check_available_item(struct map_session_data *sd, uint8 type);
  1138. int pc_useitem(struct map_session_data*,int);
  1139. int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id);
  1140. int pc_sub_skillatk_bonus(struct map_session_data *sd, uint16 skill_id);
  1141. int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id);
  1142. int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id);
  1143. void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp);
  1144. int pc_dead(struct map_session_data *sd,struct block_list *src);
  1145. void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp);
  1146. bool pc_revive_item(struct map_session_data *sd);
  1147. void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int type);
  1148. int pc_itemheal(struct map_session_data *sd, t_itemid itemid, int hp,int sp);
  1149. int pc_percentheal(struct map_session_data *sd,int,int);
  1150. bool pc_jobchange(struct map_session_data *sd, int job, char upper);
  1151. void pc_setoption(struct map_session_data *,int type, int subtype = 0);
  1152. bool pc_setcart(struct map_session_data* sd, int type);
  1153. void pc_setfalcon(struct map_session_data* sd, int flag);
  1154. void pc_setriding(struct map_session_data* sd, int flag);
  1155. void pc_setmadogear(struct map_session_data* sd, bool flag, e_mado_type type = MADO_ROBOT);
  1156. void pc_changelook(struct map_session_data *,int,int);
  1157. void pc_equiplookall(struct map_session_data *sd);
  1158. void pc_set_costume_view(struct map_session_data *sd);
  1159. int64 pc_readparam(struct map_session_data *sd, int64 type);
  1160. bool pc_setparam(struct map_session_data *sd, int64 type, int64 val);
  1161. int64 pc_readreg(struct map_session_data *sd, int64 reg);
  1162. bool pc_setreg(struct map_session_data *sd, int64 reg, int64 val);
  1163. char *pc_readregstr(struct map_session_data *sd, int64 reg);
  1164. bool pc_setregstr(struct map_session_data *sd, int64 reg, const char *str);
  1165. int64 pc_readregistry(struct map_session_data *sd, int64 reg);
  1166. bool pc_setregistry(struct map_session_data *sd, int64 reg, int64 val);
  1167. char *pc_readregistry_str(struct map_session_data *sd, int64 reg);
  1168. bool pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val);
  1169. #define pc_readglobalreg(sd,reg) pc_readregistry(sd,reg)
  1170. #define pc_setglobalreg(sd,reg,val) pc_setregistry(sd,reg,val)
  1171. #define pc_readglobalreg_str(sd,reg) pc_readregistry_str(sd,reg)
  1172. #define pc_setglobalreg_str(sd,reg,val) pc_setregistry_str(sd,reg,val)
  1173. #define pc_readaccountreg(sd,reg) pc_readregistry(sd,reg)
  1174. #define pc_setaccountreg(sd,reg,val) pc_setregistry(sd,reg,val)
  1175. #define pc_readaccountregstr(sd,reg) pc_readregistry_str(sd,reg)
  1176. #define pc_setaccountregstr(sd,reg,val) pc_setregistry_str(sd,reg,val)
  1177. #define pc_readaccountreg2(sd,reg) pc_readregistry(sd,reg)
  1178. #define pc_setaccountreg2(sd,reg,val) pc_setregistry(sd,reg,val)
  1179. #define pc_readaccountreg2str(sd,reg) pc_readregistry_str(sd,reg)
  1180. #define pc_setaccountreg2str(sd,reg,val) pc_setregistry_str(sd,reg,val)
  1181. bool pc_setreg2(struct map_session_data *sd, const char *reg, int64 val);
  1182. int64 pc_readreg2(struct map_session_data *sd, const char *reg);
  1183. bool pc_addeventtimer(struct map_session_data *sd,int tick,const char *name);
  1184. bool pc_deleventtimer(struct map_session_data *sd,const char *name);
  1185. void pc_cleareventtimer(struct map_session_data *sd);
  1186. void pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick);
  1187. int pc_calc_pvprank(struct map_session_data *sd);
  1188. TIMER_FUNC(pc_calc_pvprank_timer);
  1189. int pc_ismarried(struct map_session_data *sd);
  1190. bool pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd);
  1191. bool pc_divorce(struct map_session_data *sd);
  1192. struct map_session_data *pc_get_partner(struct map_session_data *sd);
  1193. struct map_session_data *pc_get_father(struct map_session_data *sd);
  1194. struct map_session_data *pc_get_mother(struct map_session_data *sd);
  1195. struct map_session_data *pc_get_child(struct map_session_data *sd);
  1196. void pc_bleeding (struct map_session_data *sd, t_tick diff_tick);
  1197. void pc_regen (struct map_session_data *sd, t_tick diff_tick);
  1198. bool pc_setstand(struct map_session_data *sd, bool force);
  1199. bool pc_candrop(struct map_session_data *sd,struct item *item);
  1200. bool pc_can_attack(struct map_session_data *sd, int target_id);
  1201. int pc_jobid2mapid(unsigned short b_class); // Skotlex
  1202. int pc_mapid2jobid(unsigned short class_, int sex); // Skotlex
  1203. const char * job_name(int class_);
  1204. struct skill_tree_entry {
  1205. uint16 skill_id, skill_lv;
  1206. uint32 baselv, joblv;
  1207. struct {
  1208. uint16 skill_id, skill_lv;
  1209. } need[MAX_PC_SKILL_REQUIRE];
  1210. }; // Celest
  1211. extern struct skill_tree_entry skill_tree[CLASS_COUNT][MAX_SKILL_TREE];
  1212. struct sg_data {
  1213. short anger_id;
  1214. short bless_id;
  1215. short comfort_id;
  1216. char feel_var[NAME_LENGTH];
  1217. char hate_var[NAME_LENGTH];
  1218. bool (*day_func)(void);
  1219. };
  1220. extern const struct sg_data sg_info[MAX_PC_FEELHATE];
  1221. void pc_set_bg_queue_timer(map_session_data *sd);
  1222. void pc_delete_bg_queue_timer(map_session_data *sd);
  1223. void pc_setinvincibletimer(struct map_session_data* sd, int val);
  1224. void pc_delinvincibletimer(struct map_session_data* sd);
  1225. void pc_addspiritball(struct map_session_data *sd,int interval,int max);
  1226. void pc_delspiritball(struct map_session_data *sd,int count,int type);
  1227. int pc_addsoulball(map_session_data *sd, int max);
  1228. int pc_delsoulball(map_session_data *sd, int count, bool type);
  1229. void pc_addfame(struct map_session_data *sd,int count);
  1230. unsigned char pc_famerank(uint32 char_id, int job);
  1231. bool pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl);
  1232. extern struct fame_list smith_fame_list[MAX_FAME_LIST];
  1233. extern struct fame_list chemist_fame_list[MAX_FAME_LIST];
  1234. extern struct fame_list taekwon_fame_list[MAX_FAME_LIST];
  1235. void pc_readdb(void);
  1236. void do_init_pc(void);
  1237. void do_final_pc(void);
  1238. // timer for night.day
  1239. extern int day_timer_tid;
  1240. extern int night_timer_tid;
  1241. TIMER_FUNC(map_day_timer); // by [yor]
  1242. TIMER_FUNC(map_night_timer); // by [yor]
  1243. // Rental System
  1244. void pc_inventory_rentals(struct map_session_data *sd);
  1245. void pc_inventory_rental_clear(struct map_session_data *sd);
  1246. void pc_inventory_rental_add(struct map_session_data *sd, unsigned int seconds);
  1247. int pc_read_motd(void); // [Valaris]
  1248. int pc_disguise(struct map_session_data *sd, int class_);
  1249. bool pc_isautolooting(struct map_session_data *sd, t_itemid nameid);
  1250. void pc_overheat(struct map_session_data *sd, int16 heat);
  1251. void pc_itemcd_do(struct map_session_data *sd, bool load);
  1252. uint8 pc_itemcd_add(struct map_session_data *sd, struct item_data *id, t_tick tick, unsigned short n);
  1253. uint8 pc_itemcd_check(struct map_session_data *sd, struct item_data *id, t_tick tick, unsigned short n);
  1254. int pc_load_combo(struct map_session_data *sd);
  1255. void pc_addspiritcharm(struct map_session_data *sd, int interval, int max, int type);
  1256. void pc_delspiritcharm(struct map_session_data *sd, int count, int type);
  1257. void pc_baselevelchanged(struct map_session_data *sd);
  1258. void pc_damage_log_add(struct map_session_data *sd, int id);
  1259. void pc_damage_log_clear(struct map_session_data *sd, int id);
  1260. enum e_BANKING_DEPOSIT_ACK : uint8;
  1261. enum e_BANKING_WITHDRAW_ACK : uint8;
  1262. enum e_BANKING_DEPOSIT_ACK pc_bank_deposit(struct map_session_data *sd, int money);
  1263. enum e_BANKING_WITHDRAW_ACK pc_bank_withdraw(struct map_session_data *sd, int money);
  1264. void pc_crimson_marker_clear(struct map_session_data *sd);
  1265. void pc_show_version(struct map_session_data *sd);
  1266. TIMER_FUNC(pc_bonus_script_timer);
  1267. void pc_bonus_script(struct map_session_data *sd);
  1268. 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);
  1269. void pc_bonus_script_clear(struct map_session_data *sd, uint16 flag);
  1270. void pc_cell_basilica(struct map_session_data *sd);
  1271. short pc_get_itemgroup_bonus(struct map_session_data* sd, t_itemid nameid, std::vector<s_item_bonus>& bonuses);
  1272. short pc_get_itemgroup_bonus_group(struct map_session_data* sd, uint16 group_id, std::vector<s_item_bonus>& bonuses);
  1273. bool pc_is_same_equip_index(enum equip_index eqi, short *equip_index, short index);
  1274. /// Check if player is Taekwon Ranker and the level is >= 90 (battle_config.taekwon_ranker_min_lv)
  1275. #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))
  1276. TIMER_FUNC(pc_autotrade_timer);
  1277. void pc_validate_skill(struct map_session_data *sd);
  1278. void pc_show_questinfo(struct map_session_data *sd);
  1279. void pc_show_questinfo_reinit(struct map_session_data *sd);
  1280. bool pc_job_can_entermap(enum e_job jobid, int m, int group_lv);
  1281. #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
  1282. 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 );
  1283. #endif
  1284. bool pc_attendance_enabled();
  1285. int32 pc_attendance_counter( struct map_session_data* sd );
  1286. void pc_attendance_claim_reward( struct map_session_data* sd );
  1287. #endif /* PC_HPP */