diff options
author | Dastgir <dastgirpojee@rocketmail.com> | 2015-12-10 16:07:08 +0530 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-12-25 16:09:36 +0100 |
commit | f426844acb3955ba3436d7c0870053c655d70fd1 (patch) | |
tree | 87f80bb4384b7356bdeec01d36553266201c7b7d | |
parent | d9a19c93322de3a7a022b01049b5ce76c9e87b0b (diff) | |
download | hercules-f426844acb3955ba3436d7c0870053c655d70fd1.tar.gz hercules-f426844acb3955ba3436d7c0870053c655d70fd1.tar.bz2 hercules-f426844acb3955ba3436d7c0870053c655d70fd1.tar.xz hercules-f426844acb3955ba3436d7c0870053c655d70fd1.zip |
Implemented NoViewID
(http://herc.ws/board/topic/10020-official-mapflag-to-disable-viewid/)
Closes #926 as merged
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | conf/messages.conf | 2 | ||||
-rw-r--r-- | db/const.txt | 1 | ||||
-rw-r--r-- | src/map/atcommand.c | 8 | ||||
-rw-r--r-- | src/map/clif.c | 24 | ||||
-rw-r--r-- | src/map/map.h | 3 | ||||
-rw-r--r-- | src/map/npc.c | 2 | ||||
-rw-r--r-- | src/map/packets_struct.h | 2 | ||||
-rw-r--r-- | src/map/pc.c | 26 | ||||
-rw-r--r-- | src/map/script.c | 3 | ||||
-rw-r--r-- | src/map/script.h | 3 |
10 files changed, 44 insertions, 30 deletions
diff --git a/conf/messages.conf b/conf/messages.conf index f4098ae30..d946f2c8b 100644 --- a/conf/messages.conf +++ b/conf/messages.conf @@ -870,7 +870,7 @@ 1076: Clouds2 | 1077: Fireworks | 1078: Leaves | -//1079 FREE +1079: NoViewID | 1080: Displays Night | 1081: Other Flags: 1082: NoBranch | diff --git a/db/const.txt b/db/const.txt index ce9697a31..9edb0b18a 100644 --- a/db/const.txt +++ b/db/const.txt @@ -361,6 +361,7 @@ mf_battleground 51 mf_reset 52 mf_notomb 53 mf_nocashshop 54 +mf_noviewid 55 cell_walkable 0 cell_shootable 1 diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 96a2e0c2f..d90b4af55 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -3889,6 +3889,8 @@ ACMD(mapinfo) { strcat(atcmd_output, msg_fd(fd,1096)); // PartyLock | if (map->list[m_id].flag.guildlock) strcat(atcmd_output, msg_fd(fd,1097)); // GuildLock | + if (map->list[m_id].flag.noviewid) + strcat(atcmd_output, msg_fd(fd,1079)); // NoViewID | clif->message(fd, atcmd_output); switch (list) { @@ -7540,7 +7542,7 @@ ACMD(mapflag) { CHECKFLAG(nojobexp); CHECKFLAG(nomobloot); CHECKFLAG(nomvploot); CHECKFLAG(nightenabled); CHECKFLAG(nodrop); CHECKFLAG(novending); CHECKFLAG(loadevent); CHECKFLAG(nochat); CHECKFLAG(partylock); CHECKFLAG(guildlock); CHECKFLAG(src4instance); - CHECKFLAG(notomb); CHECKFLAG(nocashshop); + CHECKFLAG(notomb); CHECKFLAG(nocashshop); CHECKFLAG(noviewid); clif->message(sd->fd," "); clif->message(sd->fd,msg_fd(fd,1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On) clif->message(sd->fd,msg_fd(fd,1313)); // Type "@mapflag available" to list the available mapflags. @@ -7577,7 +7579,7 @@ ACMD(mapflag) { SETFLAG(nojobexp); SETFLAG(nomobloot); SETFLAG(nomvploot); SETFLAG(nightenabled); SETFLAG(nodrop); SETFLAG(novending); SETFLAG(loadevent); SETFLAG(nochat); SETFLAG(partylock); SETFLAG(guildlock); SETFLAG(src4instance); - SETFLAG(notomb); SETFLAG(nocashshop); + SETFLAG(notomb); SETFLAG(nocashshop); SETFLAG(noviewid); clif->message(sd->fd,msg_fd(fd,1314)); // Invalid flag name or flag. clif->message(sd->fd,msg_fd(fd,1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On) @@ -7589,7 +7591,7 @@ ACMD(mapflag) { clif->message(sd->fd,"nozenypenalty, notrade, noskill, nowarp, nowarpto, noicewall, snow, clouds, clouds2,"); clif->message(sd->fd,"fog, fireworks, sakura, leaves, nobaseexp, nojobexp, nomobloot,"); clif->message(sd->fd,"nomvploot, nightenabled, nodrop, novending, loadevent, nochat, partylock,"); - clif->message(sd->fd,"guildlock, src4instance, notomb, nocashshop"); + clif->message(sd->fd,"guildlock, src4instance, notomb, nocashshop, noviewid"); #undef CHECKFLAG #undef SETFLAG diff --git a/src/map/clif.c b/src/map/clif.c index b3c7cc41c..85206fac9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -17504,18 +17504,18 @@ void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { p.PacketType = maptypeproperty2Type; p.type = 0x28; - p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; - p.flag.guild = (map->list[bl->m].flag.battleground || map_flag_gvg(bl->m)) ? 1 : 0; - p.flag.siege = (map->list[bl->m].flag.battleground || map_flag_gvg2(bl->m)) ? 1: 0; - p.flag.mineffect = map_flag_gvg(bl->m) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); // Forcing /mineffect in castles during WoE (probably redundant? I'm not sure) - p.flag.nolockon = 0; // TODO - p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; - p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; - p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; - p.flag.noitemconsumption = 0; // TODO - p.flag.summonstarmiracle = 0; // TODO - p.flag.usecart = 1; // TODO - p.flag.SpareBits = 0; + p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; //PARTY + p.flag.guild = (map->list[bl->m].flag.battleground || map_flag_gvg(bl->m)) ? 1 : 0; // GUILD + p.flag.siege = (map->list[bl->m].flag.battleground || map_flag_gvg2(bl->m)) ? 1: 0; // SIEGE + p.flag.mineffect = map_flag_gvg(bl->m) ? 1 : ( (sd && sd->state.lesseffect) ? 1 : 0); // USE_SIMPLE_EFFECT - Forcing /mineffect in castles during WoE (probably redundant? I'm not sure) + p.flag.nolockon = 0; // DISABLE_LOCKON - TODO + p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; // COUNT_PK + p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; // NO_PARTY_FORMATION + p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; // BATTLEFIELD + p.flag.nocostume = (map->list[bl->m].flag.noviewid & EQP_COSTUME) ? 1 : 0; // DISABLE_COSTUMEITEM - Disables Costume Sprite + p.flag.usecart = 1; // USECART - TODO + p.flag.summonstarmiracle = 0; // SUNMOONSTAR_MIRACLE - TODO + p.flag.SpareBits = 0; // UNUSED clif->send(&p,sizeof(p),bl,t); #endif diff --git a/src/map/map.h b/src/map/map.h index 84af04f77..86a05e11b 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -243,6 +243,8 @@ enum { #define map_flag_gvg2(m) (map->list[m].flag.gvg || map->list[m].flag.gvg_castle) // No Kill Steal Protection #define map_flag_ks(m) (map->list[m].flag.town || map->list[m].flag.pvp || map->list[m].flag.gvg || map->list[m].flag.battleground) +// No ViewID +#define map_no_view(m, view) (map->list[m].flag.noviewid & (view)) //This stackable implementation does not means a BL can be more than one type at a time, but it's // meant to make it easier to check for multiple types at a time on invocations such as map_foreach* calls [Skotlex] @@ -732,6 +734,7 @@ struct map_data { unsigned noknockback : 1; unsigned notomb : 1; unsigned nocashshop : 1; + unsigned noviewid : 22; } flag; struct point save; struct npc_data *npc[MAX_NPC_PER_MAP]; diff --git a/src/map/npc.c b/src/map/npc.c index 9af6de518..09e5c0f46 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -4292,6 +4292,8 @@ const char *npc_parse_mapflag(const char *w1, const char *w2, const char *w3, co map->list[m].flag.src4instance = (state) ? 1 : 0; } else if ( !strcmpi(w3,"nocashshop") ) { map->list[m].flag.nocashshop = (state) ? 1 : 0; + } else if (!strcmpi(w3,"noviewid")) { + map->list[m].flag.noviewid = (state) ? atoi(w4) : 0; } else { npc->parse_unknown_mapflag(mapname, w3, w4, start, buffer, filepath, retval); } diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index f22bbacac..43ff0737f 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -765,7 +765,7 @@ struct packet_maptypeproperty2 { unsigned int countpk : 1; /// Show the PvP counter unsigned int nopartyformation : 1; /// Prevent party creation/modification unsigned int bg : 1; // TODO: What does this do? Probably related to Battlegrounds, but I'm not sure on the effect - unsigned int noitemconsumption : 1; // TODO: What does this do? (shows a "Nothing found in the selected map" message when set) + unsigned int nocostume : 1; /// Does not show costume sprite. unsigned int usecart : 1; /// Allow opening cart inventory unsigned int summonstarmiracle : 1; // TODO: What does this do? Related to Taekwon Masters, but I have no idea. unsigned int SpareBits : 15; /// Currently ignored, reserved for future updates diff --git a/src/map/pc.c b/src/map/pc.c index 43d320a80..447bcbd75 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9400,7 +9400,7 @@ int pc_load_combo(struct map_session_data *sd) { } /** -* Equip item ad given position. +* Equip item at given position. * @param sd the affected player structure. Must be checked before. * @param id item structure for equip. Must be checked before. * @param n inventory item position. Must be checked before. @@ -9408,7 +9408,8 @@ int pc_load_combo(struct map_session_data *sd) { **/ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n, int pos) { - if (pos & (EQP_HAND_R|EQP_SHADOW_WEAPON)) { + if ((!map_no_view(sd->bl.m,EQP_SHADOW_WEAPON) && pos & EQP_SHADOW_WEAPON) || + (pos & EQP_HAND_R)) { if(id) sd->weapontype1 = id->look; else @@ -9416,7 +9417,8 @@ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n, pc->calcweapontype(sd); clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); } - if (pos & (EQP_HAND_L|EQP_SHADOW_SHIELD)) { + if ((!map_no_view(sd->bl.m,EQP_SHADOW_SHIELD) && pos & EQP_SHADOW_SHIELD) || + (pos & EQP_HAND_L)) { if (id) { if(id->type == IT_WEAPON) { sd->status.shield = 0; @@ -9432,42 +9434,42 @@ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n, } //Added check to prevent sending the same look on multiple slots -> //causes client to redraw item on top of itself. (suggested by Lupus) - if (pos & EQP_HEAD_LOW && pc->checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1) { + if (!map_no_view(sd->bl.m,EQP_HEAD_LOW) && pos & EQP_HEAD_LOW && pc->checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1) { if (id && !(pos&(EQP_HEAD_TOP|EQP_HEAD_MID))) sd->status.head_bottom = id->look; else sd->status.head_bottom = 0; clif->changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom); } - if (pos & EQP_HEAD_TOP && pc->checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1) { + if (!map_no_view(sd->bl.m,EQP_HEAD_TOP) && pos & EQP_HEAD_TOP && pc->checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1) { if (id) sd->status.head_top = id->look; else sd->status.head_top = 0; clif->changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top); } - if (pos & EQP_HEAD_MID && pc->checkequip(sd,EQP_COSTUME_HEAD_MID) == -1) { + if (!map_no_view(sd->bl.m,EQP_HEAD_MID) && pos & EQP_HEAD_MID && pc->checkequip(sd,EQP_COSTUME_HEAD_MID) == -1) { if (id && !(pos&EQP_HEAD_TOP)) sd->status.head_mid = id->look; else sd->status.head_mid = 0; clif->changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid); } - if (pos & EQP_COSTUME_HEAD_TOP) { + if (!map_no_view(sd->bl.m,EQP_COSTUME_HEAD_TOP) && pos & EQP_COSTUME_HEAD_TOP) { if (id){ sd->status.head_top = id->look; } else sd->status.head_top = 0; clif->changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top); } - if (pos & EQP_COSTUME_HEAD_MID) { + if (!map_no_view(sd->bl.m,EQP_COSTUME_HEAD_MID) && pos & EQP_COSTUME_HEAD_MID) { if(id && !(pos&EQP_HEAD_TOP)){ sd->status.head_mid = id->look; } else sd->status.head_mid = 0; clif->changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid); } - if (pos & EQP_COSTUME_HEAD_LOW) { + if (!map_no_view(sd->bl.m,EQP_COSTUME_HEAD_LOW) && pos & EQP_COSTUME_HEAD_LOW) { if (id && !(pos&(EQP_HEAD_TOP|EQP_HEAD_MID))){ sd->status.head_bottom = id->look; } else @@ -9475,14 +9477,14 @@ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n, clif->changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom); } - if (pos & EQP_SHOES) + if (!map_no_view(sd->bl.m,EQP_SHOES) && pos & EQP_SHOES) clif->changelook(&sd->bl,LOOK_SHOES,0); - if (pos&EQP_GARMENT && pc->checkequip(sd,EQP_COSTUME_GARMENT) == -1) { + if (!map_no_view(sd->bl.m,EQP_GARMENT) && pos&EQP_GARMENT && pc->checkequip(sd,EQP_COSTUME_GARMENT) == -1) { sd->status.robe = id ? id->look : 0; clif->changelook(&sd->bl, LOOK_ROBE, sd->status.robe); } - if (pos & EQP_COSTUME_GARMENT) { + if (!map_no_view(sd->bl.m,EQP_COSTUME_GARMENT) && pos & EQP_COSTUME_GARMENT) { sd->status.robe = id ? id->look : 0; clif->changelook(&sd->bl,LOOK_ROBE,sd->status.robe); } diff --git a/src/map/script.c b/src/map/script.c index 829555820..24ccf30b4 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11710,6 +11710,7 @@ BUILDIN(getmapflag) case MF_RESET: script_pushint(st,map->list[m].flag.reset); break; case MF_NOTOMB: script_pushint(st,map->list[m].flag.notomb); break; case MF_NOCASHSHOP: script_pushint(st,map->list[m].flag.nocashshop); break; + case MF_NOVIEWID: script_pushint(st,map->list[m].flag.noviewid); break; } } @@ -11826,6 +11827,7 @@ BUILDIN(setmapflag) { case MF_RESET: map->list[m].flag.reset = 1; break; case MF_NOTOMB: map->list[m].flag.notomb = 1; break; case MF_NOCASHSHOP: map->list[m].flag.nocashshop = 1; break; + case MF_NOVIEWID: map->list[m].flag.noviewid = (val <= 0) ? 0 : val; break; } } @@ -11912,6 +11914,7 @@ BUILDIN(removemapflag) { case MF_RESET: map->list[m].flag.reset = 0; break; case MF_NOTOMB: map->list[m].flag.notomb = 0; break; case MF_NOCASHSHOP: map->list[m].flag.nocashshop = 0; break; + case MF_NOVIEWID: map->list[m].flag.noviewid = 0; break; } } diff --git a/src/map/script.h b/src/map/script.h index 36b7edef3..b3e16b1b4 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -336,7 +336,8 @@ enum { MF_BATTLEGROUND, MF_RESET, MF_NOTOMB, - MF_NOCASHSHOP + MF_NOCASHSHOP, + MF_NOVIEWID }; /** |