pc.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  1. // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef _PC_H_
  4. #define _PC_H_
  5. #include "../common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus
  6. #include "../common/timer.h" // INVALID_TIMER
  7. #include "atcommand.h" // AtCommandType
  8. #include "battle.h" // battle_config
  9. #include "buyingstore.h" // struct s_buyingstore
  10. #include "itemdb.h" // MAX_ITEMGROUP
  11. #include "map.h" // RC_MAX
  12. #include "script.h" // struct script_reg, struct script_regstr
  13. #include "searchstore.h" // struct s_search_store_info
  14. #include "status.h" // OPTION_*, struct weapon_atk
  15. #include "unit.h" // unit_stop_attack(), unit_stop_walking()
  16. #include "vending.h" // struct s_vending
  17. #include "mob.h"
  18. #include "log.h"
  19. #include "pc_groups.h"
  20. #define MAX_PC_BONUS 10
  21. #define MAX_PC_SKILL_REQUIRE 5
  22. #define MAX_PC_FEELHATE 3
  23. //Equip indexes constants. (eg: sd->equip_index[EQI_AMMO] returns the index
  24. //where the arrows are equipped)
  25. enum equip_index {
  26. EQI_ACC_L = 0,
  27. EQI_ACC_R,
  28. EQI_SHOES,
  29. EQI_GARMENT,
  30. EQI_HEAD_LOW,
  31. EQI_HEAD_MID,
  32. EQI_HEAD_TOP,
  33. EQI_ARMOR,
  34. EQI_HAND_L,
  35. EQI_HAND_R,
  36. EQI_COSTUME_TOP,
  37. EQI_COSTUME_MID,
  38. EQI_COSTUME_LOW,
  39. EQI_COSTUME_GARMENT,
  40. EQI_AMMO,
  41. EQI_MAX
  42. };
  43. struct weapon_data {
  44. int atkmods[3];
  45. // all the variables except atkmods get zero'ed in each call of status_calc_pc
  46. // NOTE: if you want to add a non-zeroed variable, you need to update the memset call
  47. // in status_calc_pc as well! All the following are automatically zero'ed. [Skotlex]
  48. int overrefine;
  49. int star;
  50. int ignore_def_ele;
  51. int ignore_def_race;
  52. int def_ratio_atk_ele;
  53. int def_ratio_atk_race;
  54. int addele[ELE_MAX];
  55. int addrace[RC_MAX];
  56. int addrace2[RC2_MAX];
  57. int addsize[3];
  58. struct drain_data {
  59. short rate;
  60. short per;
  61. short value;
  62. unsigned type:1;
  63. } hp_drain[RC_MAX], sp_drain[RC_MAX];
  64. struct {
  65. short class_, rate;
  66. } add_dmg[MAX_PC_BONUS];
  67. struct {
  68. short flag, rate;
  69. unsigned char ele;
  70. } addele2[MAX_PC_BONUS];
  71. };
  72. struct s_autospell {
  73. short id, lv, rate, card_id, flag;
  74. bool lock; // bAutoSpellOnSkill: blocks autospell from triggering again, while being executed
  75. };
  76. struct s_addeffect {
  77. enum sc_type id;
  78. short rate, arrow_rate;
  79. unsigned char flag;
  80. };
  81. struct s_addeffectonskill {
  82. enum sc_type id;
  83. short rate, skill;
  84. unsigned char target;
  85. };
  86. struct s_add_drop {
  87. short id, group;
  88. int race, rate;
  89. };
  90. struct s_autobonus {
  91. short rate,atk_type;
  92. unsigned int duration;
  93. char *bonus_script, *other_script;
  94. int active;
  95. unsigned short pos;
  96. };
  97. enum npc_timeout_type {
  98. NPCT_INPUT = 0,
  99. NPCT_MENU = 1,
  100. NPCT_WAIT = 2,
  101. };
  102. struct map_session_data {
  103. struct block_list bl;
  104. struct unit_data ud;
  105. struct view_data vd;
  106. struct status_data base_status, battle_status;
  107. struct status_change sc;
  108. struct regen_data regen;
  109. struct regen_data_sub sregen, ssregen;
  110. //NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in
  111. //status_calc_pc, while special_state is recalculated in each call. [Skotlex]
  112. struct {
  113. unsigned int active : 1; //Marks active player (not active is logging in/out, or changing map servers)
  114. unsigned int menu_or_input : 1;// if a script is waiting for feedback from the player
  115. unsigned int dead_sit : 2;
  116. unsigned int lr_flag : 3;//1: left h. weapon; 2: arrow; 3: shield
  117. unsigned int connect_new : 1;
  118. unsigned int arrow_atk : 1;
  119. unsigned int gangsterparadise : 1;
  120. unsigned int rest : 1;
  121. unsigned int storage_flag : 2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex]
  122. unsigned int snovice_dead_flag : 1; //Explosion spirits on death: 0 off, 1 used.
  123. unsigned int abra_flag : 2; // Abracadabra bugfix by Aru
  124. unsigned int autocast : 1; // Autospell flag [Inkfish]
  125. unsigned int autotrade : 1; //By Fantik
  126. unsigned int reg_dirty : 4; //By Skotlex (marks whether registry variables have been saved or not yet)
  127. unsigned int showdelay :1;
  128. unsigned int showexp :1;
  129. unsigned int showzeny :1;
  130. unsigned int noask :1; // [LuzZza]
  131. unsigned int trading :1; //[Skotlex] is 1 only after a trade has started.
  132. unsigned int deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE
  133. unsigned int monster_ignore :1; // for monsters to ignore a character [Valaris] [zzo]
  134. unsigned int size :2; // for tiny/large types
  135. unsigned int night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex]
  136. unsigned int blockedmove :1;
  137. unsigned int using_fake_npc :1;
  138. unsigned int rewarp :1; //Signals that a player should warp as soon as he is done loading a map. [Skotlex]
  139. unsigned int killer : 1;
  140. unsigned int killable : 1;
  141. unsigned int doridori : 1;
  142. unsigned int ignoreAll : 1;
  143. unsigned int debug_remove_map : 1; // temporary state to track double remove_map's [FlavioJS]
  144. unsigned int buyingstore : 1;
  145. unsigned int lesseffect : 1;
  146. unsigned int vending : 1;
  147. unsigned int noks : 3; // [Zeph Kill Steal Protection]
  148. unsigned int changemap : 1;
  149. unsigned int callshop : 1; // flag to indicate that a script used callshop; on a shop
  150. short pmap; // Previous map on Map Change
  151. unsigned short autoloot;
  152. unsigned short autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus]
  153. unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid
  154. unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish]
  155. struct guild *gmaster_flag;
  156. unsigned int prevend : 1;//used to flag wheather you've spent 40sp to open the vending or not.
  157. unsigned int warping : 1;//states whether you're in the middle of a warp processing
  158. unsigned int permanent_speed : 1; // When 1, speed cannot be changed through status_calc_pc().
  159. } state;
  160. struct {
  161. unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
  162. unsigned int restart_full_recover : 1;
  163. unsigned int no_castcancel : 1;
  164. unsigned int no_castcancel2 : 1;
  165. unsigned int no_sizefix : 1;
  166. unsigned int no_gemstone : 1;
  167. unsigned int intravision : 1; // Maya Purple Card effect [DracoRPG]
  168. unsigned int perfect_hiding : 1; // [Valaris]
  169. unsigned int no_knockback : 1;
  170. unsigned int bonus_coma : 1;
  171. } special_state;
  172. int login_id1, login_id2;
  173. unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex]
  174. int group_id, group_pos, group_level;
  175. unsigned int permissions;/* group permissions */
  176. int langtype;
  177. int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18
  178. struct mmo_charstatus status;
  179. struct registry save_reg;
  180. struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups)
  181. short equip_index[EQI_MAX];
  182. unsigned int weight,max_weight;
  183. int cart_weight,cart_num,cart_weight_max;
  184. int fd;
  185. unsigned short mapindex;
  186. unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left.
  187. unsigned int client_tick;
  188. int npc_id,areanpc_id,npc_shopid,touching_id; //for script follow scriptoid; ,npcid
  189. int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse)
  190. int npc_menu; // internal variable, used in npc menu handling
  191. int npc_amount;
  192. struct script_state *st;
  193. char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine
  194. int npc_timer_id; //For player attached npc timers. [Skotlex]
  195. unsigned int chatID;
  196. time_t idletime;
  197. struct{
  198. int npc_id;
  199. unsigned int timeout;
  200. } progressbar; //Progress Bar [Inkfish]
  201. struct{
  202. char name[NAME_LENGTH];
  203. } ignore[MAX_IGNORE_LIST];
  204. int followtimer; // [MouseJstr]
  205. int followtarget;
  206. time_t emotionlasttime; // to limit flood with emotion packets
  207. short skillitem,skillitemlv;
  208. uint16 skill_id_old,skill_lv_old;
  209. uint16 skill_id_dance,skill_lv_dance;
  210. short cook_mastery; // range: [0,1999] [Inkfish]
  211. unsigned char blockskill[MAX_SKILL];
  212. int cloneskill_id, reproduceskill_id;
  213. int menuskill_id, menuskill_val, menuskill_val2;
  214. int invincible_timer;
  215. unsigned int canlog_tick;
  216. unsigned int canuseitem_tick; // [Skotlex]
  217. unsigned int canusecashfood_tick;
  218. unsigned int canequip_tick; // [Inkfish]
  219. unsigned int cantalk_tick;
  220. unsigned int canskill_tick; // used to prevent abuse from no-delay ACT files
  221. unsigned int cansendmail_tick; // [Mail System Flood Protection]
  222. unsigned int ks_floodprotect_tick; // [Kill Steal Protection]
  223. unsigned int bloodylust_tick; // bloodylust player timer [out/in re full-heal protection]
  224. struct {
  225. short nameid;
  226. unsigned int tick;
  227. } item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
  228. short weapontype1,weapontype2;
  229. short disguise; // [Valaris]
  230. struct weapon_data right_weapon, left_weapon;
  231. // here start arrays to be globally zeroed at the beginning of status_calc_pc()
  232. int param_bonus[6],param_equip[6]; //Stores card/equipment bonuses.
  233. int subele[ELE_MAX];
  234. int subrace[RC_MAX];
  235. int subrace2[RC2_MAX];
  236. int subsize[3];
  237. int reseff[SC_COMMON_MAX-SC_COMMON_MIN+1];
  238. int weapon_coma_ele[ELE_MAX];
  239. int weapon_coma_race[RC_MAX];
  240. int weapon_atk[16];
  241. int weapon_atk_rate[16];
  242. int arrow_addele[ELE_MAX];
  243. int arrow_addrace[RC_MAX];
  244. int arrow_addsize[3];
  245. int magic_addele[ELE_MAX];
  246. int magic_addrace[RC_MAX];
  247. int magic_addsize[3];
  248. int magic_atk_ele[ELE_MAX];
  249. int critaddrace[RC_MAX];
  250. int expaddrace[RC_MAX];
  251. int ignore_mdef[RC_MAX];
  252. int ignore_def[RC_MAX];
  253. int itemgrouphealrate[MAX_ITEMGROUP];
  254. short sp_gain_race[RC_MAX];
  255. short sp_gain_race_attack[RC_MAX];
  256. short hp_gain_race_attack[RC_MAX];
  257. // zeroed arrays end here.
  258. // zeroed structures start here
  259. struct s_autospell autospell[15], autospell2[15], autospell3[15];
  260. struct s_addeffect addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS];
  261. struct s_addeffectonskill addeff3[MAX_PC_BONUS];
  262. struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills.
  263. unsigned short id;
  264. short val;
  265. } skillatk[MAX_PC_BONUS], skillusesprate[MAX_PC_BONUS], skillusesp[MAX_PC_BONUS], skillheal[5], skillheal2[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS], skillcooldown[MAX_PC_BONUS], skillfixcast[MAX_PC_BONUS], skillvarcast[MAX_PC_BONUS], skillfixcastrate[MAX_PC_BONUS];
  266. struct {
  267. short value;
  268. int rate;
  269. int tick;
  270. } hp_loss, sp_loss, hp_regen, sp_regen;
  271. struct {
  272. short class_, rate;
  273. } add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS], add_mdmg[MAX_PC_BONUS];
  274. struct s_add_drop add_drop[MAX_PC_BONUS];
  275. struct {
  276. int nameid;
  277. int rate;
  278. } itemhealrate[MAX_PC_BONUS];
  279. struct {
  280. short flag, rate;
  281. unsigned char ele;
  282. } subele2[MAX_PC_BONUS];
  283. // zeroed structures end here
  284. // manually zeroed structures start here.
  285. struct s_autobonus autobonus[MAX_PC_BONUS], autobonus2[MAX_PC_BONUS], autobonus3[MAX_PC_BONUS]; //Auto script on attack, when attacked, on skill usage
  286. // manually zeroed structures end here.
  287. // zeroed vars start here.
  288. struct {
  289. int atk_rate;
  290. int arrow_atk,arrow_ele,arrow_cri,arrow_hit;
  291. int nsshealhp,nsshealsp;
  292. int critical_def,double_rate;
  293. int long_attack_atk_rate; //Long range atk rate, not weapon based. [Skotlex]
  294. int near_attack_def_rate,long_attack_def_rate,magic_def_rate,misc_def_rate;
  295. int ignore_mdef_ele;
  296. int ignore_mdef_race;
  297. int perfect_hit;
  298. int perfect_hit_add;
  299. int get_zeny_rate;
  300. int get_zeny_num; //Added Get Zeny Rate [Skotlex]
  301. int double_add_rate;
  302. int short_weapon_damage_return,long_weapon_damage_return;
  303. int magic_damage_return; // AppleGirl Was Here
  304. int break_weapon_rate,break_armor_rate;
  305. int crit_atk_rate;
  306. int classchange; // [Valaris]
  307. int speed_rate, speed_add_rate, aspd_add;
  308. int itemhealrate2; // [Epoque] Increase heal rate of all healing items.
  309. int shieldmdef;//royal guard's
  310. unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex]
  311. short splash_range, splash_add_range;
  312. short add_steal_rate;
  313. short add_heal_rate, add_heal2_rate;
  314. short sp_gain_value, hp_gain_value, magic_sp_gain_value, magic_hp_gain_value;
  315. short sp_vanish_rate;
  316. short sp_vanish_per;
  317. unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest]
  318. unsigned short unbreakable_equip; //100% break resistance on certain equipment
  319. unsigned short unstripable_equip;
  320. int fixcastrate,varcastrate;
  321. int add_fixcast,add_varcast;
  322. int ematk; // matk bonus from equipment
  323. // int eatk; // atk bonus from equipment
  324. } bonus;
  325. // zeroed vars end here.
  326. int castrate,delayrate,hprate,sprate,dsprate;
  327. int hprecov_rate,sprecov_rate;
  328. int matk_rate;
  329. int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate;
  330. int itemid;
  331. short itemindex; //Used item's index in sd->inventory [Skotlex]
  332. short catch_target_class; // pet catching, stores a pet class to catch (short now) [zzo]
  333. short spiritball, spiritball_old;
  334. int spirit_timer[MAX_SKILL_LEVEL];
  335. short talisman[ELE_POISON+1]; // There are actually 5 talisman Fire, Ice, Wind, Earth & Poison maybe because its color violet.
  336. int talisman_timer[ELE_POISON+1][10];
  337. unsigned char potion_success_counter; //Potion successes in row counter
  338. unsigned char mission_count; //Stores the bounty kill count for TK_MISSION
  339. short mission_mobid; //Stores the target mob_id for TK_MISSION
  340. int die_counter; //Total number of times you've died
  341. int devotion[5]; //Stores the account IDs of chars devoted to.
  342. int reg_num; //Number of registries (type numeric)
  343. int regstr_num; //Number of registries (type string)
  344. struct script_reg *reg;
  345. struct script_regstr *regstr;
  346. int trade_partner;
  347. struct {
  348. struct {
  349. short index, amount;
  350. } item[10];
  351. int zeny, weight;
  352. } deal;
  353. bool party_creating; // whether the char is requesting party creation
  354. bool party_joining; // whether the char is accepting party invitation
  355. int party_invite, party_invite_account; // for handling party invitation (holds party id and account id)
  356. int adopt_invite; // Adoption
  357. struct guild *guild; // [Ind] speed everything up
  358. int guild_invite,guild_invite_account;
  359. int guild_emblem_id,guild_alliance,guild_alliance_account;
  360. short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo]
  361. int guildspy; // [Syrus22]
  362. int partyspy; // [Syrus22]
  363. int vended_id;
  364. int vender_id;
  365. int vend_num;
  366. char message[MESSAGE_SIZE];
  367. struct s_vending vending[MAX_VENDING];
  368. unsigned int buyer_id; // uid of open buying store
  369. struct s_buyingstore buyingstore;
  370. struct s_search_store_info searchstore;
  371. struct pet_data *pd;
  372. struct homun_data *hd; // [blackhole89]
  373. struct mercenary_data *md;
  374. struct elemental_data *ed;
  375. struct{
  376. int m; //-1 - none, other: map index corresponding to map name.
  377. unsigned short index; //map index
  378. }feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars
  379. short hate_mob[3];
  380. int pvp_timer;
  381. short pvp_point;
  382. unsigned short pvp_rank, pvp_lastusers;
  383. unsigned short pvp_won, pvp_lost;
  384. char eventqueue[MAX_EVENTQUEUE][EVENT_NAME_LENGTH];
  385. int eventtimer[MAX_EVENTTIMER];
  386. unsigned short eventcount; // [celest]
  387. unsigned char change_level_2nd; // job level when changing from 1st to 2nd class [jobchange_level in global_reg_value]
  388. unsigned char change_level_3rd; // job level when changing from 2nd to 3rd class [jobchange_level_3rd in global_reg_value]
  389. char fakename[NAME_LENGTH]; // fake names [Valaris]
  390. int duel_group; // duel vars [LuzZza]
  391. int duel_invite;
  392. int killerrid, killedrid;
  393. int cashPoints, kafraPoints;
  394. int rental_timer;
  395. // Auction System [Zephyrus]
  396. struct {
  397. int index, amount;
  398. } auction;
  399. // Mail System [Zephyrus]
  400. struct {
  401. short nameid;
  402. int index, amount, zeny;
  403. struct mail_data inbox;
  404. bool changed; // if true, should sync with charserver on next mailbox request
  405. } mail;
  406. //Quest log system [Kevin] [Inkfish]
  407. int num_quests;
  408. int avail_quests;
  409. int quest_index[MAX_QUEST_DB];
  410. struct quest quest_log[MAX_QUEST_DB];
  411. bool save_quest;
  412. // temporary debug [flaviojs]
  413. const char* debug_file;
  414. int debug_line;
  415. const char* debug_func;
  416. unsigned int bg_id;
  417. unsigned short user_font;
  418. #ifdef SECURE_NPCTIMEOUT
  419. /**
  420. * ID of the timer
  421. * @info
  422. * - value is -1 (INVALID_TIMER constant) when not being used
  423. * - timer is cancelled upon closure of the current npc's instance
  424. **/
  425. int npc_idle_timer;
  426. /**
  427. * Tick on the last recorded NPC iteration (next/menu/whatever)
  428. * @info
  429. * - It is updated on every NPC iteration as mentioned above
  430. **/
  431. unsigned int npc_idle_tick;
  432. /* */
  433. enum npc_timeout_type npc_idle_type;
  434. #endif
  435. struct {
  436. struct script_code **bonus;/* the script */
  437. unsigned short *id;/* array of combo ids */
  438. unsigned char count;
  439. } combos;
  440. /**
  441. * Guarantees your friend request is legit (for bugreport:4629)
  442. **/
  443. int friend_req;
  444. int shadowform_id;
  445. /* Channel System [Ind] */
  446. struct Channel **channels;
  447. unsigned char channel_count;
  448. struct Channel *gcbind;
  449. bool stealth;
  450. unsigned char fontcolor; /* debug-only */
  451. unsigned int channel_tick;
  452. // temporary debugging of bug #3504
  453. const char* delunit_prevfile;
  454. int delunit_prevline;
  455. };
  456. //Update this max as necessary. 55 is the value needed for Super Baby currently
  457. //Raised to 84 since Expanded Super Novice needs it.
  458. #define MAX_SKILL_TREE 84
  459. //Total number of classes (for data storage)
  460. #define CLASS_COUNT (JOB_MAX - JOB_NOVICE_HIGH + JOB_MAX_BASIC)
  461. enum weapon_type {
  462. W_FIST, //Bare hands
  463. W_DAGGER, //1
  464. W_1HSWORD, //2
  465. W_2HSWORD, //3
  466. W_1HSPEAR, //4
  467. W_2HSPEAR, //5
  468. W_1HAXE, //6
  469. W_2HAXE, //7
  470. W_MACE, //8
  471. W_2HMACE, //9 (unused)
  472. W_STAFF, //10
  473. W_BOW, //11
  474. W_KNUCKLE, //12
  475. W_MUSICAL, //13
  476. W_WHIP, //14
  477. W_BOOK, //15
  478. W_KATAR, //16
  479. W_REVOLVER, //17
  480. W_RIFLE, //18
  481. W_GATLING, //19
  482. W_SHOTGUN, //20
  483. W_GRENADE, //21
  484. W_HUUMA, //22
  485. W_2HSTAFF, //23
  486. MAX_WEAPON_TYPE,
  487. // dual-wield constants
  488. W_DOUBLE_DD, // 2 daggers
  489. W_DOUBLE_SS, // 2 swords
  490. W_DOUBLE_AA, // 2 axes
  491. W_DOUBLE_DS, // dagger + sword
  492. W_DOUBLE_DA, // dagger + axe
  493. W_DOUBLE_SA, // sword + axe
  494. };
  495. enum ammo_type {
  496. A_ARROW = 1,
  497. A_DAGGER, //2
  498. A_BULLET, //3
  499. A_SHELL, //4
  500. A_GRENADE, //5
  501. A_SHURIKEN, //6
  502. A_KUNAI, //7
  503. A_CANNONBALL, //8
  504. A_THROWWEAPON //9
  505. };
  506. //Equip position constants
  507. enum equip_pos {
  508. EQP_HEAD_LOW = 0x0001,
  509. EQP_HEAD_MID = 0x0200, //512
  510. EQP_HEAD_TOP = 0x0100, //256
  511. EQP_HAND_R = 0x0002, //2
  512. EQP_HAND_L = 0x0020, //32
  513. EQP_ARMOR = 0x0010, //16
  514. EQP_SHOES = 0x0040, //64
  515. EQP_GARMENT = 0x0004, //4
  516. EQP_ACC_L = 0x0008, //8
  517. EQP_ACC_R = 0x0080, //128
  518. EQP_COSTUME_HEAD_TOP = 0x0400, //1024
  519. EQP_COSTUME_HEAD_MID = 0x0800, //2048
  520. EQP_COSTUME_HEAD_LOW = 0x1000, //4096
  521. EQP_COSTUME_GARMENT = 0x2000, //8192
  522. EQP_AMMO = 0x8000, //32768
  523. //EQP_COSTUME_FLOOR = 0x4000,
  524. //EQP_SHADOW_ARMOR = 0x10000,//Shadow equip slots will be left disabled until client's supporting them are usable. [Rytech]
  525. //EQP_SHADOW_WEAPON = 0x20000,
  526. //EQP_SHADOW_SHIELD = 0x40000,
  527. //EQP_SHADOW_SHOES = 0x80000,
  528. //EQP_SHADOW_ACC_R = 0x100000,
  529. //EQP_SHADOW_ACC_L = 0x200000,
  530. };
  531. #define EQP_WEAPON EQP_HAND_R
  532. #define EQP_SHIELD EQP_HAND_L
  533. #define EQP_ARMS (EQP_HAND_R|EQP_HAND_L)
  534. #define EQP_HELM (EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)
  535. #define EQP_ACC (EQP_ACC_L|EQP_ACC_R)
  536. #define EQP_COSTUME (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)
  537. //#define EQP_SHADOW_GEAR (EQP_SHADOW_ARMOR|EQP_SHADOW_WEAPON|EQP_SHADOW_SHIELD|EQP_SHADOW_SHOES|EQP_SHADOW_ACC_R|EQP_SHADOW_ACC_L)
  538. /// Equip positions that use a visible sprite
  539. #if PACKETVER < 20110111
  540. #define EQP_VISIBLE EQP_HELM
  541. #else
  542. #define EQP_VISIBLE (EQP_HELM|EQP_GARMENT|EQP_COSTUME)
  543. #endif
  544. #define pc_setdead(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 )
  545. #define pc_setsit(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 )
  546. #define pc_isdead(sd) ( (sd)->state.dead_sit == 1 )
  547. #define pc_issit(sd) ( (sd)->vd.dead_sit == 2 )
  548. #define pc_isidle(sd) ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(last_tick, (sd)->idletime) >= battle_config.idle_no_share )
  549. #define pc_istrading(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )
  550. #define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )
  551. /* equals pc_cant_act except it doesn't check for chat rooms */
  552. #define pc_cant_act2(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )
  553. #define pc_setdir(sd,b,h) ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) )
  554. #define pc_setchatid(sd,n) ( (sd)->chatID = n )
  555. #define pc_ishiding(sd) ( (sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) )
  556. #define pc_iscloaking(sd) ( !((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK) )
  557. #define pc_ischasewalk(sd) ( (sd)->sc.option&OPTION_CHASEWALK )
  558. #ifdef NEW_CARTS
  559. #define pc_iscarton(sd) ( (sd)->sc.data[SC_PUSH_CART] )
  560. #else
  561. #define pc_iscarton(sd) ( (sd)->sc.option&OPTION_CART )
  562. #endif
  563. #define pc_isfalcon(sd) ( (sd)->sc.option&OPTION_FALCON )
  564. #define pc_isriding(sd) ( (sd)->sc.option&OPTION_RIDING )
  565. #define pc_isinvisible(sd) ( (sd)->sc.option&OPTION_INVISIBLE )
  566. #define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle_config.natural_heal_weight_rate )
  567. #define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 )
  568. #define pc_maxparameter(sd) ( ((((sd)->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO) || (sd)->class_&JOBL_THIRD ? ((sd)->class_&JOBL_BABY ? battle_config.max_baby_third_parameter : battle_config.max_third_parameter) : ((sd)->class_&JOBL_BABY ? battle_config.max_baby_parameter : battle_config.max_parameter)) )
  569. /**
  570. * Ranger
  571. **/
  572. #define pc_iswug(sd) ( (sd)->sc.option&OPTION_WUG )
  573. #define pc_isridingwug(sd) ( (sd)->sc.option&OPTION_WUGRIDER )
  574. // Mechanic Magic Gear
  575. #define pc_ismadogear(sd) ( (sd)->sc.option&OPTION_MADOGEAR )
  576. // Rune Knight Dragon
  577. #define pc_isridingdragon(sd) ( (sd)->sc.option&OPTION_DRAGON )
  578. #define pc_stop_walking(sd, type) unit_stop_walking(&(sd)->bl, type)
  579. #define pc_stop_attack(sd) unit_stop_attack(&(sd)->bl)
  580. //Weapon check considering dual wielding.
  581. #define pc_check_weapontype(sd, type) ((type)&((sd)->status.weapon < MAX_WEAPON_TYPE? \
  582. 1<<(sd)->status.weapon:(1<<(sd)->weapontype1)|(1<<(sd)->weapontype2)|(1<<(sd)->status.weapon)))
  583. //Checks if the given class value corresponds to a player class. [Skotlex]
  584. //JOB_NOVICE isn't checked for class_ is supposed to be unsigned
  585. #define pcdb_checkid_sub(class_) \
  586. ( \
  587. ( (class_) < JOB_MAX_BASIC ) \
  588. || ( (class_) >= JOB_NOVICE_HIGH && (class_) <= JOB_DARK_COLLECTOR ) \
  589. || ( (class_) >= JOB_RUNE_KNIGHT && (class_) <= JOB_MECHANIC_T2 ) \
  590. || ( (class_) >= JOB_BABY_RUNE && (class_) <= JOB_BABY_MECHANIC2 ) \
  591. || ( (class_) >= JOB_SUPER_NOVICE_E && (class_) <= JOB_SUPER_BABY_E ) \
  592. || ( (class_) >= JOB_KAGEROU && (class_) < JOB_MAX ) \
  593. )
  594. #define pcdb_checkid(class_) pcdb_checkid_sub((unsigned int)class_)
  595. // clientside display macros (values to the left/right of the "+")
  596. #ifdef RENEWAL
  597. #define pc_leftside_atk(sd) ((sd)->battle_status.batk)
  598. #define pc_rightside_atk(sd) ((sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk + (sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2)
  599. #define pc_leftside_def(sd) ((sd)->battle_status.def2)
  600. #define pc_rightside_def(sd) ((sd)->battle_status.def)
  601. #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef2)
  602. #define pc_rightside_mdef(sd) ((sd)->battle_status.mdef)
  603. #define pc_leftside_matk(sd) (status_base_matk(status_get_status_data(&(sd)->bl), (sd)->status.base_level))
  604. #define pc_rightside_matk(sd) ((sd)->battle_status.rhw.matk+(sd)->bonus.ematk)
  605. #else
  606. #define pc_leftside_atk(sd) ((sd)->battle_status.batk + (sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk)
  607. #define pc_rightside_atk(sd) ((sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2)
  608. #define pc_leftside_def(sd) ((sd)->battle_status.def)
  609. #define pc_rightside_def(sd) ((sd)->battle_status.def2)
  610. #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef)
  611. #define pc_rightside_mdef(sd) ( (sd)->battle_status.mdef2 - ((sd)->battle_status.vit>>1) )
  612. #define pc_leftside_matk(sd) \
  613. (\
  614. ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \
  615. ?((sd)->battle_status.matk_min * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \
  616. :(sd)->battle_status.matk_min \
  617. )
  618. #define pc_rightside_matk(sd) \
  619. (\
  620. ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \
  621. ?((sd)->battle_status.matk_max * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \
  622. :(sd)->battle_status.matk_max \
  623. )
  624. #endif
  625. int pc_class2idx(int class_);
  626. int pc_get_group_level(struct map_session_data *sd);
  627. int pc_get_group_id(struct map_session_data *sd);
  628. int pc_getrefinebonus(int lv,int type);
  629. bool pc_can_give_items(struct map_session_data *sd);
  630. bool pc_can_use_command(struct map_session_data *sd, const char *command, AtCommandType type);
  631. #define pc_has_permission(sd, permission) ( ((sd)->permissions&permission) != 0 )
  632. bool pc_should_log_commands(struct map_session_data *sd);
  633. int pc_setrestartvalue(struct map_session_data *sd,int type);
  634. int pc_makesavestatus(struct map_session_data *);
  635. void pc_respawn(struct map_session_data* sd, clr_type clrtype);
  636. int pc_setnewpc(struct map_session_data*,int,int,int,unsigned int,int,int);
  637. bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers);
  638. void pc_authfail(struct map_session_data *);
  639. int pc_reg_received(struct map_session_data *sd);
  640. void pc_close_npc(struct map_session_data *sd,int flag);
  641. int pc_isequip(struct map_session_data *sd,int n);
  642. int pc_equippoint(struct map_session_data *sd,int n);
  643. int pc_setinventorydata(struct map_session_data *sd);
  644. int pc_checkskill(struct map_session_data *sd,uint16 skill_id);
  645. int pc_checkallowskill(struct map_session_data *sd);
  646. int pc_checkequip(struct map_session_data *sd,int pos);
  647. int pc_calc_skilltree(struct map_session_data *sd);
  648. int pc_calc_skilltree_normalize_job(struct map_session_data *sd);
  649. int pc_clean_skilltree(struct map_session_data *sd);
  650. #define pc_checkoverhp(sd) ((sd)->battle_status.hp == (sd)->battle_status.max_hp)
  651. #define pc_checkoversp(sd) ((sd)->battle_status.sp == (sd)->battle_status.max_sp)
  652. int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype);
  653. int pc_setsavepoint(struct map_session_data*,short,int,int);
  654. int pc_randomwarp(struct map_session_data *sd,clr_type type);
  655. int pc_memo(struct map_session_data* sd, int pos);
  656. int pc_checkadditem(struct map_session_data*,int,int);
  657. int pc_inventoryblank(struct map_session_data*);
  658. int pc_search_inventory(struct map_session_data *sd,int item_id);
  659. int pc_payzeny(struct map_session_data*,int, enum e_log_pick_type type, struct map_session_data*);
  660. int pc_additem(struct map_session_data*,struct item*,int,e_log_pick_type);
  661. int pc_getzeny(struct map_session_data*,int, enum e_log_pick_type, struct map_session_data*);
  662. int pc_delitem(struct map_session_data*,int,int,int,short,e_log_pick_type);
  663. // Special Shop System
  664. int pc_paycash( struct map_session_data *sd, int price, int points, e_log_pick_type type );
  665. int pc_getcash( struct map_session_data *sd, int cash, int points, e_log_pick_type type );
  666. int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type);
  667. int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type);
  668. int pc_putitemtocart(struct map_session_data *sd,int idx,int amount);
  669. int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount);
  670. int pc_cartitem_amount(struct map_session_data *sd,int idx,int amount);
  671. int pc_takeitem(struct map_session_data*,struct flooritem_data*);
  672. int pc_dropitem(struct map_session_data*,int,int);
  673. bool pc_isequipped(struct map_session_data *sd, int nameid);
  674. bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd );
  675. bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
  676. int pc_updateweightstatus(struct map_session_data *sd);
  677. int pc_addautobonus(struct s_autobonus *bonus,char max,const char *script,short rate,unsigned int dur,short atk_type,const char *o_script,unsigned short pos,bool onskill);
  678. int pc_exeautobonus(struct map_session_data* sd,struct s_autobonus *bonus);
  679. int pc_endautobonus(int tid, unsigned int tick, int id, intptr_t data);
  680. int pc_delautobonus(struct map_session_data* sd,struct s_autobonus *bonus,char max,bool restore);
  681. int pc_bonus(struct map_session_data*,int,int);
  682. int pc_bonus2(struct map_session_data *sd,int,int,int);
  683. int pc_bonus3(struct map_session_data *sd,int,int,int,int);
  684. int pc_bonus4(struct map_session_data *sd,int,int,int,int,int);
  685. int pc_bonus5(struct map_session_data *sd,int,int,int,int,int,int);
  686. int pc_skill(struct map_session_data* sd, int id, int level, int flag);
  687. int pc_insert_card(struct map_session_data *sd,int idx_card,int idx_equip);
  688. int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skill_lv);
  689. int pc_steal_coin(struct map_session_data *sd,struct block_list *bl);
  690. int pc_modifybuyvalue(struct map_session_data*,int);
  691. int pc_modifysellvalue(struct map_session_data*,int);
  692. int pc_follow(struct map_session_data*, int); // [MouseJstr]
  693. int pc_stop_following(struct map_session_data*);
  694. unsigned int pc_maxbaselv(struct map_session_data *sd);
  695. unsigned int pc_maxjoblv(struct map_session_data *sd);
  696. int pc_checkbaselevelup(struct map_session_data *sd);
  697. int pc_checkjoblevelup(struct map_session_data *sd);
  698. int pc_gainexp(struct map_session_data*,struct block_list*,unsigned int,unsigned int, bool);
  699. unsigned int pc_nextbaseexp(struct map_session_data *);
  700. unsigned int pc_thisbaseexp(struct map_session_data *);
  701. unsigned int pc_nextjobexp(struct map_session_data *);
  702. unsigned int pc_thisjobexp(struct map_session_data *);
  703. int pc_gets_status_point(int);
  704. int pc_need_status_point(struct map_session_data *,int,int);
  705. int pc_statusup(struct map_session_data*,int);
  706. int pc_statusup2(struct map_session_data*,int,int);
  707. int pc_skillup(struct map_session_data*,uint16 skill_id);
  708. int pc_allskillup(struct map_session_data*);
  709. int pc_resetlvl(struct map_session_data*,int type);
  710. int pc_resetstate(struct map_session_data*);
  711. int pc_resetskill(struct map_session_data*, int);
  712. int pc_resetfeel(struct map_session_data*);
  713. int pc_resethate(struct map_session_data*);
  714. int pc_equipitem(struct map_session_data*,int,int);
  715. int pc_unequipitem(struct map_session_data*,int,int);
  716. int pc_checkitem(struct map_session_data*);
  717. int pc_useitem(struct map_session_data*,int);
  718. int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id);
  719. int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id);
  720. int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id);
  721. void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp);
  722. int pc_dead(struct map_session_data *sd,struct block_list *src);
  723. void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp);
  724. void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int type);
  725. int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp);
  726. int pc_percentheal(struct map_session_data *sd,int,int);
  727. int pc_jobchange(struct map_session_data *,int, int);
  728. int pc_setoption(struct map_session_data *,int);
  729. int pc_setcart(struct map_session_data* sd, int type);
  730. int pc_setfalcon(struct map_session_data* sd, int flag);
  731. int pc_setriding(struct map_session_data* sd, int flag);
  732. int pc_setmadogear(struct map_session_data* sd, int flag);
  733. int pc_changelook(struct map_session_data *,int,int);
  734. int pc_equiplookall(struct map_session_data *sd);
  735. int pc_readparam(struct map_session_data*,int);
  736. int pc_setparam(struct map_session_data*,int,int);
  737. int pc_readreg(struct map_session_data*,int);
  738. int pc_setreg(struct map_session_data*,int,int);
  739. char *pc_readregstr(struct map_session_data *sd,int reg);
  740. int pc_setregstr(struct map_session_data *sd,int reg,const char *str);
  741. #define pc_readglobalreg(sd,reg) pc_readregistry(sd,reg,3)
  742. #define pc_setglobalreg(sd,reg,val) pc_setregistry(sd,reg,val,3)
  743. #define pc_readglobalreg_str(sd,reg) pc_readregistry_str(sd,reg,3)
  744. #define pc_setglobalreg_str(sd,reg,val) pc_setregistry_str(sd,reg,val,3)
  745. #define pc_readaccountreg(sd,reg) pc_readregistry(sd,reg,2)
  746. #define pc_setaccountreg(sd,reg,val) pc_setregistry(sd,reg,val,2)
  747. #define pc_readaccountregstr(sd,reg) pc_readregistry_str(sd,reg,2)
  748. #define pc_setaccountregstr(sd,reg,val) pc_setregistry_str(sd,reg,val,2)
  749. #define pc_readaccountreg2(sd,reg) pc_readregistry(sd,reg,1)
  750. #define pc_setaccountreg2(sd,reg,val) pc_setregistry(sd,reg,val,1)
  751. #define pc_readaccountreg2str(sd,reg) pc_readregistry_str(sd,reg,1)
  752. #define pc_setaccountreg2str(sd,reg,val) pc_setregistry_str(sd,reg,val,1)
  753. int pc_readregistry(struct map_session_data*,const char*,int);
  754. int pc_setregistry(struct map_session_data*,const char*,int,int);
  755. char *pc_readregistry_str(struct map_session_data*,const char*,int);
  756. int pc_setregistry_str(struct map_session_data*,const char*,const char*,int);
  757. int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name);
  758. int pc_deleventtimer(struct map_session_data *sd,const char *name);
  759. int pc_cleareventtimer(struct map_session_data *sd);
  760. int pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick);
  761. int pc_calc_pvprank(struct map_session_data *sd);
  762. int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr_t data);
  763. int pc_ismarried(struct map_session_data *sd);
  764. int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd);
  765. int pc_divorce(struct map_session_data *sd);
  766. struct map_session_data *pc_get_partner(struct map_session_data *sd);
  767. struct map_session_data *pc_get_father(struct map_session_data *sd);
  768. struct map_session_data *pc_get_mother(struct map_session_data *sd);
  769. struct map_session_data *pc_get_child(struct map_session_data *sd);
  770. void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick);
  771. void pc_regen (struct map_session_data *sd, unsigned int diff_tick);
  772. void pc_setstand(struct map_session_data *sd);
  773. int pc_candrop(struct map_session_data *sd,struct item *item);
  774. int pc_jobid2mapid(unsigned short b_class); // Skotlex
  775. int pc_mapid2jobid(unsigned short class_, int sex); // Skotlex
  776. const char * job_name(int class_);
  777. struct skill_tree_entry {
  778. short id;
  779. unsigned char max;
  780. unsigned char joblv;
  781. struct {
  782. short id;
  783. unsigned char lv;
  784. } need[MAX_PC_SKILL_REQUIRE];
  785. }; // Celest
  786. extern struct skill_tree_entry skill_tree[CLASS_COUNT][MAX_SKILL_TREE];
  787. struct sg_data {
  788. short anger_id;
  789. short bless_id;
  790. short comfort_id;
  791. char feel_var[NAME_LENGTH];
  792. char hate_var[NAME_LENGTH];
  793. int (*day_func)(void);
  794. };
  795. extern const struct sg_data sg_info[MAX_PC_FEELHATE];
  796. void pc_setinvincibletimer(struct map_session_data* sd, int val);
  797. void pc_delinvincibletimer(struct map_session_data* sd);
  798. int pc_addspiritball(struct map_session_data *sd,int,int);
  799. int pc_delspiritball(struct map_session_data *sd,int,int);
  800. void pc_addfame(struct map_session_data *sd,int count);
  801. unsigned char pc_famerank(int char_id, int job);
  802. int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl);
  803. extern struct fame_list smith_fame_list[MAX_FAME_LIST];
  804. extern struct fame_list chemist_fame_list[MAX_FAME_LIST];
  805. extern struct fame_list taekwon_fame_list[MAX_FAME_LIST];
  806. int pc_readdb(void);
  807. int do_init_pc(void);
  808. void do_final_pc(void);
  809. enum {CHKADDITEM_EXIST,CHKADDITEM_NEW,CHKADDITEM_OVERAMOUNT};
  810. enum {
  811. ADDITEM_SUCCESS,
  812. ADDITEM_INVALID,
  813. ADDITEM_OVERWEIGHT,
  814. ADDITEM_OVERITEM=4,
  815. ADDITEM_OVERAMOUNT,
  816. ADDITEM_STACKLIMIT=7
  817. };
  818. // timer for night.day
  819. extern int day_timer_tid;
  820. extern int night_timer_tid;
  821. int map_day_timer(int tid, unsigned int tick, int id, intptr_t data); // by [yor]
  822. int map_night_timer(int tid, unsigned int tick, int id, intptr_t data); // by [yor]
  823. // Rental System
  824. void pc_inventory_rentals(struct map_session_data *sd);
  825. int pc_inventory_rental_clear(struct map_session_data *sd);
  826. void pc_inventory_rental_add(struct map_session_data *sd, int seconds);
  827. int pc_read_motd(void); // [Valaris]
  828. int pc_disguise(struct map_session_data *sd, int class_);
  829. bool pc_isautolooting(struct map_session_data *sd, int nameid);
  830. void pc_overheat(struct map_session_data *sd, int val);
  831. int pc_banding(struct map_session_data *sd, uint16 skill_lv);
  832. void pc_itemcd_do(struct map_session_data *sd, bool load);
  833. int pc_load_combo(struct map_session_data *sd);
  834. int pc_add_talisman(struct map_session_data *sd,int interval,int max,int type);
  835. int pc_del_talisman(struct map_session_data *sd,int count,int type);
  836. void pc_baselevelchanged(struct map_session_data *sd);
  837. #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
  838. int pc_level_penalty_mod(struct map_session_data *sd, int mob_level, uint32 mob_race, uint32 mob_mode, int type);
  839. #endif
  840. #endif /* _PC_H_ */