diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 37 | ||||
-rw-r--r-- | src/map/mob.c | 5 | ||||
-rw-r--r-- | src/map/pc.c | 76 | ||||
-rw-r--r-- | src/map/pc.h | 2 | ||||
-rw-r--r-- | src/map/skill.c | 2 | ||||
-rw-r--r-- | src/map/status.c | 4 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 4 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 8 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 52 |
10 files changed, 155 insertions, 37 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 91ddc3ef9..00073e544 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -962,39 +962,10 @@ ACMD(option) *------------------------------------------*/ ACMD(hide) { - if (pc_isinvisible(sd)) { - sd->sc.option &= ~OPTION_INVISIBLE; - if (sd->disguise != -1 ) - status->set_viewdata(&sd->bl, sd->disguise); - else - status->set_viewdata(&sd->bl, sd->status.class); - clif->message(fd, msg_fd(fd,10)); // Invisible: Off - - // increment the number of pvp players on the map - map->list[sd->bl.m].users_pvp++; - - if( map->list[sd->bl.m].flag.pvp && !map->list[sd->bl.m].flag.pvp_nocalcrank ) { - // register the player for ranking calculations - sd->pvp_timer = timer->add( timer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0 ); - } - //bugreport:2266 - map->foreachinmovearea(clif->insight, &sd->bl, AREA_SIZE, sd->bl.x, sd->bl.y, BL_ALL, &sd->bl); - } else { - clif->clearunit_area(&sd->bl, CLR_OUTSIGHT); - sd->sc.option |= OPTION_INVISIBLE; - sd->vd.class = INVISIBLE_CLASS; - clif->message(fd, msg_fd(fd,11)); // Invisible: On - - // decrement the number of pvp players on the map - map->list[sd->bl.m].users_pvp--; - - if( map->list[sd->bl.m].flag.pvp && !map->list[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER ) { - // unregister the player for ranking - timer->delete( sd->pvp_timer, pc->calc_pvprank_timer ); - sd->pvp_timer = INVALID_TIMER; - } - } - clif->changeoption(&sd->bl); + if (pc_isinvisible(sd)) + pc->unhide(sd, true); + else + pc->hide(sd, true); return true; } diff --git a/src/map/mob.c b/src/map/mob.c index 07732b996..f36d626a3 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -446,6 +446,9 @@ static bool mob_ksprotected(struct block_list *src, struct block_list *target) if( !battle_config.ksprotection ) return false; // KS Protection Disabled + if (status->isdead(target) != 0) + return false; // Target is dead. + if( !(md = BL_CAST(BL_MOB,target)) ) return false; // Target is not MOB @@ -5012,12 +5015,10 @@ static int mob_read_db_sub(struct config_setting_t *mobt, int n, const char *sou md.status.def_ele = i32; md.status.ele_lv = value; } else if (!inherit) { - ShowWarning("mob_read_db_sub: Missing element for monster ID %d.\n", md.mob_id); md.status.def_ele = ELE_NEUTRAL; md.status.ele_lv = 1; } } else if (!inherit) { - ShowWarning("mob_read_db_sub: Missing element for monster ID %d.\n", md.mob_id); md.status.def_ele = ELE_NEUTRAL; md.status.ele_lv = 1; } diff --git a/src/map/pc.c b/src/map/pc.c index d21a31313..a8ed4430e 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9288,6 +9288,72 @@ static int pc_changelook(struct map_session_data *sd, int type, int val) return 0; } +/** + * Hides a character. + * + * @param sd The character to hide. + * @param show_msg Whether to show message to the character or not. + * + **/ +static void pc_hide(struct map_session_data *sd, bool show_msg) +{ + nullpo_retv(sd); + + clif->clearunit_area(&sd->bl, CLR_OUTSIGHT); + sd->sc.option |= OPTION_INVISIBLE; + sd->vd.class = INVISIBLE_CLASS; + + if (show_msg) + clif->message(sd->fd, atcommand->msgsd(sd, 11)); // Invisible: On + + // Decrement the number of pvp players on the map. + map->list[sd->bl.m].users_pvp--; + + if (map->list[sd->bl.m].flag.pvp != 0 && map->list[sd->bl.m].flag.pvp_nocalcrank == 0 + && sd->pvp_timer != INVALID_TIMER) { // Unregister the player for ranking. + timer->delete(sd->pvp_timer, pc->calc_pvprank_timer); + sd->pvp_timer = INVALID_TIMER; + } + + clif->changeoption(&sd->bl); +} + +/** + * Unhides a character. + * + * @param sd The character to unhide. + * @param show_msg Whether to show message to the character or not. + * + **/ +static void pc_unhide(struct map_session_data *sd, bool show_msg) +{ + nullpo_retv(sd); + + sd->sc.option &= ~OPTION_INVISIBLE; + + if (sd->disguise != -1) + status->set_viewdata(&sd->bl, sd->disguise); + else + status->set_viewdata(&sd->bl, sd->status.class); + + if (show_msg) + clif->message(sd->fd, atcommand->msgsd(sd, 10)); // Invisible: Off + + // Increment the number of pvp players on the map. + map->list[sd->bl.m].users_pvp++; + + if (map->list[sd->bl.m].flag.pvp != 0 && map->list[sd->bl.m].flag.pvp_nocalcrank == 0) // Register the player for ranking. + sd->pvp_timer = timer->add(timer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0); + + // bugreport:2266 + map->foreachinmovearea(clif->insight, &sd->bl, AREA_SIZE, sd->bl.x, sd->bl.y, BL_ALL, &sd->bl); + + if (sd->disguise != -1) + clif->spawn_unit(&sd->bl, AREA_WOS); + + clif->changeoption(&sd->bl); +} + /*========================================== * Give an option (type) to player (sd) and display it to client *------------------------------------------*/ @@ -9299,7 +9365,13 @@ static int pc_setoption(struct map_session_data *sd, int type) //Option has to be changed client-side before the class sprite or it won't always work (eg: Wedding sprite) [Skotlex] sd->sc.option=type; - clif->changeoption(&sd->bl); + + if ((p_type & OPTION_INVISIBLE) != 0 && (type & OPTION_INVISIBLE) == 0) // Unhide character. + pc->unhide(sd, false); + else if ((p_type & OPTION_INVISIBLE) == 0 && (type & OPTION_INVISIBLE) != 0) // Hide character. + pc->hide(sd, false); + else + clif->changeoption(&sd->bl); if( (type&OPTION_RIDING && !(p_type&OPTION_RIDING)) || (type&OPTION_DRAGON && !(p_type&OPTION_DRAGON) && pc->checkskill(sd,RK_DRAGONTRAINING) > 0) ) { // Mounting @@ -12824,6 +12896,8 @@ void pc_defaults(void) pc->itemheal = pc_itemheal; pc->percentheal = pc_percentheal; pc->jobchange = pc_jobchange; + pc->hide = pc_hide; + pc->unhide = pc_unhide; pc->setoption = pc_setoption; pc->setcart = pc_setcart; pc->setfalcon = pc_setfalcon; diff --git a/src/map/pc.h b/src/map/pc.h index 2699b7882..6b2b44e2a 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1044,6 +1044,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); diff --git a/src/map/skill.c b/src/map/skill.c index d7ad922c8..1222cf940 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -11296,7 +11296,7 @@ static int skill_castend_pos2(struct block_list *src, int x, int y, uint16 skill FALLTHROUGH case GS_GROUNDDRIFT: //Ammo should be deleted right away. if ( skill_id == WM_SEVERE_RAINSTORM ) - sc_start(src,src,SC_NO_SWITCH_EQUIP,100,0,skill->get_time(skill_id,skill_lv)); + sc_start(src, src, type, 100, 0, skill->get_time(skill_id, skill_lv)); skill->unitsetting(src,skill_id,skill_lv,x,y,0); break; case WZ_ICEWALL: diff --git a/src/map/status.c b/src/map/status.c index d3e85e5be..d2d65ce37 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -696,6 +696,7 @@ static void initChangeTables(void) status->set_sc( WM_BEYOND_OF_WARCRY , SC_BEYOND_OF_WARCRY , SCB_STR|SCB_CRI|SCB_MAXHP ); status->set_sc( WM_UNLIMITED_HUMMING_VOICE, SC_UNLIMITED_HUMMING_VOICE, SCB_NONE ); status->set_sc( WM_FRIGG_SONG , SC_FRIGG_SONG , SCB_MAXHP ); + status->set_sc( WM_SEVERE_RAINSTORM , SC_NO_SWITCH_EQUIP , SCB_NONE ); /** * Sorcerer @@ -7808,6 +7809,9 @@ static int status_change_start_sub(struct block_list *src, struct block_list *bl calc_flag = status->dbs->ChangeFlagTable[type]; if(!(flag&SCFLAG_LOADED)) { // Do not parse val settings when loading SCs switch(type) { + case SC_AUTOTRADE: + case SC_KSPROTECTED: + break; // Prevent calling status_change_start_unknown_sc(). case SC_ADORAMUS: sc_start(src,bl,SC_BLIND,100,val1,skill->get_time(status->sc2skill(type),val1)); // Fall through to SC_INC_AGI diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index b8aa5ae61..8192889c9 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -6210,6 +6210,10 @@ typedef int (*HPMHOOK_pre_pc_percentheal) (struct map_session_data **sd, int *hp typedef int (*HPMHOOK_post_pc_percentheal) (int retVal___, struct map_session_data *sd, int hp, int sp); typedef int (*HPMHOOK_pre_pc_jobchange) (struct map_session_data **sd, int *class, int *upper); typedef int (*HPMHOOK_post_pc_jobchange) (int retVal___, struct map_session_data *sd, int class, int upper); +typedef void (*HPMHOOK_pre_pc_hide) (struct map_session_data **sd, bool *show_msg); +typedef void (*HPMHOOK_post_pc_hide) (struct map_session_data *sd, bool show_msg); +typedef void (*HPMHOOK_pre_pc_unhide) (struct map_session_data **sd, bool *show_msg); +typedef void (*HPMHOOK_post_pc_unhide) (struct map_session_data *sd, bool show_msg); typedef int (*HPMHOOK_pre_pc_setoption) (struct map_session_data **sd, int *type); typedef int (*HPMHOOK_post_pc_setoption) (int retVal___, struct map_session_data *sd, int type); typedef int (*HPMHOOK_pre_pc_setcart) (struct map_session_data **sd, int *type); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 109c30885..13633807c 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -4790,6 +4790,10 @@ struct { struct HPMHookPoint *HP_pc_percentheal_post; struct HPMHookPoint *HP_pc_jobchange_pre; struct HPMHookPoint *HP_pc_jobchange_post; + struct HPMHookPoint *HP_pc_hide_pre; + struct HPMHookPoint *HP_pc_hide_post; + struct HPMHookPoint *HP_pc_unhide_pre; + struct HPMHookPoint *HP_pc_unhide_post; struct HPMHookPoint *HP_pc_setoption_pre; struct HPMHookPoint *HP_pc_setoption_post; struct HPMHookPoint *HP_pc_setcart_pre; @@ -11671,6 +11675,10 @@ struct { int HP_pc_percentheal_post; int HP_pc_jobchange_pre; int HP_pc_jobchange_post; + int HP_pc_hide_pre; + int HP_pc_hide_post; + int HP_pc_unhide_pre; + int HP_pc_unhide_post; int HP_pc_setoption_pre; int HP_pc_setoption_post; int HP_pc_setcart_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index ac30b97d4..673dcc67a 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2453,6 +2453,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->itemheal, HP_pc_itemheal) }, { HP_POP(pc->percentheal, HP_pc_percentheal) }, { HP_POP(pc->jobchange, HP_pc_jobchange) }, + { HP_POP(pc->hide, HP_pc_hide) }, + { HP_POP(pc->unhide, HP_pc_unhide) }, { HP_POP(pc->setoption, HP_pc_setoption) }, { HP_POP(pc->setcart, HP_pc_setcart) }, { HP_POP(pc->setfalcon, HP_pc_setfalcon) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 940f96ca2..1e76d9eb5 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -63705,6 +63705,58 @@ int HP_pc_jobchange(struct map_session_data *sd, int class, int upper) { } return retVal___; } +void HP_pc_hide(struct map_session_data *sd, bool show_msg) { + int hIndex = 0; + if (HPMHooks.count.HP_pc_hide_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, bool *show_msg); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_hide_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_hide_pre[hIndex].func; + preHookFunc(&sd, &show_msg); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pc.hide(sd, show_msg); + } + if (HPMHooks.count.HP_pc_hide_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, bool show_msg); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_hide_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_hide_post[hIndex].func; + postHookFunc(sd, show_msg); + } + } + return; +} +void HP_pc_unhide(struct map_session_data *sd, bool show_msg) { + int hIndex = 0; + if (HPMHooks.count.HP_pc_unhide_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, bool *show_msg); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_unhide_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_unhide_pre[hIndex].func; + preHookFunc(&sd, &show_msg); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pc.unhide(sd, show_msg); + } + if (HPMHooks.count.HP_pc_unhide_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, bool show_msg); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_unhide_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_unhide_post[hIndex].func; + postHookFunc(sd, show_msg); + } + } + return; +} int HP_pc_setoption(struct map_session_data *sd, int type) { int hIndex = 0; int retVal___ = 0; |