summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-02 18:22:02 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-02 18:22:02 +0000
commit83de953a5fe5c1316abd3171a01f3e751edab3d1 (patch)
tree79c3e2082ff1dd82335693175f54d0b80016dddf /src
parent78f55689894725d4ec08fc2a86628bc585718415 (diff)
downloadhercules-83de953a5fe5c1316abd3171a01f3e751edab3d1.tar.gz
hercules-83de953a5fe5c1316abd3171a01f3e751edab3d1.tar.bz2
hercules-83de953a5fe5c1316abd3171a01f3e751edab3d1.tar.xz
hercules-83de953a5fe5c1316abd3171a01f3e751edab3d1.zip
* Reduced MAX_SKILL_LEVEL to 10
* Tidied up parts in skill_castfix a bit * Fixed map-server crashing if an empty line was added in any of the skill-xx db files * Updated skill_castnodex reading git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@895 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/mob.c5
-rw-r--r--src/map/skill.c75
-rw-r--r--src/map/skill.h1
4 files changed, 56 insertions, 27 deletions
diff --git a/src/map/map.h b/src/map/map.h
index eecb35afc..812785f13 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -16,7 +16,7 @@
#define LIFETIME_FLOORITEM 60
#define DAMAGELOG_SIZE 30
#define LOOTITEM_SIZE 10
-#define MAX_SKILL_LEVEL 100
+#define MAX_SKILL_LEVEL 10
#define MAX_STATUSCHANGE 210
#define MAX_SKILLUNITGROUP 32
#define MAX_MOBSKILLUNITGROUP 8
diff --git a/src/map/mob.c b/src/map/mob.c
index 539a10c1a..4f80c23bb 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -4205,7 +4205,10 @@ static int mob_readskilldb(void)
ms->state=state[j].id;
}
ms->skill_id=atoi(sp[3]);
- ms->skill_lv=atoi(sp[4]);
+ j=atoi(sp[4]);
+ if (j<=0 || j>MAX_SKILL_DB)
+ continue;
+ ms->skill_lv=j;
ms->permillage=atoi(sp[5]);
ms->casttime=atoi(sp[6]);
ms->delay=atoi(sp[7]);
diff --git a/src/map/skill.c b/src/map/skill.c
index 413fa7ba0..8c7f64e54 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -854,6 +854,11 @@ int skill_get_castnodex( int id ,int lv ){
if ((id > MAX_SKILL) || (id < 0)) return 0;
return (lv <= 0) ? 0:skill_db[id].castnodex[lv-1];
}
+int skill_get_delaynodex( int id ,int lv ){
+ if (id >= 10000 && id < 10015) id-= 9500;
+ if ((id > MAX_SKILL) || (id < 0)) return 0;
+ return (lv <= 0) ? 0:skill_db[id].delaynodex[lv-1];
+}
int skill_get_nocast ( int id ){
if (id >= 10000 && id < 10015) id-= 9500;
if ((id > MAX_SKILL) || (id < 0)) return 0;
@@ -7390,23 +7395,23 @@ int skill_check_condition(struct map_session_data *sd,int type)
*/
int skill_castfix( struct block_list *bl, int time )
{
- struct map_session_data *sd;
+ struct map_session_data *sd = NULL;
struct mob_data *md; // [Valaris]
struct status_change *sc_data;
int dex;
int castrate=100;
- int skill,lv,castnodex;
+ int skill,lv;
nullpo_retr(0, bl);
if(bl->type==BL_MOB){ // Crash fix [Valaris]
- md=(struct mob_data*)bl;
+ nullpo_retr(0, md=(struct mob_data*)bl);
skill = md->skillid;
lv = md->skilllv;
}
else {
- sd=(struct map_session_data*)bl;
+ nullpo_retr(0, sd=(struct map_session_data*)bl);
skill = sd->skillid;
lv = sd->skilllv;
}
@@ -7419,8 +7424,6 @@ int skill_castfix( struct block_list *bl, int time )
if (skill > MAX_SKILL_DB || skill < 0)
return 0;
- castnodex=skill_get_castnodex(skill, lv);
-
/* ƒTƒtƒ‰ƒMƒEƒ€ */
if(sc_data && sc_data[SC_SUFFRAGIUM].timer!=-1 )
time=time*(100-sc_data[SC_SUFFRAGIUM].val1*15)/100;
@@ -7428,12 +7431,14 @@ int skill_castfix( struct block_list *bl, int time )
if(time==0)
return 0;
- if(castnodex > 0 && bl->type==BL_PC)
- castrate=((struct map_session_data *)bl)->castrate;
- else if (castnodex <= 0 && bl->type==BL_PC) {
- castrate=((struct map_session_data *)bl)->castrate;
- time=time*castrate*(battle_config.castrate_dex_scale - dex)/(battle_config.castrate_dex_scale * 100);
- time=time*battle_config.cast_rate/100;
+ if (sd) {
+ if(skill_get_castnodex(skill, lv) > 0)
+ castrate=((struct map_session_data *)bl)->castrate;
+ else {
+ castrate=((struct map_session_data *)bl)->castrate;
+ time=time*castrate*(battle_config.castrate_dex_scale - dex)/(battle_config.castrate_dex_scale * 100);
+ time=time*battle_config.cast_rate/100;
+ }
}
/* ƒuƒ‰ƒM‚ΜŽ */
@@ -7450,15 +7455,24 @@ int skill_castfix( struct block_list *bl, int time )
int skill_delayfix( struct block_list *bl, int time )
{
struct status_change *sc_data;
-
+ struct map_session_data *sd = NULL;
+ int skill,lv = 0;
+
nullpo_retr(0, bl);
+ if(bl->type==BL_PC){
+ nullpo_retr(0, sd=(struct map_session_data*)bl);
+ skill = sd->skillid;
+ lv = sd->skilllv;
+ }
+
+ if(lv <= 0) return 0;
+
sc_data = battle_get_sc_data(bl);
-/* if(time<=0)
- return ( battle_get_adelay(bl) / 2 );*/
- if(bl->type == BL_PC) {
- if( battle_config.delay_dependon_dex ) /* dex‚Μ‰e‹Ώ‚πŒvŽZ‚·‚ι */
+ if(sd) {
+ if(battle_config.delay_dependon_dex && /* dex‚Μ‰e‹Ώ‚πŒvŽZ‚·‚ι */
+ skill_get_delaynodex(skill, lv) > 0)
time=time*(battle_config.castrate_dex_scale - battle_get_dex(bl))/battle_config.castrate_dex_scale;
time=time*battle_config.delay_rate/100;
}
@@ -11646,7 +11660,7 @@ int skill_readdb(void)
i=atoi(split[0]);
if (i>=10000 && i<10015) // for guild skills [Celest]
i -= 9500;
- else if(i<0 || i>MAX_SKILL_DB)
+ else if(i<=0 || i>MAX_SKILL_DB)
continue;
/* printf("skill id=%d\n",i); */
@@ -11721,7 +11735,7 @@ int skill_readdb(void)
i=atoi(split[0]);
if (i>=10000 && i<10015) // for guild skills [Celest]
i -= 9500;
- else if(i<0 || i>MAX_SKILL_DB)
+ else if(i<=0 || i>MAX_SKILL_DB)
continue;
memset(split2,0,sizeof(split2));
@@ -11863,7 +11877,7 @@ int skill_readdb(void)
i=atoi(split[0]);
if (i>=10000 && i<10015) // for guild skills [Celest]
i -= 9500;
- else if(i<0 || i>MAX_SKILL_DB)
+ else if(i<=0 || i>MAX_SKILL_DB)
continue;
memset(split2,0,sizeof(split2));
@@ -12030,10 +12044,10 @@ int skill_readdb(void)
}
while(fgets(line,1020,fp)){
char *split[50], *split2[MAX_SKILL_LEVEL];
- memset(split,0,sizeof(split));
if(line[0]=='/' && line[1]=='/')
continue;
- for(j=0,p=line;j<2 && p;j++){
+ memset(split,0,sizeof(split));
+ for(j=0,p=line;j<3 && p;j++){
split[j]=p;
p=strchr(p,',');
if(p) *p++=0;
@@ -12042,9 +12056,9 @@ int skill_readdb(void)
i=atoi(split[0]);
if (i>=10000 && i<10015) // for guild skills [Celest]
i -= 9500;
- else if(i<0 || i>MAX_SKILL_DB)
+ else if(i<=0 || i>MAX_SKILL_DB)
continue;
-
+
memset(split2,0,sizeof(split2));
for(j=0,p=split[1];j<MAX_SKILL_LEVEL && p;j++){
split2[j]=p;
@@ -12053,6 +12067,17 @@ int skill_readdb(void)
}
for(k=0;k<MAX_SKILL_LEVEL;k++)
skill_db[i].castnodex[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
+
+ if (!split[2])
+ continue;
+ memset(split2,0,sizeof(split2));
+ for(j=0,p=split[2];j<MAX_SKILL_LEVEL && p;j++){
+ split2[j]=p;
+ p=strchr(p,':');
+ if(p) *p++=0;
+ }
+ for(k=0;k<MAX_SKILL_LEVEL;k++)
+ skill_db[i].delaynodex[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
}
fclose(fp);
sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/skill_castnodex_db.txt");
@@ -12079,7 +12104,7 @@ int skill_readdb(void)
i=atoi(split[0]);
if (i>=10000 && i<10015) // for guild skills [Celest]
i -= 9500;
- else if(i<0 || i>MAX_SKILL_DB)
+ else if(i<=0 || i>MAX_SKILL_DB)
continue;
skill_db[i].nocast=atoi(split[1]);
k++;
diff --git a/src/map/skill.h b/src/map/skill.h
index 87a56345c..af6e6006a 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 delaynodex[MAX_SKILL_LEVEL];
int nocast;
};
extern struct skill_db skill_db[MAX_SKILL_DB];