Small OPTION_INVISIBLE refactor

* Cleaned up the usage of OPTION_INVISIBLE to utilize the macro that was defined for it.
This commit is contained in:
aleos89 2016-11-18 14:44:49 -05:00
parent 1aa2012cff
commit ef63cffa30
4 changed files with 14 additions and 14 deletions

View File

@ -643,7 +643,7 @@ ACMD_FUNC(who) {
iter = mapit_getallusers();
for (pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter)) {
if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || (pl_sd->sc.option & OPTION_INVISIBLE)) && pc_get_group_level(pl_sd) > level)) { // you can look only lower or same level
if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || pc_isinvisible(pl_sd)) && pc_get_group_level(pl_sd) > level)) { // you can look only lower or same level
if (stristr(pl_sd->status.name, player_name) == NULL // search with no case sensitive
|| (map_id >= 0 && pl_sd->bl.m != map_id))
continue;
@ -751,7 +751,7 @@ ACMD_FUNC(whogm)
continue;
}
if (pl_level > level) {
if (pl_sd->sc.option & OPTION_INVISIBLE)
if (pc_isinvisible(pl_sd))
continue;
sprintf(atcmd_output, msg_txt(sd,913), pl_sd->status.name); // Name: %s (GM)
clif_displaymessage(fd, atcmd_output);
@ -973,7 +973,7 @@ ACMD_FUNC(option)
ACMD_FUNC(hide)
{
nullpo_retr(-1, sd);
if (sd->sc.option & OPTION_INVISIBLE) {
if (pc_isinvisible(sd)) {
sd->sc.option &= ~OPTION_INVISIBLE;
if (sd->disguise)
status_set_viewdata(&sd->bl, sd->disguise);

View File

@ -5943,7 +5943,7 @@ void clif_status_change(struct block_list *bl, int type, int flag, int tick, int
if (!(status_type2relevant_bl_types(type)&bl->type)) // only send status changes that actually matter to the client
return;
clif_status_change_sub(bl, bl->id, type, flag, tick, val1, val2, val3, ((sd ? (sd->status.option&OPTION_INVISIBLE ? SELF : AREA) : AREA_WOS)));
clif_status_change_sub(bl, bl->id, type, flag, tick, val1, val2, val3, ((sd ? (pc_isinvisible(sd) ? SELF : AREA) : AREA_WOS)));
}
/**
@ -6282,7 +6282,7 @@ void clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type)
else
WBUFL(buf,6) = pvprank;
WBUFL(buf,10) = pvpnum;
if(sd->sc.option&OPTION_INVISIBLE || sd->disguise) //Causes crashes when a 'mob' with pvp info dies.
if(pc_isinvisible(sd) || sd->disguise) //Causes crashes when a 'mob' with pvp info dies.
clif_send(buf,packet_len(0x19a),&sd->bl,SELF);
else if(!type)
clif_send(buf,packet_len(0x19a),&sd->bl,AREA);
@ -10109,7 +10109,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if( map[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs )
map_spawnmobs(sd->bl.m);
if( !(sd->sc.option&OPTION_INVISIBLE) ) { // increment the number of pvp players on the map
if( !pc_isinvisible(sd) ) { // increment the number of pvp players on the map
map[sd->bl.m].users_pvp++;
}
sd->state.debug_remove_map = 0; // temporary state to track double remove_map's [FlavioJS]
@ -10130,7 +10130,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if( sd->bg_id ) clif_bg_hp(sd); // BattleGround System
if(map[sd->bl.m].flag.pvp && !(sd->sc.option&OPTION_INVISIBLE)) {
if(map[sd->bl.m].flag.pvp && !pc_isinvisible(sd)) {
if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris]
if (!map[sd->bl.m].flag.pvp_nocalcrank)
sd->pvp_timer = add_timer(gettick()+200, pc_calc_pvprank_timer, sd->bl.id, 0);
@ -11048,7 +11048,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
// if player ignores everyone
if (dstsd->state.ignoreAll && pc_get_group_level(sd) <= pc_get_group_level(dstsd)) {
if (dstsd->sc.option & OPTION_INVISIBLE && pc_get_group_level(sd) < pc_get_group_level(dstsd))
if (pc_isinvisible(dstsd) && pc_get_group_level(sd) < pc_get_group_level(dstsd))
clif_wis_end(fd, 1); // 1: target character is not logged in
else
clif_wis_end(fd, 3); // 3: everyone ignored by target

View File

@ -1159,7 +1159,7 @@ bool pc_authok(struct map_session_data *sd, uint32 login_id2, time_t expiration_
memset(&sd->premiumStorage, 0, sizeof(struct s_storage));
memset(&sd->equip_index, -1, sizeof(sd->equip_index));
if( sd->status.option&OPTION_INVISIBLE && !pc_can_use_command( sd, "hide", COMMAND_ATCOMMAND ) ){
if( pc_isinvisible(sd) && !pc_can_use_command( sd, "hide", COMMAND_ATCOMMAND ) ){
sd->status.option &= ~OPTION_INVISIBLE;
}
@ -1448,7 +1448,7 @@ void pc_reg_received(struct map_session_data *sd)
clif_parse_LoadEndAck(sd->fd, sd);
}
if( sd->sc.option&OPTION_INVISIBLE ) {
if( pc_isinvisible(sd) ) {
sd->vd.class_ = INVISIBLE_CLASS;
clif_displaymessage( sd->fd, msg_txt( sd, 11 ) ); // Invisible: On
// decrement the number of pvp players on the map
@ -1937,7 +1937,7 @@ int pc_disguise(struct map_session_data *sd, int class_)
if (class_ && sd->disguise == class_)
return 0;
if(sd->sc.option&OPTION_INVISIBLE)
if(pc_isinvisible(sd))
{ //Character is invisible. Stealth class-change. [Skotlex]
sd->disguise = class_; //viewdata is set on uncloaking.
return 2;
@ -10006,7 +10006,7 @@ static int pc_calc_pvprank_sub(struct block_list *bl,va_list ap)
sd1=(struct map_session_data *)bl;
sd2=va_arg(ap,struct map_session_data *);
if( sd1->sc.option&OPTION_INVISIBLE || sd2->sc.option&OPTION_INVISIBLE )
if( pc_isinvisible(sd1) || pc_isinvisible(sd2) )
{// cannot register pvp rank for hidden GMs
return 0;
}
@ -10042,7 +10042,7 @@ int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
sd->pvp_timer = INVALID_TIMER;
if( sd->sc.option&OPTION_INVISIBLE )
if( pc_isinvisible(sd) )
{// do not calculate the pvp rank for a hidden GM
return 0;
}

View File

@ -2980,7 +2980,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
else if (--map[bl->m].users == 0 && battle_config.dynamic_mobs)
map_removemobs(bl->m);
if( !(sd->sc.option&OPTION_INVISIBLE) ) // Decrement the number of active pvp players on the map
if( !pc_isinvisible(sd) ) // Decrement the number of active pvp players on the map
--map[bl->m].users_pvp;
if( sd->state.hpmeter_visible ) {