root/src/map/pc.h @ 19

Revision 19, 27.3 kB (checked in by jinshiro, 17 years ago)

Now Compiles with Cygwin GCC

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