diff options
author | shennetsind <ind@henn.et> | 2013-10-25 12:45:13 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-10-25 12:45:13 -0200 |
commit | 8629562655cfcbd6aef97307e3e0c078235619ff (patch) | |
tree | 6de8f57077d52fe52c306adee05d6043c5675584 | |
parent | 259fe1930d2307248327bd5737f4909fd77e72ad (diff) | |
download | hercules-8629562655cfcbd6aef97307e3e0c078235619ff.tar.gz hercules-8629562655cfcbd6aef97307e3e0c078235619ff.tar.bz2 hercules-8629562655cfcbd6aef97307e3e0c078235619ff.tar.xz hercules-8629562655cfcbd6aef97307e3e0c078235619ff.zip |
nocashshop mapflag
As requested by the community in http://hercules.ws/board/topic/1477-mapflag-for-cash-shop/ and http://hercules.ws/board/topic/1476-disable-cashshop-in-pvp-woe/
'nocashshop' mapflag disables the usage of the cashshop button as well as any attempts to purchase (in case the flag is turned on after someone gets the shop open).
Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r-- | conf/messages.conf | 2 | ||||
-rw-r--r-- | db/const.txt | 2 | ||||
-rw-r--r-- | db/pre-re/map_zone_db.conf | 7 | ||||
-rw-r--r-- | db/re/map_zone_db.conf | 7 | ||||
-rw-r--r-- | src/map/atcommand.c | 6 | ||||
-rw-r--r-- | src/map/clif.c | 11 | ||||
-rw-r--r-- | src/map/map.c | 10 | ||||
-rw-r--r-- | src/map/map.h | 1 | ||||
-rw-r--r-- | src/map/npc.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 3 | ||||
-rw-r--r-- | src/map/script.h | 3 |
11 files changed, 48 insertions, 6 deletions
diff --git a/conf/messages.conf b/conf/messages.conf index 3a16d8054..7b7a99301 100644 --- a/conf/messages.conf +++ b/conf/messages.conf @@ -1532,5 +1532,7 @@ 1487: Character cannot be disguised while in monster form. 1488: Transforming into monster is not allowed in Guild Wars. +//CashShop mapflag +1489: Cash Shop is disabled in this map //Custom translations import: conf/import/msg_conf.txt diff --git a/db/const.txt b/db/const.txt index af3dedbc5..6ecae2177 100644 --- a/db/const.txt +++ b/db/const.txt @@ -365,6 +365,8 @@ mf_monster_noteleport 49 mf_pvp_nocalcrank 50 mf_battleground 51 mf_reset 52 +mf_notomb 53 +mf_nocashshop 54 cell_walkable 0 cell_shootable 1 diff --git a/db/pre-re/map_zone_db.conf b/db/pre-re/map_zone_db.conf index 384384fec..3bc0fd95e 100644 --- a/db/pre-re/map_zone_db.conf +++ b/db/pre-re/map_zone_db.conf @@ -87,6 +87,9 @@ zones: ( disabled_items: { Greed_Scroll: true } + + mapflags: ( "nocashshop" ) + }, { /* PK Mode zone is only used when server is on pk_mode (battle.conf), @@ -157,7 +160,9 @@ zones: ( "magic_damage_rate 60", "misc_damage_rate 60", "long_damage_rate 80", - "short_damage_rate 80" ) + "short_damage_rate 80", + "nocashshop" + ) }, { diff --git a/db/re/map_zone_db.conf b/db/re/map_zone_db.conf index 384384fec..7a8331216 100644 --- a/db/re/map_zone_db.conf +++ b/db/re/map_zone_db.conf @@ -87,6 +87,9 @@ zones: ( disabled_items: { Greed_Scroll: true } + + /* cashshop disabled in pvp maps */ + mapflags: ( "nocashshop" ) }, { /* PK Mode zone is only used when server is on pk_mode (battle.conf), @@ -157,7 +160,9 @@ zones: ( "magic_damage_rate 60", "misc_damage_rate 60", "long_damage_rate 80", - "short_damage_rate 80" ) + "short_damage_rate 80", + "nocashshop" + ) }, { diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 7d4008faf..c815967c2 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -7333,7 +7333,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(notomb); CHECKFLAG(nocashshop); clif->message(sd->fd," "); clif->message(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On) clif->message(sd->fd,msg_txt(1313)); // Type "@mapflag available" to list the available mapflags. @@ -7370,7 +7370,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(notomb); SETFLAG(nocashshop); clif->message(sd->fd,msg_txt(1314)); // Invalid flag name or flag. clif->message(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On) @@ -7382,7 +7382,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"); + clif->message(sd->fd,"guildlock, src4instance, notomb, nocashshop"); #undef CHECKFLAG #undef SETFLAG diff --git a/src/map/clif.c b/src/map/clif.c index d8ca2872a..94fc6f7a7 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -17387,6 +17387,12 @@ void __attribute__ ((unused)) clif_parse_dull(int fd,struct map_session_data *sd return; } void clif_parse_CashShopOpen(int fd, struct map_session_data *sd) { + + if( map->list[sd->bl.m].flag.nocashshop ) { + clif->colormes(fd,COLOR_RED,msg_txt(1489)); //Cash Shop is disabled in this map + return; + } + WFIFOHEAD(fd, 10); WFIFOW(fd, 0) = 0x845; WFIFOL(fd, 2) = sd->cashPoints; //[Ryuuzaki] - switched positions to reflect proper values @@ -17423,6 +17429,11 @@ void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { unsigned short limit = RFIFOW(fd, 4), i, j; unsigned int kafra_pay = RFIFOL(fd, 6);// [Ryuuzaki] - These are free cash points (strangely #CASH = main cash curreny for us, confusing) + if( map->list[sd->bl.m].flag.nocashshop ) { + clif->colormes(fd,COLOR_RED,msg_txt(1489)); //Cash Shop is disabled in this map + return; + } + for(i = 0; i < limit; i++) { int qty = RFIFOL(fd, 14 + ( i * 10 )); int id = RFIFOL(fd, 10 + ( i * 10 )); diff --git a/src/map/map.c b/src/map/map.c index 749b9de81..133c63a1c 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -4388,7 +4388,17 @@ bool map_zone_mf_cache(int m, char *flag, char *params) { map_zone_mf_cache_add(m,rflag); } } + } else if (!strcmpi(flag,"nocashshop")) { + if( state && map->list[m].flag.nocashshop ) + ;/* nothing to do */ + else { + if( state ) + map_zone_mf_cache_add(m,"nocashshop\toff"); + else if( map->list[m].flag.nocashshop ) + map_zone_mf_cache_add(m,"nocashshop"); + } } + return false; } void map_zone_apply(int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath) { diff --git a/src/map/map.h b/src/map/map.h index 83d5aa5a8..408d03c76 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -632,6 +632,7 @@ struct map_data { unsigned chsysnolocalaj : 1; unsigned noknockback : 1; unsigned notomb : 1; + unsigned nocashshop : 1; } 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 c536dc856..2b6d807cb 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3441,6 +3441,8 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char map->list[m].long_damage_rate = (state) ? atoi(w4) : 100; } else if ( !strcmpi(w3,"src4instance") ) { map->list[m].flag.src4instance = (state) ? 1 : 0; + } else if ( !strcmpi(w3,"nocashshop") ) { + map->list[m].flag.nocashshop = (state) ? 1 : 0; } else ShowError("npc_parse_mapflag: unrecognized mapflag '%s' (file '%s', line '%d').\n", w3, filepath, strline(buffer,start-buffer)); diff --git a/src/map/script.c b/src/map/script.c index 3c0742405..826c5ae34 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -10201,6 +10201,7 @@ BUILDIN(getmapflag) case MF_BATTLEGROUND: script_pushint(st,map->list[m].flag.battleground); break; 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; } } @@ -10317,6 +10318,7 @@ BUILDIN(setmapflag) { case MF_BATTLEGROUND: map->list[m].flag.battleground = (val <= 0 || val > 2) ? 1 : val; break; 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; } } @@ -10402,6 +10404,7 @@ BUILDIN(removemapflag) { case MF_BATTLEGROUND: map->list[m].flag.battleground = 0; break; 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; } } diff --git a/src/map/script.h b/src/map/script.h index c00086ef9..400916af8 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -287,7 +287,8 @@ enum { MF_PVP_NOCALCRANK, //50 MF_BATTLEGROUND, MF_RESET, - MF_NOTOMB + MF_NOTOMB, + MF_NOCASHSHOP }; /** |