From f1375b9ae3116eb408a962d9b03a5f64df6747f3 Mon Sep 17 00:00:00 2001 From: Komurka Date: Mon, 30 Jan 2006 14:24:26 +0000 Subject: * 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 --- Changelog-Trunk.txt | 4 ++++ conf-tmpl/mapflag/restricted.txt | 20 ++++++++++++++++++++ db/item_noequip.txt | 31 +++++++++++++++++++++++++++++-- db/skill_nocast_db.txt | 33 ++++++++++++++++++++++++++++++++- npc/scripts_mapflags.conf | 1 + src/map/itemdb.h | 2 +- src/map/map.h | 2 ++ src/map/npc.c | 5 +++++ src/map/pc.c | 27 +++++++++++++++++++-------- src/map/script.c | 10 ++++++++-- src/map/skill.c | 6 +++++- 11 files changed, 126 insertions(+), 15 deletions(-) create mode 100644 conf-tmpl/mapflag/restricted.txt diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 1c4647a40..653517770 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -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] diff --git a/conf-tmpl/mapflag/restricted.txt b/conf-tmpl/mapflag/restricted.txt new file mode 100644 index 000000000..e5e21a5d5 --- /dev/null +++ b/conf-tmpl/mapflag/restricted.txt @@ -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 diff --git a/db/item_noequip.txt b/db/item_noequip.txt index c40d1b8a9..17eba9a11 100644 --- a/db/item_noequip.txt +++ b/db/item_noequip.txt @@ -1,8 +1,35 @@ // The equipment/items/cards restriction file // here you define which items may not be used at PvP / GvG // format: , -// 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 ' 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. \ No newline at end of file +//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 \ No newline at end of file diff --git a/db/skill_nocast_db.txt b/db/skill_nocast_db.txt index a6c5066c4..390fd397e 100644 --- a/db/skill_nocast_db.txt +++ b/db/skill_nocast_db.txt @@ -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 ' 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 \ No newline at end of file + +//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# + diff --git a/npc/scripts_mapflags.conf b/npc/scripts_mapflags.conf index 7a7e48429..2d1bbd4ed 100644 --- a/npc/scripts_mapflags.conf +++ b/npc/scripts_mapflags.conf @@ -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 // -------------------------------------------------------------- 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: -- cgit v1.2.3-70-g09d2