diff --git a/conf/battle/items.conf b/conf/battle/items.conf
index f7efd93d10..007024b512 100644
--- a/conf/battle/items.conf
+++ b/conf/battle/items.conf
@@ -110,3 +110,8 @@ default_bind_on_equip: 4
// no = Bound items are unable to be sold at Itemshops
// yes = Bound items are able to be sold at Itemshops
allow_bound_sell: no
+
+// Turn on event refine chance (see db/{pre-}re/refine_db.yml)
+// no = normal refine chances in effect (official/default value)
+// yes = event refine chances in effect
+event_refine_chance: no
diff --git a/db/import-tmpl/refine_db.txt b/db/import-tmpl/refine_db.txt
deleted file mode 100644
index fcc13be56b..0000000000
--- a/db/import-tmpl/refine_db.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-// Refine Database [Renewal]
-//
-// Structure of Database:
-// Type,Stats per level,Random bonus start level,Random bonus value,Chance+1:Bonus+1,Chance+2:Bonus+2,Chance+3:Bonus+3,...
-//
-// For armors, values of 100 add 1 armor defense.
-// For weapons, values of 100 add 1 ATK&MATK.
-//
-// Type:
-// 0 - Armors
-// 1 - Level 1 weapons
-// 2 - Level 2 weapons
-// 3 - Level 3 weapons
-// 4 - Level 4 weapons
-//
-// Stats per level:
-// This value is applied for every upgrade level.
-//
-// Random bonus start level:
-// This value specifies the start point for those levels that give a random bonus value (usually the first unsafe upgrade).
-//
-// Random bonus value:
-// A random number between 0 and (Random bonus start level - Upgrade level + 1) * this value is applied for all upgrades past
-// Random bonus start level. This is only applied for weapons, and not displayed client-side.
-//
-// Chance:
-// 100 = 100%
-//
-// Notes:
-// Changing the number of upgrade levels requires modifying MAX_REFINE in src/map/status.h.
-// For Renewal Armors, there may or may not be another bonus, according to iRO wiki: Every upgrade gives floor[( 3 + current upgrade ) / 4] equipment DEF)
-
diff --git a/db/import-tmpl/refine_db.yml b/db/import-tmpl/refine_db.yml
new file mode 100644
index 0000000000..fbe8728eec
--- /dev/null
+++ b/db/import-tmpl/refine_db.yml
@@ -0,0 +1,20 @@
+# This file is a part of rAthena++.
+# Copyright(C) 2017 rAthena Development Team
+# https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+###########################################################################
+# Custom Refine Database
+###########################################################################
diff --git a/db/pre-re/refine_db.txt b/db/pre-re/refine_db.txt
deleted file mode 100644
index 1bec859f12..0000000000
--- a/db/pre-re/refine_db.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-// Refine Database [Pre-Renewal]
-//
-// Structure of Database:
-// Type,Stats per level,Random bonus start level,Random bonus value,Chance+1:Bonus+1,Chance+2:Bonus+2,Chance+3:Bonus+3,...
-//
-// For armors, values of 100 add 1 armor defense.
-// For weapons, values of 100 add 1 ATK.
-//
-// Type:
-// 0 - Armors
-// 1 - Level 1 weapons
-// 2 - Level 2 weapons
-// 3 - Level 3 weapons
-// 4 - Level 4 weapons
-//
-// Stats per level:
-// This value is applied for every upgrade level.
-//
-// Random bonus start level:
-// This value specifies the start point for those levels that give a random bonus value.
-//
-// Random bonus value:
-// A random number between 0 and (Random bonus start level - Upgrade level + 1) * this value is applied for all upgrades past
-// Random bonus start level (usually the first unsafe upgrade). This is only applied for weapons, and not displayed client-side.
-//
-// Chance:
-// 100 = 100%
-//
-// Notes:
-// Changing the number of upgrade levels requires modifying MAX_REFINE in src/map/status.h.
-
-// Armors
-0,70,0,0,100:0,100:0,100:0,100:0,60:0,40:0,40:0,20:0,20:0,10:0
-// Level 1 weapons
-1,200,8,300,100:0,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,20:0
-// Level 2 weapons
-2,300,7,500,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,20:0,20:0
-// Level 3 weapons
-3,500,6,800,100:0,100:0,100:0,100:0,100:0,60:0,50:0,20:0,20:0,20:0
-// Level 4 weapons
-4,700,5,1300,100:0,100:0,100:0,100:0,60:0,40:0,40:0,20:0,20:0,10:0
diff --git a/db/pre-re/refine_db.yml b/db/pre-re/refine_db.yml
new file mode 100644
index 0000000000..3602c72b78
--- /dev/null
+++ b/db/pre-re/refine_db.yml
@@ -0,0 +1,235 @@
+# This file is a part of rAthena++.
+# Copyright(C) 2017 rAthena Development Team
+# https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+###########################################################################
+# Pre-Renewal Refine Database
+###########################################################################
+Armor:
+ StatsPerLevel: 66
+ RandomBonusStartLevel: 0
+ RandomBonusValue: 0
+ Costs:
+ - Type: REFINE_COST_NORMAL
+ Price: 2000
+ Material: 985
+ - Type: REFINE_COST_ENRICHED
+ Price: 2000
+ Material: 7619
+ Rates:
+ - Level: 5
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ - Level: 6
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ - Level: 7
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ - Level: 8
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
+ - Level: 9
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
+ - Level: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
+WeaponLv1:
+ StatsPerLevel: 200
+ RandomBonusStartLevel: 8
+ RandomBonusValue: 300
+ Costs:
+ - Type: REFINE_COST_NORMAL
+ Price: 50
+ Material: 1010
+ - Type: REFINE_COST_ENRICHED
+ Price: 2000
+ Material: 7620
+ Rates:
+ - Level: 8
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ - Level: 9
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
+ - Level: 10
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 55
+WeaponLv2:
+ StatsPerLevel: 300
+ RandomBonusStartLevel: 7
+ RandomBonusValue: 500
+ Costs:
+ - Type: REFINE_COST_NORMAL
+ Price: 200
+ Material: 1011
+ - Type: REFINE_COST_ENRICHED
+ Price: 2000
+ Material: 7620
+ Rates:
+ - Level: 7
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ - Level: 8
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
+ - Level: 9
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
+ - Level: 10
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
+WeaponLv3:
+ StatsPerLevel: 500
+ RandomBonusStartLevel: 6
+ RandomBonusValue: 800
+ Costs:
+ - Type: REFINE_COST_NORMAL
+ Price: 5000
+ Material: 984
+ - Type: REFINE_COST_ENRICHED
+ Price: 2000
+ Material: 7620
+ Rates:
+ - Level: 6
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ - Level: 7
+ NormalChance: 50
+ EnrichedChance: 80
+ EventNormalChance: 50
+ EventEnrichedChance: 90
+ - Level: 8
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 70
+ - Level: 9
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
+ - Level: 10
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
+WeaponLv4:
+ StatsPerLevel: 700
+ RandomBonusStartLevel: 5
+ RandomBonusValue: 1300
+ Costs:
+ - Type: REFINE_COST_NORMAL
+ Price: 20000
+ Material: 984
+ - Type: REFINE_COST_ENRICHED
+ Price: 2000
+ Material: 7620
+ Rates:
+ - Level: 5
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ - Level: 6
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ - Level: 7
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ - Level: 8
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
+ - Level: 9
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
+ - Level: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
+Shadow:
+ StatsPerLevel: 0
+ RandomBonusStartLevel: 0
+ RandomBonusValue: 0
+ Rates:
+ - Level: 5
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ - Level: 6
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ - Level: 7
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ - Level: 8
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
+ - Level: 9
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
+ - Level: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
diff --git a/db/re/refine_db.txt b/db/re/refine_db.txt
deleted file mode 100644
index 87a134b276..0000000000
--- a/db/re/refine_db.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-// Refine Database [Renewal]
-//
-// Structure of Database:
-// Type,Stats per level,Random bonus start level,Random bonus value,Chance+1:Bonus+1,Chance+2:Bonus+2,Chance+3:Bonus+3,...
-//
-// For armors, values of 100 add 1 armor defense.
-// For weapons, values of 100 add 1 ATK&MATK.
-//
-// Type:
-// 0 - Armors
-// 1 - Level 1 weapons
-// 2 - Level 2 weapons
-// 3 - Level 3 weapons
-// 4 - Level 4 weapons
-//
-// Stats per level:
-// This value is applied for every upgrade level.
-//
-// Random bonus start level:
-// This value specifies the start point for those levels that give a random bonus value (usually the first unsafe upgrade).
-//
-// Random bonus value:
-// A random number between 0 and (Random bonus start level - Upgrade level + 1) * this value is applied for all upgrades past
-// Random bonus start level. This is only applied for weapons, and not displayed client-side.
-//
-// Chance:
-// 100 = 100%
-//
-// Notes:
-// Changing the number of upgrade levels requires modifying MAX_REFINE in src/map/status.h.
-// For Renewal Armors, there may or may not be another bonus, according to iRO wiki: Every upgrade gives floor[( 3 + current upgrade ) / 4] equipment DEF)
-
-0,0,0,0,100:100,100:100,100:100,100:100,60:200,40:200,40:200,20:200,20:300,9:300,8:300,8:300,8:400,8:400,7:400,7:400,7:500,7:500,5:500,5:500
-// Level 1 weapons
-1,200,8,300,100:0,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,19:0,18:0,18:0,18:0,18:0,18:0,17:300,17:300,17:300,15:300,15:300
-// Level 2 weapons
-2,300,7,500,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,20:0,19:0,18:0,18:0,18:0,18:0,18:0,17:600,17:600,17:600,15:600,15:600
-// Level 3 weapons
-3,500,6,800,100:0,100:0,100:0,100:0,100:0,60:0,50:0,20:0,20:0,19:0,18:0,18:0,18:0,18:0,18:0,17:900,17:900,17:900,15:900,15:900
-// Level 4 weapons
-4,700,5,1400,100:0,100:0,100:0,100:0,60:0,40:0,40:0,20:0,20:0,9:0,8:0,8:0,8:0,8:0,7:0,7:1200,7:1200,7:1200,5:1200,5:1200
diff --git a/db/re/refine_db.yml b/db/re/refine_db.yml
new file mode 100644
index 0000000000..f96e0d2d9a
--- /dev/null
+++ b/db/re/refine_db.yml
@@ -0,0 +1,584 @@
+# This file is a part of rAthena++.
+# Copyright(C) 2017 rAthena Development Team
+# https://rathena.org - https://github.com/rathena
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+###########################################################################
+# Renewal Refine Database
+###########################################################################
+Armor:
+ StatsPerLevel: 0
+ RandomBonusStartLevel: 0
+ RandomBonusValue: 0
+ Costs:
+ - Type: REFINE_COST_NORMAL
+ Price: 2000
+ Material: 985
+ - Type: REFINE_COST_OVER10
+ Price: 100000
+ Material: 6223
+ - Type: REFINE_COST_HD
+ Price: 20000
+ Material: 6241
+ - Type: REFINE_COST_ENRICHED
+ Price: 2000
+ Material: 7619
+ - Type: REFINE_COST_OVER10_HD
+ Price: 100000
+ Material: 6225
+ Rates:
+ - Level: 1
+ Bonus: 100
+ - Level: 2
+ Bonus: 100
+ - Level: 3
+ Bonus: 100
+ - Level: 4
+ Bonus: 100
+ - Level: 5
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ Bonus: 200
+ - Level: 6
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ Bonus: 200
+ - Level: 7
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ Bonus: 200
+ - Level: 8
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
+ Bonus: 200
+ - Level: 9
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
+ Bonus: 300
+ - Level: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
+ Bonus: 300
+ - Level: 11
+ NormalChance: 8
+ EnrichedChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
+ Bonus: 300
+ - Level: 12
+ NormalChance: 8
+ EnrichedChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
+ Bonus: 300
+ - Level: 13
+ NormalChance: 8
+ EnrichedChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
+ Bonus: 400
+ - Level: 14
+ NormalChance: 8
+ EnrichedChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
+ Bonus: 400
+ - Level: 15
+ NormalChance: 7
+ EnrichedChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
+ Bonus: 400
+ - Level: 16
+ NormalChance: 7
+ EnrichedChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
+ Bonus: 400
+ - Level: 17
+ NormalChance: 7
+ EnrichedChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
+ Bonus: 500
+ - Level: 18
+ NormalChance: 7
+ EnrichedChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
+ Bonus: 500
+ - Level: 19
+ NormalChance: 5
+ EnrichedChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
+ Bonus: 500
+ - Level: 20
+ NormalChance: 5
+ EnrichedChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
+ Bonus: 500
+WeaponLv1:
+ StatsPerLevel: 200
+ RandomBonusStartLevel: 8
+ RandomBonusValue: 300
+ Costs:
+ - Type: REFINE_COST_NORMAL
+ Price: 50
+ Material: 1010
+ - Type: REFINE_COST_OVER10
+ Price: 100000
+ Material: 6224
+ - Type: REFINE_COST_HD
+ Price: 20000
+ Material: 6240
+ - Type: REFINE_COST_ENRICHED
+ Price: 2000
+ Material: 7620
+ - Type: REFINE_COST_OVER10_HD
+ Price: 100000
+ Material: 6226
+ Rates:
+ - Level: 8
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ - Level: 9
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
+ - Level: 10
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 55
+ - Level: 11
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
+ - Level: 12
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
+ - Level: 13
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
+ - Level: 14
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
+ - Level: 15
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 30
+ EventEnrichedChance: 30
+ - Level: 16
+ NormalChance: 17
+ EnrichedChance: 17
+ EventNormalChance: 30
+ EventEnrichedChance: 30
+ Bonus: 300
+ - Level: 17
+ NormalChance: 17
+ EnrichedChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
+ Bonus: 300
+ - Level: 18
+ NormalChance: 17
+ EnrichedChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
+ Bonus: 300
+ - Level: 19
+ NormalChance: 15
+ EnrichedChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
+ Bonus: 300
+ - Level: 20
+ NormalChance: 15
+ EnrichedChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
+ Bonus: 300
+WeaponLv2:
+ StatsPerLevel: 300
+ RandomBonusStartLevel: 7
+ RandomBonusValue: 500
+ Costs:
+ - Type: REFINE_COST_NORMAL
+ Price: 200
+ Material: 1011
+ - Type: REFINE_COST_OVER10
+ Price: 100000
+ Material: 6224
+ - Type: REFINE_COST_HD
+ Price: 20000
+ Material: 6240
+ - Type: REFINE_COST_ENRICHED
+ Price: 2000
+ Material: 7620
+ - Type: REFINE_COST_OVER10_HD
+ Price: 100000
+ Material: 6226
+ Rates:
+ - Level: 7
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ - Level: 8
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
+ - Level: 9
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
+ - Level: 10
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
+ - Level: 11
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
+ - Level: 12
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
+ - Level: 13
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
+ - Level: 14
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
+ - Level: 15
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 30
+ EventEnrichedChance: 30
+ - Level: 16
+ NormalChance: 17
+ EnrichedChance: 17
+ EventNormalChance: 30
+ EventEnrichedChance: 30
+ Bonus: 600
+ - Level: 17
+ NormalChance: 17
+ EnrichedChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
+ Bonus: 600
+ - Level: 18
+ NormalChance: 17
+ EnrichedChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
+ Bonus: 600
+ - Level: 19
+ NormalChance: 15
+ EnrichedChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
+ Bonus: 600
+ - Level: 20
+ NormalChance: 15
+ EnrichedChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
+ Bonus: 600
+WeaponLv3:
+ StatsPerLevel: 500
+ RandomBonusStartLevel: 6
+ RandomBonusValue: 800
+ Costs:
+ - Type: REFINE_COST_NORMAL
+ Price: 5000
+ Material: 984
+ - Type: REFINE_COST_OVER10
+ Price: 100000
+ Material: 6224
+ - Type: REFINE_COST_HD
+ Price: 20000
+ Material: 6240
+ - Type: REFINE_COST_ENRICHED
+ Price: 2000
+ Material: 7620
+ - Type: REFINE_COST_OVER10_HD
+ Price: 100000
+ Material: 6226
+ Rates:
+ - Level: 6
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ - Level: 7
+ NormalChance: 50
+ EnrichedChance: 80
+ EventNormalChance: 50
+ EventEnrichedChance: 90
+ - Level: 8
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 70
+ - Level: 9
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
+ - Level: 10
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
+ - Level: 11
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
+ - Level: 12
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
+ - Level: 13
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
+ - Level: 14
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
+ - Level: 15
+ NormalChance: 18
+ EnrichedChance: 18
+ EventNormalChance: 30
+ EventEnrichedChance: 30
+ - Level: 16
+ NormalChance: 17
+ EnrichedChance: 17
+ EventNormalChance: 30
+ EventEnrichedChance: 30
+ Bonus: 900
+ - Level: 17
+ NormalChance: 17
+ EnrichedChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
+ Bonus: 900
+ - Level: 18
+ NormalChance: 17
+ EnrichedChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
+ Bonus: 900
+ - Level: 19
+ NormalChance: 15
+ EnrichedChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
+ Bonus: 900
+ - Level: 20
+ NormalChance: 15
+ EnrichedChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
+ Bonus: 900
+WeaponLv4:
+ StatsPerLevel: 700
+ RandomBonusStartLevel: 5
+ RandomBonusValue: 1400
+ Costs:
+ - Type: REFINE_COST_NORMAL
+ Price: 20000
+ Material: 984
+ - Type: REFINE_COST_OVER10
+ Price: 100000
+ Material: 6224
+ - Type: REFINE_COST_HD
+ Price: 20000
+ Material: 6240
+ - Type: REFINE_COST_ENRICHED
+ Price: 2000
+ Material: 7620
+ - Type: REFINE_COST_OVER10_HD
+ Price: 100000
+ Material: 6226
+ Rates:
+ - Level: 5
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ - Level: 6
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ - Level: 7
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ - Level: 8
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
+ - Level: 9
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
+ - Level: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
+ - Level: 11
+ NormalChance: 8
+ EnrichedChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
+ - Level: 12
+ NormalChance: 8
+ EnrichedChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
+ - Level: 13
+ NormalChance: 8
+ EnrichedChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
+ - Level: 14
+ NormalChance: 8
+ EnrichedChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
+ - Level: 15
+ NormalChance: 7
+ EnrichedChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
+ - Level: 16
+ NormalChance: 7
+ EnrichedChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
+ Bonus: 1200
+ - Level: 17
+ NormalChance: 7
+ EnrichedChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
+ Bonus: 1200
+ - Level: 18
+ NormalChance: 7
+ EnrichedChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
+ Bonus: 1200
+ - Level: 19
+ NormalChance: 5
+ EnrichedChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
+ Bonus: 1200
+ - Level: 20
+ NormalChance: 5
+ EnrichedChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
+ Bonus: 1200
+Shadow:
+ StatsPerLevel: 0
+ RandomBonusStartLevel: 0
+ RandomBonusValue: 0
+ Costs:
+ - Type: REFINE_COST_NORMAL
+ Price: 20000
+ Material: 985
+ - Type: REFINE_COST_HD
+ Price: 20000
+ Material: 6241
+ - Type: REFINE_COST_ENRICHED
+ Price: 20000
+ Material: 7619
+ Rates:
+ - Level: 5
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
+ - Level: 6
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ - Level: 7
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
+ - Level: 8
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
+ - Level: 9
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
+ - Level: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index d11ccb06b6..4ef760762d 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -2719,14 +2719,17 @@ Examples:
---------------------------------------
-*getequippercentrefinery({,})
+*getequippercentrefinery({,,})
This function calculates and returns the percent value chance to successfully
refine the item found in the specified equipment slot of the invoking character
by +1. There is no actual formula, the success rate for a given weapon level of
-a certain refine level is found in the db/refine_db.txt file. For a list of
+a certain refine level is found in the db/(pre-)re/refine_db.yml file. For a list of
equipment slots see 'getequipid'.
+If enriched parameter is set to true, chance to successfully refine the item with
+enriched material is returned instead.
+
These values can be displayed for the player to see, or used to calculate the
random change of a refine succeeding or failing and then going through with it
(which is what the official NPC refinery scripts use it for)
@@ -2737,6 +2740,28 @@ random change of a refine succeeding or failing and then going through with it
---------------------------------------
+*getequiprefinecost(,,{,})
+
+This function returns refine cost for equipment in based on
+passed arguments and .
+
+Valid cost types are:
+
+REFINE_COST_NORMAL - For normal refining
+REFINE_COST_OVER10 - For refining over +10
+REFINE_COST_HD - For refining with HD ores
+REFINE_COST_ENRICHED - For refining with enriched ores
+REFINE_COST_OVER10_HD - For refining over +10 with HD ores
+
+This function will return required cost for refining based on argument.
+
+Valid information types are:
+
+REFINE_ZENY_COST - Zeny
+REFINE_MATERIAL_ID - Material Item ID
+
+---------------------------------------
+
*getareadropitem("