Issue information

Issue ID
#437
Status
Working as Intended
Severity
None
Started
Hercules Elf Bot
Nov 18, 2007 11:14
Last Post
Hercules Elf Bot
Nov 18, 2007 11:14
Confirmation
N/A

Hercules Elf Bot - Nov 18, 2007 11:14

Originally posted by [b]ulkesh[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=437


Hi,

The restricted mapflag system doesn't work. So i have written a patch..

CODE
--- eastable.old/conf-tmpl/mapflag/restricted.txt    2007-11-18 13:37:06.000000000 +0100
+++ eastable.new/conf-tmpl/mapflag/restricted.txt    2007-11-18 13:40:37.000000000 +0100
@@ -7,14 +7,14 @@
//===== Current Version: =====================================

//Aldebaran Turbo Track
-alde_tt02    mapflag    restricted    1
-turbo_n_1    mapflag    restricted    1
-turbo_n_4    mapflag    restricted    1
-turbo_n_8    mapflag    restricted    1
-turbo_n_16    mapflag    restricted    1
-turbo_e_4    mapflag    restricted    1
-turbo_e_8    mapflag    restricted    1
-turbo_e_16    mapflag    restricted    1
+alde_tt02    mapflag    restricted    32
+turbo_n_1    mapflag    restricted    32
+turbo_n_4    mapflag    restricted    32
+turbo_n_8    mapflag    restricted    32
+turbo_n_16    mapflag    restricted    32
+turbo_e_4    mapflag    restricted    32
+turbo_e_8    mapflag    restricted    32
+turbo_e_16    mapflag    restricted    32

//Jail
-sec_pri    mapflag    restricted    2
+sec_pri    mapflag    restricted    64
--- eastable.old/db/skill_nocast_db.txt    2007-11-18 13:37:06.000000000 +0100
+++ eastable.new/db/skill_nocast_db.txt    2007-11-18 13:44:00.000000000 +0100
@@ -52,6 +52,10 @@
362,32    //Basilica
395,32    //Sheltering Bliss
357,32    //Spear Dynamo (Concentration)
+357,32    //Spear Dynamo
+264,32    //Body relocation [Nyal]
+421,32    //TK_JUMPKICK#Flying Side Kick# [Nyal]
+426,32    //TK_HIGHJUMP#Taekwon Jump# [Nyal]

//Zone 2 - Jail
421,64    //TK_JUMPKICK#Flying Side Kick#
--- eastable.old/db/item_noequip.txt    2007-11-18 13:37:06.000000000 +0100
+++ eastable.new/db/item_noequip.txt    2007-11-18 13:43:38.000000000 +0100
@@ -2,34 +2,40 @@
// here you define which items may not be used at PvP / GvG
// format: <item id>,<mode>
// mode
-// 1- restricted in PVP
-// 2- restricted in GVG
-// 3- restricted in both PvP and GvG
-// Restricted zones - they're configured by 'restricted <number>' mapflag
-// 4   - restricted in zone 1
-// 8   - restricted in zone 2
-// 16  - restricted in zone 3
-// 32  - restricted in zone 4
-// 64 -  restricted in zone 5
-// 128 - restricted in zone 6
-// 256 - restricted in zone 7
+// Legend for 'Flag' field (bitmask):
+//  1 = Cannot be used in normal maps
+//  2 = Cannot be used in PvP maps (use this instead of 1 for PK-mode servers)
+//  4 = Cannot be used in GvG maps
+//  8 = Cannot be used when WoE is on
+//  16 = Cannot be cloned (clones will not copy this skill)
+//  Restricted zones - they're configured by 'restricted <number>' mapflag
+//  32 = Cannot be used in zone 1 maps
+//  64 = Cannot be used in zone 2 maps
+//  128 = Cannot be used in zone 3 maps
+//  256 = Cannot be used in zone 4 maps
+//  512 = Cannot be used in zone 5 maps
+//  1024 = Cannot be used in zone 6 maps
+//  2048 = Cannot be used in zone 7 maps

//Examples:
-//1201,1 you can't use KNIFE(ID 1201) on PvP and GvG
-//608,3 you can't use Yggdrasil Seed(ID 608) on both PvP & GvG & WoE Castles
-//4174,3 Forbid Deviling Card in every PVP or GVG map, and during woes.
-//501,4 you can't use Red Potion on map marked as 'restricted zone 1'
-//502,8 you can't use Orange Potion on map marked as 'restricted zone 2'
-//503,16 you can't use Yellow Potion on map marked as 'restricted zone 3'
+//1201,2 you can't use KNIFE(ID 1201) on PvP
+//608,6 you can't use Yggdrasil Seed(ID 608) on both PvP & GvG & WoE Castles
+//4174,14 Forbid Deviling Card in every PVP or GVG map, and during woes.
+//501,32 you can't use Red Potion on map marked as 'restricted zone 1'
+//502,64 you can't use Orange Potion on map marked as 'restricted zone 2'
+//503,128 you can't use Yellow Potion on map marked as 'restricted zone 3'
// you can even mix modes
-//519,41 (32+8+1) you can't use Milk on PVP, and maps marked as 'restricted zone 2' and 'restricted zone 4'
+//519,322 (2+64+256) you can't use Milk on PVP, and maps marked as 'restricted zone 2' and 'restricted zone 4'


//Zone 1 - Aldebaran Turbo Track
-601,4 //Fly Wing
-506,4 //Green Potion
-525,4 //Panacea
+601,32 //Fly Wing
+506,32 //Green Potion
+525,32 //Panacea

//Zone 2 - Jail
-601,8 //Fly Wing - not really needed here but ...
-602,8 //Butterfly Wing - also not needed
+601,64 //Fly Wing - not really needed here but ...
+602,64 //Butterfly Wing - also not needed
+
+//Zone 3 - Izlude Battle Arena
+601,128 //Fly Wing
--- eastable.old/src/map/skill.c    2007-11-18 13:37:07.000000000 +0100
+++ eastable.new/src/map/skill.c    2007-11-17 20:12:14.000000000 +0100
@@ -924,7 +924,7 @@
        return 1;
    if(agit_flag && skill_get_nocast (skillid) & 8)
        return 1;
-    if(map[m].flag.restricted && map[m].zone && skill_get_nocast (skillid) & (8*map[m].zone))
+    if(map[m].flag.restricted && map[m].zone && skill_get_nocast (skillid) & (map[m].zone))
        return 1;

    switch (skillid) {
--- eastable.old/src/map/npc.c    2007-11-18 13:37:07.000000000 +0100
+++ eastable.new/src/map/npc.c    2007-11-17 20:10:27.000000000 +0100
@@ -2468,7 +2468,8 @@
        if (state) {
            map[m].flag.restricted=1;
            sscanf(w4, "%d", &state);
-            map[m].zone |= 1<<(state+1);
+            //map[m].zone |= 1<<(state+1);
+            map[m].zone |= state;
        } else {
            map[m].flag.restricted=0;
            map[m].zone = 0;
--- eastable.old/src/map/pc.c    2007-11-18 13:37:07.000000000 +0100
+++ eastable.new/src/map/pc.c    2007-11-17 20:12:44.000000000 +0100
@@ -558,9 +558,9 @@
        return 0;
    if(item->sex != 2 && sd->status.sex != item->sex)
        return 0;
-    if(map[sd->bl.m].flag.pvp && item->flag.no_equip&1)
+    if(map[sd->bl.m].flag.pvp && item->flag.no_equip&2)
        return 0;
-    if(map_flag_gvg(sd->bl.m) && item->flag.no_equip&2)
+    if(map_flag_gvg(sd->bl.m) && item->flag.no_equip&4)
        return 0;
    if(map[sd->bl.m].flag.restricted && item->flag.no_equip&map[sd->bl.m].zone)
        return 0;
@@ -3063,8 +3063,8 @@
      
    //added item_noequip.txt items check by Maya&[Lupus]
    if (
-        (map[sd->bl.m].flag.pvp && item->flag.no_equip&1) || // PVP
-        (map_flag_gvg(sd->bl.m) && item->flag.no_equip&2) || // GVG
+        (map[sd->bl.m].flag.pvp && item->flag.no_equip&2) || // PVP
+        (map_flag_gvg(sd->bl.m) && item->flag.no_equip&4) || // GVG
        (map[sd->bl.m].flag.restricted && item->flag.no_equip&map[sd->bl.m].zone) // Zone restriction
    )
        return 0;
@@ -6681,12 +6681,12 @@
        }
        //?”õ§ŒÀƒ`Æ’FÆ’bÆ’N
        if(sd->status.inventory[i].equip && it) {
-            if (map[sd->bl.m].flag.pvp && it->flag.no_equip&1)
+            if (map[sd->bl.m].flag.pvp && it->flag.no_equip&2)
            {  //PVP check for forbiden items. optimized by [Lupus]
                sd->status.inventory[i].equip=0;
                calc_flag = 1;
            } else
-            if (map_flag_gvg(sd->bl.m) && it->flag.no_equip&2)
+            if (map_flag_gvg(sd->bl.m) && it->flag.no_equip&4)
            {  //GvG optimized by [Lupus]
                sd->status.inventory[i].equip=0;
                calc_flag = 1;
@@ -6699,8 +6699,8 @@
            if (!calc_flag) { //Check cards
                int flag;
                flag = (map[sd->bl.m].flag.restricted?map[sd->bl.m].zone:0)
-                    | (map[sd->bl.m].flag.pvp?1:0)
-                    | (map_flag_gvg(sd->bl.m)?2:0);
+                    | (map[sd->bl.m].flag.pvp?2:0)
+                    | (map_flag_gvg(sd->bl.m)?4:0);
                if (flag && !pc_isAllowedCardOn(sd,it->slot,i,flag))
                    calc_flag = 1;
            }
--- eastable.old/src/map/status.c    2007-11-18 13:37:07.000000000 +0100
+++ eastable.new/src/map/status.c    2007-11-17 20:01:21.000000000 +0100
@@ -1909,9 +1909,9 @@
                if(data->flag.no_equip) { //Card restriction checks.
                    if(map[sd->bl.m].flag.restricted && data->flag.no_equip&map[sd->bl.m].zone)
                        continue;
-                    if(map[sd->bl.m].flag.pvp && data->flag.no_equip&1)
+                    if(map[sd->bl.m].flag.pvp && data->flag.no_equip&2)
                        continue;
-                    if(map_flag_gvg(sd->bl.m) && data->flag.no_equip&2)
+                    if(map_flag_gvg(sd->bl.m) && data->flag.no_equip&4)
                        continue;
                }
                if(i == EQI_HAND_L && sd->status.inventory[index].equip == EQP_HAND_L)