summaryrefslogtreecommitdiff
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
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
-rw-r--r--Changelog.txt8
-rw-r--r--db/skill_castnodex_db.txt30
-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
6 files changed, 81 insertions, 40 deletions
diff --git a/Changelog.txt b/Changelog.txt
index 611643ee7..6d04fc00a 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,5 +1,13 @@
Date Added
01/02
+ * Reduced MAX_SKILL_LEVEL to 10 to save a bit of memory and speed [celest]
+ * Tidied up parts in skill_castfix a bit [celest]
+ * Fixed map-server crashing if an empty line was added in any of the skill-xx
+ db files [celest]
+ * Updated skill_castnodex reading - An *optional* 3rd value can be added to set
+ whether a skill's delay time can be affected by dex [celest]
+ Example: 46,1,1 - double strafe's delay is not affected by dex
+ 46,1,0:0:0:0:1 - only level 5 double strafe is not affected by dex
* More atempts at memory leak fixes [Codemaster] [SVN 890]
* Updated weapon breaking rates, thanks to DracoRPG [celest]
* Optimized enchanting skills success rates calculation, thanks to Wallex
diff --git a/db/skill_castnodex_db.txt b/db/skill_castnodex_db.txt
index bbf128904..eaa8226a5 100644
--- a/db/skill_castnodex_db.txt
+++ b/db/skill_castnodex_db.txt
@@ -1,13 +1,17 @@
-//<Skill id>,<1 or 0>
-// With 1, dex does not effect the skill's cast rate
-// With 0, dex effects the skill's cast rate
-46,1
-47,1
-129,1
-366,1
-381,1
-382,1
-383,1
-394,1
-403,1
-406,1 \ No newline at end of file
+//<Skill id>,<Cast: 1 or 0>,<Delay (Optional): 1 or 0>
+// Cast: With 1, dex does not affect the skill's cast rate
+// Cast: With 0, dex affects the skill's cast rate
+// Delay: With 1, dex does not affect the skill's delay rate
+// Delay: With 0, dex affects the skill's delay rate
+// Example - 46,1,1 = Double Strafe's casting time and delay is not affected by dex.
+
+46,1 //AC_DOUBLE
+47,1 //AC_SHOWER
+129,1 //HT_FALCON
+366,1 //HW_MAGICPOWER
+381,1 //SN_FALCONASSAULT
+382,1 //SN_SHARPSHOOTING
+383,1 //SN_WINDWALK
+394,1 //CG_ARROWVULCAN
+403,1 //PF_MEMORIZE
+406,0,1 //ASC_METEORASSAULT \ No newline at end of file
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];