summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog.txt2
-rw-r--r--db/skill_nocast_db.txt17
-rw-r--r--src/map/skill.c60
-rw-r--r--src/map/skill.h1
4 files changed, 71 insertions, 9 deletions
diff --git a/Changelog.txt b/Changelog.txt
index 2bc1f2b4c..b36d4f321 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,6 +1,8 @@
Date Added
11/26
* Finished Full Strip, Weapon Refine, Slim Pitcher and Full Protection. [celest]
+ * Added skill_nocast_db.txt. Use it to set which skills cannot be used in
+ which conditions [celest]
11/25
* Added @skilltree to help GM's answer skill tree questions [MouseJstr]
diff --git a/db/skill_nocast_db.txt b/db/skill_nocast_db.txt
new file mode 100644
index 000000000..5159396a8
--- /dev/null
+++ b/db/skill_nocast_db.txt
@@ -0,0 +1,17 @@
+//<Skill ID> <Mode>
+//
+// Mode:
+// 1 - Cannot be used in normal maps
+// 2 - Cannot be used in PvP maps
+// 4 - Cannot be used in GvG maps
+// 8 - Cannot be used when WoE is on
+// 16 - Cannot be used in PK Mode maps
+// Example: 8,6 = Endure cannot be used in PvP and GvG maps (2+4)
+8,12
+26,12
+27,12
+87,12
+150,12
+361,12
+362,12
+389,12 \ No newline at end of file
diff --git a/src/map/skill.c b/src/map/skill.c
index 2c7be17ea..bb6df7f3d 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1,4 +1,4 @@
-// $Id: skill.c,v 1.8 2004/11/26 5:46:59 PM Celestia Exp $
+// $Id: skill.c,v 1.8 2004/11/26 7:12:23 PM Celestia Exp $
/* スキル?係 */
#include <stdio.h>
@@ -859,6 +859,19 @@ int skillnotok(int skillid, struct map_session_data *sd) {
return 0;
if (pc_isGM(sd) >= 20)
return 0; // gm's can do anything damn thing they want
+
+ // Check skill restrictions [Celest]
+ if(!map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.gvg && skill_db[skillid].nocast & 1)
+ return 1;
+ if(map[sd->bl.m].flag.pvp && skill_db[skillid].nocast & 2)
+ return 1;
+ if(map[sd->bl.m].flag.gvg && skill_db[skillid].nocast & 4)
+ return 1;
+ if (agit_flag && skill_db[skillid].nocast & 8)
+ return 1;
+ if (battle_config.pk_mode && !map[sd->bl.m].flag.nopvp && skill_db[skillid].nocast & 16)
+ return 1;
+
switch (skillid) {
case AL_WARP:
case AL_TELEPORT:
@@ -7262,7 +7275,7 @@ int skill_use_id( struct map_session_data *sd, int target_id,
if(sd->status.option&2 && skill_num!=TF_HIDING && skill_num!=AS_GRIMTOOTH && skill_num!=RG_BACKSTAP && skill_num!=RG_RAID )
return 0;
- if(map[sd->bl.m].flag.gvg){ //GvGで使用できないスキル
+ /*if(map[sd->bl.m].flag.gvg){ //GvGで使用できないスキル
switch(skill_num){
case SM_ENDURE:
case AL_TELEPORT:
@@ -7275,7 +7288,7 @@ int skill_use_id( struct map_session_data *sd, int target_id,
case ST_CHASEWALK:
return 0;
}
- }
+ }*/
/* 演奏/ダンス中 */
if( sc_data && sc_data[SC_DANCING].timer!=-1 ){
@@ -7538,12 +7551,12 @@ int skill_use_pos( struct map_session_data *sd,
if(pc_isdead(sd))
return 0;
- if (skillnotok(skill_num, sd)) // [MoueJstr]
- return 0;
+ if (skillnotok(skill_num, sd)) // [MoueJstr]
+ return 0;
if(skill_num==WZ_ICEWALL && map[sd->bl.m].flag.noicewall && !map[sd->bl.m].flag.pvp) { // noicewall flag [Valaris]
clif_skill_fail(sd,sd->skillid,0,0);
- return 0;
+ return 0;
}
sc_data=sd->sc_data;
@@ -7583,11 +7596,11 @@ int skill_use_pos( struct map_session_data *sd,
if(sd->status.option&2)
return 0;
- if(map[sd->bl.m].flag.gvg &&
+/* if(map[sd->bl.m].flag.gvg &&
(skill_num == SM_ENDURE || skill_num == AL_TELEPORT ||
skill_num == AL_WARP || skill_num == WZ_ICEWALL ||
skill_num == TF_BACKSLIDING))
- return 0;
+ return 0;*/
sd->skillid = skill_num;
sd->skilllv = skill_lv;
@@ -11516,7 +11529,9 @@ int skill_readdb(void)
}
i=atoi(split[0]);
- if(i<0 || i>MAX_SKILL_DB)
+ if (i>=10000 && i<10015) // for guild skills [Celest]
+ i -= 9500;
+ else if(i<0 || i>MAX_SKILL_DB)
continue;
memset(split2,0,sizeof(split2));
@@ -11531,6 +11546,33 @@ int skill_readdb(void)
fclose(fp);
printf("read db/skill_castnodex_db.txt done\n");
+ fp=fopen("db/skill_nocast_db.txt","r");
+ if(fp==NULL){
+ printf("can't read db/skill_nocast_db.txt\n");
+ return 1;
+ }
+ k=0;
+ while(fgets(line,1020,fp)){
+ char *split[16];
+ if(line[0]=='/' && line[1]=='/')
+ continue;
+ memset(split,0,sizeof(split));
+ for(j=0,p=line;j<2 && p;j++){
+ split[j]=p;
+ p=strchr(p,',');
+ if(p) *p++=0;
+ }
+ if(split[0]==NULL)
+ continue;
+ i=atoi(split[0]);
+ if(i < 0 || i > MAX_SKILL_DB)
+ continue;
+ skill_db[i].nocast=atoi(split[1]);
+ k++;
+ }
+ fclose(fp);
+ printf("read db/skill_nocast_db done\n");
+
return 0;
}
diff --git a/src/map/skill.h b/src/map/skill.h
index 01f077158..a8bf30e3c 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -23,6 +23,7 @@ struct skill_db {
int weapon,state,spiritball[MAX_SKILL_LEVEL];
int itemid[10],amount[10];
int castnodex[MAX_SKILL_LEVEL];
+ int nocast;
};
extern struct skill_db skill_db[MAX_SKILL_DB];