From 1e21ff7d621ca19f341318c67756d7b39baa7d7b Mon Sep 17 00:00:00 2001 From: shennetsind Date: Mon, 15 Apr 2013 23:54:36 -0300 Subject: Fixed Bug #7102 @hide is now persistent to logout http://hercules.ws/board/tracker/issue-7102-perfect-hide/ Signed-off-by: shennetsind --- src/map/pc.c | 29 +++++++++++++++++++++-------- src/map/status.c | 1 - src/map/status.h | 1 - 3 files changed, 21 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/map/pc.c b/src/map/pc.c index 0e1656b91..bb577a8fc 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -522,9 +522,9 @@ int pc_makesavestatus(struct map_session_data *sd) //Only copy the Cart/Peco/Falcon options, the rest are handled via //status change load/saving. [Skotlex] #ifdef NEW_CARTS - sd->status.option = sd->sc.option&(OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_MOUNTING); + sd->status.option = sd->sc.option&(OPTION_INVISIBLE|OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_MOUNTING); #else - sd->status.option = sd->sc.option&(OPTION_CART|OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_MOUNTING); + sd->status.option = sd->sc.option&(OPTION_INVISIBLE|OPTION_CART|OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_MOUNTING); #endif if (sd->sc.data[SC_JAILED]) { //When Jailed, do not move last point. @@ -1007,14 +1007,13 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim pc_setinventorydata(sd); pc_setequipindex(sd); + if( sd->status.option & OPTION_INVISIBLE && !pc_can_use_command(sd, "hide", COMMAND_ATCOMMAND) ) + sd->status.option &=~ OPTION_INVISIBLE; + status_change_init(&sd->bl); - - if (pc_can_use_command(sd, "hide", COMMAND_ATCOMMAND)) - sd->status.option &= (OPTION_MASK | OPTION_INVISIBLE); - else - sd->status.option &= OPTION_MASK; - + sd->sc.option = sd->status.option; //This is the actual option used in battle. + //Set here because we need the inventory data for weapon sprite parsing. status_set_viewdata(&sd->bl, sd->status.class_); unit_dataset(&sd->bl); @@ -1243,6 +1242,20 @@ int pc_reg_received(struct map_session_data *sd) pc_inventory_rentals(sd); + if( sd->sc.option & OPTION_INVISIBLE ) { + sd->vd.class_ = INVISIBLE_CLASS; + clif->message(sd->fd, msg_txt(11)); // Invisible: On + // decrement the number of pvp players on the map + map[sd->bl.m].users_pvp--; + + if( map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER ) {// unregister the player for ranking + delete_timer( sd->pvp_timer, pc_calc_pvprank_timer ); + sd->pvp_timer = INVALID_TIMER; + } + clif->changeoption(&sd->bl); + } + + return 1; } diff --git a/src/map/status.c b/src/map/status.c index f7531494e..7412467c3 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -8998,7 +8998,6 @@ int status_change_clear(struct block_list* bl, int type) { sc->opt1 = 0; sc->opt2 = 0; sc->opt3 = 0; - sc->option &= OPTION_MASK; if( type == 0 || type == 2 ) clif->changeoption(bl); diff --git a/src/map/status.h b/src/map/status.h index 4535b1aed..3c02b9d6c 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -1488,7 +1488,6 @@ enum { // compound constants OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, - OPTION_MASK = ~OPTION_INVISIBLE, }; //Defines for the manner system [Skotlex] -- cgit v1.2.3-70-g09d2