pc.h 40 KB

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