* 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://svn.code.sf.net/p/rathena/svn/trunk@5115 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
Komurka 2006-01-30 14:24:26 +00:00
parent a06526eff4
commit 05eba2d392
11 changed files with 126 additions and 15 deletions

View File

@ -5,6 +5,10 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
2006/01/30
* Added 'restricted' mapflag, based on lordalfa patch [Komurka]
- 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
* Moved MVP log code so it can log all MVP, not only when player gets MVP item,
thanks to Hatred_ [Komurka]
* One more small fix on 'bSPVanishRate' (hp -> sp) [Komurka]

View File

@ -0,0 +1,20 @@
//===== eAthena Script =======================================
//= Map flags that disable certain items/skills configured in
//= item_noequip.txt and skill_nocast_db.txt
//===== By: ==================================================
//= eAthena Dev Team
//= 1.0 [Komurka]
//===== Current Version: =====================================
//Aldebaran Turbo Track
alde_tt02.gat mapflag restricted 1
turbo_n_1.gat mapflag restricted 1
turbo_n_4.gat mapflag restricted 1
turbo_n_8.gat mapflag restricted 1
turbo_n_16.gat mapflag restricted 1
turbo_e_4.gat mapflag restricted 1
turbo_e_8.gat mapflag restricted 1
turbo_e_16.gat mapflag restricted 1
//Jail
sec_pri.gat mapflag restricted 2

View File

@ -1,8 +1,35 @@
// The equipment/items/cards restriction file
// 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
// 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
//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.
//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'
// 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'
//Zone 1 - Aldebaran Turbo Track
601,4 //Fly Wing
506,4 //Green Potion
525,4 //Panacea
//Zone 2 - Jail
601,8 //Fly Wing - not really needed here but ...
602,8 //Butterfly Wing - also not needed

View File

@ -9,15 +9,46 @@
// 4 = Cannot be used in GvG maps
// 8 = Cannot be used when WoE is on
// 16 = Cannot be used in PK Mode maps
// 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
//
// Example:
// 8,6 = Endure cannot be used in PvP and GvG maps (2+4)
//GVG
26,4 //AL_TELEPORT
27,4 //AL_WARP
87,4 //WZ_ICEWALL
150,4 //TF_BACKSLIDING
361,4 //HP_ASSUMPTIO
362,4 //HP_BASILICA
491,4 //CR_CULTIVATION
//mixed
488,19 //CG_HERMODE
491,4 //CR_CULTIVATION
//Zone 1 - Aldebaran Turbo Track
219,32 //Snatch
26,32 //Teleport
27,32 //Warp portal
51,32 //Hiding
135,32 //Cloacking
389,32 //Stealth
35,32 //Cure
87,32 //Ice Wall
359,32 //Berserk (Frenzy)
362,32 //Basilica
395,32 //Sheltering Bliss
357,32 //Spear Dynamo (Concentration)
//Zone 2 - Jail
421,64 //TK_JUMPKICK#Flying Side Kick#
426,64 //TK_HIGHJUMP#Taekwon Jump#

View File

@ -35,5 +35,6 @@ npc: conf/mapflag/pvp.txt
npc: conf/mapflag/pvp_noparty.txt
npc: conf/mapflag/pvp_noguild.txt
npc: conf/mapflag/night.txt
npc: conf/mapflag/restricted.txt
water_height: conf/mapflag/water_height.txt
// --------------------------------------------------------------

View File

@ -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]

View File

@ -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 {

View File

@ -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;
}

View File

@ -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)
}
//?”õ<E2809D>§ŒÀƒ`ƒFƒbƒN
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);

View File

@ -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;
}
}

View File

@ -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: