Guest User

Untitled

a guest
Feb 10th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.53 KB | None | 0 0
  1. // Copyright (c) Hercules Dev Team, licensed under GNU GPL.
  2. // See the LICENSE file
  3. // Portions Copyright (c) Athena Dev Teams
  4.  
  5. #ifndef MAP_PC_H
  6. #define MAP_PC_H
  7.  
  8. #include "map/adelays.h"
  9. #include "map/battle.h" // battle
  10. #include "map/battleground.h" // enum bg_queue_types
  11. #include "map/buyingstore.h" // struct s_buyingstore
  12. #include "map/itemdb.h" // MAX_ITEMDELAYS
  13. #include "map/log.h" // struct e_log_pick_type
  14. #include "map/map.h" // RC_MAX, ELE_MAX
  15. #include "map/pc_groups.h" // GroupSettings
  16. #include "map/script.h" // struct reg_db
  17. #include "map/searchstore.h" // struct s_search_store_info
  18. #include "map/status.h" // enum sc_type, OPTION_*
  19. #include "map/unit.h" // struct unit_data, struct view_data
  20. #include "map/vending.h" // struct s_vending
  21. #include "common/hercules.h"
  22. #include "common/ers.h" // struct eri
  23. #include "common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus, NEW_CARTS
  24.  
  25. /**
  26. * Defines
  27. **/
  28. #define MAX_PC_BONUS 10
  29. #define MAX_PC_SKILL_REQUIRE 5
  30. #define MAX_PC_FEELHATE 3
  31. #define MAX_PC_DEVOTION 5 ///< Max amount of devotion targets
  32. #define PVP_CALCRANK_INTERVAL 1000 ///< PVP calculation interval
  33.  
  34. //Equip indexes constants. (eg: sd->equip_index[EQI_AMMO] returns the index
  35. //where the arrows are equipped)
  36. enum equip_index {
  37. EQI_ACC_L = 0,
  38. EQI_ACC_R,
  39. EQI_SHOES,
  40. EQI_GARMENT,
  41. EQI_HEAD_LOW,
  42. EQI_HEAD_MID,
  43. EQI_HEAD_TOP,
  44. EQI_ARMOR,
  45. EQI_HAND_L,
  46. EQI_HAND_R,
  47. EQI_COSTUME_TOP,
  48. EQI_COSTUME_MID,
  49. EQI_COSTUME_LOW,
  50. EQI_COSTUME_GARMENT,
  51. EQI_AMMO,
  52. EQI_SHADOW_ARMOR,
  53. EQI_SHADOW_WEAPON,
  54. EQI_SHADOW_SHIELD,
  55. EQI_SHADOW_SHOES,
  56. EQI_SHADOW_ACC_R,
  57. EQI_SHADOW_ACC_L,
  58. EQI_MAX
  59. };
  60.  
  61. enum pc_unequipitem_flag {
  62. PCUNEQUIPITEM_NONE = 0x0, ///< Just unequip
  63. PCUNEQUIPITEM_RECALC = 0x1, ///< Recalculate status after unequipping
  64. PCUNEQUIPITEM_FORCE = 0x2, ///< Force unequip
  65. };
  66.  
  67. enum pc_resetskill_flag {
  68. PCRESETSKILL_NONE = 0x0,
  69. PCRESETSKILL_RESYNC = 0x1, // perform block resync and status_calc call
  70. PCRESETSKILL_RECOUNT = 0x2, // just count total amount of skill points used by player, do not really reset
  71. PCRESETSKILL_CHSEX = 0x4, // just reset the skills if the player class is a bard/dancer type (for changesex.)
  72. };
  73.  
  74. struct weapon_data {
  75. int atkmods[3];
  76. BEGIN_ZEROED_BLOCK; // all the variables within this block get zero'ed in each call of status_calc_pc
  77. int overrefine;
  78. int star;
  79. int ignore_def_ele;
  80. int ignore_def_race;
  81. int def_ratio_atk_ele;
  82. int def_ratio_atk_race;
  83. int addele[ELE_MAX];
  84. int addrace[RC_MAX];
  85. int addrace2[RC2_MAX];
  86. int addsize[3];
  87. struct drain_data {
  88. short rate;
  89. short per;
  90. short value;
  91. unsigned type:1;
  92. } hp_drain[RC_MAX], sp_drain[RC_MAX];
  93. struct {
  94. short class_, rate;
  95. } add_dmg[MAX_PC_BONUS];
  96. struct {
  97. short flag, rate;
  98. unsigned char ele;
  99. } addele2[MAX_PC_BONUS];
  100. END_ZEROED_BLOCK;
  101. };
  102. struct s_autospell {
  103. short id, lv, rate, card_id, flag;
  104. bool lock; // bAutoSpellOnSkill: blocks autospell from triggering again, while being executed
  105. };
  106. /// AddEff bonus data
  107. struct s_addeffect {
  108. enum sc_type id; ///< Effect ID
  109. int16 rate; ///< Base success rate
  110. int16 arrow_rate; ///< Success rate modifier for ranged attacks (adds to the base rate)
  111. uint8 flag; ///< Trigger flag (@see enum auto_trigger_flag)
  112. uint16 duration; ///< Optional, non-reducible duration in ms. If 0, the default, reducible effect's duration is used.
  113. // TODO[Haru]: Duration is only used in addeff (set through bonus4 bAddEff). The other addeffect types could also use it.
  114. };
  115. struct s_addeffectonskill {
  116. enum sc_type id;
  117. short rate, skill;
  118. unsigned char target;
  119. };
  120. struct s_add_drop {
  121. short id, group;
  122. int race, rate;
  123. };
  124. struct s_autobonus {
  125. short rate,atk_type;
  126. unsigned int duration;
  127. char *bonus_script, *other_script;
  128. int active;
  129. unsigned short pos;
  130. };
  131. enum npc_timeout_type {
  132. NPCT_INPUT = 0,
  133. NPCT_MENU = 1,
  134. NPCT_WAIT = 2,
  135. };
  136.  
  137. struct pc_combos {
  138. struct script_code *bonus;/* the script of the combo */
  139. unsigned short id;/* this combo id */
  140. };
  141.  
  142. struct map_session_data {
  143. struct block_list bl;
  144. struct unit_data ud;
  145. struct view_data vd;
  146. struct status_data base_status, battle_status;
  147. struct status_change sc;
  148. struct regen_data regen;
  149. struct regen_data_sub sregen, ssregen;
  150. //NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in
  151. //status_calc_pc, while special_state is recalculated in each call. [Skotlex]
  152. struct {
  153. unsigned int active : 1; //Marks active player (not active is logging in/out, or changing map servers)
  154. unsigned int menu_or_input : 1;// if a script is waiting for feedback from the player
  155. unsigned int dead_sit : 2;
  156. unsigned int lr_flag : 3;//1: left h. weapon; 2: arrow; 3: shield
  157. unsigned int connect_new : 1;
  158. unsigned int arrow_atk : 1;
  159. unsigned int gangsterparadise : 1;
  160. unsigned int rest : 1;
  161. unsigned int storage_flag : 2; // @see enum storage_flag
  162. unsigned int snovice_dead_flag : 1; //Explosion spirits on death: 0 off, 1 used.
  163. unsigned int abra_flag : 2; // Abracadabra bugfix by Aru
  164. unsigned int autocast : 1; // Autospell flag [Inkfish]
  165. unsigned int autotrade : 2; //By Fantik
  166. unsigned int showdelay :1;
  167. unsigned int showexp :1;
  168. unsigned int showzeny :1;
  169. unsigned int noask :1; // [LuzZza]
  170. unsigned int trading :1; //[Skotlex] is 1 only after a trade has started.
  171. unsigned int deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE
  172. unsigned int monster_ignore :1; // for monsters to ignore a character [Valaris] [zzo]
  173. unsigned int size :2; // for tiny/large types
  174. unsigned int night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex]
  175. unsigned int blockedmove :1;
  176. unsigned int using_fake_npc :1;
  177. unsigned int rewarp :1; //Signals that a player should warp as soon as he is done loading a map. [Skotlex]
  178. unsigned int killer : 1;
  179. unsigned int killable : 1;
  180. unsigned int doridori : 1;
  181. unsigned int ignoreAll : 1;
  182. unsigned int debug_remove_map : 1; // temporary state to track double remove_map's [FlavioJS]
  183. unsigned int buyingstore : 1;
  184. unsigned int lesseffect : 1;
  185. unsigned int vending : 1;
  186. unsigned int noks : 3; // [Zeph Kill Steal Protection]
  187. unsigned int changemap : 1;
  188. unsigned int callshop : 1; // flag to indicate that a script used callshop; on a shop
  189. short pmap; // Previous map on Map Change
  190. unsigned short autoloot;
  191. unsigned short autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus]
  192. unsigned short autoloottype;
  193. unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid
  194. unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish]
  195. unsigned int gmaster_flag : 1;
  196. unsigned int prevend : 1;//used to flag wheather you've spent 40sp to open the vending or not.
  197. unsigned int warping : 1;//states whether you're in the middle of a warp processing
  198. unsigned int permanent_speed : 1; // When 1, speed cannot be changed through status_calc_pc().
  199. unsigned int dialog : 1;
  200. unsigned int prerefining : 1;
  201. unsigned int workinprogress : 3; // 1 = disable skill/item, 2 = disable npc interaction, 3 = disable both
  202. unsigned int hold_recalc : 1;
  203. unsigned int snovice_call_flag : 3; //Summon Angel (stage 1~3)
  204. unsigned int hpmeter_visible : 1;
  205. unsigned int itemcheck : 1;
  206. unsigned int standalone : 1;/* [Ind/Hercules <3] */
  207. unsigned int loggingout : 1;
  208. unsigned int warp_clean : 1;
  209. unsigned int arealoot : 1;
  210. unsigned int pvp_listen : 1;
  211. bool noattack;
  212. unsigned int spb : 1;
  213. unsigned int secure_items : 1;
  214. unsigned int mac_noexp : 1 ;
  215. int unique_id[15];
  216. } state;
  217. #ifdef ADELAYS
  218. struct Adelays_State adelays_state;
  219. #endif
  220. struct {
  221. unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
  222. unsigned int restart_full_recover : 1;
  223. unsigned int no_castcancel : 1;
  224. unsigned int no_castcancel2 : 1;
  225. unsigned int no_sizefix : 1;
  226. unsigned int no_gemstone : 1;
  227. unsigned int intravision : 1; // Maya Purple Card effect [DracoRPG]
  228. unsigned int perfect_hiding : 1; // [Valaris]
  229. unsigned int no_knockback : 1;
  230. unsigned int bonus_coma : 1;
  231. } special_state;
  232. int login_id1, login_id2;
  233. unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex]
  234.  
  235. unsigned int gotzenylog;
  236. unsigned int countskilllog;
  237. /// Groups & permissions
  238. int group_id;
  239. GroupSettings *group;
  240. unsigned int extra_temp_permissions; /* permissions from @addperm */
  241.  
  242. struct mmo_charstatus status;
  243. struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups)
  244. short equip_index[EQI_MAX];
  245. unsigned int weight,max_weight;
  246. int cart_weight,cart_num,cart_weight_max;
  247. int fd;
  248. unsigned short mapindex;
  249. unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left.
  250. unsigned int client_tick;
  251. int npc_id,areanpc_id,npc_shopid,touching_id; //for script follow scriptoid; ,npcid
  252. int npc_item_flag; //Marks the npc_id with which you can change equipments during interactions with said npc (see script command enable_itemuse)
  253. int npc_menu; // internal variable, used in npc menu handling
  254. int npc_amount;
  255. struct script_state *st;
  256. char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine
  257. int npc_timer_id; //For player attached npc timers. [Skotlex]
  258. unsigned int chatID;
  259. int64 idletime;
  260. struct {
  261. int npc_id;
  262. int64 timeout;
  263. } progressbar; //Progress Bar [Inkfish]
  264. struct{
  265. char name[NAME_LENGTH];
  266. } ignore[MAX_IGNORE_LIST];
  267. int followtimer; // [MouseJstr]
  268. int followtarget;
  269. time_t emotionlasttime; // to limit flood with emotion packets
  270. short skillitem,skillitemlv;
  271. uint16 skill_id_old,skill_lv_old;
  272. uint16 skill_id_dance,skill_lv_dance;
  273. short cook_mastery; // range: [0,1999] [Inkfish]
  274. bool blockskill[MAX_SKILL];
  275. int cloneskill_id, reproduceskill_id;
  276. int menuskill_id, menuskill_val, menuskill_val2;
  277. int invincible_timer;
  278. int64 canlog_tick;
  279. int64 canuseitem_tick; // [Skotlex]
  280. int64 canusecashfood_tick;
  281. int64 canequip_tick; // [Inkfish]
  282. int64 cantalk_tick;
  283. int64 canskill_tick; /// used to prevent abuse from no-delay ACT files
  284. int64 cansendmail_tick; /// Mail System Flood Protection
  285. int64 ks_floodprotect_tick; /// [Kill Steal Protection]
  286. struct {
  287. short nameid;
  288. int64 tick;
  289. } item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
  290. short weapontype1,weapontype2;
  291. short disguise; // [Valaris]
  292. struct weapon_data right_weapon, left_weapon;
  293.  
  294. BEGIN_ZEROED_BLOCK; // this block will be globally zeroed at the beginning of status_calc_pc()
  295. int param_bonus[6],param_equip[6]; //Stores card/equipment bonuses.
  296. int subele[ELE_MAX];
  297. int subrace[RC_MAX];
  298. int subrace2[RC2_MAX];
  299. int subsize[3];
  300. int reseff[SC_COMMON_MAX-SC_COMMON_MIN+1];
  301. int weapon_coma_ele[ELE_MAX];
  302. int weapon_coma_race[RC_MAX];
  303. int weapon_atk[16];
  304. int weapon_atk_rate[16];
  305. int arrow_addele[ELE_MAX];
  306. int arrow_addrace[RC_MAX];
  307. int arrow_addsize[3];
  308. int magic_addele[ELE_MAX];
  309. int magic_addrace[RC_MAX];
  310. int magic_addsize[3];
  311. int magic_atk_ele[ELE_MAX];
  312. int critaddrace[RC_MAX];
  313. int expaddrace[RC_MAX];
  314. int ignore_mdef[RC_MAX];
  315. int ignore_def[RC_MAX];
  316. short sp_gain_race[RC_MAX];
  317. short sp_gain_race_attack[RC_MAX];
  318. short hp_gain_race_attack[RC_MAX];
  319. #ifdef RENEWAL
  320. int race_tolerance[RC_MAX];
  321. #endif
  322. struct s_autospell autospell[15], autospell2[15], autospell3[15];
  323. struct s_addeffect addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS];
  324. struct s_addeffectonskill addeff3[MAX_PC_BONUS];
  325. struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills.
  326. unsigned short id;
  327. short val;
  328. } 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];
  329. struct {
  330. short value;
  331. int rate;
  332. int tick;
  333. } hp_loss, sp_loss, hp_regen, sp_regen;
  334. struct {
  335. short class_, rate;
  336. } add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS], add_mdmg[MAX_PC_BONUS];
  337. struct s_add_drop add_drop[MAX_PC_BONUS];
  338. struct {
  339. int nameid;
  340. int rate;
  341. } itemhealrate[MAX_PC_BONUS];
  342. struct {
  343. short flag, rate;
  344. unsigned char ele;
  345. } subele2[MAX_PC_BONUS];
  346. struct {
  347. short value;
  348. int rate, tick;
  349. } def_set_race[RC_MAX], mdef_set_race[RC_MAX];
  350. struct {
  351. int atk_rate;
  352. int arrow_atk,arrow_ele,arrow_cri,arrow_hit;
  353. int nsshealhp,nsshealsp;
  354. int critical_def,double_rate;
  355. int long_attack_atk_rate; //Long range atk rate, not weapon based. [Skotlex]
  356. int near_attack_def_rate,long_attack_def_rate,magic_def_rate,misc_def_rate;
  357. int ignore_mdef_ele;
  358. int ignore_mdef_race;
  359. int perfect_hit;
  360. int perfect_hit_add;
  361. int get_zeny_rate;
  362. int get_zeny_num; //Added Get Zeny Rate [Skotlex]
  363. int double_add_rate;
  364. int short_weapon_damage_return,long_weapon_damage_return;
  365. int magic_damage_return; // AppleGirl Was Here
  366. int break_weapon_rate,break_armor_rate;
  367. int crit_atk_rate;
  368. int classchange; // [Valaris]
  369. int speed_rate, speed_add_rate, aspd_add;
  370. int itemhealrate2; // [Epoque] Increase heal rate of all healing items.
  371. int shieldmdef;//royal guard's
  372. unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex]
  373. short splash_range, splash_add_range;
  374. short add_steal_rate;
  375. short add_heal_rate, add_heal2_rate;
  376. short sp_gain_value, hp_gain_value, magic_sp_gain_value, magic_hp_gain_value;
  377. short sp_vanish_rate;
  378. short sp_vanish_per, sp_vanish_trigger;
  379. unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest]
  380. unsigned short unbreakable_equip; //100% break resistance on certain equipment
  381. unsigned short unstripable_equip;
  382. int fixcastrate,varcastrate;
  383. int add_fixcast,add_varcast;
  384. int ematk; // matk bonus from equipment
  385. } bonus;
  386. END_ZEROED_BLOCK;
  387.  
  388. // The following structures are zeroed manually in status_calc_pc_
  389. struct s_autobonus autobonus[MAX_PC_BONUS], autobonus2[MAX_PC_BONUS], autobonus3[MAX_PC_BONUS]; //Auto script on attack, when attacked, on skill usage
  390.  
  391. // LGP by Functor
  392. bool lgp_is_native_client;
  393. unsigned int lgp_settings;
  394.  
  395. int castrate,delayrate,hprate,sprate,dsprate;
  396. int hprecov_rate,sprecov_rate;
  397. int matk_rate;
  398. int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate;
  399. int itemid;
  400. short itemindex; //Used item's index in sd->inventory [Skotlex]
  401. short catch_target_class; // pet catching, stores a pet class to catch (short now) [zzo]
  402. short spiritball, spiritball_old;
  403. int spirit_timer[MAX_SPIRITBALL];
  404. short charm_count;
  405. int charm_type;
  406. int charm_timer[MAX_SPIRITCHARM];
  407. unsigned char potion_success_counter; //Potion successes in row counter
  408. unsigned char mission_count; //Stores the bounty kill count for TK_MISSION
  409. short mission_mobid; //Stores the target mob_id for TK_MISSION
  410. int die_counter; //Total number of times you've died
  411. int devotion[MAX_PC_DEVOTION]; //Stores the account IDs of chars devoted to.
  412. int trade_partner;
  413. struct {
  414. struct {
  415. short index, amount;
  416. } item[10];
  417. int zeny, weight;
  418. } deal;
  419. bool party_creating; // whether the char is requesting party creation
  420. bool party_joining; // whether the char is accepting party invitation
  421. int party_invite, party_invite_account; // for handling party invitation (holds party id and account id)
  422. int adopt_invite; // Adoption
  423. struct guild *guild;/* [Ind/Hercules] speed everything up */
  424. int guild_invite,guild_invite_account;
  425. int guild_emblem_id,guild_alliance,guild_alliance_account;
  426. short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo]
  427. int guildspy; // [Syrus22]
  428. int partyspy; // [Syrus22]
  429. unsigned int vended_id;
  430. unsigned int vender_id;
  431. int vend_num;
  432. char message[MESSAGE_SIZE];
  433. struct s_vending vending[MAX_VENDING];
  434. unsigned int buyer_id; // uid of open buying store
  435. struct s_buyingstore buyingstore;
  436. struct s_search_store_info searchstore;
  437.  
  438. struct pet_data *pd;
  439. struct homun_data *hd; // [blackhole89]
  440. struct mercenary_data *md;
  441. struct elemental_data *ed;
  442.  
  443. struct {
  444. int m; //-1 - none, other: map index corresponding to map name.
  445. unsigned short index; //map index
  446. } feel_map[MAX_PC_FEELHATE];// 0 - Sun; 1 - Moon; 2 - Stars
  447. short hate_mob[MAX_PC_FEELHATE];
  448.  
  449. int pvp_timer;
  450. short pvp_point;
  451. unsigned short pvp_rank, pvp_lastusers;
  452. unsigned short pvp_won, pvp_lost;
  453.  
  454. char eventqueue[MAX_EVENTQUEUE][EVENT_NAME_LENGTH];
  455. int eventtimer[MAX_EVENTTIMER];
  456. unsigned short eventcount; // [celest]
  457.  
  458. unsigned char change_level_2nd; // job level when changing from 1st to 2nd class [jobchange_level in global_reg_value]
  459. unsigned char change_level_3rd; // job level when changing from 2nd to 3rd class [jobchange_level_3rd in global_reg_value]
  460.  
  461. char fakename[NAME_LENGTH]; // fake names [Valaris]
  462.  
  463. int duel_group; // duel vars [LuzZza]
  464. int duel_invite;
  465.  
  466. int killerrid, killedrid;
  467.  
  468. int cashPoints, kafraPoints;
  469. int rental_timer;
  470.  
  471. // Auction System [Zephyrus]
  472. struct {
  473. int index, amount;
  474. } auction;
  475.  
  476. // Mail System [Zephyrus]
  477. struct {
  478. short nameid;
  479. int index, amount, zeny;
  480. struct mail_data inbox;
  481. bool changed; // if true, should sync with charserver on next mailbox request
  482. } mail;
  483.  
  484. // Quest log system
  485. int num_quests; ///< Number of entries in quest_log
  486. int avail_quests; ///< Number of Q_ACTIVE and Q_INACTIVE entries in quest log (index of the first Q_COMPLETE entry)
  487. struct quest *quest_log; ///< Quest log entries (note: Q_COMPLETE quests follow the first <avail_quests>th enties
  488. bool save_quest; ///< Whether the quest_log entries were modified and are waitin to be saved
  489.  
  490. // temporary debug [flaviojs]
  491. const char* debug_file;
  492. int debug_line;
  493. const char* debug_func;
  494.  
  495. unsigned int bg_id;
  496. struct queue_data *qd;
  497.  
  498. /**
  499. * For the Secure NPC Timeout option (check config/Secure.h) [RR]
  500. **/
  501. #ifdef SECURE_NPCTIMEOUT
  502. /**
  503. * ID of the timer
  504. * @info
  505. * - value is -1 (INVALID_TIMER constant) when not being used
  506. * - timer is cancelled upon closure of the current npc's instance
  507. **/
  508. int npc_idle_timer;
  509. /**
  510. * Tick on the last recorded NPC iteration (next/menu/whatever)
  511. * @info
  512. * - It is updated on every NPC iteration as mentioned above
  513. **/
  514. int64 npc_idle_tick;
  515. /* */
  516. enum npc_timeout_type npc_idle_type;
  517. #endif
  518.  
  519. struct pc_combos *combos;
  520. unsigned char combo_count;
  521.  
  522. /**
  523. * Guarantees your friend request is legit (for bugreport:4629)
  524. **/
  525. int friend_req;
  526.  
  527. int shadowform_id;
  528.  
  529. /* [Ind/Hercules] */
  530. struct channel_data **channels;
  531. unsigned char channel_count;
  532. struct channel_data *gcbind;
  533. unsigned char fontcolor;
  534. unsigned int fontcolor_tid;
  535. int64 hchsysch_tick;
  536.  
  537. /* [Ind/Hercules] */
  538. struct sc_display_entry **sc_display;
  539. unsigned char sc_display_count;
  540.  
  541. short *instance;
  542. unsigned short instances;
  543.  
  544. /* Possible Thanks to Yommy~! */
  545. struct {
  546. unsigned int ready : 1;/* did he accept the 'match is about to start, enter' dialog? */
  547. unsigned int client_has_bg_data : 1; /* flags whether the client has the "in queue" window (aka the client knows it is in a queue) */
  548. struct bg_arena *arena;
  549. enum bg_queue_types type;
  550. } bg_queue;
  551.  
  552. int *queues;
  553. unsigned int queues_count;
  554.  
  555. /* Made Possible Thanks to Yommy~! */
  556. unsigned int cryptKey; ///< Packet obfuscation key to be used for the next received packet
  557. unsigned short (*parse_cmd_func)(int fd, struct map_session_data *sd); ///< parse_cmd_func used by this player
  558.  
  559. unsigned char delayed_damage;//ref. counter bugreport:7307 [Ind/Hercules]
  560.  
  561. /* HPM Custom Struct */
  562. struct HPluginData **hdata;
  563. unsigned int hdatac;
  564.  
  565. /* expiration_time timer id */
  566. int expiration_tid;
  567. time_t expiration_time;
  568.  
  569. /* */
  570. struct {
  571. unsigned int second,third;
  572. } sktree;
  573.  
  574. /**
  575. * Account/Char variables & array control of those variables
  576. **/
  577. struct reg_db regs;
  578. unsigned char vars_received;/* char loading is only complete when you get it all. */
  579. bool vars_ok;
  580. bool vars_dirty;
  581.  
  582. struct {
  583. short stage;
  584. short prizeIdx;
  585. short prizeStage;
  586. bool claimPrize;
  587. } roulette;
  588.  
  589. uint8 lang_id;
  590.  
  591. // temporary debugging of bug #3504
  592. const char* delunit_prevfile;
  593. int delunit_prevline;
  594.  
  595. };
  596.  
  597. #define EQP_WEAPON EQP_HAND_R
  598. #define EQP_SHIELD EQP_HAND_L
  599. #define EQP_ARMS (EQP_HAND_R|EQP_HAND_L)
  600. #define EQP_HELM (EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)
  601. #define EQP_ACC (EQP_ACC_L|EQP_ACC_R)
  602. #define EQP_COSTUME (EQP_COSTUME_HEAD_TOP|EQP_COSTUME_HEAD_MID|EQP_COSTUME_HEAD_LOW|EQP_COSTUME_GARMENT)
  603. #define EQP_SHADOW_ACC (EQP_SHADOW_ACC_R|EQP_SHADOW_ACC_L)
  604. #define EQP_SHADOW_ARMS (EQP_SHADOW_WEAPON|EQP_SHADOW_SHIELD)
  605.  
  606. /// Equip positions that use a visible sprite
  607. #if PACKETVER < 20110111
  608. #define EQP_VISIBLE EQP_HELM
  609. #else
  610. #define EQP_VISIBLE (EQP_HELM|EQP_GARMENT|EQP_COSTUME)
  611. #endif
  612.  
  613. #define pc_setdead(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 )
  614. #define pc_setsit(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 )
  615. #define pc_isdead(sd) ( (sd)->state.dead_sit == 1 )
  616. #define pc_issit(sd) ( (sd)->vd.dead_sit == 2 )
  617. #define pc_isidle(sd) ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(sockt->last_tick, (sd)->idletime) >= battle->bc->idle_no_share )
  618. #define pc_istrading(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )
  619. #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 )
  620.  
  621. /* equals pc_cant_act except it doesn't check for chat rooms */
  622. #define pc_cant_act2(sd) ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )
  623.  
  624. #define pc_setdir(sd,b,h) ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) )
  625. #define pc_setchatid(sd,n) ( (sd)->chatID = n )
  626. #define pc_ishiding(sd) ( (sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) )
  627. #define pc_iscloaking(sd) ( !((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK) )
  628. #define pc_ischasewalk(sd) ( (sd)->sc.option&OPTION_CHASEWALK )
  629.  
  630. #ifdef NEW_CARTS
  631. #define pc_iscarton(sd) ( (sd)->sc.data[SC_PUSH_CART] )
  632. #else
  633. #define pc_iscarton(sd) ( (sd)->sc.option&OPTION_CART )
  634. #endif
  635.  
  636. #define pc_isfalcon(sd) ( (sd)->sc.option&OPTION_FALCON )
  637. #define pc_isinvisible(sd) ( (sd)->sc.option&OPTION_INVISIBLE )
  638. #define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle->bc->natural_heal_weight_rate )
  639. #define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 )
  640. #define pc_maxparameter(sd) ( \
  641. ( ((sd)->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO \
  642. || ((sd)->class_&MAPID_UPPERMASK) == MAPID_REBELLION \
  643. || ((sd)->class_&MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E \
  644. ) ? battle->bc->max_extended_parameter : ((sd)->class_&JOBL_THIRD) ? \
  645. (((sd)->class_&JOBL_BABY) ? battle->bc->max_baby_third_parameter : battle->bc->max_third_parameter ) : \
  646. (((sd)->class_&JOBL_BABY) ? battle->bc->max_baby_parameter : battle->bc->max_parameter) \
  647. )
  648. /// Generic check for mounts
  649. #define pc_hasmount(sd) ( (sd)->sc.option&(OPTION_RIDING|OPTION_WUGRIDER|OPTION_DRAGON|OPTION_MADOGEAR) )
  650. /// Knight classes Peco / Gryphon
  651. #define pc_isridingpeco(sd) ( (sd)->sc.option&(OPTION_RIDING) )
  652. /// Ranger Warg
  653. #define pc_iswug(sd) ( (sd)->sc.option&OPTION_WUG )
  654. #define pc_isridingwug(sd) ( (sd)->sc.option&OPTION_WUGRIDER )
  655. /// Mechanic Magic Gear
  656. #define pc_ismadogear(sd) ( (sd)->sc.option&OPTION_MADOGEAR )
  657. /// Rune Knight Dragon
  658. #define pc_isridingdragon(sd) ( (sd)->sc.option&OPTION_DRAGON )
  659.  
  660. #define pc_stop_walking(sd, type) (unit->stop_walking(&(sd)->bl, (type)))
  661. #define pc_stop_attack(sd) (unit->stop_attack(&(sd)->bl))
  662.  
  663. //Weapon check considering dual wielding.
  664. #define pc_check_weapontype(sd, type) ((type)&((sd)->status.weapon < MAX_WEAPON_TYPE? \
  665. 1<<(sd)->status.weapon:(1<<(sd)->weapontype1)|(1<<(sd)->weapontype2)|(1<<(sd)->status.weapon)))
  666.  
  667. // clientside display macros (values to the left/right of the "+")
  668. #ifdef RENEWAL
  669. #define pc_leftside_atk(sd) ((sd)->battle_status.batk)
  670. #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 + (sd)->battle_status.equip_atk )
  671. #define pc_leftside_def(sd) ((sd)->battle_status.def2)
  672. #define pc_rightside_def(sd) ((sd)->battle_status.def)
  673. #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef2)
  674. #define pc_rightside_mdef(sd) ((sd)->battle_status.mdef)
  675. #define pc_leftside_matk(sd) (status->base_matk(&(sd)->bl, status->get_status_data(&(sd)->bl), (sd)->status.base_level))
  676. #define pc_rightside_matk(sd) ((sd)->battle_status.rhw.matk+(sd)->battle_status.lhw.matk+(sd)->bonus.ematk)
  677. #else
  678. #define pc_leftside_atk(sd) ((sd)->battle_status.batk + (sd)->battle_status.rhw.atk + (sd)->battle_status.lhw.atk)
  679. #define pc_rightside_atk(sd) ((sd)->battle_status.rhw.atk2 + (sd)->battle_status.lhw.atk2)
  680. #define pc_leftside_def(sd) ((sd)->battle_status.def)
  681. #define pc_rightside_def(sd) ((sd)->battle_status.def2)
  682. #define pc_leftside_mdef(sd) ((sd)->battle_status.mdef)
  683. #define pc_rightside_mdef(sd) ( (sd)->battle_status.mdef2 - ((sd)->battle_status.vit>>1) )
  684. #define pc_leftside_matk(sd) (\
  685. ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \
  686. ?((sd)->battle_status.matk_min * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \
  687. :(sd)->battle_status.matk_min \
  688. )
  689. #define pc_rightside_matk(sd) (\
  690. ((sd)->sc.data[SC_MAGICPOWER] && (sd)->sc.data[SC_MAGICPOWER]->val4) \
  691. ?((sd)->battle_status.matk_max * 100 + 50) / ((sd)->sc.data[SC_MAGICPOWER]->val3+100) \
  692. :(sd)->battle_status.matk_max \
  693. )
  694. #endif
  695.  
  696. #define pc_get_group_id(sd) ( (sd)->group_id )
  697.  
  698. #define pc_checkoverhp(sd) ((sd)->battle_status.hp == (sd)->battle_status.max_hp)
  699. #define pc_checkoversp(sd) ((sd)->battle_status.sp == (sd)->battle_status.max_sp)
  700.  
  701. #define pc_readglobalreg(sd,reg) (pc->readregistry((sd),(reg)))
  702. #define pc_setglobalreg(sd,reg,val) (pc->setregistry((sd),(reg),(val)))
  703. #define pc_readglobalreg_str(sd,reg) (pc->readregistry_str((sd),(reg)))
  704. #define pc_setglobalreg_str(sd,reg,val) (pc->setregistry_str((sd),(reg),(val)))
  705. #define pc_readaccountreg(sd,reg) (pc->readregistry((sd),(reg)))
  706. #define pc_setaccountreg(sd,reg,val) (pc->setregistry((sd),(reg),(val)))
  707. #define pc_readaccountregstr(sd,reg) (pc->readregistry_str((sd),(reg)))
  708. #define pc_setaccountregstr(sd,reg,val) (pc->setregistry_str((sd),(reg),(val)))
  709. #define pc_readaccountreg2(sd,reg) (pc->readregistry((sd),(reg)))
  710. #define pc_setaccountreg2(sd,reg,val) (pc->setregistry((sd),(reg),(val)))
  711. #define pc_readaccountreg2str(sd,reg) (pc->readregistry_str((sd),(reg)))
  712. #define pc_setaccountreg2str(sd,reg,val) (pc->setregistry_str((sd),(reg),(val)))
  713.  
  714. /* pc_groups easy access */
  715. #define pc_get_group_level(sd) ( (sd)->group->level )
  716. #define pc_has_permission(sd,permission) ( ((sd)->extra_temp_permissions&(permission)) != 0 || ((sd)->group->e_permissions&(permission)) != 0 )
  717. #define pc_can_give_items(sd) ( pc_has_permission((sd),PC_PERM_TRADE) )
  718. #define pc_can_give_bound_items(sd) ( pc_has_permission((sd),PC_PERM_TRADE_BOUND) )
  719.  
  720. struct skill_tree_entry {
  721. short id;
  722. unsigned short idx;
  723. unsigned char max;
  724. unsigned char joblv;
  725. short inherited;
  726. struct {
  727. short id;
  728. unsigned short idx;
  729. unsigned char lv;
  730. } need[MAX_PC_SKILL_REQUIRE];
  731. }; // Celest
  732.  
  733. struct sg_data {
  734. short anger_id;
  735. short bless_id;
  736. short comfort_id;
  737. char feel_var[NAME_LENGTH];
  738. char hate_var[NAME_LENGTH];
  739. bool (*day_func)(void);
  740. };
  741.  
  742. enum { ADDITEM_EXIST , ADDITEM_NEW , ADDITEM_OVERAMOUNT };
  743.  
  744. /**
  745. * Item Cool Down Delay Saving
  746. * Struct item_cd is not a member of struct map_session_data
  747. * to keep cooldowns in memory between player log-ins.
  748. * All cooldowns are reset when server is restarted.
  749. **/
  750. struct item_cd {
  751. int64 tick[MAX_ITEMDELAYS];//tick
  752. short nameid[MAX_ITEMDELAYS];//skill id
  753. };
  754.  
  755. enum e_pc_autotrade_update_action {
  756. PAUC_START,
  757. PAUC_REFRESH,
  758. PAUC_REMOVE,
  759. };
  760.  
  761. /**
  762. * Flag values for pc->skill
  763. */
  764. enum pc_skill_flag {
  765. SKILL_GRANT_PERMANENT = 0, // Grant permanent skill to be bound to skill tree
  766. SKILL_GRANT_TEMPORARY = 1, // Grant an item skill (temporary)
  767. SKILL_GRANT_TEMPSTACK = 2, // Like 1, except the level granted can stack with previously learned level.
  768. SKILL_GRANT_UNCONDITIONAL = 3, // Grant skill unconditionally and forever (persistent to job changes and skill resets)
  769. };
  770.  
  771. /**
  772. * Used to temporarily remember vending data
  773. **/
  774. struct autotrade_vending {
  775. struct item list[MAX_VENDING];
  776. struct s_vending vending[MAX_VENDING];
  777. unsigned char vend_num;
  778. };
  779.  
  780. /*=====================================
  781. * Interface : pc.h
  782. * Generated by HerculesInterfaceMaker
  783. * created by Susu
  784. *-------------------------------------*/
  785. struct pc_interface {
  786.  
  787. /* */
  788. DBMap *at_db;/* char id -> struct autotrade_vending */
  789. /* */
  790. DBMap* itemcd_db;
  791. /* */
  792. int day_timer_tid;
  793. int night_timer_tid;
  794. /* */
  795.  
  796. BEGIN_ZEROED_BLOCK; /* Everything within this block will be memset to 0 when status_defaults() is executed */
  797. unsigned int exp_table[CLASS_COUNT][2][MAX_LEVEL];
  798. unsigned int max_level[CLASS_COUNT][2];
  799. unsigned int statp[MAX_LEVEL+1];
  800. unsigned int level_penalty[3][RC_MAX][MAX_LEVEL*2+1];
  801. /* */
  802. struct skill_tree_entry skill_tree[CLASS_COUNT][MAX_SKILL_TREE];
  803. struct fame_list smith_fame_list[MAX_FAME_LIST];
  804. struct fame_list chemist_fame_list[MAX_FAME_LIST];
  805. struct fame_list taekwon_fame_list[MAX_FAME_LIST];
  806. END_ZEROED_BLOCK; /* End */
  807.  
  808. unsigned int equip_pos[EQI_MAX];
  809. struct sg_data sg_info[MAX_PC_FEELHATE];
  810. /* */
  811. struct eri *sc_display_ers;
  812. /* global expiration timer id */
  813. int expiration_tid;
  814. /**
  815. * ERS for the bulk of pc vars
  816. **/
  817. struct eri *num_reg_ers;
  818. struct eri *str_reg_ers;
  819. /* */
  820. bool reg_load;
  821. /* funcs */
  822. void (*init) (bool minimal);
  823. void (*final) (void);
  824.  
  825. struct map_session_data* (*get_dummy_sd) (void);
  826. int (*class2idx) (int class_);
  827. bool (*can_talk) (struct map_session_data *sd);
  828. bool (*can_attack) ( struct map_session_data *sd, int target_id );
  829.  
  830. bool (*can_use_command) (struct map_session_data *sd, const char *command);
  831. int (*set_group) (struct map_session_data *sd, int group_id);
  832. bool (*should_log_commands) (struct map_session_data *sd);
  833.  
  834. int (*setrestartvalue) (struct map_session_data *sd,int type);
  835. int (*makesavestatus) (struct map_session_data *sd);
  836. void (*respawn) (struct map_session_data* sd, clr_type clrtype);
  837. int (*setnewpc) (struct map_session_data *sd, int account_id, int char_id, int login_id1, unsigned int client_tick, int sex, int fd);
  838. bool (*authok) (struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers);
  839. void (*authfail) (struct map_session_data *sd);
  840. int (*reg_received) (struct map_session_data *sd);
  841.  
  842. int (*isequip) (struct map_session_data *sd,int n);
  843. int (*equippoint) (struct map_session_data *sd,int n);
  844. int (*setinventorydata) (struct map_session_data *sd);
  845.  
  846. int (*checkskill) (struct map_session_data *sd,uint16 skill_id);
  847. int (*checkskill2) (struct map_session_data *sd,uint16 index);
  848. int (*checkallowskill) (struct map_session_data *sd);
  849. int (*checkequip) (struct map_session_data *sd,int pos);
  850.  
  851. int (*calc_skilltree) (struct map_session_data *sd);
  852. int (*calc_skilltree_normalize_job) (struct map_session_data *sd);
  853. int (*clean_skilltree) (struct map_session_data *sd);
  854.  
  855. int (*setpos) (struct map_session_data* sd, unsigned short map_index, int x, int y, clr_type clrtype);
  856. int (*setsavepoint) (struct map_session_data *sd, short map_index, int x, int y);
  857. int (*randomwarp) (struct map_session_data *sd,clr_type type);
  858. int (*memo) (struct map_session_data* sd, int pos);
  859.  
  860. int (*checkadditem) (struct map_session_data *sd,int nameid,int amount);
  861. int (*inventoryblank) (struct map_session_data *sd);
  862. int (*search_inventory) (struct map_session_data *sd,int item_id);
  863. int (*payzeny) (struct map_session_data *sd,int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
  864. int (*additem) (struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type);
  865. int (*getzeny) (struct map_session_data *sd,int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
  866. int (*delitem) (struct map_session_data *sd,int n,int amount,int type, short reason, e_log_pick_type log_type);
  867.  
  868. // Special Shop System
  869. int (*paycash) (struct map_session_data *sd, int price, int points);
  870. int (*getcash) (struct map_session_data *sd, int cash, int points);
  871.  
  872. int (*cart_additem) (struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type);
  873. int (*cart_delitem) (struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type);
  874. int (*putitemtocart) (struct map_session_data *sd,int idx,int amount);
  875. int (*getitemfromcart) (struct map_session_data *sd,int idx,int amount);
  876. int (*cartitem_amount) (struct map_session_data *sd,int idx,int amount);
  877.  
  878. int (*takeitem) (struct map_session_data *sd,struct flooritem_data *fitem);
  879. int (*dropitem) (struct map_session_data *sd,int n,int amount);
  880.  
  881. bool (*isequipped) (struct map_session_data *sd, int nameid);
  882. bool (*can_Adopt) (struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
  883. bool (*adoption) (struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
  884.  
  885. int (*updateweightstatus) (struct map_session_data *sd);
  886.  
  887. int (*addautobonus) (struct s_autobonus *bonus,char max,const char *bonus_script,short rate,unsigned int dur,short atk_type,const char *o_script,unsigned short pos,bool onskill);
  888. int (*exeautobonus) (struct map_session_data* sd,struct s_autobonus *bonus);
  889. int (*endautobonus) (int tid, int64 tick, int id, intptr_t data);
  890. int (*delautobonus) (struct map_session_data* sd,struct s_autobonus *bonus,char max,bool restore);
  891.  
  892. int (*bonus) (struct map_session_data *sd,int type,int val);
  893. int (*bonus2) (struct map_session_data *sd,int type,int type2,int val);
  894. int (*bonus3) (struct map_session_data *sd,int type,int type2,int type3,int val);
  895. int (*bonus4) (struct map_session_data *sd,int type,int type2,int type3,int type4,int val);
  896. int (*bonus5) (struct map_session_data *sd,int type,int type2,int type3,int type4,int type5,int val);
  897. int (*skill) (struct map_session_data *sd, int id, int level, int flag);
  898.  
  899. int (*insert_card) (struct map_session_data *sd,int idx_card,int idx_equip);
  900. bool (*can_insert_card) (struct map_session_data* sd, int idx_card);
  901. bool (*can_insert_card_into) (struct map_session_data* sd, int idx_card, int idx_equip);
  902.  
  903. int (*steal_item) (struct map_session_data *sd,struct block_list *bl, uint16 skill_lv);
  904. int (*steal_coin) (struct map_session_data *sd,struct block_list *bl);
  905.  
  906. int (*modifybuyvalue) (struct map_session_data *sd,int orig_value);
  907. int (*modifysellvalue) (struct map_session_data *sd,int orig_value);
  908.  
  909. int (*follow) (struct map_session_data *sd, int target_id); // [MouseJstr]
  910. int (*stop_following) (struct map_session_data *sd);
  911.  
  912. unsigned int (*maxbaselv) (struct map_session_data *sd);
  913. unsigned int (*maxjoblv) (struct map_session_data *sd);
  914. int (*checkbaselevelup) (struct map_session_data *sd);
  915. int (*checkjoblevelup) (struct map_session_data *sd);
  916. bool (*gainexp) (struct map_session_data *sd, struct block_list *src, unsigned int base_exp, unsigned int job_exp, bool is_quest);
  917. unsigned int (*nextbaseexp) (struct map_session_data *sd);
  918. unsigned int (*thisbaseexp) (struct map_session_data *sd);
  919. unsigned int (*nextjobexp) (struct map_session_data *sd);
  920. unsigned int (*thisjobexp) (struct map_session_data *sd);
  921. int (*gets_status_point) (int level);
  922. int (*need_status_point) (struct map_session_data *sd,int type,int val);
  923. int (*maxparameterincrease) (struct map_session_data* sd, int type);
  924. bool (*statusup) (struct map_session_data *sd, int type, int increase);
  925. int (*statusup2) (struct map_session_data *sd,int type,int val);
  926. int (*skillup) (struct map_session_data *sd,uint16 skill_id);
  927. int (*allskillup) (struct map_session_data *sd);
  928. int (*resetlvl) (struct map_session_data *sd,int type);
  929. int (*resetstate) (struct map_session_data *sd);
  930. int (*resetskill) (struct map_session_data *sd, int flag);
  931. int (*resetfeel) (struct map_session_data *sd);
  932. int (*resethate) (struct map_session_data *sd);
  933. int (*equipitem) (struct map_session_data *sd,int n,int req_pos);
  934. void (*equipitem_pos) (struct map_session_data *sd, struct item_data *id, int n, int pos);
  935. int (*unequipitem) (struct map_session_data *sd,int n,int flag);
  936. void (*unequipitem_pos) (struct map_session_data *sd, int n, int pos);
  937. int (*checkitem) (struct map_session_data *sd);
  938. int (*useitem) (struct map_session_data *sd,int n);
  939.  
  940. int (*skillatk_bonus) (struct map_session_data *sd, uint16 skill_id);
  941. int (*skillheal_bonus) (struct map_session_data *sd, uint16 skill_id);
  942. int (*skillheal2_bonus) (struct map_session_data *sd, uint16 skill_id);
  943.  
  944. void (*damage) (struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp);
  945. int (*dead) (struct map_session_data *sd,struct block_list *src);
  946. void (*revive) (struct map_session_data *sd,unsigned int hp, unsigned int sp);
  947. void (*heal) (struct map_session_data *sd,unsigned int hp,unsigned int sp, int type);
  948. int (*itemheal) (struct map_session_data *sd,int itemid, int hp,int sp);
  949. int (*percentheal) (struct map_session_data *sd,int hp,int sp);
  950. int (*jobchange) (struct map_session_data *sd,int job, int upper);
  951. int (*setoption) (struct map_session_data *sd,int type);
  952. int (*setcart) (struct map_session_data* sd, int type);
  953. void (*setfalcon) (struct map_session_data *sd, bool flag);
  954. void (*setridingpeco) (struct map_session_data *sd, bool flag);
  955. void (*setmadogear) (struct map_session_data *sd, bool flag);
  956. void (*setridingdragon) (struct map_session_data *sd, unsigned int type);
  957. void (*setridingwug) (struct map_session_data *sd, bool flag);
  958. int (*changelook) (struct map_session_data *sd,int type,int val);
  959. int (*equiplookall) (struct map_session_data *sd);
  960.  
  961. int (*readparam) (struct map_session_data *sd,int type);
  962. int (*setparam) (struct map_session_data *sd,int type,int val);
  963. int (*readreg) (struct map_session_data *sd, int64 reg);
  964. void (*setreg) (struct map_session_data *sd, int64 reg,int val);
  965. char * (*readregstr) (struct map_session_data *sd, int64 reg);
  966. void (*setregstr) (struct map_session_data *sd, int64 reg, const char *str);
  967. int (*readregistry) (struct map_session_data *sd, int64 reg);
  968. int (*setregistry) (struct map_session_data *sd, int64 reg, int val);
  969. char * (*readregistry_str) (struct map_session_data *sd, int64 reg);
  970. int (*setregistry_str) (struct map_session_data *sd, int64 reg, const char *val);
  971.  
  972. int (*addeventtimer) (struct map_session_data *sd,int tick,const char *name);
  973. int (*deleventtimer) (struct map_session_data *sd,const char *name);
  974. int (*cleareventtimer) (struct map_session_data *sd);
  975. int (*addeventtimercount) (struct map_session_data *sd,const char *name,int tick);
  976.  
  977. int (*calc_pvprank) (struct map_session_data *sd);
  978. int (*calc_pvprank_timer) (int tid, int64 tick, int id, intptr_t data);
  979.  
  980. int (*ismarried) (struct map_session_data *sd);
  981. int (*marriage) (struct map_session_data *sd,struct map_session_data *dstsd);
  982. int (*divorce) (struct map_session_data *sd);
  983. struct map_session_data * (*get_partner) (struct map_session_data *sd);
  984. struct map_session_data * (*get_father) (struct map_session_data *sd);
  985. struct map_session_data * (*get_mother) (struct map_session_data *sd);
  986. struct map_session_data * (*get_child) (struct map_session_data *sd);
  987.  
  988. void (*bleeding) (struct map_session_data *sd, unsigned int diff_tick);
  989. void (*regen) (struct map_session_data *sd, unsigned int diff_tick);
  990.  
  991. void (*setstand) (struct map_session_data *sd);
  992. int (*candrop) (struct map_session_data *sd,struct item *item);
  993.  
  994. int (*jobid2mapid) (unsigned short b_class); // Skotlex
  995. int (*mapid2jobid) (unsigned short class_, int sex); // Skotlex
  996.  
  997. const char * (*job_name) (int class_);
  998.  
  999. void (*setinvincibletimer) (struct map_session_data* sd, int val);
  1000. void (*delinvincibletimer) (struct map_session_data* sd);
  1001.  
  1002. int (*addspiritball) (struct map_session_data *sd,int interval,int max);
  1003. int (*delspiritball) (struct map_session_data *sd,int count,int type);
  1004. int (*getmaxspiritball) (struct map_session_data *sd, int min);
  1005. void (*addfame) (struct map_session_data *sd,int count);
  1006. unsigned char (*famerank) (int char_id, int job);
  1007. int (*set_hate_mob) (struct map_session_data *sd, int pos, struct block_list *bl);
  1008.  
  1009. int (*readdb) (void);
  1010. int (*map_day_timer) (int tid, int64 tick, int id, intptr_t data); // by [yor]
  1011. int (*map_night_timer) (int tid, int64 tick, int id, intptr_t data); // by [yor]
  1012. // Rental System
  1013. void (*inventory_rentals) (struct map_session_data *sd);
  1014. int (*inventory_rental_clear) (struct map_session_data *sd);
  1015. void (*inventory_rental_add) (struct map_session_data *sd, int seconds);
  1016.  
  1017. int (*disguise) (struct map_session_data *sd, int class_);
  1018. bool (*isautolooting) (struct map_session_data *sd, int nameid);
  1019.  
  1020. void (*overheat) (struct map_session_data *sd, int val);
  1021.  
  1022. int (*banding) (struct map_session_data *sd, uint16 skill_lv);
  1023.  
  1024. void (*itemcd_do) (struct map_session_data *sd, bool load);
  1025.  
  1026. int (*load_combo) (struct map_session_data *sd);
  1027.  
  1028. void (*add_charm) (struct map_session_data *sd, int interval, int max, int type);
  1029. void (*del_charm) (struct map_session_data *sd, int count, int type);
  1030.  
  1031. void (*baselevelchanged) (struct map_session_data *sd);
  1032. int (*level_penalty_mod) (int diff, unsigned char race, unsigned short mode, int type);
  1033. int (*calc_skillpoint) (struct map_session_data* sd);
  1034.  
  1035. int (*invincible_timer) (int tid, int64 tick, int id, intptr_t data);
  1036. int (*spiritball_timer) (int tid, int64 tick, int id, intptr_t data);
  1037. int (*check_banding) ( struct block_list *bl, va_list ap );
  1038. int (*inventory_rental_end) (int tid, int64 tick, int id, intptr_t data);
  1039. void (*check_skilltree) (struct map_session_data *sd, int skill_id);
  1040. int (*bonus_autospell) (struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id);
  1041. int (*bonus_autospell_onskill) (struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id);
  1042. int (*bonus_addeff) (struct s_addeffect* effect, int max, enum sc_type id, int16 rate, int16 arrow_rate, uint8 flag, uint16 duration);
  1043. int (*bonus_addeff_onskill) (struct s_addeffectonskill* effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target);
  1044. int (*bonus_item_drop) (struct s_add_drop *drop, const short max, short id, short group, int race, int rate);
  1045. void (*calcexp) (struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src);
  1046. int (*respawn_timer) (int tid, int64 tick, int id, intptr_t data);
  1047. int (*jobchange_killclone) (struct block_list *bl, va_list ap);
  1048. int (*getstat) (struct map_session_data* sd, int type);
  1049. int (*setstat) (struct map_session_data* sd, int type, int val);
  1050. int (*eventtimer) (int tid, int64 tick, int id, intptr_t data);
  1051. int (*daynight_timer_sub) (struct map_session_data *sd,va_list ap);
  1052. int (*charm_timer) (int tid, int64 tick, int id, intptr_t data);
  1053. bool (*readdb_levelpenalty) (char* fields[], int columns, int current);
  1054. int (*autosave) (int tid, int64 tick, int id, intptr_t data);
  1055. int (*follow_timer) (int tid, int64 tick, int id, intptr_t data);
  1056. void (*read_skill_tree) (void);
  1057. int (*isUseitem) (struct map_session_data *sd,int n);
  1058. int (*show_steal) (struct block_list *bl,va_list ap);
  1059. int (*checkcombo) (struct map_session_data *sd, struct item_data *data );
  1060. int (*calcweapontype) (struct map_session_data *sd);
  1061. int (*removecombo) (struct map_session_data *sd, struct item_data *data );
  1062.  
  1063. void (*bank_deposit) (struct map_session_data *sd, int money);
  1064. void (*bank_withdraw) (struct map_session_data *sd, int money);
  1065.  
  1066. void (*rental_expire) (struct map_session_data *sd, int i);
  1067. void (*scdata_received) (struct map_session_data *sd);
  1068.  
  1069. void (*bound_clear) (struct map_session_data *sd, enum e_item_bound_type type);
  1070.  
  1071. int (*expiration_timer) (int tid, int64 tick, int id, intptr_t data);
  1072. int (*global_expiration_timer) (int tid, int64 tick, int id, intptr_t data);
  1073. void (*expire_check) (struct map_session_data *sd);
  1074.  
  1075. bool (*db_checkid) (unsigned int class_);
  1076.  
  1077. void (*validate_levels) (void);
  1078.  
  1079. /**
  1080. * Autotrade persistency [Ind/Hercules <3]
  1081. **/
  1082. void (*autotrade_load) (void);
  1083. void (*autotrade_update) (struct map_session_data *sd, enum e_pc_autotrade_update_action action);
  1084. void (*autotrade_start) (struct map_session_data *sd);
  1085. void (*autotrade_prepare) (struct map_session_data *sd);
  1086. void (*autotrade_populate) (struct map_session_data *sd);
  1087.  
  1088. int (*check_job_name) (const char *name);
  1089. int (*countmac) (struct block_list *bl, va_list ap);
  1090. };
  1091.  
  1092. #ifdef HERCULES_CORE
  1093. void pc_defaults(void);
  1094. #endif // HERCULES_CORE
  1095.  
  1096. HPShared struct pc_interface *pc;
  1097.  
  1098. // LGP by Functor
  1099. enum
  1100. {
  1101. LGP_ENABLED = 0x00010000,
  1102. LGP_SQUARE = 0x00020000,
  1103. LGP_CIRCLE = 0x00040000,
  1104. LGP_AOES = 0x00080000,
  1105. LGP_SHAKE = 0x00100000
  1106. };
  1107.  
  1108. void pc_lgp_update_settings (struct map_session_data* sd);
  1109.  
  1110. #endif /* MAP_PC_H */
Add Comment
Please, Sign In to add comment