summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-02 00:11:54 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-02 00:11:54 +0000
commit572e2c0dcc4e124136f9ad4bc493184e917e8f63 (patch)
treef93861924f9b03e10feb005e21eb51672693e545
parentf9b1682603fee23ba36ff04fbdc303dd0b7cf0ef (diff)
downloadhercules-572e2c0dcc4e124136f9ad4bc493184e917e8f63.tar.gz
hercules-572e2c0dcc4e124136f9ad4bc493184e917e8f63.tar.bz2
hercules-572e2c0dcc4e124136f9ad4bc493184e917e8f63.tar.xz
hercules-572e2c0dcc4e124136f9ad4bc493184e917e8f63.zip
EOL-styled some more files
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9947 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--eAthena-6.dsw178
-rw-r--r--lib/zlib-1.2.3bin58 -> 0 bytes
-rw-r--r--npc/custom/eAAC_Scripts/DonationGirl/sql/donate.sql10
-rw-r--r--npc/custom/eAAC_Scripts/DonationGirl/sql/donate_item_db.sql26
-rw-r--r--npc/jobs/2-2/sage.txt8
-rw-r--r--npc/jobs/novice/supernovice.txt2
-rw-r--r--npc/sample/npc_test_setitemx.txt140
-rw-r--r--sql-files/convert_engine.sql44
-rw-r--r--sql-files/convert_passwords.sql6
-rwxr-xr-xsql-files/item_db2.sql84
-rw-r--r--sql-files/logs.sql224
-rw-r--r--sql-files/mail.sql24
-rw-r--r--sql-files/main.sql1156
-rw-r--r--sql-files/oA2eA-rc5.sql408
-rw-r--r--sql-files/update_logs.sql26
-rw-r--r--sql-files/upgrade_0.5.2_database.sql2
-rw-r--r--sql-files/upgrade_0.5.2_main.sql124
-rw-r--r--sql-files/upgrade_1.0.0-rc1_main.sql6
-rw-r--r--sql-files/upgrade_1.0.0-rc2_database.sql8
-rw-r--r--sql-files/upgrade_1.0.0-rc5_database.sql8
-rw-r--r--sql-files/upgrade_svn1759.sql36
-rw-r--r--sql-files/upgrade_svn1863.sql14
-rw-r--r--sql-files/upgrade_svn2068.sql6
-rw-r--r--sql-files/upgrade_svn2252.sql28
-rw-r--r--sql-files/upgrade_svn2331.sql6
-rw-r--r--sql-files/upgrade_svn2574.sql4
-rw-r--r--sql-files/upgrade_svn3273.sql24
-rw-r--r--sql-files/upgrade_svn3746.sql2
-rw-r--r--sql-files/upgrade_svn4367.sql18
-rw-r--r--sql-files/upgrade_svn4941.sql10
-rw-r--r--sql-files/upgrade_svn5311.sql2
-rw-r--r--sql-files/upgrade_svn5322.sql2
-rw-r--r--sql-files/upgrade_svn5455.sql4
-rw-r--r--sql-files/upgrade_svn5607.sql2
-rw-r--r--sql-files/upgrade_svn5834.sql2
-rw-r--r--sql-files/upgrade_svn5902.sql28
-rw-r--r--sql-files/upgrade_svn6533.sql4
-rw-r--r--sql-files/upgrade_svn6868.sql2
-rw-r--r--sql-files/upgrade_svn7146.sql2
-rw-r--r--sql-files/upgrade_svn7580.sql4
-rw-r--r--sql-files/upgrade_svn7706.sql72
-rw-r--r--sql-files/upgrade_svn7768.sql14
-rw-r--r--sql-files/upgrade_svn8630.sql2
-rw-r--r--sql-files/upgrade_svn8675.sql2
-rw-r--r--sql-files/upgrade_svn8728.sql8
-rw-r--r--sql-files/upgrade_svn9050.sql12
-rw-r--r--sql-files/upgrade_svn9135.sql2
-rw-r--r--src/map/script.c1
-rw-r--r--src/tool/grfio.c1964
-rw-r--r--src/tool/grfio.h46
-rw-r--r--src/tool/mapcache.c404
-rw-r--r--src/zlib/zlib-1.2.3bin58 -> 0 bytes
52 files changed, 2606 insertions, 2605 deletions
diff --git a/eAthena-6.dsw b/eAthena-6.dsw
index db1930d17..c28270df2 100644
--- a/eAthena-6.dsw
+++ b/eAthena-6.dsw
@@ -1,89 +1,89 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "login_txt"=".\vcproj-6\login-server_txt.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "login_sql"=".\vcproj-6\login-server_sql.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "char_txt"=".\vcproj-6\char-server_txt.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "char_sql"=".\vcproj-6\char-server_sql.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "map_txt"=".\vcproj-6\map-server_txt.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "map_sql"=".\vcproj-6\map-server_sql.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "login_txt"=".\vcproj-6\login-server_txt.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "login_sql"=".\vcproj-6\login-server_sql.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "char_txt"=".\vcproj-6\char-server_txt.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "char_sql"=".\vcproj-6\char-server_sql.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "map_txt"=".\vcproj-6\map-server_txt.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "map_sql"=".\vcproj-6\map-server_sql.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/lib/zlib-1.2.3 b/lib/zlib-1.2.3
index a6a9cc84d..e69de29bb 100644
--- a/lib/zlib-1.2.3
+++ b/lib/zlib-1.2.3
Binary files differ
diff --git a/npc/custom/eAAC_Scripts/DonationGirl/sql/donate.sql b/npc/custom/eAAC_Scripts/DonationGirl/sql/donate.sql
index 3b7eefbed..9315228a9 100644
--- a/npc/custom/eAAC_Scripts/DonationGirl/sql/donate.sql
+++ b/npc/custom/eAAC_Scripts/DonationGirl/sql/donate.sql
@@ -1,6 +1,6 @@
-CREATE TABLE `donate` (
- `account_id` int(11) unsigned NOT NULL,
- `amount` float(5,2) unsigned NOT NULL,
- `claimed` float(5,2) unsigned NOT NULL,
- PRIMARY KEY (`account_id`,`amount`)
+CREATE TABLE `donate` (
+ `account_id` int(11) unsigned NOT NULL,
+ `amount` float(5,2) unsigned NOT NULL,
+ `claimed` float(5,2) unsigned NOT NULL,
+ PRIMARY KEY (`account_id`,`amount`)
) TYPE=MyISAM; \ No newline at end of file
diff --git a/npc/custom/eAAC_Scripts/DonationGirl/sql/donate_item_db.sql b/npc/custom/eAAC_Scripts/DonationGirl/sql/donate_item_db.sql
index 604373139..34519324b 100644
--- a/npc/custom/eAAC_Scripts/DonationGirl/sql/donate_item_db.sql
+++ b/npc/custom/eAAC_Scripts/DonationGirl/sql/donate_item_db.sql
@@ -1,14 +1,14 @@
-CREATE TABLE `donate_item_db` (
- `id` smallint(5) unsigned NOT NULL default '0',
- `name` varchar(30) NOT NULL default '',
- `price` float(5,2) unsigned NOT NULL,
- PRIMARY KEY (`id`)
-) TYPE=MyISAM;
-
-#(ID,'Name',Price);
-REPLACE INTO `donate_item_db` VALUES (601,'Fly_Wing',0.06);
-REPLACE INTO `donate_item_db` VALUES (602,'Butterfly_Wing',0.33);
-REPLACE INTO `donate_item_db` VALUES (603,'Old_Blue_Box',10);
-REPLACE INTO `donate_item_db` VALUES (604,'Dead_Branch',0.05);
-REPLACE INTO `donate_item_db` VALUES (605,'Anodyne',2);
+CREATE TABLE `donate_item_db` (
+ `id` smallint(5) unsigned NOT NULL default '0',
+ `name` varchar(30) NOT NULL default '',
+ `price` float(5,2) unsigned NOT NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+#(ID,'Name',Price);
+REPLACE INTO `donate_item_db` VALUES (601,'Fly_Wing',0.06);
+REPLACE INTO `donate_item_db` VALUES (602,'Butterfly_Wing',0.33);
+REPLACE INTO `donate_item_db` VALUES (603,'Old_Blue_Box',10);
+REPLACE INTO `donate_item_db` VALUES (604,'Dead_Branch',0.05);
+REPLACE INTO `donate_item_db` VALUES (605,'Anodyne',2);
REPLACE INTO `donate_item_db` VALUES (606,'Aloevera',2); \ No newline at end of file
diff --git a/npc/jobs/2-2/sage.txt b/npc/jobs/2-2/sage.txt
index cbb79973d..70d38bbc0 100644
--- a/npc/jobs/2-2/sage.txt
+++ b/npc/jobs/2-2/sage.txt
@@ -1558,15 +1558,15 @@ L_Menu1_2:
L_Test1_14:
mes "15. Which one isn't necessary to unlock the Blacksmith skill 'Maximize Power'?";
next;
- menu "Hilt Bending",L_Test1_15,"Skin Tempering",-,"Hammer Fall",L_Test1_15,"Weapon Perfection",L_Test1_15;
+ menu "Hilt Binding",L_Test1_15,"Skin Tempering",-,"Hammer Fall",L_Test1_15,"Weapon Perfection",L_Test1_15;
set @sage_test2,@sage_test2+5;
L_Test1_15:
- mes "16. What is the defense power and supplemental ability of a Ribbon?";
+ mes "16. What is the defense power and supplemental ability of a Cute Ribbon?";
next;
menu "0 / SP +20",L_Test1_16,"0 / SP +30",L_Test1_16,"1 / SP +20",-,"1 / SP +30",L_Test1_16;
set @sage_test2,@sage_test2+5;
L_Test1_16:
- mes "17. Which class can't equip a Saint Robe?";
+ mes "17. Which class can't equip a Saint's Robe?";
next;
//Swordsmen can't equip it either as of this writing.
menu "Swordsman",-,"Merchant",L_Test1_17,"Thief",-,"Acolyte",L_Test1_17;
@@ -1584,7 +1584,7 @@ L_Menu1_2:
L_Test1_19:
mes "20. Which tree is said to be the world's root?";
next;
- menu "Igg Drasil",-,"Idrasil",L_Menu2_3,"Master",L_Menu2_3,"Old Tree",L_Menu2_3;
+ menu "Yggdrasil",-,"Idrasil",L_Menu2_3,"Master",L_Menu2_3,"Old Tree",L_Menu2_3;
set @sage_test2,@sage_test2+5;
goto L_Menu2_3;
//==================================
diff --git a/npc/jobs/novice/supernovice.txt b/npc/jobs/novice/supernovice.txt
index 4f94859bb..5212254b6 100644
--- a/npc/jobs/novice/supernovice.txt
+++ b/npc/jobs/novice/supernovice.txt
@@ -216,7 +216,7 @@ L_Otherjob:
// -- Car Rental --
-aldebaran.gat,54,238,5 script Kafra 117,{
+aldebaran.gat,54,238,5 script Kafra::kaf_sn 117,{
if(BaseJob != Job_SuperNovice) goto L_Otherjob;
if(checkcart() == 1) goto L_GotCart;
mes "[Kafra]";
diff --git a/npc/sample/npc_test_setitemx.txt b/npc/sample/npc_test_setitemx.txt
index 1e8d021e4..a13a3f836 100644
--- a/npc/sample/npc_test_setitemx.txt
+++ b/npc/sample/npc_test_setitemx.txt
@@ -1,70 +1,70 @@
-//by Lupus.
-// SVN TRUNK 9940+ only
-
-//setiteminfo(itemID,n,Value), where n
-// 0 value_buy;
-// 1 value_sell;
-// 2 type;
-// 3 maxchance = Max drop chance of this item e.g. 1 = 0.01% , etc..
-// if = 0, then monsters don't drop it at all (rare or a quest item)
-// if = 10000, then this item is sold in NPC shops only
-// 4 sex;
-// 5 equip;
-// 6 weight;
-// 7 atk;
-// 8 def;
-// 9 range;
-// 10 slot;
-// 11 look;
-// 12 elv;
-// 13 wlv;
-
-prontera.gat,164,161,5 script Lupus 1013,{
- menu "Make Knife[3] Edible",M_1,
- "Make Apple Equippable",M_2,
- "Edible Knife = Full SP",M_3,
- "Knife = Weapon + 3 Notes",M_4;
- close;
-
-M_1:
- //WORKS!
- mes "Ok. We Made Knife[3] Edible";
- setiteminfo(1201,2,0); //type = 0 : potion
- setitemscript(1201,"{dispbottom \"* You used Knife[3]\";}");
- close;
-
-M_2:
- //WORKS!
- mes "Ok. We Made Apple Equippable";
- //item type -> headgear
- setiteminfo(512,2,5); //type = 5
- //where to equip to
- setiteminfo(512,5,512); //equip = 512
- //set as headgear location
- setiteminfo(512,11,256); //loc = 256
- //set Headgear Sprite ID
- setiteminfo(512,14,85); //view id = 85
-
- setitemscript(512,"{dispbottom \"* Other item's changed\";}",0);
- setitemscript(512,"{dispbottom \"* Equipped\";}",1);
- setitemscript(512,"{dispbottom \"* Unequipped\";}",2);
- close;
-
-M_3:
- //WORKS!
- mes "Ok. Now Edible Knife[3] restores your SP";
- setitemscript(1201,2,0);
- setitemscript(1201,"{dispbottom \"* You ate Knife[3] + Full SP\"; percentheal 0,100;}");
- close;
-
-M_4:
- //WORKS!
- mes "Ok. We Made Knife... a weapon. But added 3 notes.";
- setiteminfo(1201,2,4); //type = 4 : weapon again
- setitemscript(1201,"{dispbottom \"* 1 Used\";}",0);
- setitemscript(1201,"{dispbottom \"* 2 Equipped\";}",1);
- setitemscript(1201,"{dispbottom \"* 3 Unequipped\";}",2);
- close;
-
-}
-
+//by Lupus.
+// SVN TRUNK 9940+ only
+
+//setiteminfo(itemID,n,Value), where n
+// 0 value_buy;
+// 1 value_sell;
+// 2 type;
+// 3 maxchance = Max drop chance of this item e.g. 1 = 0.01% , etc..
+// if = 0, then monsters don't drop it at all (rare or a quest item)
+// if = 10000, then this item is sold in NPC shops only
+// 4 sex;
+// 5 equip;
+// 6 weight;
+// 7 atk;
+// 8 def;
+// 9 range;
+// 10 slot;
+// 11 look;
+// 12 elv;
+// 13 wlv;
+
+prontera.gat,164,161,5 script Lupus 1013,{
+ menu "Make Knife[3] Edible",M_1,
+ "Make Apple Equippable",M_2,
+ "Edible Knife = Full SP",M_3,
+ "Knife = Weapon + 3 Notes",M_4;
+ close;
+
+M_1:
+ //WORKS!
+ mes "Ok. We Made Knife[3] Edible";
+ setiteminfo(1201,2,0); //type = 0 : potion
+ setitemscript(1201,"{dispbottom \"* You used Knife[3]\";}");
+ close;
+
+M_2:
+ //WORKS!
+ mes "Ok. We Made Apple Equippable";
+ //item type -> headgear
+ setiteminfo(512,2,5); //type = 5
+ //where to equip to
+ setiteminfo(512,5,512); //equip = 512
+ //set as headgear location
+ setiteminfo(512,11,256); //loc = 256
+ //set Headgear Sprite ID
+ setiteminfo(512,14,85); //view id = 85
+
+ setitemscript(512,"{dispbottom \"* Other item's changed\";}",0);
+ setitemscript(512,"{dispbottom \"* Equipped\";}",1);
+ setitemscript(512,"{dispbottom \"* Unequipped\";}",2);
+ close;
+
+M_3:
+ //WORKS!
+ mes "Ok. Now Edible Knife[3] restores your SP";
+ setitemscript(1201,2,0);
+ setitemscript(1201,"{dispbottom \"* You ate Knife[3] + Full SP\"; percentheal 0,100;}");
+ close;
+
+M_4:
+ //WORKS!
+ mes "Ok. We Made Knife... a weapon. But added 3 notes.";
+ setiteminfo(1201,2,4); //type = 4 : weapon again
+ setitemscript(1201,"{dispbottom \"* 1 Used\";}",0);
+ setitemscript(1201,"{dispbottom \"* 2 Equipped\";}",1);
+ setitemscript(1201,"{dispbottom \"* 3 Unequipped\";}",2);
+ close;
+
+}
+
diff --git a/sql-files/convert_engine.sql b/sql-files/convert_engine.sql
index 98bdec409..9db50748e 100644
--- a/sql-files/convert_engine.sql
+++ b/sql-files/convert_engine.sql
@@ -1,22 +1,22 @@
---
--- eAthena Database Converter ( InnoDB -> MyISAM ) by Jaguar
---
-
-ALTER TABLE `sc_data` DROP FOREIGN KEY `scdata_ibfk_1`, DROP FOREIGN KEY `scdata_ibfk_2`;
-ALTER TABLE `guild` DROP FOREIGN KEY `guild_ibfk_1`;
-ALTER TABLE `guild_alliance` DROP FOREIGN KEY `guild_alliance_ibfk_1`, DROP FOREIGN KEY `guild_alliance_ibfk_2`;
-ALTER TABLE `guild_expulsion` DROP FOREIGN KEY `guild_expulsion_ibfk_1`;
-ALTER TABLE `guild_member` DROP FOREIGN KEY `guild_member_ibfk_1`, DROP FOREIGN KEY `guild_member_ibfk_2`;
-ALTER TABLE `guild_position` DROP FOREIGN KEY `guild_position_ibfk_1`;
-ALTER TABLE `guild_skill` DROP FOREIGN KEY `guild_skill_ibfk_1`;
-ALTER TABLE `guild_storage` DROP FOREIGN KEY `guild_storage_ibfk_1`;
-ALTER TABLE `sc_data` TYPE = MYISAM;
-ALTER TABLE `login` TYPE = MYISAM;
-ALTER TABLE `char` TYPE = MYISAM;
-ALTER TABLE `guild` TYPE = MYISAM;
-ALTER TABLE `guild_alliance` TYPE = MYISAM;
-ALTER TABLE `guild_expulsion` TYPE = MYISAM;
-ALTER TABLE `guild_member` TYPE = MYISAM;
-ALTER TABLE `guild_position` TYPE = MYISAM;
-ALTER TABLE `guild_skill` TYPE = MYISAM;
-ALTER TABLE `guild_storage` TYPE = MYISAM;
+--
+-- eAthena Database Converter ( InnoDB -> MyISAM ) by Jaguar
+--
+
+ALTER TABLE `sc_data` DROP FOREIGN KEY `scdata_ibfk_1`, DROP FOREIGN KEY `scdata_ibfk_2`;
+ALTER TABLE `guild` DROP FOREIGN KEY `guild_ibfk_1`;
+ALTER TABLE `guild_alliance` DROP FOREIGN KEY `guild_alliance_ibfk_1`, DROP FOREIGN KEY `guild_alliance_ibfk_2`;
+ALTER TABLE `guild_expulsion` DROP FOREIGN KEY `guild_expulsion_ibfk_1`;
+ALTER TABLE `guild_member` DROP FOREIGN KEY `guild_member_ibfk_1`, DROP FOREIGN KEY `guild_member_ibfk_2`;
+ALTER TABLE `guild_position` DROP FOREIGN KEY `guild_position_ibfk_1`;
+ALTER TABLE `guild_skill` DROP FOREIGN KEY `guild_skill_ibfk_1`;
+ALTER TABLE `guild_storage` DROP FOREIGN KEY `guild_storage_ibfk_1`;
+ALTER TABLE `sc_data` TYPE = MYISAM;
+ALTER TABLE `login` TYPE = MYISAM;
+ALTER TABLE `char` TYPE = MYISAM;
+ALTER TABLE `guild` TYPE = MYISAM;
+ALTER TABLE `guild_alliance` TYPE = MYISAM;
+ALTER TABLE `guild_expulsion` TYPE = MYISAM;
+ALTER TABLE `guild_member` TYPE = MYISAM;
+ALTER TABLE `guild_position` TYPE = MYISAM;
+ALTER TABLE `guild_skill` TYPE = MYISAM;
+ALTER TABLE `guild_storage` TYPE = MYISAM;
diff --git a/sql-files/convert_passwords.sql b/sql-files/convert_passwords.sql
index 6d2521e56..86e4c5b08 100644
--- a/sql-files/convert_passwords.sql
+++ b/sql-files/convert_passwords.sql
@@ -1,3 +1,3 @@
-# Convert passwords to MD5 hashes
-
-UPDATE `login` SET `user_pass`=MD5(`user_pass`);
+# Convert passwords to MD5 hashes
+
+UPDATE `login` SET `user_pass`=MD5(`user_pass`);
diff --git a/sql-files/item_db2.sql b/sql-files/item_db2.sql
index 8496bf0da..c7a15306b 100755
--- a/sql-files/item_db2.sql
+++ b/sql-files/item_db2.sql
@@ -1,42 +1,42 @@
-#
-# Table structure for table `item_db2`
-#
-
-DROP TABLE IF EXISTS `item_db2`;
-CREATE TABLE `item_db2` (
- `id` smallint(5) unsigned NOT NULL default '0',
- `name_english` varchar(50) NOT NULL default '',
- `name_japanese` varchar(50) NOT NULL default '',
- `type` tinyint(2) unsigned NOT NULL default '0',
- `price_buy` mediumint(10) unsigned default NULL,
- `price_sell` mediumint(10) unsigned default NULL,
- `weight` smallint(5) unsigned NOT NULL default '0',
- `attack` smallint(3) unsigned default NULL,
- `defence` tinyint(3) unsigned default NULL,
- `range` tinyint(2) unsigned default NULL,
- `slots` tinyint(2) unsigned default NULL,
- `equip_jobs` int(12) unsigned default NULL,
- `equip_upper` tinyint(8) unsigned default NULL,
- `equip_genders` tinyint(2) unsigned default NULL,
- `equip_locations` smallint(4) unsigned default NULL,
- `weapon_level` tinyint(2) unsigned default NULL,
- `equip_level` tinyint(3) unsigned default NULL,
- `refineable` tinyint(1) unsigned default NULL,
- `view` smallint(3) unsigned default NULL,
- `script` text,
- `equip_script` text,
- `unequip_script` text,
- PRIMARY KEY (`id`)
-) TYPE=MyISAM;
-
-# // Items Additional Database - Custom Items go here
-# //
-# // Structure of Database:
-# // ID,Name,Name,Type,Price,Sell,Weight,ATK,DEF,Range,Slot,Job,Upper,Gender,Loc,wLV,eLV,Refineable,View,{ Script },{ OnEquip_Script },{ OnUnequip_Script }
-# //
-# // THQ Quest Items
-# //=============================================================
-# REPLACE INTO `item_db2` VALUES (7950,'THG_Membership','THG Membership',3,NULL,10,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-# REPLACE INTO `item_db2` VALUES (7951,'Token_Bag','Token Bag',3,NULL,10,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-# REPLACE INTO `item_db2` VALUES (1998,'Jeramiah\'s_Jur','Jeramiah\'s Jur',3,NULL,10,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-# REPLACE INTO `item_db2` VALUES (1999,'Zed\'s_Staff','Zed\'s Staff',3,NULL,10,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+#
+# Table structure for table `item_db2`
+#
+
+DROP TABLE IF EXISTS `item_db2`;
+CREATE TABLE `item_db2` (
+ `id` smallint(5) unsigned NOT NULL default '0',
+ `name_english` varchar(50) NOT NULL default '',
+ `name_japanese` varchar(50) NOT NULL default '',
+ `type` tinyint(2) unsigned NOT NULL default '0',
+ `price_buy` mediumint(10) unsigned default NULL,
+ `price_sell` mediumint(10) unsigned default NULL,
+ `weight` smallint(5) unsigned NOT NULL default '0',
+ `attack` smallint(3) unsigned default NULL,
+ `defence` tinyint(3) unsigned default NULL,
+ `range` tinyint(2) unsigned default NULL,
+ `slots` tinyint(2) unsigned default NULL,
+ `equip_jobs` int(12) unsigned default NULL,
+ `equip_upper` tinyint(8) unsigned default NULL,
+ `equip_genders` tinyint(2) unsigned default NULL,
+ `equip_locations` smallint(4) unsigned default NULL,
+ `weapon_level` tinyint(2) unsigned default NULL,
+ `equip_level` tinyint(3) unsigned default NULL,
+ `refineable` tinyint(1) unsigned default NULL,
+ `view` smallint(3) unsigned default NULL,
+ `script` text,
+ `equip_script` text,
+ `unequip_script` text,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+# // Items Additional Database - Custom Items go here
+# //
+# // Structure of Database:
+# // ID,Name,Name,Type,Price,Sell,Weight,ATK,DEF,Range,Slot,Job,Upper,Gender,Loc,wLV,eLV,Refineable,View,{ Script },{ OnEquip_Script },{ OnUnequip_Script }
+# //
+# // THQ Quest Items
+# //=============================================================
+# REPLACE INTO `item_db2` VALUES (7950,'THG_Membership','THG Membership',3,NULL,10,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+# REPLACE INTO `item_db2` VALUES (7951,'Token_Bag','Token Bag',3,NULL,10,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+# REPLACE INTO `item_db2` VALUES (1998,'Jeramiah\'s_Jur','Jeramiah\'s Jur',3,NULL,10,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+# REPLACE INTO `item_db2` VALUES (1999,'Zed\'s_Staff','Zed\'s Staff',3,NULL,10,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
diff --git a/sql-files/logs.sql b/sql-files/logs.sql
index 7a27f8a6a..597e9e0ed 100644
--- a/sql-files/logs.sql
+++ b/sql-files/logs.sql
@@ -1,112 +1,112 @@
-#Pick_Log types (M)onsters Drop, (P)layers Drop/Take, Mobs Drop (L)oot Drop/Take,
-# Players (T)rade Give/Take, Players (V)ending Sell/Take, (S)hop Sell/Take, (N)PC Give/Take,
-# (C)onsumable Items, (A)dministrators Create/Delete
-
-#Database: log
-#Table: picklog
-CREATE TABLE `picklog` (
- `id` int(11) NOT NULL auto_increment,
- `time` datetime NOT NULL default '0000-00-00 00:00:00',
- `char_id` int(11) NOT NULL default '0',
- `type` set('M','P','L','T','V','S','N','C','A') NOT NULL default 'P',
- `nameid` int(11) NOT NULL default '0',
- `amount` int(11) NOT NULL default '1',
- `refine` tinyint(3) unsigned NOT NULL default '0',
- `card0` int(11) NOT NULL default '0',
- `card1` int(11) NOT NULL default '0',
- `card2` int(11) NOT NULL default '0',
- `card3` int(11) NOT NULL default '0',
- `map` varchar(20) NOT NULL default 'prontera.gat',
- PRIMARY KEY (`id`),
- INDEX (`type`)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;
-
-#ZenyLog types (M)onsters,(T)rade,(V)ending Sell/Buy,(S)hop Sell/Buy,(N)PC Change amount,(A)dministrators
-#Database: log
-#Table: zenylog
-CREATE TABLE `zenylog` (
- `id` int(11) NOT NULL auto_increment,
- `time` datetime NOT NULL default '0000-00-00 00:00:00',
- `char_id` int(11) NOT NULL default '0',
- `src_id` int(11) NOT NULL default '0',
- `type` set('M','T','V','S','N','A') NOT NULL default 'S',
- `amount` int(11) NOT NULL default '0',
- `map` varchar(20) NOT NULL default 'prontera.gat',
- PRIMARY KEY (`id`),
- INDEX (`type`)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;
-
-#Database: log
-#Table: branchlog
-CREATE TABLE `branchlog` (
- `branch_id` mediumint(9) unsigned NOT NULL auto_increment,
- `branch_date` datetime NOT NULL default '0000-00-00 00:00:00',
- `account_id` int(11) NOT NULL default '0',
- `char_id` int(11) NOT NULL default '0',
- `char_name` varchar(30) NOT NULL default '',
- `map` varchar(20) NOT NULL default 'prontera.gat',
- PRIMARY KEY (`branch_id`),
- INDEX (`account_id`),
- INDEX (`char_id`)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;
-
-#Database: log
-#Table: mvplog
-CREATE TABLE `mvplog` (
- `mvp_id` mediumint(9) unsigned NOT NULL auto_increment,
- `mvp_date` datetime NOT NULL default '0000-00-00 00:00:00',
- `kill_char_id` int(11) NOT NULL default '0',
- `monster_id` smallint(6) NOT NULL default '0',
- `prize` int(11) NOT NULL default '0',
- `mvpexp` mediumint(9) NOT NULL default '0',
- `map` varchar(20) NOT NULL default 'prontera.gat',
- PRIMARY KEY (`mvp_id`)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;
-
-#Database: log
-#Table: atcommandlog
-CREATE TABLE `atcommandlog` (
- `atcommand_id` mediumint(9) unsigned NOT NULL auto_increment,
- `atcommand_date` datetime NOT NULL default '0000-00-00 00:00:00',
- `account_id` int(11) unsigned NOT NULL default '0',
- `char_id` int(11) unsigned NOT NULL default '0',
- `char_name` varchar(30) NOT NULL default '',
- `map` varchar(20) NOT NULL default 'prontera.gat',
- `command` varchar(50) NOT NULL default '',
- PRIMARY KEY (`atcommand_id`),
- INDEX (`account_id`),
- INDEX (`char_id`)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;
-
-#Database: log
-#Table: npclog
-CREATE TABLE `npclog` (
- `npc_id` mediumint(9) unsigned NOT NULL auto_increment,
- `npc_date` datetime NOT NULL default '0000-00-00 00:00:00',
- `account_id` int(11) unsigned NOT NULL default '0',
- `char_id` int(11) unsigned NOT NULL default '0',
- `char_name` varchar(30) NOT NULL default '',
- `map` varchar(20) NOT NULL default 'prontera.gat',
- `mes` varchar(255) NOT NULL default '',
- PRIMARY KEY (`npc_id`),
- INDEX (`account_id`),
- INDEX (`char_id`)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;
-
-#ChatLOG
-CREATE TABLE `chatlog` (
- `id` bigint(20) NOT NULL auto_increment,
- `time` datetime NOT NULL default '0000-00-00 00:00:00',
- `type` set('W','P','G') NOT NULL default 'W',
- `type_id` int(11) NOT NULL default '0',
- `src_charid` int(11) NOT NULL default '0',
- `src_accountid` int(11) NOT NULL default '0',
- `src_map` varchar(17) NOT NULL default 'prontera.gat',
- `src_map_x` smallint(4) NOT NULL default '0',
- `src_map_y` smallint(4) NOT NULL default '0',
- `dst_charname` varchar(25) NOT NULL default '',
- `message` varchar(150) NOT NULL default '',
- PRIMARY KEY (`id`),
- INDEX (`src_accountid`),
- INDEX (`src_charid`)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;
+#Pick_Log types (M)onsters Drop, (P)layers Drop/Take, Mobs Drop (L)oot Drop/Take,
+# Players (T)rade Give/Take, Players (V)ending Sell/Take, (S)hop Sell/Take, (N)PC Give/Take,
+# (C)onsumable Items, (A)dministrators Create/Delete
+
+#Database: log
+#Table: picklog
+CREATE TABLE `picklog` (
+ `id` int(11) NOT NULL auto_increment,
+ `time` datetime NOT NULL default '0000-00-00 00:00:00',
+ `char_id` int(11) NOT NULL default '0',
+ `type` set('M','P','L','T','V','S','N','C','A') NOT NULL default 'P',
+ `nameid` int(11) NOT NULL default '0',
+ `amount` int(11) NOT NULL default '1',
+ `refine` tinyint(3) unsigned NOT NULL default '0',
+ `card0` int(11) NOT NULL default '0',
+ `card1` int(11) NOT NULL default '0',
+ `card2` int(11) NOT NULL default '0',
+ `card3` int(11) NOT NULL default '0',
+ `map` varchar(20) NOT NULL default 'prontera.gat',
+ PRIMARY KEY (`id`),
+ INDEX (`type`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+#ZenyLog types (M)onsters,(T)rade,(V)ending Sell/Buy,(S)hop Sell/Buy,(N)PC Change amount,(A)dministrators
+#Database: log
+#Table: zenylog
+CREATE TABLE `zenylog` (
+ `id` int(11) NOT NULL auto_increment,
+ `time` datetime NOT NULL default '0000-00-00 00:00:00',
+ `char_id` int(11) NOT NULL default '0',
+ `src_id` int(11) NOT NULL default '0',
+ `type` set('M','T','V','S','N','A') NOT NULL default 'S',
+ `amount` int(11) NOT NULL default '0',
+ `map` varchar(20) NOT NULL default 'prontera.gat',
+ PRIMARY KEY (`id`),
+ INDEX (`type`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+#Database: log
+#Table: branchlog
+CREATE TABLE `branchlog` (
+ `branch_id` mediumint(9) unsigned NOT NULL auto_increment,
+ `branch_date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `account_id` int(11) NOT NULL default '0',
+ `char_id` int(11) NOT NULL default '0',
+ `char_name` varchar(30) NOT NULL default '',
+ `map` varchar(20) NOT NULL default 'prontera.gat',
+ PRIMARY KEY (`branch_id`),
+ INDEX (`account_id`),
+ INDEX (`char_id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+#Database: log
+#Table: mvplog
+CREATE TABLE `mvplog` (
+ `mvp_id` mediumint(9) unsigned NOT NULL auto_increment,
+ `mvp_date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `kill_char_id` int(11) NOT NULL default '0',
+ `monster_id` smallint(6) NOT NULL default '0',
+ `prize` int(11) NOT NULL default '0',
+ `mvpexp` mediumint(9) NOT NULL default '0',
+ `map` varchar(20) NOT NULL default 'prontera.gat',
+ PRIMARY KEY (`mvp_id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+#Database: log
+#Table: atcommandlog
+CREATE TABLE `atcommandlog` (
+ `atcommand_id` mediumint(9) unsigned NOT NULL auto_increment,
+ `atcommand_date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `account_id` int(11) unsigned NOT NULL default '0',
+ `char_id` int(11) unsigned NOT NULL default '0',
+ `char_name` varchar(30) NOT NULL default '',
+ `map` varchar(20) NOT NULL default 'prontera.gat',
+ `command` varchar(50) NOT NULL default '',
+ PRIMARY KEY (`atcommand_id`),
+ INDEX (`account_id`),
+ INDEX (`char_id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+#Database: log
+#Table: npclog
+CREATE TABLE `npclog` (
+ `npc_id` mediumint(9) unsigned NOT NULL auto_increment,
+ `npc_date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `account_id` int(11) unsigned NOT NULL default '0',
+ `char_id` int(11) unsigned NOT NULL default '0',
+ `char_name` varchar(30) NOT NULL default '',
+ `map` varchar(20) NOT NULL default 'prontera.gat',
+ `mes` varchar(255) NOT NULL default '',
+ PRIMARY KEY (`npc_id`),
+ INDEX (`account_id`),
+ INDEX (`char_id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+#ChatLOG
+CREATE TABLE `chatlog` (
+ `id` bigint(20) NOT NULL auto_increment,
+ `time` datetime NOT NULL default '0000-00-00 00:00:00',
+ `type` set('W','P','G') NOT NULL default 'W',
+ `type_id` int(11) NOT NULL default '0',
+ `src_charid` int(11) NOT NULL default '0',
+ `src_accountid` int(11) NOT NULL default '0',
+ `src_map` varchar(17) NOT NULL default 'prontera.gat',
+ `src_map_x` smallint(4) NOT NULL default '0',
+ `src_map_y` smallint(4) NOT NULL default '0',
+ `dst_charname` varchar(25) NOT NULL default '',
+ `message` varchar(150) NOT NULL default '',
+ PRIMARY KEY (`id`),
+ INDEX (`src_accountid`),
+ INDEX (`src_charid`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
diff --git a/sql-files/mail.sql b/sql-files/mail.sql
index 8ec74dcdd..62cc9d65d 100644
--- a/sql-files/mail.sql
+++ b/sql-files/mail.sql
@@ -1,12 +1,12 @@
-CREATE TABLE `mail` (
- `message_id` int(11) NOT NULL auto_increment,
- `to_account_id` int(11) NOT NULL default '0',
- `to_char_name` varchar(24) NOT NULL default '',
- `from_account_id` int(11) NOT NULL default '0',
- `from_char_name` varchar(24) NOT NULL default '',
- `message` varchar(80) NOT NULL default '',
- `read_flag` tinyint(1) NOT NULL default '0',
- `priority` tinyint(1) NOT NULL default '0',
- `check_flag` tinyint(1) NOT NULL default '0',
- PRIMARY KEY (`message_id`)
-) TYPE=MyISAM;
+CREATE TABLE `mail` (
+ `message_id` int(11) NOT NULL auto_increment,
+ `to_account_id` int(11) NOT NULL default '0',
+ `to_char_name` varchar(24) NOT NULL default '',
+ `from_account_id` int(11) NOT NULL default '0',
+ `from_char_name` varchar(24) NOT NULL default '',
+ `message` varchar(80) NOT NULL default '',
+ `read_flag` tinyint(1) NOT NULL default '0',
+ `priority` tinyint(1) NOT NULL default '0',
+ `check_flag` tinyint(1) NOT NULL default '0',
+ PRIMARY KEY (`message_id`)
+) TYPE=MyISAM;
diff --git a/sql-files/main.sql b/sql-files/main.sql
index 155542119..c7c45d3c5 100644
--- a/sql-files/main.sql
+++ b/sql-files/main.sql
@@ -1,578 +1,578 @@
--- MySQL dump 9.11
--- Server version 4.0.24
-
---
--- Table structure for table `cart_inventory`
---
-
-DROP TABLE IF EXISTS `cart_inventory`;
-CREATE TABLE `cart_inventory` (
- `id` int(11) NOT NULL auto_increment,
- `char_id` int(11) NOT NULL default '0',
- `nameid` int(11) NOT NULL default '0',
- `amount` int(11) NOT NULL default '0',
- `equip` mediumint(8) unsigned NOT NULL default '0',
- `identify` smallint(6) NOT NULL default '0',
- `refine` tinyint(3) unsigned NOT NULL default '0',
- `attribute` tinyint(4) NOT NULL default '0',
- `card0` int(11) NOT NULL default '0',
- `card1` int(11) NOT NULL default '0',
- `card2` int(11) NOT NULL default '0',
- `card3` int(11) NOT NULL default '0',
- PRIMARY KEY (`id`),
- KEY `char_id` (`char_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `char`
---
-
-DROP TABLE IF EXISTS `char`;
-CREATE TABLE `char` (
- `char_id` int(11) unsigned NOT NULL auto_increment,
- `account_id` int(11) unsigned NOT NULL default '0',
- `char_num` tinyint(1) NOT NULL default '0',
- `name` varchar(30) NOT NULL default '',
- `class` smallint(6) unsigned NOT NULL default '0',
- `base_level` smallint(6) unsigned NOT NULL default '1',
- `job_level` smallint(6) unsigned NOT NULL default '1',
- `base_exp` bigint(20) unsigned NOT NULL default '0',
- `job_exp` bigint(20) unsigned NOT NULL default '0',
- `zeny` int(11) unsigned NOT NULL default '0',
- `str` smallint(4) unsigned NOT NULL default '0',
- `agi` smallint(4) unsigned NOT NULL default '0',
- `vit` smallint(4) unsigned NOT NULL default '0',
- `int` smallint(4) unsigned NOT NULL default '0',
- `dex` smallint(4) unsigned NOT NULL default '0',
- `luk` smallint(4) unsigned NOT NULL default '0',
- `max_hp` mediumint(8) unsigned NOT NULL default '0',
- `hp` mediumint(8) unsigned NOT NULL default '0',
- `max_sp` mediumint(6) unsigned NOT NULL default '0',
- `sp` mediumint(6) unsigned NOT NULL default '0',
- `status_point` smallint(4) unsigned NOT NULL default '0',
- `skill_point` smallint(4) unsigned NOT NULL default '0',
- `option` int(11) NOT NULL default '0',
- `karma` tinyint(3) NOT NULL default '0',
- `manner` tinyint(3) NOT NULL default '0',
- `party_id` int(11) unsigned NOT NULL default '0',
- `guild_id` int(11) unsigned NOT NULL default '0',
- `pet_id` int(11) unsigned NOT NULL default '0',
- `homun_id` int(11) unsigned NOT NULL default '0',
- `hair` tinyint(4) unsigned NOT NULL default '0',
- `hair_color` smallint(5) unsigned NOT NULL default '0',
- `clothes_color` smallint(5) unsigned NOT NULL default '0',
- `weapon` smallint(6) unsigned NOT NULL default '1',
- `shield` smallint(6) unsigned NOT NULL default '0',
- `head_top` smallint(6) unsigned NOT NULL default '0',
- `head_mid` smallint(6) unsigned NOT NULL default '0',
- `head_bottom` smallint(6) unsigned NOT NULL default '0',
- `last_map` varchar(20) NOT NULL default 'prontera.gat',
- `last_x` smallint(4) unsigned NOT NULL default '53',
- `last_y` smallint(4) unsigned NOT NULL default '111',
- `save_map` varchar(20) NOT NULL default 'prontera.gat',
- `save_x` smallint(4) unsigned NOT NULL default '53',
- `save_y` smallint(4) unsigned NOT NULL default '111',
- `partner_id` int(11) unsigned NOT NULL default '0',
- `online` tinyint(2) NOT NULL default '0',
- `father` int(11) unsigned NOT NULL default '0',
- `mother` int(11) unsigned NOT NULL default '0',
- `child` int(11) unsigned NOT NULL default '0',
- `fame` int(11) unsigned NOT NULL default '0',
- PRIMARY KEY (`char_id`),
- KEY `account_id` (`account_id`),
- KEY `party_id` (`party_id`),
- KEY `guild_id` (`guild_id`),
- KEY `name` (`name`),
- KEY `online` (`online`)
-) TYPE=MyISAM AUTO_INCREMENT=150000;
-
---
--- Table structure for table `charlog`
---
-
-DROP TABLE IF EXISTS `charlog`;
-CREATE TABLE `charlog` (
- `time` datetime NOT NULL default '0000-00-00 00:00:00',
- `char_msg` varchar(255) NOT NULL default 'char select',
- `account_id` int(11) NOT NULL default '0',
- `char_num` tinyint(4) NOT NULL default '0',
- `name` varchar(255) NOT NULL default '',
- `str` int(11) unsigned NOT NULL default '0',
- `agi` int(11) unsigned NOT NULL default '0',
- `vit` int(11) unsigned NOT NULL default '0',
- `int` int(11) unsigned NOT NULL default '0',
- `dex` int(11) unsigned NOT NULL default '0',
- `luk` int(11) unsigned NOT NULL default '0',
- `hair` tinyint(4) NOT NULL default '0',
- `hair_color` int(11) NOT NULL default '0'
-) TYPE=MyISAM;
-
---
--- Table structure for table `friends`
---
-
-DROP TABLE IF EXISTS `friends`;
-CREATE TABLE `friends` (
- `char_id` int(11) NOT NULL default '0',
- `friend_account` int(11) NOT NULL default '0',
- `friend_id` int(11) NOT NULL default '0',
- KEY `char_id` (`char_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `global_reg_value`
---
-
-DROP TABLE IF EXISTS `global_reg_value`;
-CREATE TABLE `global_reg_value` (
- `char_id` int(11) unsigned NOT NULL default '0',
- `str` varchar(255) NOT NULL default '',
- `value` varchar(255) NOT NULL default '0',
- `type` int(11) NOT NULL default '3',
- `account_id` int(11) unsigned NOT NULL default '0',
- PRIMARY KEY (`char_id`,`str`,`account_id`),
- KEY `account_id` (`account_id`),
- KEY `char_id` (`char_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `guild`
---
-
-DROP TABLE IF EXISTS `guild`;
-CREATE TABLE `guild` (
- `guild_id` int(11) unsigned NOT NULL auto_increment,
- `name` varchar(24) NOT NULL default '',
- `char_id` int(11) unsigned NOT NULL default '0',
- `master` varchar(24) NOT NULL default '',
- `guild_lv` tinyint(6) unsigned NOT NULL default '0',
- `connect_member` tinyint(6) unsigned NOT NULL default '0',
- `max_member` tinyint(6) unsigned NOT NULL default '0',
- `average_lv` smallint(6) unsigned NOT NULL default '1',
- `exp` int(11) unsigned NOT NULL default '0',
- `next_exp` int(11) unsigned NOT NULL default '0',
- `skill_point` tinyint(11) unsigned NOT NULL default '0',
- `mes1` varchar(60) NOT NULL default '',
- `mes2` varchar(120) NOT NULL default '',
- `emblem_len` int(11) unsigned NOT NULL default '0',
- `emblem_id` int(11) unsigned NOT NULL default '0',
- `emblem_data` blob,
- PRIMARY KEY (`guild_id`,`char_id`),
- UNIQUE KEY `guild_id` (`guild_id`),
- KEY `char_id` (`char_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `guild_alliance`
---
-
-DROP TABLE IF EXISTS `guild_alliance`;
-CREATE TABLE `guild_alliance` (
- `guild_id` int(11) unsigned NOT NULL default '0',
- `opposition` int(11) unsigned NOT NULL default '0',
- `alliance_id` int(11) unsigned NOT NULL default '0',
- `name` varchar(24) NOT NULL default '',
- PRIMARY KEY (`guild_id`,`alliance_id`),
- KEY `alliance_id` (`alliance_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `guild_castle`
---
-
-DROP TABLE IF EXISTS `guild_castle`;
-CREATE TABLE `guild_castle` (
- `castle_id` int(11) unsigned NOT NULL default '0',
- `guild_id` int(11) unsigned NOT NULL default '0',
- `economy` int(11) unsigned NOT NULL default '0',
- `defense` int(11) unsigned NOT NULL default '0',
- `triggerE` int(11) unsigned NOT NULL default '0',
- `triggerD` int(11) unsigned NOT NULL default '0',
- `nextTime` int(11) unsigned NOT NULL default '0',
- `payTime` int(11) unsigned NOT NULL default '0',
- `createTime` int(11) unsigned NOT NULL default '0',
- `visibleC` int(11) unsigned NOT NULL default '0',
- `visibleG0` int(11) unsigned NOT NULL default '0',
- `visibleG1` int(11) unsigned NOT NULL default '0',
- `visibleG2` int(11) unsigned NOT NULL default '0',
- `visibleG3` int(11) unsigned NOT NULL default '0',
- `visibleG4` int(11) unsigned NOT NULL default '0',
- `visibleG5` int(11) unsigned NOT NULL default '0',
- `visibleG6` int(11) unsigned NOT NULL default '0',
- `visibleG7` int(11) unsigned NOT NULL default '0',
- `gHP0` int(11) unsigned NOT NULL default '0',
- `ghP1` int(11) unsigned NOT NULL default '0',
- `gHP2` int(11) unsigned NOT NULL default '0',
- `gHP3` int(11) unsigned NOT NULL default '0',
- `gHP4` int(11) unsigned NOT NULL default '0',
- `gHP5` int(11) unsigned NOT NULL default '0',
- `gHP6` int(11) unsigned NOT NULL default '0',
- `gHP7` int(11) unsigned NOT NULL default '0',
- PRIMARY KEY (`castle_id`),
- KEY `guild_id` (`guild_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `guild_expulsion`
---
-
-DROP TABLE IF EXISTS `guild_expulsion`;
-CREATE TABLE `guild_expulsion` (
- `guild_id` int(11) unsigned NOT NULL default '0',
- `name` varchar(24) NOT NULL default '',
- `mes` varchar(40) NOT NULL default '',
- `acc` varchar(40) NOT NULL default '',
- `account_id` int(11) unsigned NOT NULL default '0',
- `rsv1` int(11) unsigned NOT NULL default '0',
- `rsv2` int(11) unsigned NOT NULL default '0',
- `rsv3` int(11) unsigned NOT NULL default '0',
- PRIMARY KEY (`guild_id`,`name`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `guild_member`
---
-
-DROP TABLE IF EXISTS `guild_member`;
-CREATE TABLE `guild_member` (
- `guild_id` int(11) unsigned NOT NULL default '0',
- `account_id` int(11) unsigned NOT NULL default '0',
- `char_id` int(11) unsigned NOT NULL default '0',
- `hair` tinyint(6) unsigned NOT NULL default '0',
- `hair_color` smallint(6) unsigned NOT NULL default '0',
- `gender` tinyint(6) unsigned NOT NULL default '0',
- `class` smallint(6) unsigned NOT NULL default '0',
- `lv` smallint(6) unsigned NOT NULL default '0',
- `exp` bigint(20) unsigned NOT NULL default '0',
- `exp_payper` tinyint(11) unsigned NOT NULL default '0',
- `online` tinyint(4) unsigned NOT NULL default '0',
- `position` tinyint(6) unsigned NOT NULL default '0',
- `rsv1` int(11) unsigned NOT NULL default '0',
- `rsv2` int(11) unsigned NOT NULL default '0',
- `name` varchar(24) NOT NULL default '',
- PRIMARY KEY (`guild_id`,`char_id`),
- KEY `char_id` (`char_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `guild_position`
---
-
-DROP TABLE IF EXISTS `guild_position`;
-CREATE TABLE `guild_position` (
- `guild_id` int(9) unsigned NOT NULL default '0',
- `position` tinyint(6) unsigned NOT NULL default '0',
- `name` varchar(24) NOT NULL default '',
- `mode` tinyint(11) unsigned NOT NULL default '0',
- `exp_mode` tinyint(11) unsigned NOT NULL default '0',
- PRIMARY KEY (`guild_id`,`position`),
- KEY `guild_id` (`guild_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `guild_skill`
---
-
-DROP TABLE IF EXISTS `guild_skill`;
-CREATE TABLE `guild_skill` (
- `guild_id` int(11) unsigned NOT NULL default '0',
- `id` smallint(11) unsigned NOT NULL default '0',
- `lv` tinyint(11) unsigned NOT NULL default '0',
- PRIMARY KEY (`guild_id`,`id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `guild_storage`
---
-
-DROP TABLE IF EXISTS `guild_storage`;
-CREATE TABLE `guild_storage` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `guild_id` int(11) unsigned NOT NULL default '0',
- `nameid` int(11) unsigned NOT NULL default '0',
- `amount` int(11) unsigned NOT NULL default '0',
- `equip` mediumint(8) unsigned NOT NULL default '0',
- `identify` smallint(6) unsigned NOT NULL default '0',
- `refine` tinyint(3) unsigned NOT NULL default '0',
- `attribute` tinyint(4) unsigned NOT NULL default '0',
- `card0` smallint(11) NOT NULL default '0',
- `card1` smallint(11) NOT NULL default '0',
- `card2` smallint(11) NOT NULL default '0',
- `card3` smallint(11) NOT NULL default '0',
- PRIMARY KEY (`id`),
- KEY `guild_id` (`guild_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `homunculus`
---
-
-DROP TABLE IF EXISTS `homunculus`;
-CREATE TABLE `homunculus` (
- `homun_id` int(11) NOT NULL auto_increment,
- `char_id` int(11) NOT NULL,
- `class` mediumint(9) unsigned NOT NULL default '0',
- `name` varchar(24) NOT NULL default '',
- `level` smallint(4) NOT NULL default '0',
- `exp` int(12) NOT NULL default '0',
- `intimacy` int(12) NOT NULL default '0',
- `hunger` smallint(4) NOT NULL default '0',
- `str` smallint(4) unsigned NOT NULL default '0',
- `agi` smallint(4) unsigned NOT NULL default '0',
- `vit` smallint(4) unsigned NOT NULL default '0',
- `int` smallint(4) unsigned NOT NULL default '0',
- `dex` smallint(4) unsigned NOT NULL default '0',
- `luk` smallint(4) unsigned NOT NULL default '0',
- `hp` int(12) NOT NULL default '1',
- `max_hp` int(12) NOT NULL default '1',
- `sp` int(12) NOT NULL default '1',
- `max_sp` int(12) NOT NULL default '1',
- `skill_point` smallint(4) unsigned NOT NULL default '0',
- `alive` tinyint(2) NOT NULL default '1',
- `rename_flag` tinyint(2) NOT NULL default '0',
- `vaporize` tinyint(2) NOT NULL default '0',
- PRIMARY KEY (`homun_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `interlog`
---
-
-DROP TABLE IF EXISTS `interlog`;
-CREATE TABLE `interlog` (
- `time` datetime NOT NULL default '0000-00-00 00:00:00',
- `log` varchar(255) NOT NULL default ''
-) TYPE=MyISAM;
-
---
--- Table structure for table `inventory`
---
-
-DROP TABLE IF EXISTS `inventory`;
-CREATE TABLE `inventory` (
- `id` int(11) unsigned NOT NULL auto_increment,
- `char_id` int(11) unsigned NOT NULL default '0',
- `nameid` int(11) unsigned NOT NULL default '0',
- `amount` int(11) unsigned NOT NULL default '0',
- `equip` mediumint(8) unsigned NOT NULL default '0',
- `identify` smallint(6) NOT NULL default '0',
- `refine` tinyint(3) unsigned NOT NULL default '0',
- `attribute` tinyint(4) unsigned NOT NULL default '0',
- `card0` smallint(11) NOT NULL default '0',
- `card1` smallint(11) NOT NULL default '0',
- `card2` smallint(11) NOT NULL default '0',
- `card3` smallint(11) NOT NULL default '0',
- PRIMARY KEY (`id`),
- KEY `char_id` (`char_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `ipbanlist`
---
-
-DROP TABLE IF EXISTS `ipbanlist`;
-CREATE TABLE `ipbanlist` (
- `list` varchar(255) NOT NULL default '',
- `btime` datetime NOT NULL default '0000-00-00 00:00:00',
- `rtime` datetime NOT NULL default '0000-00-00 00:00:00',
- `reason` varchar(255) NOT NULL default '',
- KEY (`list`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `login`
---
-
-DROP TABLE IF EXISTS `login`;
-CREATE TABLE `login` (
- `account_id` int(11) unsigned NOT NULL auto_increment,
- `userid` varchar(255) NOT NULL default '',
- `user_pass` varchar(32) NOT NULL default '',
- `lastlogin` datetime NOT NULL default '0000-00-00 00:00:00',
- `sex` char(1) NOT NULL default 'M',
- `logincount` mediumint(9) unsigned NOT NULL default '0',
- `email` varchar(60) NOT NULL default '',
- `level` tinyint(3) NOT NULL default '0',
- `error_message` smallint(11) unsigned NOT NULL default '0',
- `connect_until` int(11) unsigned NOT NULL default '0',
- `last_ip` varchar(100) NOT NULL default '',
- `memo` smallint(11) unsigned NOT NULL default '0',
- `ban_until` int(11) unsigned NOT NULL default '0',
- `state` int(11) unsigned NOT NULL default '0',
- PRIMARY KEY (`account_id`),
- KEY `name` (`userid`)
-) TYPE=MyISAM AUTO_INCREMENT=2000000;
-
--- added standard accounts for servers, VERY INSECURE!!!
--- inserted into the table called login which is above
-
-INSERT INTO `login` (`account_id`, `userid`, `user_pass`, `sex`, `email`) VALUES ('1', 's1', 'p1', 'S','athena@athena.com');
-
---
--- Table structure for table `mapreg`
---
-
-DROP TABLE IF EXISTS `mapreg`;
-CREATE TABLE `mapreg` (
- `varname` varchar(32) NOT NULL,
- `index` int(11) unsigned NOT NULL default '0',
- `value` varchar(255) NOT NULL,
- KEY `varname` (`varname`),
- KEY `index` (`index`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `sc_data`
---
-
-DROP TABLE IF EXISTS `sc_data`;
-CREATE TABLE `sc_data` (
- `account_id` int(11) unsigned NOT NULL,
- `char_id` int(11) unsigned NOT NULL,
- `type` smallint(11) unsigned NOT NULL,
- `tick` int(11) NOT NULL,
- `val1` int(11) NOT NULL default '0',
- `val2` int(11) NOT NULL default '0',
- `val3` int(11) NOT NULL default '0',
- `val4` int(11) NOT NULL default '0',
- KEY (`account_id`),
- KEY (`char_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `loginlog`
---
-
-DROP TABLE IF EXISTS `loginlog`;
-CREATE TABLE `loginlog` (
- `time` datetime NOT NULL default '0000-00-00 00:00:00',
- `ip` int(10) unsigned NOT NULL default '0',
- `user` varchar(32) NOT NULL default '',
- `rcode` tinyint(4) NOT NULL default '0',
- `log` varchar(255) NOT NULL default '',
- INDEX (`ip`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `memo`
---
-
-DROP TABLE IF EXISTS `memo`;
-CREATE TABLE `memo` (
- `memo_id` int(11) unsigned NOT NULL auto_increment,
- `char_id` int(11) unsigned NOT NULL default '0',
- `map` varchar(255) NOT NULL default '',
- `x` smallint(9) unsigned NOT NULL default '0',
- `y` smallint(9) unsigned NOT NULL default '0',
- PRIMARY KEY (`memo_id`),
- KEY `char_id` (`char_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `party`
---
-
-DROP TABLE IF EXISTS `party`;
-CREATE TABLE `party` (
- `party_id` int(11) unsigned NOT NULL auto_increment,
- `name` char(100) NOT NULL default '',
- `exp` tinyint(11) unsigned NOT NULL default '0',
- `item` tinyint(11) unsigned NOT NULL default '0',
- `leader_id` int(11) unsigned NOT NULL default '0',
- `leader_char` int(11) unsigned NOT NULL default '0',
- PRIMARY KEY (`party_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `pet`
---
-
-DROP TABLE IF EXISTS `pet`;
-CREATE TABLE `pet` (
- `pet_id` int(11) unsigned NOT NULL auto_increment,
- `class` mediumint(9) unsigned NOT NULL default '0',
- `name` varchar(24) NOT NULL default '',
- `account_id` int(11) unsigned NOT NULL default '0',
- `char_id` int(11) unsigned NOT NULL default '0',
- `level` smallint(4) unsigned NOT NULL default '0',
- `egg_id` smallint(11) unsigned NOT NULL default '0',
- `equip` mediumint(8) unsigned NOT NULL default '0',
- `intimate` smallint(9) unsigned NOT NULL default '0',
- `hungry` smallint(9) unsigned NOT NULL default '0',
- `rename_flag` tinyint(4) unsigned NOT NULL default '0',
- `incuvate` int(11) unsigned NOT NULL default '0',
- PRIMARY KEY (`pet_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `ragsrvinfo`
---
-
-DROP TABLE IF EXISTS `ragsrvinfo`;
-CREATE TABLE `ragsrvinfo` (
- `index` int(11) NOT NULL default '0',
- `name` varchar(255) NOT NULL default '',
- `exp` int(11) unsigned NOT NULL default '0',
- `jexp` int(11) unsigned NOT NULL default '0',
- `drop` int(11) unsigned NOT NULL default '0',
- `motd` varchar(255) NOT NULL default ''
-) TYPE=MyISAM;
-
---
--- Table structure for table `skill`
---
-
-DROP TABLE IF EXISTS `skill`;
-CREATE TABLE `skill` (
- `char_id` int(11) unsigned NOT NULL default '0',
- `id` smallint(11) unsigned NOT NULL default '0',
- `lv` tinyint(4) unsigned NOT NULL default '0',
- PRIMARY KEY (`char_id`,`id`),
- KEY `char_id` (`char_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `skill_homunculus`
---
-
-DROP TABLE IF EXISTS `skill_homunculus`;
-CREATE TABLE `skill_homunculus` (
- `homun_id` int(11) NOT NULL,
- `id` int(11) NOT NULL,
- `lv` smallint(6) NOT NULL,
- PRIMARY KEY (`homun_id`,`id`),
- KEY `homun_id` (`homun_id`)
-) TYPE=MyISAM;
-
---
--- Table structure for table `sstatus`
---
-
-DROP TABLE IF EXISTS `sstatus`;
-CREATE TABLE `sstatus` (
- `index` tinyint(4) unsigned NOT NULL default '0',
- `name` varchar(255) NOT NULL default '',
- `user` int(11) unsigned NOT NULL default '0'
-) TYPE=MyISAM;
-
---
--- Table structure for table `storage`
---
-
-DROP TABLE IF EXISTS `storage`;
-CREATE TABLE `storage` (
- `id` int(11) unsigned NOT NULL auto_increment,
- `account_id` int(11) unsigned NOT NULL default '0',
- `nameid` int(11) unsigned NOT NULL default '0',
- `amount` smallint(11) unsigned NOT NULL default '0',
- `equip` mediumint(8) unsigned NOT NULL default '0',
- `identify` smallint(6) unsigned NOT NULL default '0',
- `refine` tinyint(3) unsigned NOT NULL default '0',
- `attribute` tinyint(4) unsigned NOT NULL default '0',
- `card0` smallint(11) NOT NULL default '0',
- `card1` smallint(11) NOT NULL default '0',
- `card2` smallint(11) NOT NULL default '0',
- `card3` smallint(11) NOT NULL default '0',
- PRIMARY KEY (`id`),
- KEY `account_id` (`account_id`)
-) TYPE=MyISAM;
+-- MySQL dump 9.11
+-- Server version 4.0.24
+
+--
+-- Table structure for table `cart_inventory`
+--
+
+DROP TABLE IF EXISTS `cart_inventory`;
+CREATE TABLE `cart_inventory` (
+ `id` int(11) NOT NULL auto_increment,
+ `char_id` int(11) NOT NULL default '0',
+ `nameid` int(11) NOT NULL default '0',
+ `amount` int(11) NOT NULL default '0',
+ `equip` mediumint(8) unsigned NOT NULL default '0',
+ `identify` smallint(6) NOT NULL default '0',
+ `refine` tinyint(3) unsigned NOT NULL default '0',
+ `attribute` tinyint(4) NOT NULL default '0',
+ `card0` int(11) NOT NULL default '0',
+ `card1` int(11) NOT NULL default '0',
+ `card2` int(11) NOT NULL default '0',
+ `card3` int(11) NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ KEY `char_id` (`char_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `char`
+--
+
+DROP TABLE IF EXISTS `char`;
+CREATE TABLE `char` (
+ `char_id` int(11) unsigned NOT NULL auto_increment,
+ `account_id` int(11) unsigned NOT NULL default '0',
+ `char_num` tinyint(1) NOT NULL default '0',
+ `name` varchar(30) NOT NULL default '',
+ `class` smallint(6) unsigned NOT NULL default '0',
+ `base_level` smallint(6) unsigned NOT NULL default '1',
+ `job_level` smallint(6) unsigned NOT NULL default '1',
+ `base_exp` bigint(20) unsigned NOT NULL default '0',
+ `job_exp` bigint(20) unsigned NOT NULL default '0',
+ `zeny` int(11) unsigned NOT NULL default '0',
+ `str` smallint(4) unsigned NOT NULL default '0',
+ `agi` smallint(4) unsigned NOT NULL default '0',
+ `vit` smallint(4) unsigned NOT NULL default '0',
+ `int` smallint(4) unsigned NOT NULL default '0',
+ `dex` smallint(4) unsigned NOT NULL default '0',
+ `luk` smallint(4) unsigned NOT NULL default '0',
+ `max_hp` mediumint(8) unsigned NOT NULL default '0',
+ `hp` mediumint(8) unsigned NOT NULL default '0',
+ `max_sp` mediumint(6) unsigned NOT NULL default '0',
+ `sp` mediumint(6) unsigned NOT NULL default '0',
+ `status_point` smallint(4) unsigned NOT NULL default '0',
+ `skill_point` smallint(4) unsigned NOT NULL default '0',
+ `option` int(11) NOT NULL default '0',
+ `karma` tinyint(3) NOT NULL default '0',
+ `manner` tinyint(3) NOT NULL default '0',
+ `party_id` int(11) unsigned NOT NULL default '0',
+ `guild_id` int(11) unsigned NOT NULL default '0',
+ `pet_id` int(11) unsigned NOT NULL default '0',
+ `homun_id` int(11) unsigned NOT NULL default '0',
+ `hair` tinyint(4) unsigned NOT NULL default '0',
+ `hair_color` smallint(5) unsigned NOT NULL default '0',
+ `clothes_color` smallint(5) unsigned NOT NULL default '0',
+ `weapon` smallint(6) unsigned NOT NULL default '1',
+ `shield` smallint(6) unsigned NOT NULL default '0',
+ `head_top` smallint(6) unsigned NOT NULL default '0',
+ `head_mid` smallint(6) unsigned NOT NULL default '0',
+ `head_bottom` smallint(6) unsigned NOT NULL default '0',
+ `last_map` varchar(20) NOT NULL default 'prontera.gat',
+ `last_x` smallint(4) unsigned NOT NULL default '53',
+ `last_y` smallint(4) unsigned NOT NULL default '111',
+ `save_map` varchar(20) NOT NULL default 'prontera.gat',
+ `save_x` smallint(4) unsigned NOT NULL default '53',
+ `save_y` smallint(4) unsigned NOT NULL default '111',
+ `partner_id` int(11) unsigned NOT NULL default '0',
+ `online` tinyint(2) NOT NULL default '0',
+ `father` int(11) unsigned NOT NULL default '0',
+ `mother` int(11) unsigned NOT NULL default '0',
+ `child` int(11) unsigned NOT NULL default '0',
+ `fame` int(11) unsigned NOT NULL default '0',
+ PRIMARY KEY (`char_id`),
+ KEY `account_id` (`account_id`),
+ KEY `party_id` (`party_id`),
+ KEY `guild_id` (`guild_id`),
+ KEY `name` (`name`),
+ KEY `online` (`online`)
+) TYPE=MyISAM AUTO_INCREMENT=150000;
+
+--
+-- Table structure for table `charlog`
+--
+
+DROP TABLE IF EXISTS `charlog`;
+CREATE TABLE `charlog` (
+ `time` datetime NOT NULL default '0000-00-00 00:00:00',
+ `char_msg` varchar(255) NOT NULL default 'char select',
+ `account_id` int(11) NOT NULL default '0',
+ `char_num` tinyint(4) NOT NULL default '0',
+ `name` varchar(255) NOT NULL default '',
+ `str` int(11) unsigned NOT NULL default '0',
+ `agi` int(11) unsigned NOT NULL default '0',
+ `vit` int(11) unsigned NOT NULL default '0',
+ `int` int(11) unsigned NOT NULL default '0',
+ `dex` int(11) unsigned NOT NULL default '0',
+ `luk` int(11) unsigned NOT NULL default '0',
+ `hair` tinyint(4) NOT NULL default '0',
+ `hair_color` int(11) NOT NULL default '0'
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `friends`
+--
+
+DROP TABLE IF EXISTS `friends`;
+CREATE TABLE `friends` (
+ `char_id` int(11) NOT NULL default '0',
+ `friend_account` int(11) NOT NULL default '0',
+ `friend_id` int(11) NOT NULL default '0',
+ KEY `char_id` (`char_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `global_reg_value`
+--
+
+DROP TABLE IF EXISTS `global_reg_value`;
+CREATE TABLE `global_reg_value` (
+ `char_id` int(11) unsigned NOT NULL default '0',
+ `str` varchar(255) NOT NULL default '',
+ `value` varchar(255) NOT NULL default '0',
+ `type` int(11) NOT NULL default '3',
+ `account_id` int(11) unsigned NOT NULL default '0',
+ PRIMARY KEY (`char_id`,`str`,`account_id`),
+ KEY `account_id` (`account_id`),
+ KEY `char_id` (`char_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `guild`
+--
+
+DROP TABLE IF EXISTS `guild`;
+CREATE TABLE `guild` (
+ `guild_id` int(11) unsigned NOT NULL auto_increment,
+ `name` varchar(24) NOT NULL default '',
+ `char_id` int(11) unsigned NOT NULL default '0',
+ `master` varchar(24) NOT NULL default '',
+ `guild_lv` tinyint(6) unsigned NOT NULL default '0',
+ `connect_member` tinyint(6) unsigned NOT NULL default '0',
+ `max_member` tinyint(6) unsigned NOT NULL default '0',
+ `average_lv` smallint(6) unsigned NOT NULL default '1',
+ `exp` int(11) unsigned NOT NULL default '0',
+ `next_exp` int(11) unsigned NOT NULL default '0',
+ `skill_point` tinyint(11) unsigned NOT NULL default '0',
+ `mes1` varchar(60) NOT NULL default '',
+ `mes2` varchar(120) NOT NULL default '',
+ `emblem_len` int(11) unsigned NOT NULL default '0',
+ `emblem_id` int(11) unsigned NOT NULL default '0',
+ `emblem_data` blob,
+ PRIMARY KEY (`guild_id`,`char_id`),
+ UNIQUE KEY `guild_id` (`guild_id`),
+ KEY `char_id` (`char_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `guild_alliance`
+--
+
+DROP TABLE IF EXISTS `guild_alliance`;
+CREATE TABLE `guild_alliance` (
+ `guild_id` int(11) unsigned NOT NULL default '0',
+ `opposition` int(11) unsigned NOT NULL default '0',
+ `alliance_id` int(11) unsigned NOT NULL default '0',
+ `name` varchar(24) NOT NULL default '',
+ PRIMARY KEY (`guild_id`,`alliance_id`),
+ KEY `alliance_id` (`alliance_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `guild_castle`
+--
+
+DROP TABLE IF EXISTS `guild_castle`;
+CREATE TABLE `guild_castle` (
+ `castle_id` int(11) unsigned NOT NULL default '0',
+ `guild_id` int(11) unsigned NOT NULL default '0',
+ `economy` int(11) unsigned NOT NULL default '0',
+ `defense` int(11) unsigned NOT NULL default '0',
+ `triggerE` int(11) unsigned NOT NULL default '0',
+ `triggerD` int(11) unsigned NOT NULL default '0',
+ `nextTime` int(11) unsigned NOT NULL default '0',
+ `payTime` int(11) unsigned NOT NULL default '0',
+ `createTime` int(11) unsigned NOT NULL default '0',
+ `visibleC` int(11) unsigned NOT NULL default '0',
+ `visibleG0` int(11) unsigned NOT NULL default '0',
+ `visibleG1` int(11) unsigned NOT NULL default '0',
+ `visibleG2` int(11) unsigned NOT NULL default '0',
+ `visibleG3` int(11) unsigned NOT NULL default '0',
+ `visibleG4` int(11) unsigned NOT NULL default '0',
+ `visibleG5` int(11) unsigned NOT NULL default '0',
+ `visibleG6` int(11) unsigned NOT NULL default '0',
+ `visibleG7` int(11) unsigned NOT NULL default '0',
+ `gHP0` int(11) unsigned NOT NULL default '0',
+ `ghP1` int(11) unsigned NOT NULL default '0',
+ `gHP2` int(11) unsigned NOT NULL default '0',
+ `gHP3` int(11) unsigned NOT NULL default '0',
+ `gHP4` int(11) unsigned NOT NULL default '0',
+ `gHP5` int(11) unsigned NOT NULL default '0',
+ `gHP6` int(11) unsigned NOT NULL default '0',
+ `gHP7` int(11) unsigned NOT NULL default '0',
+ PRIMARY KEY (`castle_id`),
+ KEY `guild_id` (`guild_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `guild_expulsion`
+--
+
+DROP TABLE IF EXISTS `guild_expulsion`;
+CREATE TABLE `guild_expulsion` (
+ `guild_id` int(11) unsigned NOT NULL default '0',
+ `name` varchar(24) NOT NULL default '',
+ `mes` varchar(40) NOT NULL default '',
+ `acc` varchar(40) NOT NULL default '',
+ `account_id` int(11) unsigned NOT NULL default '0',
+ `rsv1` int(11) unsigned NOT NULL default '0',
+ `rsv2` int(11) unsigned NOT NULL default '0',
+ `rsv3` int(11) unsigned NOT NULL default '0',
+ PRIMARY KEY (`guild_id`,`name`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `guild_member`
+--
+
+DROP TABLE IF EXISTS `guild_member`;
+CREATE TABLE `guild_member` (
+ `guild_id` int(11) unsigned NOT NULL default '0',
+ `account_id` int(11) unsigned NOT NULL default '0',
+ `char_id` int(11) unsigned NOT NULL default '0',
+ `hair` tinyint(6) unsigned NOT NULL default '0',
+ `hair_color` smallint(6) unsigned NOT NULL default '0',
+ `gender` tinyint(6) unsigned NOT NULL default '0',
+ `class` smallint(6) unsigned NOT NULL default '0',
+ `lv` smallint(6) unsigned NOT NULL default '0',
+ `exp` bigint(20) unsigned NOT NULL default '0',
+ `exp_payper` tinyint(11) unsigned NOT NULL default '0',
+ `online` tinyint(4) unsigned NOT NULL default '0',
+ `position` tinyint(6) unsigned NOT NULL default '0',
+ `rsv1` int(11) unsigned NOT NULL default '0',
+ `rsv2` int(11) unsigned NOT NULL default '0',
+ `name` varchar(24) NOT NULL default '',
+ PRIMARY KEY (`guild_id`,`char_id`),
+ KEY `char_id` (`char_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `guild_position`
+--
+
+DROP TABLE IF EXISTS `guild_position`;
+CREATE TABLE `guild_position` (
+ `guild_id` int(9) unsigned NOT NULL default '0',
+ `position` tinyint(6) unsigned NOT NULL default '0',
+ `name` varchar(24) NOT NULL default '',
+ `mode` tinyint(11) unsigned NOT NULL default '0',
+ `exp_mode` tinyint(11) unsigned NOT NULL default '0',
+ PRIMARY KEY (`guild_id`,`position`),
+ KEY `guild_id` (`guild_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `guild_skill`
+--
+
+DROP TABLE IF EXISTS `guild_skill`;
+CREATE TABLE `guild_skill` (
+ `guild_id` int(11) unsigned NOT NULL default '0',
+ `id` smallint(11) unsigned NOT NULL default '0',
+ `lv` tinyint(11) unsigned NOT NULL default '0',
+ PRIMARY KEY (`guild_id`,`id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `guild_storage`
+--
+
+DROP TABLE IF EXISTS `guild_storage`;
+CREATE TABLE `guild_storage` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `guild_id` int(11) unsigned NOT NULL default '0',
+ `nameid` int(11) unsigned NOT NULL default '0',
+ `amount` int(11) unsigned NOT NULL default '0',
+ `equip` mediumint(8) unsigned NOT NULL default '0',
+ `identify` smallint(6) unsigned NOT NULL default '0',
+ `refine` tinyint(3) unsigned NOT NULL default '0',
+ `attribute` tinyint(4) unsigned NOT NULL default '0',
+ `card0` smallint(11) NOT NULL default '0',
+ `card1` smallint(11) NOT NULL default '0',
+ `card2` smallint(11) NOT NULL default '0',
+ `card3` smallint(11) NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ KEY `guild_id` (`guild_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `homunculus`
+--
+
+DROP TABLE IF EXISTS `homunculus`;
+CREATE TABLE `homunculus` (
+ `homun_id` int(11) NOT NULL auto_increment,
+ `char_id` int(11) NOT NULL,
+ `class` mediumint(9) unsigned NOT NULL default '0',
+ `name` varchar(24) NOT NULL default '',
+ `level` smallint(4) NOT NULL default '0',
+ `exp` int(12) NOT NULL default '0',
+ `intimacy` int(12) NOT NULL default '0',
+ `hunger` smallint(4) NOT NULL default '0',
+ `str` smallint(4) unsigned NOT NULL default '0',
+ `agi` smallint(4) unsigned NOT NULL default '0',
+ `vit` smallint(4) unsigned NOT NULL default '0',
+ `int` smallint(4) unsigned NOT NULL default '0',
+ `dex` smallint(4) unsigned NOT NULL default '0',
+ `luk` smallint(4) unsigned NOT NULL default '0',
+ `hp` int(12) NOT NULL default '1',
+ `max_hp` int(12) NOT NULL default '1',
+ `sp` int(12) NOT NULL default '1',
+ `max_sp` int(12) NOT NULL default '1',
+ `skill_point` smallint(4) unsigned NOT NULL default '0',
+ `alive` tinyint(2) NOT NULL default '1',
+ `rename_flag` tinyint(2) NOT NULL default '0',
+ `vaporize` tinyint(2) NOT NULL default '0',
+ PRIMARY KEY (`homun_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `interlog`
+--
+
+DROP TABLE IF EXISTS `interlog`;
+CREATE TABLE `interlog` (
+ `time` datetime NOT NULL default '0000-00-00 00:00:00',
+ `log` varchar(255) NOT NULL default ''
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `inventory`
+--
+
+DROP TABLE IF EXISTS `inventory`;
+CREATE TABLE `inventory` (
+ `id` int(11) unsigned NOT NULL auto_increment,
+ `char_id` int(11) unsigned NOT NULL default '0',
+ `nameid` int(11) unsigned NOT NULL default '0',
+ `amount` int(11) unsigned NOT NULL default '0',
+ `equip` mediumint(8) unsigned NOT NULL default '0',
+ `identify` smallint(6) NOT NULL default '0',
+ `refine` tinyint(3) unsigned NOT NULL default '0',
+ `attribute` tinyint(4) unsigned NOT NULL default '0',
+ `card0` smallint(11) NOT NULL default '0',
+ `card1` smallint(11) NOT NULL default '0',
+ `card2` smallint(11) NOT NULL default '0',
+ `card3` smallint(11) NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ KEY `char_id` (`char_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `ipbanlist`
+--
+
+DROP TABLE IF EXISTS `ipbanlist`;
+CREATE TABLE `ipbanlist` (
+ `list` varchar(255) NOT NULL default '',
+ `btime` datetime NOT NULL default '0000-00-00 00:00:00',
+ `rtime` datetime NOT NULL default '0000-00-00 00:00:00',
+ `reason` varchar(255) NOT NULL default '',
+ KEY (`list`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `login`
+--
+
+DROP TABLE IF EXISTS `login`;
+CREATE TABLE `login` (
+ `account_id` int(11) unsigned NOT NULL auto_increment,
+ `userid` varchar(255) NOT NULL default '',
+ `user_pass` varchar(32) NOT NULL default '',
+ `lastlogin` datetime NOT NULL default '0000-00-00 00:00:00',
+ `sex` char(1) NOT NULL default 'M',
+ `logincount` mediumint(9) unsigned NOT NULL default '0',
+ `email` varchar(60) NOT NULL default '',
+ `level` tinyint(3) NOT NULL default '0',
+ `error_message` smallint(11) unsigned NOT NULL default '0',
+ `connect_until` int(11) unsigned NOT NULL default '0',
+ `last_ip` varchar(100) NOT NULL default '',
+ `memo` smallint(11) unsigned NOT NULL default '0',
+ `ban_until` int(11) unsigned NOT NULL default '0',
+ `state` int(11) unsigned NOT NULL default '0',
+ PRIMARY KEY (`account_id`),
+ KEY `name` (`userid`)
+) TYPE=MyISAM AUTO_INCREMENT=2000000;
+
+-- added standard accounts for servers, VERY INSECURE!!!
+-- inserted into the table called login which is above
+
+INSERT INTO `login` (`account_id`, `userid`, `user_pass`, `sex`, `email`) VALUES ('1', 's1', 'p1', 'S','athena@athena.com');
+
+--
+-- Table structure for table `mapreg`
+--
+
+DROP TABLE IF EXISTS `mapreg`;
+CREATE TABLE `mapreg` (
+ `varname` varchar(32) NOT NULL,
+ `index` int(11) unsigned NOT NULL default '0',
+ `value` varchar(255) NOT NULL,
+ KEY `varname` (`varname`),
+ KEY `index` (`index`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `sc_data`
+--
+
+DROP TABLE IF EXISTS `sc_data`;
+CREATE TABLE `sc_data` (
+ `account_id` int(11) unsigned NOT NULL,
+ `char_id` int(11) unsigned NOT NULL,
+ `type` smallint(11) unsigned NOT NULL,
+ `tick` int(11) NOT NULL,
+ `val1` int(11) NOT NULL default '0',
+ `val2` int(11) NOT NULL default '0',
+ `val3` int(11) NOT NULL default '0',
+ `val4` int(11) NOT NULL default '0',
+ KEY (`account_id`),
+ KEY (`char_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `loginlog`
+--
+
+DROP TABLE IF EXISTS `loginlog`;
+CREATE TABLE `loginlog` (
+ `time` datetime NOT NULL default '0000-00-00 00:00:00',
+ `ip` int(10) unsigned NOT NULL default '0',
+ `user` varchar(32) NOT NULL default '',
+ `rcode` tinyint(4) NOT NULL default '0',
+ `log` varchar(255) NOT NULL default '',
+ INDEX (`ip`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `memo`
+--
+
+DROP TABLE IF EXISTS `memo`;
+CREATE TABLE `memo` (
+ `memo_id` int(11) unsigned NOT NULL auto_increment,
+ `char_id` int(11) unsigned NOT NULL default '0',
+ `map` varchar(255) NOT NULL default '',
+ `x` smallint(9) unsigned NOT NULL default '0',
+ `y` smallint(9) unsigned NOT NULL default '0',
+ PRIMARY KEY (`memo_id`),
+ KEY `char_id` (`char_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `party`
+--
+
+DROP TABLE IF EXISTS `party`;
+CREATE TABLE `party` (
+ `party_id` int(11) unsigned NOT NULL auto_increment,
+ `name` char(100) NOT NULL default '',
+ `exp` tinyint(11) unsigned NOT NULL default '0',
+ `item` tinyint(11) unsigned NOT NULL default '0',
+ `leader_id` int(11) unsigned NOT NULL default '0',
+ `leader_char` int(11) unsigned NOT NULL default '0',
+ PRIMARY KEY (`party_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `pet`
+--
+
+DROP TABLE IF EXISTS `pet`;
+CREATE TABLE `pet` (
+ `pet_id` int(11) unsigned NOT NULL auto_increment,
+ `class` mediumint(9) unsigned NOT NULL default '0',
+ `name` varchar(24) NOT NULL default '',
+ `account_id` int(11) unsigned NOT NULL default '0',
+ `char_id` int(11) unsigned NOT NULL default '0',
+ `level` smallint(4) unsigned NOT NULL default '0',
+ `egg_id` smallint(11) unsigned NOT NULL default '0',
+ `equip` mediumint(8) unsigned NOT NULL default '0',
+ `intimate` smallint(9) unsigned NOT NULL default '0',
+ `hungry` smallint(9) unsigned NOT NULL default '0',
+ `rename_flag` tinyint(4) unsigned NOT NULL default '0',
+ `incuvate` int(11) unsigned NOT NULL default '0',
+ PRIMARY KEY (`pet_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `ragsrvinfo`
+--
+
+DROP TABLE IF EXISTS `ragsrvinfo`;
+CREATE TABLE `ragsrvinfo` (
+ `index` int(11) NOT NULL default '0',
+ `name` varchar(255) NOT NULL default '',
+ `exp` int(11) unsigned NOT NULL default '0',
+ `jexp` int(11) unsigned NOT NULL default '0',
+ `drop` int(11) unsigned NOT NULL default '0',
+ `motd` varchar(255) NOT NULL default ''
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `skill`
+--
+
+DROP TABLE IF EXISTS `skill`;
+CREATE TABLE `skill` (
+ `char_id` int(11) unsigned NOT NULL default '0',
+ `id` smallint(11) unsigned NOT NULL default '0',
+ `lv` tinyint(4) unsigned NOT NULL default '0',
+ PRIMARY KEY (`char_id`,`id`),
+ KEY `char_id` (`char_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `skill_homunculus`
+--
+
+DROP TABLE IF EXISTS `skill_homunculus`;
+CREATE TABLE `skill_homunculus` (
+ `homun_id` int(11) NOT NULL,
+ `id` int(11) NOT NULL,
+ `lv` smallint(6) NOT NULL,
+ PRIMARY KEY (`homun_id`,`id`),
+ KEY `homun_id` (`homun_id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `sstatus`
+--
+
+DROP TABLE IF EXISTS `sstatus`;
+CREATE TABLE `sstatus` (
+ `index` tinyint(4) unsigned NOT NULL default '0',
+ `name` varchar(255) NOT NULL default '',
+ `user` int(11) unsigned NOT NULL default '0'
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `storage`
+--
+
+DROP TABLE IF EXISTS `storage`;
+CREATE TABLE `storage` (
+ `id` int(11) unsigned NOT NULL auto_increment,
+ `account_id` int(11) unsigned NOT NULL default '0',
+ `nameid` int(11) unsigned NOT NULL default '0',
+ `amount` smallint(11) unsigned NOT NULL default '0',
+ `equip` mediumint(8) unsigned NOT NULL default '0',
+ `identify` smallint(6) unsigned NOT NULL default '0',
+ `refine` tinyint(3) unsigned NOT NULL default '0',
+ `attribute` tinyint(4) unsigned NOT NULL default '0',
+ `card0` smallint(11) NOT NULL default '0',
+ `card1` smallint(11) NOT NULL default '0',
+ `card2` smallint(11) NOT NULL default '0',
+ `card3` smallint(11) NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ KEY `account_id` (`account_id`)
+) TYPE=MyISAM;
diff --git a/sql-files/oA2eA-rc5.sql b/sql-files/oA2eA-rc5.sql
index 2e30fa4b8..b501b232c 100644
--- a/sql-files/oA2eA-rc5.sql
+++ b/sql-files/oA2eA-rc5.sql
@@ -1,204 +1,204 @@
-//
-// When converting from oA to eA, my oA db was in ragnarok so I created
-// a new db called eragnarok and then ran the following commands...
-//
-// /usr/local/mysql/bin/mysql -Deragnarok -u eragnarok -p< athena/sql-files/main.sql
-// /usr/local/mysql/bin/mysql -Deragnarok -u eragnarok -p< athena/sql-files/db_tables.sql
-// /usr/local/mysql/bin/mysql -Deragnarok -u eragnarok -p< athena/sql-files/mail.sql
-// /usr/local/mysql/bin/mysql -Deragnarok -u eragnarok -p< athena/sql-files/oA2eA-rc5.sql
-//
-// This creates a eragnarok database and fills everything in from the oA
-// database.
-//
-// -- MouseJstr
-
-CREATE TABLE `item_db` (
- `id` smallint(5) unsigned NOT NULL default '0',
- `name_english` varchar(24) NOT NULL default '',
- `name_japanese` varchar(24) NOT NULL default '',
- `type` tinyint(2) unsigned NOT NULL default '0',
- `price_buy` int(10) unsigned default NULL,
- `price_sell` int(10) unsigned default NULL,
- `weight` int(10) unsigned NOT NULL default '0',
- `attack` mediumint(9) unsigned default NULL,
- `defence` mediumint(9) unsigned default NULL,
- `range` tinyint(2) unsigned default NULL,
- `slots` tinyint(1) unsigned default NULL,
- `equip_jobs` mediumint(8) unsigned default NULL,
- `equip_genders` tinyint(1) unsigned default NULL,
- `equip_locations` smallint(4) unsigned default NULL,
- `weapon_level` tinyint(1) unsigned default NULL,
- `equip_level` tinyint(3) unsigned default NULL,
- `view` tinyint(3) unsigned default NULL,
- `script_use` text,
- `script_equip` text,
- PRIMARY KEY (`id`)
-) TYPE=MyISAM;
-
-CREATE TABLE `mob_db` (
- `ID` mediumint(9) NOT NULL default '0',
- `Name` text NOT NULL,
- `Name2` text NOT NULL,
- `LV` smallint(6) NOT NULL default '0',
- `HP` mediumint(9) NOT NULL default '0',
- `SP` mediumint(9) NOT NULL default '0',
- `EXP` mediumint(9) NOT NULL default '0',
- `JEXP` mediumint(9) NOT NULL default '0',
- `Range1` tinyint(4) NOT NULL default '0',
- `ATK1` smallint(6) NOT NULL default '0',
- `ATK2` smallint(6) NOT NULL default '0',
- `DEF` smallint(6) NOT NULL default '0',
- `MDEF` smallint(6) NOT NULL default '0',
- `STR` tinyint(4) NOT NULL default '0',
- `AGI` tinyint(4) NOT NULL default '0',
- `VIT` tinyint(4) NOT NULL default '0',
- `INT` tinyint(4) NOT NULL default '0',
- `DEX` tinyint(4) NOT NULL default '0',
- `LUK` tinyint(4) NOT NULL default '0',
- `Range2` tinyint(4) NOT NULL default '0',
- `Range3` tinyint(4) NOT NULL default '0',
- `Scale` tinyint(4) NOT NULL default '0',
- `Race` tinyint(4) NOT NULL default '0',
- `Element` tinyint(4) NOT NULL default '0',
- `Mode` smallint(6) NOT NULL default '0',
- `Speed` smallint(6) NOT NULL default '0',
- `ADelay` smallint(6) NOT NULL default '0',
- `aMotion` smallint(6) NOT NULL default '0',
- `dMotion` smallint(6) NOT NULL default '0',
- `Drop1id` mediumint(9) NOT NULL default '0',
- `Drop1per` mediumint(9) NOT NULL default '0',
- `Drop2id` mediumint(9) NOT NULL default '0',
- `Drop2per` mediumint(9) NOT NULL default '0',
- `Drop3id` mediumint(9) NOT NULL default '0',
- `Drop3per` mediumint(9) NOT NULL default '0',
- `Drop4id` mediumint(9) NOT NULL default '0',
- `Drop4per` mediumint(9) NOT NULL default '0',
- `Drop5id` mediumint(9) NOT NULL default '0',
- `Drop5per` mediumint(9) NOT NULL default '0',
- `Drop6id` mediumint(9) NOT NULL default '0',
- `Drop6per` mediumint(9) NOT NULL default '0',
- `Drop7id` mediumint(9) NOT NULL default '0',
- `Drop7per` mediumint(9) NOT NULL default '0',
- `Drop8id` mediumint(9) NOT NULL default '0',
- `Drop8per` mediumint(9) NOT NULL default '0',
- `MEXP` mediumint(9) NOT NULL default '0',
- `ExpPer` mediumint(9) NOT NULL default '0',
- `MVP1id` mediumint(9) NOT NULL default '0',
- `MVP1per` mediumint(9) NOT NULL default '0',
- `MVP2id` mediumint(9) NOT NULL default '0',
- `MVP2per` mediumint(9) NOT NULL default '0',
- `MVP3id` mediumint(9) NOT NULL default '0',
- `MVP3per` mediumint(9) NOT NULL default '0'
-) TYPE=MyISAM;
-
-INSERT INTO eragnarok.storage(`id`, `account_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`) SELECT `id`, `account_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3` from ragnarok.storage;
-
- INSERT INTO eragnarok.cart_inventory(`id`, `char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `broken`) SELECT `id`, `char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `broken` from ragnarok.cart_inventory;
-
-INSERT INTO eragnarok.char( `char_id`, `account_id`, `char_num`, `name`, `class`, `base_level`, `job_level`, `base_exp`, `job_exp`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`, `max_sp`, `sp`, `status_point`, `skill_point`, `option`, `karma`, `manner`, `party_id`, `guild_id`, `pet_id`, `hair`, `hair_color`, `clothes_color`, `weapon`, `shield`, `head_top`, `head_mid`, `head_bottom`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`, `partner_id`, `online`) SELECT `char_id`, `account_id`, `char_num`, `name`, `class`, `base_level`, `job_level`, `base_exp`, `job_exp`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`, `max_sp`, `sp`, `status_point`, `skill_point`, `option`, `karma`, `manner`, `party_id`, `guild_id`, `pet_id`, `hair`, `hair_color`, `clothes_color`, `weapon`, `shield`, `head_top`, `head_mid`, `head_bottom`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`, `partner_id`, `online` from ragnarok.char;
-
-INSERT INTO eragnarok.charlog( `time`, `char_msg`, `account_id`, `char_num`, `name`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hair`, `hair_color` ) SELECT `time`, `char_msg`, `account_id`, `char_num`, `name`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hair`, `hair_color` from ragnarok.charlog;
-
-INSERT INTO eragnarok.global_reg_value ( `char_id`, `str`, `value`, `type`, `account_id`) SELECT `char_id`, `str`, `value`, `type`, `account_id` from ragnarok.global_reg_value ;
-
-INSERT INTO eragnarok.guild( `guild_id`, `name`, `master`, `guild_lv`, `connect_member`, `max_member`, `average_lv`, `exp`, `next_exp`, `skill_point`, `castle_id`, `mes1`, `mes2`, `emblem_len`, `emblem_id`, `emblem_data` ) SELECT `guild_id`, `name`, `master`, `guild_lv`, `connect_member`, `max_member`, `average_lv`, `exp`, `next_exp`, `skill_point`, `castle_id`, `mes1`, `mes2`, `emblem_len`, `emblem_id`, `emblem_data` from ragnarok.guild;
-
-INSERT INTO eragnarok.guild_alliance ( `guild_id`, `opposition`, `alliance_id`, `name` ) SELECT `guild_id`, `opposition`, `alliance_id`, `name` from ragnarok.guild_alliance ;
-
-INSERT INTO eragnarok.guild_castle ( `castle_id`, `guild_id`, `economy`, `defense`, `triggerE`, `triggerD`, `nextTime`, `payTime`, `createTime`, `visibleC`, `visibleG0`, `visibleG1`, `visibleG2`, `visibleG3`, `visibleG4`, `visibleG5`, `visibleG6`, `visibleG7` ) SELECT `castle_id`, `guild_id`, `economy`, `defense`, `triggerE`, `triggerD`, `nextTime`, `payTime`, `createTime`, `visibleC`, `visibleG0`, `visibleG1`, `visibleG2`, `visibleG3`, `visibleG4`, `visibleG5`, `visibleG6`, `visibleG7` from ragnarok.guild_castle ;
-
-INSERT INTO eragnarok.guild_expulsion ( `guild_id`, `name`, `mes`, `acc`, `account_id`, `rsv1`, `rsv2`, `rsv3` ) SELECT `guild_id`, `name`, `mes`, `acc`, `account_id`, `rsv1`, `rsv2`, `rsv3` from ragnarok.guild_expulsion ;
-
-INSERT INTO eragnarok.guild_member ( `guild_id`, `account_id`, `char_id`, `hair`, `hair_color`, `gender`, `class`, `lv`, `exp`, `exp_payper`, `online`, `position`, `rsv1`, `rsv2`, `name` ) SELECT `guild_id`, `account_id`, `char_id`, `hair`, `hair_color`, `gender`, `class`, `lv`, `exp`, `exp_payper`, `online`, `position`, `rsv1`, `rsv2`, `name` from ragnarok.guild_member ;
-
-INSERT INTO eragnarok.guild_position ( `guild_id`, `position`, `name`, `mode`, `exp_mode` ) SELECT `guild_id`, `position`, `name`, `mode`, `exp_mode` from ragnarok.guild_position ;
-
-INSERT INTO eragnarok.guild_skill ( `guild_id`, `id`, `lv` ) SELECT `guild_id`, `id`, `lv` from ragnarok.guild_skill ;
-
-INSERT INTO eragnarok.guild_storage ( `id`, `guild_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3` ) SELECT `id`, `guild_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3` from ragnarok.guild_storage ;
-
-INSERT INTO eragnarok.interlog ( `time`, `log` ) SELECT `time`, `log` from ragnarok.interlog ;
-
-INSERT INTO eragnarok.inventory ( `id`, `char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3` ) SELECT `id`, `char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3` from ragnarok.inventory ;
-
-INSERT INTO eragnarok.ipbanlist ( `list`, `btime`, `rtime`, `reason` ) SELECT `list`, `btime`, `rtime`, `reason` from ragnarok.ipbanlist ;
-
-
-# INSERT INTO eragnarok.login_error ( `err_id`, `reason` ) SELECT `err_id`, `reason` from ragnarok.login_error ;
-
-INSERT INTO eragnarok.loginlog ( `time`, `ip`, `user`, `rcode`, `log` ) SELECT `time`, `ip`, `user`, `rcode`, `log` from ragnarok.loginlog ;
-
-INSERT INTO eragnarok.memo ( `memo_id`, `char_id`, `map`, `x`, `y` ) SELECT `memo_id`, `char_id`, `map`, `x`, `y` from ragnarok.memo ;
-
-INSERT INTO eragnarok.party ( `party_id`, `name`, `exp`, `item`, `leader_id` ) SELECT `party_id`, `name`, `exp`, `item`, `leader_id` from ragnarok.party ;
-
-INSERT INTO eragnarok.pet ( `pet_id`, `class`, `name`, `account_id`, `char_id`, `level`, `egg_id`, `equip`, `intimate`, `hungry`, `rename_flag`, `incuvate` ) SELECT `pet_id`, `class`, `name`, `account_id`, `char_id`, `level`, `egg_id`, `equip`, `intimate`, `hungry`, `rename_flag`, `incuvate` from ragnarok.pet ;
-
-INSERT INTO eragnarok.ragsrvinfo ( `index`, `name`, `exp`, `jexp`, `drop` ) SELECT `index`, `name`, `exp`, `jexp`, `drop` from ragnarok.ragsrvinfo ;
-
-INSERT INTO eragnarok.skill ( `char_id`, `id`, `lv` ) SELECT `char_id`, `id`, `lv` from ragnarok.skill ;
-
-INSERT INTO eragnarok.sstatus ( `index`, `name`, `user` ) SELECT `index`, `name`, `user` from ragnarok.sstatus ;
-
-
-# INSERT INTO eragnarok.abra_db ( `ID`, `Dummy`, `Req_Lvl`, `Per`, `Comment`) SELECT `ID`, `Dummy`, `Req_Lvl`, `Per`, `Comment` from ragnarok.abra_db;
-
-# INSERT INTO eragnarok.attr_fix ( `Level`, `None`, `Water`, `Earth`, `Fire`, `Wind`, `Poison`, `Saint`, `Darkness`, `Sense`, `Immortality`, `Comment`) SELECT `Level`, `None`, `Water`, `Earth`, `Fire`, `Wind`, `Poison`, `Saint`, `Darkness`, `Sense`, `Immortality`, `Comment` from ragnarok.attr_fix;
-
-# INSERT INTO eragnarok.cast_db ( `ID`, `Cast_List`, `Delay_List`, `Upkeep_Time`, `Upkeep_Time2`, `Comment` ) SELECT `ID`, `Cast_List`, `Delay_List`, `Upkeep_Time`, `Upkeep_Time2`, `Comment` from ragnarok.cast_db;
-
-#INSERT INTO eragnarok.castle_db ( `CastleID`, `map_name`, `castle_name`, `switch_flag`, `Comment` ) SELECT `CastleID`, `map_name`, `castle_name`, `switch_flag`, `Comment` from ragnarok.castle_db;
-
-#INSERT INTO eragnarok.create_arrow_db ( `SourceID`, `MakeID1`, `MakeNum1`, `MakeID2`, `MakeNum2`, `MakeID3`, `MakeNum3`, `MakeID4`, `MakeNum4`, `MakeID5`, `MakeNum5`, `Comment` ) SELECT `SourceID`, `MakeID1`, `MakeNum1`, `MakeID2`, `MakeNum2`, `MakeID3`, `MakeNum3`, `MakeID4`, `MakeNum4`, `MakeID5`, `MakeNum5`, `Comment` from ragnarok.create_arrow_db;
-
-#INSERT INTO eragnarok.exp ( `EXP1`, `EXP2`, `EXP3`, `EXP4`, `EXP5`, `EXP6`, `EXP7`, `EXP8`, `EXP9`, `EXP10`, `EXP11`, `EXP12`, `EXP13`, `EXP14` ) SELECT `EXP1`, `EXP2`, `EXP3`, `EXP4`, `EXP5`, `EXP6`, `EXP7`, `EXP8`, `EXP9`, `EXP10`, `EXP11`, `EXP12`, `EXP13`, `EXP14` from ragnarok.exp;
-
-#INSERT INTO eragnarok.exp_guild ( `Level`, `EXP`, `Comment` ) SELECT `Level`, `EXP`, `Comment` from ragnarok.exp_guild;
-
-#INSERT INTO eragnarok.item_bluebox ( `NameID`, `item_name`, `rate`, `Comment` ) SELECT `NameID`, `item_name`, `rate`, `Comment` from ragnarok.item_bluebox;
-
-#INSERT INTO eragnarok.item_cardalbum ( `NameID`, `item_name`, `rate`, `Comment` ) SELECT `NameID`, `item_name`, `rate`, `Comment` from ragnarok.item_cardalbum;
-
-INSERT INTO eragnarok.item_db2 ( `ID`, `Name`, `Name2`, `Type`, `Price`, `Sell`, `Weight`, `ATK`, `DEF`, `Range`, `Slot`, `Job`, `Gender`, `Loc`, `wLV`, `eLV`, `View`, `UseScript`, `EquipScript`, `Comment` ) SELECT `ID`, `Name`, `Name2`, `Type`, `Price`, `Sell`, `Weight`, `ATK`, `DEF`, `Range`, `Slot`, `Job`, `Gender`, `Loc`, `wLV`, `eLV`, `View`, `UseScript`, `EquipScript`, `Comment` from ragnarok.item_db2;
-
-# INSERT INTO eragnarok.item_giftbox ( `NameID`, `item_name`, `rate`, `Comment` ) SELECT `NameID`, `item_name`, `rate`, `Comment` from ragnarok.item_giftbox;
-
-#INSERT INTO eragnarok.item_scroll ( `NameID`, `item_name`, `rate`, `Comment` ) SELECT `NameID`, `item_name`, `rate`, `Comment` from ragnarok.item_scroll;
-
-#INSERT INTO eragnarok.item_violetbox ( `NameID`, `item_name`, `rate`, `Comment` ) SELECT `NameID`, `item_name`, `rate`, `Comment` from ragnarok.item_violetbox;
-
-#INSERT INTO eragnarok.job_db1 ( `Class_ID`, `Weight`, `HP`, `HP2`, `SP`, `Empty`, `Dagger`, `Sword`, `Two_Handed_Sword`, `Spear`, `Two_Handed_Spear`, `Axe`, `Two_Handed_Axe`, `Rod`, `Club`, `Stick`, `Bow`, `Fist`, `Musical`, `Whip`, `Book`, `Katar`, `Comment` ) SELECT `Class_ID`, `Weight`, `HP`, `HP2`, `SP`, `Empty`, `Dagger`, `Sword`, `Two_Handed_Sword`, `Spear`, `Two_Handed_Spear`, `Axe`, `Two_Handed_Axe`, `Rod`, `Club`, `Stick`, `Bow`, `Fist`, `Musical`, `Whip`, `Book`, `Katar`, `Comment` from ragnarok.job_db1;
-
-INSERT INTO eragnarok.mob_boss ( `MobID`, `MobName`, `Rate`, `Comment` ) SELECT `MobID`, `MobName`, `Rate`, `Comment` from ragnarok.mob_boss;
-
-INSERT INTO eragnarok.mob_branch ( `MobID`, `MobName`, `Rate`, `Comment` ) SELECT `MobID`, `MobName`, `Rate`, `Comment` from ragnarok.mob_branch;
-
-INSERT INTO eragnarok.mob_db2 ( `ID`, `Name`, `Name2`, `LV`, `HP`, `SP`, `EXP`, `JEXP`, `Range1`, `ATK1`, `ATK2`, `DEF`, `MDEF`, `STR`, `AGI`, `VIT`, `INT`, `DEX`, `LUK`, `Range2`, `Range3`, `Scale`, `Race`, `Element`, `Mode`, `Speed`, `ADelay`, `aMotion`, `dMotion`, `Drop1id`, `Drop1per`, `Drop2id`, `Drop2per`, `Drop3id`, `Drop3per`, `Drop4id`, `Drop4per`, `Drop5id`, `Drop5per`, `Drop6id`, `Drop6per`, `Drop7d`, `Drop7per`, `Drop8id`, `Drop8per`, `Item1`, `Item2`, `MEXP`, `ExpPer`, `MVP1id`, `MVP1per`, `MVP2id`, `MVP2per`, `MVP3id`, `MVP3per`, `Comment` ) SELECT `ID`, `Name`, `Name2`, `LV`, `HP`, `SP`, `EXP`, `JEXP`, `Range1`, `ATK1`, `ATK2`, `DEF`, `MDEF`, `STR`, `AGI`, `VIT`, `INT`, `DEX`, `LUK`, `Range2`, `Range3`, `Scale`, `Race`, `Element`, `Mode`, `Speed`, `ADelay`, `aMotion`, `dMotion`, `Drop1id`, `Drop1per`, `Drop2id`, `Drop2per`, `Drop3id`, `Drop3per`, `Drop4id`, `Drop4per`, `Drop5id`, `Drop5per`, `Drop6id`, `Drop6per`, `Drop7d`, `Drop7per`, `Drop8id`, `Drop8per`, `Item1`, `Item2`, `MEXP`, `ExpPer`, `MVP1id`, `MVP1per`, `MVP2id`, `MVP2per`, `MVP3id`, `MVP3per`, `Comment` from ragnarok.mob_db2;
-
-INSERT INTO eragnarok.mob_poring ( `MobID`, `MobName`, `Rate`, `Comment` ) SELECT `MobID`, `MobName`, `Rate`, `Comment` from ragnarok.mob_poring;
-
-INSERT INTO eragnarok.mob_skill_db ( `Mob_ID`, `Dummy`, `State`, `Skill_ID`, `Skill_LV`, `Use_Rate`, `Cast_Time`, `Delay`, `Disturbance`, `Target`, `Condition_Type`, `Condition_Value`, `Value1`, `Value2`, `Value3`, `Value4`, `Value5`, `Comment` ) SELECT `Mob_ID`, `Dummy`, `State`, `Skill_ID`, `Skill_LV`, `Use_Rate`, `Cast_Time`, `Delay`, `Disturbance`, `Target`, `Condition_Type`, `Condition_Value`, `Value1`, `Value2`, `Value3`, `Value4`, `Value5`, `Comment` from ragnarok.mob_skill_db;
-
-#INSERT INTO eragnarok.pet_db ( `MobID`, `Name`, `JName`, `ItemID`, `EggID`, `AcceID`, `FoodID`, `Fullness`, `HungryDeray`, `R_Hungry`, `R_Full`, `Intimate`, `Die`, `Capture`, `Speed`, `S_Performance`, `Talk_Convert_Class`, `Attack_Rate`, `Defence_Attack_Rate`, `Change_Target_Rate`, `Pet_Script`, `Comment` ) SELECT `MobID`, `Name`, `JName`, `ItemID`, `EggID`, `AcceID`, `FoodID`, `Fullness`, `HungryDeray`, `R_Hungry`, `R_Full`, `Intimate`, `Die`, `Capture`, `Speed`, `S_Performance`, `Talk_Convert_Class`, `Attack_Rate`, `Defence_Attack_Rate`, `Change_Target_Rate`, `Pet_Script`, `Comment` from ragnarok.pet_db;
-
-#INSERT INTO eragnarok.produce_db ( `ID`, `ItemLV`, `RequireSkill`, `MaterialID1`, `MaterialAmount1`, `MaterialID2`, `MaterialAmount2`, `MaterialID3`, `MaterialAmount3`, `MaterialID4`, `MaterialAmount4`, `MaterialID5`, `MaterialAmount5`, `Comment` ) SELECT `ID`, `ItemLV`, `RequireSkill`, `MaterialID1`, `MaterialAmount1`, `MaterialID2`, `MaterialAmount2`, `MaterialID3`, `MaterialAmount3`, `MaterialID4`, `MaterialAmount4`, `MaterialID5`, `MaterialAmount5`, `Comment` from ragnarok.produce_db;
-
-#INSERT INTO eragnarok.refine_db ( `Refine_Bonus`, `Danger_Bonus`, `Safe_Limit`, `RefineChance1`, `RefineChance2`, `RefineChance3`, `RefineChance4`, `RefineChance5`, `RefineChance6`, `RefineChance7`, `RefineChance8`, `RefineChance9`, `RefineChance10`, `Comment` ) SELECT `Refine_Bonus`, `Danger_Bonus`, `Safe_Limit`, `RefineChance1`, `RefineChance2`, `RefineChance3`, `RefineChance4`, `RefineChance5`, `RefineChance6`, `RefineChance7`, `RefineChance8`, `RefineChance9`, `RefineChance10`, `Comment` from ragnarok.refine_db;
-
-#INSERT INTO eragnarok.size_fix ( `Element`, `Dagger`, `Sword`, `Two_Handed_Sword`, `Spear`, `Two_Handed_Spear`, `Axe`, `Two_Handed_Axe`, `Club`, `Whip`, `Stick`, `Bow`, `Fist`, `Musical`, `Rod`, `Book`, `Katar`, `Comment` ) SELECT `Element`, `Dagger`, `Sword`, `Two_Handed_Sword`, `Spear`, `Two_Handed_Spear`, `Axe`, `Two_Handed_Axe`, `Club`, `Whip`, `Stick`, `Bow`, `Fist`, `Musical`, `Rod`, `Book`, `Katar`, `Comment` from ragnarok.size_fix;
-
-#INSERT INTO eragnarok.skill_db ( `ID`, `Range`, `Hit`, `inf`, `nk`, `max`, `list_num`, `castcancel`, `cast_defence_rate`, `inf2`, `maxcount`, `skill_type`, `blow_count`, `Comment` ) SELECT `ID`, `Range`, `Hit`, `inf`, `nk`, `max`, `list_num`, `castcancel`, `cast_defence_rate`, `inf2`, `maxcount`, `skill_type`, `blow_count`, `Comment` from ragnarok.skill_db;
-
-#INSERT INTO eragnarok.skill_require_db ( `ID`, `List_HP`, `List_SP`, `List_HP_Rate`, `List_SP_Rate`, `List_Zeny`, `List_Weapon`, `State`, `Spiritball`, `ItemID1`, `Amount1`, `ItemID2`, `Amount2`, `ItemID3`, `Amount3`, `ItemID4`, `Amount4`, `ItemID5`, `Amount5`, `ItemID6`, `Amount6`, `ItemID7`, `Amount7`, `ItemID8`, `Amount8`, `ItemID9`, `Amount9`, `ItemID10`, `Amount10`, `Comment` ) SELECT `ID`, `List_HP`, `List_SP`, `List_HP_Rate`, `List_SP_Rate`, `List_Zeny`, `List_Weapon`, `State`, `Spiritball`, `ItemID1`, `Amount1`, `ItemID2`, `Amount2`, `ItemID3`, `Amount3`, `ItemID4`, `Amount4`, `ItemID5`, `Amount5`, `ItemID6`, `Amount6`, `ItemID7`, `Amount7`, `ItemID8`, `Amount8`, `ItemID9`, `Amount9`, `ItemID10`, `Amount10`, `Comment` from ragnarok.skill_require_db;
-
-#INSERT INTO eragnarok.skill_tree ( `Upper`, `JobNo`, `Skill_ID`, `MaxLV`, `Skill_ID_Require1`, `Skill_LV_Require1`, `Skill_ID_Require2`, `Skill_LV_Require2`, `Skill_ID_Require3`, `Skill_LV_Require3`, `Skill_ID_Require4`, `Skill_LV_Require4`, `Skill_ID_Require5`, `Skill_LV_Require5`, `Comment` ) SELECT `Upper`, `JobNo`, `Skill_ID`, `MaxLV`, `Skill_ID_Require1`, `Skill_LV_Require1`, `Skill_ID_Require2`, `Skill_LV_Require2`, `Skill_ID_Require3`, `Skill_LV_Require3`, `Skill_ID_Require4`, `Skill_LV_Require4`, `Skill_ID_Require5`, `Skill_LV_Require5`, `Comment` from ragnarok.skill_tree;
-
-INSERT INTO eragnarok.item_db ( `id`, `name_english`, `name_japanese`, `type`, `price_buy`, `price_sell`, `weight`, `attack`, `defence`, `range`, `slots`, `equip_jobs`, `equip_genders`, `equip_locations`, `weapon_level`, `equip_level`, `view`, `script_use`, `script_equip` ) SELECT `id`, `Name`, `Name2`, `type`, `Price`, `Sell`, `Weight`, `Atk`, `Def`, `range`, `Slot`, `Job`, `Gender`, `Loc`, `wLV`, `eLV`, `view`, `UseScript`, `EquipScript` from ragnarok.item_db;
-
-UPDATE item_db SET price_sell = price_buy/2;
-
-INSERT INTO eragnarok.mob_db (`ID`, `Name`, `Name2`, `LV`, `HP`, `SP`, `EXP`, `JEXP`, `Range1`, `ATK1`, `ATK2`, `DEF`, `MDEF`, `STR`, `AGI`, `VIT`, `INT`, `DEX`, `LUK`, `Range2`, `Range3`, `Scale`, `Race`, `Element`, `Mode`, `Speed`, `ADelay`, `aMotion`, `dMotion`, `Drop1id`, `Drop1per`, `Drop2id`, `Drop2per`, `Drop3id`, `Drop3per`, `Drop4id`, `Drop4per`, `Drop5id`, `Drop5per`, `Drop6id`, `Drop6per`, `Drop7id`, `Drop7per`, `Drop8id`, `Drop8per`, `MEXP`, `ExpPer`, `MVP1id`, `MVP1per`, `MVP2id`, `MVP2per`, `MVP3id`, `MVP3per`) SELECT `ID`, `Name`, `Name2`, `LV`, `HP`, `SP`, `EXP`, `JEXP`, `Range1`, `ATK1`, `ATK2`, `DEF`, `MDEF`, `STR`, `AGI`, `VIT`, `INT`, `DEX`, `LUK`, `Range2`, `Range3`, `Scale`, `Race`, `Element`, `Mode`, `Speed`, `ADelay`, `aMotion`, `dMotion`, `Drop1id`, `Drop1per`, `Drop2id`, `Drop2per`, `Drop3id`, `Drop3per`, `Drop4id`, `Drop4per`, `Drop5id`, `Drop5per`, `Drop6id`, `Drop6per`, `Drop7id`, `Drop7per`, `Drop8id`, `Drop8per`, `MEXP`, `ExpPer`, `MVP1id`, `MVP1per`, `MVP2id`, `MVP2per`, `MVP3id`, `MVP3per` from ragnarok.mob_db;
-
-DELETE FROM eragnarok.login;
-
-INSERT INTO eragnarok.login ( `account_id`, `userid`, `user_pass`, `lastlogin`, `sex`, `logincount`, `email`, `level` ) SELECT `account_id`, `userid`, `user_pass`, `lastlogin`, `sex`, `logincount`, `email`, `level` from ragnarok.login ;
+//
+// When converting from oA to eA, my oA db was in ragnarok so I created
+// a new db called eragnarok and then ran the following commands...
+//
+// /usr/local/mysql/bin/mysql -Deragnarok -u eragnarok -p< athena/sql-files/main.sql
+// /usr/local/mysql/bin/mysql -Deragnarok -u eragnarok -p< athena/sql-files/db_tables.sql
+// /usr/local/mysql/bin/mysql -Deragnarok -u eragnarok -p< athena/sql-files/mail.sql
+// /usr/local/mysql/bin/mysql -Deragnarok -u eragnarok -p< athena/sql-files/oA2eA-rc5.sql
+//
+// This creates a eragnarok database and fills everything in from the oA
+// database.
+//
+// -- MouseJstr
+
+CREATE TABLE `item_db` (
+ `id` smallint(5) unsigned NOT NULL default '0',
+ `name_english` varchar(24) NOT NULL default '',
+ `name_japanese` varchar(24) NOT NULL default '',
+ `type` tinyint(2) unsigned NOT NULL default '0',
+ `price_buy` int(10) unsigned default NULL,
+ `price_sell` int(10) unsigned default NULL,
+ `weight` int(10) unsigned NOT NULL default '0',
+ `attack` mediumint(9) unsigned default NULL,
+ `defence` mediumint(9) unsigned default NULL,
+ `range` tinyint(2) unsigned default NULL,
+ `slots` tinyint(1) unsigned default NULL,
+ `equip_jobs` mediumint(8) unsigned default NULL,
+ `equip_genders` tinyint(1) unsigned default NULL,
+ `equip_locations` smallint(4) unsigned default NULL,
+ `weapon_level` tinyint(1) unsigned default NULL,
+ `equip_level` tinyint(3) unsigned default NULL,
+ `view` tinyint(3) unsigned default NULL,
+ `script_use` text,
+ `script_equip` text,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+CREATE TABLE `mob_db` (
+ `ID` mediumint(9) NOT NULL default '0',
+ `Name` text NOT NULL,
+ `Name2` text NOT NULL,
+ `LV` smallint(6) NOT NULL default '0',
+ `HP` mediumint(9) NOT NULL default '0',
+ `SP` mediumint(9) NOT NULL default '0',
+ `EXP` mediumint(9) NOT NULL default '0',
+ `JEXP` mediumint(9) NOT NULL default '0',
+ `Range1` tinyint(4) NOT NULL default '0',
+ `ATK1` smallint(6) NOT NULL default '0',
+ `ATK2` smallint(6) NOT NULL default '0',
+ `DEF` smallint(6) NOT NULL default '0',
+ `MDEF` smallint(6) NOT NULL default '0',
+ `STR` tinyint(4) NOT NULL default '0',
+ `AGI` tinyint(4) NOT NULL default '0',
+ `VIT` tinyint(4) NOT NULL default '0',
+ `INT` tinyint(4) NOT NULL default '0',
+ `DEX` tinyint(4) NOT NULL default '0',
+ `LUK` tinyint(4) NOT NULL default '0',
+ `Range2` tinyint(4) NOT NULL default '0',
+ `Range3` tinyint(4) NOT NULL default '0',
+ `Scale` tinyint(4) NOT NULL default '0',
+ `Race` tinyint(4) NOT NULL default '0',
+ `Element` tinyint(4) NOT NULL default '0',
+ `Mode` smallint(6) NOT NULL default '0',
+ `Speed` smallint(6) NOT NULL default '0',
+ `ADelay` smallint(6) NOT NULL default '0',
+ `aMotion` smallint(6) NOT NULL default '0',
+ `dMotion` smallint(6) NOT NULL default '0',
+ `Drop1id` mediumint(9) NOT NULL default '0',
+ `Drop1per` mediumint(9) NOT NULL default '0',
+ `Drop2id` mediumint(9) NOT NULL default '0',
+ `Drop2per` mediumint(9) NOT NULL default '0',
+ `Drop3id` mediumint(9) NOT NULL default '0',
+ `Drop3per` mediumint(9) NOT NULL default '0',
+ `Drop4id` mediumint(9) NOT NULL default '0',
+ `Drop4per` mediumint(9) NOT NULL default '0',
+ `Drop5id` mediumint(9) NOT NULL default '0',
+ `Drop5per` mediumint(9) NOT NULL default '0',
+ `Drop6id` mediumint(9) NOT NULL default '0',
+ `Drop6per` mediumint(9) NOT NULL default '0',
+ `Drop7id` mediumint(9) NOT NULL default '0',
+ `Drop7per` mediumint(9) NOT NULL default '0',
+ `Drop8id` mediumint(9) NOT NULL default '0',
+ `Drop8per` mediumint(9) NOT NULL default '0',
+ `MEXP` mediumint(9) NOT NULL default '0',
+ `ExpPer` mediumint(9) NOT NULL default '0',
+ `MVP1id` mediumint(9) NOT NULL default '0',
+ `MVP1per` mediumint(9) NOT NULL default '0',
+ `MVP2id` mediumint(9) NOT NULL default '0',
+ `MVP2per` mediumint(9) NOT NULL default '0',
+ `MVP3id` mediumint(9) NOT NULL default '0',
+ `MVP3per` mediumint(9) NOT NULL default '0'
+) TYPE=MyISAM;
+
+INSERT INTO eragnarok.storage(`id`, `account_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`) SELECT `id`, `account_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3` from ragnarok.storage;
+
+ INSERT INTO eragnarok.cart_inventory(`id`, `char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `broken`) SELECT `id`, `char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `broken` from ragnarok.cart_inventory;
+
+INSERT INTO eragnarok.char( `char_id`, `account_id`, `char_num`, `name`, `class`, `base_level`, `job_level`, `base_exp`, `job_exp`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`, `max_sp`, `sp`, `status_point`, `skill_point`, `option`, `karma`, `manner`, `party_id`, `guild_id`, `pet_id`, `hair`, `hair_color`, `clothes_color`, `weapon`, `shield`, `head_top`, `head_mid`, `head_bottom`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`, `partner_id`, `online`) SELECT `char_id`, `account_id`, `char_num`, `name`, `class`, `base_level`, `job_level`, `base_exp`, `job_exp`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`, `max_sp`, `sp`, `status_point`, `skill_point`, `option`, `karma`, `manner`, `party_id`, `guild_id`, `pet_id`, `hair`, `hair_color`, `clothes_color`, `weapon`, `shield`, `head_top`, `head_mid`, `head_bottom`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`, `partner_id`, `online` from ragnarok.char;
+
+INSERT INTO eragnarok.charlog( `time`, `char_msg`, `account_id`, `char_num`, `name`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hair`, `hair_color` ) SELECT `time`, `char_msg`, `account_id`, `char_num`, `name`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hair`, `hair_color` from ragnarok.charlog;
+
+INSERT INTO eragnarok.global_reg_value ( `char_id`, `str`, `value`, `type`, `account_id`) SELECT `char_id`, `str`, `value`, `type`, `account_id` from ragnarok.global_reg_value ;
+
+INSERT INTO eragnarok.guild( `guild_id`, `name`, `master`, `guild_lv`, `connect_member`, `max_member`, `average_lv`, `exp`, `next_exp`, `skill_point`, `castle_id`, `mes1`, `mes2`, `emblem_len`, `emblem_id`, `emblem_data` ) SELECT `guild_id`, `name`, `master`, `guild_lv`, `connect_member`, `max_member`, `average_lv`, `exp`, `next_exp`, `skill_point`, `castle_id`, `mes1`, `mes2`, `emblem_len`, `emblem_id`, `emblem_data` from ragnarok.guild;
+
+INSERT INTO eragnarok.guild_alliance ( `guild_id`, `opposition`, `alliance_id`, `name` ) SELECT `guild_id`, `opposition`, `alliance_id`, `name` from ragnarok.guild_alliance ;
+
+INSERT INTO eragnarok.guild_castle ( `castle_id`, `guild_id`, `economy`, `defense`, `triggerE`, `triggerD`, `nextTime`, `payTime`, `createTime`, `visibleC`, `visibleG0`, `visibleG1`, `visibleG2`, `visibleG3`, `visibleG4`, `visibleG5`, `visibleG6`, `visibleG7` ) SELECT `castle_id`, `guild_id`, `economy`, `defense`, `triggerE`, `triggerD`, `nextTime`, `payTime`, `createTime`, `visibleC`, `visibleG0`, `visibleG1`, `visibleG2`, `visibleG3`, `visibleG4`, `visibleG5`, `visibleG6`, `visibleG7` from ragnarok.guild_castle ;
+
+INSERT INTO eragnarok.guild_expulsion ( `guild_id`, `name`, `mes`, `acc`, `account_id`, `rsv1`, `rsv2`, `rsv3` ) SELECT `guild_id`, `name`, `mes`, `acc`, `account_id`, `rsv1`, `rsv2`, `rsv3` from ragnarok.guild_expulsion ;
+
+INSERT INTO eragnarok.guild_member ( `guild_id`, `account_id`, `char_id`, `hair`, `hair_color`, `gender`, `class`, `lv`, `exp`, `exp_payper`, `online`, `position`, `rsv1`, `rsv2`, `name` ) SELECT `guild_id`, `account_id`, `char_id`, `hair`, `hair_color`, `gender`, `class`, `lv`, `exp`, `exp_payper`, `online`, `position`, `rsv1`, `rsv2`, `name` from ragnarok.guild_member ;
+
+INSERT INTO eragnarok.guild_position ( `guild_id`, `position`, `name`, `mode`, `exp_mode` ) SELECT `guild_id`, `position`, `name`, `mode`, `exp_mode` from ragnarok.guild_position ;
+
+INSERT INTO eragnarok.guild_skill ( `guild_id`, `id`, `lv` ) SELECT `guild_id`, `id`, `lv` from ragnarok.guild_skill ;
+
+INSERT INTO eragnarok.guild_storage ( `id`, `guild_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3` ) SELECT `id`, `guild_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3` from ragnarok.guild_storage ;
+
+INSERT INTO eragnarok.interlog ( `time`, `log` ) SELECT `time`, `log` from ragnarok.interlog ;
+
+INSERT INTO eragnarok.inventory ( `id`, `char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3` ) SELECT `id`, `char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3` from ragnarok.inventory ;
+
+INSERT INTO eragnarok.ipbanlist ( `list`, `btime`, `rtime`, `reason` ) SELECT `list`, `btime`, `rtime`, `reason` from ragnarok.ipbanlist ;
+
+
+# INSERT INTO eragnarok.login_error ( `err_id`, `reason` ) SELECT `err_id`, `reason` from ragnarok.login_error ;
+
+INSERT INTO eragnarok.loginlog ( `time`, `ip`, `user`, `rcode`, `log` ) SELECT `time`, `ip`, `user`, `rcode`, `log` from ragnarok.loginlog ;
+
+INSERT INTO eragnarok.memo ( `memo_id`, `char_id`, `map`, `x`, `y` ) SELECT `memo_id`, `char_id`, `map`, `x`, `y` from ragnarok.memo ;
+
+INSERT INTO eragnarok.party ( `party_id`, `name`, `exp`, `item`, `leader_id` ) SELECT `party_id`, `name`, `exp`, `item`, `leader_id` from ragnarok.party ;
+
+INSERT INTO eragnarok.pet ( `pet_id`, `class`, `name`, `account_id`, `char_id`, `level`, `egg_id`, `equip`, `intimate`, `hungry`, `rename_flag`, `incuvate` ) SELECT `pet_id`, `class`, `name`, `account_id`, `char_id`, `level`, `egg_id`, `equip`, `intimate`, `hungry`, `rename_flag`, `incuvate` from ragnarok.pet ;
+
+INSERT INTO eragnarok.ragsrvinfo ( `index`, `name`, `exp`, `jexp`, `drop` ) SELECT `index`, `name`, `exp`, `jexp`, `drop` from ragnarok.ragsrvinfo ;
+
+INSERT INTO eragnarok.skill ( `char_id`, `id`, `lv` ) SELECT `char_id`, `id`, `lv` from ragnarok.skill ;
+
+INSERT INTO eragnarok.sstatus ( `index`, `name`, `user` ) SELECT `index`, `name`, `user` from ragnarok.sstatus ;
+
+
+# INSERT INTO eragnarok.abra_db ( `ID`, `Dummy`, `Req_Lvl`, `Per`, `Comment`) SELECT `ID`, `Dummy`, `Req_Lvl`, `Per`, `Comment` from ragnarok.abra_db;
+
+# INSERT INTO eragnarok.attr_fix ( `Level`, `None`, `Water`, `Earth`, `Fire`, `Wind`, `Poison`, `Saint`, `Darkness`, `Sense`, `Immortality`, `Comment`) SELECT `Level`, `None`, `Water`, `Earth`, `Fire`, `Wind`, `Poison`, `Saint`, `Darkness`, `Sense`, `Immortality`, `Comment` from ragnarok.attr_fix;
+
+# INSERT INTO eragnarok.cast_db ( `ID`, `Cast_List`, `Delay_List`, `Upkeep_Time`, `Upkeep_Time2`, `Comment` ) SELECT `ID`, `Cast_List`, `Delay_List`, `Upkeep_Time`, `Upkeep_Time2`, `Comment` from ragnarok.cast_db;
+
+#INSERT INTO eragnarok.castle_db ( `CastleID`, `map_name`, `castle_name`, `switch_flag`, `Comment` ) SELECT `CastleID`, `map_name`, `castle_name`, `switch_flag`, `Comment` from ragnarok.castle_db;
+
+#INSERT INTO eragnarok.create_arrow_db ( `SourceID`, `MakeID1`, `MakeNum1`, `MakeID2`, `MakeNum2`, `MakeID3`, `MakeNum3`, `MakeID4`, `MakeNum4`, `MakeID5`, `MakeNum5`, `Comment` ) SELECT `SourceID`, `MakeID1`, `MakeNum1`, `MakeID2`, `MakeNum2`, `MakeID3`, `MakeNum3`, `MakeID4`, `MakeNum4`, `MakeID5`, `MakeNum5`, `Comment` from ragnarok.create_arrow_db;
+
+#INSERT INTO eragnarok.exp ( `EXP1`, `EXP2`, `EXP3`, `EXP4`, `EXP5`, `EXP6`, `EXP7`, `EXP8`, `EXP9`, `EXP10`, `EXP11`, `EXP12`, `EXP13`, `EXP14` ) SELECT `EXP1`, `EXP2`, `EXP3`, `EXP4`, `EXP5`, `EXP6`, `EXP7`, `EXP8`, `EXP9`, `EXP10`, `EXP11`, `EXP12`, `EXP13`, `EXP14` from ragnarok.exp;
+
+#INSERT INTO eragnarok.exp_guild ( `Level`, `EXP`, `Comment` ) SELECT `Level`, `EXP`, `Comment` from ragnarok.exp_guild;
+
+#INSERT INTO eragnarok.item_bluebox ( `NameID`, `item_name`, `rate`, `Comment` ) SELECT `NameID`, `item_name`, `rate`, `Comment` from ragnarok.item_bluebox;
+
+#INSERT INTO eragnarok.item_cardalbum ( `NameID`, `item_name`, `rate`, `Comment` ) SELECT `NameID`, `item_name`, `rate`, `Comment` from ragnarok.item_cardalbum;
+
+INSERT INTO eragnarok.item_db2 ( `ID`, `Name`, `Name2`, `Type`, `Price`, `Sell`, `Weight`, `ATK`, `DEF`, `Range`, `Slot`, `Job`, `Gender`, `Loc`, `wLV`, `eLV`, `View`, `UseScript`, `EquipScript`, `Comment` ) SELECT `ID`, `Name`, `Name2`, `Type`, `Price`, `Sell`, `Weight`, `ATK`, `DEF`, `Range`, `Slot`, `Job`, `Gender`, `Loc`, `wLV`, `eLV`, `View`, `UseScript`, `EquipScript`, `Comment` from ragnarok.item_db2;
+
+# INSERT INTO eragnarok.item_giftbox ( `NameID`, `item_name`, `rate`, `Comment` ) SELECT `NameID`, `item_name`, `rate`, `Comment` from ragnarok.item_giftbox;
+
+#INSERT INTO eragnarok.item_scroll ( `NameID`, `item_name`, `rate`, `Comment` ) SELECT `NameID`, `item_name`, `rate`, `Comment` from ragnarok.item_scroll;
+
+#INSERT INTO eragnarok.item_violetbox ( `NameID`, `item_name`, `rate`, `Comment` ) SELECT `NameID`, `item_name`, `rate`, `Comment` from ragnarok.item_violetbox;
+
+#INSERT INTO eragnarok.job_db1 ( `Class_ID`, `Weight`, `HP`, `HP2`, `SP`, `Empty`, `Dagger`, `Sword`, `Two_Handed_Sword`, `Spear`, `Two_Handed_Spear`, `Axe`, `Two_Handed_Axe`, `Rod`, `Club`, `Stick`, `Bow`, `Fist`, `Musical`, `Whip`, `Book`, `Katar`, `Comment` ) SELECT `Class_ID`, `Weight`, `HP`, `HP2`, `SP`, `Empty`, `Dagger`, `Sword`, `Two_Handed_Sword`, `Spear`, `Two_Handed_Spear`, `Axe`, `Two_Handed_Axe`, `Rod`, `Club`, `Stick`, `Bow`, `Fist`, `Musical`, `Whip`, `Book`, `Katar`, `Comment` from ragnarok.job_db1;
+
+INSERT INTO eragnarok.mob_boss ( `MobID`, `MobName`, `Rate`, `Comment` ) SELECT `MobID`, `MobName`, `Rate`, `Comment` from ragnarok.mob_boss;
+
+INSERT INTO eragnarok.mob_branch ( `MobID`, `MobName`, `Rate`, `Comment` ) SELECT `MobID`, `MobName`, `Rate`, `Comment` from ragnarok.mob_branch;
+
+INSERT INTO eragnarok.mob_db2 ( `ID`, `Name`, `Name2`, `LV`, `HP`, `SP`, `EXP`, `JEXP`, `Range1`, `ATK1`, `ATK2`, `DEF`, `MDEF`, `STR`, `AGI`, `VIT`, `INT`, `DEX`, `LUK`, `Range2`, `Range3`, `Scale`, `Race`, `Element`, `Mode`, `Speed`, `ADelay`, `aMotion`, `dMotion`, `Drop1id`, `Drop1per`, `Drop2id`, `Drop2per`, `Drop3id`, `Drop3per`, `Drop4id`, `Drop4per`, `Drop5id`, `Drop5per`, `Drop6id`, `Drop6per`, `Drop7d`, `Drop7per`, `Drop8id`, `Drop8per`, `Item1`, `Item2`, `MEXP`, `ExpPer`, `MVP1id`, `MVP1per`, `MVP2id`, `MVP2per`, `MVP3id`, `MVP3per`, `Comment` ) SELECT `ID`, `Name`, `Name2`, `LV`, `HP`, `SP`, `EXP`, `JEXP`, `Range1`, `ATK1`, `ATK2`, `DEF`, `MDEF`, `STR`, `AGI`, `VIT`, `INT`, `DEX`, `LUK`, `Range2`, `Range3`, `Scale`, `Race`, `Element`, `Mode`, `Speed`, `ADelay`, `aMotion`, `dMotion`, `Drop1id`, `Drop1per`, `Drop2id`, `Drop2per`, `Drop3id`, `Drop3per`, `Drop4id`, `Drop4per`, `Drop5id`, `Drop5per`, `Drop6id`, `Drop6per`, `Drop7d`, `Drop7per`, `Drop8id`, `Drop8per`, `Item1`, `Item2`, `MEXP`, `ExpPer`, `MVP1id`, `MVP1per`, `MVP2id`, `MVP2per`, `MVP3id`, `MVP3per`, `Comment` from ragnarok.mob_db2;
+
+INSERT INTO eragnarok.mob_poring ( `MobID`, `MobName`, `Rate`, `Comment` ) SELECT `MobID`, `MobName`, `Rate`, `Comment` from ragnarok.mob_poring;
+
+INSERT INTO eragnarok.mob_skill_db ( `Mob_ID`, `Dummy`, `State`, `Skill_ID`, `Skill_LV`, `Use_Rate`, `Cast_Time`, `Delay`, `Disturbance`, `Target`, `Condition_Type`, `Condition_Value`, `Value1`, `Value2`, `Value3`, `Value4`, `Value5`, `Comment` ) SELECT `Mob_ID`, `Dummy`, `State`, `Skill_ID`, `Skill_LV`, `Use_Rate`, `Cast_Time`, `Delay`, `Disturbance`, `Target`, `Condition_Type`, `Condition_Value`, `Value1`, `Value2`, `Value3`, `Value4`, `Value5`, `Comment` from ragnarok.mob_skill_db;
+
+#INSERT INTO eragnarok.pet_db ( `MobID`, `Name`, `JName`, `ItemID`, `EggID`, `AcceID`, `FoodID`, `Fullness`, `HungryDeray`, `R_Hungry`, `R_Full`, `Intimate`, `Die`, `Capture`, `Speed`, `S_Performance`, `Talk_Convert_Class`, `Attack_Rate`, `Defence_Attack_Rate`, `Change_Target_Rate`, `Pet_Script`, `Comment` ) SELECT `MobID`, `Name`, `JName`, `ItemID`, `EggID`, `AcceID`, `FoodID`, `Fullness`, `HungryDeray`, `R_Hungry`, `R_Full`, `Intimate`, `Die`, `Capture`, `Speed`, `S_Performance`, `Talk_Convert_Class`, `Attack_Rate`, `Defence_Attack_Rate`, `Change_Target_Rate`, `Pet_Script`, `Comment` from ragnarok.pet_db;
+
+#INSERT INTO eragnarok.produce_db ( `ID`, `ItemLV`, `RequireSkill`, `MaterialID1`, `MaterialAmount1`, `MaterialID2`, `MaterialAmount2`, `MaterialID3`, `MaterialAmount3`, `MaterialID4`, `MaterialAmount4`, `MaterialID5`, `MaterialAmount5`, `Comment` ) SELECT `ID`, `ItemLV`, `RequireSkill`, `MaterialID1`, `MaterialAmount1`, `MaterialID2`, `MaterialAmount2`, `MaterialID3`, `MaterialAmount3`, `MaterialID4`, `MaterialAmount4`, `MaterialID5`, `MaterialAmount5`, `Comment` from ragnarok.produce_db;
+
+#INSERT INTO eragnarok.refine_db ( `Refine_Bonus`, `Danger_Bonus`, `Safe_Limit`, `RefineChance1`, `RefineChance2`, `RefineChance3`, `RefineChance4`, `RefineChance5`, `RefineChance6`, `RefineChance7`, `RefineChance8`, `RefineChance9`, `RefineChance10`, `Comment` ) SELECT `Refine_Bonus`, `Danger_Bonus`, `Safe_Limit`, `RefineChance1`, `RefineChance2`, `RefineChance3`, `RefineChance4`, `RefineChance5`, `RefineChance6`, `RefineChance7`, `RefineChance8`, `RefineChance9`, `RefineChance10`, `Comment` from ragnarok.refine_db;
+
+#INSERT INTO eragnarok.size_fix ( `Element`, `Dagger`, `Sword`, `Two_Handed_Sword`, `Spear`, `Two_Handed_Spear`, `Axe`, `Two_Handed_Axe`, `Club`, `Whip`, `Stick`, `Bow`, `Fist`, `Musical`, `Rod`, `Book`, `Katar`, `Comment` ) SELECT `Element`, `Dagger`, `Sword`, `Two_Handed_Sword`, `Spear`, `Two_Handed_Spear`, `Axe`, `Two_Handed_Axe`, `Club`, `Whip`, `Stick`, `Bow`, `Fist`, `Musical`, `Rod`, `Book`, `Katar`, `Comment` from ragnarok.size_fix;
+
+#INSERT INTO eragnarok.skill_db ( `ID`, `Range`, `Hit`, `inf`, `nk`, `max`, `list_num`, `castcancel`, `cast_defence_rate`, `inf2`, `maxcount`, `skill_type`, `blow_count`, `Comment` ) SELECT `ID`, `Range`, `Hit`, `inf`, `nk`, `max`, `list_num`, `castcancel`, `cast_defence_rate`, `inf2`, `maxcount`, `skill_type`, `blow_count`, `Comment` from ragnarok.skill_db;
+
+#INSERT INTO eragnarok.skill_require_db ( `ID`, `List_HP`, `List_SP`, `List_HP_Rate`, `List_SP_Rate`, `List_Zeny`, `List_Weapon`, `State`, `Spiritball`, `ItemID1`, `Amount1`, `ItemID2`, `Amount2`, `ItemID3`, `Amount3`, `ItemID4`, `Amount4`, `ItemID5`, `Amount5`, `ItemID6`, `Amount6`, `ItemID7`, `Amount7`, `ItemID8`, `Amount8`, `ItemID9`, `Amount9`, `ItemID10`, `Amount10`, `Comment` ) SELECT `ID`, `List_HP`, `List_SP`, `List_HP_Rate`, `List_SP_Rate`, `List_Zeny`, `List_Weapon`, `State`, `Spiritball`, `ItemID1`, `Amount1`, `ItemID2`, `Amount2`, `ItemID3`, `Amount3`, `ItemID4`, `Amount4`, `ItemID5`, `Amount5`, `ItemID6`, `Amount6`, `ItemID7`, `Amount7`, `ItemID8`, `Amount8`, `ItemID9`, `Amount9`, `ItemID10`, `Amount10`, `Comment` from ragnarok.skill_require_db;
+
+#INSERT INTO eragnarok.skill_tree ( `Upper`, `JobNo`, `Skill_ID`, `MaxLV`, `Skill_ID_Require1`, `Skill_LV_Require1`, `Skill_ID_Require2`, `Skill_LV_Require2`, `Skill_ID_Require3`, `Skill_LV_Require3`, `Skill_ID_Require4`, `Skill_LV_Require4`, `Skill_ID_Require5`, `Skill_LV_Require5`, `Comment` ) SELECT `Upper`, `JobNo`, `Skill_ID`, `MaxLV`, `Skill_ID_Require1`, `Skill_LV_Require1`, `Skill_ID_Require2`, `Skill_LV_Require2`, `Skill_ID_Require3`, `Skill_LV_Require3`, `Skill_ID_Require4`, `Skill_LV_Require4`, `Skill_ID_Require5`, `Skill_LV_Require5`, `Comment` from ragnarok.skill_tree;
+
+INSERT INTO eragnarok.item_db ( `id`, `name_english`, `name_japanese`, `type`, `price_buy`, `price_sell`, `weight`, `attack`, `defence`, `range`, `slots`, `equip_jobs`, `equip_genders`, `equip_locations`, `weapon_level`, `equip_level`, `view`, `script_use`, `script_equip` ) SELECT `id`, `Name`, `Name2`, `type`, `Price`, `Sell`, `Weight`, `Atk`, `Def`, `range`, `Slot`, `Job`, `Gender`, `Loc`, `wLV`, `eLV`, `view`, `UseScript`, `EquipScript` from ragnarok.item_db;
+
+UPDATE item_db SET price_sell = price_buy/2;
+
+INSERT INTO eragnarok.mob_db (`ID`, `Name`, `Name2`, `LV`, `HP`, `SP`, `EXP`, `JEXP`, `Range1`, `ATK1`, `ATK2`, `DEF`, `MDEF`, `STR`, `AGI`, `VIT`, `INT`, `DEX`, `LUK`, `Range2`, `Range3`, `Scale`, `Race`, `Element`, `Mode`, `Speed`, `ADelay`, `aMotion`, `dMotion`, `Drop1id`, `Drop1per`, `Drop2id`, `Drop2per`, `Drop3id`, `Drop3per`, `Drop4id`, `Drop4per`, `Drop5id`, `Drop5per`, `Drop6id`, `Drop6per`, `Drop7id`, `Drop7per`, `Drop8id`, `Drop8per`, `MEXP`, `ExpPer`, `MVP1id`, `MVP1per`, `MVP2id`, `MVP2per`, `MVP3id`, `MVP3per`) SELECT `ID`, `Name`, `Name2`, `LV`, `HP`, `SP`, `EXP`, `JEXP`, `Range1`, `ATK1`, `ATK2`, `DEF`, `MDEF`, `STR`, `AGI`, `VIT`, `INT`, `DEX`, `LUK`, `Range2`, `Range3`, `Scale`, `Race`, `Element`, `Mode`, `Speed`, `ADelay`, `aMotion`, `dMotion`, `Drop1id`, `Drop1per`, `Drop2id`, `Drop2per`, `Drop3id`, `Drop3per`, `Drop4id`, `Drop4per`, `Drop5id`, `Drop5per`, `Drop6id`, `Drop6per`, `Drop7id`, `Drop7per`, `Drop8id`, `Drop8per`, `MEXP`, `ExpPer`, `MVP1id`, `MVP1per`, `MVP2id`, `MVP2per`, `MVP3id`, `MVP3per` from ragnarok.mob_db;
+
+DELETE FROM eragnarok.login;
+
+INSERT INTO eragnarok.login ( `account_id`, `userid`, `user_pass`, `lastlogin`, `sex`, `logincount`, `email`, `level` ) SELECT `account_id`, `userid`, `user_pass`, `lastlogin`, `sex`, `logincount`, `email`, `level` from ragnarok.login ;
diff --git a/sql-files/update_logs.sql b/sql-files/update_logs.sql
index 4c89ebdcf..7b12c454e 100644
--- a/sql-files/update_logs.sql
+++ b/sql-files/update_logs.sql
@@ -1,13 +1,13 @@
-#ZenyLog types (M)onsters,(T)rade,(V)ending Sell/Buy,(S)hop Sell/Buy,(N)PC Change amount,(A)dministrators
-#Database: log
-#Table: zenylog
-CREATE TABLE `zenylog` (
- `id` int(11) NOT NULL auto_increment,
- `time` datetime NOT NULL default '0000-00-00 00:00:00',
- `char_id` int(11) NOT NULL default '0',
- `src_id` int(11) NOT NULL default '0',
- `type` set('M','T','V','S','N','A') NOT NULL default 'S',
- `amount` int(11) NOT NULL default '0',
- `map` varchar(20) NOT NULL default 'prontera.gat',
- PRIMARY KEY (`id`)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;
+#ZenyLog types (M)onsters,(T)rade,(V)ending Sell/Buy,(S)hop Sell/Buy,(N)PC Change amount,(A)dministrators
+#Database: log
+#Table: zenylog
+CREATE TABLE `zenylog` (
+ `id` int(11) NOT NULL auto_increment,
+ `time` datetime NOT NULL default '0000-00-00 00:00:00',
+ `char_id` int(11) NOT NULL default '0',
+ `src_id` int(11) NOT NULL default '0',
+ `type` set('M','T','V','S','N','A') NOT NULL default 'S',
+ `amount` int(11) NOT NULL default '0',
+ `map` varchar(20) NOT NULL default 'prontera.gat',
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
diff --git a/sql-files/upgrade_0.5.2_database.sql b/sql-files/upgrade_0.5.2_database.sql
index 266207104..4d328acf6 100644
--- a/sql-files/upgrade_0.5.2_database.sql
+++ b/sql-files/upgrade_0.5.2_database.sql
@@ -1 +1 @@
-# Upgrade database tables for eAthena 0.5.2 to 1.0 RC 2
+# Upgrade database tables for eAthena 0.5.2 to 1.0 RC 2
diff --git a/sql-files/upgrade_0.5.2_main.sql b/sql-files/upgrade_0.5.2_main.sql
index 76e092c4f..e11d226ba 100644
--- a/sql-files/upgrade_0.5.2_main.sql
+++ b/sql-files/upgrade_0.5.2_main.sql
@@ -1,62 +1,62 @@
-# Upgrade login and character server tables for eAthena 0.5.2 to 1.0 RC 2
-
-ALTER TABLE `cart_inventory` ADD `broken` int(11) NOT NULL default '0';
-
-ALTER TABLE `char` MODIFY `base_level` bigint(20) unsigned NOT NULL default '1';
-ALTER TABLE `char` MODIFY `job_level` bigint(20) unsigned NOT NULL default '1';
-ALTER TABLE `char` MODIFY `base_exp` bigint(20) NOT NULL default '0';
-ALTER TABLE `char` MODIFY `job_exp` bigint(20) NOT NULL default '0';
-ALTER TABLE `char` ADD `partner_id` int(11) NOT NULL default '0';
-
-ALTER TABLE `charlog` MODIFY `str` int(11) unsigned NOT NULL default '0';
-ALTER TABLE `charlog` MODIFY `agi` int(11) unsigned NOT NULL default '0';
-ALTER TABLE `charlog` MODIFY `vit` int(11) unsigned NOT NULL default '0';
-ALTER TABLE `charlog` MODIFY `int` int(11) unsigned NOT NULL default '0';
-ALTER TABLE `charlog` MODIFY `dex` int(11) unsigned NOT NULL default '0';
-ALTER TABLE `charlog` MODIFY `luk` int(11) unsigned NOT NULL default '0';
-
-ALTER TABLE `global_reg_value` MODIFY `value` varchar(255) NOT NULL default '0';
-ALTER TABLE `global_reg_value` ADD PRIMARY KEY (`char_id`, `str`, `account_id`);
-ALTER TABLE `global_reg_value` DROP INDEX `account_id`;
-ALTER TABLE `global_reg_value` ADD INDEX `account_id` (`account_id`);
-
-ALTER TABLE `guild_castle` ADD `gHP0` int(11) NOT NULL default '0';
-ALTER TABLE `guild_castle` ADD `gHP1` int(11) NOT NULL default '0';
-ALTER TABLE `guild_castle` ADD `gHP2` int(11) NOT NULL default '0';
-ALTER TABLE `guild_castle` ADD `gHP3` int(11) NOT NULL default '0';
-ALTER TABLE `guild_castle` ADD `gHP4` int(11) NOT NULL default '0';
-ALTER TABLE `guild_castle` ADD `gHP5` int(11) NOT NULL default '0';
-ALTER TABLE `guild_castle` ADD `gHP6` int(11) NOT NULL default '0';
-ALTER TABLE `guild_castle` ADD `gHP7` int(11) NOT NULL default '0';
-
-ALTER TABLE `guild_member` MODIFY `exp` bigint(20) NOT NULL default '0';
-
-ALTER TABLE `guild_storage` ADD `broken` int(11) NOT NULL default '0';
-
-ALTER TABLE `inventory` ADD `broken` int(11) NOT NULL default '0';
-
-ALTER TABLE `login` MODIFY `account_id` int(11) NOT NULL default '0' AUTO_INCREMENT, AUTO_INCREMENT=1000057;
-ALTER TABLE `login` MODIFY `userid` varchar(255) NOT NULL default '';
-ALTER TABLE `login` MODIFY `user_pass` varchar(32) NOT NULL default '';
-ALTER TABLE `login` ADD `error_message` int(11) NOT NULL default '0';
-ALTER TABLE `login` ADD `connect_until` int(11) NOT NULL default '0';
-ALTER TABLE `login` ADD `last_ip` varchar(100) NOT NULL default '';
-ALTER TABLE `login` ADD `memo` int(11) NOT NULL default '0';
-ALTER TABLE `login` ADD `ban_until` int(11) NOT NULL default '0';
-ALTER TABLE `login` ADD `state` int(11) NOT NULL default '0';
-ALTER TABLE `login` DROP INDEX `account_id`;
-ALTER TABLE `login` DROP INDEX `userid`;
-ALTER TABLE `login` ADD PRIMARY KEY (`account_id`), ADD INDEX `name` (`userid`);
-
-CREATE TABLE `login_error` (
- `err_id` int(11) NOT NULL default '0',
- `reason` varchar(100) NOT NULL default 'Unknown',
- PRIMARY KEY (`err_id`)
-) TYPE=MyISAM;
-
-ALTER TABLE `ragsrvinfo` DROP `type`, DROP `text1`, DROP `text2`, DROP `text3`, DROP `text4`;
-ALTER TABLE `ragsrvinfo` ADD `motd` varchar(255) NOT NULL default '';
-
-ALTER TABLE `skill` ADD PRIMARY KEY (`char_id`,`id`);
-
-ALTER TABLE `storage` ADD `broken` int(11) NOT NULL default '0';
+# Upgrade login and character server tables for eAthena 0.5.2 to 1.0 RC 2
+
+ALTER TABLE `cart_inventory` ADD `broken` int(11) NOT NULL default '0';
+
+ALTER TABLE `char` MODIFY `base_level` bigint(20) unsigned NOT NULL default '1';
+ALTER TABLE `char` MODIFY `job_level` bigint(20) unsigned NOT NULL default '1';
+ALTER TABLE `char` MODIFY `base_exp` bigint(20) NOT NULL default '0';
+ALTER TABLE `char` MODIFY `job_exp` bigint(20) NOT NULL default '0';
+ALTER TABLE `char` ADD `partner_id` int(11) NOT NULL default '0';
+
+ALTER TABLE `charlog` MODIFY `str` int(11) unsigned NOT NULL default '0';
+ALTER TABLE `charlog` MODIFY `agi` int(11) unsigned NOT NULL default '0';
+ALTER TABLE `charlog` MODIFY `vit` int(11) unsigned NOT NULL default '0';
+ALTER TABLE `charlog` MODIFY `int` int(11) unsigned NOT NULL default '0';
+ALTER TABLE `charlog` MODIFY `dex` int(11) unsigned NOT NULL default '0';
+ALTER TABLE `charlog` MODIFY `luk` int(11) unsigned NOT NULL default '0';
+
+ALTER TABLE `global_reg_value` MODIFY `value` varchar(255) NOT NULL default '0';
+ALTER TABLE `global_reg_value` ADD PRIMARY KEY (`char_id`, `str`, `account_id`);
+ALTER TABLE `global_reg_value` DROP INDEX `account_id`;
+ALTER TABLE `global_reg_value` ADD INDEX `account_id` (`account_id`);
+
+ALTER TABLE `guild_castle` ADD `gHP0` int(11) NOT NULL default '0';
+ALTER TABLE `guild_castle` ADD `gHP1` int(11) NOT NULL default '0';
+ALTER TABLE `guild_castle` ADD `gHP2` int(11) NOT NULL default '0';
+ALTER TABLE `guild_castle` ADD `gHP3` int(11) NOT NULL default '0';
+ALTER TABLE `guild_castle` ADD `gHP4` int(11) NOT NULL default '0';
+ALTER TABLE `guild_castle` ADD `gHP5` int(11) NOT NULL default '0';
+ALTER TABLE `guild_castle` ADD `gHP6` int(11) NOT NULL default '0';
+ALTER TABLE `guild_castle` ADD `gHP7` int(11) NOT NULL default '0';
+
+ALTER TABLE `guild_member` MODIFY `exp` bigint(20) NOT NULL default '0';
+
+ALTER TABLE `guild_storage` ADD `broken` int(11) NOT NULL default '0';
+
+ALTER TABLE `inventory` ADD `broken` int(11) NOT NULL default '0';
+
+ALTER TABLE `login` MODIFY `account_id` int(11) NOT NULL default '0' AUTO_INCREMENT, AUTO_INCREMENT=1000057;
+ALTER TABLE `login` MODIFY `userid` varchar(255) NOT NULL default '';
+ALTER TABLE `login` MODIFY `user_pass` varchar(32) NOT NULL default '';
+ALTER TABLE `login` ADD `error_message` int(11) NOT NULL default '0';
+ALTER TABLE `login` ADD `connect_until` int(11) NOT NULL default '0';
+ALTER TABLE `login` ADD `last_ip` varchar(100) NOT NULL default '';
+ALTER TABLE `login` ADD `memo` int(11) NOT NULL default '0';
+ALTER TABLE `login` ADD `ban_until` int(11) NOT NULL default '0';
+ALTER TABLE `login` ADD `state` int(11) NOT NULL default '0';
+ALTER TABLE `login` DROP INDEX `account_id`;
+ALTER TABLE `login` DROP INDEX `userid`;
+ALTER TABLE `login` ADD PRIMARY KEY (`account_id`), ADD INDEX `name` (`userid`);
+
+CREATE TABLE `login_error` (
+ `err_id` int(11) NOT NULL default '0',
+ `reason` varchar(100) NOT NULL default 'Unknown',
+ PRIMARY KEY (`err_id`)
+) TYPE=MyISAM;
+
+ALTER TABLE `ragsrvinfo` DROP `type`, DROP `text1`, DROP `text2`, DROP `text3`, DROP `text4`;
+ALTER TABLE `ragsrvinfo` ADD `motd` varchar(255) NOT NULL default '';
+
+ALTER TABLE `skill` ADD PRIMARY KEY (`char_id`,`id`);
+
+ALTER TABLE `storage` ADD `broken` int(11) NOT NULL default '0';
diff --git a/sql-files/upgrade_1.0.0-rc1_main.sql b/sql-files/upgrade_1.0.0-rc1_main.sql
index 4af7f6f5a..0ae05933f 100644
--- a/sql-files/upgrade_1.0.0-rc1_main.sql
+++ b/sql-files/upgrade_1.0.0-rc1_main.sql
@@ -1,3 +1,3 @@
-# Upgrade login and character server tables for eAthena 1.0 RC 1 to 1.0 RC 2
-
-ALTER TABLE `login` MODIFY `account_id` INT(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2000000;
+# Upgrade login and character server tables for eAthena 1.0 RC 1 to 1.0 RC 2
+
+ALTER TABLE `login` MODIFY `account_id` INT(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2000000;
diff --git a/sql-files/upgrade_1.0.0-rc2_database.sql b/sql-files/upgrade_1.0.0-rc2_database.sql
index ad6019df7..e1b041c97 100644
--- a/sql-files/upgrade_1.0.0-rc2_database.sql
+++ b/sql-files/upgrade_1.0.0-rc2_database.sql
@@ -1,4 +1,4 @@
-# Upgrade database tables for eAthena 1.0 RC2
-
-ALTER TABLE `item_db` MODIFY `name_english` varchar(28);
-ALTER TABLE `item_db` MODIFY `name_japanese` varchar(28);
+# Upgrade database tables for eAthena 1.0 RC2
+
+ALTER TABLE `item_db` MODIFY `name_english` varchar(28);
+ALTER TABLE `item_db` MODIFY `name_japanese` varchar(28);
diff --git a/sql-files/upgrade_1.0.0-rc5_database.sql b/sql-files/upgrade_1.0.0-rc5_database.sql
index b6f8ee6d8..8b60b7216 100644
--- a/sql-files/upgrade_1.0.0-rc5_database.sql
+++ b/sql-files/upgrade_1.0.0-rc5_database.sql
@@ -1,4 +1,4 @@
-# Upgrade database tables for eAthena 1.0 RC2
-
-ALTER TABLE `item_db` MODIFY `name_english` varchar(24);
-ALTER TABLE `item_db` MODIFY `name_japanese` varchar(24);
+# Upgrade database tables for eAthena 1.0 RC2
+
+ALTER TABLE `item_db` MODIFY `name_english` varchar(24);
+ALTER TABLE `item_db` MODIFY `name_japanese` varchar(24);
diff --git a/sql-files/upgrade_svn1759.sql b/sql-files/upgrade_svn1759.sql
index b53bc39c7..281cef6c9 100644
--- a/sql-files/upgrade_svn1759.sql
+++ b/sql-files/upgrade_svn1759.sql
@@ -1,18 +1,18 @@
-
-CREATE TABLE `chatlog` (
- `id` bigint(20) NOT NULL auto_increment,
- `time` datetime NOT NULL default '0000-00-00 00:00:00',
- `type` enum('W','P','G') NOT NULL default 'W',
- `type_id` int(11) NOT NULL default '0',
- `src_charid` int(11) NOT NULL default '0',
- `src_accountid` int(11) NOT NULL default '0',
- `src_map` varchar(17) NOT NULL default '',
- `src_map_x` tinyint(4) NOT NULL default '0',
- `src_map_y` tinyint(4) NOT NULL default '0',
- `dst_charname` varchar(25) NOT NULL default '',
- `message` varchar(150) NOT NULL default '',
- PRIMARY KEY (`id`)
-) ENGINE=MyISAM AUTO_INCREMENT=1 ;
-
-
-
+
+CREATE TABLE `chatlog` (
+ `id` bigint(20) NOT NULL auto_increment,
+ `time` datetime NOT NULL default '0000-00-00 00:00:00',
+ `type` enum('W','P','G') NOT NULL default 'W',
+ `type_id` int(11) NOT NULL default '0',
+ `src_charid` int(11) NOT NULL default '0',
+ `src_accountid` int(11) NOT NULL default '0',
+ `src_map` varchar(17) NOT NULL default '',
+ `src_map_x` tinyint(4) NOT NULL default '0',
+ `src_map_y` tinyint(4) NOT NULL default '0',
+ `dst_charname` varchar(25) NOT NULL default '',
+ `message` varchar(150) NOT NULL default '',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=1 ;
+
+
+
diff --git a/sql-files/upgrade_svn1863.sql b/sql-files/upgrade_svn1863.sql
index 367dd44ea..f4b1b4910 100644
--- a/sql-files/upgrade_svn1863.sql
+++ b/sql-files/upgrade_svn1863.sql
@@ -1,7 +1,7 @@
-ALTER TABLE item_db ADD `refineable` tinyint(1) default NULL AFTER `equip_level`;
-ALTER TABLE item_db2 ADD `refineable` tinyint(1) default NULL AFTER `equip_level`;
-UPDATE item_db SET refineable=1 where type=4 or type=5;
-UPDATE item_db2 SET refineable=1 where type=4 or type=5;
-UPDATE item_db SET refineable = 0 where id = 1243 OR id = 1530 OR id = 2110 OR id = 2112 OR id = 2250 OR id = 2253 OR id = 2264 OR id = 2271 OR id = 2279 OR id = 2282 OR id = 2289 OR id = 2290 OR id = 2293 OR id = 2298 OR id = 2352 OR id = 2410 OR id = 2413 OR id = 2414 OR id = 2509 OR id = 2510 OR id = 5008 OR id = 5015 OR id = 5037 OR id = 5039 OR id = 5046 OR id = 5049 OR id = 5050 OR id = 5053 OR id = 5055 OR id = 5058 OR id = 5098;
-UPDATE item_db SET refineable = 0 where equip_locations = 513 OR equip_locations = 512 OR equip_locations = 136 OR equip_locations = 1;
-UPDATE item_db2 SET refineable = 0 where equip_locations = 513 OR equip_locations = 512 OR equip_locations = 136 OR equip_locations = 1;
+ALTER TABLE item_db ADD `refineable` tinyint(1) default NULL AFTER `equip_level`;
+ALTER TABLE item_db2 ADD `refineable` tinyint(1) default NULL AFTER `equip_level`;
+UPDATE item_db SET refineable=1 where type=4 or type=5;
+UPDATE item_db2 SET refineable=1 where type=4 or type=5;
+UPDATE item_db SET refineable = 0 where id = 1243 OR id = 1530 OR id = 2110 OR id = 2112 OR id = 2250 OR id = 2253 OR id = 2264 OR id = 2271 OR id = 2279 OR id = 2282 OR id = 2289 OR id = 2290 OR id = 2293 OR id = 2298 OR id = 2352 OR id = 2410 OR id = 2413 OR id = 2414 OR id = 2509 OR id = 2510 OR id = 5008 OR id = 5015 OR id = 5037 OR id = 5039 OR id = 5046 OR id = 5049 OR id = 5050 OR id = 5053 OR id = 5055 OR id = 5058 OR id = 5098;
+UPDATE item_db SET refineable = 0 where equip_locations = 513 OR equip_locations = 512 OR equip_locations = 136 OR equip_locations = 1;
+UPDATE item_db2 SET refineable = 0 where equip_locations = 513 OR equip_locations = 512 OR equip_locations = 136 OR equip_locations = 1;
diff --git a/sql-files/upgrade_svn2068.sql b/sql-files/upgrade_svn2068.sql
index c0ce870aa..33de1848c 100644
--- a/sql-files/upgrade_svn2068.sql
+++ b/sql-files/upgrade_svn2068.sql
@@ -1,3 +1,3 @@
-update mob_db set aMotion="185" where id=1275;
-update mob_db set aMotion="160" where id=1200;
-update mob_db set aMotion="160" where id=1482;
+update mob_db set aMotion="185" where id=1275;
+update mob_db set aMotion="160" where id=1200;
+update mob_db set aMotion="160" where id=1482;
diff --git a/sql-files/upgrade_svn2252.sql b/sql-files/upgrade_svn2252.sql
index 870a57144..c1d3884f1 100644
--- a/sql-files/upgrade_svn2252.sql
+++ b/sql-files/upgrade_svn2252.sql
@@ -1,14 +1,14 @@
-################################
-# NEW friend table #
-# NOTE -> if you dont write a #
-# converter, all your friends #
-# will be deleted #
-################################
-
-DROP TABLE `friends`;
-
-CREATE TABLE `friends` (
- `char_id` int(11) NOT NULL default '0',
- `friend_id` int(11) NOT NULL default '0'
-) TYPE=MyISAM;
-
+################################
+# NEW friend table #
+# NOTE -> if you dont write a #
+# converter, all your friends #
+# will be deleted #
+################################
+
+DROP TABLE `friends`;
+
+CREATE TABLE `friends` (
+ `char_id` int(11) NOT NULL default '0',
+ `friend_id` int(11) NOT NULL default '0'
+) TYPE=MyISAM;
+
diff --git a/sql-files/upgrade_svn2331.sql b/sql-files/upgrade_svn2331.sql
index 99b38ad61..e45c42185 100644
--- a/sql-files/upgrade_svn2331.sql
+++ b/sql-files/upgrade_svn2331.sql
@@ -1,3 +1,3 @@
-ALTER TABLE guild_position
-ADD CONSTRAINT `guild_position_ibfk_1` FOREIGN KEY (`guild_id`)
-REFERENCES `guild` (`guild_id`) ON DELETE CASCADE
+ALTER TABLE guild_position
+ADD CONSTRAINT `guild_position_ibfk_1` FOREIGN KEY (`guild_id`)
+REFERENCES `guild` (`guild_id`) ON DELETE CASCADE
diff --git a/sql-files/upgrade_svn2574.sql b/sql-files/upgrade_svn2574.sql
index 3804f0beb..35e444106 100644
--- a/sql-files/upgrade_svn2574.sql
+++ b/sql-files/upgrade_svn2574.sql
@@ -1,2 +1,2 @@
-ALTER TABLE friends ADD `friend_account` int(11) NOT NULL default 0 AFTER `char_id`;
-UPDATE friends, `char` SET friends.friend_account=`char`.account_id where friends.friend_id=`char`.char_id;
+ALTER TABLE friends ADD `friend_account` int(11) NOT NULL default 0 AFTER `char_id`;
+UPDATE friends, `char` SET friends.friend_account=`char`.account_id where friends.friend_id=`char`.char_id;
diff --git a/sql-files/upgrade_svn3273.sql b/sql-files/upgrade_svn3273.sql
index 4bf99f48c..c9e88d761 100644
--- a/sql-files/upgrade_svn3273.sql
+++ b/sql-files/upgrade_svn3273.sql
@@ -1,12 +1,12 @@
-CREATE TABLE `sc_data` (
- `account_id` int(11) unsigned NOT NULL,
- `char_id` int(11) unsigned NOT NULL,
- `type` smallint(11) unsigned NOT NULL,
- `tick` int(11) NOT NULL,
- `val1` int(11) NOT NULL default '0',
- `val2` int(11) NOT NULL default '0',
- `val3` int(11) NOT NULL default '0',
- `val4` int(11) NOT NULL default '0',
- CONSTRAINT `scdata_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `login` (`account_id`) ON DELETE CASCADE,
- CONSTRAINT `scdata_ibfk_2` FOREIGN KEY (`char_id`) REFERENCES `char` (`char_id`) ON DELETE CASCADE
-) TYPE=InnoDB;
+CREATE TABLE `sc_data` (
+ `account_id` int(11) unsigned NOT NULL,
+ `char_id` int(11) unsigned NOT NULL,
+ `type` smallint(11) unsigned NOT NULL,
+ `tick` int(11) NOT NULL,
+ `val1` int(11) NOT NULL default '0',
+ `val2` int(11) NOT NULL default '0',
+ `val3` int(11) NOT NULL default '0',
+ `val4` int(11) NOT NULL default '0',
+ CONSTRAINT `scdata_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `login` (`account_id`) ON DELETE CASCADE,
+ CONSTRAINT `scdata_ibfk_2` FOREIGN KEY (`char_id`) REFERENCES `char` (`char_id`) ON DELETE CASCADE
+) TYPE=InnoDB;
diff --git a/sql-files/upgrade_svn3746.sql b/sql-files/upgrade_svn3746.sql
index de5bcb558..893568358 100644
--- a/sql-files/upgrade_svn3746.sql
+++ b/sql-files/upgrade_svn3746.sql
@@ -1 +1 @@
-ALTER TABLE `char` MODIFY `manner` tinyint(11) NOT NULL default '0';
+ALTER TABLE `char` MODIFY `manner` tinyint(11) NOT NULL default '0';
diff --git a/sql-files/upgrade_svn4367.sql b/sql-files/upgrade_svn4367.sql
index 1dd63d63f..d0b52f9f4 100644
--- a/sql-files/upgrade_svn4367.sql
+++ b/sql-files/upgrade_svn4367.sql
@@ -1,9 +1,9 @@
-DROP TABLE IF EXISTS `mapreg`;
-CREATE TABLE `mapreg` (
- `varname` char(32) NOT NULL,
- `index` int(11) unsigned NOT NULL default '0',
- `value` char(255) NOT NULL
-) TYPE=MyISAM;
-
-ALTER TABLE `mapreg` ADD INDEX ( `varname` );
-ALTER TABLE `mapreg` ADD INDEX ( `index` );
+DROP TABLE IF EXISTS `mapreg`;
+CREATE TABLE `mapreg` (
+ `varname` char(32) NOT NULL,
+ `index` int(11) unsigned NOT NULL default '0',
+ `value` char(255) NOT NULL
+) TYPE=MyISAM;
+
+ALTER TABLE `mapreg` ADD INDEX ( `varname` );
+ALTER TABLE `mapreg` ADD INDEX ( `index` );
diff --git a/sql-files/upgrade_svn4941.sql b/sql-files/upgrade_svn4941.sql
index 29c4bf404..93037ef0c 100644
--- a/sql-files/upgrade_svn4941.sql
+++ b/sql-files/upgrade_svn4941.sql
@@ -1,6 +1,6 @@
-ALTER TABLE `char` MODIFY `last_map` varchar(20) NOT NULL default 'prontera.gat';
-ALTER TABLE `char` MODIFY `last_x` smallint(11) unsigned NOT NULL default '53';
-ALTER TABLE `char` MODIFY `last_y` smallint(11) unsigned NOT NULL default '111';
-ALTER TABLE `char` MODIFY `save_map` varchar(20) NOT NULL default 'prontera.gat';
-ALTER TABLE `char` MODIFY `save_x` smallint(11) unsigned NOT NULL default '53';
+ALTER TABLE `char` MODIFY `last_map` varchar(20) NOT NULL default 'prontera.gat';
+ALTER TABLE `char` MODIFY `last_x` smallint(11) unsigned NOT NULL default '53';
+ALTER TABLE `char` MODIFY `last_y` smallint(11) unsigned NOT NULL default '111';
+ALTER TABLE `char` MODIFY `save_map` varchar(20) NOT NULL default 'prontera.gat';
+ALTER TABLE `char` MODIFY `save_x` smallint(11) unsigned NOT NULL default '53';
ALTER TABLE `char` MODIFY `save_y` smallint(11) unsigned NOT NULL default '111'; \ No newline at end of file
diff --git a/sql-files/upgrade_svn5311.sql b/sql-files/upgrade_svn5311.sql
index e7b4db9a4..38bbbea3a 100644
--- a/sql-files/upgrade_svn5311.sql
+++ b/sql-files/upgrade_svn5311.sql
@@ -1 +1 @@
-ALTER TABLE `party` MODIFY `party_id` int(11) unsigned NOT NULL auto_increment;
+ALTER TABLE `party` MODIFY `party_id` int(11) unsigned NOT NULL auto_increment;
diff --git a/sql-files/upgrade_svn5322.sql b/sql-files/upgrade_svn5322.sql
index 6b801a1b3..a06d90326 100644
--- a/sql-files/upgrade_svn5322.sql
+++ b/sql-files/upgrade_svn5322.sql
@@ -1 +1 @@
-ALTER TABLE `guild` MODIFY `guild_id` int(11) unsigned NOT NULL auto_increment;
+ALTER TABLE `guild` MODIFY `guild_id` int(11) unsigned NOT NULL auto_increment;
diff --git a/sql-files/upgrade_svn5455.sql b/sql-files/upgrade_svn5455.sql
index 8d324230c..6c79a5159 100644
--- a/sql-files/upgrade_svn5455.sql
+++ b/sql-files/upgrade_svn5455.sql
@@ -1,2 +1,2 @@
-ALTER TABLE `char` MODIFY `karma` tinyint(3) NOT NULL default '0';
-ALTER TABLE `char` MODIFY `manner` tinyint(3) NOT NULL default '0';
+ALTER TABLE `char` MODIFY `karma` tinyint(3) NOT NULL default '0';
+ALTER TABLE `char` MODIFY `manner` tinyint(3) NOT NULL default '0';
diff --git a/sql-files/upgrade_svn5607.sql b/sql-files/upgrade_svn5607.sql
index 7c3f88527..51dae2c75 100644
--- a/sql-files/upgrade_svn5607.sql
+++ b/sql-files/upgrade_svn5607.sql
@@ -1 +1 @@
-ALTER TABLE `guild` MODIFY `average_lv` smallint(6) unsigned NOT NULL default '1';
+ALTER TABLE `guild` MODIFY `average_lv` smallint(6) unsigned NOT NULL default '1';
diff --git a/sql-files/upgrade_svn5834.sql b/sql-files/upgrade_svn5834.sql
index 2966b820e..467bc24bb 100644
--- a/sql-files/upgrade_svn5834.sql
+++ b/sql-files/upgrade_svn5834.sql
@@ -1 +1 @@
-UPDATE `item_db` SET `view`=1 where `type` = 10;
+UPDATE `item_db` SET `view`=1 where `type` = 10;
diff --git a/sql-files/upgrade_svn5902.sql b/sql-files/upgrade_svn5902.sql
index 174f512c5..382f92eb6 100644
--- a/sql-files/upgrade_svn5902.sql
+++ b/sql-files/upgrade_svn5902.sql
@@ -1,14 +1,14 @@
-update `char` set `class`='7' where `class`='13';
-update `char` set `class`='14' where `class`='21';
-update `char` set `class`='4008' where `class`='4014';
-update `char` set `class`='4015' where `class`='4022';
-update `char` set `class`='4030' where `class`='4036';
-update `char` set `class`='4037' where `class`='4044';
-update `char` set `class`='4047' where `class`='4048';
-update `guild_member` set `class`='7' where `class`='13';
-update `guild_member` set `class`='14' where `class`='21';
-update `guild_member` set `class`='4008' where `class`='4014';
-update `guild_member` set `class`='4015' where `class`='4022';
-update `guild_member` set `class`='4030' where `class`='4036';
-update `guild_member` set `class`='4037' where `class`='4044';
-update `guild_member` set `class`='4047' where `class`='4048';
+update `char` set `class`='7' where `class`='13';
+update `char` set `class`='14' where `class`='21';
+update `char` set `class`='4008' where `class`='4014';
+update `char` set `class`='4015' where `class`='4022';
+update `char` set `class`='4030' where `class`='4036';
+update `char` set `class`='4037' where `class`='4044';
+update `char` set `class`='4047' where `class`='4048';
+update `guild_member` set `class`='7' where `class`='13';
+update `guild_member` set `class`='14' where `class`='21';
+update `guild_member` set `class`='4008' where `class`='4014';
+update `guild_member` set `class`='4015' where `class`='4022';
+update `guild_member` set `class`='4030' where `class`='4036';
+update `guild_member` set `class`='4037' where `class`='4044';
+update `guild_member` set `class`='4047' where `class`='4048';
diff --git a/sql-files/upgrade_svn6533.sql b/sql-files/upgrade_svn6533.sql
index 60550dbe6..28ca04c50 100644
--- a/sql-files/upgrade_svn6533.sql
+++ b/sql-files/upgrade_svn6533.sql
@@ -1,2 +1,2 @@
-ALTER TABLE `loginlog` CHANGE `ip` `ip` CHAR( 15 ) NOT NULL;
-ALTER TABLE `loginlog` ADD INDEX ( `ip` ( 15 ) );
+ALTER TABLE `loginlog` CHANGE `ip` `ip` CHAR( 15 ) NOT NULL;
+ALTER TABLE `loginlog` ADD INDEX ( `ip` ( 15 ) );
diff --git a/sql-files/upgrade_svn6868.sql b/sql-files/upgrade_svn6868.sql
index 000237297..47f89b1a3 100644
--- a/sql-files/upgrade_svn6868.sql
+++ b/sql-files/upgrade_svn6868.sql
@@ -1,2 +1,2 @@
-UPDATE `loginlog` SET `ip` = inet_aton(`ip`);
+UPDATE `loginlog` SET `ip` = inet_aton(`ip`);
ALTER TABLE `loginlog` CHANGE `ip` `ip` INT( 10 ) UNSIGNED ZEROFILL NOT NULL DEFAULT '0'; \ No newline at end of file
diff --git a/sql-files/upgrade_svn7146.sql b/sql-files/upgrade_svn7146.sql
index d639229dc..f608ab273 100644
--- a/sql-files/upgrade_svn7146.sql
+++ b/sql-files/upgrade_svn7146.sql
@@ -1 +1 @@
-ALTER TABLE `char` ADD INDEX ( `account_id` );
+ALTER TABLE `char` ADD INDEX ( `account_id` );
diff --git a/sql-files/upgrade_svn7580.sql b/sql-files/upgrade_svn7580.sql
index 0df8894d0..e383d2f0e 100644
--- a/sql-files/upgrade_svn7580.sql
+++ b/sql-files/upgrade_svn7580.sql
@@ -1,2 +1,2 @@
-ALTER TABLE `char` MODIFY `party_id` int(11) unsigned NOT NULL default '0';
-ALTER TABLE `char` MODIFY `guild_id` int(11) unsigned NOT NULL default '0';
+ALTER TABLE `char` MODIFY `party_id` int(11) unsigned NOT NULL default '0';
+ALTER TABLE `char` MODIFY `guild_id` int(11) unsigned NOT NULL default '0';
diff --git a/sql-files/upgrade_svn7706.sql b/sql-files/upgrade_svn7706.sql
index afd91d220..0e847ad27 100644
--- a/sql-files/upgrade_svn7706.sql
+++ b/sql-files/upgrade_svn7706.sql
@@ -1,36 +1,36 @@
-ALTER TABLE `char` ADD `homun_id` int(11) unsigned NOT NULL default '0' AFTER `pet_id`;
-
-DROP TABLE IF EXISTS `homunculus`;
-CREATE TABLE `homunculus` (
- `homun_id` int(11) NOT NULL auto_increment,
- `char_id` int(11) NOT NULL,
- `class` mediumint(9) unsigned NOT NULL default '0',
- `name` varchar(24) NOT NULL default '',
- `level` smallint(4) NOT NULL default '0',
- `exp` int(12) NOT NULL default '0',
- `intimacy` int(12) NOT NULL default '0',
- `hunger` smallint(4) NOT NULL default '0',
- `str` smallint(4) unsigned NOT NULL default '0',
- `agi` smallint(4) unsigned NOT NULL default '0',
- `vit` smallint(4) unsigned NOT NULL default '0',
- `int` smallint(4) unsigned NOT NULL default '0',
- `dex` smallint(4) unsigned NOT NULL default '0',
- `luk` smallint(4) unsigned NOT NULL default '0',
- `hp` int(12) NOT NULL default '1',
- `max_hp` int(12) NOT NULL default '1',
- `sp` int(12) NOT NULL default '1',
- `max_sp` int(12) NOT NULL default '1',
- `skill_point` smallint(4) unsigned NOT NULL default '0',
- `alive` tinyint(2) NOT NULL default '1',
- `rename_flag` tinyint(2) NOT NULL default '0',
- `vaporize` tinyint(2) NOT NULL default '0',
- PRIMARY KEY (`homun_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-
-CREATE TABLE `skill_homunculus` (
- `homun_id` int(11) NOT NULL,
- `id` int(11) NOT NULL,
- `lv` smallint(6) NOT NULL,
- PRIMARY KEY (`homun_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+ALTER TABLE `char` ADD `homun_id` int(11) unsigned NOT NULL default '0' AFTER `pet_id`;
+
+DROP TABLE IF EXISTS `homunculus`;
+CREATE TABLE `homunculus` (
+ `homun_id` int(11) NOT NULL auto_increment,
+ `char_id` int(11) NOT NULL,
+ `class` mediumint(9) unsigned NOT NULL default '0',
+ `name` varchar(24) NOT NULL default '',
+ `level` smallint(4) NOT NULL default '0',
+ `exp` int(12) NOT NULL default '0',
+ `intimacy` int(12) NOT NULL default '0',
+ `hunger` smallint(4) NOT NULL default '0',
+ `str` smallint(4) unsigned NOT NULL default '0',
+ `agi` smallint(4) unsigned NOT NULL default '0',
+ `vit` smallint(4) unsigned NOT NULL default '0',
+ `int` smallint(4) unsigned NOT NULL default '0',
+ `dex` smallint(4) unsigned NOT NULL default '0',
+ `luk` smallint(4) unsigned NOT NULL default '0',
+ `hp` int(12) NOT NULL default '1',
+ `max_hp` int(12) NOT NULL default '1',
+ `sp` int(12) NOT NULL default '1',
+ `max_sp` int(12) NOT NULL default '1',
+ `skill_point` smallint(4) unsigned NOT NULL default '0',
+ `alive` tinyint(2) NOT NULL default '1',
+ `rename_flag` tinyint(2) NOT NULL default '0',
+ `vaporize` tinyint(2) NOT NULL default '0',
+ PRIMARY KEY (`homun_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+
+CREATE TABLE `skill_homunculus` (
+ `homun_id` int(11) NOT NULL,
+ `id` int(11) NOT NULL,
+ `lv` smallint(6) NOT NULL,
+ PRIMARY KEY (`homun_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/sql-files/upgrade_svn7768.sql b/sql-files/upgrade_svn7768.sql
index 69f6f1333..c04d03973 100644
--- a/sql-files/upgrade_svn7768.sql
+++ b/sql-files/upgrade_svn7768.sql
@@ -1,8 +1,8 @@
-DROP TABLE IF EXISTS `skill_homunculus`;
-CREATE TABLE `skill_homunculus` (
- `homun_id` int(11) NOT NULL,
- `id` int(11) NOT NULL,
- `lv` smallint(6) NOT NULL,
- PRIMARY KEY (`homun_id`,`id`),
- KEY `homun_id` (`homun_id`)
+DROP TABLE IF EXISTS `skill_homunculus`;
+CREATE TABLE `skill_homunculus` (
+ `homun_id` int(11) NOT NULL,
+ `id` int(11) NOT NULL,
+ `lv` smallint(6) NOT NULL,
+ PRIMARY KEY (`homun_id`,`id`),
+ KEY `homun_id` (`homun_id`)
) TYPE=MyISAM; \ No newline at end of file
diff --git a/sql-files/upgrade_svn8630.sql b/sql-files/upgrade_svn8630.sql
index a94dbf116..33e218eb2 100644
--- a/sql-files/upgrade_svn8630.sql
+++ b/sql-files/upgrade_svn8630.sql
@@ -1 +1 @@
-ALTER TABLE `login` MODIFY `connect_until` int(11) unsigned NOT NULL default '0';
+ALTER TABLE `login` MODIFY `connect_until` int(11) unsigned NOT NULL default '0';
diff --git a/sql-files/upgrade_svn8675.sql b/sql-files/upgrade_svn8675.sql
index 5f6d15299..1499a748b 100644
--- a/sql-files/upgrade_svn8675.sql
+++ b/sql-files/upgrade_svn8675.sql
@@ -1 +1 @@
-ALTER TABLE `guild` MODIFY `emblem_data` blob;
+ALTER TABLE `guild` MODIFY `emblem_data` blob;
diff --git a/sql-files/upgrade_svn8728.sql b/sql-files/upgrade_svn8728.sql
index 71558893f..5a45f87c4 100644
--- a/sql-files/upgrade_svn8728.sql
+++ b/sql-files/upgrade_svn8728.sql
@@ -1,4 +1,4 @@
-ALTER TABLE `friends` ADD INDEX ( `char_id` );
-ALTER TABLE `memo` ADD INDEX ( `char_id` );
-ALTER TABLE `char` ADD INDEX ( `name` );
-ALTER TABLE `char` ADD INDEX ( `online` );
+ALTER TABLE `friends` ADD INDEX ( `char_id` );
+ALTER TABLE `memo` ADD INDEX ( `char_id` );
+ALTER TABLE `char` ADD INDEX ( `name` );
+ALTER TABLE `char` ADD INDEX ( `online` );
diff --git a/sql-files/upgrade_svn9050.sql b/sql-files/upgrade_svn9050.sql
index 932bc3b38..2e0c72489 100644
--- a/sql-files/upgrade_svn9050.sql
+++ b/sql-files/upgrade_svn9050.sql
@@ -1,6 +1,6 @@
-ALTER TABLE `picklog` ADD INDEX (`type`);
-ALTER TABLE `zenylog` ADD INDEX (`type`);
-ALTER TABLE `branchlog` ADD INDEX (`account_id`), ADD INDEX (`char_id`);
-ALTER TABLE `atcommandlog` ADD INDEX (`account_id`), ADD INDEX (`char_id`);
-ALTER TABLE `npclog` ADD INDEX (`account_id`), ADD INDEX (`char_id`);
-ALTER TABLE `chatlog` ADD INDEX (`src_accountid`), ADD INDEX (`src_charid`);
+ALTER TABLE `picklog` ADD INDEX (`type`);
+ALTER TABLE `zenylog` ADD INDEX (`type`);
+ALTER TABLE `branchlog` ADD INDEX (`account_id`), ADD INDEX (`char_id`);
+ALTER TABLE `atcommandlog` ADD INDEX (`account_id`), ADD INDEX (`char_id`);
+ALTER TABLE `npclog` ADD INDEX (`account_id`), ADD INDEX (`char_id`);
+ALTER TABLE `chatlog` ADD INDEX (`src_accountid`), ADD INDEX (`src_charid`);
diff --git a/sql-files/upgrade_svn9135.sql b/sql-files/upgrade_svn9135.sql
index 0647bc452..4b618a5ad 100644
--- a/sql-files/upgrade_svn9135.sql
+++ b/sql-files/upgrade_svn9135.sql
@@ -1,2 +1,2 @@
-alter table `item_db` modify `view` smallint(3) unsigned default null;
+alter table `item_db` modify `view` smallint(3) unsigned default null;
alter table `item_db2` modify `view` smallint(3) unsigned default null; \ No newline at end of file
diff --git a/src/map/script.c b/src/map/script.c
index 09f84afbd..3b51a18b6 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -9058,6 +9058,7 @@ static int buildin_maprespawnguildid_sub_mob(struct block_list *bl,va_list ap)
if(!md->guardian_data && md->class_ != MOBID_EMPERIUM)
status_kill(bl);
+
return 0;
}
diff --git a/src/tool/grfio.c b/src/tool/grfio.c
index ad6a466ba..2fa48a2a1 100644
--- a/src/tool/grfio.c
+++ b/src/tool/grfio.c
@@ -1,982 +1,982 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-/*********************************************************************
- *
- * Ragnarok Online Emulator : grfio.c -- grf file I/O Module
- *--------------------------------------------------------------------
- * special need library : zlib
- *********************************************************************
- * $Id: grfio.c,v 1.2 2004/09/29 17:31:49 kalaspuff Exp $
- *
- * 2002/12/18... the original edition
- * 2003/01/23 ... Code correction
- * 2003/02/01 ... An addition and decryption processing are improved for LocalFile and two or more GRF(s) check processing.
- * 2003/02/02 ... Even if there is no grf it does not stop -- as -- correction
- * 2003/02/02... grf reading specification can be added later -- as -- correction (grfio_add function addition)
- * 2003/02 / 03... at the time of grfio_resourcecheck processing the entry addition processing method -- correction
- * 2003/02/05... change of the processing in grfio_init
- * 2003/02/23... a local file check -- GRFIO_LOCAL -- switch (Defoe -- Function Off)
- * 2003/10/21 ... The data of alpha client was read.
- * 2003/11/10 ... Ready new grf format.
- * 2003/11/11 ... version check fix & bug fix
- * 2006/04/16 ... fixed crash grfio_find_file when file is not found.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <malloc.h>
-#include <sys/stat.h>
-
-#include "grfio.h"
-#include "../common/mmo.h"
-#include "../zlib/unzip.h"
-
-#define CHUNK 16384
-
-#ifdef __WIN32
- #include "../zlib/zlib.h"
- #include "../zlib/iowin32.h"
-#else
- #ifndef __FREEBSD__
- #include <zlib.h>
- #endif
-#endif
-
-typedef unsigned char BYTE;
-typedef unsigned short WORD;
-typedef unsigned long DWORD;
-
-static char data_dir[1024] = ""; // "../";
-
-//----------------------------
-// file entry table struct
-//----------------------------
-typedef struct {
- int srclen; // compressed size
- int srclen_aligned; //
- int declen; // original size
- int srcpos;
- short next;
- int cycle;
- char type;
- char fn[128-4*5]; // file name
- char *fnd;
- signed char gentry; // read grf file select
-} FILELIST;
-//gentry ... 0 : It acquires from a local file.
-// It acquires from the resource file of 1>=:gentry_table[gentry-1].
-// 1<=: Check a local file.
-// If it is, after re-setting to 0, it acquires from a local file.
-// If there is nothing, mark reversal will be carried out, and it will re-set, and will acquire from a resource file as well as 1>=.
-
-//Since char defines *FILELIST.gentry, the maximum which can be added by grfio_add becomes by 127 pieces.
-
-#define GENTRY_LIMIT 512
-#define FILELIST_LIMIT 1048576 // temporary maximum, and a theory top maximum are 2G.
-
-static FILELIST *filelist = NULL;
-static int filelist_entrys = 0;
-static int filelist_maxentry = 0;
-
-static char **gentry_table = NULL;
-static int gentry_entrys = 0;
-static int gentry_maxentry = 0;
-
-//----------------------------
-// file list hash table
-//----------------------------
-static int filelist_hash[256];
-
-//----------------------------
-// grf decode data table
-//----------------------------
-static unsigned char BitMaskTable[8] = {
- 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
-};
-
-static char BitSwapTable1[64] = {
- 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4,
- 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8,
- 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3,
- 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7
-};
-static char BitSwapTable2[64] = {
- 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31,
- 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29,
- 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27,
- 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25
-};
-static char BitSwapTable3[32] = {
- 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10,
- 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25
-};
-
-static unsigned char NibbleData[4][64]={
- {
- 0xef, 0x03, 0x41, 0xfd, 0xd8, 0x74, 0x1e, 0x47, 0x26, 0xef, 0xfb, 0x22, 0xb3, 0xd8, 0x84, 0x1e,
- 0x39, 0xac, 0xa7, 0x60, 0x62, 0xc1, 0xcd, 0xba, 0x5c, 0x96, 0x90, 0x59, 0x05, 0x3b, 0x7a, 0x85,
- 0x40, 0xfd, 0x1e, 0xc8, 0xe7, 0x8a, 0x8b, 0x21, 0xda, 0x43, 0x64, 0x9f, 0x2d, 0x14, 0xb1, 0x72,
- 0xf5, 0x5b, 0xc8, 0xb6, 0x9c, 0x37, 0x76, 0xec, 0x39, 0xa0, 0xa3, 0x05, 0x52, 0x6e, 0x0f, 0xd9,
- }, {
- 0xa7, 0xdd, 0x0d, 0x78, 0x9e, 0x0b, 0xe3, 0x95, 0x60, 0x36, 0x36, 0x4f, 0xf9, 0x60, 0x5a, 0xa3,
- 0x11, 0x24, 0xd2, 0x87, 0xc8, 0x52, 0x75, 0xec, 0xbb, 0xc1, 0x4c, 0xba, 0x24, 0xfe, 0x8f, 0x19,
- 0xda, 0x13, 0x66, 0xaf, 0x49, 0xd0, 0x90, 0x06, 0x8c, 0x6a, 0xfb, 0x91, 0x37, 0x8d, 0x0d, 0x78,
- 0xbf, 0x49, 0x11, 0xf4, 0x23, 0xe5, 0xce, 0x3b, 0x55, 0xbc, 0xa2, 0x57, 0xe8, 0x22, 0x74, 0xce,
- }, {
- 0x2c, 0xea, 0xc1, 0xbf, 0x4a, 0x24, 0x1f, 0xc2, 0x79, 0x47, 0xa2, 0x7c, 0xb6, 0xd9, 0x68, 0x15,
- 0x80, 0x56, 0x5d, 0x01, 0x33, 0xfd, 0xf4, 0xae, 0xde, 0x30, 0x07, 0x9b, 0xe5, 0x83, 0x9b, 0x68,
- 0x49, 0xb4, 0x2e, 0x83, 0x1f, 0xc2, 0xb5, 0x7c, 0xa2, 0x19, 0xd8, 0xe5, 0x7c, 0x2f, 0x83, 0xda,
- 0xf7, 0x6b, 0x90, 0xfe, 0xc4, 0x01, 0x5a, 0x97, 0x61, 0xa6, 0x3d, 0x40, 0x0b, 0x58, 0xe6, 0x3d,
- }, {
- 0x4d, 0xd1, 0xb2, 0x0f, 0x28, 0xbd, 0xe4, 0x78, 0xf6, 0x4a, 0x0f, 0x93, 0x8b, 0x17, 0xd1, 0xa4,
- 0x3a, 0xec, 0xc9, 0x35, 0x93, 0x56, 0x7e, 0xcb, 0x55, 0x20, 0xa0, 0xfe, 0x6c, 0x89, 0x17, 0x62,
- 0x17, 0x62, 0x4b, 0xb1, 0xb4, 0xde, 0xd1, 0x87, 0xc9, 0x14, 0x3c, 0x4a, 0x7e, 0xa8, 0xe2, 0x7d,
- 0xa0, 0x9f, 0xf6, 0x5c, 0x6a, 0x09, 0x8d, 0xf0, 0x0f, 0xe3, 0x53, 0x25, 0x95, 0x36, 0x28, 0xcb,
- }
-};
-/*-----------------
- * long data get
- */
-static unsigned int getlong(unsigned char *p)
-{
- return p[0]
- | p[1] << 0x08
- | p[2] << 0x10
- | p[3] << 0x18; // Shinomori
-}
-
-/*==========================================
- * Grf data decode : Subs
- *------------------------------------------
- */
-static void NibbleSwap(BYTE *Src, int len)
-{
- for(;0<len;len--,Src++) {
- *Src = (*Src>>4) | (*Src<<4);
- }
-}
-
-static void BitConvert(BYTE *Src,char *BitSwapTable)
-{
- int lop,prm;
- BYTE tmp[8];
- memset(tmp,0,8);
- for(lop=0;lop!=64;lop++) {
- prm = BitSwapTable[lop]-1;
- if (Src[(prm >> 3) & 7] & BitMaskTable[prm & 7]) {
- tmp[(lop >> 3) & 7] |= BitMaskTable[lop & 7];
- }
- }
- memcpy(Src,tmp,8);
-}
-
-static void BitConvert4(BYTE *Src)
-{
- int lop,prm;
- BYTE tmp[8];
- tmp[0] = ((Src[7]<<5) | (Src[4]>>3)) & 0x3f; // ..0 vutsr
- tmp[1] = ((Src[4]<<1) | (Src[5]>>7)) & 0x3f; // ..srqpo n
- tmp[2] = ((Src[4]<<5) | (Src[5]>>3)) & 0x3f; // ..o nmlkj
- tmp[3] = ((Src[5]<<1) | (Src[6]>>7)) & 0x3f; // ..kjihg f
- tmp[4] = ((Src[5]<<5) | (Src[6]>>3)) & 0x3f; // ..g fedcb
- tmp[5] = ((Src[6]<<1) | (Src[7]>>7)) & 0x3f; // ..cba98 7
- tmp[6] = ((Src[6]<<5) | (Src[7]>>3)) & 0x3f; // ..8 76543
- tmp[7] = ((Src[7]<<1) | (Src[4]>>7)) & 0x3f; // ..43210 v
-
- for(lop=0;lop!=4;lop++) {
- tmp[lop] = (NibbleData[lop][tmp[lop*2]] & 0xf0)
- | (NibbleData[lop][tmp[lop*2+1]] & 0x0f);
- }
-
- *(DWORD*)(tmp+4)=0;
- for(lop=0;lop!=32;lop++) {
- prm = BitSwapTable3[lop]-1;
- if (tmp[prm >> 3] & BitMaskTable[prm & 7]) {
- tmp[(lop >> 3) + 4] |= BitMaskTable[lop & 7];
- }
- }
- Src[0] ^= tmp[4];
- Src[1] ^= tmp[5];
- Src[2] ^= tmp[6];
- Src[3] ^= tmp[7];
-}
-
-static void decode_des_etc(BYTE *buf,int len,int type,int cycle)
-{
- int lop,cnt=0;
- if(cycle<3) cycle=3;
- else if(cycle<5) cycle++;
- else if(cycle<7) cycle+=9;
- else cycle+=15;
-
- for(lop=0;lop*8<len;lop++,buf+=8) {
- if(lop<20 || (type==0 && lop%cycle==0)){ // des
- BitConvert(buf,BitSwapTable1);
- BitConvert4(buf);
- BitConvert(buf,BitSwapTable2);
- } else {
- if(cnt==7 && type==0){
- int a;
- BYTE tmp[8];
- *(DWORD*)tmp = *(DWORD*)buf;
- *(DWORD*)(tmp+4) = *(DWORD*)(buf+4);
- cnt=0;
- buf[0]=tmp[3];
- buf[1]=tmp[4];
- buf[2]=tmp[6];
- buf[3]=tmp[0];
- buf[4]=tmp[1];
- buf[5]=tmp[2];
- buf[6]=tmp[5];
- a=tmp[7];
- if(a==0x00) a=0x2b;
- else if(a==0x2b) a=0x00;
- else if(a==0x01) a=0x68;
- else if(a==0x68) a=0x01;
- else if(a==0x48) a=0x77;
- else if(a==0x77) a=0x48;
- else if(a==0x60) a=0xff;
- else if(a==0xff) a=0x60;
- else if(a==0x6c) a=0x80;
- else if(a==0x80) a=0x6c;
- else if(a==0xb9) a=0xc0;
- else if(a==0xc0) a=0xb9;
- else if(a==0xeb) a=0xfe;
- else if(a==0xfe) a=0xeb;
- buf[7]=a;
- }
- cnt++;
- }
- }
-}
-/*==========================================
- * Grf data decode sub : zip
- *------------------------------------------
- */
-int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen)
-{
- z_stream stream;
- int err;
-
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-
- stream.next_out = (Bytef*) dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
-
- err = inflateInit(&stream);
- if (err != Z_OK) return err;
-
- err = inflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- inflateEnd(&stream);
- return err == Z_OK ? Z_BUF_ERROR : err;
- }
- *destLen = stream.total_out;
-
- err = inflateEnd(&stream);
- return err;
-}
-
-int encode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen) {
- z_stream stream;
- int err;
- memset(&stream, 0, sizeof(stream));
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-
- stream.next_out = (Bytef*) dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
-
- err = deflateInit(&stream,Z_DEFAULT_COMPRESSION);
- if (err != Z_OK) return err;
-
- err = deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- inflateEnd(&stream);
- return err == Z_OK ? Z_BUF_ERROR : err;
- }
- *destLen = stream.total_out;
-
- err = deflateEnd(&stream);
- return err;
-}
-
-/* ===================================
-* Unzips a file. 1: success, 0: error
-* Adapted from miniunz.c [Celest]
-* Version 1.01b, May 30th, 2004
-* Copyright (C) 1998-2004 Gilles Vollant
-* -------------------------------------
-*/
-int deflate_file (const char *source, const char *filename)
-{
-#ifdef _WIN32
- zlib_filefunc_def ffunc;
-#endif
- unzFile uf = NULL;
- int err = UNZ_OK;
- uInt size_buf = 8192;
- FILE *fout = NULL;
- void *buf;
-
-#ifdef _WIN32
- fill_win32_filefunc(&ffunc);
- uf = unzOpen2(source, &ffunc);
-#else
- uf = unzOpen(source);
-#endif
-
- if (uf == NULL)
- return 0;
-
- if (unzLocateFile(uf, filename, 0) != UNZ_OK)
- return 0;
-
- err = unzOpenCurrentFilePassword(uf, NULL);
-
- fout = fopen(filename,"wb");
- if (fout == NULL)
- return 0;
-
- buf = (void *)malloc(size_buf);
- do {
- err = unzReadCurrentFile(uf, buf, size_buf);
- if (err < 0)
- break;
- if (err > 0 &&
- fwrite(buf, err, 1, fout)!=1)
- {
- err = UNZ_ERRNO;
- break;
- }
- } while (err > 0);
-
- if (fout) fclose(fout);
-
- if (err == UNZ_OK) {
- err = unzCloseCurrentFile (uf);
- free(buf);
- return (err == UNZ_OK);
- }
-
- unzCloseCurrentFile(uf); /* don't lose the error */
-
- return 0;
-}
-
-unsigned long grfio_crc32 (const unsigned char *buf, unsigned int len)
-{
- return crc32(crc32(0L, Z_NULL, 0), buf, len);
-}
-
-/***********************************************************
- *** File List Subroutines ***
- ***********************************************************/
-
-/*==========================================
- * File List : Hash make
- *------------------------------------------
- */
-static int filehash(unsigned char *fname)
-{
- unsigned int hash=0;
- while(*fname) {
- hash = ((hash<<1)+(hash>>7)*9+tolower(*fname));
- fname++;
- }
- return hash & 255;
-}
-
-/*==========================================
- * File List : Hash initalize
- *------------------------------------------
- */
-static void hashinit(void)
-{
- int lop;
- for (lop = 0; lop < 256; lop++)
- filelist_hash[lop] = -1;
-}
-
-/*==========================================
- * File List : File find
- *------------------------------------------
- */
-static FILELIST *filelist_find(char *fname)
-{
- int hash;
-
- if (!filelist)
- return NULL;
-
- for (hash = filelist_hash[filehash((unsigned char *) fname)]; hash >= 0; hash = filelist[hash].next) {
- if(strcmpi(filelist[hash].fn, fname) == 0)
- break;
- }
-
- return (hash >= 0) ? &filelist[hash] : NULL;
-}
-
-char *grfio_find_file(char *fname){
- FILELIST *filelist = filelist_find(fname);
- if (!filelist) return NULL;
- return (!filelist->fnd?filelist->fn:filelist->fnd);
-}
-
-/*==========================================
- * File List : Filelist add
- *------------------------------------------
- */
-#define FILELIST_ADDS 1024 // number increment of file lists `
-
-static FILELIST* filelist_add(FILELIST *entry)
-{
- int hash;
-
- if (filelist_entrys >= FILELIST_LIMIT) {
- printf("GRF filelist limit reached!\n");
- exit(1);
- }
-
- if (filelist_entrys >= filelist_maxentry) {
- filelist = (FILELIST *)realloc(filelist, (filelist_maxentry + FILELIST_ADDS) * sizeof(FILELIST));
- memset(filelist + filelist_maxentry, '\0', FILELIST_ADDS * sizeof(FILELIST));
- filelist_maxentry += FILELIST_ADDS;
- }
-
- memcpy (&filelist[filelist_entrys], entry, sizeof(FILELIST));
-
- hash = filehash((unsigned char *) entry->fn);
- filelist[filelist_entrys].next = filelist_hash[hash];
- filelist_hash[hash] = filelist_entrys;
-
- filelist_entrys++;
-
- return &filelist[filelist_entrys - 1];
-}
-
-static FILELIST* filelist_modify(FILELIST *entry)
-{
- FILELIST *fentry;
- if ((fentry = filelist_find(entry->fn)) != NULL) {
- int tmp = fentry->next;
- memcpy(fentry, entry, sizeof(FILELIST));
- fentry->next = tmp;
- } else {
- fentry = filelist_add(entry);
- }
- return fentry;
-}
-
-/*==========================================
- * File List : filelist size adjust
- *------------------------------------------
- */
-static void filelist_adjust(void)
-{
- if (filelist != NULL) {
- if (filelist_maxentry > filelist_entrys) {
- filelist = (FILELIST *)realloc(
- filelist, filelist_entrys * sizeof(FILELIST));
- filelist_maxentry = filelist_entrys;
- }
- }
-}
-
-/***********************************************************
- *** Grfio Sobroutines ***
- ***********************************************************/
-
-/*==========================================
- * Grfio : Resource file size get
- *------------------------------------------
- */
-int grfio_size(char *fname)
-{
- FILELIST *entry;
-
- entry = filelist_find(fname);
-
- if (entry == NULL || entry->gentry < 0) { // LocalFileCheck
- char lfname[256], *p;
- FILELIST lentry;
- struct stat st;
-
- sprintf(lfname, "%s%s", data_dir, fname);
-
- for (p = &lfname[0]; *p != 0; p++)
- if (*p=='\\') *p = '/'; // * At the time of Unix
-
- if (stat(lfname, &st) == 0) {
- strncpy(lentry.fn, fname, sizeof(lentry.fn) - 1);
- lentry.fnd = NULL;
- lentry.declen = st.st_size;
- lentry.gentry = 0; // 0:LocalFile
- entry = filelist_modify(&lentry);
- } else if (entry == NULL) {
- printf("%s not found (grfio_size)\n", fname);
- //exit(1);
- return -1;
- }
- }
- return entry->declen;
-}
-
-/*==========================================
- * Grfio : Resource file read & size get
- *------------------------------------------
- */
-void* grfio_reads(char *fname, int *size)
-{
- FILE *in;
- FILELIST *entry;
- unsigned char *buf2 = NULL;
-
- entry = filelist_find(fname);
-
- if (entry == NULL || entry->gentry <= 0) { // LocalFileCheck
- char lfname[256], *p;
- FILELIST lentry;
-
- sprintf(lfname, "%s%s", data_dir, fname);
-
- for (p = &lfname[0]; *p != 0; p++)
- if (*p == '\\') *p = '/'; // * At the time of Unix
-
- in = fopen(lfname, "rb");
- if (in != NULL) {
- if (entry != NULL && entry->gentry == 0) {
- lentry.declen = entry->declen;
- } else {
- fseek(in,0,2); // SEEK_END
- lentry.declen = ftell(in);
- }
- fseek(in,0,0); // SEEK_SET
- buf2 = (unsigned char *)malloc(lentry.declen + 1024);
- fread(buf2, 1, lentry.declen, in);
- fclose(in);
- strncpy(lentry.fn, fname, sizeof(lentry.fn) - 1);
- lentry.fnd = NULL;
- lentry.gentry = 0; // 0:LocalFile
- entry = filelist_modify(&lentry);
- } else {
- if (entry != NULL && entry->gentry < 0) {
- entry->gentry = -entry->gentry; // local file checked
- } else {
- printf("%s not found (grfio_reads - local file %s)\n", fname, lfname);
- return NULL;
- }
- }
- }
- if (entry != NULL && entry->gentry > 0) { // Archive[GRF] File Read
- char *gfname = gentry_table[entry->gentry - 1];
- in = fopen(gfname, "rb");
- if(in != NULL) {
- unsigned char *buf = (unsigned char *)malloc(entry->srclen_aligned + 1024);
- fseek(in, entry->srcpos, 0);
- fread(buf, 1, entry->srclen_aligned, in);
- fclose(in);
- buf2 = (unsigned char *)malloc(entry->declen + 1024);
- if (entry->type == 1 || entry->type == 3 || entry->type == 5) {
- uLongf len;
- if (entry->cycle >= 0)
- decode_des_etc(buf, entry->srclen_aligned, entry->cycle == 0, entry->cycle);
- len = entry->declen;
- decode_zip(buf2, &len, buf, entry->srclen);
- if (len != entry->declen) {
- printf("decode_zip size mismatch err: %d != %d\n", (int)len, entry->declen);
- free(buf);
- free(buf2);
- return NULL;
- }
- } else {
- memcpy(buf2, buf, entry->declen);
- }
- free(buf);
- } else {
- printf("%s not found (grfio_reads - GRF file %s)\n", fname, gfname);
- return NULL;
- }
- }
- if (size != NULL && entry != NULL)
- *size = entry->declen;
-
- return buf2;
-}
-
-/*==========================================
- * Resource filename decode
- *------------------------------------------
- */
-static char * decode_filename(unsigned char *buf,int len)
-{
- int lop;
- for(lop=0;lop<len;lop+=8) {
- NibbleSwap(&buf[lop],8);
- BitConvert(&buf[lop],BitSwapTable1);
- BitConvert4(&buf[lop]);
- BitConvert(&buf[lop],BitSwapTable2);
- }
- return (char*)buf;
-}
-
-/*==========================================
- * Grfio : Entry table read
- *------------------------------------------
- */
-static int grfio_entryread(char *gfname,int gentry)
-{
- FILE *fp;
- long grf_size,list_size;
- unsigned char grf_header[0x2e];
- int lop,entry,entrys,ofs,grf_version;
- char *fname;
- unsigned char *grf_filelist;
-
- fp = fopen(gfname, "rb");
- if (fp == NULL) {
- printf("GRF data file not found: '%s'.\n",gfname);
- return 1; // 1:not found error
- }
-
- fseek(fp,0,2); // SEEK_END
- grf_size = ftell(fp);
- fseek(fp,0,0); // SEEK_SET
- fread(grf_header,1,0x2e,fp);
- if (strcmp((const char *) grf_header,"Master of Magic") ||
- fseek(fp,getlong(grf_header+0x1e),1)) // SEEK_CUR
- {
- fclose(fp);
- printf("GRF %s read error\n",gfname);
- return 2; // 2:file format error
- }
-
- grf_version = getlong(grf_header+0x2a) >> 8;
-
- if (grf_version == 0x01) { //****** Grf version 01xx ******
- list_size = grf_size - ftell(fp);
- grf_filelist = (unsigned char *) malloc(list_size);
- fread(grf_filelist,1,list_size,fp);
- fclose(fp);
-
- entrys = getlong(grf_header+0x26) - getlong(grf_header+0x22) - 7;
-
- // Get an entry
- for (entry = 0,ofs = 0; entry < entrys; entry++) {
- int ofs2, srclen, srccount, type;
- char *period_ptr;
- FILELIST aentry;
-
- ofs2 = ofs+getlong(grf_filelist+ofs)+4;
- type = grf_filelist[ofs2+12];
- if (type != 0) { // Directory Index ... skip
- fname = decode_filename(grf_filelist+ofs+6, grf_filelist[ofs]-6);
- if (strlen(fname) > sizeof(aentry.fn) - 1) {
- printf("GRF file name %s is too long\n", fname);
- free(grf_filelist);
- exit(1);
- }
- srclen = 0;
- if ((period_ptr = strrchr(fname, '.')) != NULL) {
- for(lop = 0; lop < 4; lop++) {
- if (strcmpi(period_ptr, ".gnd\0.gat\0.act\0.str"+lop*5) == 0)
- break;
- }
- srclen = getlong(grf_filelist+ofs2) - getlong(grf_filelist+ofs2+8) - 715;
- if(lop == 4) {
- for(lop = 10, srccount = 1; srclen >= lop; lop = lop * 10, srccount++);
- } else {
- srccount = 0;
- }
- } else {
- srccount = 0;
- }
-
- aentry.srclen = srclen;
- aentry.srclen_aligned = getlong(grf_filelist+ofs2+4)-37579;
- aentry.declen = getlong(grf_filelist+ofs2+8);
- aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e;
- aentry.cycle = srccount;
- aentry.type = type;
- strncpy(aentry.fn, fname,sizeof(aentry.fn)-1);
- aentry.fnd = NULL;
-#ifdef GRFIO_LOCAL
- aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck
-#else
- aentry.gentry = gentry+1; // With no first time LocalFileCheck
-#endif
- filelist_modify(&aentry);
- }
- ofs = ofs2 + 17;
- }
- free(grf_filelist);
-
- } else if (grf_version == 0x02) { //****** Grf version 02xx ******
- unsigned char eheader[8];
- unsigned char *rBuf;
- uLongf rSize, eSize;
-
- fread(eheader,1,8,fp);
- rSize = getlong(eheader); // Read Size
- eSize = getlong(eheader+4); // Extend Size
-
- if ((long)rSize > grf_size-ftell(fp)) { // Warning fix [Lance]
- fclose(fp);
- printf("Illegal data format: GRF compress entry size\n");
- return 4;
- }
-
- rBuf = (unsigned char *)malloc(rSize); // Get a Read Size
- grf_filelist = (unsigned char *)malloc(eSize); // Get a Extend Size
- fread(rBuf,1,rSize,fp);
- fclose(fp);
- decode_zip(grf_filelist, &eSize, rBuf, rSize); // Decode function
- list_size = eSize;
- free(rBuf);
-
- entrys = getlong(grf_header+0x26) - 7;
-
- // Get an entry
- for(entry = 0, ofs = 0; entry < entrys; entry++){
- int ofs2, srclen, srccount, type;
- FILELIST aentry;
-
- fname = (char*)(grf_filelist+ofs);
- if (strlen(fname) > sizeof(aentry.fn)-1) {
- printf("GRF file name %s is too long\n", fname);
- free(grf_filelist);
- exit(1);
- }
- //ofs2 = ofs+strlen((char*)(grf_filelist+ofs))+1;
- ofs2 = ofs + strlen(fname)+1;
- type = grf_filelist[ofs2+12];
- if (type == 1 || type == 3 || type == 5) {
- srclen = getlong(grf_filelist+ofs2);
- if (grf_filelist[ofs2+12] == 3) {
- for (lop = 10, srccount = 1; srclen >= lop; lop = lop * 10, srccount++);
- } else if (grf_filelist[ofs2+12] == 5) {
- srccount = 0;
- } else { // if (grf_filelist[ofs2+12]==1) {
- srccount = -1;
- }
-
- aentry.srclen = srclen;
- aentry.srclen_aligned = getlong(grf_filelist+ofs2+4);
- aentry.declen = getlong(grf_filelist+ofs2+8);
- aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e;
- aentry.cycle = srccount;
- aentry.type = type;
- strncpy(aentry.fn,fname,sizeof(aentry.fn)-1);
- aentry.fnd = NULL;
-#ifdef GRFIO_LOCAL
- aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck
-#else
- aentry.gentry = gentry+1; // With no first time LocalFileCheck
-#endif
- filelist_modify(&aentry);
- }
- ofs = ofs2 + 17;
- }
- free(grf_filelist);
-
- } else { //****** Grf Other version ******
- fclose(fp);
- printf("GRF version %04x not supported\n",getlong(grf_header+0x2a));
- return 4;
- }
-
- filelist_adjust(); // Unnecessary area release of filelist
-
- return 0; // 0:no error
-}
-
-/*==========================================
- * Grfio : Resource file check
- *------------------------------------------
- */
-static void grfio_resourcecheck(void)
-{
- char w1[256], w2[256], src[256], dst[256], restable[256], line[256];
- char *ptr, *buf;
- FILELIST *entry;
- int size, i = 0;
- FILE *fp;
-
- // read resnametable from data directory and return if successful
- sprintf(restable, "%sdata\\resnametable.txt", data_dir);
- for (ptr = &restable[0]; *ptr != 0; ptr++)
- if (*ptr == '\\') *ptr = '/';
-
- fp = fopen(restable,"rb");
- if (fp) {
- while (fgets(line, sizeof(line) - 1, fp)) {
- if (sscanf(line, "%[^#]#%[^#]#", w1, w2) == 2 &&
- // we only need the maps' GAT and RSW files
- (strstr(w2, ".gat") || strstr(w2, ".rsw")))
- {
- sprintf(src, "data\\%s", w1);
- sprintf(dst, "data\\%s", w2);
- entry = filelist_find(dst);
- // create new entries reusing the original's info
- if (entry != NULL) {
- FILELIST fentry;
- memcpy(&fentry, entry, sizeof(FILELIST));
- strncpy(fentry.fn, src, sizeof(fentry.fn) - 1);
- fentry.fnd = grfio_alloc_ptr(dst);
- filelist_modify(&fentry);
- i++;
- }
- }
- }
- fclose(fp);
- return; // we're done here!
- }
-
- // read resnametable from loaded GRF's, only if it cannot be
- // loaded from the data directory
- buf = (char *)grfio_reads("data\\resnametable.txt", &size);
- if (buf) {
- buf[size] = 0;
- ptr = buf;
-
- while (ptr - buf < size) {
- if (sscanf(ptr, "%[^#]#%[^#]#", w1, w2) == 2 &&
- (strstr(w2, ".gat") || strstr(w2, ".rsw")))
- {
- sprintf(src, "data\\%s", w1);
- sprintf(dst, "data\\%s", w2);
- entry = filelist_find(dst);
- if (entry != NULL) {
- FILELIST fentry;
- memcpy(&fentry, entry, sizeof(FILELIST));
- strncpy(fentry.fn, src, sizeof(fentry.fn) - 1);
- fentry.fnd = grfio_alloc_ptr(dst);
- filelist_modify(&fentry);
- i++;
- }
- }
- ptr = strchr(ptr,'\n'); // Next line
- if (!ptr) break;
- ptr++;
- }
- free(buf);
- return;
- }
-
-}
-
-/*==========================================
- * Grfio : Resource add
- *------------------------------------------
- */
-#define GENTRY_ADDS 4 // The number increment of gentry_table entries
-
-static int grfio_add(char *fname)
-{
- grfio_alloc_ptr(fname);
-
- return grfio_entryread(fname, gentry_entrys - 1);
-}
-
-char *grfio_alloc_ptr(char *fname)
-{
- int len;
- char *buf;
-
- if (gentry_entrys >= GENTRY_LIMIT) {
- printf("GRF file entry limit reached!\n");
- exit(1);
- }
-
- if (gentry_entrys >= gentry_maxentry) {
- gentry_maxentry += GENTRY_ADDS;
- gentry_table = (char**)realloc(gentry_table, gentry_maxentry * sizeof(char*));
- memset(gentry_table + (gentry_maxentry - GENTRY_ADDS), 0, sizeof(char*) * GENTRY_ADDS);
- }
- len = strlen( fname );
- buf = (char*)malloc(len + 1);
- strcpy(buf, fname);
- gentry_table[gentry_entrys++] = buf;
-
- return buf;
-}
-
-/*==========================================
- * Grfio : Finalize
- *------------------------------------------
- */
-void grfio_final(void)
-{
- if (filelist != NULL)
- free(filelist);
-
- filelist_entrys = filelist_maxentry = 0;
-
- if (gentry_table != NULL) {
- int lop;
- for (lop = 0; lop < gentry_entrys; lop++) {
- if (gentry_table[lop] != NULL)
- free(gentry_table[lop]);
- }
- free(gentry_table);
- }
- gentry_table = NULL;
- gentry_entrys = gentry_maxentry = 0;
-}
-
-/*==========================================
- * Grfio : Initialize
- *------------------------------------------
- */
-void grfio_init(char *fname)
-{
- FILE *data_conf;
- char line[1024], w1[1024], w2[1024];
- int grf_num = 0;
-
- hashinit(); // hash table initialization
-
- data_conf = fopen(fname, "r");
- // It will read, if there is grf-files.txt.
- if (data_conf) {
- while(fgets(line, sizeof(line) - 1, data_conf)) {
- if (line[0] == '/' && line[1] == '/')
- continue;
- if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
- continue;
- // Entry table reading
- if(strcmp(w1, "grf") == 0) // GRF file
- grf_num += (grfio_add(w2) == 0);
- else if(strcmp(w1,"data_dir") == 0) // Data directory
- strcpy(data_dir, w2);
- }
- fclose(data_conf);
- } // end of reading grf-files.txt
-
- if (grf_num == 0) {
- printf("No GRF loaded, using default data directory\n");
- }
-
- // Unnecessary area release of filelist
- filelist_adjust();
- // Resource check
- grfio_resourcecheck();
-
- return;
-}
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+/*********************************************************************
+ *
+ * Ragnarok Online Emulator : grfio.c -- grf file I/O Module
+ *--------------------------------------------------------------------
+ * special need library : zlib
+ *********************************************************************
+ * $Id: grfio.c,v 1.2 2004/09/29 17:31:49 kalaspuff Exp $
+ *
+ * 2002/12/18... the original edition
+ * 2003/01/23 ... Code correction
+ * 2003/02/01 ... An addition and decryption processing are improved for LocalFile and two or more GRF(s) check processing.
+ * 2003/02/02 ... Even if there is no grf it does not stop -- as -- correction
+ * 2003/02/02... grf reading specification can be added later -- as -- correction (grfio_add function addition)
+ * 2003/02 / 03... at the time of grfio_resourcecheck processing the entry addition processing method -- correction
+ * 2003/02/05... change of the processing in grfio_init
+ * 2003/02/23... a local file check -- GRFIO_LOCAL -- switch (Defoe -- Function Off)
+ * 2003/10/21 ... The data of alpha client was read.
+ * 2003/11/10 ... Ready new grf format.
+ * 2003/11/11 ... version check fix & bug fix
+ * 2006/04/16 ... fixed crash grfio_find_file when file is not found.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <malloc.h>
+#include <sys/stat.h>
+
+#include "grfio.h"
+#include "../common/mmo.h"
+#include "../zlib/unzip.h"
+
+#define CHUNK 16384
+
+#ifdef __WIN32
+ #include "../zlib/zlib.h"
+ #include "../zlib/iowin32.h"
+#else
+ #ifndef __FREEBSD__
+ #include <zlib.h>
+ #endif
+#endif
+
+typedef unsigned char BYTE;
+typedef unsigned short WORD;
+typedef unsigned long DWORD;
+
+static char data_dir[1024] = ""; // "../";
+
+//----------------------------
+// file entry table struct
+//----------------------------
+typedef struct {
+ int srclen; // compressed size
+ int srclen_aligned; //
+ int declen; // original size
+ int srcpos;
+ short next;
+ int cycle;
+ char type;
+ char fn[128-4*5]; // file name
+ char *fnd;
+ signed char gentry; // read grf file select
+} FILELIST;
+//gentry ... 0 : It acquires from a local file.
+// It acquires from the resource file of 1>=:gentry_table[gentry-1].
+// 1<=: Check a local file.
+// If it is, after re-setting to 0, it acquires from a local file.
+// If there is nothing, mark reversal will be carried out, and it will re-set, and will acquire from a resource file as well as 1>=.
+
+//Since char defines *FILELIST.gentry, the maximum which can be added by grfio_add becomes by 127 pieces.
+
+#define GENTRY_LIMIT 512
+#define FILELIST_LIMIT 1048576 // temporary maximum, and a theory top maximum are 2G.
+
+static FILELIST *filelist = NULL;
+static int filelist_entrys = 0;
+static int filelist_maxentry = 0;
+
+static char **gentry_table = NULL;
+static int gentry_entrys = 0;
+static int gentry_maxentry = 0;
+
+//----------------------------
+// file list hash table
+//----------------------------
+static int filelist_hash[256];
+
+//----------------------------
+// grf decode data table
+//----------------------------
+static unsigned char BitMaskTable[8] = {
+ 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
+};
+
+static char BitSwapTable1[64] = {
+ 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4,
+ 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8,
+ 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3,
+ 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7
+};
+static char BitSwapTable2[64] = {
+ 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31,
+ 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29,
+ 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27,
+ 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25
+};
+static char BitSwapTable3[32] = {
+ 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10,
+ 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25
+};
+
+static unsigned char NibbleData[4][64]={
+ {
+ 0xef, 0x03, 0x41, 0xfd, 0xd8, 0x74, 0x1e, 0x47, 0x26, 0xef, 0xfb, 0x22, 0xb3, 0xd8, 0x84, 0x1e,
+ 0x39, 0xac, 0xa7, 0x60, 0x62, 0xc1, 0xcd, 0xba, 0x5c, 0x96, 0x90, 0x59, 0x05, 0x3b, 0x7a, 0x85,
+ 0x40, 0xfd, 0x1e, 0xc8, 0xe7, 0x8a, 0x8b, 0x21, 0xda, 0x43, 0x64, 0x9f, 0x2d, 0x14, 0xb1, 0x72,
+ 0xf5, 0x5b, 0xc8, 0xb6, 0x9c, 0x37, 0x76, 0xec, 0x39, 0xa0, 0xa3, 0x05, 0x52, 0x6e, 0x0f, 0xd9,
+ }, {
+ 0xa7, 0xdd, 0x0d, 0x78, 0x9e, 0x0b, 0xe3, 0x95, 0x60, 0x36, 0x36, 0x4f, 0xf9, 0x60, 0x5a, 0xa3,
+ 0x11, 0x24, 0xd2, 0x87, 0xc8, 0x52, 0x75, 0xec, 0xbb, 0xc1, 0x4c, 0xba, 0x24, 0xfe, 0x8f, 0x19,
+ 0xda, 0x13, 0x66, 0xaf, 0x49, 0xd0, 0x90, 0x06, 0x8c, 0x6a, 0xfb, 0x91, 0x37, 0x8d, 0x0d, 0x78,
+ 0xbf, 0x49, 0x11, 0xf4, 0x23, 0xe5, 0xce, 0x3b, 0x55, 0xbc, 0xa2, 0x57, 0xe8, 0x22, 0x74, 0xce,
+ }, {
+ 0x2c, 0xea, 0xc1, 0xbf, 0x4a, 0x24, 0x1f, 0xc2, 0x79, 0x47, 0xa2, 0x7c, 0xb6, 0xd9, 0x68, 0x15,
+ 0x80, 0x56, 0x5d, 0x01, 0x33, 0xfd, 0xf4, 0xae, 0xde, 0x30, 0x07, 0x9b, 0xe5, 0x83, 0x9b, 0x68,
+ 0x49, 0xb4, 0x2e, 0x83, 0x1f, 0xc2, 0xb5, 0x7c, 0xa2, 0x19, 0xd8, 0xe5, 0x7c, 0x2f, 0x83, 0xda,
+ 0xf7, 0x6b, 0x90, 0xfe, 0xc4, 0x01, 0x5a, 0x97, 0x61, 0xa6, 0x3d, 0x40, 0x0b, 0x58, 0xe6, 0x3d,
+ }, {
+ 0x4d, 0xd1, 0xb2, 0x0f, 0x28, 0xbd, 0xe4, 0x78, 0xf6, 0x4a, 0x0f, 0x93, 0x8b, 0x17, 0xd1, 0xa4,
+ 0x3a, 0xec, 0xc9, 0x35, 0x93, 0x56, 0x7e, 0xcb, 0x55, 0x20, 0xa0, 0xfe, 0x6c, 0x89, 0x17, 0x62,
+ 0x17, 0x62, 0x4b, 0xb1, 0xb4, 0xde, 0xd1, 0x87, 0xc9, 0x14, 0x3c, 0x4a, 0x7e, 0xa8, 0xe2, 0x7d,
+ 0xa0, 0x9f, 0xf6, 0x5c, 0x6a, 0x09, 0x8d, 0xf0, 0x0f, 0xe3, 0x53, 0x25, 0x95, 0x36, 0x28, 0xcb,
+ }
+};
+/*-----------------
+ * long data get
+ */
+static unsigned int getlong(unsigned char *p)
+{
+ return p[0]
+ | p[1] << 0x08
+ | p[2] << 0x10
+ | p[3] << 0x18; // Shinomori
+}
+
+/*==========================================
+ * Grf data decode : Subs
+ *------------------------------------------
+ */
+static void NibbleSwap(BYTE *Src, int len)
+{
+ for(;0<len;len--,Src++) {
+ *Src = (*Src>>4) | (*Src<<4);
+ }
+}
+
+static void BitConvert(BYTE *Src,char *BitSwapTable)
+{
+ int lop,prm;
+ BYTE tmp[8];
+ memset(tmp,0,8);
+ for(lop=0;lop!=64;lop++) {
+ prm = BitSwapTable[lop]-1;
+ if (Src[(prm >> 3) & 7] & BitMaskTable[prm & 7]) {
+ tmp[(lop >> 3) & 7] |= BitMaskTable[lop & 7];
+ }
+ }
+ memcpy(Src,tmp,8);
+}
+
+static void BitConvert4(BYTE *Src)
+{
+ int lop,prm;
+ BYTE tmp[8];
+ tmp[0] = ((Src[7]<<5) | (Src[4]>>3)) & 0x3f; // ..0 vutsr
+ tmp[1] = ((Src[4]<<1) | (Src[5]>>7)) & 0x3f; // ..srqpo n
+ tmp[2] = ((Src[4]<<5) | (Src[5]>>3)) & 0x3f; // ..o nmlkj
+ tmp[3] = ((Src[5]<<1) | (Src[6]>>7)) & 0x3f; // ..kjihg f
+ tmp[4] = ((Src[5]<<5) | (Src[6]>>3)) & 0x3f; // ..g fedcb
+ tmp[5] = ((Src[6]<<1) | (Src[7]>>7)) & 0x3f; // ..cba98 7
+ tmp[6] = ((Src[6]<<5) | (Src[7]>>3)) & 0x3f; // ..8 76543
+ tmp[7] = ((Src[7]<<1) | (Src[4]>>7)) & 0x3f; // ..43210 v
+
+ for(lop=0;lop!=4;lop++) {
+ tmp[lop] = (NibbleData[lop][tmp[lop*2]] & 0xf0)
+ | (NibbleData[lop][tmp[lop*2+1]] & 0x0f);
+ }
+
+ *(DWORD*)(tmp+4)=0;
+ for(lop=0;lop!=32;lop++) {
+ prm = BitSwapTable3[lop]-1;
+ if (tmp[prm >> 3] & BitMaskTable[prm & 7]) {
+ tmp[(lop >> 3) + 4] |= BitMaskTable[lop & 7];
+ }
+ }
+ Src[0] ^= tmp[4];
+ Src[1] ^= tmp[5];
+ Src[2] ^= tmp[6];
+ Src[3] ^= tmp[7];
+}
+
+static void decode_des_etc(BYTE *buf,int len,int type,int cycle)
+{
+ int lop,cnt=0;
+ if(cycle<3) cycle=3;
+ else if(cycle<5) cycle++;
+ else if(cycle<7) cycle+=9;
+ else cycle+=15;
+
+ for(lop=0;lop*8<len;lop++,buf+=8) {
+ if(lop<20 || (type==0 && lop%cycle==0)){ // des
+ BitConvert(buf,BitSwapTable1);
+ BitConvert4(buf);
+ BitConvert(buf,BitSwapTable2);
+ } else {
+ if(cnt==7 && type==0){
+ int a;
+ BYTE tmp[8];
+ *(DWORD*)tmp = *(DWORD*)buf;
+ *(DWORD*)(tmp+4) = *(DWORD*)(buf+4);
+ cnt=0;
+ buf[0]=tmp[3];
+ buf[1]=tmp[4];
+ buf[2]=tmp[6];
+ buf[3]=tmp[0];
+ buf[4]=tmp[1];
+ buf[5]=tmp[2];
+ buf[6]=tmp[5];
+ a=tmp[7];
+ if(a==0x00) a=0x2b;
+ else if(a==0x2b) a=0x00;
+ else if(a==0x01) a=0x68;
+ else if(a==0x68) a=0x01;
+ else if(a==0x48) a=0x77;
+ else if(a==0x77) a=0x48;
+ else if(a==0x60) a=0xff;
+ else if(a==0xff) a=0x60;
+ else if(a==0x6c) a=0x80;
+ else if(a==0x80) a=0x6c;
+ else if(a==0xb9) a=0xc0;
+ else if(a==0xc0) a=0xb9;
+ else if(a==0xeb) a=0xfe;
+ else if(a==0xfe) a=0xeb;
+ buf[7]=a;
+ }
+ cnt++;
+ }
+ }
+}
+/*==========================================
+ * Grf data decode sub : zip
+ *------------------------------------------
+ */
+int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen)
+{
+ z_stream stream;
+ int err;
+
+ stream.next_in = (Bytef*)source;
+ stream.avail_in = (uInt)sourceLen;
+ /* Check for source > 64K on 16-bit machine: */
+ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+
+ stream.next_out = (Bytef*) dest;
+ stream.avail_out = (uInt)*destLen;
+ if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+ stream.zalloc = (alloc_func)0;
+ stream.zfree = (free_func)0;
+
+ err = inflateInit(&stream);
+ if (err != Z_OK) return err;
+
+ err = inflate(&stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ inflateEnd(&stream);
+ return err == Z_OK ? Z_BUF_ERROR : err;
+ }
+ *destLen = stream.total_out;
+
+ err = inflateEnd(&stream);
+ return err;
+}
+
+int encode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen) {
+ z_stream stream;
+ int err;
+ memset(&stream, 0, sizeof(stream));
+ stream.next_in = (Bytef*)source;
+ stream.avail_in = (uInt)sourceLen;
+ /* Check for source > 64K on 16-bit machine: */
+ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+
+ stream.next_out = (Bytef*) dest;
+ stream.avail_out = (uInt)*destLen;
+ if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+ stream.zalloc = (alloc_func)0;
+ stream.zfree = (free_func)0;
+
+ err = deflateInit(&stream,Z_DEFAULT_COMPRESSION);
+ if (err != Z_OK) return err;
+
+ err = deflate(&stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ inflateEnd(&stream);
+ return err == Z_OK ? Z_BUF_ERROR : err;
+ }
+ *destLen = stream.total_out;
+
+ err = deflateEnd(&stream);
+ return err;
+}
+
+/* ===================================
+* Unzips a file. 1: success, 0: error
+* Adapted from miniunz.c [Celest]
+* Version 1.01b, May 30th, 2004
+* Copyright (C) 1998-2004 Gilles Vollant
+* -------------------------------------
+*/
+int deflate_file (const char *source, const char *filename)
+{
+#ifdef _WIN32
+ zlib_filefunc_def ffunc;
+#endif
+ unzFile uf = NULL;
+ int err = UNZ_OK;
+ uInt size_buf = 8192;
+ FILE *fout = NULL;
+ void *buf;
+
+#ifdef _WIN32
+ fill_win32_filefunc(&ffunc);
+ uf = unzOpen2(source, &ffunc);
+#else
+ uf = unzOpen(source);
+#endif
+
+ if (uf == NULL)
+ return 0;
+
+ if (unzLocateFile(uf, filename, 0) != UNZ_OK)
+ return 0;
+
+ err = unzOpenCurrentFilePassword(uf, NULL);
+
+ fout = fopen(filename,"wb");
+ if (fout == NULL)
+ return 0;
+
+ buf = (void *)malloc(size_buf);
+ do {
+ err = unzReadCurrentFile(uf, buf, size_buf);
+ if (err < 0)
+ break;
+ if (err > 0 &&
+ fwrite(buf, err, 1, fout)!=1)
+ {
+ err = UNZ_ERRNO;
+ break;
+ }
+ } while (err > 0);
+
+ if (fout) fclose(fout);
+
+ if (err == UNZ_OK) {
+ err = unzCloseCurrentFile (uf);
+ free(buf);
+ return (err == UNZ_OK);
+ }
+
+ unzCloseCurrentFile(uf); /* don't lose the error */
+
+ return 0;
+}
+
+unsigned long grfio_crc32 (const unsigned char *buf, unsigned int len)
+{
+ return crc32(crc32(0L, Z_NULL, 0), buf, len);
+}
+
+/***********************************************************
+ *** File List Subroutines ***
+ ***********************************************************/
+
+/*==========================================
+ * File List : Hash make
+ *------------------------------------------
+ */
+static int filehash(unsigned char *fname)
+{
+ unsigned int hash=0;
+ while(*fname) {
+ hash = ((hash<<1)+(hash>>7)*9+tolower(*fname));
+ fname++;
+ }
+ return hash & 255;
+}
+
+/*==========================================
+ * File List : Hash initalize
+ *------------------------------------------
+ */
+static void hashinit(void)
+{
+ int lop;
+ for (lop = 0; lop < 256; lop++)
+ filelist_hash[lop] = -1;
+}
+
+/*==========================================
+ * File List : File find
+ *------------------------------------------
+ */
+static FILELIST *filelist_find(char *fname)
+{
+ int hash;
+
+ if (!filelist)
+ return NULL;
+
+ for (hash = filelist_hash[filehash((unsigned char *) fname)]; hash >= 0; hash = filelist[hash].next) {
+ if(strcmpi(filelist[hash].fn, fname) == 0)
+ break;
+ }
+
+ return (hash >= 0) ? &filelist[hash] : NULL;
+}
+
+char *grfio_find_file(char *fname){
+ FILELIST *filelist = filelist_find(fname);
+ if (!filelist) return NULL;
+ return (!filelist->fnd?filelist->fn:filelist->fnd);
+}
+
+/*==========================================
+ * File List : Filelist add
+ *------------------------------------------
+ */
+#define FILELIST_ADDS 1024 // number increment of file lists `
+
+static FILELIST* filelist_add(FILELIST *entry)
+{
+ int hash;
+
+ if (filelist_entrys >= FILELIST_LIMIT) {
+ printf("GRF filelist limit reached!\n");
+ exit(1);
+ }
+
+ if (filelist_entrys >= filelist_maxentry) {
+ filelist = (FILELIST *)realloc(filelist, (filelist_maxentry + FILELIST_ADDS) * sizeof(FILELIST));
+ memset(filelist + filelist_maxentry, '\0', FILELIST_ADDS * sizeof(FILELIST));
+ filelist_maxentry += FILELIST_ADDS;
+ }
+
+ memcpy (&filelist[filelist_entrys], entry, sizeof(FILELIST));
+
+ hash = filehash((unsigned char *) entry->fn);
+ filelist[filelist_entrys].next = filelist_hash[hash];
+ filelist_hash[hash] = filelist_entrys;
+
+ filelist_entrys++;
+
+ return &filelist[filelist_entrys - 1];
+}
+
+static FILELIST* filelist_modify(FILELIST *entry)
+{
+ FILELIST *fentry;
+ if ((fentry = filelist_find(entry->fn)) != NULL) {
+ int tmp = fentry->next;
+ memcpy(fentry, entry, sizeof(FILELIST));
+ fentry->next = tmp;
+ } else {
+ fentry = filelist_add(entry);
+ }
+ return fentry;
+}
+
+/*==========================================
+ * File List : filelist size adjust
+ *------------------------------------------
+ */
+static void filelist_adjust(void)
+{
+ if (filelist != NULL) {
+ if (filelist_maxentry > filelist_entrys) {
+ filelist = (FILELIST *)realloc(
+ filelist, filelist_entrys * sizeof(FILELIST));
+ filelist_maxentry = filelist_entrys;
+ }
+ }
+}
+
+/***********************************************************
+ *** Grfio Sobroutines ***
+ ***********************************************************/
+
+/*==========================================
+ * Grfio : Resource file size get
+ *------------------------------------------
+ */
+int grfio_size(char *fname)
+{
+ FILELIST *entry;
+
+ entry = filelist_find(fname);
+
+ if (entry == NULL || entry->gentry < 0) { // LocalFileCheck
+ char lfname[256], *p;
+ FILELIST lentry;
+ struct stat st;
+
+ sprintf(lfname, "%s%s", data_dir, fname);
+
+ for (p = &lfname[0]; *p != 0; p++)
+ if (*p=='\\') *p = '/'; // * At the time of Unix
+
+ if (stat(lfname, &st) == 0) {
+ strncpy(lentry.fn, fname, sizeof(lentry.fn) - 1);
+ lentry.fnd = NULL;
+ lentry.declen = st.st_size;
+ lentry.gentry = 0; // 0:LocalFile
+ entry = filelist_modify(&lentry);
+ } else if (entry == NULL) {
+ printf("%s not found (grfio_size)\n", fname);
+ //exit(1);
+ return -1;
+ }
+ }
+ return entry->declen;
+}
+
+/*==========================================
+ * Grfio : Resource file read & size get
+ *------------------------------------------
+ */
+void* grfio_reads(char *fname, int *size)
+{
+ FILE *in;
+ FILELIST *entry;
+ unsigned char *buf2 = NULL;
+
+ entry = filelist_find(fname);
+
+ if (entry == NULL || entry->gentry <= 0) { // LocalFileCheck
+ char lfname[256], *p;
+ FILELIST lentry;
+
+ sprintf(lfname, "%s%s", data_dir, fname);
+
+ for (p = &lfname[0]; *p != 0; p++)
+ if (*p == '\\') *p = '/'; // * At the time of Unix
+
+ in = fopen(lfname, "rb");
+ if (in != NULL) {
+ if (entry != NULL && entry->gentry == 0) {
+ lentry.declen = entry->declen;
+ } else {
+ fseek(in,0,2); // SEEK_END
+ lentry.declen = ftell(in);
+ }
+ fseek(in,0,0); // SEEK_SET
+ buf2 = (unsigned char *)malloc(lentry.declen + 1024);
+ fread(buf2, 1, lentry.declen, in);
+ fclose(in);
+ strncpy(lentry.fn, fname, sizeof(lentry.fn) - 1);
+ lentry.fnd = NULL;
+ lentry.gentry = 0; // 0:LocalFile
+ entry = filelist_modify(&lentry);
+ } else {
+ if (entry != NULL && entry->gentry < 0) {
+ entry->gentry = -entry->gentry; // local file checked
+ } else {
+ printf("%s not found (grfio_reads - local file %s)\n", fname, lfname);
+ return NULL;
+ }
+ }
+ }
+ if (entry != NULL && entry->gentry > 0) { // Archive[GRF] File Read
+ char *gfname = gentry_table[entry->gentry - 1];
+ in = fopen(gfname, "rb");
+ if(in != NULL) {
+ unsigned char *buf = (unsigned char *)malloc(entry->srclen_aligned + 1024);
+ fseek(in, entry->srcpos, 0);
+ fread(buf, 1, entry->srclen_aligned, in);
+ fclose(in);
+ buf2 = (unsigned char *)malloc(entry->declen + 1024);
+ if (entry->type == 1 || entry->type == 3 || entry->type == 5) {
+ uLongf len;
+ if (entry->cycle >= 0)
+ decode_des_etc(buf, entry->srclen_aligned, entry->cycle == 0, entry->cycle);
+ len = entry->declen;
+ decode_zip(buf2, &len, buf, entry->srclen);
+ if (len != entry->declen) {
+ printf("decode_zip size mismatch err: %d != %d\n", (int)len, entry->declen);
+ free(buf);
+ free(buf2);
+ return NULL;
+ }
+ } else {
+ memcpy(buf2, buf, entry->declen);
+ }
+ free(buf);
+ } else {
+ printf("%s not found (grfio_reads - GRF file %s)\n", fname, gfname);
+ return NULL;
+ }
+ }
+ if (size != NULL && entry != NULL)
+ *size = entry->declen;
+
+ return buf2;
+}
+
+/*==========================================
+ * Resource filename decode
+ *------------------------------------------
+ */
+static char * decode_filename(unsigned char *buf,int len)
+{
+ int lop;
+ for(lop=0;lop<len;lop+=8) {
+ NibbleSwap(&buf[lop],8);
+ BitConvert(&buf[lop],BitSwapTable1);
+ BitConvert4(&buf[lop]);
+ BitConvert(&buf[lop],BitSwapTable2);
+ }
+ return (char*)buf;
+}
+
+/*==========================================
+ * Grfio : Entry table read
+ *------------------------------------------
+ */
+static int grfio_entryread(char *gfname,int gentry)
+{
+ FILE *fp;
+ long grf_size,list_size;
+ unsigned char grf_header[0x2e];
+ int lop,entry,entrys,ofs,grf_version;
+ char *fname;
+ unsigned char *grf_filelist;
+
+ fp = fopen(gfname, "rb");
+ if (fp == NULL) {
+ printf("GRF data file not found: '%s'.\n",gfname);
+ return 1; // 1:not found error
+ }
+
+ fseek(fp,0,2); // SEEK_END
+ grf_size = ftell(fp);
+ fseek(fp,0,0); // SEEK_SET
+ fread(grf_header,1,0x2e,fp);
+ if (strcmp((const char *) grf_header,"Master of Magic") ||
+ fseek(fp,getlong(grf_header+0x1e),1)) // SEEK_CUR
+ {
+ fclose(fp);
+ printf("GRF %s read error\n",gfname);
+ return 2; // 2:file format error
+ }
+
+ grf_version = getlong(grf_header+0x2a) >> 8;
+
+ if (grf_version == 0x01) { //****** Grf version 01xx ******
+ list_size = grf_size - ftell(fp);
+ grf_filelist = (unsigned char *) malloc(list_size);
+ fread(grf_filelist,1,list_size,fp);
+ fclose(fp);
+
+ entrys = getlong(grf_header+0x26) - getlong(grf_header+0x22) - 7;
+
+ // Get an entry
+ for (entry = 0,ofs = 0; entry < entrys; entry++) {
+ int ofs2, srclen, srccount, type;
+ char *period_ptr;
+ FILELIST aentry;
+
+ ofs2 = ofs+getlong(grf_filelist+ofs)+4;
+ type = grf_filelist[ofs2+12];
+ if (type != 0) { // Directory Index ... skip
+ fname = decode_filename(grf_filelist+ofs+6, grf_filelist[ofs]-6);
+ if (strlen(fname) > sizeof(aentry.fn) - 1) {
+ printf("GRF file name %s is too long\n", fname);
+ free(grf_filelist);
+ exit(1);
+ }
+ srclen = 0;
+ if ((period_ptr = strrchr(fname, '.')) != NULL) {
+ for(lop = 0; lop < 4; lop++) {
+ if (strcmpi(period_ptr, ".gnd\0.gat\0.act\0.str"+lop*5) == 0)
+ break;
+ }
+ srclen = getlong(grf_filelist+ofs2) - getlong(grf_filelist+ofs2+8) - 715;
+ if(lop == 4) {
+ for(lop = 10, srccount = 1; srclen >= lop; lop = lop * 10, srccount++);
+ } else {
+ srccount = 0;
+ }
+ } else {
+ srccount = 0;
+ }
+
+ aentry.srclen = srclen;
+ aentry.srclen_aligned = getlong(grf_filelist+ofs2+4)-37579;
+ aentry.declen = getlong(grf_filelist+ofs2+8);
+ aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e;
+ aentry.cycle = srccount;
+ aentry.type = type;
+ strncpy(aentry.fn, fname,sizeof(aentry.fn)-1);
+ aentry.fnd = NULL;
+#ifdef GRFIO_LOCAL
+ aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck
+#else
+ aentry.gentry = gentry+1; // With no first time LocalFileCheck
+#endif
+ filelist_modify(&aentry);
+ }
+ ofs = ofs2 + 17;
+ }
+ free(grf_filelist);
+
+ } else if (grf_version == 0x02) { //****** Grf version 02xx ******
+ unsigned char eheader[8];
+ unsigned char *rBuf;
+ uLongf rSize, eSize;
+
+ fread(eheader,1,8,fp);
+ rSize = getlong(eheader); // Read Size
+ eSize = getlong(eheader+4); // Extend Size
+
+ if ((long)rSize > grf_size-ftell(fp)) { // Warning fix [Lance]
+ fclose(fp);
+ printf("Illegal data format: GRF compress entry size\n");
+ return 4;
+ }
+
+ rBuf = (unsigned char *)malloc(rSize); // Get a Read Size
+ grf_filelist = (unsigned char *)malloc(eSize); // Get a Extend Size
+ fread(rBuf,1,rSize,fp);
+ fclose(fp);
+ decode_zip(grf_filelist, &eSize, rBuf, rSize); // Decode function
+ list_size = eSize;
+ free(rBuf);
+
+ entrys = getlong(grf_header+0x26) - 7;
+
+ // Get an entry
+ for(entry = 0, ofs = 0; entry < entrys; entry++){
+ int ofs2, srclen, srccount, type;
+ FILELIST aentry;
+
+ fname = (char*)(grf_filelist+ofs);
+ if (strlen(fname) > sizeof(aentry.fn)-1) {
+ printf("GRF file name %s is too long\n", fname);
+ free(grf_filelist);
+ exit(1);
+ }
+ //ofs2 = ofs+strlen((char*)(grf_filelist+ofs))+1;
+ ofs2 = ofs + strlen(fname)+1;
+ type = grf_filelist[ofs2+12];
+ if (type == 1 || type == 3 || type == 5) {
+ srclen = getlong(grf_filelist+ofs2);
+ if (grf_filelist[ofs2+12] == 3) {
+ for (lop = 10, srccount = 1; srclen >= lop; lop = lop * 10, srccount++);
+ } else if (grf_filelist[ofs2+12] == 5) {
+ srccount = 0;
+ } else { // if (grf_filelist[ofs2+12]==1) {
+ srccount = -1;
+ }
+
+ aentry.srclen = srclen;
+ aentry.srclen_aligned = getlong(grf_filelist+ofs2+4);
+ aentry.declen = getlong(grf_filelist+ofs2+8);
+ aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e;
+ aentry.cycle = srccount;
+ aentry.type = type;
+ strncpy(aentry.fn,fname,sizeof(aentry.fn)-1);
+ aentry.fnd = NULL;
+#ifdef GRFIO_LOCAL
+ aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck
+#else
+ aentry.gentry = gentry+1; // With no first time LocalFileCheck
+#endif
+ filelist_modify(&aentry);
+ }
+ ofs = ofs2 + 17;
+ }
+ free(grf_filelist);
+
+ } else { //****** Grf Other version ******
+ fclose(fp);
+ printf("GRF version %04x not supported\n",getlong(grf_header+0x2a));
+ return 4;
+ }
+
+ filelist_adjust(); // Unnecessary area release of filelist
+
+ return 0; // 0:no error
+}
+
+/*==========================================
+ * Grfio : Resource file check
+ *------------------------------------------
+ */
+static void grfio_resourcecheck(void)
+{
+ char w1[256], w2[256], src[256], dst[256], restable[256], line[256];
+ char *ptr, *buf;
+ FILELIST *entry;
+ int size, i = 0;
+ FILE *fp;
+
+ // read resnametable from data directory and return if successful
+ sprintf(restable, "%sdata\\resnametable.txt", data_dir);
+ for (ptr = &restable[0]; *ptr != 0; ptr++)
+ if (*ptr == '\\') *ptr = '/';
+
+ fp = fopen(restable,"rb");
+ if (fp) {
+ while (fgets(line, sizeof(line) - 1, fp)) {
+ if (sscanf(line, "%[^#]#%[^#]#", w1, w2) == 2 &&
+ // we only need the maps' GAT and RSW files
+ (strstr(w2, ".gat") || strstr(w2, ".rsw")))
+ {
+ sprintf(src, "data\\%s", w1);
+ sprintf(dst, "data\\%s", w2);
+ entry = filelist_find(dst);
+ // create new entries reusing the original's info
+ if (entry != NULL) {
+ FILELIST fentry;
+ memcpy(&fentry, entry, sizeof(FILELIST));
+ strncpy(fentry.fn, src, sizeof(fentry.fn) - 1);
+ fentry.fnd = grfio_alloc_ptr(dst);
+ filelist_modify(&fentry);
+ i++;
+ }
+ }
+ }
+ fclose(fp);
+ return; // we're done here!
+ }
+
+ // read resnametable from loaded GRF's, only if it cannot be
+ // loaded from the data directory
+ buf = (char *)grfio_reads("data\\resnametable.txt", &size);
+ if (buf) {
+ buf[size] = 0;
+ ptr = buf;
+
+ while (ptr - buf < size) {
+ if (sscanf(ptr, "%[^#]#%[^#]#", w1, w2) == 2 &&
+ (strstr(w2, ".gat") || strstr(w2, ".rsw")))
+ {
+ sprintf(src, "data\\%s", w1);
+ sprintf(dst, "data\\%s", w2);
+ entry = filelist_find(dst);
+ if (entry != NULL) {
+ FILELIST fentry;
+ memcpy(&fentry, entry, sizeof(FILELIST));
+ strncpy(fentry.fn, src, sizeof(fentry.fn) - 1);
+ fentry.fnd = grfio_alloc_ptr(dst);
+ filelist_modify(&fentry);
+ i++;
+ }
+ }
+ ptr = strchr(ptr,'\n'); // Next line
+ if (!ptr) break;
+ ptr++;
+ }
+ free(buf);
+ return;
+ }
+
+}
+
+/*==========================================
+ * Grfio : Resource add
+ *------------------------------------------
+ */
+#define GENTRY_ADDS 4 // The number increment of gentry_table entries
+
+static int grfio_add(char *fname)
+{
+ grfio_alloc_ptr(fname);
+
+ return grfio_entryread(fname, gentry_entrys - 1);
+}
+
+char *grfio_alloc_ptr(char *fname)
+{
+ int len;
+ char *buf;
+
+ if (gentry_entrys >= GENTRY_LIMIT) {
+ printf("GRF file entry limit reached!\n");
+ exit(1);
+ }
+
+ if (gentry_entrys >= gentry_maxentry) {
+ gentry_maxentry += GENTRY_ADDS;
+ gentry_table = (char**)realloc(gentry_table, gentry_maxentry * sizeof(char*));
+ memset(gentry_table + (gentry_maxentry - GENTRY_ADDS), 0, sizeof(char*) * GENTRY_ADDS);
+ }
+ len = strlen( fname );
+ buf = (char*)malloc(len + 1);
+ strcpy(buf, fname);
+ gentry_table[gentry_entrys++] = buf;
+
+ return buf;
+}
+
+/*==========================================
+ * Grfio : Finalize
+ *------------------------------------------
+ */
+void grfio_final(void)
+{
+ if (filelist != NULL)
+ free(filelist);
+
+ filelist_entrys = filelist_maxentry = 0;
+
+ if (gentry_table != NULL) {
+ int lop;
+ for (lop = 0; lop < gentry_entrys; lop++) {
+ if (gentry_table[lop] != NULL)
+ free(gentry_table[lop]);
+ }
+ free(gentry_table);
+ }
+ gentry_table = NULL;
+ gentry_entrys = gentry_maxentry = 0;
+}
+
+/*==========================================
+ * Grfio : Initialize
+ *------------------------------------------
+ */
+void grfio_init(char *fname)
+{
+ FILE *data_conf;
+ char line[1024], w1[1024], w2[1024];
+ int grf_num = 0;
+
+ hashinit(); // hash table initialization
+
+ data_conf = fopen(fname, "r");
+ // It will read, if there is grf-files.txt.
+ if (data_conf) {
+ while(fgets(line, sizeof(line) - 1, data_conf)) {
+ if (line[0] == '/' && line[1] == '/')
+ continue;
+ if (sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2)
+ continue;
+ // Entry table reading
+ if(strcmp(w1, "grf") == 0) // GRF file
+ grf_num += (grfio_add(w2) == 0);
+ else if(strcmp(w1,"data_dir") == 0) // Data directory
+ strcpy(data_dir, w2);
+ }
+ fclose(data_conf);
+ } // end of reading grf-files.txt
+
+ if (grf_num == 0) {
+ printf("No GRF loaded, using default data directory\n");
+ }
+
+ // Unnecessary area release of filelist
+ filelist_adjust();
+ // Resource check
+ grfio_resourcecheck();
+
+ return;
+}
diff --git a/src/tool/grfio.h b/src/tool/grfio.h
index 72aceeda9..0d6268b0d 100644
--- a/src/tool/grfio.h
+++ b/src/tool/grfio.h
@@ -1,23 +1,23 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#ifndef _GRFIO_H_
-#define _GRFIO_H_
-
-void grfio_init(char*); // GRFIO Initialize
-void grfio_final(void); // GRFIO Finalize
-void* grfio_reads(char*,int*); // GRFIO data file read & size get
-char *grfio_find_file(char *fname);
-char *grfio_alloc_ptr(char *fname);
-
-#define grfio_read(fn) grfio_reads(fn, NULL)
-
-int grfio_size(char*); // GRFIO data file size get
-unsigned long grfio_crc32(const unsigned char *buf, unsigned int len);
-
-int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen);
-int encode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen);
-int deflate_file (const char *source, const char *filename);
-
-#endif /* _GRFIO_H_ */
-
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+#ifndef _GRFIO_H_
+#define _GRFIO_H_
+
+void grfio_init(char*); // GRFIO Initialize
+void grfio_final(void); // GRFIO Finalize
+void* grfio_reads(char*,int*); // GRFIO data file read & size get
+char *grfio_find_file(char *fname);
+char *grfio_alloc_ptr(char *fname);
+
+#define grfio_read(fn) grfio_reads(fn, NULL)
+
+int grfio_size(char*); // GRFIO data file size get
+unsigned long grfio_crc32(const unsigned char *buf, unsigned int len);
+
+int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen);
+int encode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen);
+int deflate_file (const char *source, const char *filename);
+
+#endif /* _GRFIO_H_ */
+
diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c
index c7e6aaa60..f2d638d34 100644
--- a/src/tool/mapcache.c
+++ b/src/tool/mapcache.c
@@ -1,202 +1,202 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <malloc.h>
-
-#ifndef _WIN32
-#include <unistd.h>
-#endif
-
-#include "grfio.h"
-
-char grf_list_file[256] = "tools/mapcache/grf_files.txt";
-char map_list_file[256] = "tools/mapcache/map_list.txt";
-char map_cache_file[256] = "map_cache.dat";
-
-#define MAP_NAME_LENGTH 16
-#define NO_WATER 1000000
-
-// Used internally, this structure contains the physical map cells
-struct map_data {
- short xs;
- short ys;
- unsigned char *cells;
-};
-
-// This is the header appended before every compressed map cells info
-struct map_cache_info {
- char name[MAP_NAME_LENGTH];
- unsigned short index;
- short xs;
- short ys;
- long len;
-};
-
-// This is the main header found at the very beginning of the file
-struct map_cache_head {
- short sizeof_header;
- short sizeof_mapinfo;
- long filesize;
- unsigned short map_count;
-} header;
-
-FILE *map_cache_fp;
-
-
-// Read map from GRF's GAT and RSW files
-int read_map(char *name, struct map_data *m)
-{
- char filename[256];
- char *gat, *rsw;
- int water_height;
- int x, y, xs, ys;
- struct gat_cell {
- float height[4];
- int type;
- } *p = NULL;
-
- // Open map GAT
- sprintf(filename,"data\\%s.gat", name);
- gat = (char *)grfio_read(filename);
- if (gat == NULL)
- return 0;
-
- // Open map RSW
- sprintf(filename,"data\\%s.rsw", name);
- rsw = (char *)grfio_read(filename);
-
- // Read water height
- if (rsw) {
- float temp = *(float*)(rsw+166);
- water_height = (int)temp;
- free(rsw);
- } else
- water_height = NO_WATER;
-
- // Read map size and allocate needed memory
- xs = m->xs = *(int*)(gat+6);
- ys = m->ys = *(int*)(gat+10);
- m->cells = (unsigned char *)malloc(xs*ys);
-
- // Set cell properties
- for (y = 0; y < ys; y++) {
- p = (struct gat_cell*)(gat+14+y*xs*20);
- for (x = 0; x < xs; x++) {
- if (water_height != NO_WATER && p->type == 0 && (p->height[0] > water_height || p->height[1] > water_height || p->height[2] > water_height || p->height[3] > water_height))
- m->cells[x+y*xs] = 3; // Cell is 0 (walkable) but under water level, set to 3 (walkable water)
- else
- m->cells[x+y*xs] = p->type;
- p++;
- }
- }
-
- free(gat);
-
- return 1;
-}
-
-void cache_map(char *name, unsigned short index, struct map_data *m)
-{
- struct map_cache_info info;
- unsigned long len;
- char *write_buf;
-
- // Create an output buffer twice as big as the uncompressed map... this way we're sure it fits
- len = m->xs*m->ys*2;
- write_buf = (char *)malloc(len);
- // Compress the cells and get the compressed length
- encode_zip((unsigned char *)write_buf, &len, m->cells, m->xs*m->ys);
-
- // Fill the map header
- strncpy(info.name, name, MAP_NAME_LENGTH);
- info.index = index;
- info.xs = m->xs;
- info.ys = m->ys;
- info.len = len;
-
- // Append map header then compressed cells at the end of the file
- fseek(map_cache_fp, header.filesize, SEEK_SET);
- fwrite(&info, sizeof(struct map_cache_info), 1, map_cache_fp);
- fwrite(write_buf, 1, len, map_cache_fp);
- header.map_count++;
- header.filesize += header.sizeof_mapinfo + len;
-
- free(write_buf);
- free(m->cells);
-
- return;
-}
-
-int main(int argc, char *argv[])
-{
- FILE *list;
- char line[1024];
- struct map_data map;
- char name[MAP_NAME_LENGTH];
- unsigned short index = 1;
-
- if(argc > 1)
- strcpy(grf_list_file, argv[1]);
- if(argc > 2)
- strcpy(map_list_file, argv[2]);
- if(argc > 3)
- strcpy(map_cache_file, argv[3]);
-
- printf("Initializing grfio with %s\n", grf_list_file);
- grfio_init(grf_list_file);
-
- printf("Opening map cache: %s\n", map_cache_file);
- if(!(map_cache_fp = fopen(map_cache_file, "wb"))) {
- printf("Failure when opening map cache file %s\n", map_cache_file);
- exit(1);
- }
-
- printf("Opening map list: %s\n", map_list_file);
- if(!(list = fopen(map_list_file, "r"))) {
- printf("Failure when opening maps list file %s\n", map_list_file);
- exit(1);
- }
-
- // Initialize the main header
- header.sizeof_header = sizeof(struct map_cache_head);
- header.sizeof_mapinfo = sizeof(struct map_cache_info);
- header.map_count = 0;
- header.filesize = sizeof(struct map_cache_head);
-
- // Read and process the map list
- while(fgets(line, 1020, list)){
-
- if(line[0] == '/' && line[1] == '/')
- continue;
-
- if(sscanf(line, "%16s %hu", name, &index) > 0) { // No defines in strings, 16 is hardcoded here
- printf("Index %d : %s\n", index, name);
- if(read_map(name, &map))
- cache_map(name, index, &map);
- else
- printf("Map file not found in GRF\n");
- // If the 2nd argument is omitted at next line, we'll keep last used index + 1
- index++;
- } else
- printf("Skipping incorrect line\n");
- }
-
- printf("Closing map list: %s\n", map_list_file);
- fclose(list);
-
- printf("Closing map cache: %s\n", map_cache_file);
- // Write the main header and close the map cache
- fseek(map_cache_fp, 0, SEEK_SET);
- fwrite(&header, sizeof(struct map_cache_head), 1, map_cache_fp);
- fclose(map_cache_fp);
-
- printf("Finalizing grfio\n");
- grfio_final();
-
- printf("%d maps cached\n", header.map_count);
-
- return 0;
-}
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <malloc.h>
+
+#ifndef _WIN32
+#include <unistd.h>
+#endif
+
+#include "grfio.h"
+
+char grf_list_file[256] = "tools/mapcache/grf_files.txt";
+char map_list_file[256] = "tools/mapcache/map_list.txt";
+char map_cache_file[256] = "map_cache.dat";
+
+#define MAP_NAME_LENGTH 16
+#define NO_WATER 1000000
+
+// Used internally, this structure contains the physical map cells
+struct map_data {
+ short xs;
+ short ys;
+ unsigned char *cells;
+};
+
+// This is the header appended before every compressed map cells info
+struct map_cache_info {
+ char name[MAP_NAME_LENGTH];
+ unsigned short index;
+ short xs;
+ short ys;
+ long len;
+};
+
+// This is the main header found at the very beginning of the file
+struct map_cache_head {
+ short sizeof_header;
+ short sizeof_mapinfo;
+ long filesize;
+ unsigned short map_count;
+} header;
+
+FILE *map_cache_fp;
+
+
+// Read map from GRF's GAT and RSW files
+int read_map(char *name, struct map_data *m)
+{
+ char filename[256];
+ char *gat, *rsw;
+ int water_height;
+ int x, y, xs, ys;
+ struct gat_cell {
+ float height[4];
+ int type;
+ } *p = NULL;
+
+ // Open map GAT
+ sprintf(filename,"data\\%s.gat", name);
+ gat = (char *)grfio_read(filename);
+ if (gat == NULL)
+ return 0;
+
+ // Open map RSW
+ sprintf(filename,"data\\%s.rsw", name);
+ rsw = (char *)grfio_read(filename);
+
+ // Read water height
+ if (rsw) {
+ float temp = *(float*)(rsw+166);
+ water_height = (int)temp;
+ free(rsw);
+ } else
+ water_height = NO_WATER;
+
+ // Read map size and allocate needed memory
+ xs = m->xs = *(int*)(gat+6);
+ ys = m->ys = *(int*)(gat+10);
+ m->cells = (unsigned char *)malloc(xs*ys);
+
+ // Set cell properties
+ for (y = 0; y < ys; y++) {
+ p = (struct gat_cell*)(gat+14+y*xs*20);
+ for (x = 0; x < xs; x++) {
+ if (water_height != NO_WATER && p->type == 0 && (p->height[0] > water_height || p->height[1] > water_height || p->height[2] > water_height || p->height[3] > water_height))
+ m->cells[x+y*xs] = 3; // Cell is 0 (walkable) but under water level, set to 3 (walkable water)
+ else
+ m->cells[x+y*xs] = p->type;
+ p++;
+ }
+ }
+
+ free(gat);
+
+ return 1;
+}
+
+void cache_map(char *name, unsigned short index, struct map_data *m)
+{
+ struct map_cache_info info;
+ unsigned long len;
+ char *write_buf;
+
+ // Create an output buffer twice as big as the uncompressed map... this way we're sure it fits
+ len = m->xs*m->ys*2;
+ write_buf = (char *)malloc(len);
+ // Compress the cells and get the compressed length
+ encode_zip((unsigned char *)write_buf, &len, m->cells, m->xs*m->ys);
+
+ // Fill the map header
+ strncpy(info.name, name, MAP_NAME_LENGTH);
+ info.index = index;
+ info.xs = m->xs;
+ info.ys = m->ys;
+ info.len = len;
+
+ // Append map header then compressed cells at the end of the file
+ fseek(map_cache_fp, header.filesize, SEEK_SET);
+ fwrite(&info, sizeof(struct map_cache_info), 1, map_cache_fp);
+ fwrite(write_buf, 1, len, map_cache_fp);
+ header.map_count++;
+ header.filesize += header.sizeof_mapinfo + len;
+
+ free(write_buf);
+ free(m->cells);
+
+ return;
+}
+
+int main(int argc, char *argv[])
+{
+ FILE *list;
+ char line[1024];
+ struct map_data map;
+ char name[MAP_NAME_LENGTH];
+ unsigned short index = 1;
+
+ if(argc > 1)
+ strcpy(grf_list_file, argv[1]);
+ if(argc > 2)
+ strcpy(map_list_file, argv[2]);
+ if(argc > 3)
+ strcpy(map_cache_file, argv[3]);
+
+ printf("Initializing grfio with %s\n", grf_list_file);
+ grfio_init(grf_list_file);
+
+ printf("Opening map cache: %s\n", map_cache_file);
+ if(!(map_cache_fp = fopen(map_cache_file, "wb"))) {
+ printf("Failure when opening map cache file %s\n", map_cache_file);
+ exit(1);
+ }
+
+ printf("Opening map list: %s\n", map_list_file);
+ if(!(list = fopen(map_list_file, "r"))) {
+ printf("Failure when opening maps list file %s\n", map_list_file);
+ exit(1);
+ }
+
+ // Initialize the main header
+ header.sizeof_header = sizeof(struct map_cache_head);
+ header.sizeof_mapinfo = sizeof(struct map_cache_info);
+ header.map_count = 0;
+ header.filesize = sizeof(struct map_cache_head);
+
+ // Read and process the map list
+ while(fgets(line, 1020, list)){
+
+ if(line[0] == '/' && line[1] == '/')
+ continue;
+
+ if(sscanf(line, "%16s %hu", name, &index) > 0) { // No defines in strings, 16 is hardcoded here
+ printf("Index %d : %s\n", index, name);
+ if(read_map(name, &map))
+ cache_map(name, index, &map);
+ else
+ printf("Map file not found in GRF\n");
+ // If the 2nd argument is omitted at next line, we'll keep last used index + 1
+ index++;
+ } else
+ printf("Skipping incorrect line\n");
+ }
+
+ printf("Closing map list: %s\n", map_list_file);
+ fclose(list);
+
+ printf("Closing map cache: %s\n", map_cache_file);
+ // Write the main header and close the map cache
+ fseek(map_cache_fp, 0, SEEK_SET);
+ fwrite(&header, sizeof(struct map_cache_head), 1, map_cache_fp);
+ fclose(map_cache_fp);
+
+ printf("Finalizing grfio\n");
+ grfio_final();
+
+ printf("%d maps cached\n", header.map_count);
+
+ return 0;
+}
diff --git a/src/zlib/zlib-1.2.3 b/src/zlib/zlib-1.2.3
index a6a9cc84d..e69de29bb 100644
--- a/src/zlib/zlib-1.2.3
+++ b/src/zlib/zlib-1.2.3
Binary files differ