root/src/map/pc.h @ 1

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