diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-04-08 07:48:30 +0200 |
---|---|---|
committer | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-04-08 08:08:46 +0200 |
commit | 18c93185ecf6b150d027a070c49c46dbd2ec45c1 (patch) | |
tree | 6b4ac8933360e2526d9c836d7f272cde3b1e2997 /src/map | |
parent | e5d0f388bd40dbadebe1d18a4a6c2805648baa13 (diff) | |
download | hercules-18c93185ecf6b150d027a070c49c46dbd2ec45c1.tar.gz hercules-18c93185ecf6b150d027a070c49c46dbd2ec45c1.tar.bz2 hercules-18c93185ecf6b150d027a070c49c46dbd2ec45c1.tar.xz hercules-18c93185ecf6b150d027a070c49c46dbd2ec45c1.zip |
Add pc_unhide() function
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/pc.c | 37 | ||||
-rw-r--r-- | src/map/pc.h | 1 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 194c2cbb1..ded87f368 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9318,6 +9318,42 @@ static void pc_hide(struct map_session_data *sd, bool show_msg) 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 *------------------------------------------*/ @@ -12855,6 +12891,7 @@ void pc_defaults(void) 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 b895c75db..6b2b44e2a 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1045,6 +1045,7 @@ END_ZEROED_BLOCK; /* End */ 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); |