diff options
Diffstat (limited to 'src/map/pc.h')
-rw-r--r-- | src/map/pc.h | 70 |
1 files changed, 45 insertions, 25 deletions
diff --git a/src/map/pc.h b/src/map/pc.h index e940c3310..e8e591b09 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -103,6 +103,13 @@ enum pc_checkitem_types { PCCHECKITEM_GSTORAGE = 0x8 }; +/** Bit flags for allowed item actions while interacting with NPC. **/ +enum item_enabled_npc_flags { + ITEMENABLEDNPC_NONE = 0x0, //!< Don't allow any item actions while interacting with NPC. + ITEMENABLEDNPC_EQUIP = 0x1, //!< Allow changing equipment while interacting with NPC. + ITEMENABLEDNPC_CONSUME = 0x2, //!< Allow consuming usable items while interacting with NPC. +}; + 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 @@ -173,6 +180,17 @@ struct pc_combos { int id; /* this combo id */ }; +/** Auto-cast related data. **/ +struct autocast_data { + enum autocast_type type; // The auto-cast type. + int skill_id; // The auto-cast skill ID. + int skill_lv; // The auto-cast skill level. + bool itemskill_conditions_checked; // Used by itemskill() script command, to prevent second check of conditions after target was selected. + bool itemskill_check_conditions; // Used by itemskill() script command, to check skill conditions and consume them. + bool itemskill_instant_cast; // Used by itemskill() script command, to cast skill instantaneously. + bool itemskill_cast_on_self; // Used by itemskill() script command, to forcefully cast skill on invoking character. +}; + struct map_session_data { struct block_list bl; struct unit_data ud; @@ -181,6 +199,8 @@ struct map_session_data { struct status_change sc; struct regen_data regen; struct regen_data_sub sregen, ssregen; + struct autocast_data auto_cast_current; // Currently processed auto-cast skill. + VECTOR_DECL(struct autocast_data) auto_cast; // Auto-cast vector. //NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in //status_calc_pc, while special_state is recalculated in each call. [Skotlex] struct { @@ -194,8 +214,6 @@ struct map_session_data { unsigned int rest : 1; unsigned int storage_flag : 2; // @see enum storage_flag unsigned int snovice_dead_flag : 1; //Explosion spirits on death: 0 off, 1 used. - unsigned int abra_flag : 2; // Abracadabra bugfix by Aru - unsigned int autocast : 1; // Autospell flag [Inkfish] unsigned int autotrade : 2; //By Fantik unsigned int showdelay :1; unsigned int showexp :1; @@ -206,6 +224,7 @@ struct map_session_data { unsigned int size :2; // for tiny/large types unsigned int night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex] unsigned int using_fake_npc :1; + unsigned int using_megaphone : 1; //!< Whether the character is currently using a Megephone (ID=12221). unsigned int rewarp :1; //Signals that a player should warp as soon as he is done loading a map. [Skotlex] unsigned int killer : 1; unsigned int killable : 1; @@ -240,10 +259,6 @@ struct map_session_data { unsigned int refine_ui : 1; unsigned int npc_unloaded : 1; ///< The player is talking with an unloaded NPCs (respawned tombstones) unsigned int lapine_ui : 1; - unsigned int itemskill_conditions_checked : 1; // Used by itemskill() script command, to prevent second check of conditions after target was selected. - unsigned int itemskill_no_conditions : 1; // Used by itemskill() script command, to ignore skill conditions and don't consume them. - unsigned int itemskill_no_casttime : 1; // Used by itemskill() script command, to cast skill instantaneously. - unsigned int itemskill_castonself : 1; // Used by itemskill() script command, to forcefully cast skill on invoking character. } state; struct { unsigned char no_weapon_damage, no_magic_damage, no_misc_damage; @@ -298,7 +313,6 @@ struct map_session_data { int followtimer; // [MouseJstr] int followtarget; time_t emotionlasttime; // to limit flood with emotion packets - int skillitem,skillitemlv; uint16 skill_id_old,skill_lv_old; uint16 skill_id_dance,skill_lv_dance; short cook_mastery; // range: [0,1999] [Inkfish] @@ -434,7 +448,7 @@ END_ZEROED_BLOCK; int spiritball, spiritball_old; int spirit_timer[MAX_SPIRITBALL]; int charm_count; - int charm_type; + enum spirit_charm_types charm_type; int charm_timer[MAX_SPIRITCHARM]; unsigned char potion_success_counter; //Potion successes in row counter unsigned char mission_count; //Stores the bounty kill count for TK_MISSION @@ -492,6 +506,7 @@ END_ZEROED_BLOCK; 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] + int fakename_options; // Fake name display options. int duel_group; // duel vars [LuzZza] int duel_invite; @@ -623,10 +638,6 @@ END_ZEROED_BLOCK; uint8 lang_id; - // temporary debugging of bug #3504 - const char* delunit_prevfile; - int delunit_prevline; - // HatEffect VECTOR_DECL(int) hatEffectId; @@ -647,15 +658,6 @@ END_ZEROED_BLOCK; bool achievements_received; // Title VECTOR_DECL(int) title_ids; - - /* - * itemskill_conditions_checked/itemskill_no_conditions/itemskill_no_casttime/itemskill_castonself abuse prevention. - * If a skill, casted by itemskill() script command, is aborted while target selection, - * the map server gets no notification where these states could be unset. - * Thus we need this helper variables to prevent abusing these states for next skill cast. - */ - int itemskill_id; - int itemskill_lv; }; #define EQP_WEAPON EQP_HAND_R @@ -680,7 +682,11 @@ END_ZEROED_BLOCK; #define pc_issit(sd) ( (sd)->vd.dead_sit == 2 ) #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_istrading_except_npc(sd) ( (sd)->state.vending != 0 || (sd)->state.buyingstore != 0 || (sd)->state.trading != 0 ) #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 || (sd)->state.refine_ui == 1 || (sd)->state.lapine_ui == 1) +#define pc_cant_act_except_lapine(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 || (sd)->state.refine_ui == 1) +#define pc_cant_act_except_npc(sd) ( (sd)->state.vending != 0 || (sd)->state.buyingstore != 0 || (sd)->chat_id != 0 || ((sd)->sc.opt1 != 0 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading != 0 || (sd)->state.storage_flag != 0 || (sd)->state.prevend != 0 || (sd)->state.refine_ui == 1 || (sd)->state.lapine_ui == 1) +#define pc_cant_act_except_npc_chat(sd) ( (sd)->state.vending != 0 || (sd)->state.buyingstore != 0 || ((sd)->sc.opt1 != 0 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading != 0 || (sd)->state.storage_flag != 0 || (sd)->state.prevend != 0 || (sd)->state.refine_ui == 1 || (sd)->state.lapine_ui == 1) /* 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 || (sd)->state.refine_ui == 1 || (sd)->state.lapine_ui == 1) @@ -690,7 +696,7 @@ END_ZEROED_BLOCK; #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 ) -#define pc_ismuted(sc,type) ( (sc)->data[SC_NOCHAT] && (sc)->data[SC_NOCHAT]->val1&(type) ) +#define pc_ismuted(sc, type) ( (sc)->data[SC_NOCHAT] != NULL && (battle_config.manner_system & (type)) != 0 ) #define pc_isvending(sd) ((sd)->state.vending || (sd)->state.prevend || (sd)->state.buyingstore) #ifdef NEW_CARTS @@ -724,6 +730,9 @@ END_ZEROED_BLOCK; /// Rune Knight Dragon #define pc_isridingdragon(sd) ( (sd)->sc.option&OPTION_DRAGON ) +// Check if character has a pet. +#define pc_has_pet(sd) ( (sd)->status.pet_id != 0 && (sd)->pd != NULL && (sd)->pd->pet.intimate > PET_INTIMACY_NONE ) + #define pc_stop_walking(sd, type) (unit->stop_walking(&(sd)->bl, (type))) #define pc_stop_attack(sd) (unit->stop_attack(&(sd)->bl)) @@ -870,6 +879,12 @@ struct class_exp_tables { struct class_exp_group *class_exp_table[CLASS_COUNT][2]; }; +enum player_actions_when_dead_flags { + PCALLOWACTION_NONE = 0x0, // Don't allow trading and open chat rooms. + PCALLOWACTION_TRADE = 0x1, // Allow trading when dead. + PCALLOWACTION_CHAT = 0x2, // Allow open chat room when dead. +}; + /*===================================== * Interface : pc.h * Generated by HerculesInterfaceMaker @@ -1034,7 +1049,10 @@ END_ZEROED_BLOCK; /* End */ void (*unequipitem_pos) (struct map_session_data *sd, int n, int pos); int (*checkitem) (struct map_session_data *sd); int (*useitem) (struct map_session_data *sd,int n); - int (*itemskill_clear) (struct map_session_data *sd); + void (*autocast_clear_current) (struct map_session_data *sd); + void (*autocast_clear) (struct map_session_data *sd); + void (*autocast_set_current) (struct map_session_data *sd, int skill_id); + void (*autocast_remove) (struct map_session_data *sd, enum autocast_type type, int skill_id, int skill_lv); int (*skillatk_bonus) (struct map_session_data *sd, uint16 skill_id); int (*skillheal_bonus) (struct map_session_data *sd, uint16 skill_id); @@ -1047,6 +1065,8 @@ END_ZEROED_BLOCK; /* End */ 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 class, int upper); + void (*hide) (struct map_session_data *sd, bool show_msg); + void (*unhide) (struct map_session_data *sd, bool show_msg); 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); @@ -1130,8 +1150,8 @@ END_ZEROED_BLOCK; /* End */ int (*load_combo) (struct map_session_data *sd); - void (*add_charm) (struct map_session_data *sd, int interval, int max, int type); - void (*del_charm) (struct map_session_data *sd, int count, int type); + void (*add_charm) (struct map_session_data *sd, int interval, int max, enum spirit_charm_types type); + void (*del_charm) (struct map_session_data *sd, int count, enum spirit_charm_types type); void (*baselevelchanged) (struct map_session_data *sd); int (*level_penalty_mod) (int diff, unsigned char race, uint32 mode, int type); |