Sfoglia il codice sorgente

Merge branch 'rathena/master'

Cydh Ramdh 11 anni fa
parent
commit
5ed0a5bf99

+ 9 - 4
conf/battle/client.conf

@@ -139,7 +139,7 @@ motd_type: 0
 display_version: yes
 display_version: yes
 
 
 // When affected with the "Hallucination" status effect, send the effect to client? (Note 1)
 // When affected with the "Hallucination" status effect, send the effect to client? (Note 1)
-// Note: Set to 'no' if the client lags due to the "Wavy" screen effect.
+// NOTE: Set to 'no' if the client lags due to the "Wavy" screen effect.
 display_hallucination: yes
 display_hallucination: yes
 
 
 // Set this to 1 if your client supports status change timers and you want to use them
 // Set this to 1 if your client supports status change timers and you want to use them
@@ -155,9 +155,14 @@ client_reshuffle_dice: yes
 // NOTE: Enabling this option degrades performance.
 // NOTE: Enabling this option degrades performance.
 client_sort_storage: no
 client_sort_storage: no
 
 
-// Do we allow to change guilde emblem during woe_time ?
+// Do we allow to change guilde emblem during woe_time?
 emblem_woe_change: yes
 emblem_woe_change: yes
 
 
-// How many transparent pixel can be found in emblem before detected as invalid ?
-// Note 2
+// How many transparent pixel can be found in emblem before detected as invalid? (Note 2)
 emblem_transparency_limit: 80
 emblem_transparency_limit: 80
+
+// Update enemy position while in invisible state? (Note 1)
+// NOTE: Set to 'no' will make client won't update enemy position unless the players have "Intravision" effect.
+//       So that will help client handling WPE - Maya Purple Hack stuff.
+//       But it will screw 'the game animation display' while players in invisible state.
+update_enemy_position: yes

+ 6 - 0
conf/battle/skill.conf

@@ -181,6 +181,12 @@ gx_disptype: 1
 // Max Level Difference for Devotion
 // Max Level Difference for Devotion
 devotion_level_difference: 10
 devotion_level_difference: 10
 
 
+// Using 'old' behavior for devotion vs reflect damage? (Note 2)
+// Default is 0 (official). If 'devotion_rdamage' is > 0 (chance to devot the reflected damage),
+// when player with devotion attacks player with reflect damage ability (item bonus or skill),
+// the damage will be taken by the person who provides devotion instead the attacker.
+devotion_rdamage: 0
+
 // If no than you can use the ensemble skills alone. (Note 1)
 // If no than you can use the ensemble skills alone. (Note 1)
 player_skill_partner_check: yes
 player_skill_partner_check: yes
 
 

+ 1 - 0
db/const.txt

@@ -789,6 +789,7 @@ IG_CardAlbum_Shoes	66
 IG_CardAlbum_Shield	67
 IG_CardAlbum_Shield	67
 IG_CardAlbum_Weapon	68
 IG_CardAlbum_Weapon	68
 IG_CardAlbum_Garment	69
 IG_CardAlbum_Garment	69
+IG_Flamel_Card	70
 
 
 SC_ALL	-1
 SC_ALL	-1
 SC_STONE	0
 SC_STONE	0

+ 1 - 1
db/pre-re/skill_db.txt

@@ -308,7 +308,7 @@
 199,9,6,1,7,0x40,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_BLOODDRAIN,Sucking Blood
 199,9,6,1,7,0x40,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_BLOODDRAIN,Sucking Blood
 200,9,6,1,7,0,0,1,1,no,0,0x2,0,magic,0,0x0,		NPC_ENERGYDRAIN,Energy Drain
 200,9,6,1,7,0,0,1,1,no,0,0x2,0,magic,0,0x0,		NPC_ENERGYDRAIN,Energy Drain
 201,0,0,4,0,0x1,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_KEEPING,Keeping
 201,0,0,4,0,0x1,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_KEEPING,Keeping
-202,9,6,1,7,0,0,5,1,no,0,0x2,0,misc,0,0x0,		NPC_DARKBREATH,Dark Breath
+202,9,6,1,7,0xC0,0,5,1,no,0,0x2,0,misc,0,0x0,		NPC_DARKBREATH,Dark Breath
 203,9,6,1,7,0x1,0,10,1,no,0,0x2,0,magic,0,0x0,	NPC_DARKBLESSING,Dark Blessing
 203,9,6,1,7,0x1,0,10,1,no,0,0x2,0,magic,0,0x0,	NPC_DARKBLESSING,Dark Blessing
 204,0,0,4,0,0x1,0,1,1,no,0,0x2,0,magic,0,0x0,	NPC_BARRIER,Barrier
 204,0,0,4,0,0x1,0,1,1,no,0,0x2,0,magic,0,0x0,	NPC_BARRIER,Barrier
 205,0,0,4,0,0x1,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_DEFENDER,Defender
 205,0,0,4,0,0x1,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_DEFENDER,Defender

+ 69 - 1
db/quest_db.txt

@@ -599,7 +599,9 @@
 4263,0,0,0,0,0,0,0,"Counteroffensive (1)"
 4263,0,0,0,0,0,0,0,"Counteroffensive (1)"
 4264,0,0,0,0,0,0,0,"Counteroffensive (2)"
 4264,0,0,0,0,0,0,0,"Counteroffensive (2)"
 4265,0,0,0,0,0,0,0,"Bookshelf use"
 4265,0,0,0,0,0,0,0,"Bookshelf use"
-
+//4303,0,0,0,0,0,0,0,""
+//4304,0,0,0,0,0,0,0,""
+//4305,0,0,0,0,0,0,0,""
 5000,0,0,0,0,0,0,0,"The Crow of the Fate - 7"
 5000,0,0,0,0,0,0,0,"The Crow of the Fate - 7"
 
 
 // Researcher's Quest
 // Researcher's Quest
@@ -1595,6 +1597,15 @@
 9260,0,0,0,0,0,0,0,"Survey investigation notes"
 9260,0,0,0,0,0,0,0,"Survey investigation notes"
 9262,0,0,0,0,0,0,0,"Mystery Robbery Incident 16"
 9262,0,0,0,0,0,0,0,"Mystery Robbery Incident 16"
 
 
+//9327,0,0,0,0,0,0,0,""
+//9328,0,0,0,0,0,0,0,""
+//9329,0,0,0,0,0,0,0,""
+//9330,0,0,0,0,0,0,0,""
+//9331,0,0,0,0,0,0,0,""
+//9332,0,0,0,0,0,0,0,""
+//9333,0,0,0,0,0,0,0,""
+//9334,0,0,0,0,0,0,0,""
+
 10000,0,0,0,0,0,0,0,"To the Prontera Royal Court"
 10000,0,0,0,0,0,0,0,"To the Prontera Royal Court"
 10001,0,0,0,0,0,0,0,"Qualification Test"
 10001,0,0,0,0,0,0,0,"Qualification Test"
 10002,0,0,0,0,0,0,0,"Qualification Review"
 10002,0,0,0,0,0,0,0,"Qualification Review"
@@ -2356,6 +2367,63 @@
 14140,0,0,0,0,0,0,0,"To Wuhari"
 14140,0,0,0,0,0,0,0,"To Wuhari"
 14141,0,0,0,0,0,0,0,"Ingredients for research"
 14141,0,0,0,0,0,0,0,"Ingredients for research"
 
 
+//14254,0,0,0,0,0,0,0,""
+//14255,0,0,0,0,0,0,0,""
+//14256,0,0,0,0,0,0,0,""
+//14257,0,0,0,0,0,0,0,""
+//14258,0,0,0,0,0,0,0,""
+//14259,0,0,0,0,0,0,0,""
+//14260,0,0,0,0,0,0,0,""
+//14261,0,0,0,0,0,0,0,""
+//14262,0,0,0,0,0,0,0,""
+//14263,0,0,0,0,0,0,0,""
+//14264,0,0,0,0,0,0,0,""
+//14265,0,0,0,0,0,0,0,""
+//14266,0,0,0,0,0,0,0,""
+//14267,0,0,0,0,0,0,0,""
+//14268,0,0,0,0,0,0,0,""
+//14269,0,0,0,0,0,0,0,""
+//14270,0,0,0,0,0,0,0,""
+//14271,0,0,0,0,0,0,0,""
+//14272,0,0,0,0,0,0,0,""
+//14273,0,0,0,0,0,0,0,""
+//14275,0,0,0,0,0,0,0,""
+//14276,0,0,0,0,0,0,0,""
+//14277,0,0,0,0,0,0,0,""
+//14278,0,0,0,0,0,0,0,""
+//14279,0,0,0,0,0,0,0,""
+//14280,0,0,0,0,0,0,0,""
+//14281,0,0,0,0,0,0,0,""
+//14282,0,0,0,0,0,0,0,""
+//14283,0,0,0,0,0,0,0,""
+//14284,0,0,0,0,0,0,0,""
+//14285,0,0,0,0,0,0,0,""
+//14286,0,0,0,0,0,0,0,""
+//14287,0,0,0,0,0,0,0,""
+//14288,0,0,0,0,0,0,0,""
+//14289,0,0,0,0,0,0,0,""
+//14290,0,0,0,0,0,0,0,""
+//14291,0,0,0,0,0,0,0,""
+//15025,0,0,0,0,0,0,0,""
+//15026,0,0,0,0,0,0,0,""
+//15027,0,0,0,0,0,0,0,""
+//15028,0,0,0,0,0,0,0,""
+//15029,0,0,0,0,0,0,0,""
+//15030,0,0,0,0,0,0,0,""
+//15031,0,0,0,0,0,0,0,""
+//15032,0,0,0,0,0,0,0,""
+//15033,0,0,0,0,0,0,0,""
+//15034,0,0,0,0,0,0,0,""
+//15035,0,0,0,0,0,0,0,""
+//15036,0,0,0,0,0,0,0,""
+//15037,0,0,0,0,0,0,0,""
+//15038,0,0,0,0,0,0,0,""
+//15039,0,0,0,0,0,0,0,""
+//15040,0,0,0,0,0,0,0,""
+//15041,0,0,0,0,0,0,0,""
+//15043,0,0,0,0,0,0,0,""
+//15045,0,0,0,0,0,0,0,""
+
 16000,0,0,0,0,0,0,0,"Metz Brayde's Notice"
 16000,0,0,0,0,0,0,0,"Metz Brayde's Notice"
 16001,0,0,0,0,0,0,0,"First examination"
 16001,0,0,0,0,0,0,0,"First examination"
 16002,0,0,0,0,0,0,0,"Fetching Items for Arian -1"
 16002,0,0,0,0,0,0,0,"Fetching Items for Arian -1"

+ 20 - 7
db/re/item_db.txt

@@ -1975,6 +1975,8 @@
 2940,Ninja_Manual,Ninja Manual,5,0,,100,,0,,0,0x00000001,63,2,136,,0,0,0,{ bonus bMaxSP,100; skill "NJ_UTSUSEMI",1; skill "NJ_KOUENKA",1; skill "NJ_SYURIKEN",1; },{},{}
 2940,Ninja_Manual,Ninja Manual,5,0,,100,,0,,0,0x00000001,63,2,136,,0,0,0,{ bonus bMaxSP,100; skill "NJ_UTSUSEMI",1; skill "NJ_KOUENKA",1; skill "NJ_SYURIKEN",1; },{},{}
 2941,Gunslinger_Manual,Gunslinger Manual,5,0,,100,,0,,0,0x00000001,63,2,136,,0,0,0,{ bonus bMaxSP,100; skill "GS_GLITTERING",1; skill "GS_ADJUSTMENT",1; skill "GS_MADNESSCANCEL",1; skill "GS_INCREASING",1; },{},{}
 2941,Gunslinger_Manual,Gunslinger Manual,5,0,,100,,0,,0,0x00000001,63,2,136,,0,0,0,{ bonus bMaxSP,100; skill "GS_GLITTERING",1; skill "GS_ADJUSTMENT",1; skill "GS_MADNESSCANCEL",1; skill "GS_INCREASING",1; },{},{}
 2942,Taekwon_Manual,Taekwon Manual,5,0,,100,,0,,0,0x00000001,63,2,136,,0,0,0,{ bonus bMaxSP,100; skill "TK_SEVENWIND",4; skill "TK_JUMPKICK",5; },{},{}
 2942,Taekwon_Manual,Taekwon Manual,5,0,,100,,0,,0,0x00000001,63,2,136,,0,0,0,{ bonus bMaxSP,100; skill "TK_SEVENWIND",4; skill "TK_JUMPKICK",5; },{},{}
+2957,Enhanced_Ring_of_Flame_Lord,Enhanced Ring of Flame Lord,5,10,,100,,0,,,0x7CCFDF80,63,2,136,,85,,,{ bonus bStr,3; bonus bVit,2; bonus bBaseAtk,20; bonus2 bSubEle,Ele_Fire,10; bonus3 bAutoSpell,"CH_SOULCOLLECT",1,30; bonus3 bAutoSpell,"MO_EXPLOSIONSPIRITS",1,10; bonus3 bAutoSpell,"PA_PRESSURE",2,30; bonus3 bAutoSpell,"MG_FIREBALL",1,150; bonus3 bAutoSpell,"KN_BOWLINGBASH",5,20; },{},{}
+2958,Enhanced_Ring_of_Resonance,Enhanced Ring of Resonance,5,10,,100,,2,,,0x7CCFDF80,63,2,136,,85,,,{ bonus bAgi,3; bonus bVit,1; bonus bMdef,2; bonus bMatk,10; bonus4 bAutoSpellWhenHit,"WZ_QUAGMIRE",1,50,0; bonus3 bAutoSpellWhenHit,"AS_SPLASHER",10,20; bonus3 bAutoSpellWhenHit,"AL_HEAL",10,30; bonus3 bAutoSpellWhenHit,"HP_ASSUMPTIO",3,20; bonus3 bAutoSpellWhenHit,"CG_TAROTCARD",5,20; },{},{}
 2959,Fidelity_Necklace,Fidelity Necklace,5,20,,300,,0,,1,0xFFFFFFFF,63,2,136,,50,0,0,{ bonus bAgi,2; bonus2 bSubRace,RC_Brute,3; },{},{}
 2959,Fidelity_Necklace,Fidelity Necklace,5,20,,300,,0,,1,0xFFFFFFFF,63,2,136,,50,0,0,{ bonus bAgi,2; bonus2 bSubRace,RC_Brute,3; },{},{}
 2960,Badge_Of_Manny,Badge Of Manny,5,20,,200,,0,,1,0xFFFFFFFF,63,2,136,,0,0,0,{ bonus bAllStats,1; },{},{}
 2960,Badge_Of_Manny,Badge Of Manny,5,20,,200,,0,,1,0xFFFFFFFF,63,2,136,,0,0,0,{ bonus bAllStats,1; },{},{}
 2966,RWC_2012_Ring,RWC 2012 Ring,5,20,,200,,0,,0,0xFFFFFFFF,63,2,136,,0,0,0,{ bonus2 bAddRace,RC_NonBoss,1; bonus2 bAddRace,RC_Boss,1; },{},{}
 2966,RWC_2012_Ring,RWC 2012 Ring,5,20,,200,,0,,0,0xFFFFFFFF,63,2,136,,0,0,0,{ bonus2 bAddRace,RC_NonBoss,1; bonus2 bAddRace,RC_Boss,1; },{},{}
@@ -7668,9 +7670,12 @@
 14613,RWC_Scroll_2012,RWC Scroll 2012,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 14613,RWC_Scroll_2012,RWC Scroll 2012,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 14614,Ex_Def_Potion,Ex Def Potion,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 14614,Ex_Def_Potion,Ex Def Potion,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
 //
 //
-14616,STR_Biscuit_Stick,Bar of Strength,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
-14617,VIT_Biscuit_Stick,Bar of Fitness,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
-14618,AGI_Biscuit_Stick,Bar of Agility,2,0,,10,,,,,0xFFFFFFFF,63,2,,,,,,{},{},{}
+14616,STR_Biscuit_Stick,Bar Cookie Of Strength,18,1,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_STRFOOD,1800000,15; sc_start SC_INCATKRATE,600000,rand(11,111); },{},{}
+14617,VIT_Biscuit_Stick,Bar Cookie Of Vitality,18,1,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_INCVIT,1800000,15; /*sc_start SC_INCDEFRATE,600000,rand(11,33);*/ },{},{}
+14618,AGI_Biscuit_Stick,Bar Cookie Of Agility,18,1,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_AGIFOOD,1800000,15; sc_start SC_INCFLEE,600000,rand(11,33); },{},{}
+14619,INT_Biscuit_Stick,Bar Cookie Of Intelligence,18,1,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_INTFOOD,1800000,15; sc_start SC_INCMATKRATE,600000,rand(11,111); },{},{}
+14620,DEX_Biscuit_Stick,Bar Cookie Of Dexterity,18,1,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_DEXFOOD,1800000,15; sc_start SC_INCHIT,600000,rand(11,33); },{},{}
+14621,LUK_Biscuit_Stick,Bar Cookie Of Lucky,18,1,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_LUKFOOD,1800000,15; sc_start SC_INCCRI,600000,rand(11,33); },{},{}
 //14626,Indigo_Scroll
 //14626,Indigo_Scroll
 //14643,Violet_Scroll
 //14643,Violet_Scroll
 //14664,Bi_Hwang_Scroll
 //14664,Bi_Hwang_Scroll
@@ -8269,6 +8274,7 @@
 17338,Ore_Box_V,Ore Box V,18,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getitem 7619,5; getitem 7620,5; getitem 14696,1; },{},{}
 17338,Ore_Box_V,Ore Box V,18,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getitem 7619,5; getitem 7620,5; getitem 14696,1; },{},{}
 17339,Ore_Box_V(10),Ore Box V(10),18,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getitem 7619,50; getitem 7620,50; getitem 14696,11; },{},{}
 17339,Ore_Box_V(10),Ore Box V(10),18,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ getitem 7619,50; getitem 7620,50; getitem 14696,11; },{},{}
 //17394,Event_Old_Headgear_Box,Event Old Headgear Box,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ /* TODO */ },{},{}
 //17394,Event_Old_Headgear_Box,Event Old Headgear Box,2,20,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ /* TODO */ },{},{}
+17449,Cookies_Bar_Set,Set Bar Cookies,2,10,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ for (set .@i,14616; .@i <= 14621; set .@i,.@i+1) getitem .@i,1; },{},{}
 // Mechanic/Genetic Cannonballs
 // Mechanic/Genetic Cannonballs
 18000,Cannon_Ball,Cannon Ball,10,100,,10,100,,,,0x00040400,56,2,32768,,99,,8,{},{},{}
 18000,Cannon_Ball,Cannon Ball,10,100,,10,100,,,,0x00040400,56,2,32768,,99,,8,{},{},{}
 18001,Holy_Cannon_Ball,Holy Cannon Ball,10,200,,10,120,,,,0x00040400,56,2,32768,,99,,8,{ bonus bAtkEle,Ele_Holy; },{},{}
 18001,Holy_Cannon_Ball,Holy Cannon Ball,10,200,,10,120,,,,0x00040400,56,2,32768,,99,,8,{ bonus bAtkEle,Ele_Holy; },{},{}
@@ -8521,9 +8527,9 @@
 18737,Fortier_Mask,Fortier Masque,5,20,,200,,0,,0,0xFFFFFFFF,63,2,512,,10,0,876,{ bonus bUnbreakableHelm,0; },{},{}
 18737,Fortier_Mask,Fortier Masque,5,20,,200,,0,,0,0xFFFFFFFF,63,2,512,,10,0,876,{ bonus bUnbreakableHelm,0; },{},{}
 18739,Carnation_Hairband,Carnation Hairband,5,20,,100,,0,,0,0xFFFFFFFF,63,2,256,,0,1,878,{ bonus bLuk,1; },{},{}
 18739,Carnation_Hairband,Carnation Hairband,5,20,,100,,0,,0,0xFFFFFFFF,63,2,256,,0,1,878,{ bonus bLuk,1; },{},{}
 18740,Hair_Of_The_Strong,Hair Of The Strong,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,879,{},{},{}
 18740,Hair_Of_The_Strong,Hair Of The Strong,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,879,{},{},{}
-18742,C_MoonStar_Accessory,Moon and Stars,5,20,,0,,0,,0,0xFFFFFFFF,7,2,2048,,0,0,881,{},{ sc_start SC_MOONSTAR,-1,0; },{ sc_end SC_MOONSTAR; }
+18742,C_MoonStar_Accessory,Moon and Stars,5,20,,0,,0,,0,0xFFFFFFFF,63,2,2048,,0,0,881,{},{ sc_start SC_MOONSTAR,-1,0; },{ sc_end SC_MOONSTAR; }
 18743,Spirit_Of_Chung_E,Spirit Of Chung E,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,882,{},{},{}
 18743,Spirit_Of_Chung_E,Spirit Of Chung E,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,882,{},{},{}
-18744,C_World_Star,Twilight,5,20,,0,,0,,0,0xFFFFFFFF,7,2,2048,,0,0,883,{},{ sc_start SC_SUPER_STAR,-1,0; },{ sc_end SC_SUPER_STAR; }
+18744,C_World_Star,Twilight,5,20,,0,,0,,0,0xFFFFFFFF,63,2,2048,,0,0,883,{},{ sc_start SC_SUPER_STAR,-1,0; },{ sc_end SC_SUPER_STAR; }
 18745,Choco_Stick_In_Mouth,Choco Stick In Mouth,5,20,,100,,0,,0,0xFFFFFFFF,63,2,1,,10,0,884,{},{},{}
 18745,Choco_Stick_In_Mouth,Choco Stick In Mouth,5,20,,100,,0,,0,0xFFFFFFFF,63,2,1,,10,0,884,{},{},{}
 18746,Chilly_Breath,Chilly Breath,5,20,,100,,0,,0,0xFFFFFFFF,63,2,1,,10,0,885,{ bonus bInt,1; },{},{}
 18746,Chilly_Breath,Chilly Breath,5,20,,100,,0,,0,0xFFFFFFFF,63,2,1,,10,0,885,{ bonus bInt,1; },{},{}
 18747,Eyes_Of_Ifrit,Eyes Of Ifrit,5,20,,100,,1,,1,0xFFFFFFFF,63,2,512,,0,0,886,{ bonus bDex,1; },{},{}
 18747,Eyes_Of_Ifrit,Eyes Of Ifrit,5,20,,100,,1,,1,0xFFFFFFFF,63,2,512,,0,0,886,{ bonus bDex,1; },{},{}
@@ -8536,6 +8542,9 @@
 18758,Hat_Of_Scrat,Hat Of Scrat,5,20,,200,,3,,1,0xFFFFFFFF,63,2,256,,0,1,896,{},{},{}
 18758,Hat_Of_Scrat,Hat Of Scrat,5,20,,200,,3,,1,0xFFFFFFFF,63,2,256,,0,1,896,{},{},{}
 18759,Stretched_Nose_M,Wood Goblin's Nose,5,20,,200,,0,,0,0xFFFFFFFF,63,2,512,,50,0,737,{ bonus bUnbreakableHelm,0; },{},{}
 18759,Stretched_Nose_M,Wood Goblin's Nose,5,20,,200,,0,,0,0xFFFFFFFF,63,2,512,,50,0,737,{ bonus bUnbreakableHelm,0; },{},{}
 //
 //
+18766,Improved_Helm_of_Angel,Improved Helm of Angel,5,10,,1600,,10,,1,0x7CCFDF80,63,2,256,,99,1,,{ bonus bAgi,1; bonus bLuk,1; bonus bMDef,3; if (getrefine()>=7) { bonus bAgi,2; bonus bLuk,2; } if(getrefine()>=9) bonus bAspd,1; },{},{}
+18767,Improved_Helm_Of_Sun,Improved Hat of the Sun God,5,10,,2400,,4,,1,0x7CCFDF80,63,2,768,,99,1,,{ bonus bStr,3; bonus bInt,2; bonus bAtk,10; bonus bMatk,10; if(getrefine()>=7){bonus bAtk,15;bonus bMatk,15;} if(getrefine()>=9){bonus bAtk,15;bonus bMatk,15;} },{},{}
+//
 18779,RWC_Champ_Crown_First_Place,RWC Champ Crown First Place,5,20,,500,,12,,,0xFFFFFFFF,63,2,256,,1,,902,{ bonus2 bResEff,Eff_Stun,10000; bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,7; bonus bMdef,5; },{},{}
 18779,RWC_Champ_Crown_First_Place,RWC Champ Crown First Place,5,20,,500,,12,,,0xFFFFFFFF,63,2,256,,1,,902,{ bonus2 bResEff,Eff_Stun,10000; bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,7; bonus bMdef,5; },{},{}
 18780,RWC_Champ_Crown_Second_Place,RWC Champ Crown Second Place,5,20,,500,,12,,,0xFFFFFFFF,63,2,256,,1,,903,{ bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,7; bonus bMdef,5; },{},{}
 18780,RWC_Champ_Crown_Second_Place,RWC Champ Crown Second Place,5,20,,500,,12,,,0xFFFFFFFF,63,2,256,,1,,903,{ bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,7; bonus bMdef,5; },{},{}
 18781,RWC_Champ_Crown_Third_Place,RWC Champ Crown Third Place,5,20,,500,,12,,,0xFFFFFFFF,63,2,256,,1,,904,{ bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,3; bonus bMdef,1; },{},{}
 18781,RWC_Champ_Crown_Third_Place,RWC Champ Crown Third Place,5,20,,500,,12,,,0xFFFFFFFF,63,2,256,,1,,904,{ bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,3; bonus bMdef,1; },{},{}
@@ -8657,10 +8666,11 @@
 19707,C_Polar_Bear_Cap,Costume Polar Bear Cap,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,966,{ bonus bUnbreakableHelm,0; },{},{}
 19707,C_Polar_Bear_Cap,Costume Polar Bear Cap,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,966,{ bonus bUnbreakableHelm,0; },{},{}
 19730,C_Snake_Hat,C Snake Hat,5,20,,10,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,986,{},{},{}
 19730,C_Snake_Hat,C Snake Hat,5,20,,10,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,986,{},{},{}
 19746,C_Executioner_Hood,Executioner Hood,5,20,,0,,0,,0,0xFFFFFFFF,63,2,2048,,0,0,0,{},{},{}
 19746,C_Executioner_Hood,Executioner Hood,5,20,,0,,0,,0,0xFFFFFFFF,63,2,2048,,0,0,0,{},{},{}
+19777,C_Shiny_Small_Star,Shiny Small Star,5,20,,10,,0,,0,0xFFFFFFFF,63,2,1024,,1,0,0,{},{},{}
 19829,C_Straw_Hat,C Straw Hat,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,146,{},{},{}
 19829,C_Straw_Hat,C Straw Hat,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,146,{},{},{}
-19853,C_Filir Wings,C Filir Wings,5,20,,0,,0,,0,0xFFFFFFFF,63,2,2048,,1,0,595,{ for (set .@i,0; .@i <= 12; set .@i,.@i+1) { bonus2 bExpAddRace,.@i,5; } },{},{}
+19853,C_Filir Wings,C Filir Wings,5,20,,0,,0,,0,0xFFFFFFFF,63,2,2048,,1,0,595,{ bonus2 bExpAddRace,RC_Boss,5; bonus2 bExpAddRace,RC_NonBoss,5; },{},{}
 19856,Costume_Snow_Cone_Hat,Costume Snow Cone Hat,5,10,,0,,0,,0,0xFFFFFFFF,63,2,1024,,1,0,0,{ bonus2 bAddEle,Ele_Fire,5; bonus2 bMagicAddEle,Ele_Fire,5; bonus2 bAddMonsterDropItem,11589,5; },{},{}
 19856,Costume_Snow_Cone_Hat,Costume Snow Cone Hat,5,10,,0,,0,,0,0xFFFFFFFF,63,2,1024,,1,0,0,{ bonus2 bAddEle,Ele_Fire,5; bonus2 bMagicAddEle,Ele_Fire,5; bonus2 bAddMonsterDropItem,11589,5; },{},{}
-19857,Costume_Crayfish_Hat,Costume Crayfish Hat,5,10,,10,,0,,,0xFFFFFFFF,63,2,1024,,1,,,{},{},{}
+19857,Costume_Crayfish_Hat,Costume Crayfish Hat,5,10,,10,,0,,,0xFFFFFFFF,63,2,1024,,1,0,0,{},{},{}
 19859,C_Flying_Angel,Flying Angel,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,264,{},{},{}
 19859,C_Flying_Angel,Flying Angel,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,264,{},{},{}
 19860,C_School_Criatura_Hat,School Criatura Hat,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,0,{},{},{}
 19860,C_School_Criatura_Hat,School Criatura Hat,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,0,{},{},{}
 19861,C_Heart_Hairpin,Heart Hairpin,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,126,{},{},{}
 19861,C_Heart_Hairpin,Heart Hairpin,5,20,,0,,0,,0,0xFFFFFFFF,63,2,1024,,0,0,126,{},{},{}
@@ -8693,6 +8703,7 @@
 21005,Metal_Two_Hand_Sword,Metal Two Hand Sword,4,20,,0,95,,1,1,0x00004082,63,2,34,3,1,1,3,{ bonus bBaseAtk,(getrefine()*6); bonus bMatk,(getrefine()*2); set .@i,((BaseLevel/10)>12)?12:(BaseLevel/10); if(.@i>2) bonus bBaseAtk,((.@i-2)*5); },{},{}
 21005,Metal_Two_Hand_Sword,Metal Two Hand Sword,4,20,,0,95,,1,1,0x00004082,63,2,34,3,1,1,3,{ bonus bBaseAtk,(getrefine()*6); bonus bMatk,(getrefine()*2); set .@i,((BaseLevel/10)>12)?12:(BaseLevel/10); if(.@i>2) bonus bBaseAtk,((.@i-2)*5); },{},{}
 21011,Gigantic_Blade,Gigantic Blade,3,10,,5000,300,,,,0xFFFFFFFF,56,2,2,4,130,1,3,{ bonus bUnbreakableWeapon,1; bonus bAspdRate,-5; if(readparam(bStr)<=110){ bonus bAtk,-250; } },{},{}
 21011,Gigantic_Blade,Gigantic Blade,3,10,,5000,300,,,,0xFFFFFFFF,56,2,2,4,130,1,3,{ bonus bUnbreakableWeapon,1; bonus bAspdRate,-5; if(readparam(bStr)<=110){ bonus bAtk,-250; } },{},{}
 // New Items
 // New Items
+22014,Enhanced_Variant_Shoes,Enhanced Variant Shoes,3,10,,500,,13,,1,0x7CCFDF80,63,2,64,,85,1,,{ bonus bMaxHPrate,12; bonus bMaxSPrate,12; bonus bDef,getrefine(); bonus bMdef,getrefine(); },{},{}
 22043,AGI_Complement,AGI Complement,5,10,,350,,25,,,0x00000400,56,2,64,,100,1,,{ bonus bAspdRate,5+(getrefine()/4); },{},{}
 22043,AGI_Complement,AGI Complement,5,10,,350,,25,,,0x00000400,56,2,64,,100,1,,{ bonus bAspdRate,5+(getrefine()/4); },{},{}
 22044,Reinforced_Parts_Booster,Reinforced Parts - Booster,5,10,,1000,,23,,,0x00000400,56,2,64,,100,1,,{ bonus2 bSkillUseSP,"NC_HOVERING",15; if(getrefine()>=7){bonus2 bSkillUseSP,"NC_HOVERING",-20;} },{},{}
 22044,Reinforced_Parts_Booster,Reinforced Parts - Booster,5,10,,1000,,23,,,0x00000400,56,2,64,,100,1,,{ bonus2 bSkillUseSP,"NC_HOVERING",15; if(getrefine()>=7){bonus2 bSkillUseSP,"NC_HOVERING",-20;} },{},{}
 22045,Summer_Sandals,Summer Sandals,5,10,,200,,5,,0,0xFFFFFFFF,63,2,64,,0,1,0,{ bonus bFlee,5; bonus3 bAutoSpellWhenHit,"AL_INCAGI",10,50; },{},{}
 22045,Summer_Sandals,Summer Sandals,5,10,,200,,5,,0,0xFFFFFFFF,63,2,64,,0,1,0,{ bonus bFlee,5; bonus3 bAutoSpellWhenHit,"AL_INCAGI",10,50; },{},{}
@@ -8715,6 +8726,8 @@
 22648,Angel_Ring_Package,Angel Ring Package,3,10,,10,,,,,,,,,,,,,{},{},{}
 22648,Angel_Ring_Package,Angel Ring Package,3,10,,10,,,,,,,,,,,,,{},{},{}
 22649,Devil_Ring_Package,Devil Ring Package,3,10,,10,,,,,,,,,,,,,{},{},{}
 22649,Devil_Ring_Package,Devil Ring Package,3,10,,10,,,,,,,,,,,,,{},{},{}
 22652,Briliant_Hat_Box,Brilliant Hat Box,2,10,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ /* TODO */ },{},{}
 22652,Briliant_Hat_Box,Brilliant Hat Box,2,10,,200,,,,,0xFFFFFFFF,63,2,,,,,,{ /* TODO */ },{},{}
+22653,Wet_Card_Album,Wet Card Album,2,10000,,50,,,,,0xFFFFFFFF,63,2,,,,,,{ /* TODO */ },{},{}
+22654,Golden_Seal_Card,Golden Seal Card,3,20,,50,,,,,,,,,,,,,{},{},{}
 22675,Mysterious_Scroll,Mysterious Scroll,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_INTFOOD,3600000,30; },{},{}
 22675,Mysterious_Scroll,Mysterious Scroll,2,20,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_INTFOOD,3600000,30; },{},{}
 22676,Hangul_Day_Event_Box,Hangul Day Event Box,2,20,,0,,,,,0xFFFFFFFF,63,2,,,0,,,{ getitem 22675,10; getitem 607,9; },{},{}
 22676,Hangul_Day_Event_Box,Hangul Day Event Box,2,20,,0,,,,,0xFFFFFFFF,63,2,,,0,,,{ getitem 22675,10; getitem 607,9; },{},{}
 
 

+ 1 - 1
db/re/item_misc.txt

@@ -1217,4 +1217,4 @@
 // Flamel Card
 // Flamel Card
 70,545,1		// Condensed Red Potion
 70,545,1		// Condensed Red Potion
 70,546,1		// Condensed Yellow Potion
 70,546,1		// Condensed Yellow Potion
-70,547,1		// Condensed White Potion
+70,547,1		// Condensed White Potion

+ 9 - 0
db/re/item_trade.txt

@@ -2080,5 +2080,14 @@
 // kRO 2013-10-08
 // kRO 2013-10-08
 22675,475,100
 22675,475,100
 
 
+// kRO 2013-11-06
+17449,475,100
+14616,475,100
+14617,475,100
+14618,475,100
+14619,475,100
+14620,475,100
+14621,475,100
+
 // kRO 2013-11-13
 // kRO 2013-11-13
 16628,475,100
 16628,475,100

+ 1 - 0
db/re/mob_db.txt

@@ -2276,6 +2276,7 @@
 //3154,RECON_ROBOT
 //3154,RECON_ROBOT
 //3155,REPAIR_ROBOT
 //3155,REPAIR_ROBOT
 //3156,EXPLORATION_ROVER
 //3156,EXPLORATION_ROVER
+//3166,M_E_DEVILING
 //
 //
 //3201,JT_LUCKYCASE
 //3201,JT_LUCKYCASE
 //3202,JT_ORGANIC_JAKK
 //3202,JT_ORGANIC_JAKK

+ 1 - 1
db/re/skill_db.txt

@@ -307,7 +307,7 @@
 199,9,6,1,7,0x40,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_BLOODDRAIN,Sucking Blood
 199,9,6,1,7,0x40,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_BLOODDRAIN,Sucking Blood
 200,9,6,1,7,0,0,1,1,no,0,0x2,0,magic,0,0x0,		NPC_ENERGYDRAIN,Energy Drain
 200,9,6,1,7,0,0,1,1,no,0,0x2,0,magic,0,0x0,		NPC_ENERGYDRAIN,Energy Drain
 201,0,0,4,0,0x1,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_KEEPING,Keeping
 201,0,0,4,0,0x1,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_KEEPING,Keeping
-202,9,6,1,7,0,0,5,1,no,0,0x2,0,misc,0,0x0,		NPC_DARKBREATH,Dark Breath
+202,9,6,1,7,0xC0,0,5,1,no,0,0x2,0,misc,0,0x0,		NPC_DARKBREATH,Dark Breath
 203,9,6,1,7,0x1,0,10,1,no,0,0x2,0,magic,0,0x0,	NPC_DARKBLESSING,Dark Blessing
 203,9,6,1,7,0x1,0,10,1,no,0,0x2,0,magic,0,0x0,	NPC_DARKBLESSING,Dark Blessing
 204,0,0,4,0,0x1,0,1,1,no,0,0x2,0,magic,0,0x0,	NPC_BARRIER,Barrier
 204,0,0,4,0,0x1,0,1,1,no,0,0x2,0,magic,0,0x0,	NPC_BARRIER,Barrier
 205,0,0,4,0,0x1,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_DEFENDER,Defender
 205,0,0,4,0,0x1,0,1,1,no,0,0x2,0,weapon,0,0x0,	NPC_DEFENDER,Defender

+ 0 - 1
npc/mapflag/nosave.txt

@@ -31,7 +31,6 @@ job_cru	mapflag	nosave	SavePoint
 job_duncer	mapflag	nosave	SavePoint
 job_duncer	mapflag	nosave	SavePoint
 job_monk	mapflag	nosave	SavePoint
 job_monk	mapflag	nosave	SavePoint
 monk_test	mapflag	nosave	SavePoint
 monk_test	mapflag	nosave	SavePoint
-monk_in	mapflag	nosave	SavePoint
 in_rogue	mapflag	nosave	SavePoint
 in_rogue	mapflag	nosave	SavePoint
 job_sage	mapflag	nosave	SavePoint
 job_sage	mapflag	nosave	SavePoint
 // Ext
 // Ext

+ 2 - 2
npc/pre-re/guides/guides_payon.txt

@@ -186,7 +186,7 @@ payon,162,67,4	script	Guide#pay	708,{
 			break;
 			break;
 		}
 		}
 	}
 	}
-	cutin "pay_soldier",255;
+	cutin "",255;
 	end;
 	end;
 }
 }
 
 
@@ -291,6 +291,6 @@ pay_arche,85,30,2	script	Guide#2pay	708,{
 			break;
 			break;
 		}
 		}
 	}
 	}
-	cutin "pay_soldier",255;
+	cutin "",255;
 	end;
 	end;
 }
 }

+ 1 - 1
npc/quests/bard_quest.txt

@@ -1929,7 +1929,7 @@ morocc,134,111,3	script	Bard#3	741,{
 				mes "There's no reason to be afraid of this riffraff, your Uncle Kino is here, okay?";
 				mes "There's no reason to be afraid of this riffraff, your Uncle Kino is here, okay?";
 			} else if (BaseClass == Job_Assassin) {
 			} else if (BaseClass == Job_Assassin) {
 				mes "There's no reason to be afraid. I know that person looks scary, but you're a good girl, so you'll be okay.";
 				mes "There's no reason to be afraid. I know that person looks scary, but you're a good girl, so you'll be okay.";
-			} else if (BaeClass == Job_Blacksmith) {
+			} else if (BaseClass == Job_Blacksmith) {
 				mes "There's no reason to be scared, honey. It's just a Blacksmith.";
 				mes "There's no reason to be scared, honey. It's just a Blacksmith.";
 			} else {
 			} else {
 				mes "There's no reason to be scared. See...? That person won't hurt you.";
 				mes "There's no reason to be scared. See...? That person won't hurt you.";

+ 3 - 3
npc/re/guides/guides_payon.txt

@@ -178,8 +178,8 @@ payon,163,64,3	script	Guide#01payon::GuidePayon	708,{
 		case 4:
 		case 4:
 			mes "[Payon Guide]";
 			mes "[Payon Guide]";
 			mes "Enjoy your stay.";
 			mes "Enjoy your stay.";
-			close;
-			cutin "pay_soldier",255;
+			close2;
+			cutin "",255;
 			end;
 			end;
 		}
 		}
 	}
 	}
@@ -287,7 +287,7 @@ pay_arche,86,33,4	script	Guide#05payon	708,{
 			mes "[Payon Guide]";
 			mes "[Payon Guide]";
 			mes "Enjoy your stay.";
 			mes "Enjoy your stay.";
 			close2;
 			close2;
-			cutin "pay_soldier",255;
+			cutin "",255;
 			end;
 			end;
 		}
 		}
 	}
 	}

+ 20 - 7
sql-files/item_db_re.sql

@@ -2006,6 +2006,8 @@ REPLACE INTO `item_db_re` VALUES (2936,'Recovery_Ring','Recovery Ring',5,20,NULL
 REPLACE INTO `item_db_re` VALUES (2940,'Ninja_Manual','Ninja Manual',5,0,NULL,100,NULL,0,NULL,0,0x00000001,63,2,136,NULL,'0',0,0,'bonus bMaxSP,100; skill "NJ_UTSUSEMI",1; skill "NJ_KOUENKA",1; skill "NJ_SYURIKEN",1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (2940,'Ninja_Manual','Ninja Manual',5,0,NULL,100,NULL,0,NULL,0,0x00000001,63,2,136,NULL,'0',0,0,'bonus bMaxSP,100; skill "NJ_UTSUSEMI",1; skill "NJ_KOUENKA",1; skill "NJ_SYURIKEN",1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (2941,'Gunslinger_Manual','Gunslinger Manual',5,0,NULL,100,NULL,0,NULL,0,0x00000001,63,2,136,NULL,'0',0,0,'bonus bMaxSP,100; skill "GS_GLITTERING",1; skill "GS_ADJUSTMENT",1; skill "GS_MADNESSCANCEL",1; skill "GS_INCREASING",1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (2941,'Gunslinger_Manual','Gunslinger Manual',5,0,NULL,100,NULL,0,NULL,0,0x00000001,63,2,136,NULL,'0',0,0,'bonus bMaxSP,100; skill "GS_GLITTERING",1; skill "GS_ADJUSTMENT",1; skill "GS_MADNESSCANCEL",1; skill "GS_INCREASING",1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (2942,'Taekwon_Manual','Taekwon Manual',5,0,NULL,100,NULL,0,NULL,0,0x00000001,63,2,136,NULL,'0',0,0,'bonus bMaxSP,100; skill "TK_SEVENWIND",4; skill "TK_JUMPKICK",5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (2942,'Taekwon_Manual','Taekwon Manual',5,0,NULL,100,NULL,0,NULL,0,0x00000001,63,2,136,NULL,'0',0,0,'bonus bMaxSP,100; skill "TK_SEVENWIND",4; skill "TK_JUMPKICK",5;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (2957,'Enhanced_Ring_of_Flame_Lord','Enhanced Ring of Flame Lord',5,10,NULL,100,NULL,0,NULL,NULL,0x7CCFDF80,63,2,136,NULL,'85',NULL,NULL,'bonus bStr,3; bonus bVit,2; bonus bBaseAtk,20; bonus2 bSubEle,Ele_Fire,10; bonus3 bAutoSpell,"CH_SOULCOLLECT",1,30; bonus3 bAutoSpell,"MO_EXPLOSIONSPIRITS",1,10; bonus3 bAutoSpell,"PA_PRESSURE",2,30; bonus3 bAutoSpell,"MG_FIREBALL",1,150; bonus3 bAutoSpell,"KN_BOWLINGBASH",5,20;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (2958,'Enhanced_Ring_of_Resonance','Enhanced Ring of Resonance',5,10,NULL,100,NULL,2,NULL,NULL,0x7CCFDF80,63,2,136,NULL,'85',NULL,NULL,'bonus bAgi,3; bonus bVit,1; bonus bMdef,2; bonus bMatk,10; bonus4 bAutoSpellWhenHit,"WZ_QUAGMIRE",1,50,0; bonus3 bAutoSpellWhenHit,"AS_SPLASHER",10,20; bonus3 bAutoSpellWhenHit,"AL_HEAL",10,30; bonus3 bAutoSpellWhenHit,"HP_ASSUMPTIO",3,20; bonus3 bAutoSpellWhenHit,"CG_TAROTCARD",5,20;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (2959,'Fidelity_Necklace','Fidelity Necklace',5,20,NULL,300,NULL,0,NULL,1,0xFFFFFFFF,63,2,136,NULL,'50',0,0,'bonus bAgi,2; bonus2 bSubRace,RC_Brute,3;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (2959,'Fidelity_Necklace','Fidelity Necklace',5,20,NULL,300,NULL,0,NULL,1,0xFFFFFFFF,63,2,136,NULL,'50',0,0,'bonus bAgi,2; bonus2 bSubRace,RC_Brute,3;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (2960,'Badge_Of_Manny','Badge Of Manny',5,20,NULL,200,NULL,0,NULL,1,0xFFFFFFFF,63,2,136,NULL,'0',0,0,'bonus bAllStats,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (2960,'Badge_Of_Manny','Badge Of Manny',5,20,NULL,200,NULL,0,NULL,1,0xFFFFFFFF,63,2,136,NULL,'0',0,0,'bonus bAllStats,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (2966,'RWC_2012_Ring','RWC 2012 Ring',5,20,NULL,200,NULL,0,NULL,0,0xFFFFFFFF,63,2,136,NULL,'0',0,0,'bonus2 bAddRace,RC_NonBoss,1; bonus2 bAddRace,RC_Boss,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (2966,'RWC_2012_Ring','RWC 2012 Ring',5,20,NULL,200,NULL,0,NULL,0,0xFFFFFFFF,63,2,136,NULL,'0',0,0,'bonus2 bAddRace,RC_NonBoss,1; bonus2 bAddRace,RC_Boss,1;',NULL,NULL);
@@ -7699,9 +7701,12 @@ REPLACE INTO `item_db_re` VALUES (14612,'M_Mdef_Potion','M Mdef Potion',11,0,NUL
 REPLACE INTO `item_db_re` VALUES (14613,'RWC_Scroll_2012','RWC Scroll 2012',2,20,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (14613,'RWC_Scroll_2012','RWC Scroll 2012',2,20,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (14614,'Ex_Def_Potion','Ex Def Potion',2,0,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (14614,'Ex_Def_Potion','Ex Def Potion',2,0,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 #
 #
-REPLACE INTO `item_db_re` VALUES (14616,'STR_Biscuit_Stick','Bar of Strength',2,0,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (14617,'VIT_Biscuit_Stick','Bar of Fitness',2,0,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (14618,'AGI_Biscuit_Stick','Bar of Agility',2,0,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (14616,'STR_Biscuit_Stick','Bar Cookie Of Strength',18,1,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_STRFOOD,1800000,15; sc_start SC_INCATKRATE,600000,rand(11,111);',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (14617,'VIT_Biscuit_Stick','Bar Cookie Of Vitality',18,1,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_INCVIT,1800000,15; /*sc_start SC_INCDEFRATE,600000,rand(11,33);*/',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (14618,'AGI_Biscuit_Stick','Bar Cookie Of Agility',18,1,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_AGIFOOD,1800000,15; sc_start SC_INCFLEE,600000,rand(11,33);',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (14619,'INT_Biscuit_Stick','Bar Cookie Of Intelligence',18,1,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_INTFOOD,1800000,15; sc_start SC_INCMATKRATE,600000,rand(11,111);',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (14620,'DEX_Biscuit_Stick','Bar Cookie Of Dexterity',18,1,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_DEXFOOD,1800000,15; sc_start SC_INCHIT,600000,rand(11,33);',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (14621,'LUK_Biscuit_Stick','Bar Cookie Of Lucky',18,1,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_LUKFOOD,1800000,15; sc_start SC_INCCRI,600000,rand(11,33);',NULL,NULL);
 #14626,Indigo_Scroll
 #14626,Indigo_Scroll
 #14643,Violet_Scroll
 #14643,Violet_Scroll
 #14664,Bi_Hwang_Scroll
 #14664,Bi_Hwang_Scroll
@@ -8300,6 +8305,7 @@ REPLACE INTO `item_db_re` VALUES (17271,'VIT_Biscuit_Stick_Box','VIT Biscuit Sti
 REPLACE INTO `item_db_re` VALUES (17338,'Ore_Box_V','Ore Box V',18,20,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'getitem 7619,5; getitem 7620,5; getitem 14696,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (17338,'Ore_Box_V','Ore Box V',18,20,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'getitem 7619,5; getitem 7620,5; getitem 14696,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (17339,'Ore_Box_V(10)','Ore Box V(10)',18,20,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'getitem 7619,50; getitem 7620,50; getitem 14696,11;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (17339,'Ore_Box_V(10)','Ore Box V(10)',18,20,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'getitem 7619,50; getitem 7620,50; getitem 14696,11;',NULL,NULL);
 #REPLACE INTO `item_db_re` VALUES (17394,'Event_Old_Headgear_Box','Event Old Headgear Box',2,20,NULL,50,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'/* TODO */',NULL,NULL);
 #REPLACE INTO `item_db_re` VALUES (17394,'Event_Old_Headgear_Box','Event Old Headgear Box',2,20,NULL,50,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'/* TODO */',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (17449,'Cookies_Bar_Set','Set Bar Cookies',2,10,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'for (set .@i,14616; .@i <= 14621; set .@i,.@i+1) getitem .@i,1;',NULL,NULL);
 # Mechanic/Genetic Cannonballs
 # Mechanic/Genetic Cannonballs
 REPLACE INTO `item_db_re` VALUES (18000,'Cannon_Ball','Cannon Ball',10,100,NULL,10,'100',NULL,NULL,NULL,0x00040400,56,2,32768,NULL,'99',NULL,8,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18000,'Cannon_Ball','Cannon Ball',10,100,NULL,10,'100',NULL,NULL,NULL,0x00040400,56,2,32768,NULL,'99',NULL,8,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18001,'Holy_Cannon_Ball','Holy Cannon Ball',10,200,NULL,10,'120',NULL,NULL,NULL,0x00040400,56,2,32768,NULL,'99',NULL,8,'bonus bAtkEle,Ele_Holy;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18001,'Holy_Cannon_Ball','Holy Cannon Ball',10,200,NULL,10,'120',NULL,NULL,NULL,0x00040400,56,2,32768,NULL,'99',NULL,8,'bonus bAtkEle,Ele_Holy;',NULL,NULL);
@@ -8552,9 +8558,9 @@ REPLACE INTO `item_db_re` VALUES (18730,'Cryptura_Academy_Hat','Cryptura Academy
 REPLACE INTO `item_db_re` VALUES (18737,'Fortier_Mask','Fortier Masque',5,20,NULL,200,NULL,0,NULL,0,0xFFFFFFFF,63,2,512,NULL,'10',0,876,'bonus bUnbreakableHelm,0;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18737,'Fortier_Mask','Fortier Masque',5,20,NULL,200,NULL,0,NULL,0,0xFFFFFFFF,63,2,512,NULL,'10',0,876,'bonus bUnbreakableHelm,0;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18739,'Carnation_Hairband','Carnation Hairband',5,20,NULL,100,NULL,0,NULL,0,0xFFFFFFFF,63,2,256,NULL,'0',1,878,'bonus bLuk,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18739,'Carnation_Hairband','Carnation Hairband',5,20,NULL,100,NULL,0,NULL,0,0xFFFFFFFF,63,2,256,NULL,'0',1,878,'bonus bLuk,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18740,'Hair_Of_The_Strong','Hair Of The Strong',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,879,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18740,'Hair_Of_The_Strong','Hair Of The Strong',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,879,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (18742,'C_MoonStar_Accessory','Moon and Stars',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,7,2,2048,NULL,'0',0,881,NULL,'sc_start SC_MOONSTAR,-1,0;','sc_end SC_MOONSTAR;');
+REPLACE INTO `item_db_re` VALUES (18742,'C_MoonStar_Accessory','Moon and Stars',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,2048,NULL,'0',0,881,NULL,'sc_start SC_MOONSTAR,-1,0;','sc_end SC_MOONSTAR;');
 REPLACE INTO `item_db_re` VALUES (18743,'Spirit_Of_Chung_E','Spirit Of Chung E',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,882,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18743,'Spirit_Of_Chung_E','Spirit Of Chung E',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,882,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (18744,'C_World_Star','Twilight',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,7,2,2048,NULL,'0',0,883,NULL,'sc_start SC_SUPER_STAR,-1,0;','sc_end SC_SUPER_STAR;');
+REPLACE INTO `item_db_re` VALUES (18744,'C_World_Star','Twilight',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,2048,NULL,'0',0,883,NULL,'sc_start SC_SUPER_STAR,-1,0;','sc_end SC_SUPER_STAR;');
 REPLACE INTO `item_db_re` VALUES (18745,'Choco_Stick_In_Mouth','Choco Stick In Mouth',5,20,NULL,100,NULL,0,NULL,0,0xFFFFFFFF,63,2,1,NULL,'10',0,884,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18745,'Choco_Stick_In_Mouth','Choco Stick In Mouth',5,20,NULL,100,NULL,0,NULL,0,0xFFFFFFFF,63,2,1,NULL,'10',0,884,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18746,'Chilly_Breath','Chilly Breath',5,20,NULL,100,NULL,0,NULL,0,0xFFFFFFFF,63,2,1,NULL,'10',0,885,'bonus bInt,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18746,'Chilly_Breath','Chilly Breath',5,20,NULL,100,NULL,0,NULL,0,0xFFFFFFFF,63,2,1,NULL,'10',0,885,'bonus bInt,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18747,'Eyes_Of_Ifrit','Eyes Of Ifrit',5,20,NULL,100,NULL,1,NULL,1,0xFFFFFFFF,63,2,512,NULL,'0',0,886,'bonus bDex,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18747,'Eyes_Of_Ifrit','Eyes Of Ifrit',5,20,NULL,100,NULL,1,NULL,1,0xFFFFFFFF,63,2,512,NULL,'0',0,886,'bonus bDex,1;',NULL,NULL);
@@ -8567,6 +8573,9 @@ REPLACE INTO `item_db_re` VALUES (18756,'Black_Shiba_Inu_Hat','Black Shiba Inu H
 REPLACE INTO `item_db_re` VALUES (18758,'Hat_Of_Scrat','Hat Of Scrat',5,20,NULL,200,NULL,3,NULL,1,0xFFFFFFFF,63,2,256,NULL,'0',1,896,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18758,'Hat_Of_Scrat','Hat Of Scrat',5,20,NULL,200,NULL,3,NULL,1,0xFFFFFFFF,63,2,256,NULL,'0',1,896,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18759,'Stretched_Nose_M','Wood Goblin\'s Nose',5,20,NULL,200,NULL,0,NULL,0,0xFFFFFFFF,63,2,512,NULL,'50',0,737,'bonus bUnbreakableHelm,0;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18759,'Stretched_Nose_M','Wood Goblin\'s Nose',5,20,NULL,200,NULL,0,NULL,0,0xFFFFFFFF,63,2,512,NULL,'50',0,737,'bonus bUnbreakableHelm,0;',NULL,NULL);
 #
 #
+REPLACE INTO `item_db_re` VALUES (18766,'Improved_Helm_of_Angel','Improved Helm of Angel',5,10,NULL,1600,NULL,10,NULL,1,0x7CCFDF80,63,2,256,NULL,'99',1,NULL,'bonus bAgi,1; bonus bLuk,1; bonus bMDef,3; if (getrefine()>=7) { bonus bAgi,2; bonus bLuk,2; } if(getrefine()>=9) bonus bAspd,1;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (18767,'Improved_Helm_Of_Sun','Improved Hat of the Sun God',5,10,NULL,2400,NULL,4,NULL,1,0x7CCFDF80,63,2,768,NULL,'99',1,NULL,'bonus bStr,3; bonus bInt,2; bonus bAtk,10; bonus bMatk,10; if(getrefine()>=7){bonus bAtk,15;bonus bMatk,15;} if(getrefine()>=9){bonus bAtk,15;bonus bMatk,15;}',NULL,NULL);
+#
 REPLACE INTO `item_db_re` VALUES (18779,'RWC_Champ_Crown_First_Place','RWC Champ Crown First Place',5,20,NULL,500,NULL,12,NULL,NULL,0xFFFFFFFF,63,2,256,NULL,'1',NULL,902,'bonus2 bResEff,Eff_Stun,10000; bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,7; bonus bMdef,5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18779,'RWC_Champ_Crown_First_Place','RWC Champ Crown First Place',5,20,NULL,500,NULL,12,NULL,NULL,0xFFFFFFFF,63,2,256,NULL,'1',NULL,902,'bonus2 bResEff,Eff_Stun,10000; bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,7; bonus bMdef,5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18780,'RWC_Champ_Crown_Second_Place','RWC Champ Crown Second Place',5,20,NULL,500,NULL,12,NULL,NULL,0xFFFFFFFF,63,2,256,NULL,'1',NULL,903,'bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,7; bonus bMdef,5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18780,'RWC_Champ_Crown_Second_Place','RWC Champ Crown Second Place',5,20,NULL,500,NULL,12,NULL,NULL,0xFFFFFFFF,63,2,256,NULL,'1',NULL,903,'bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,7; bonus bMdef,5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18781,'RWC_Champ_Crown_Third_Place','RWC Champ Crown Third Place',5,20,NULL,500,NULL,12,NULL,NULL,0xFFFFFFFF,63,2,256,NULL,'1',NULL,904,'bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,3; bonus bMdef,1;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (18781,'RWC_Champ_Crown_Third_Place','RWC Champ Crown Third Place',5,20,NULL,500,NULL,12,NULL,NULL,0xFFFFFFFF,63,2,256,NULL,'1',NULL,904,'bonus2 bResEff,Eff_Curse,10000; bonus bUnbreakableHelm,0; bonus bAllStats,3; bonus bMdef,1;',NULL,NULL);
@@ -8688,10 +8697,11 @@ REPLACE INTO `item_db_re` VALUES (19656,'C_Wandering_Minstrel_Hat','Wandering Mi
 REPLACE INTO `item_db_re` VALUES (19707,'C_Polar_Bear_Cap','Costume Polar Bear Cap',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,966,'bonus bUnbreakableHelm,0;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19707,'C_Polar_Bear_Cap','Costume Polar Bear Cap',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,966,'bonus bUnbreakableHelm,0;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19730,'C_Snake_Hat','C Snake Hat',5,20,NULL,10,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,986,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19730,'C_Snake_Hat','C Snake Hat',5,20,NULL,10,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,986,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19746,'C_Executioner_Hood','Executioner Hood',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,2048,NULL,'0',0,0,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19746,'C_Executioner_Hood','Executioner Hood',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,2048,NULL,'0',0,0,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (19777,'C_Shiny_Small_Star','Shiny Small Star',5,20,NULL,10,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'1',0,0,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19829,'C_Straw_Hat','C Straw Hat',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,146,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19829,'C_Straw_Hat','C Straw Hat',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,146,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (19853,'C_Filir Wings','C Filir Wings',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,2048,NULL,'1',0,595,'for (set .@i,0; .@i <= 12; set .@i,.@i+1) { bonus2 bExpAddRace,.@i,5; }',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (19853,'C_Filir Wings','C Filir Wings',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,2048,NULL,'1',0,595,'bonus2 bExpAddRace,RC_Boss,5; bonus2 bExpAddRace,RC_NonBoss,5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19856,'Costume_Snow_Cone_Hat','Costume Snow Cone Hat',5,10,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'1',0,0,'bonus2 bAddEle,Ele_Fire,5; bonus2 bMagicAddEle,Ele_Fire,5; bonus2 bAddMonsterDropItem,11589,5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19856,'Costume_Snow_Cone_Hat','Costume Snow Cone Hat',5,10,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'1',0,0,'bonus2 bAddEle,Ele_Fire,5; bonus2 bMagicAddEle,Ele_Fire,5; bonus2 bAddMonsterDropItem,11589,5;',NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (19857,'Costume_Crayfish_Hat','Costume Crayfish Hat',5,10,NULL,10,NULL,0,NULL,NULL,0xFFFFFFFF,63,2,1024,NULL,'1',NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (19857,'Costume_Crayfish_Hat','Costume Crayfish Hat',5,10,NULL,10,NULL,0,NULL,NULL,0xFFFFFFFF,63,2,1024,NULL,'1',0,0,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19859,'C_Flying_Angel','Flying Angel',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,264,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19859,'C_Flying_Angel','Flying Angel',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,264,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19860,'C_School_Criatura_Hat','School Criatura Hat',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,0,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19860,'C_School_Criatura_Hat','School Criatura Hat',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,0,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19861,'C_Heart_Hairpin','Heart Hairpin',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,126,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (19861,'C_Heart_Hairpin','Heart Hairpin',5,20,NULL,0,NULL,0,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'0',0,126,NULL,NULL,NULL);
@@ -8724,6 +8734,7 @@ REPLACE INTO `item_db_re` VALUES (21004,'Alca_Bringer_','Alca Bringer',4,20,NULL
 REPLACE INTO `item_db_re` VALUES (21005,'Metal_Two_Hand_Sword','Metal Two Hand Sword',4,20,NULL,0,'95',NULL,1,1,0x00004082,63,2,34,3,'1',1,3,'bonus bBaseAtk,(getrefine()*6); bonus bMatk,(getrefine()*2); set .@i,((BaseLevel/10)>12)?12:(BaseLevel/10); if(.@i>2) bonus bBaseAtk,((.@i-2)*5);',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (21005,'Metal_Two_Hand_Sword','Metal Two Hand Sword',4,20,NULL,0,'95',NULL,1,1,0x00004082,63,2,34,3,'1',1,3,'bonus bBaseAtk,(getrefine()*6); bonus bMatk,(getrefine()*2); set .@i,((BaseLevel/10)>12)?12:(BaseLevel/10); if(.@i>2) bonus bBaseAtk,((.@i-2)*5);',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (21011,'Gigantic_Blade','Gigantic Blade',3,10,NULL,5000,'300',NULL,NULL,NULL,0xFFFFFFFF,56,2,2,4,'130',1,3,'bonus bUnbreakableWeapon,1; bonus bAspdRate,-5; if(readparam(bStr)<=110){ bonus bAtk,-250; }',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (21011,'Gigantic_Blade','Gigantic Blade',3,10,NULL,5000,'300',NULL,NULL,NULL,0xFFFFFFFF,56,2,2,4,'130',1,3,'bonus bUnbreakableWeapon,1; bonus bAspdRate,-5; if(readparam(bStr)<=110){ bonus bAtk,-250; }',NULL,NULL);
 # New Items
 # New Items
+REPLACE INTO `item_db_re` VALUES (22014,'Enhanced_Variant_Shoes','Enhanced Variant Shoes',3,10,NULL,500,NULL,13,NULL,1,0x7CCFDF80,63,2,64,NULL,'85',1,NULL,'bonus bMaxHPrate,12; bonus bMaxSPrate,12; bonus bDef,getrefine(); bonus bMdef,getrefine();',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22043,'AGI_Complement','AGI Complement',5,10,NULL,350,NULL,25,NULL,NULL,0x00000400,56,2,64,NULL,'100',1,NULL,'bonus bAspdRate,5+(getrefine()/4);',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22043,'AGI_Complement','AGI Complement',5,10,NULL,350,NULL,25,NULL,NULL,0x00000400,56,2,64,NULL,'100',1,NULL,'bonus bAspdRate,5+(getrefine()/4);',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22044,'Reinforced_Parts_Booster','Reinforced Parts - Booster',5,10,NULL,1000,NULL,23,NULL,NULL,0x00000400,56,2,64,NULL,'100',1,NULL,'bonus2 bSkillUseSP,"NC_HOVERING",15; if(getrefine()>=7){bonus2 bSkillUseSP,"NC_HOVERING",-20;}',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22044,'Reinforced_Parts_Booster','Reinforced Parts - Booster',5,10,NULL,1000,NULL,23,NULL,NULL,0x00000400,56,2,64,NULL,'100',1,NULL,'bonus2 bSkillUseSP,"NC_HOVERING",15; if(getrefine()>=7){bonus2 bSkillUseSP,"NC_HOVERING",-20;}',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22045,'Summer_Sandals','Summer Sandals',5,10,NULL,200,NULL,5,NULL,0,0xFFFFFFFF,63,2,64,NULL,'0',1,0,'bonus bFlee,5; bonus3 bAutoSpellWhenHit,"AL_INCAGI",10,50;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22045,'Summer_Sandals','Summer Sandals',5,10,NULL,200,NULL,5,NULL,0,0xFFFFFFFF,63,2,64,NULL,'0',1,0,'bonus bFlee,5; bonus3 bAutoSpellWhenHit,"AL_INCAGI",10,50;',NULL,NULL);
@@ -8746,6 +8757,8 @@ REPLACE INTO `item_db_re` VALUES (22621,'Barbecued_Squid','Barbecued Squid',3,10
 REPLACE INTO `item_db_re` VALUES (22648,'Angel_Ring_Package','Angel Ring Package',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22648,'Angel_Ring_Package','Angel Ring Package',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22649,'Devil_Ring_Package','Devil Ring Package',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22649,'Devil_Ring_Package','Devil Ring Package',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22652,'Briliant_Hat_Box','Brilliant Hat Box',2,10,NULL,200,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'/* TODO */',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22652,'Briliant_Hat_Box','Brilliant Hat Box',2,10,NULL,200,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'/* TODO */',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (22653,'Wet_Card_Album','Wet Card Album',2,10000,NULL,50,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'/* TODO */',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (22654,'Golden_Seal_Card','Golden Seal Card',3,20,NULL,50,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22675,'Mysterious_Scroll','Mysterious Scroll',2,20,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_INTFOOD,3600000,30;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22675,'Mysterious_Scroll','Mysterious Scroll',2,20,NULL,10,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_INTFOOD,3600000,30;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22676,'Hangul_Day_Event_Box','Hangul Day Event Box',2,20,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'0',NULL,NULL,'getitem 22675,10; getitem 607,9;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22676,'Hangul_Day_Event_Box','Hangul Day Event Box',2,20,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'0',NULL,NULL,'getitem 22675,10; getitem 607,9;',NULL,NULL);
 
 

+ 1 - 0
sql-files/mob_db_re.sql

@@ -2342,6 +2342,7 @@ REPLACE INTO `mob_db` VALUES (2476,'MG_AMDARAIS','Amdarias','Amdarias',143,32839
 #3154,RECON_ROBOT
 #3154,RECON_ROBOT
 #3155,REPAIR_ROBOT
 #3155,REPAIR_ROBOT
 #3156,EXPLORATION_ROVER
 #3156,EXPLORATION_ROVER
+#3166,M_E_DEVILING
 #
 #
 #3201,JT_LUCKYCASE
 #3201,JT_LUCKYCASE
 #3202,JT_ORGANIC_JAKK
 #3202,JT_ORGANIC_JAKK

+ 1 - 1
src/char/inter.c

@@ -37,7 +37,7 @@ Sql* sql_handle = NULL;
 int char_server_port = 3306;
 int char_server_port = 3306;
 char char_server_ip[32] = "127.0.0.1";
 char char_server_ip[32] = "127.0.0.1";
 char char_server_id[32] = "ragnarok";
 char char_server_id[32] = "ragnarok";
-char char_server_pw[32] = "ragnarok";
+char char_server_pw[32] = ""; // Allow user to send empty password (bugreport:7787)
 char char_server_db[32] = "ragnarok";
 char char_server_db[32] = "ragnarok";
 char default_codepage[32] = ""; //Feature by irmin.
 char default_codepage[32] = ""; //Feature by irmin.
 
 

+ 2 - 0
src/common/mmo.h

@@ -407,6 +407,8 @@ struct mmo_charstatus {
 
 
 	// Char server addon system
 	// Char server addon system
 	unsigned int character_moves;
 	unsigned int character_moves;
+
+	bool cashshop_sent; // Whether the player has received the CashShop list
 };
 };
 
 
 typedef enum mail_status {
 typedef enum mail_status {

+ 1 - 1
src/login/account_sql.c

@@ -23,7 +23,7 @@ typedef struct AccountDB_SQL
 	Sql* accounts;       // SQL accounts storage
 	Sql* accounts;       // SQL accounts storage
 
 
 	// global sql settings
 	// global sql settings
-	char   global_db_hostname[32];
+	char   global_db_hostname[64]; // Doubled for long hostnames (bugreport:8003)
 	uint16 global_db_port;
 	uint16 global_db_port;
 	char   global_db_username[32];
 	char   global_db_username[32];
 	char   global_db_password[32];
 	char   global_db_password[32];

+ 2 - 1
src/map/atcommand.c

@@ -2103,9 +2103,10 @@ ACMD_FUNC(refine)
 	refine = cap_value(refine, -MAX_REFINE, MAX_REFINE);
 	refine = cap_value(refine, -MAX_REFINE, MAX_REFINE);
 
 
 	count = 0;
 	count = 0;
-	for (j = 0; j < EQI_MAX-1; j++) {
+	for (j = 0; j < EQI_MAX; j++) {
 		if ((i = sd->equip_index[j]) < 0)
 		if ((i = sd->equip_index[j]) < 0)
 			continue;
 			continue;
+		if(j == EQI_AMMO) continue;
 		if(j == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == i)
 		if(j == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == i)
 			continue;
 			continue;
 		if(j == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == i)
 		if(j == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == i)

+ 31 - 10
src/map/battle.c

@@ -4477,11 +4477,20 @@ void battle_do_reflect(int attack_type, struct Damage *wd, struct block_list* sr
 		// Item reflect gets calculated first
 		// Item reflect gets calculated first
 		rdamage = battle_calc_return_damage(target, src, &damage, wd->flag, skill_id, 0);
 		rdamage = battle_calc_return_damage(target, src, &damage, wd->flag, skill_id, 0);
 		if( rdamage > 0 ) {
 		if( rdamage > 0 ) {
-			//Use Reflect Shield to signal this kind of skill trigger. [Skotlex]
-			rdelay = clif_damage(src, src, tick, wd->amotion, sstatus->dmotion, rdamage, 1, 4, 0);
+			bool isDevotRdamage = false;
+			//Get info if the attacker has Devotion from other player
+			struct status_change *ssc = NULL;
+			struct block_list *d_bl = NULL;
+			if (battle_config.devotion_rdamage && battle_config.devotion_rdamage > rand()%100) {
+				ssc = status_get_sc(src);;
+				if (ssc && ssc->data[SC_DEVOTION] && (d_bl = map_id2bl(ssc->data[SC_DEVOTION]->val1)))
+					isDevotRdamage = true;
+			}
+			rdelay = clif_damage(src, (!isDevotRdamage) ? src : d_bl, tick, wd->amotion, sstatus->dmotion, rdamage, 1, 4, 0);
 			if( tsd ) battle_drain(tsd, src, rdamage, rdamage, sstatus->race, is_boss(src));
 			if( tsd ) battle_drain(tsd, src, rdamage, rdamage, sstatus->race, is_boss(src));
-			battle_delay_damage(tick, wd->amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
-			skill_additional_effect(target, src, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick);
+			//Use Reflect Shield to signal this kind of skill trigger. [Skotlex]
+			battle_delay_damage(tick, wd->amotion,target,(!isDevotRdamage) ? src : d_bl,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
+			skill_additional_effect(target, (!isDevotRdamage) ? src : d_bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick);
 		}
 		}
 
 
 		// Calculate skill reflect damage separately
 		// Calculate skill reflect damage separately
@@ -4489,6 +4498,15 @@ void battle_do_reflect(int attack_type, struct Damage *wd, struct block_list* sr
 			struct status_data *tstatus = status_get_status_data(target);
 			struct status_data *tstatus = status_get_status_data(target);
 			rdamage = battle_calc_return_damage(target, src, &damage, wd->flag, skill_id, 1);
 			rdamage = battle_calc_return_damage(target, src, &damage, wd->flag, skill_id, 1);
 			if( rdamage > 0 ) {
 			if( rdamage > 0 ) {
+				bool isDevotRdamage = false;
+				//Get info if the attacker has Devotion from other player
+				struct status_change *ssc = NULL;
+				struct block_list *d_bl = NULL;
+				if (battle_config.devotion_rdamage && battle_config.devotion_rdamage > rand()%100) {
+					ssc = status_get_sc(src);;
+					if (ssc && ssc->data[SC_DEVOTION] && (d_bl = map_id2bl(ssc->data[SC_DEVOTION]->val1)))
+						isDevotRdamage = true;
+				}
 				//if(tsc->data[SC__SHADOWFORM]) {
 				//if(tsc->data[SC__SHADOWFORM]) {
 				//	struct block_list *s_bl = map_id2bl(tsc->data[SC__SHADOWFORM]->val2);
 				//	struct block_list *s_bl = map_id2bl(tsc->data[SC__SHADOWFORM]->val2);
 				//	if(s_bl)
 				//	if(s_bl)
@@ -4500,11 +4518,11 @@ void battle_do_reflect(int attack_type, struct Damage *wd, struct block_list* sr
 				if(attack_type == BF_WEAPON && tsc->data[SC_REFLECTDAMAGE] ) // Don't reflect your own damage (Grand Cross)
 				if(attack_type == BF_WEAPON && tsc->data[SC_REFLECTDAMAGE] ) // Don't reflect your own damage (Grand Cross)
 					map_foreachinshootrange(battle_damage_area,target,skill_get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,wd->amotion,sstatus->dmotion,rdamage,tstatus->race);
 					map_foreachinshootrange(battle_damage_area,target,skill_get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,wd->amotion,sstatus->dmotion,rdamage,tstatus->race);
 				else if(attack_type == BF_WEAPON || attack_type == BF_MISC) {
 				else if(attack_type == BF_WEAPON || attack_type == BF_MISC) {
-					rdelay = clif_damage(src, src, tick, wd->amotion, sstatus->dmotion, rdamage, 1, 4, 0);
+					rdelay = clif_damage(src, (!isDevotRdamage) ? src : d_bl, tick, wd->amotion, sstatus->dmotion, rdamage, 1, 4, 0);
 					if( tsd ) battle_drain(tsd, src, rdamage, rdamage, sstatus->race, is_boss(src));
 					if( tsd ) battle_drain(tsd, src, rdamage, rdamage, sstatus->race, is_boss(src));
 					// It appears that official servers give skill reflect damage a longer delay
 					// It appears that official servers give skill reflect damage a longer delay
-					battle_delay_damage(tick, wd->amotion,target,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
-					skill_additional_effect(target, src, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick);
+					battle_delay_damage(tick, wd->amotion,target,(!isDevotRdamage) ? src : d_bl,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,rdelay,true);
+					skill_additional_effect(target, (!isDevotRdamage) ? src : d_bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick);
 				}
 				}
 			}
 			}
 		}
 		}
@@ -4694,7 +4712,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src, struct bl
 			case KO_HAPPOKUNAI:
 			case KO_HAPPOKUNAI:
 				break;
 				break;
 			default:
 			default:
-				wd.damage += battle_calc_cardfix(BF_WEAPON, src, target, battle_skill_get_damage_properties(skill_id, wd.miscflag), right_element, left_element, wd.damage, is_attack_left_handed(src, skill_id), wd.flag);
+				wd.damage += battle_calc_cardfix(BF_WEAPON, src, target, battle_skill_get_damage_properties(skill_id, wd.miscflag), right_element, left_element, wd.damage, 0, wd.flag);
+				if(is_attack_left_handed(src, skill_id))
+					wd.damage2 += battle_calc_cardfix(BF_WEAPON, src, target, battle_skill_get_damage_properties(skill_id, wd.miscflag), right_element, left_element, wd.damage2, 1, wd.flag);
 				break;
 				break;
 		}
 		}
 	}
 	}
@@ -5551,8 +5571,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
 		md.damage=3;
 		md.damage=3;
 		break;
 		break;
 	case NPC_DARKBREATH:
 	case NPC_DARKBREATH:
-		md.damage = 500 + (skill_lv-1)*1000 + rnd()%1000;
-		if(md.damage > 9999) md.damage = 9999;
+		md.damage = tstatus->max_hp * (skill_lv * 10) / 100;
 		break;
 		break;
 	case PA_PRESSURE:
 	case PA_PRESSURE:
 		md.damage=500+300*skill_lv;
 		md.damage=500+300*skill_lv;
@@ -7262,6 +7281,8 @@ static const struct _battle_data {
 	{ "emblem_woe_change",                  &battle_config.emblem_woe_change,               0,      0,      1,              },
 	{ "emblem_woe_change",                  &battle_config.emblem_woe_change,               0,      0,      1,              },
 	{ "emblem_transparency_limit",          &battle_config.emblem_transparency_limit,      80,      0,      100,            },
 	{ "emblem_transparency_limit",          &battle_config.emblem_transparency_limit,      80,      0,      100,            },
 	{ "discount_item_point_shop",			&battle_config.discount_item_point_shop,		0,		0,		3,				},
 	{ "discount_item_point_shop",			&battle_config.discount_item_point_shop,		0,		0,		3,				},
+	{ "update_enemy_position",				&battle_config.update_enemy_position,			0,		0,		1,				},
+	{ "devotion_rdamage",					&battle_config.devotion_rdamage,				0,		0,		100,			},
 };
 };
 #ifndef STATS_OPT_OUT
 #ifndef STATS_OPT_OUT
 /**
 /**

+ 2 - 0
src/map/battle.h

@@ -513,6 +513,8 @@ extern struct Battle_Config
 	int emblem_woe_change;
 	int emblem_woe_change;
 	int emblem_transparency_limit;
 	int emblem_transparency_limit;
 	int discount_item_point_shop;
 	int discount_item_point_shop;
+	int update_enemy_position;
+	int devotion_rdamage;
 } battle_config;
 } battle_config;
 
 
 void do_init_battle(void);
 void do_init_battle(void);

+ 11 - 4
src/map/chat.c

@@ -167,7 +167,10 @@ int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
 
 
 
 
 /*==========================================
 /*==========================================
- * leave a chatroom
+ * Make player *sd leave a chatroom
+ * @param *sd : player pointer
+ * @param kicked : for clif notification, kicked=1 or regular leave
+ * @return 0:sucess, 1:failed
  *------------------------------------------*/
  *------------------------------------------*/
 int chat_leavechat(struct map_session_data* sd, bool kicked)
 int chat_leavechat(struct map_session_data* sd, bool kicked)
 {
 {
@@ -229,8 +232,8 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
 		map_delblock( &cd->bl );
 		map_delblock( &cd->bl );
 		cd->bl.x=cd->usersd[0]->bl.x;
 		cd->bl.x=cd->usersd[0]->bl.x;
 		cd->bl.y=cd->usersd[0]->bl.y;
 		cd->bl.y=cd->usersd[0]->bl.y;
-		map_addblock( &cd->bl );
-
+		if(map_addblock( &cd->bl ))
+			return 1;
 		clif_dispchat(cd,0);
 		clif_dispchat(cd,0);
 	}
 	}
 	else
 	else
@@ -241,6 +244,9 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
 
 
 /*==========================================
 /*==========================================
  * change a chatroom's owner
  * change a chatroom's owner
+ * @param *sd : player pointer
+ * @param *nextownername : string of new owner (name should be in chatroom)
+ * @return 0:sucess, 1:failure
  *------------------------------------------*/
  *------------------------------------------*/
 int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
 int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
 {
 {
@@ -274,7 +280,8 @@ int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
 	map_delblock( &cd->bl );
 	map_delblock( &cd->bl );
 	cd->bl.x = cd->owner->x;
 	cd->bl.x = cd->owner->x;
 	cd->bl.y = cd->owner->y;
 	cd->bl.y = cd->owner->y;
-	map_addblock( &cd->bl );
+	if(map_addblock( &cd->bl ))
+		return 1;
 
 
 	// and display again
 	// and display again
 	clif_dispchat(cd,0);
 	clif_dispchat(cd,0);

+ 55 - 23
src/map/clif.c

@@ -326,7 +326,8 @@ static int clif_send_sub(struct block_list *bl, va_list ap)
 		return 0;
 		return 0;
 
 
 	/* unless visible, hold it here */
 	/* unless visible, hold it here */
-	if (clif_ally_only && !sd->special_state.intravision && battle_check_target(src_bl,&sd->bl,BCT_ENEMY) > 0)
+	if (!battle_config.update_enemy_position && clif_ally_only && !sd->special_state.intravision &&
+		!sd->sc.data[SC_INTRAVISION] && battle_check_target(src_bl,&sd->bl,BCT_ENEMY) > 0)
 		return 0;
 		return 0;
 
 
 	WFIFOHEAD(fd, len);
 	WFIFOHEAD(fd, len);
@@ -1918,6 +1919,22 @@ void clif_scriptclose(struct map_session_data *sd, int npcid)
 	WFIFOSET(fd,packet_len(0xb6));
 	WFIFOSET(fd,packet_len(0xb6));
 }
 }
 
 
+/// [Ind/Hercules]
+/// Close script when player is idle
+/// 08d6 <npc id>.L
+void clif_scriptclear(struct map_session_data *sd, int npcid)
+{
+	int fd;
+
+	nullpo_retv(sd);
+
+	fd=sd->fd;
+	WFIFOHEAD(fd, packet_len(0x8d6));
+	WFIFOW(fd,0)=0x8d6;
+	WFIFOL(fd,2)=npcid;
+	WFIFOSET(fd,packet_len(0x8d6));
+ }
+ 
 /*==========================================
 /*==========================================
  *
  *
  *------------------------------------------*/
  *------------------------------------------*/
@@ -2485,10 +2502,12 @@ void clif_equiplist(struct map_session_data *sd)
 
 
 void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length)
 void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length)
 {
 {
+	static const int client_buf = 0x5000; // Max buffer to send
 	struct item_data *id;
 	struct item_data *id;
-	int i,n,ne;
+	int i,n,ne,nn;
 	unsigned char *buf;
 	unsigned char *buf;
 	unsigned char *bufe;
 	unsigned char *bufe;
+	unsigned char *bufn;
 #if PACKETVER < 5
 #if PACKETVER < 5
 	const int s = 10; //Entry size.normal item
 	const int s = 10; //Entry size.normal item
 	const int sidx=4; //start itemlist idx
 	const int sidx=4; //start itemlist idx
@@ -2533,33 +2552,39 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items
 			n++;
 			n++;
 		}
 		}
 	}
 	}
-	if( n )
+	for (i = 0; i < n;) // Loop through non-equipable items
 	{
 	{
+		nn = n - i < (client_buf - 4)/s ? n - i : (client_buf - 4)/s; // Split up non-equipable items 
+		bufn = buf + i*s; // Update buffer to new index range
+		i += nn;
 #if PACKETVER < 5
 #if PACKETVER < 5
-		WBUFW(buf,0)=0xa5;
+		WBUFW(bufn,0)=0xa5;
 #elif PACKETVER < 20080102
 #elif PACKETVER < 20080102
-		WBUFW(buf,0)=0x1f0;
+		WBUFW(bufn,0)=0x1f0;
 #elif PACKETVER < 20120925
 #elif PACKETVER < 20120925
-		WBUFW(buf,0)=0x2ea;
+		WBUFW(bufn,0)=0x2ea;
 #else
 #else
-		WBUFW(buf,0)=0x995;
+		WBUFW(bufn,0)=0x995;
 		memset((char*)WBUFP(buf,4),0,24); //storename
 		memset((char*)WBUFP(buf,4),0,24); //storename
 #endif
 #endif
-		WBUFW(buf,2)=n*s+sidx;
-		clif_send(buf, WBUFW(buf,2), &sd->bl, SELF);
+		WBUFW(bufn,2)=sidx+nn*s;
+		clif_send(bufn, WBUFW(bufn,2), &sd->bl, SELF);
 	}
 	}
-	if( ne )
+	for (i = 0; i < ne;) // Loop through equipable items
 	{
 	{
+		nn = ne - i < (client_buf - 4)/se ? ne - i : (client_buf - 4)/se; // Split up equipable items
+		bufn = bufe + i*se; // Update buffer to new index range
+		i += nn;
 #if PACKETVER < 20071002
 #if PACKETVER < 20071002
-		WBUFW(bufe,0)=0xa6;
+		WBUFW(bufn,0)=0xa6;
 #elif PACKETVER < 20120925
 #elif PACKETVER < 20120925
-		WBUFW(bufe,0)=0x2d1;
+		WBUFW(bufn,0)=0x2d1;
 #else
 #else
-		WBUFW(bufe,0)=0x996;
-		memset((char*)WBUFP(bufe,4),0,24); //storename
+		WBUFW(bufn,0)=0x996;
+		memset((char*)WBUFP(bufn,4),0,24); //storename
 #endif
 #endif
-		WBUFW(bufe,2)=ne*se+sidxe;
-		clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);
+		WBUFW(bufn,2)=sidxe+nn*se;
+		clif_send(bufn, WBUFW(bufn,2), &sd->bl, SELF);
 	}
 	}
 
 
 	if( buf ) aFree(buf);
 	if( buf ) aFree(buf);
@@ -9457,7 +9482,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 	// reset the callshop flag if the player changes map
 	// reset the callshop flag if the player changes map
 	sd->state.callshop = 0;
 	sd->state.callshop = 0;
 
 
-	map_addblock(&sd->bl);
+	if(map_addblock(&sd->bl))
+		return;
 	clif_spawn(&sd->bl);
 	clif_spawn(&sd->bl);
 
 
 	// Party
 	// Party
@@ -9499,7 +9525,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 			clif_displaymessage(sd->fd, msg_txt(sd,666));
 			clif_displaymessage(sd->fd, msg_txt(sd,666));
 			pet_menu(sd, 3); //Option 3 is return to egg.
 			pet_menu(sd, 3); //Option 3 is return to egg.
 		} else {
 		} else {
-			map_addblock(&sd->pd->bl);
+			if(map_addblock(&sd->pd->bl))
+				return;
 			clif_spawn(&sd->pd->bl);
 			clif_spawn(&sd->pd->bl);
 			clif_send_petdata(sd,sd->pd,0,0);
 			clif_send_petdata(sd,sd->pd,0,0);
 			clif_send_petstatus(sd);
 			clif_send_petstatus(sd);
@@ -9509,7 +9536,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 
 
 	//homunculus [blackhole89]
 	//homunculus [blackhole89]
 	if( merc_is_hom_active(sd->hd) ) {
 	if( merc_is_hom_active(sd->hd) ) {
-		map_addblock(&sd->hd->bl);
+		if(map_addblock(&sd->hd->bl))
+			return;
 		clif_spawn(&sd->hd->bl);
 		clif_spawn(&sd->hd->bl);
 		clif_send_homdata(sd,SP_ACK,0);
 		clif_send_homdata(sd,SP_ACK,0);
 		clif_hominfo(sd,sd->hd,1);
 		clif_hominfo(sd,sd->hd,1);
@@ -9522,7 +9550,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 	}
 	}
 
 
 	if( sd->md ) {
 	if( sd->md ) {
-		map_addblock(&sd->md->bl);
+		if(map_addblock(&sd->md->bl))
+			return;
 		clif_spawn(&sd->md->bl);
 		clif_spawn(&sd->md->bl);
 		clif_mercenary_info(sd);
 		clif_mercenary_info(sd);
 		clif_mercenary_skillblock(sd);
 		clif_mercenary_skillblock(sd);
@@ -14801,7 +14830,7 @@ void clif_cashshop_list( int fd ){
 	int tab;
 	int tab;
 
 
 	for( tab = CASHSHOP_TAB_NEW; tab < CASHSHOP_TAB_SEARCH; tab++ ){
 	for( tab = CASHSHOP_TAB_NEW; tab < CASHSHOP_TAB_SEARCH; tab++ ){
-		int length = 8 + cash_shop_items->count * 6;
+		int length = 8 + cash_shop_items[tab].count * 6;
 		int i, offset;
 		int i, offset;
 
 
 		WFIFOHEAD( fd, length );
 		WFIFOHEAD( fd, length );
@@ -14820,7 +14849,10 @@ void clif_cashshop_list( int fd ){
 }
 }
 
 
 void clif_parse_cashshop_list_request( int fd, struct map_session_data* sd ){
 void clif_parse_cashshop_list_request( int fd, struct map_session_data* sd ){
-	clif_cashshop_list( fd );
+	if( !sd->status.cashshop_sent ) {
+		clif_cashshop_list( fd );
+		sd->status.cashshop_sent = true;
+	}
 }
 }
 /// List of items offered in a cash shop (ZC_PC_CASH_POINT_ITEMLIST).
 /// List of items offered in a cash shop (ZC_PC_CASH_POINT_ITEMLIST).
 /// 0287 <packet len>.W <cash point>.L { <sell price>.L <discount price>.L <item type>.B <name id>.W }*
 /// 0287 <packet len>.W <cash point>.L { <sell price>.L <discount price>.L <item type>.B <name id>.W }*
@@ -17529,7 +17561,7 @@ void packetdb_readdb(void)
 		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 	//#0x08C0
 	//#0x08C0
 		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,
 		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,
-		9,  7, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+		9,  7, 10,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 	//#0x0900
 	//#0x0900

+ 1 - 0
src/map/clif.h

@@ -392,6 +392,7 @@ void clif_selllist(struct map_session_data *sd);	//self
 void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes);	//self
 void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes);	//self
 void clif_scriptnext(struct map_session_data *sd,int npcid);	//self
 void clif_scriptnext(struct map_session_data *sd,int npcid);	//self
 void clif_scriptclose(struct map_session_data *sd, int npcid);	//self
 void clif_scriptclose(struct map_session_data *sd, int npcid);	//self
+void clif_scriptclear(struct map_session_data *sd, int npcid);	//self
 void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes);	//self
 void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes);	//self
 void clif_scriptinput(struct map_session_data *sd, int npcid);	//self
 void clif_scriptinput(struct map_session_data *sd, int npcid);	//self
 void clif_scriptinputstr(struct map_session_data *sd, int npcid);	// self
 void clif_scriptinputstr(struct map_session_data *sd, int npcid);	// self

+ 8 - 1
src/map/elemental.c

@@ -222,6 +222,12 @@ void elemental_summon_init(struct elemental_data *ed) {
 	ed->regen.state.block = 0;
 	ed->regen.state.block = 0;
 }
 }
 
 
+/**
+ * Inter-serv has sent us the elemental data from sql, fill it in map-serv memory
+ * @param ele : The elemental data received from char-serv
+ * @param flag : 0:not created, 1:was saved/loaded
+ * @return 0:failed, 1:sucess
+ */
 int elemental_data_received(struct s_elemental *ele, bool flag) {
 int elemental_data_received(struct s_elemental *ele, bool flag) {
 	struct map_session_data *sd;
 	struct map_session_data *sd;
 	struct elemental_data *ed;
 	struct elemental_data *ed;
@@ -271,7 +277,8 @@ int elemental_data_received(struct s_elemental *ele, bool flag) {
 	sd->status.ele_id = ele->elemental_id;
 	sd->status.ele_id = ele->elemental_id;
 
 
 	if( ed->bl.prev == NULL && sd->bl.prev != NULL ) {
 	if( ed->bl.prev == NULL && sd->bl.prev != NULL ) {
-		map_addblock(&ed->bl);
+		if(map_addblock(&ed->bl))
+			return 0;
 		clif_spawn(&ed->bl);
 		clif_spawn(&ed->bl);
 		clif_elemental_info(sd);
 		clif_elemental_info(sd);
 		clif_elemental_updatestatus(sd,SP_HP);
 		clif_elemental_updatestatus(sd,SP_HP);

+ 43 - 9
src/map/homunculus.c

@@ -406,6 +406,11 @@ int merc_hom_change_class(struct homun_data *hd, short class_)
 	return 1;
 	return 1;
 }
 }
 
 
+/**
+ * Make an homonculus evolve, (changing in evolution class and apply bonus)
+ * @param hd : homonculus datas
+ * @return 0:failure, 1:success
+ */
 int merc_hom_evolution(struct homun_data *hd)
 int merc_hom_evolution(struct homun_data *hd)
 {
 {
 	struct s_homunculus *hom;
 	struct s_homunculus *hom;
@@ -442,7 +447,8 @@ int merc_hom_evolution(struct homun_data *hd)
 	hom->intimacy = 500;
 	hom->intimacy = 500;
 
 
 	unit_remove_map(&hd->bl, CLR_OUTSIGHT);
 	unit_remove_map(&hd->bl, CLR_OUTSIGHT);
-	map_addblock(&hd->bl);
+	if(map_addblock(&hd->bl))
+		return 0;
 
 
 	clif_spawn(&hd->bl);
 	clif_spawn(&hd->bl);
 	clif_emotion(&sd->bl, E_NO1);
 	clif_emotion(&sd->bl, E_NO1);
@@ -459,6 +465,12 @@ int merc_hom_evolution(struct homun_data *hd)
 	return 1 ;
 	return 1 ;
 }
 }
 
 
+/**
+ * Make an homonculus mutate in renewal homon
+ * @param hd : homonculus datas
+ * @param homun_id : id to make it transform into (must be a valid homon class)
+ * @return 0:failure, 1:sucess
+ */
 int hom_mutate(struct homun_data *hd, int homun_id)
 int hom_mutate(struct homun_data *hd, int homun_id)
 {
 {
 	struct s_homunculus *hom;
 	struct s_homunculus *hom;
@@ -486,7 +498,8 @@ int hom_mutate(struct homun_data *hd, int homun_id)
 	}
 	}
 
 
 	unit_remove_map(&hd->bl, CLR_OUTSIGHT);
 	unit_remove_map(&hd->bl, CLR_OUTSIGHT);
-	map_addblock(&hd->bl);
+	if(map_addblock(&hd->bl))
+		return 0;
 
 
 	clif_spawn(&hd->bl);
 	clif_spawn(&hd->bl);
 	clif_emotion(&sd->bl, E_NO1);
 	clif_emotion(&sd->bl, E_NO1);
@@ -827,6 +840,11 @@ void merc_hom_init_timers(struct homun_data * hd)
 	hd->masterteleport_timer = INVALID_TIMER;
 	hd->masterteleport_timer = INVALID_TIMER;
 }
 }
 
 
+/**
+ * Make a player spawn a homonculus (call)
+ * @param sd
+ * @return 0:failure, 1:sucess
+ */
 int merc_call_homunculus(struct map_session_data *sd)
 int merc_call_homunculus(struct map_session_data *sd)
 {
 {
 	struct homun_data *hd;
 	struct homun_data *hd;
@@ -853,7 +871,8 @@ int merc_call_homunculus(struct map_session_data *sd)
 		hd->bl.x = sd->bl.x;
 		hd->bl.x = sd->bl.x;
 		hd->bl.y = sd->bl.y;
 		hd->bl.y = sd->bl.y;
 		hd->bl.m = sd->bl.m;
 		hd->bl.m = sd->bl.m;
-		map_addblock(&hd->bl);
+		if(map_addblock(&hd->bl))
+			return 0;
 		clif_spawn(&hd->bl);
 		clif_spawn(&hd->bl);
 		clif_send_homdata(sd,SP_ACK,0);
 		clif_send_homdata(sd,SP_ACK,0);
 		clif_hominfo(sd,hd,1);
 		clif_hominfo(sd,hd,1);
@@ -868,7 +887,13 @@ int merc_call_homunculus(struct map_session_data *sd)
 	return 1;
 	return 1;
 }
 }
 
 
-// Recv homunculus data from char server
+/**
+ * Receive homunculus data from char server
+ * @param account_id : owner account_id of the homon 
+ * @param sh : homonculus data from char-serv
+ * @param flag : does the creation in inter-serv was a success (0:no,1:yes)
+ * @return 0:failure, 1:sucess
+ */
 int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag)
 int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag)
 {
 {
 	struct map_session_data *sd;
 	struct map_session_data *sd;
@@ -899,7 +924,8 @@ int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag)
 	hd = sd->hd;
 	hd = sd->hd;
 	if(hd && hd->homunculus.hp && !hd->homunculus.vaporize && hd->bl.prev == NULL && sd->bl.prev != NULL)
 	if(hd && hd->homunculus.hp && !hd->homunculus.vaporize && hd->bl.prev == NULL && sd->bl.prev != NULL)
 	{
 	{
-		map_addblock(&hd->bl);
+		if(map_addblock(&hd->bl))
+			return 0;
 		clif_spawn(&hd->bl);
 		clif_spawn(&hd->bl);
 		clif_send_homdata(sd,SP_ACK,0);
 		clif_send_homdata(sd,SP_ACK,0);
 		clif_hominfo(sd,hd,1);
 		clif_hominfo(sd,hd,1);
@@ -947,6 +973,14 @@ int merc_create_homunculus_request(struct map_session_data *sd, int class_)
 	return 1;
 	return 1;
 }
 }
 
 
+/**
+ * Make a player resurect an homon (player must have one)
+ * @param sd : player pointer
+ * @param per : hp percentage to revive homon
+ * @param x : x map coordinate
+ * @param y : Y map coordinate
+ * @return 0:failure, 1:success
+ */
 int merc_resurrect_homunculus(struct map_session_data* sd, unsigned char per, short x, short y)
 int merc_resurrect_homunculus(struct map_session_data* sd, unsigned char per, short x, short y)
 {
 {
 	struct homun_data* hd;
 	struct homun_data* hd;
@@ -960,7 +994,7 @@ int merc_resurrect_homunculus(struct map_session_data* sd, unsigned char per, sh
 
 
 	hd = sd->hd;
 	hd = sd->hd;
 
 
-  	if (hd->homunculus.vaporize == HOM_ST_REST)
+	if (hd->homunculus.vaporize == HOM_ST_REST)
 		return 0; // vaporized homunculi need to be 'called'
 		return 0; // vaporized homunculi need to be 'called'
 
 
 	if (!status_isdead(&hd->bl))
 	if (!status_isdead(&hd->bl))
@@ -973,11 +1007,11 @@ int merc_resurrect_homunculus(struct map_session_data* sd, unsigned char per, sh
 		hd->bl.m = sd->bl.m;
 		hd->bl.m = sd->bl.m;
 		hd->bl.x = x;
 		hd->bl.x = x;
 		hd->bl.y = y;
 		hd->bl.y = y;
-		map_addblock(&hd->bl);
+		if(map_addblock(&hd->bl))
+			return 0;
 		clif_spawn(&hd->bl);
 		clif_spawn(&hd->bl);
 	}
 	}
-	status_revive(&hd->bl, per, 0);
-	return 1;
+	return status_revive(&hd->bl, per, 0);
 }
 }
 
 
 void merc_hom_revive(struct homun_data *hd, unsigned int hp, unsigned int sp)
 void merc_hom_revive(struct homun_data *hd, unsigned int hp, unsigned int sp)

+ 27 - 13
src/map/map.c

@@ -328,7 +328,7 @@ int map_delblock(struct block_list* bl)
 	int pos;
 	int pos;
 	nullpo_ret(bl);
 	nullpo_ret(bl);
 
 
-    // blocklist (2ways chainlist)
+	// blocklist (2ways chainlist)
 	if (bl->prev == NULL) {
 	if (bl->prev == NULL) {
 		if (bl->next != NULL) {
 		if (bl->next != NULL) {
 			// can't delete block (already at the begining of the chain)
 			// can't delete block (already at the begining of the chain)
@@ -361,11 +361,16 @@ int map_delblock(struct block_list* bl)
 	return 0;
 	return 0;
 }
 }
 
 
-/*==========================================
+/**
  * Moves a block a x/y target position. [Skotlex]
  * Moves a block a x/y target position. [Skotlex]
  * Pass flag as 1 to prevent doing skill_unit_move checks
  * Pass flag as 1 to prevent doing skill_unit_move checks
  * (which are executed by default on BL_CHAR types)
  * (which are executed by default on BL_CHAR types)
- *------------------------------------------*/
+ * @param bl : block(object) to move
+ * @param x1 : new x position
+ * @param y1 : new y position
+ * @param tick : when this was scheduled
+ * @return 0:sucess, 1:fail
+ */
 int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
 int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
 {
 {
 	int x0 = bl->x, y0 = bl->y;
 	int x0 = bl->x, y0 = bl->y;
@@ -404,7 +409,10 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
 #endif
 #endif
 	bl->x = x1;
 	bl->x = x1;
 	bl->y = y1;
 	bl->y = y1;
-	if (moveblock) map_addblock(bl);
+	if (moveblock) {
+		if(map_addblock(bl))
+			return 1;
+	}
 #ifdef CELL_NOSTACK
 #ifdef CELL_NOSTACK
 	else map_addblcell(bl);
 	else map_addblcell(bl);
 #endif
 #endif
@@ -677,7 +685,7 @@ int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0
 	int blockcount = bl_list_count, i;
 	int blockcount = bl_list_count, i;
 	va_list ap;
 	va_list ap;
 
 
-	if ( m < 0 )
+	if ( m < 0 || m >= map_num)
 		return 0;
 		return 0;
 
 
 	if ( x1 < x0 )
 	if ( x1 < x0 )
@@ -1417,13 +1425,18 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1
 }
 }
 
 
 /*==========================================
 /*==========================================
- * Add an item to location (m,x,y)
- * Parameters
- * @item_data item attributes
- * @amount quantity
- * @m, @x, @y mapid,x,y
- * @first_charid, @second_charid, @third_charid, looting priority
- * @flag: &1 MVP item. &2 do stacking check. &4 bypass droppable check.
+ * Add an item in floor to location (m,x,y) and add restriction for those who could pickup later
+ * NB : If charids are null their no restriction for pickup
+ * @param item_data : item attributes
+ * @param amount : items quantity
+ * @param m : mapid
+ * @param x : x coordinates
+ * @param y : y coordinates
+ * @param first_charid : 1st player that could loot the item (only charid that could loot for first_get_tick duration)
+ * @param second_charid :  2nd player that could loot the item (2nd charid that could loot for second_get_charid duration)
+ * @param third_charid : 3rd player that could loot the item (3rd charid that could loot for third_get_charid duration)
+ * @param flag: &1 MVP item. &2 do stacking check. &4 bypass droppable check.
+ * @return 0:failure, x:item_gid [MIN_FLOORITEM;MAX_FLOORITEM]==[2;START_ACCOUNT_NUM]
  *------------------------------------------*/
  *------------------------------------------*/
 int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags)
 int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags)
 {
 {
@@ -1465,7 +1478,8 @@ int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,i
 	fitem->cleartimer=add_timer(gettick()+battle_config.flooritem_lifetime,map_clearflooritem_timer,fitem->bl.id,0);
 	fitem->cleartimer=add_timer(gettick()+battle_config.flooritem_lifetime,map_clearflooritem_timer,fitem->bl.id,0);
 
 
 	map_addiddb(&fitem->bl);
 	map_addiddb(&fitem->bl);
-	map_addblock(&fitem->bl);
+	if(map_addblock(&fitem->bl))
+		return 0;
 	clif_dropflooritem(fitem);
 	clif_dropflooritem(fitem);
 
 
 	return fitem->bl.id;
 	return fitem->bl.id;

+ 8 - 1
src/map/mercenary.c

@@ -280,6 +280,12 @@ void merc_contract_init(struct mercenary_data *md)
 	md->regen.state.block = 0;
 	md->regen.state.block = 0;
 }
 }
 
 
+/**
+ * Received mercenary data from char-serv
+ * @param merc : mercenary datas
+ * @param flag : if inter-serv request was sucessfull
+ * @return 0:failure, 1:sucess
+ */
 int merc_data_received(struct s_mercenary *merc, bool flag)
 int merc_data_received(struct s_mercenary *merc, bool flag)
 {
 {
 	struct map_session_data *sd;
 	struct map_session_data *sd;
@@ -336,7 +342,8 @@ int merc_data_received(struct s_mercenary *merc, bool flag)
 
 
 	if( md && md->bl.prev == NULL && sd->bl.prev != NULL )
 	if( md && md->bl.prev == NULL && sd->bl.prev != NULL )
 	{
 	{
-		map_addblock(&md->bl);
+		if(map_addblock(&md->bl))
+			return 0;
 		clif_spawn(&md->bl);
 		clif_spawn(&md->bl);
 		clif_mercenary_info(sd);
 		clif_mercenary_info(sd);
 		clif_mercenary_skillblock(sd);
 		clif_mercenary_skillblock(sd);

+ 26 - 11
src/map/mob.c

@@ -122,9 +122,13 @@ static int mobdb_searchname_array_sub(struct mob_db* mob, const char *str)
 	return strcmpi(mob->jname,str);
 	return strcmpi(mob->jname,str);
 }
 }
 
 
-/*==========================================
- *              MvP Tomb [GreenBox]
- *------------------------------------------*/
+/**
+ * Create and display a tombstone on the map
+ * @author [GreenBox]
+ * @param md : the mob to create a tombstone for
+ * @param killer : name of who has killed the mob
+ * @param time : time at wich the killed happen
+ */
 void mvptomb_create(struct mob_data *md, char *killer, time_t time)
 void mvptomb_create(struct mob_data *md, char *killer, time_t time)
 {
 {
 	struct npc_data *nd;
 	struct npc_data *nd;
@@ -157,7 +161,8 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
 		nd->u.tomb.killer_name[0] = '\0';
 		nd->u.tomb.killer_name[0] = '\0';
 
 
 	map_addnpc(nd->bl.m, nd);
 	map_addnpc(nd->bl.m, nd);
-	map_addblock(&nd->bl);
+	if(map_addblock(&nd->bl))
+		return;
 	status_set_viewdata(&nd->bl, nd->class_);
 	status_set_viewdata(&nd->bl, nd->class_);
 	status_change_init(&nd->bl);
 	status_change_init(&nd->bl);
 	unit_dataset(&nd->bl);
 	unit_dataset(&nd->bl);
@@ -894,9 +899,11 @@ int mob_count_sub(struct block_list *bl, va_list ap) {
     return 1; //backward compatibility
     return 1; //backward compatibility
 }
 }
 
 
-/*==========================================
- * Mob spawning. Initialization is also variously here.
- *------------------------------------------*/
+/**
+ * Mob spawning. Initialization is also variously here. (Spawn a mob in a map)
+ * @param md : mob data to spawn
+ * @return 0:spawned, 1:delayed, 2:error
+ */
 int mob_spawn (struct mob_data *md)
 int mob_spawn (struct mob_data *md)
 {
 {
 	int i=0;
 	int i=0;
@@ -981,7 +988,8 @@ int mob_spawn (struct mob_data *md)
 	if ( md->tomb_nid )
 	if ( md->tomb_nid )
 		mvptomb_destroy(md);
 		mvptomb_destroy(md);
 
 
-	map_addblock(&md->bl);
+	if(map_addblock(&md->bl))
+		return 2;
 	if( map[md->bl.m].users )
 	if( map[md->bl.m].users )
 		clif_spawn(&md->bl);
 		clif_spawn(&md->bl);
 	skill_unit_move(&md->bl,tick,1);
 	skill_unit_move(&md->bl,tick,1);
@@ -2598,7 +2606,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 			else if( sd->avail_quests )
 			else if( sd->avail_quests )
 				quest_update_objective(sd, md->class_);
 				quest_update_objective(sd, md->class_);
 
 
-			if( sd->md && src && src->type != BL_HOM && mob_db(md->class_)->lv > sd->status.base_level/2 )
+			if( sd->md && src && src->type == BL_MER && mob_db(md->class_)->lv > sd->status.base_level/2 )
 				mercenary_kills(sd->md);
 				mercenary_kills(sd->md);
 		}
 		}
 
 
@@ -2656,6 +2664,11 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 	return 3; //Remove from map.
 	return 3; //Remove from map.
 }
 }
 
 
+/**
+ * Resurect a mob with x hp (reset value and respawn on map)
+ * @param md : mob pointer
+ * @param hp : hp to resurect him with, @FIXME unused atm
+ */
 void mob_revive(struct mob_data *md, unsigned int hp)
 void mob_revive(struct mob_data *md, unsigned int hp)
 {
 {
 	unsigned int tick = gettick();
 	unsigned int tick = gettick();
@@ -2666,8 +2679,10 @@ void mob_revive(struct mob_data *md, unsigned int hp)
 	md->last_pcneartime = 0;
 	md->last_pcneartime = 0;
 	memset(md->dmglog, 0, sizeof(md->dmglog));	// Reset the damage done on the rebirthed monster, otherwise will grant full exp + damage done. [Valaris]
 	memset(md->dmglog, 0, sizeof(md->dmglog));	// Reset the damage done on the rebirthed monster, otherwise will grant full exp + damage done. [Valaris]
 	md->tdmg = 0;
 	md->tdmg = 0;
-	if (!md->bl.prev)
-		map_addblock(&md->bl);
+	if (!md->bl.prev){
+		if(map_addblock(&md->bl))
+			return;
+	}
 	clif_spawn(&md->bl);
 	clif_spawn(&md->bl);
 	skill_unit_move(&md->bl,tick,1);
 	skill_unit_move(&md->bl,tick,1);
 	mobskill_use(md, tick, MSC_SPAWN);
 	mobskill_use(md, tick, MSC_SPAWN);

+ 67 - 14
src/map/npc.c

@@ -2158,7 +2158,19 @@ static void npc_parsename(struct npc_data* nd, const char* name, const char* sta
 	}
 	}
 }
 }
 
 
-//Add then display an npc warp on map
+/**
+ * Add then display an npc warp on map
+ * @param name : warp unique name
+ * @param from_mapid : mapid to warp from
+ * @param from_x : x coordinate of warp
+ * @param from_y : y coordinate of warp
+ * @param xs : x lenght of warp (for trigger activation)
+ * @param ys : y lenght of warp (for trigger activation)
+ * @param to_mapindex : mapid to warp to
+ * @param to_x : x coordinate to warp to
+ * @param to_y : y coordinate to warp to
+ * @return NULL:failed creation, npc_data* new warp
+ */
 struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y)
 struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y)
 {
 {
 	int i, flag = 0;
 	int i, flag = 0;
@@ -2197,7 +2209,8 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short
 	nd->bl.type = BL_NPC;
 	nd->bl.type = BL_NPC;
 	nd->subtype = WARP;
 	nd->subtype = WARP;
 	npc_setcells(nd);
 	npc_setcells(nd);
-	map_addblock(&nd->bl);
+	if(map_addblock(&nd->bl))
+		return NULL;
 	status_set_viewdata(&nd->bl, nd->class_);
 	status_set_viewdata(&nd->bl, nd->class_);
 	status_change_init(&nd->bl);
 	status_change_init(&nd->bl);
 	unit_dataset(&nd->bl);
 	unit_dataset(&nd->bl);
@@ -2208,7 +2221,18 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short
 	return nd;
 	return nd;
 }
 }
 
 
-/// Parses a warp npc.
+/**
+ * Parses a warp npc.
+ * Line definition <from mapname>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to mapname>,<toX>,<toY>
+ * @param w1 : word 1 before tab (<from map name>,<fromX>,<fromY>,<facing>)
+ * @param w2 : word 2 before tab (warp), keyword that sent us in this parsing
+ * @param w3 : word 3 before tab (<warp name>)
+ * @param w4 : word 4 before tab (<spanx>,<spany>,<to mapname>,<toX>,<toY>)
+ * @param start : index to start parsing
+ * @param buffer : lines to parses
+ * @param filepath : filename with path wich we are parsing
+ * @return new index for next parsing
+ */
 static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 {
 {
 	int x, y, xs, ys, to_x, to_y, m;
 	int x, y, xs, ys, to_x, to_y, m;
@@ -2262,7 +2286,8 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const
 	nd->bl.type = BL_NPC;
 	nd->bl.type = BL_NPC;
 	nd->subtype = WARP;
 	nd->subtype = WARP;
 	npc_setcells(nd);
 	npc_setcells(nd);
-	map_addblock(&nd->bl);
+	if(map_addblock(&nd->bl)) //couldn't add on map
+		return strchr(start,'\n');
 	status_set_viewdata(&nd->bl, nd->class_);
 	status_set_viewdata(&nd->bl, nd->class_);
 	status_change_init(&nd->bl);
 	status_change_init(&nd->bl);
 	unit_dataset(&nd->bl);
 	unit_dataset(&nd->bl);
@@ -2273,7 +2298,22 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const
 	return strchr(start,'\n');// continue
 	return strchr(start,'\n');// continue
 }
 }
 
 
-/// Parses a shop/cashshop npc.
+/**
+ * Parses a shop/cashshop npc.
+ * Line definition :
+ * <map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
+ * <map name>,<x>,<y>,<facing>%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
+ * <map name>,<x>,<y>,<facing>%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
+ * @TODO missing cashshop line definition
+ * @param w1 : word 1 before tab (<from map name>,<x>,<y>,<facing>)
+ * @param w2 : word 2 before tab (shop|cashshop|itemshop|pointshop), keyword that sent us in this parsing
+ * @param w3 : word 3 before tab (<NPC Name>)
+ * @param w4 : word 4 before tab (<sprited id>,<shop definition...>)
+ * @param start : index to start parsing
+ * @param buffer : lines to parses
+ * @param filepath : filename with path wich we are parsing
+ * @return new index for next parsing
+ */
 static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 {
 {
 	//TODO: could be rewritten to NOT need this temp array [ultramage]
 	//TODO: could be rewritten to NOT need this temp array [ultramage]
@@ -2419,7 +2459,8 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 	if( m >= 0 )
 	if( m >= 0 )
 	{// normal shop npc
 	{// normal shop npc
 		map_addnpc(m,nd);
 		map_addnpc(m,nd);
-		map_addblock(&nd->bl);
+		if(map_addblock(&nd->bl))
+			return strchr(start,'\n');
 		status_set_viewdata(&nd->bl, nd->class_);
 		status_set_viewdata(&nd->bl, nd->class_);
 		status_change_init(&nd->bl);
 		status_change_init(&nd->bl);
 		unit_dataset(&nd->bl);
 		unit_dataset(&nd->bl);
@@ -2555,11 +2596,20 @@ static const char* npc_skip_script(const char* start, const char* buffer, const
 	return p+1;// return after the last '}'
 	return p+1;// return after the last '}'
 }
 }
 
 
-/// Parses a npc script.
-///
-/// -%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>}
-/// <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
-/// <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
+/**
+ * Parses a npc script.
+ * Line definition :
+ * <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
+ * <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>} * @TODO missing cashshop line definition
+ * @param w1 : word 1 before tab (<from map name>,<x>,<y>,<facing>)
+ * @param w2 : word 2 before tab (script), keyword that sent us in this parsing
+ * @param w3 : word 3 before tab (<NPC Name>)
+ * @param w4 : word 4 before tab (<sprited id>,<code>)
+ * @param start : index to start parsing
+ * @param buffer : lines to parses
+ * @param filepath : filename with path wich we are parsing
+ * @return new index for next parsing
+ */
 static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, bool runOnInit) {
 static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, bool runOnInit) {
 	int x, y, dir = 0, m, xs = 0, ys = 0, class_ = 0;	// [Valaris] thanks to fov
 	int x, y, dir = 0, m, xs = 0, ys = 0, class_ = 0;	// [Valaris] thanks to fov
 	char mapname[32];
 	char mapname[32];
@@ -2648,7 +2698,8 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
 		unit_dataset(&nd->bl);
 		unit_dataset(&nd->bl);
 		nd->ud.dir = dir;
 		nd->ud.dir = dir;
 		npc_setcells(nd);
 		npc_setcells(nd);
-		map_addblock(&nd->bl);
+		if(map_addblock(&nd->bl))
+			return NULL;
 		if( class_ >= 0 )
 		if( class_ >= 0 )
 		{
 		{
 			status_set_viewdata(&nd->bl, nd->class_);
 			status_set_viewdata(&nd->bl, nd->class_);
@@ -2808,7 +2859,8 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
 		unit_dataset(&nd->bl);
 		unit_dataset(&nd->bl);
 		nd->ud.dir = dir;
 		nd->ud.dir = dir;
 		npc_setcells(nd);
 		npc_setcells(nd);
-		map_addblock(&nd->bl);
+		if(map_addblock(&nd->bl))
+			return end;
 		if( class_ >= 0 ) {
 		if( class_ >= 0 ) {
 			status_set_viewdata(&nd->bl, nd->class_);
 			status_set_viewdata(&nd->bl, nd->class_);
 			if( map[nd->bl.m].users )
 			if( map[nd->bl.m].users )
@@ -2892,7 +2944,8 @@ int npc_duplicate4instance(struct npc_data *snd, int16 m) {
 		wnd->bl.type = BL_NPC;
 		wnd->bl.type = BL_NPC;
 		wnd->subtype = WARP;
 		wnd->subtype = WARP;
 		npc_setcells(wnd);
 		npc_setcells(wnd);
-		map_addblock(&wnd->bl);
+		if(map_addblock(&wnd->bl))
+			return 1;
 		status_set_viewdata(&wnd->bl, wnd->class_);
 		status_set_viewdata(&wnd->bl, wnd->class_);
 		status_change_init(&wnd->bl);
 		status_change_init(&wnd->bl);
 		unit_dataset(&wnd->bl);
 		unit_dataset(&wnd->bl);

+ 8 - 7
src/map/pc.c

@@ -1155,6 +1155,9 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
 	}
 	}
 #endif
 #endif
 
 
+	// Player has not yet received the CashShop list
+	sd->status.cashshop_sent = false;
+
 	// Request all registries (auth is considered completed whence they arrive)
 	// Request all registries (auth is considered completed whence they arrive)
 	intif_request_registry(sd,7);
 	intif_request_registry(sd,7);
 	return true;
 	return true;
@@ -1990,8 +1993,8 @@ int pc_delautobonus(struct map_session_data* sd, struct s_autobonus *autobonus,c
 				if( autobonus[i].bonus_script )
 				if( autobonus[i].bonus_script )
 				{
 				{
 					int j;
 					int j;
-					ARR_FIND( 0, EQI_MAX-1, j, sd->equip_index[j] >= 0 && sd->status.inventory[sd->equip_index[j]].equip == autobonus[i].pos );
-					if( j < EQI_MAX-1 )
+					ARR_FIND( 0, EQI_MAX, j, sd->equip_index[j] >= 0 && sd->status.inventory[sd->equip_index[j]].equip == autobonus[i].pos );
+					if( j < EQI_MAX )
 						script_run_autobonus(autobonus[i].bonus_script,sd->bl.id,sd->equip_index[j]);
 						script_run_autobonus(autobonus[i].bonus_script,sd->bl.id,sd->equip_index[j]);
 				}
 				}
 				continue;
 				continue;
@@ -2021,8 +2024,8 @@ int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus)
 	if( autobonus->other_script )
 	if( autobonus->other_script )
 	{
 	{
 		int j;
 		int j;
-		ARR_FIND( 0, EQI_MAX-1, j, sd->equip_index[j] >= 0 && sd->status.inventory[sd->equip_index[j]].equip == autobonus->pos );
-		if( j < EQI_MAX-1 )
+		ARR_FIND( 0, EQI_MAX, j, sd->equip_index[j] >= 0 && sd->status.inventory[sd->equip_index[j]].equip == autobonus->pos );
+		if( j < EQI_MAX )
 			script_run_autobonus(autobonus->other_script,sd->bl.id,sd->equip_index[j]);
 			script_run_autobonus(autobonus->other_script,sd->bl.id,sd->equip_index[j]);
 	}
 	}
 
 
@@ -6761,6 +6764,7 @@ void pc_close_npc(struct map_session_data *sd,int flag)
 		sd->npc_idle_timer = INVALID_TIMER;
 		sd->npc_idle_timer = INVALID_TIMER;
 #endif
 #endif
 		clif_scriptclose(sd,sd->npc_id);
 		clif_scriptclose(sd,sd->npc_id);
+		clif_scriptclear(sd,sd->npc_id); // [Ind/Hercules]
 		if(sd->st && sd->st->state == END ) {// free attached scripts that are waiting
 		if(sd->st && sd->st->state == END ) {// free attached scripts that are waiting
 			script_free_state(sd->st);
 			script_free_state(sd->st);
 			sd->st = NULL;
 			sd->st = NULL;
@@ -7946,9 +7950,6 @@ int pc_setcart(struct map_session_data *sd,int type) {
 	if( pc_checkskill(sd,MC_PUSHCART) <= 0 && type != 0 )
 	if( pc_checkskill(sd,MC_PUSHCART) <= 0 && type != 0 )
 		return 1;// Push cart is required
 		return 1;// Push cart is required
 
 
-	if( type == 0 && pc_iscarton(sd) )
-		status_change_end(&sd->bl,SC_GN_CARTBOOST,INVALID_TIMER);
-
 #ifdef NEW_CARTS
 #ifdef NEW_CARTS
 
 
 	switch( type ) {
 	switch( type ) {

+ 4 - 2
src/map/pet.c

@@ -411,7 +411,8 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *pet)
 		chrif_save(sd,0); //is it REALLY Needed to save the char for hatching a pet? [Skotlex]
 		chrif_save(sd,0); //is it REALLY Needed to save the char for hatching a pet? [Skotlex]
 
 
 	if(sd->bl.prev != NULL) {
 	if(sd->bl.prev != NULL) {
-		map_addblock(&sd->pd->bl);
+		if(map_addblock(&sd->pd->bl))
+			return 1;
 		clif_spawn(&sd->pd->bl);
 		clif_spawn(&sd->pd->bl);
 		clif_send_petdata(sd,sd->pd, 0,0);
 		clif_send_petdata(sd,sd->pd, 0,0);
 		clif_send_petdata(sd,sd->pd, 5,battle_config.pet_hair_style);
 		clif_send_petdata(sd,sd->pd, 5,battle_config.pet_hair_style);
@@ -452,7 +453,8 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag)
 	} else {
 	} else {
 		pet_data_init(sd,p);
 		pet_data_init(sd,p);
 		if(sd->pd && sd->bl.prev != NULL) {
 		if(sd->pd && sd->bl.prev != NULL) {
-			map_addblock(&sd->pd->bl);
+			if(map_addblock(&sd->pd->bl))
+				return 1;
 			clif_spawn(&sd->pd->bl);
 			clif_spawn(&sd->pd->bl);
 			clif_send_petdata(sd,sd->pd,0,0);
 			clif_send_petdata(sd,sd->pd,0,0);
 			clif_send_petdata(sd,sd->pd,5,battle_config.pet_hair_style);
 			clif_send_petdata(sd,sd->pd,5,battle_config.pet_hair_style);

+ 114 - 35
src/map/script.c

@@ -6103,7 +6103,7 @@ BUILDIN_FUNC(countitem)
 	}
 	}
 
 
 	data = script_getdata(st,2);
 	data = script_getdata(st,2);
-	get_val(st, data);  // convert into value in case of a variable
+	get_val(st, data); // Convert into value in case of a variable
 
 
 	if( data_isstring(data) ) // item name
 	if( data_isstring(data) ) // item name
 		id = itemdb_searchname(conv_str(st, data));
 		id = itemdb_searchname(conv_str(st, data));
@@ -6220,7 +6220,7 @@ BUILDIN_FUNC(checkweight)
 
 
 	for(i=2; i<nbargs; i=i+2) {
 	for(i=2; i<nbargs; i=i+2) {
 		data = script_getdata(st,i);
 		data = script_getdata(st,i);
-		get_val(st, data);  // convert into value in case of a variable
+		get_val(st, data); // Convert into value in case of a variable
 		if( data_isstring(data) ) // item name
 		if( data_isstring(data) ) // item name
 			id = itemdb_searchname(conv_str(st, data));
 			id = itemdb_searchname(conv_str(st, data));
 		else // item id
 		else // item id
@@ -7878,6 +7878,7 @@ BUILDIN_FUNC(bonus)
 	int val4 = 0;
 	int val4 = 0;
 	int val5 = 0;
 	int val5 = 0;
 	TBL_PC* sd;
 	TBL_PC* sd;
+	struct script_data *data;
 
 
 	sd = script_rid2sd(st);
 	sd = script_rid2sd(st);
 	if( sd == NULL )
 	if( sd == NULL )
@@ -7902,7 +7903,9 @@ BUILDIN_FUNC(bonus)
 		case SP_FIXCASTRATE:
 		case SP_FIXCASTRATE:
 		case SP_SKILL_USE_SP:
 		case SP_SKILL_USE_SP:
 			// these bonuses support skill names
 			// these bonuses support skill names
-			val1 = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) );
+			data = script_getdata(st, 3);
+			get_val(st, data); // Convert into value in case of a variable
+			val1 = ( data_isstring(data) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) );
 			break;
 			break;
 		default:
 		default:
 			val1 = script_getnum(st,3);
 			val1 = script_getnum(st,3);
@@ -7923,7 +7926,9 @@ BUILDIN_FUNC(bonus)
 			pc_bonus3(sd, type, val1, val2, val3);
 			pc_bonus3(sd, type, val1, val2, val3);
 			break;
 			break;
 		case 4:
 		case 4:
-			if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) )
+			data = script_getdata(st, 4);
+			get_val(st, data); // Convert into value in case of a variable
+			if( type == SP_AUTOSPELL_ONSKILL && data_isstring(data) )
 				val2 = skill_name2id(script_getstr(st,4)); // 2nd value can be skill name
 				val2 = skill_name2id(script_getstr(st,4)); // 2nd value can be skill name
 			else
 			else
 				val2 = script_getnum(st,4);
 				val2 = script_getnum(st,4);
@@ -7933,7 +7938,9 @@ BUILDIN_FUNC(bonus)
 			pc_bonus4(sd, type, val1, val2, val3, val4);
 			pc_bonus4(sd, type, val1, val2, val3, val4);
 			break;
 			break;
 		case 5:
 		case 5:
-			if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) )
+			data = script_getdata(st, 4);
+			get_val(st, data); // Convert into value in case of a variable
+			if( type == SP_AUTOSPELL_ONSKILL && data_isstring(data) )
 				val2 = skill_name2id(script_getstr(st,4)); // 2nd value can be skill name
 				val2 = skill_name2id(script_getstr(st,4)); // 2nd value can be skill name
 			else
 			else
 				val2 = script_getnum(st,4);
 				val2 = script_getnum(st,4);
@@ -8031,6 +8038,7 @@ BUILDIN_FUNC(autobonus3)
 	short rate,atk_type;
 	short rate,atk_type;
 	TBL_PC* sd;
 	TBL_PC* sd;
 	const char *bonus_script, *other_script = NULL;
 	const char *bonus_script, *other_script = NULL;
+	struct script_data *data;
 
 
 	sd = script_rid2sd(st);
 	sd = script_rid2sd(st);
 	if( sd == NULL )
 	if( sd == NULL )
@@ -8041,7 +8049,9 @@ BUILDIN_FUNC(autobonus3)
 
 
 	rate = script_getnum(st,3);
 	rate = script_getnum(st,3);
 	dur = script_getnum(st,4);
 	dur = script_getnum(st,4);
-	atk_type = ( script_isstring(st,5) ? skill_name2id(script_getstr(st,5)) : script_getnum(st,5) );
+	data = script_getdata(st, 5);
+	get_val(st, data); // Convert into value in case of a variable
+	atk_type = ( data_isstring(data) ? skill_name2id(script_getstr(st,5)) : script_getnum(st,5) );
 	bonus_script = script_getstr(st,2);
 	bonus_script = script_getstr(st,2);
 	if( !rate || !dur || !atk_type || !bonus_script )
 	if( !rate || !dur || !atk_type || !bonus_script )
 		return 0;
 		return 0;
@@ -8076,12 +8086,15 @@ BUILDIN_FUNC(skill)
 	int level;
 	int level;
 	int flag = 1;
 	int flag = 1;
 	TBL_PC* sd;
 	TBL_PC* sd;
+	struct script_data *data;
 
 
 	sd = script_rid2sd(st);
 	sd = script_rid2sd(st);
 	if( sd == NULL )
 	if( sd == NULL )
 		return 0;// no player attached, report source
 		return 0;// no player attached, report source
 
 
-	id = ( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	id = ( data_isstring(data) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
 	level = script_getnum(st,3);
 	level = script_getnum(st,3);
 	if( script_hasdata(st,4) )
 	if( script_hasdata(st,4) )
 		flag = script_getnum(st,4);
 		flag = script_getnum(st,4);
@@ -8105,12 +8118,15 @@ BUILDIN_FUNC(addtoskill)
 	int level;
 	int level;
 	int flag = 2;
 	int flag = 2;
 	TBL_PC* sd;
 	TBL_PC* sd;
+	struct script_data *data;
 
 
 	sd = script_rid2sd(st);
 	sd = script_rid2sd(st);
 	if( sd == NULL )
 	if( sd == NULL )
 		return 0;// no player attached, report source
 		return 0;// no player attached, report source
 
 
-	id = ( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	id = ( data_isstring(data) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
 	level = script_getnum(st,3);
 	level = script_getnum(st,3);
 	if( script_hasdata(st,4) )
 	if( script_hasdata(st,4) )
 		flag = script_getnum(st,4);
 		flag = script_getnum(st,4);
@@ -8129,12 +8145,15 @@ BUILDIN_FUNC(guildskill)
 	int level;
 	int level;
 	TBL_PC* sd;
 	TBL_PC* sd;
 	int i;
 	int i;
+	struct script_data *data;
 
 
 	sd = script_rid2sd(st);
 	sd = script_rid2sd(st);
 	if( sd == NULL )
 	if( sd == NULL )
 		return 0;// no player attached, report source
 		return 0;// no player attached, report source
 
 
-	id = ( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	id = ( data_isstring(data) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
 	level = script_getnum(st,3);
 	level = script_getnum(st,3);
 	for( i=0; i < level; i++ )
 	for( i=0; i < level; i++ )
 		guild_skillup(sd, id);
 		guild_skillup(sd, id);
@@ -8150,12 +8169,15 @@ BUILDIN_FUNC(getskilllv)
 {
 {
 	int id;
 	int id;
 	TBL_PC* sd;
 	TBL_PC* sd;
+	struct script_data *data;
 
 
 	sd = script_rid2sd(st);
 	sd = script_rid2sd(st);
 	if( sd == NULL )
 	if( sd == NULL )
 		return 0;// no player attached, report source
 		return 0;// no player attached, report source
 
 
-	id = ( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	id = ( data_isstring(data) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
 	script_pushint(st, pc_checkskill(sd,id));
 	script_pushint(st, pc_checkskill(sd,id));
 
 
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
@@ -8170,9 +8192,12 @@ BUILDIN_FUNC(getgdskilllv)
 	int guild_id;
 	int guild_id;
 	uint16 skill_id;
 	uint16 skill_id;
 	struct guild* g;
 	struct guild* g;
+	struct script_data *data;
 
 
 	guild_id = script_getnum(st,2);
 	guild_id = script_getnum(st,2);
-	skill_id = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) );
+	data = script_getdata(st, 3);
+	get_val(st, data); // Convert into value in case of a variable
+	skill_id = ( data_isstring(data) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) );
 	g = guild_search(guild_id);
 	g = guild_search(guild_id);
 	if( g == NULL )
 	if( g == NULL )
 		script_pushint(st, -1);
 		script_pushint(st, -1);
@@ -8702,12 +8727,15 @@ BUILDIN_FUNC(itemskill)
 	int id;
 	int id;
 	int lv;
 	int lv;
 	TBL_PC* sd;
 	TBL_PC* sd;
+	struct script_data *data;
 
 
 	sd = script_rid2sd(st);
 	sd = script_rid2sd(st);
 	if( sd == NULL || sd->ud.skilltimer != INVALID_TIMER )
 	if( sd == NULL || sd->ud.skilltimer != INVALID_TIMER )
 		return 0;
 		return 0;
 
 
-	id = ( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	id = ( data_isstring(data) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
 	lv = script_getnum(st,3);
 	lv = script_getnum(st,3);
 
 
 	sd->skillitem=id;
 	sd->skillitem=id;
@@ -12599,6 +12627,7 @@ BUILDIN_FUNC(petheal)
 BUILDIN_FUNC(petskillattack)
 BUILDIN_FUNC(petskillattack)
 {
 {
 	struct pet_data *pd;
 	struct pet_data *pd;
+	struct script_data *data;
 	TBL_PC *sd=script_rid2sd(st);
 	TBL_PC *sd=script_rid2sd(st);
 
 
 	if(sd==NULL || sd->pd==NULL)
 	if(sd==NULL || sd->pd==NULL)
@@ -12608,7 +12637,9 @@ BUILDIN_FUNC(petskillattack)
 	if (pd->a_skill == NULL)
 	if (pd->a_skill == NULL)
 		pd->a_skill = (struct pet_skill_attack *)aMalloc(sizeof(struct pet_skill_attack));
 		pd->a_skill = (struct pet_skill_attack *)aMalloc(sizeof(struct pet_skill_attack));
 
 
-	pd->a_skill->id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	pd->a_skill->id=( data_isstring(data) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
 	pd->a_skill->lv=script_getnum(st,3);
 	pd->a_skill->lv=script_getnum(st,3);
 	pd->a_skill->div_ = 0;
 	pd->a_skill->div_ = 0;
 	pd->a_skill->rate=script_getnum(st,4);
 	pd->a_skill->rate=script_getnum(st,4);
@@ -12624,6 +12655,7 @@ BUILDIN_FUNC(petskillattack)
 BUILDIN_FUNC(petskillattack2)
 BUILDIN_FUNC(petskillattack2)
 {
 {
 	struct pet_data *pd;
 	struct pet_data *pd;
+	struct script_data *data;
 	TBL_PC *sd=script_rid2sd(st);
 	TBL_PC *sd=script_rid2sd(st);
 
 
 	if(sd==NULL || sd->pd==NULL)
 	if(sd==NULL || sd->pd==NULL)
@@ -12633,7 +12665,9 @@ BUILDIN_FUNC(petskillattack2)
 	if (pd->a_skill == NULL)
 	if (pd->a_skill == NULL)
 		pd->a_skill = (struct pet_skill_attack *)aMalloc(sizeof(struct pet_skill_attack));
 		pd->a_skill = (struct pet_skill_attack *)aMalloc(sizeof(struct pet_skill_attack));
 
 
-	pd->a_skill->id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	pd->a_skill->id=( data_isstring(data) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
 	pd->a_skill->lv=script_getnum(st,3);
 	pd->a_skill->lv=script_getnum(st,3);
 	pd->a_skill->div_ = script_getnum(st,4);
 	pd->a_skill->div_ = script_getnum(st,4);
 	pd->a_skill->rate=script_getnum(st,5);
 	pd->a_skill->rate=script_getnum(st,5);
@@ -12649,6 +12683,7 @@ BUILDIN_FUNC(petskillattack2)
 BUILDIN_FUNC(petskillsupport)
 BUILDIN_FUNC(petskillsupport)
 {
 {
 	struct pet_data *pd;
 	struct pet_data *pd;
+	struct script_data *data;
 	TBL_PC *sd=script_rid2sd(st);
 	TBL_PC *sd=script_rid2sd(st);
 
 
 	if(sd==NULL || sd->pd==NULL)
 	if(sd==NULL || sd->pd==NULL)
@@ -12667,7 +12702,9 @@ BUILDIN_FUNC(petskillsupport)
 	} else //init memory
 	} else //init memory
 		pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support));
 		pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support));
 
 
-	pd->s_skill->id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	pd->s_skill->id=( data_isstring(data) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
 	pd->s_skill->lv=script_getnum(st,3);
 	pd->s_skill->lv=script_getnum(st,3);
 	pd->s_skill->delay=script_getnum(st,4);
 	pd->s_skill->delay=script_getnum(st,4);
 	pd->s_skill->hp=script_getnum(st,5);
 	pd->s_skill->hp=script_getnum(st,5);
@@ -12689,9 +12726,12 @@ BUILDIN_FUNC(petskillsupport)
 BUILDIN_FUNC(skilleffect)
 BUILDIN_FUNC(skilleffect)
 {
 {
 	TBL_PC *sd;
 	TBL_PC *sd;
+	uint16 skill_id, skill_lv;
+	struct script_data *data = script_getdata(st, 2);
 
 
-	uint16 skill_id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
-	uint16 skill_lv=script_getnum(st,3);
+	get_val(st, data); // Convert into value in case of a variable
+	skill_id=( data_isstring(data) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
+	skill_lv=script_getnum(st,3);
 	sd=script_rid2sd(st);
 	sd=script_rid2sd(st);
 
 
 	clif_skill_nodamage(&sd->bl,&sd->bl,skill_id,skill_lv,1);
 	clif_skill_nodamage(&sd->bl,&sd->bl,skill_id,skill_lv,1);
@@ -12706,11 +12746,15 @@ BUILDIN_FUNC(skilleffect)
 BUILDIN_FUNC(npcskilleffect)
 BUILDIN_FUNC(npcskilleffect)
 {
 {
 	struct block_list *bl= map_id2bl(st->oid);
 	struct block_list *bl= map_id2bl(st->oid);
+	uint16 skill_id, skill_lv;
+	int x, y;
+	struct script_data *data = script_getdata(st, 2);
 
 
-	uint16 skill_id=( script_isstring(st,2) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
-	uint16 skill_lv=script_getnum(st,3);
-	int x=script_getnum(st,4);
-	int y=script_getnum(st,5);
+	get_val(st, data); // Convert into value in case of a variable
+	skill_id=( data_isstring(data) ? skill_name2id(script_getstr(st,2)) : script_getnum(st,2) );
+	skill_lv=script_getnum(st,3);
+	x=script_getnum(st,4);
+	y=script_getnum(st,5);
 
 
 	if (bl)
 	if (bl)
 		clif_skill_poseffect(bl,skill_id,skill_lv,x,y,gettick());
 		clif_skill_poseffect(bl,skill_id,skill_lv,x,y,gettick());
@@ -12955,7 +12999,10 @@ BUILDIN_FUNC(recovery)
 		case 4:
 		case 4:
 		{
 		{
 			struct s_mapiterator *iter;
 			struct s_mapiterator *iter;
-			if(script_hasdata(st,3) && !script_isstring(st,3))
+			struct script_data *data = script_getdata(st, 3);
+
+			get_val(st, data); // Convert into value in case of a variable
+			if(script_hasdata(st,3) && !data_isstring(data))
 				revive = script_getnum(st,3); // recovery 4,<revive_flag>;
 				revive = script_getnum(st,3); // recovery 4,<revive_flag>;
 			iter = mapit_getallusers();
 			iter = mapit_getallusers();
 			for (sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter)) {
 			for (sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter)) {
@@ -14517,7 +14564,10 @@ BUILDIN_FUNC(replacestr)
 	}
 	}
 
 
 	if(script_hasdata(st, 5)) {
 	if(script_hasdata(st, 5)) {
-		if( !script_isstring(st,5) )
+		struct script_data *data = script_getdata(st, 5);
+
+		get_val(st, data); // Convert into value in case of a variable
+		if( !data_isstring(data) )
 			usecase = script_getnum(st, 5) != 0;
 			usecase = script_getnum(st, 5) != 0;
 		else {
 		else {
 			ShowError("script:replacestr: Invalid usecase value. Expected int got string\n");
 			ShowError("script:replacestr: Invalid usecase value. Expected int got string\n");
@@ -14598,7 +14648,11 @@ BUILDIN_FUNC(countstr)
 	}
 	}
 
 
 	if(script_hasdata(st, 4)) {
 	if(script_hasdata(st, 4)) {
-		if( !script_isstring(st,4) )
+		struct script_data *data;
+
+		data = script_getdata(st, 4);
+		get_val(st, data); // Convert into value in case of a variable
+		if( !data_isstring(data) )
 			usecase = script_getnum(st, 4) != 0;
 			usecase = script_getnum(st, 4) != 0;
 		else {
 		else {
 			ShowError("script:countstr: Invalid usecase value. Expected int got string\n");
 			ShowError("script:countstr: Invalid usecase value. Expected int got string\n");
@@ -15167,9 +15221,12 @@ BUILDIN_FUNC(setitemscript)
 BUILDIN_FUNC(addmonsterdrop)
 BUILDIN_FUNC(addmonsterdrop)
 {
 {
 	struct mob_db *mob;
 	struct mob_db *mob;
+	struct script_data *data;
 	int item_id,rate,i,c = 0;
 	int item_id,rate,i,c = 0;
 
 
-	if(script_isstring(st,2))
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	if(data_isstring(data))
 		mob = mob_db(mobdb_searchname(script_getstr(st,2)));
 		mob = mob_db(mobdb_searchname(script_getstr(st,2)));
 	else
 	else
 		mob = mob_db(script_getnum(st,2));
 		mob = mob_db(script_getnum(st,2));
@@ -15219,9 +15276,12 @@ BUILDIN_FUNC(addmonsterdrop)
 BUILDIN_FUNC(delmonsterdrop)
 BUILDIN_FUNC(delmonsterdrop)
 {
 {
 	struct mob_db *mob;
 	struct mob_db *mob;
+	struct script_data *data;
 	int item_id,i;
 	int item_id,i;
 
 
-	if(script_isstring(st,2))
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	if(data_isstring(data))
 		mob = mob_db(mobdb_searchname(script_getstr(st,2)));
 		mob = mob_db(mobdb_searchname(script_getstr(st,2)));
 	else
 	else
 		mob = mob_db(script_getnum(st,2));
 		mob = mob_db(script_getnum(st,2));
@@ -15764,9 +15824,12 @@ BUILDIN_FUNC(unitskilluseid)
 	uint16 skill_lv;
 	uint16 skill_lv;
 	int target_id;
 	int target_id;
 	struct block_list* bl;
 	struct block_list* bl;
+	struct script_data *data;
 
 
 	unit_id  = script_getnum(st,2);
 	unit_id  = script_getnum(st,2);
-	skill_id = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) );
+	data = script_getdata(st, 3);
+	get_val(st, data); // Convert into value in case of a variable
+	skill_id = ( data_isstring(data) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) );
 	skill_lv = script_getnum(st,4);
 	skill_lv = script_getnum(st,4);
 	target_id = ( script_hasdata(st,5) ? script_getnum(st,5) : unit_id );
 	target_id = ( script_hasdata(st,5) ? script_getnum(st,5) : unit_id );
 
 
@@ -15789,9 +15852,12 @@ BUILDIN_FUNC(unitskillusepos)
 	int skill_x;
 	int skill_x;
 	int skill_y;
 	int skill_y;
 	struct block_list* bl;
 	struct block_list* bl;
+	struct script_data *data;
 
 
 	unit_id  = script_getnum(st,2);
 	unit_id  = script_getnum(st,2);
-	skill_id = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) );
+	data = script_getdata(st, 3);
+	get_val(st, data); // Convert into value in case of a variable
+	skill_id = ( data_isstring(data) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) );
 	skill_lv = script_getnum(st,4);
 	skill_lv = script_getnum(st,4);
 	skill_x  = script_getnum(st,5);
 	skill_x  = script_getnum(st,5);
 	skill_y  = script_getnum(st,6);
 	skill_y  = script_getnum(st,6);
@@ -16921,6 +16987,7 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
 BUILDIN_FUNC(areamobuseskill)
 BUILDIN_FUNC(areamobuseskill)
 {
 {
 	struct block_list center;
 	struct block_list center;
+	struct script_data *data;
 	int16 m;
 	int16 m;
 	int range,mobid,skill_id,skill_lv,casttime,emotion,target,cancel;
 	int range,mobid,skill_id,skill_lv,casttime,emotion,target,cancel;
 
 
@@ -16934,7 +17001,9 @@ BUILDIN_FUNC(areamobuseskill)
 	center.y = script_getnum(st,4);
 	center.y = script_getnum(st,4);
 	range = script_getnum(st,5);
 	range = script_getnum(st,5);
 	mobid = script_getnum(st,6);
 	mobid = script_getnum(st,6);
-	skill_id = ( script_isstring(st,7) ? skill_name2id(script_getstr(st,7)) : script_getnum(st,7) );
+	data = script_getdata(st, 7);
+	get_val(st, data); // Convert into value in case of a variable
+	skill_id = ( data_isstring(data) ? skill_name2id(script_getstr(st,7)) : script_getnum(st,7) );
 	if( (skill_lv = script_getnum(st,8)) > battle_config.mob_max_skilllvl )
 	if( (skill_lv = script_getnum(st,8)) > battle_config.mob_max_skilllvl )
 		skill_lv = battle_config.mob_max_skilllvl;
 		skill_lv = battle_config.mob_max_skilllvl;
 
 
@@ -17218,9 +17287,13 @@ BUILDIN_FUNC(getcharip)
 	/* check if a character name is specified */
 	/* check if a character name is specified */
 	if( script_hasdata(st, 2) )
 	if( script_hasdata(st, 2) )
 	{
 	{
-		if (script_isstring(st, 2))
+		struct script_data *data;
+
+		data = script_getdata(st, 2);
+		get_val(st, data); // Convert into value in case of a variable
+		if (data_isstring(data))
 			sd = map_nick2sd(script_getstr(st, 2));
 			sd = map_nick2sd(script_getstr(st, 2));
-		else if (script_isint(st, 2) || script_getnum(st, 2))
+		else if (data_isint(data) || script_getnum(st, 2))
 		{
 		{
 			int id = 0;
 			int id = 0;
 			id = script_getnum(st, 2);
 			id = script_getnum(st, 2);
@@ -17527,8 +17600,11 @@ BUILDIN_FUNC(npcskill)
 	unsigned int npc_level;
 	unsigned int npc_level;
 	struct npc_data *nd;
 	struct npc_data *nd;
 	struct map_session_data *sd;
 	struct map_session_data *sd;
-
-	skill_id	= script_isstring(st, 2) ? skill_name2id(script_getstr(st, 2)) : script_getnum(st, 2);
+	struct script_data *data;
+	
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	skill_id	= data_isstring(data) ? skill_name2id(script_getstr(st, 2)) : script_getnum(st, 2);
 	skill_level	= script_getnum(st, 3);
 	skill_level	= script_getnum(st, 3);
 	stat_point	= script_getnum(st, 4);
 	stat_point	= script_getnum(st, 4);
 	npc_level	= script_getnum(st, 5);
 	npc_level	= script_getnum(st, 5);
@@ -18041,11 +18117,14 @@ BUILDIN_FUNC(montransform) {
 	enum sc_type type;
 	enum sc_type type;
 	char msg[CHAT_SIZE_MAX];
 	char msg[CHAT_SIZE_MAX];
 	int tick, mob_id, val1, val2, val3, val4;
 	int tick, mob_id, val1, val2, val3, val4;
+	struct script_data *data;
 
 
 	if( (sd = script_rid2sd(st)) == NULL )
 	if( (sd = script_rid2sd(st)) == NULL )
 		return 1;
 		return 1;
 
 
-	if( script_isstring(st, 2) )
+	data = script_getdata(st, 2);
+	get_val(st, data); // Convert into value in case of a variable
+	if( data_isstring(data) )
 		mob_id = mobdb_searchname(script_getstr(st, 2));
 		mob_id = mobdb_searchname(script_getstr(st, 2));
 	else
 	else
 		mob_id = mobdb_checkid(script_getnum(st, 2));
 		mob_id = mobdb_checkid(script_getnum(st, 2));
@@ -18055,7 +18134,7 @@ BUILDIN_FUNC(montransform) {
 	val1 = val2 = val3 = val4 = 0;
 	val1 = val2 = val3 = val4 = 0;
 
 
 	if (mob_id == 0) {
 	if (mob_id == 0) {
-		if( script_isstring(st,2) )
+		if( data_isstring(data) )
 			ShowWarning("buildin_montransform: Attempted to use non-existing monster '%s'.\n", script_getstr(st, 2));
 			ShowWarning("buildin_montransform: Attempted to use non-existing monster '%s'.\n", script_getstr(st, 2));
 		else
 		else
 			ShowWarning("buildin_montransform: Attempted to use non-existing monster of ID '%d'.\n", script_getnum(st, 2));
 			ShowWarning("buildin_montransform: Attempted to use non-existing monster of ID '%d'.\n", script_getnum(st, 2));

+ 6 - 4
src/map/skill.c

@@ -2657,7 +2657,7 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *
 					//Reduction: 6% + 6% every 20%
 					//Reduction: 6% + 6% every 20%
 					dmg.damage -= dmg.damage * (6 * (1+per)) / 100;
 					dmg.damage -= dmg.damage * (6 * (1+per)) / 100;
 				}
 				}
-		}
+			}
 		#endif
 		#endif
 		}
 		}
 		if(tsc && tsc->data[SC_MAGICROD] && src == dsrc) {
 		if(tsc && tsc->data[SC_MAGICROD] && src == dsrc) {
@@ -5952,7 +5952,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 				mer->devotion_flag = 1; // Mercenary Devoting Owner
 				mer->devotion_flag = 1; // Mercenary Devoting Owner
 
 
 			clif_skill_nodamage(src, bl, skill_id, skill_lv,
 			clif_skill_nodamage(src, bl, skill_id, skill_lv,
-				sc_start4(src,bl, type, 100, src->id, i, skill_get_range2(src,skill_id,skill_lv),0, skill_get_time2(skill_id, skill_lv)));
+				sc_start4(src, bl, type, 100, src->id, i, skill_get_range2(src,skill_id,skill_lv),0, skill_get_time2(skill_id, skill_lv)));
 			clif_devotion(src, NULL);
 			clif_devotion(src, NULL);
 		}
 		}
 		break;
 		break;
@@ -6124,7 +6124,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 			skill_get_splash(skill_id, skill_lv), splash_target(src),
 			skill_get_splash(skill_id, skill_lv), splash_target(src),
 			src, skill_id, skill_lv, tick, flag|i,
 			src, skill_id, skill_lv, tick, flag|i,
 			skill_castend_damage_id);
 			skill_castend_damage_id);
-		map_addblock(src);
+		if(map_addblock(src))
+			return 1;
 		status_damage(src, src, sstatus->max_hp,0,0,1);
 		status_damage(src, src, sstatus->max_hp,0,0,1);
 		break;
 		break;
 
 
@@ -15985,7 +15986,8 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int
 
 
 	idb_put(skillunit_db, unit->bl.id, unit);
 	idb_put(skillunit_db, unit->bl.id, unit);
 	map_addiddb(&unit->bl);
 	map_addiddb(&unit->bl);
-	map_addblock(&unit->bl);
+	if(map_addblock(&unit->bl))
+		return NULL;
 
 
 	// perform oninit actions
 	// perform oninit actions
 	switch (group->skill_id) {
 	switch (group->skill_id) {

+ 5 - 3
src/map/status.c

@@ -2587,10 +2587,11 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
 	pc_delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
 	pc_delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
 
 
 	// Parse equipment
 	// Parse equipment
-	for(i=0;i<EQI_MAX-1;i++) {
+	for(i=0;i<EQI_MAX;i++) {
 		current_equip_item_index = index = sd->equip_index[i]; // We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
 		current_equip_item_index = index = sd->equip_index[i]; // We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
 		if(index < 0)
 		if(index < 0)
 			continue;
 			continue;
+		if(i == EQI_AMMO) continue;
 		if(i == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index)
 		if(i == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index)
 			continue;
 			continue;
 		if(i == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == index)
 		if(i == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == index)
@@ -2737,10 +2738,11 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
 	status->def += (refinedef+50)/100;
 	status->def += (refinedef+50)/100;
 
 
 	// Parse Cards
 	// Parse Cards
-	for(i=0;i<EQI_MAX-1;i++) {
+	for(i=0;i<EQI_MAX;i++) {
 		current_equip_item_index = index = sd->equip_index[i]; // We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
 		current_equip_item_index = index = sd->equip_index[i]; // We pass INDEX to current_equip_item_index - for EQUIP_SCRIPT (new cards solution) [Lupus]
 		if(index < 0)
 		if(index < 0)
 			continue;
 			continue;
+		if(i == EQI_AMMO) continue;
 		if(i == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index)
 		if(i == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index)
 			continue;
 			continue;
 		if(i == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == index)
 		if(i == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == index)
@@ -9279,7 +9281,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 			break;
 			break;
 		case SC_OFFERTORIUM:
 		case SC_OFFERTORIUM:
 			val2 = 30 * val1; // heal power bonus
 			val2 = 30 * val1; // heal power bonus
-			val3 = 20 * val1; // sp cost inc
+			val3 = 100 + (20 * val1); // sp cost inc
 			break;
 			break;
 		case SC_FRIGG_SONG:
 		case SC_FRIGG_SONG:
 			val2 = 5 * val1; // maxhp bonus
 			val2 = 5 * val1; // maxhp bonus

+ 5 - 3
src/map/unit.c

@@ -199,7 +199,8 @@ int unit_check_start_teleport_timer(struct block_list *sbl)
 		case BL_PET : max_dist = AREA_SIZE; break;
 		case BL_PET : max_dist = AREA_SIZE; break;
 		case BL_MER : max_dist = MAX_MER_DISTANCE; break;
 		case BL_MER : max_dist = MAX_MER_DISTANCE; break;
 	}
 	}
-	if(msd && max_dist){ // If there is a master and it's a valid type
+	// If there is a master and it's a valid type 
+	if(msd && (msd->bl.type&BL_PC) && max_dist){ ///TODO the bl.type is an hotfix please dig it to remove it
 		int *msd_tid = unit_get_masterteleport_timer(sbl);
 		int *msd_tid = unit_get_masterteleport_timer(sbl);
 		if(msd_tid == NULL) return 0;
 		if(msd_tid == NULL) return 0;
 		if (!check_distance_bl(&msd->bl, sbl, max_dist)) {
 		if (!check_distance_bl(&msd->bl, sbl, max_dist)) {
@@ -941,7 +942,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
 * @param x: Destination cell X
 * @param x: Destination cell X
 * @param y: Destination cell Y
 * @param y: Destination cell Y
 * @param type: Clear type used in clif_clearunit_area()
 * @param type: Clear type used in clif_clearunit_area()
-* @return Success(0); Failed(1); Error(2); unit_remove_map() Failed(3)
+* @return Success(0); Failed(1); Error(2); unit_remove_map() Failed(3); map_addblock Failed(4)
 **/
 **/
 int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
 int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
 {
 {
@@ -1001,7 +1002,8 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
 	bl->y=ud->to_y=y;
 	bl->y=ud->to_y=y;
 	bl->m=m;
 	bl->m=m;
 
 
-	map_addblock(bl);
+	if(map_addblock(bl))
+		return 4; //error on adding bl to map
 	clif_spawn(bl);
 	clif_spawn(bl);
 	skill_unit_move(bl,gettick(),1);
 	skill_unit_move(bl,gettick(),1);