diff options
Diffstat (limited to 'src/map/pc.h')
-rw-r--r-- | src/map/pc.h | 112 |
1 files changed, 68 insertions, 44 deletions
diff --git a/src/map/pc.h b/src/map/pc.h index 06bc5e5ae..af52f8946 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -33,8 +33,9 @@ #include "map/status.h" // enum sc_type, OPTION_* #include "map/unit.h" // struct unit_data, struct view_data #include "map/vending.h" // struct s_vending -#include "common/hercules.h" +#include "common/db.h" #include "common/ers.h" // struct eri +#include "common/hercules.h" #include "common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus, NEW_CARTS /** @@ -72,6 +73,14 @@ enum equip_index { EQI_MAX }; +enum prevent_logout_trigger { + PLT_NONE = 0x0, + PLT_LOGIN = 0x1, + PLT_ATTACK = 0x2, + PLT_SKILL = 0x4, + PLT_DAMAGE = 0x8 +}; + enum pc_unequipitem_flag { PCUNEQUIPITEM_NONE = 0x0, ///< Just unequip PCUNEQUIPITEM_RECALC = 0x1, ///< Recalculate status after unequipping @@ -85,6 +94,14 @@ enum pc_resetskill_flag { PCRESETSKILL_CHSEX = 0x4, // just reset the skills if the player class is a bard/dancer type (for changesex.) }; +enum pc_checkitem_types { + PCCHECKITEM_NONE = 0x0, + PCCHECKITEM_INVENTORY = 0x1, + PCCHECKITEM_CART = 0x2, + PCCHECKITEM_STORAGE = 0x4, + PCCHECKITEM_GSTORAGE = 0x8 +}; + struct weapon_data { int atkmods[3]; BEGIN_ZEROED_BLOCK; // all the variables within this block get zero'ed in each call of status_calc_pc @@ -216,7 +233,6 @@ struct map_session_data { unsigned int hold_recalc : 1; unsigned int snovice_call_flag : 3; //Summon Angel (stage 1~3) unsigned int hpmeter_visible : 1; - unsigned int itemcheck : 1; unsigned int standalone : 1;/* [Ind/Hercules <3] */ unsigned int loggingout : 1; unsigned int warp_clean : 1; @@ -234,7 +250,7 @@ struct map_session_data { unsigned int bonus_coma : 1; } special_state; int login_id1, login_id2; - unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex] + uint16 job; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex] /// Groups & permissions int group_id; @@ -242,7 +258,9 @@ struct map_session_data { unsigned int extra_temp_permissions; /* permissions from @addperm */ struct mmo_charstatus status; - struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups) + struct item_data *inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups) + struct storage_data storage; ///< Account Storage + enum pc_checkitem_types itemcheck; short equip_index[EQI_MAX]; unsigned int weight,max_weight; int cart_weight,cart_num,cart_weight_max; @@ -257,7 +275,7 @@ struct map_session_data { struct script_state *st; char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine int npc_timer_id; //For player attached npc timers. [Skotlex] - unsigned int chatID; + int chat_id; int64 idletime; struct { int npc_id; @@ -302,8 +320,8 @@ BEGIN_ZEROED_BLOCK; // this block will be globally zeroed at the beginning of st int reseff[SC_COMMON_MAX-SC_COMMON_MIN+1]; int weapon_coma_ele[ELE_MAX]; int weapon_coma_race[RC_MAX]; - int weapon_atk[16]; - int weapon_atk_rate[16]; + int weapon_atk[MAX_WEAPON_TYPE]; + int weapon_atk_rate[MAX_WEAPON_TYPE]; int arrow_addele[ELE_MAX]; int arrow_addrace[RC_MAX]; int arrow_addsize[3]; @@ -455,8 +473,8 @@ END_ZEROED_BLOCK; int eventtimer[MAX_EVENTTIMER]; unsigned short eventcount; // [celest] - unsigned char change_level_2nd; // job level when changing from 1st to 2nd class [jobchange_level in global_reg_value] - unsigned char change_level_3rd; // job level when changing from 2nd to 3rd class [jobchange_level_3rd in global_reg_value] + int change_level_2nd; // job level when changing from 1st to 2nd class [jobchange_level in global_reg_value] + int change_level_3rd; // job level when changing from 2nd to 3rd class [jobchange_level_3rd in global_reg_value] char fakename[NAME_LENGTH]; // fake names [Valaris] @@ -530,7 +548,7 @@ END_ZEROED_BLOCK; unsigned char channel_count; struct channel_data *gcbind; unsigned char fontcolor; - unsigned int fontcolor_tid; + int fontcolor_tid; int64 hchsysch_tick; /* [Ind/Hercules] */ @@ -563,7 +581,7 @@ END_ZEROED_BLOCK; /* */ struct { - unsigned int second,third; + int second, third; } sktree; /** @@ -609,15 +627,15 @@ END_ZEROED_BLOCK; #define pc_setsit(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 ) #define pc_isdead(sd) ( (sd)->state.dead_sit == 1 ) #define pc_issit(sd) ( (sd)->vd.dead_sit == 2 ) -#define pc_isidle(sd) ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(sockt->last_tick, (sd)->idletime) >= battle->bc->idle_no_share ) +#define pc_isidle(sd) ( (sd)->chat_id != 0 || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(sockt->last_tick, (sd)->idletime) >= battle->bc->idle_no_share ) #define pc_istrading(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) -#define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) +#define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chat_id != 0 || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) /* equals pc_cant_act except it doesn't check for chat rooms */ #define pc_cant_act2(sd) ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) #define pc_setdir(sd,b,h) ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) ) -#define pc_setchatid(sd,n) ( (sd)->chatID = n ) +#define pc_setchatid(sd,n) ( (sd)->chat_id = (n) ) #define pc_ishiding(sd) ( (sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) ) #define pc_iscloaking(sd) ( !((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK) ) #define pc_ischasewalk(sd) ( (sd)->sc.option&OPTION_CHASEWALK ) @@ -634,12 +652,13 @@ END_ZEROED_BLOCK; #define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle->bc->natural_heal_weight_rate ) #define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 ) #define pc_maxparameter(sd) ( \ - ( ((sd)->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO \ - || ((sd)->class_&MAPID_UPPERMASK) == MAPID_REBELLION \ - || ((sd)->class_&MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E \ - ) ? battle->bc->max_extended_parameter : ((sd)->class_&JOBL_THIRD) ? \ - (((sd)->class_&JOBL_BABY) ? battle->bc->max_baby_third_parameter : battle->bc->max_third_parameter ) : \ - (((sd)->class_&JOBL_BABY) ? battle->bc->max_baby_parameter : battle->bc->max_parameter) \ + ((sd)->job & MAPID_BASEMASK) == MAPID_SUMMONER ? battle->bc->max_summoner_parameter : \ + ( ((sd)->job & MAPID_UPPERMASK) == MAPID_KAGEROUOBORO \ + || ((sd)->job & MAPID_UPPERMASK) == MAPID_REBELLION \ + || ((sd)->job & MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E \ + ) ? battle->bc->max_extended_parameter : ((sd)->job & JOBL_THIRD) ? \ + (((sd)->job & JOBL_BABY) ? battle->bc->max_baby_third_parameter : battle->bc->max_third_parameter ) : \ + (((sd)->job & JOBL_BABY) ? battle->bc->max_baby_parameter : battle->bc->max_parameter) \ ) /// Generic check for mounts #define pc_hasmount(sd) ( (sd)->sc.option&(OPTION_RIDING|OPTION_WUGRIDER|OPTION_DRAGON|OPTION_MADOGEAR) ) @@ -657,7 +676,7 @@ END_ZEROED_BLOCK; #define pc_stop_attack(sd) (unit->stop_attack(&(sd)->bl)) //Weapon check considering dual wielding. -#define pc_check_weapontype(sd, type) ((type)&((sd)->status.weapon < MAX_WEAPON_TYPE? \ +#define pc_check_weapontype(sd, type) ((type)&((sd)->status.weapon < MAX_SINGLE_WEAPON_TYPE? \ 1<<(sd)->status.weapon:(1<<(sd)->weapontype1)|(1<<(sd)->weapontype2)|(1<<(sd)->status.weapon))) // clientside display macros (values to the left/right of the "+") @@ -784,9 +803,9 @@ struct autotrade_vending { struct pc_interface { /* */ - DBMap *at_db;/* char id -> struct autotrade_vending */ + struct DBMap *at_db;/* char id -> struct autotrade_vending */ /* */ - DBMap* itemcd_db; + struct DBMap *itemcd_db; /* */ int day_timer_tid; int night_timer_tid; @@ -794,7 +813,7 @@ struct pc_interface { BEGIN_ZEROED_BLOCK; /* Everything within this block will be memset to 0 when status_defaults() is executed */ unsigned int exp_table[CLASS_COUNT][2][MAX_LEVEL]; - unsigned int max_level[CLASS_COUNT][2]; + int max_level[CLASS_COUNT][2]; unsigned int statp[MAX_LEVEL+1]; unsigned int level_penalty[3][RC_MAX][MAX_LEVEL*2+1]; /* */ @@ -822,7 +841,7 @@ END_ZEROED_BLOCK; /* End */ void (*final) (void); struct map_session_data* (*get_dummy_sd) (void); - int (*class2idx) (int class_); + int (*class2idx) (int class); bool (*can_talk) (struct map_session_data *sd); bool (*can_attack) ( struct map_session_data *sd, int target_id ); @@ -834,7 +853,7 @@ END_ZEROED_BLOCK; /* End */ int (*makesavestatus) (struct map_session_data *sd); void (*respawn) (struct map_session_data* sd, clr_type clrtype); int (*setnewpc) (struct map_session_data *sd, int account_id, int char_id, int login_id1, unsigned int client_tick, int sex, int fd); - bool (*authok) (struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers); + bool (*authok) (struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, const struct mmo_charstatus *st, bool changing_mapservers); void (*authfail) (struct map_session_data *sd); int (*reg_received) (struct map_session_data *sd); @@ -900,7 +919,7 @@ END_ZEROED_BLOCK; /* End */ bool (*can_insert_card_into) (struct map_session_data* sd, int idx_card, int idx_equip); int (*steal_item) (struct map_session_data *sd,struct block_list *bl, uint16 skill_lv); - int (*steal_coin) (struct map_session_data *sd,struct block_list *bl); + int (*steal_coin) (struct map_session_data *sd,struct block_list *bl, uint16 skill_lv); int (*modifybuyvalue) (struct map_session_data *sd,int orig_value); int (*modifysellvalue) (struct map_session_data *sd,int orig_value); @@ -908,15 +927,15 @@ END_ZEROED_BLOCK; /* End */ int (*follow) (struct map_session_data *sd, int target_id); // [MouseJstr] int (*stop_following) (struct map_session_data *sd); - unsigned int (*maxbaselv) (struct map_session_data *sd); - unsigned int (*maxjoblv) (struct map_session_data *sd); + int (*maxbaselv) (const struct map_session_data *sd); + int (*maxjoblv) (const struct map_session_data *sd); int (*checkbaselevelup) (struct map_session_data *sd); int (*checkjoblevelup) (struct map_session_data *sd); bool (*gainexp) (struct map_session_data *sd, struct block_list *src, unsigned int base_exp, unsigned int job_exp, bool is_quest); - unsigned int (*nextbaseexp) (struct map_session_data *sd); - unsigned int (*thisbaseexp) (struct map_session_data *sd); - unsigned int (*nextjobexp) (struct map_session_data *sd); - unsigned int (*thisjobexp) (struct map_session_data *sd); + unsigned int (*nextbaseexp) (const struct map_session_data *sd); + unsigned int (*thisbaseexp) (const struct map_session_data *sd); + unsigned int (*nextjobexp) (const struct map_session_data *sd); + unsigned int (*thisjobexp) (const struct map_session_data *sd); int (*gets_status_point) (int level); int (*need_status_point) (struct map_session_data *sd,int type,int val); int (*maxparameterincrease) (struct map_session_data* sd, int type); @@ -946,7 +965,7 @@ END_ZEROED_BLOCK; /* End */ void (*heal) (struct map_session_data *sd,unsigned int hp,unsigned int sp, int type); int (*itemheal) (struct map_session_data *sd,int itemid, int hp,int sp); int (*percentheal) (struct map_session_data *sd,int hp,int sp); - int (*jobchange) (struct map_session_data *sd,int job, int upper); + int (*jobchange) (struct map_session_data *sd, int class, int upper); int (*setoption) (struct map_session_data *sd,int type); int (*setcart) (struct map_session_data* sd, int type); void (*setfalcon) (struct map_session_data *sd, bool flag); @@ -957,7 +976,7 @@ END_ZEROED_BLOCK; /* End */ int (*changelook) (struct map_session_data *sd,int type,int val); int (*equiplookall) (struct map_session_data *sd); - int (*readparam) (struct map_session_data *sd,int type); + int (*readparam) (const struct map_session_data *sd, int type); int (*setparam) (struct map_session_data *sd,int type,int val); int (*readreg) (struct map_session_data *sd, int64 reg); void (*setreg) (struct map_session_data *sd, int64 reg,int val); @@ -990,10 +1009,10 @@ END_ZEROED_BLOCK; /* End */ void (*setstand) (struct map_session_data *sd); int (*candrop) (struct map_session_data *sd,struct item *item); - int (*jobid2mapid) (unsigned short b_class); // Skotlex + int (*jobid2mapid) (int16 class); // Skotlex int (*mapid2jobid) (unsigned short class_, int sex); // Skotlex - const char * (*job_name) (int class_); + const char * (*job_name) (int class); void (*setinvincibletimer) (struct map_session_data* sd, int val); void (*delinvincibletimer) (struct map_session_data* sd); @@ -1001,8 +1020,9 @@ END_ZEROED_BLOCK; /* End */ int (*addspiritball) (struct map_session_data *sd,int interval,int max); int (*delspiritball) (struct map_session_data *sd,int count,int type); int (*getmaxspiritball) (struct map_session_data *sd, int min); - void (*addfame) (struct map_session_data *sd,int count); - unsigned char (*famerank) (int char_id, int job); + void (*addfame) (struct map_session_data *sd, int ranktype, int count); + int (*fame_rank) (int char_id, int ranktype); + int (*famelist_type) (uint16 job_mapid); int (*set_hate_mob) (struct map_session_data *sd, int pos, struct block_list *bl); int (*readdb) (void); @@ -1013,7 +1033,7 @@ END_ZEROED_BLOCK; /* End */ int (*inventory_rental_clear) (struct map_session_data *sd); void (*inventory_rental_add) (struct map_session_data *sd, int seconds); - int (*disguise) (struct map_session_data *sd, int class_); + int (*disguise) (struct map_session_data *sd, int class); bool (*isautolooting) (struct map_session_data *sd, int nameid); void (*overheat) (struct map_session_data *sd, int val); @@ -1028,7 +1048,7 @@ END_ZEROED_BLOCK; /* End */ void (*del_charm) (struct map_session_data *sd, int count, int type); void (*baselevelchanged) (struct map_session_data *sd); - int (*level_penalty_mod) (int diff, unsigned char race, unsigned short mode, int type); + int (*level_penalty_mod) (int diff, unsigned char race, uint32 mode, int type); int (*calc_skillpoint) (struct map_session_data* sd); int (*invincible_timer) (int tid, int64 tick, int id, intptr_t data); @@ -1072,7 +1092,7 @@ END_ZEROED_BLOCK; /* End */ int (*global_expiration_timer) (int tid, int64 tick, int id, intptr_t data); void (*expire_check) (struct map_session_data *sd); - bool (*db_checkid) (unsigned int class_); + bool (*db_checkid) (int class); void (*validate_levels) (void); @@ -1084,12 +1104,16 @@ END_ZEROED_BLOCK; /* End */ void (*autotrade_start) (struct map_session_data *sd); void (*autotrade_prepare) (struct map_session_data *sd); void (*autotrade_populate) (struct map_session_data *sd); - int (*autotrade_final) (DBKey key, DBData *data, va_list ap); + int (*autotrade_final) (union DBKey key, struct DBData *data, va_list ap); int (*check_job_name) (const char *name); void (*update_idle_time) (struct map_session_data* sd, enum e_battle_config_idletime type); - + int (*have_magnifier) (struct map_session_data *sd); + + bool (*process_chat_message) (struct map_session_data *sd, const char *message); + void (*check_supernovice_call) (struct map_session_data *sd, const char *message); + bool (*check_basicskill) (struct map_session_data *sd, int level); }; #ifdef HERCULES_CORE |