root/src/map/pc.h @ 23

Revision 22, 27.1 kB (checked in by jinshiro, 17 years ago)
Line 
1// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
2// For more information, see LICENCE in the main folder
3
4#ifndef _PC_H_
5#define _PC_H_
6
7#include "../common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus
8#include "../common/timer.h" // INVALID_TIMER
9#include "battle.h" // battle_config
10#include "itemdb.h" // MAX_ITEMGROUP
11#include "map.h" // RC_MAX
12#include "pc.h" // struct map_session_data
13#include "script.h" // struct script_reg, struct script_regstr
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
19#define MAX_PC_BONUS 10
20
21struct weapon_data {
22        int atkmods[3];
23        // all the variables except atkmods get zero'ed in each call of status_calc_pc
24        // NOTE: if you want to add a non-zeroed variable, you need to update the memset call
25        //  in status_calc_pc as well! All the following are automatically zero'ed. [Skotlex]
26        int overrefine;
27        int star;
28        int ignore_def_ele;
29        int ignore_def_race;
30        int def_ratio_atk_ele;
31        int def_ratio_atk_race;
32        int addele[ELE_MAX];
33        int addrace[RC_MAX];
34        int addrace2[RC_MAX];
35        int addsize[3];
36
37        struct drain_data {
38                short rate;
39                short per;
40                short value;
41                unsigned type:1;
42        } hp_drain[RC_MAX], sp_drain[RC_MAX];
43
44        struct {
45                short class_, rate;
46        }       add_dmg[MAX_PC_BONUS];
47};
48
49struct s_autospell {
50        short id, lv, rate, card_id, flag;
51};
52
53struct s_addeffect {
54        enum sc_type id;
55        short rate, arrow_rate;
56        unsigned char flag;
57};
58
59struct s_add_drop { 
60        short id, group;
61        int race, rate;
62};
63
64struct s_autoscript {
65        unsigned short rate, flag;
66        struct script_code *script;
67};
68
69struct map_session_data {
70        struct block_list bl;
71        struct unit_data ud;
72        struct view_data vd;
73        struct status_data base_status, battle_status;
74        struct status_change sc;
75        struct regen_data regen;
76        struct regen_data_sub sregen, ssregen;
77        //NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in
78        //status_calc_pc, while special_state is recalculated in each call. [Skotlex]
79        struct {
80                unsigned active : 1; //Marks active player (not active is logging in/out, or changing map servers)
81                unsigned menu_or_input : 1;// if a script is waiting for feedback from the player
82                unsigned dead_sit : 2;
83                unsigned lr_flag : 2;
84                unsigned connect_new : 1;
85                unsigned arrow_atk : 1;
86                unsigned skill_flag : 1;
87                unsigned gangsterparadise : 1;
88                unsigned rest : 1;
89                unsigned storage_flag : 2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex]
90                unsigned snovice_call_flag : 2; //Summon Angel (stage 1~3)
91                unsigned snovice_dead_flag : 1; //Explosion spirits on death: 0 off, 1 used.
92                unsigned abra_flag : 1; // Abracadabra bugfix by Aru
93                unsigned autotrade : 1; //By Fantik
94                unsigned reg_dirty : 3; //By Skotlex (marks whether registry variables have been saved or not yet)
95                unsigned showdelay :1;
96                unsigned showexp :1;
97                unsigned showzeny :1;
98                unsigned mainchat :1; //[LuzZza]
99                unsigned noask :1; // [LuzZza]
100                unsigned trading :1; //[Skotlex] is 1 only after a trade has started.
101                unsigned deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE
102                unsigned monster_ignore :1; // for monsters to ignore a character [Valaris] [zzo]
103                unsigned size :2; // for tiny/large types
104                unsigned night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex]
105                unsigned blockedmove :1;
106                unsigned using_fake_npc :1;
107                unsigned rewarp :1; //Signals that a player should warp as soon as he is done loading a map. [Skotlex]
108                unsigned killer : 1;
109                unsigned killable : 1;
110                unsigned doridori : 1;
111                unsigned ignoreAll : 1;
112                unsigned debug_remove_map : 1; // temporary state to track double remove_map's [FlavioJS]
113                unsigned short autoloot;
114                unsigned short autolootid; // [Zephyrus]
115                unsigned noks : 3; // [Zeph Kill Steal Protection]
116                unsigned showsummon : 1; //Show summoned monster stats [Brainstorm]
117                bool changemap;
118                struct guild *gmaster_flag;
119        } state;
120        struct {
121                unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
122                unsigned restart_full_recover : 1;
123                unsigned no_castcancel : 1;
124                unsigned no_castcancel2 : 1;
125                unsigned no_sizefix : 1;
126                unsigned no_gemstone : 1;
127                unsigned intravision : 1; // Maya Purple Card effect [DracoRPG]
128                unsigned perfect_hiding : 1; // [Valaris]
129                unsigned no_knockback : 1;
130                unsigned bonus_coma : 1;
131        } special_state;
132        int login_id1, login_id2;
133        unsigned short class_;  //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex]
134
135        int packet_ver;  // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 ... 18
136        struct mmo_charstatus status;
137        struct registry save_reg;
138       
139        struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups)
140        short equip_index[11];
141        unsigned int weight,max_weight;
142        int cart_weight,cart_num;
143        int fd;
144        unsigned short mapindex;
145        unsigned short prev_speed,prev_adelay;
146        unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left.
147        unsigned int client_tick;
148        int npc_id,areanpc_id,npc_shopid;
149        int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse)
150        int npc_menu; // internal variable, used in npc menu handling
151        int npc_amount;
152        struct script_state *st;
153        char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine
154        int npc_timer_id; //For player attached npc timers. [Skotlex]
155        unsigned int chatID;
156        time_t idletime;
157
158        struct{
159                char name[NAME_LENGTH];
160        } ignore[MAX_IGNORE_LIST];
161
162        int followtimer; // [MouseJstr]
163        int followtarget;
164
165        time_t emotionlasttime; // to limit flood with emotion packets
166
167        short skillitem,skillitemlv;
168        short skillid_old,skilllv_old;
169        short skillid_dance,skilllv_dance;
170        char blockskill[MAX_SKILL];     // [celest]
171        int cloneskill_id;
172        int menuskill_id, menuskill_val;
173
174        int invincible_timer;
175        unsigned int canlog_tick;
176        unsigned int canuseitem_tick;   // [Skotlex]
177        unsigned int cantalk_tick;
178        unsigned int cansendmail_tick; // [Mail System Flood Protection]
179        unsigned int ks_floodprotect_tick; // [Kill Steal Protection]
180
181        short weapontype1,weapontype2;
182        short disguise; // [Valaris]
183
184        struct weapon_data right_weapon, left_weapon;
185       
186        // here start arrays to be globally zeroed at the beginning of status_calc_pc()
187        int param_bonus[6],param_equip[6]; //Stores card/equipment bonuses.
188        int subele[ELE_MAX];
189        int subrace[RC_MAX];
190        int subrace2[RC_MAX];
191        int subsize[3];
192        int reseff[SC_COMMON_MAX-SC_COMMON_MIN+1];
193        int weapon_coma_ele[ELE_MAX];
194        int weapon_coma_race[RC_MAX];
195        int weapon_atk[16];
196        int weapon_atk_rate[16];
197        int arrow_addele[ELE_MAX];
198        int arrow_addrace[RC_MAX];
199        int arrow_addsize[3];
200        int magic_addele[ELE_MAX];
201        int magic_addrace[RC_MAX];
202        int magic_addsize[3];
203        int critaddrace[RC_MAX];
204        int expaddrace[RC_MAX];
205        int ignore_mdef[RC_MAX];
206        int itemgrouphealrate[MAX_ITEMGROUP];
207        short sp_gain_race[RC_MAX];
208        // zeroed arrays end here.
209        // zeroed structures start here
210        struct s_autospell autospell[15], autospell2[15];
211        struct s_addeffect addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS];
212        struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills.
213                unsigned short id;
214                short val;
215        } skillatk[MAX_PC_BONUS], skillheal[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS];
216        struct {
217                short value;
218                int rate;
219                int tick;
220        } hp_loss, sp_loss, hp_regen, sp_regen;
221        struct {
222                short class_, rate;
223        }       add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS], add_mdmg[MAX_PC_BONUS];
224        struct s_add_drop add_drop[MAX_PC_BONUS];
225        struct {
226                int nameid;
227                int rate;
228        } itemhealrate[MAX_PC_BONUS];
229        // zeroed structures end here
230        // manually zeroed structures start here.
231        struct s_autoscript autoscript[10], autoscript2[10]; //Auto script on attack, when attacked
232        // manually zeroed structures end here.
233        // zeroed vars start here.
234        int arrow_atk,arrow_ele,arrow_cri,arrow_hit;
235        int nsshealhp,nsshealsp;
236        int critical_def,double_rate;
237        int long_attack_atk_rate; //Long range atk rate, not weapon based. [Skotlex]
238        int near_attack_def_rate,long_attack_def_rate,magic_def_rate,misc_def_rate;
239        int ignore_mdef_ele;
240        int ignore_mdef_race;
241        int perfect_hit;
242        int perfect_hit_add;
243        int get_zeny_rate;
244        int get_zeny_num; //Added Get Zeny Rate [Skotlex]
245        int double_add_rate;
246        int short_weapon_damage_return,long_weapon_damage_return;
247        int magic_damage_return; // AppleGirl Was Here
248        int random_attack_increase_add,random_attack_increase_per; // [Valaris]
249        int break_weapon_rate,break_armor_rate;
250        int crit_atk_rate;
251        int classchange; // [Valaris]
252        int speed_add_rate, aspd_add;
253        unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex]
254       
255        short splash_range, splash_add_range;
256        short add_steal_rate;
257        short sp_gain_value, hp_gain_value;
258        short sp_vanish_rate;
259        short sp_vanish_per;   
260        unsigned short unbreakable;     // chance to prevent ANY equipment breaking [celest]
261        unsigned short unbreakable_equip; //100% break resistance on certain equipment
262        unsigned short unstripable_equip;
263
264        // zeroed vars end here.
265
266        int castrate,delayrate,hprate,sprate,dsprate;
267        int atk_rate;
268        int speed_rate,hprecov_rate,sprecov_rate;
269        int matk_rate;
270        int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate;
271
272        int itemid;
273        short itemindex;        //Used item's index in sd->inventory [Skotlex]
274
275        short catch_target_class; // pet catching, stores a pet class to catch (short now) [zzo]
276
277        short spiritball, spiritball_old;
278        int spirit_timer[MAX_SKILL_LEVEL];
279
280        unsigned char potion_success_counter; //Potion successes in row counter
281        unsigned char mission_count; //Stores the bounty kill count for TK_MISSION
282        short mission_mobid; //Stores the target mob_id for TK_MISSION
283        int die_counter; //Total number of times you've died
284        int devotion[5]; //Stores the account IDs of chars devoted to.
285        int reg_num; //Number of registries (type numeric)
286        int regstr_num; //Number of registries (type string)
287
288        struct script_reg *reg;
289        struct script_regstr *regstr;
290
291        int trade_partner;
292        struct { 
293                struct {
294                        short index, amount;
295                } item[10];
296                int zeny, weight;
297        } deal;
298
299        bool party_creating; // whether the char is requesting party creation
300        bool party_joining; // whether the char is accepting party invitation
301        int party_invite, party_invite_account; // for handling party invitation (holds party id and account id)
302        int adopt_invite; // Adoption
303
304        int guild_invite,guild_invite_account;
305        int guild_emblem_id,guild_alliance,guild_alliance_account;
306        short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo]
307        int guildspy; // [Syrus22]
308        int partyspy; // [Syrus22]
309
310        int vender_id;
311        int vend_num;
312        char message[MESSAGE_SIZE];
313        struct s_vending vending[MAX_VENDING];
314
315        struct pet_data *pd;
316        struct homun_data *hd;  // [blackhole89]
317
318        struct{
319                int  m; //-1 - none, other: map index corresponding to map name.
320                unsigned short index; //map index
321        }feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars
322        short hate_mob[3];
323
324        int pvp_timer;
325        short pvp_point;
326        unsigned short pvp_rank, pvp_lastusers;
327        unsigned short pvp_won, pvp_lost;
328
329        char eventqueue[MAX_EVENTQUEUE][50];
330        int eventtimer[MAX_EVENTTIMER];
331        unsigned short eventcount; // [celest]
332
333        unsigned char change_level; // [celest]
334
335        char fakename[NAME_LENGTH]; // fake names [Valaris]
336
337        int duel_group; // duel vars [LuzZza]
338        int duel_invite;
339
340        char away_message[128]; // [LuzZza]
341
342        int cashPoints, kafraPoints;
343
344        // Auction System [Zephyrus]
345        struct {
346                int index, amount;
347        } auction;
348
349        // Mail System [Zephyrus]
350        struct {
351                short nameid;
352                int index, amount, zeny;
353                struct mail_data inbox;
354        } mail;
355
356        //Quest log system [Kevin]
357        int num_quests;
358        struct quest quest_log[MAX_QUEST];
359
360        // temporary debug [flaviojs]
361        const char* debug_file;
362        int debug_line;
363        const char* debug_func;
364};
365
366
367//Update this max as necessary. 54 is the value needed for Super Baby currently
368#define MAX_SKILL_TREE 54
369//Total number of classes (for data storage)
370#define CLASS_COUNT (JOB_MAX - JOB_NOVICE_HIGH + JOB_MAX_BASIC)
371
372enum weapon_type {
373        W_FIST, //Bare hands
374        W_DAGGER,       //1
375        W_1HSWORD,      //2
376        W_2HSWORD,      //3
377        W_1HSPEAR,      //4
378        W_2HSPEAR,      //5
379        W_1HAXE,        //6
380        W_2HAXE,        //7
381        W_MACE, //8
382        W_2HMACE,       //9 (unused)
383        W_STAFF,        //10
384        W_BOW,  //11
385        W_KNUCKLE,      //12   
386        W_MUSICAL,      //13
387        W_WHIP, //14
388        W_BOOK, //15
389        W_KATAR,        //16
390        W_REVOLVER,     //17
391        W_RIFLE,        //18
392        W_GATLING,      //19
393        W_SHOTGUN,      //20
394        W_GRENADE,      //21
395        W_HUUMA,        //22
396        W_2HSTAFF,      //23
397        MAX_WEAPON_TYPE,
398        // dual-wield constants
399        W_DOUBLE_DD, // 2 daggers
400        W_DOUBLE_SS, // 2 swords
401        W_DOUBLE_AA, // 2 axes
402        W_DOUBLE_DS, // dagger + sword
403        W_DOUBLE_DA, // dagger + axe
404        W_DOUBLE_SA, // sword + axe
405};
406
407enum ammo_type {
408        A_ARROW = 1,
409        A_DAGGER,   //2
410        A_BULLET,   //3
411        A_SHELL,    //4
412        A_GRENADE,  //5
413        A_SHURIKEN, //6
414        A_KUNAI     //7
415};
416
417//Equip position constants
418enum equip_pos {
419        EQP_HEAD_LOW = 0x0001, 
420        EQP_HEAD_MID = 0x0200, //512
421        EQP_HEAD_TOP = 0x0100, //256
422        EQP_HAND_R   = 0x0002,
423        EQP_HAND_L   = 0x0020, //32
424        EQP_ARMOR    = 0x0010, //16
425        EQP_SHOES    = 0x0040, //64
426        EQP_GARMENT  = 0x0004,
427        EQP_ACC_L    = 0x0008,
428        EQP_ACC_R    = 0x0080, //128
429        EQP_AMMO     = 0x8000, //32768
430};
431
432#define EQP_WEAPON EQP_HAND_R
433#define EQP_SHIELD EQP_HAND_L
434#define EQP_ARMS (EQP_HAND_R|EQP_HAND_L)
435#define EQP_HELM (EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)
436#define EQP_ACC (EQP_ACC_L|EQP_ACC_R)
437
438//Equip indexes constants. (eg: sd->equip_index[EQI_AMMO] returns the index
439//where the arrows are equipped)
440enum equip_index {
441        EQI_ACC_L = 0,
442        EQI_ACC_R,
443        EQI_SHOES,
444        EQI_GARMENT,
445        EQI_HEAD_LOW,
446        EQI_HEAD_MID,
447        EQI_HEAD_TOP,
448        EQI_ARMOR,
449        EQI_HAND_L,
450        EQI_HAND_R,
451        EQI_AMMO,
452        EQI_MAX
453};
454
455struct duel {
456        int members_count;
457        int invites_count;
458        int max_players_limit;
459};
460
461#define MAX_DUEL 1024
462extern struct duel duel_list[MAX_DUEL];
463extern int duel_count;
464
465#define pc_setdead(sd)        ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 1 )
466#define pc_setsit(sd)         ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 )
467#define pc_isdead(sd)         ( (sd)->state.dead_sit == 1 )
468#define pc_issit(sd)          ( (sd)->vd.dead_sit == 2 )
469#define pc_isidle(sd)         ( (sd)->chatID || (sd)->vender_id || DIFF_TICK(last_tick, (sd)->idletime) >= battle_config.idle_no_share )
470#define pc_istrading(sd)      ( (sd)->npc_id || (sd)->vender_id || (sd)->state.trading )
471#define pc_cant_act(sd)       ( (sd)->npc_id || (sd)->vender_id || (sd)->chatID || (sd)->sc.opt1 || (sd)->state.trading || (sd)->state.storage_flag )
472#define pc_setdir(sd,b,h)     ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) )
473#define pc_setchatid(sd,n)    ( (sd)->chatID = n )
474#define pc_ishiding(sd)       ( (sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) )
475#define pc_iscloaking(sd)     ( !((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK) )
476#define pc_ischasewalk(sd)    ( (sd)->sc.option&OPTION_CHASEWALK )
477#define pc_iscarton(sd)       ( (sd)->sc.option&OPTION_CART )
478#define pc_isfalcon(sd)       ( (sd)->sc.option&OPTION_FALCON )
479#define pc_isriding(sd)       ( (sd)->sc.option&OPTION_RIDING )
480#define pc_isinvisible(sd)    ( (sd)->sc.option&OPTION_INVISIBLE )
481#define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle_config.natural_heal_weight_rate )
482#define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 )
483#define pc_maxparameter(sd)   ( (sd)->class_&JOBL_BABY ? battle_config.max_baby_parameter : battle_config.max_parameter )
484
485#define pc_stop_walking(sd, type) unit_stop_walking(&(sd)->bl, type)
486#define pc_stop_attack(sd) unit_stop_attack(&(sd)->bl)
487
488//Weapon check considering dual wielding.
489#define pc_check_weapontype(sd, type) ((type)&((sd)->status.weapon < MAX_WEAPON_TYPE? \
490        1<<(sd)->status.weapon:(1<<(sd)->weapontype1)|(1<<(sd)->weapontype2)))
491//Checks if the given class value corresponds to a player class. [Skotlex]
492#define pcdb_checkid(class_) (class_ < JOB_MAX_BASIC || (class_ >= JOB_NOVICE_HIGH && class_ < JOB_MAX))
493
494int pc_class2idx(int class_);
495int pc_isGM(struct map_session_data *sd);
496int pc_getrefinebonus(int lv,int type);
497bool pc_can_give_items(int level);
498
499int pc_setrestartvalue(struct map_session_data *sd,int type);
500int pc_makesavestatus(struct map_session_data *);
501void pc_respawn(struct map_session_data* sd, uint8 clrtype);
502int pc_setnewpc(struct map_session_data*,int,int,int,unsigned int,int,int);
503bool pc_authok(struct map_session_data*, int, time_t, struct mmo_charstatus *);
504void pc_authfail(struct map_session_data *);
505int pc_reg_received(struct map_session_data *sd);
506
507int pc_isequip(struct map_session_data *sd,int n);
508int pc_equippoint(struct map_session_data *sd,int n);
509int pc_setinventorydata(struct map_session_data *sd);
510
511int pc_checkskill(struct map_session_data *sd,int skill_id);
512int pc_checkallowskill(struct map_session_data *sd);
513int pc_checkequip(struct map_session_data *sd,int pos);
514
515int pc_calc_skilltree(struct map_session_data *sd);
516int pc_calc_skilltree_normalize_job(struct map_session_data *sd);
517int pc_clean_skilltree(struct map_session_data *sd);
518
519#define pc_checkoverhp(sd) (sd->battle_status.hp == sd->battle_status.max_hp)
520#define pc_checkoversp(sd) (sd->battle_status.sp == sd->battle_status.max_sp)
521
522int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, uint8 clrtype);
523int pc_setsavepoint(struct map_session_data*,short,int,int);
524int pc_randomwarp(struct map_session_data *sd,int type);
525int pc_memo(struct map_session_data* sd, int pos);
526int pc_remove_map(struct map_session_data *sd,int clrtype);
527
528int pc_checkadditem(struct map_session_data*,int,int);
529int pc_inventoryblank(struct map_session_data*);
530int pc_search_inventory(struct map_session_data *sd,int item_id);
531int pc_payzeny(struct map_session_data*,int);
532int pc_additem(struct map_session_data*,struct item*,int);
533int pc_getzeny(struct map_session_data*,int);
534int pc_delitem(struct map_session_data*,int,int,int);
535
536// Special Shop System
537void pc_paycash(struct map_session_data *sd, int price, int points);
538void pc_getcash(struct map_session_data *sd, int cash, int points);
539
540int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount);
541int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type);
542int pc_putitemtocart(struct map_session_data *sd,int idx,int amount);
543int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount);
544int pc_cartitem_amount(struct map_session_data *sd,int idx,int amount);
545
546int pc_takeitem(struct map_session_data*,struct flooritem_data*);
547int pc_dropitem(struct map_session_data*,int,int);
548
549bool pc_isequipped(struct map_session_data *sd, int nameid);
550bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd );
551bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
552
553int pc_updateweightstatus(struct map_session_data *sd);
554
555int pc_autoscript_add(struct s_autoscript *scripts, int max, short rate, short flag, struct script_code *script);
556void pc_autoscript_clear(struct s_autoscript *scripts, int max);
557
558int pc_bonus(struct map_session_data*,int,int);
559int pc_bonus2(struct map_session_data *sd,int,int,int);
560int pc_bonus3(struct map_session_data *sd,int,int,int,int);
561int pc_bonus4(struct map_session_data *sd,int,int,int,int,int);
562int pc_bonus5(struct map_session_data *sd,int,int,int,int,int,int);
563int pc_skill(struct map_session_data* sd, int id, int level, int flag);
564
565int pc_insert_card(struct map_session_data *sd,int idx_card,int idx_equip);
566
567int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int skilllv);
568int pc_steal_coin(struct map_session_data *sd,struct block_list *bl);
569
570int pc_modifybuyvalue(struct map_session_data*,int);
571int pc_modifysellvalue(struct map_session_data*,int);
572
573int pc_follow(struct map_session_data*, int); // [MouseJstr]
574int pc_stop_following(struct map_session_data*);
575
576unsigned int pc_maxbaselv(struct map_session_data *sd);
577unsigned int pc_maxjoblv(struct map_session_data *sd);
578int pc_checkbaselevelup(struct map_session_data *sd);
579int pc_checkjoblevelup(struct map_session_data *sd);
580int pc_gainexp(struct map_session_data*,struct block_list*,unsigned int,unsigned int);
581unsigned int pc_nextbaseexp(struct map_session_data *);
582unsigned int pc_thisbaseexp(struct map_session_data *);
583unsigned int pc_nextjobexp(struct map_session_data *);
584unsigned int pc_thisjobexp(struct map_session_data *);
585int pc_need_status_point(struct map_session_data *,int);
586int pc_statusup(struct map_session_data*,int);
587int pc_statusup2(struct map_session_data*,int,int);
588int pc_skillup(struct map_session_data*,int);
589int pc_allskillup(struct map_session_data*);
590int pc_resetlvl(struct map_session_data*,int type);
591int pc_resetstate(struct map_session_data*);
592int pc_resetskill(struct map_session_data*, int);
593int pc_resetfeel(struct map_session_data*);
594int pc_resethate(struct map_session_data*);
595int pc_equipitem(struct map_session_data*,int,int);
596int pc_unequipitem(struct map_session_data*,int,int);
597int pc_checkitem(struct map_session_data*);
598int pc_useitem(struct map_session_data*,int);
599
600int pc_skillatk_bonus(struct map_session_data *sd, int skill_num);
601int pc_skillheal_bonus(struct map_session_data *sd, int skill_num);
602
603void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp);
604int pc_dead(struct map_session_data *sd,struct block_list *src);
605void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp);
606void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int type);
607int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp);
608int pc_percentheal(struct map_session_data *sd,int,int);
609int pc_jobchange(struct map_session_data *,int, int);
610int pc_setoption(struct map_session_data *,int);
611int pc_setcart(struct map_session_data* sd, int type);
612int pc_setfalcon(struct map_session_data* sd, int flag);
613int pc_setriding(struct map_session_data* sd, int flag);
614int pc_changelook(struct map_session_data *,int,int);
615int pc_equiplookall(struct map_session_data *sd);
616
617int pc_readparam(struct map_session_data*,int);
618int pc_setparam(struct map_session_data*,int,int);
619int pc_readreg(struct map_session_data*,int);
620int pc_setreg(struct map_session_data*,int,int);
621char *pc_readregstr(struct map_session_data *sd,int reg);
622int pc_setregstr(struct map_session_data *sd,int reg,const char *str);
623
624#define pc_readglobalreg(sd,reg) pc_readregistry(sd,reg,3)
625#define pc_setglobalreg(sd,reg,val) pc_setregistry(sd,reg,val,3)
626#define pc_readglobalreg_str(sd,reg) pc_readregistry_str(sd,reg,3)
627#define pc_setglobalreg_str(sd,reg,val) pc_setregistry_str(sd,reg,val,3)
628#define pc_readaccountreg(sd,reg) pc_readregistry(sd,reg,2)
629#define pc_setaccountreg(sd,reg,val) pc_setregistry(sd,reg,val,2)
630#define pc_readaccountregstr(sd,reg) pc_readregistry_str(sd,reg,2)
631#define pc_setaccountregstr(sd,reg,val) pc_setregistry_str(sd,reg,val,2)
632#define pc_readaccountreg2(sd,reg) pc_readregistry(sd,reg,1)
633#define pc_setaccountreg2(sd,reg,val) pc_setregistry(sd,reg,val,1)
634#define pc_readaccountreg2str(sd,reg) pc_readregistry_str(sd,reg,1)
635#define pc_setaccountreg2str(sd,reg,val) pc_setregistry_str(sd,reg,val,1)
636int pc_readregistry(struct map_session_data*,const char*,int);
637int pc_setregistry(struct map_session_data*,const char*,int,int);
638char *pc_readregistry_str(struct map_session_data*,char*,int);
639int pc_setregistry_str(struct map_session_data*,char*,const char*,int);
640
641int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name);
642int pc_deleventtimer(struct map_session_data *sd,const char *name);
643int pc_cleareventtimer(struct map_session_data *sd);
644int pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick);
645
646int pc_calc_pvprank(struct map_session_data *sd);
647int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr data);
648
649int pc_ismarried(struct map_session_data *sd);
650int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd);
651int pc_divorce(struct map_session_data *sd);
652struct map_session_data *pc_get_partner(struct map_session_data *sd);
653struct map_session_data *pc_get_father(struct map_session_data *sd);
654struct map_session_data *pc_get_mother(struct map_session_data *sd);
655struct map_session_data *pc_get_child(struct map_session_data *sd);
656
657void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick);
658void pc_regen (struct map_session_data *sd, unsigned int diff_tick);
659
660int pc_set_gm_level(int account_id, int level);
661void pc_setstand(struct map_session_data *sd);
662int pc_candrop(struct map_session_data *sd,struct item *item);
663
664int pc_jobid2mapid(unsigned short b_class);     // Skotlex
665int pc_mapid2jobid(unsigned short class_, int sex);     // Skotlex
666
667char * job_name(int class_);
668
669struct skill_tree_entry {
670        short id;
671        unsigned char max;
672        unsigned char joblv;
673        struct {
674                short id;
675                unsigned char lv;
676        } need[5];
677}; // Celest
678extern struct skill_tree_entry skill_tree[CLASS_COUNT][MAX_SKILL_TREE];
679
680struct sg_data {
681        short anger_id;
682        short bless_id;
683        short comfort_id;
684        char feel_var[NAME_LENGTH];
685        char hate_var[NAME_LENGTH];
686        int (*day_func)(void);
687};
688extern const struct sg_data sg_info[3];
689
690int pc_read_gm_account(int fd);
691void pc_setinvincibletimer(struct map_session_data* sd, int val);
692void pc_delinvincibletimer(struct map_session_data* sd);
693
694int pc_addspiritball(struct map_session_data *sd,int,int);
695int pc_delspiritball(struct map_session_data *sd,int,int);
696void pc_addfame(struct map_session_data *sd,int count);
697unsigned char pc_famerank(int char_id, int job);
698int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl);
699
700extern struct fame_list smith_fame_list[MAX_FAME_LIST];
701extern struct fame_list chemist_fame_list[MAX_FAME_LIST];
702extern struct fame_list taekwon_fame_list[MAX_FAME_LIST];
703
704int pc_readdb(void);
705int do_init_pc(void);
706void do_final_pc(void);
707
708enum {ADDITEM_EXIST,ADDITEM_NEW,ADDITEM_OVERAMOUNT};
709
710// timer for night.day
711extern int day_timer_tid;
712extern int night_timer_tid;
713int map_day_timer(int tid, unsigned int tick, int id, intptr data); // by [yor]
714int map_night_timer(int tid, unsigned int tick, int id, intptr data); // by [yor]
715
716//Duel functions // [LuzZza]
717int duel_create(struct map_session_data* sd, const unsigned int maxpl);
718int duel_invite(const unsigned int did, struct map_session_data* sd, struct map_session_data* target_sd);
719int duel_accept(const unsigned int did, struct map_session_data* sd);
720int duel_reject(const unsigned int did, struct map_session_data* sd);
721int duel_leave(const unsigned int did, struct map_session_data* sd);
722int duel_showinfo(const unsigned int did, struct map_session_data* sd);
723int duel_checktime(struct map_session_data* sd);
724
725int pc_read_motd(void); // [Valaris]
726int pc_disguise(struct map_session_data *sd, int class_);
727
728#endif /* _PC_H_ */
Note: See TracBrowser for help on using the browser.