summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKomurka <Komurka@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-01-30 14:24:26 +0000
committerKomurka <Komurka@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-01-30 14:24:26 +0000
commitf1375b9ae3116eb408a962d9b03a5f64df6747f3 (patch)
tree1d604d92fcd06a02203f313d7fed46eb3f2f4da4 /src
parent66e4865ef4398014c67057e851456df1261c3c66 (diff)
downloadhercules-f1375b9ae3116eb408a962d9b03a5f64df6747f3.tar.gz
hercules-f1375b9ae3116eb408a962d9b03a5f64df6747f3.tar.bz2
hercules-f1375b9ae3116eb408a962d9b03a5f64df6747f3.tar.xz
hercules-f1375b9ae3116eb408a962d9b03a5f64df6747f3.zip
* Added 'restricted' mapflag, based on lordalfa patch
- you can set restriction zone on map (see mapflag/restricted.txt) - you can turn off item usage on certain restricted map in item_noequip.txt - you can turn off skill usage on certain restricted map in skill_nocast_db.txt git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5115 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/itemdb.h2
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/npc.c5
-rw-r--r--src/map/pc.c27
-rw-r--r--src/map/script.c10
-rw-r--r--src/map/skill.c6
6 files changed, 40 insertions, 12 deletions
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 0064d17b4..3de337c67 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -34,7 +34,7 @@ struct item_data {
unsigned available : 1;
unsigned value_notdc : 1;
unsigned value_notoc : 1;
- unsigned no_equip : 3;
+ short no_equip;
unsigned no_use : 1;
unsigned no_refine : 1; // [celest]
unsigned delay_consume : 1; // Signifies items that are not consumed inmediately upon double-click [Skotlex]
diff --git a/src/map/map.h b/src/map/map.h
index 26e5875f4..3f7226eba 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1023,6 +1023,7 @@ struct map_data {
unsigned nomobloot : 1; // [Lorky]
unsigned nomvploot : 1; // [Lorky]
unsigned nightenabled :1; //For night display. [Skotlex]
+ unsigned restricted : 1; // [Komurka]
} flag;
struct point save;
struct npc_data *npc[MAX_NPC_PER_MAP];
@@ -1033,6 +1034,7 @@ struct map_data {
} drop_list[MAX_DROP_PER_MAP];
struct mob_list *moblist[MAX_MOB_LIST_PER_MAP]; // [Wizputer]
int mob_delete_timer; // [Skotlex]
+ int zone; // [Komurka]
};
struct map_data_other_server {
diff --git a/src/map/npc.c b/src/map/npc.c
index 7042ea9aa..86b4c823c 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2478,6 +2478,11 @@ static int npc_parse_mapflag (char *w1, char *w2, char *w3, char *w4)
else if (strcmpi(w3,"nomvploot")==0) { // Lorky
map[m].flag.nomvploot=1;
}
+ else if (strcmpi(w3,"restricted")==0) { // Komurka
+ map[m].flag.restricted=1;
+ sscanf(w4, "%d", &map[m].zone);
+ map[m].zone = pow(2,map[m].zone+1);
+ }
return 0;
}
diff --git a/src/map/pc.c b/src/map/pc.c
index a46f34611..adc090e87 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -590,6 +590,8 @@ int pc_isequip(struct map_session_data *sd,int n)
return 0;
if(map_flag_gvg(sd->bl.m) && (item->flag.no_equip&2 || !pc_isAllowedCardOn(sd,item->slot,n,2))) //optimized by Lupus
return 0;
+ if(map[sd->bl.m].zone && map[sd->bl.m].flag.restricted && (item->flag.no_equip&map[sd->bl.m].zone || !pc_isAllowedCardOn(sd,item->slot,n,map[sd->bl.m].zone)))
+ return 0;
if((item->equip & 0x0002 || item->equip & 0x0020) && item->type == 4 && sd->sc_data[SC_STRIPWEAPON].timer != -1) // Also works with left-hand weapons [DracoRPG]
return 0;
if(item->equip & 0x0020 && item->type == 5 && sd->sc_data[SC_STRIPSHIELD].timer != -1) // Also works with left-hand weapons [DracoRPG]
@@ -2792,7 +2794,8 @@ int pc_useitem(struct map_session_data *sd,int n)
(pc_issit(sd) && (sd->itemid == 605 || sd->itemid == 606)) ||
//added item_noequip.txt items check by Maya&[Lupus]
(map[sd->bl.m].flag.pvp && (sd->inventory_data[n]->flag.no_equip&1) ) || // PVP
- (map_flag_gvg(sd->bl.m) && (sd->inventory_data[n]->flag.no_equip>1) ) || // GVG
+ (map_flag_gvg(sd->bl.m) && (sd->inventory_data[n]->flag.no_equip&2) ) || // GVG
+ (map[sd->bl.m].zone && map[sd->bl.m].flag.restricted && (sd->inventory_data[n]->flag.no_equip&map[sd->bl.m].zone)) || // Zone restriction
!pc_isUseitem(sd,n) ) {
clif_useitemack(sd,n,0,0);
return 1;
@@ -7195,14 +7198,22 @@ int pc_checkitem(struct map_session_data *sd)
}
//?備制限チェック
if(sd->status.inventory[i].equip && (map[sd->bl.m].flag.pvp||map[sd->bl.m].flag.gvg) &&
- (it->flag.no_equip&1 || !pc_isAllowedCardOn(sd,it->slot,i,1))){//PVP check for forbiden items. optimized by [Lup$
- sd->status.inventory[i].equip=0;
- calc_flag = 1;
- }else if(sd->status.inventory[i].equip && map_flag_gvg(sd->bl.m) &&
- (it->flag.no_equip&2 || !pc_isAllowedCardOn(sd,it->slot,i,2))){//GvG optimized by [Lupus]
- sd->status.inventory[i].equip=0;
- calc_flag = 1;
+ (it->flag.no_equip&1 || !pc_isAllowedCardOn(sd,it->slot,i,1)))
+ { //PVP check for forbiden items. optimized by [Lupus]
+ sd->status.inventory[i].equip=0;
+ calc_flag = 1;
+ } else if(sd->status.inventory[i].equip && map_flag_gvg(sd->bl.m) &&
+ (it->flag.no_equip&2 || !pc_isAllowedCardOn(sd,it->slot,i,2)))
+ { //GvG optimized by [Lupus]
+ sd->status.inventory[i].equip=0;
+ calc_flag = 1;
+ } else if(sd->status.inventory[i].equip && (map[sd->bl.m].zone) && (map[sd->bl.m].flag.restricted) &&
+ (it->flag.no_equip&map[sd->bl.m].zone))
+ { // Restricted zone by [Komurka]
+ sd->status.inventory[i].equip=0;
+ calc_flag = 1;
}
+
}
pc_setequipindex(sd);
diff --git a/src/map/script.c b/src/map/script.c
index a2a3f1a28..9a4c9c0e5 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -6533,8 +6533,8 @@ enum { MF_NOMEMO,MF_NOTELEPORT,MF_NOSAVE,MF_NOBRANCH,MF_NOPENALTY,MF_NOZENYPENA
MF_PVP,MF_PVP_NOPARTY,MF_PVP_NOGUILD,MF_GVG,MF_GVG_NOPARTY,MF_NOTRADE,MF_NOSKILL,
MF_NOWARP,MF_NOPVP,MF_NOICEWALL,MF_SNOW,MF_FOG,MF_SAKURA,MF_LEAVES,MF_RAIN,
MF_INDOORS,MF_NOGO,MF_CLOUDS,MF_CLOUDS2,MF_FIREWORKS,MF_GVG_CASTLE,MF_GVG_DUNGEON,MF_NIGHTENABLED,
- MF_NOBASEEXP, MF_NOJOBEXP, MF_NOMOBLOOT, MF_NOMVPLOOT, MF_NORETURN, MF_NOWARPTO, MF_NIGHTMAREDROP
- };
+ MF_NOBASEEXP, MF_NOJOBEXP, MF_NOMOBLOOT, MF_NOMVPLOOT, MF_NORETURN, MF_NOWARPTO, MF_NIGHTMAREDROP,
+ MF_RESTRICTED };
int buildin_setmapflagnosave(struct script_state *st)
{
@@ -6674,6 +6674,9 @@ int buildin_setmapflag(struct script_state *st)
case MF_NIGHTMAREDROP:
map[m].flag.pvp_nightmaredrop=1;
break;
+ case MF_RESTRICTED:
+ map[m].flag.restricted=1;
+ break;
}
}
@@ -6795,6 +6798,9 @@ int buildin_removemapflag(struct script_state *st)
case MF_NIGHTMAREDROP:
map[m].flag.pvp_nightmaredrop=0;
break;
+ case MF_RESTRICTED:
+ map[m].flag.restricted=0;
+ break;
}
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 7c393fd40..b7426beff 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -716,7 +716,7 @@ int skillnotok(int skillid, struct map_session_data *sd)
return 1;
}
- if (pc_isGM(sd) >= 20)
+ if (pc_isGM(sd) >= 20 && battle_config.gm_skilluncond)
return 0; // gm's can do anything damn thing they want
// Check skill restrictions [Celest]
@@ -730,6 +730,10 @@ int skillnotok(int skillid, struct map_session_data *sd)
return 1;
if (battle_config.pk_mode && !map[sd->bl.m].flag.nopvp && skill_get_nocast (skillid) & 16)
return 1;
+//printf("skill %d, flag restricted=%d, zone=%d, zone*8=%d, skill_get_nocast (skillid)=%d, skill_get_nocast (skillid)&8*zone=%d\n",
+// skillid,map[sd->bl.m].flag.restricted,map[sd->bl.m].zone,map[sd->bl.m].zone*8, skill_get_nocast (skillid),skill_get_nocast (skillid) & (8*map[sd->bl.m].zone));
+ if(map[sd->bl.m].flag.restricted && map[sd->bl.m].zone && skill_get_nocast (skillid) & (8*map[sd->bl.m].zone))
+ return 1;
switch (skillid) {
case AL_WARP: