Haru - May 25, 2013 14:27
I have mentioned this in the IRC channel, but I thought I'd post it here, for better tracking.
[b]Summary:[/b]
After learning a skill through Plagiarism, the character server is unable to save the character's skills. In the SQL query, the plagiarized skill appears twice, with level = -1 and flag = 0.
[b]Steps to reproduce:[/b][list]
[*]Create a Rogue, learn the Plagiarism skill (optionally, relog or otherwise wait until the character server saves your character's skills, though this isn't strictly necessary.) In my test case, I used Plagiarism lvl5.
[*]Get hit by a skill you can plagiarize. In my example, I used Water Ball lvl 10.
[*]You'll see the above skill appearing you your skill window with the appropriate level (in my case, Water Ball level 5.)
[*]Wait until the next time the character server saves your skills. A SQL error will appear, as described below.
[/list][b]Error message:[/b][code=auto:0][SQL]: DB error - Duplicate entry '150000-86' for key 'PRIMARY'
[Debug]: at char.c:600 - INSERT INTO `skill`(`char_id`,`id`,`lv`,`flag`) VALUES ('150000','1','9','0'),('150000','86','-1','0'),('150000','48','10','0'),('150000','49','10','0'),('150000','50','10','0'),('150000','51','10','0'),('150000','52','9','0'),('150000','86','-1','0'),('150000','210','4','0'),('150000','211','4','0'),('150000','212','4','0'),('150000','213','2','0'),'150000','214','5','0'),('150000','219','5','0'),('150000','225','5','0')[/code](where the incriminated skill is WZ_WATERBALL, ID:86)
[b]Environment:[/b]
The test was performed on a clean setup on a 32 bit gentoo linux machine.
Build details:[code=auto:0]*[g:master !] haru@serenity ~/cleantest $ gcc --version | head -n 1
gcc (Gentoo 4.6.3 p1.11, pie-0.5.2) 4.6.3
*[g:master !] haru@serenity ~/cleantest $ git log --oneline -1
ada0f13 Merge pull request #28 from jaBote/master
*[g:master !] haru@serenity ~/cleantest $ git diff
diff --git a/src/config/renewal.h b/src/config/renewal.h
index 8bd151f..0f92d69 100644
--- a/src/config/renewal.h
+++ b/src/config/renewal.h
@@ -17,7 +17,7 @@
/// (disable by commenting the line)
///
/// leave this line to enable renewal specific support such as renewal formulas
-#define RENEWAL
+//#define RENEWAL
/// renewal cast time
/// (disable by commenting the line)
@@ -27,7 +27,7 @@
/// example:
/// on a skill whos cast time is 10s, only 8s may be reduced. the other 2s are part of a
/// "fixed cast time" which can only be reduced by specialist items and skills
-#define RENEWAL_CAST
+//#define RENEWAL_CAST
/// renewal drop rate algorithms
/// (disable by commenting the line)
@@ -35,20 +35,20 @@
/// leave this line to enable renewal item drop rate algorithms
/// while enabled a special modified based on the difference between the player and monster level is applied
/// based on the http://irowiki.org/wiki/Drop_System#Level_Factor table
-#define RENEWAL_DROP
+//#define RENEWAL_DROP
/// renewal exp rate algorithms
/// (disable by commenting the line)
///
/// leave this line to enable renewal item exp rate algorithms
/// while enabled a special modified based on the difference between the player and monster level is applied
-#define RENEWAL_EXP
+//#define RENEWAL_EXP
/// renewal level modifier on damage
/// (disable by commenting the line)
///
// leave this line to enable renewal base level modifier on skill damage (selected skills only)
-#define RENEWAL_LVDMG
+//#define RENEWAL_LVDMG
/// renewal enchant deadly poison algorithm
///
@@ -57,7 +57,7 @@
/// - damage is NOT increased by 400%
/// - it does NOT affect grimtooth
/// - weapon and status ATK are increased
-#define RENEWAL_EDP
+//#define RENEWAL_EDP
/// renewal ASPD [malufett]
/// (disable by commenting the line)
@@ -67,6 +67,6 @@
/// - AGI has a greater factor in ASPD increase
/// - there is a change in how skills/items give ASPD
/// - some skill/item ASPD bonuses won't stack
-#define RENEWAL_ASPD
+//#define RENEWAL_ASPD
#endif // _CONFIG_RENEWAL_H_
diff --git a/src/map/script.c b/src/map/script.c
index 9a12370..ed720d9 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3462,7 +3462,7 @@ void run_script_main(struct script_state *st)
script_attach_state(st);
nd = map_id2nd(st->oid);
- if( nd && map[nd->bl.m].instance_id > 0 )
+ if( nd && nd->bl.m > 0 && map[nd->bl.m].instance_id > 0 )
st->instance_id = map[nd->bl.m].instance_id;
if(st->state == RERUNLINE) {
[/code]