root/src/map/pc.h @ 18

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