summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-06-03 18:43:44 +0200
committerGitHub <noreply@github.com>2017-06-03 18:43:44 +0200
commit3061bb8257578bc88b9873f1ecebb05f8508bd0f (patch)
tree2d2257b9c574f29896ae0baa71a224c3b4f53ecf
parentf795a6df2766348d2a7f43f48e392b3cf3008781 (diff)
parent6f2827cbf9282981a29abaa06236fb0cd6300057 (diff)
downloadhercules-3061bb8257578bc88b9873f1ecebb05f8508bd0f.tar.gz
hercules-3061bb8257578bc88b9873f1ecebb05f8508bd0f.tar.bz2
hercules-3061bb8257578bc88b9873f1ecebb05f8508bd0f.tar.xz
hercules-3061bb8257578bc88b9873f1ecebb05f8508bd0f.zip
Merge pull request #1684 from Smokexyz/refine-update
Enriched refine chance correction
-rw-r--r--db/pre-re/refine_db.conf149
-rw-r--r--db/re/refine_db.conf350
-rw-r--r--doc/script_commands.txt21
-rw-r--r--npc/merchants/advanced_refiner.txt4
-rw-r--r--npc/re/merchants/advanced_refiner.txt4
-rw-r--r--npc/re/merchants/shadow_refiner.txt167
-rw-r--r--src/map/script.c34
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/status.c77
-rw-r--r--src/map/status.h12
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc4
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc12
12 files changed, 579 insertions, 257 deletions
diff --git a/db/pre-re/refine_db.conf b/db/pre-re/refine_db.conf
index 0d59c8faa..dd3bcdb41 100644
--- a/db/pre-re/refine_db.conf
+++ b/db/pre-re/refine_db.conf
@@ -30,19 +30,22 @@
/**************************************************************************
************* Entry structure ********************************************
**************************************************************************
-Armors/WeaponLevel1~4: { // Specifies weapon level or armor type
- - For armors, values of 100 add 1 armor defense.
- - For weapons, values of 100 add 1 ATK.
- StatsPerLevel: value (int) // This value is applied for ever level.
- RandomBonusStartLevel: level (int) // This value specifies the start point for those levels that give a random bonus value (usually the first unsafe upgrade).
- RandomBonusValue: value (int) // 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.
- Rates: { // Per level configuration of the refine rates.
- Lv1~10: { // Level of refine
- Chance: value (int, optional, defaults to 100) // Chance of successful refine (100 = 100%)
- Bonus: value (int, optional, defaults to 0) // Bonus for this level of refine
- }
- // Note: Refine levels that use default values need not be listed. (Example: Lv1: Chance: 100 Bonus: 0)
+Armors/WeaponLevel1~4: { // Specifies weapon level or armor type.
+ // - For armors, values of 100 add 1 armor defense.
+ // - For weapons, values of 100 add 1 ATK.
+ StatsPerLevel: (int) // This value is applied for ever level.
+ RandomBonusStartLevel: (int) // This value specifies the start point for those levels that give a random bonus value (usually the first unsafe upgrade).
+ // - RandomBonusStartLevel is only applied for weapons, and not displayed client-side.
+ RandomBonusValue: (int) // A random number between 0 and (Random bonus start level - Upgrade level + 1) * this value is applied for all upgrades past.
+ Rates: { // Per level configuration of the refine rates.
+ Lv1~10: { // Lv1 ~ Lv10.
+ NormalChance: (int) // (optional, defaults to 100) Chance of successful refine using normal ores (100 = 100%).
+ EnrichedChance: (int) // (optional, defaults to 100 for weapons below refine level 10, otherwise 0.) Chance of successful refine using enriched ores (100 = 100%).
+ EventNormalChance: (int) // (optional, defaults to 100) Chance of successful refine using normal ores (100 = 100%) during a refine event.
+ EventEnrichedChance: (int) // (optional, defaults to 100 for weapons below refine level 10, otherwise 0.) Chance of successful refine using enriched ores (100 = 100%) during a refine event.
+ Bonus: (int) // (optional, defaults to 0) Bonus (Armor) for this level of refine.
+ }
+ // Note: Refine levels that use default values need not be listed. (Example: Lv1: { NormalChance: 100 Bonus: 0 })
}
}
**************************************************************************/
@@ -53,22 +56,40 @@ Armors: {
RandomBonusValue: 0
Rates: {
Lv5: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv6: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv7: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
}
Lv10: {
- Chance: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
}
}
}
@@ -78,13 +99,22 @@ WeaponLevel1: {
RandomBonusValue: 300
Rates: {
Lv8: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv9: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 55
}
}
}
@@ -94,16 +124,28 @@ WeaponLevel2: {
RandomBonusValue: 500
Rates: {
Lv7: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv8: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
}
}
}
@@ -113,19 +155,34 @@ WeaponLevel3: {
RandomBonusValue: 800
Rates: {
Lv6: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv7: {
- Chance: 50
+ NormalChance: 50
+ EnrichedChance: 80
+ EventNormalChance: 50
+ EventEnrichedChance: 90
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 70
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
}
}
}
@@ -135,22 +192,40 @@ WeaponLevel4: {
RandomBonusValue: 1300
Rates: {
Lv5: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv6: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv7: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
}
Lv10: {
- Chance: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
}
}
}
diff --git a/db/re/refine_db.conf b/db/re/refine_db.conf
index 927e2d6bf..4974e0033 100644
--- a/db/re/refine_db.conf
+++ b/db/re/refine_db.conf
@@ -30,22 +30,24 @@
/**************************************************************************
************* Entry structure ********************************************
**************************************************************************
-Armors/WeaponLevel1~4: { // Specifies weapon level or armor type
- - For armors, values of 100 add 1 armor defense.
- - For weapons, values of 100 add 1 ATK&MATK.
- StatsPerLevel: value (int) // This value is applied for ever level.
- RandomBonusStartLevel: level (int) // This value specifies the start point for those levels that give a random bonus value (usually the first unsafe upgrade).
- RandomBonusValue: value (int) // 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.
- Rates: { // Per level configuration of the refine rates.
- Lv1~10: { // Level of refine
- Chance: value (int, optional, defaults to 100) // Chance of successful refine (100 = 100%)
- Bonus: value (int, optional, defaults to 0) // Bonus for this level of refine
- }
- // Note: Refine levels that use default values need not be listed. (Example: Lv1: Chance: 100 Bonus: 0)
+Armors/WeaponLevel1~4: { // Specifies weapon level or armor type.
+ // - For armors, values of 100 add 1 armor defense.
+ // - For weapons, values of 100 add 1 ATK & MATK.
+ StatsPerLevel: (int) // This value is applied for ever level.
+ RandomBonusStartLevel: (int) // This value specifies the start point for those levels that give a random bonus value (usually the first unsafe upgrade).
+ // - RandomBonusStartLevel is only applied for weapons, and not displayed client-side.
+ RandomBonusValue: (int) // A random number between 0 and (Random bonus start level - Upgrade level + 1) * this value is applied for all upgrades past.
+ Rates: { // Per level configuration of the refine rates.
+ Lv1~20: { // Lv1 ~ Lv20.
+ NormalChance: (int) // (optional, defaults to 100) Chance of successful refine using normal ores (100 = 100%).
+ EnrichedChance: (int) // (optional, defaults to 100 for weapons below refine level 20, otherwise 0.) Chance of successful refine using enriched ores (100 = 100%).
+ EventNormalChance: (int) // (optional, defaults to 100) Chance of successful refine using normal ores (100 = 100%) during a refine event.
+ EventEnrichedChance: (int) // (optional, defaults to 100 for weapons below refine level 10, otherwise 0.) Chance of successful refine using enriched ores (100 = 100%) during a refine event.
+ Bonus: (int) // (optional, defaults to 0) Bonus (Armor) for this level of refine.
+ }
+ // Note: Refine levels that use default values need not be listed. (Example: Lv1: { NormalChance: 100 Bonus: 0 })
}
}
-// A note about renewal Armors, there may or may not be another bonus, according to iRO wiki: Every upgrade gives floor[( 3 + current upgrade ) / 4]
**************************************************************************/
Armors: {
@@ -66,67 +68,105 @@ Armors: {
Bonus: 100
}
Lv5: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
Bonus: 200
}
Lv6: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
Bonus: 200
}
Lv7: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
Bonus: 200
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
Bonus: 200
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
Bonus: 300
}
Lv10: {
- Chance: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
Bonus: 300
}
Lv11: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 300
}
Lv12: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 300
}
Lv13: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
Bonus: 400
}
Lv14: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
Bonus: 400
}
Lv15: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 400
}
Lv16: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 400
}
Lv17: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
Bonus: 500
}
Lv18: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
Bonus: 500
}
Lv19: {
- Chance: 5
+ NormalChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
Bonus: 500
}
Lv20: {
- Chance: 5
+ NormalChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
Bonus: 500
}
}
@@ -137,47 +177,76 @@ WeaponLevel1: {
RandomBonusValue: 300
Rates: {
Lv8: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv9: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 55
}
Lv11: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv12: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv13: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv14: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv15: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 30
+ EventEnrichedChance: 30
}
Lv16: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 30
+ EventEnrichedChance: 30
Bonus: 300
}
Lv17: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 300
}
Lv18: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 300
}
Lv19: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 300
}
Lv20: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 300
}
}
@@ -188,50 +257,82 @@ WeaponLevel2: {
RandomBonusValue: 500
Rates: {
Lv7: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv8: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
}
Lv11: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv12: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv13: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv14: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv15: {
- Chance:18
+ NormalChance:18
+ EventNormalChance: 30
+ EventEnrichedChance: 30
}
Lv16: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 30
+ EventEnrichedChance: 30
Bonus: 600
}
Lv17: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 600
}
Lv18: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 600
}
Lv19: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 600
}
Lv20: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 600
}
}
@@ -242,53 +343,88 @@ WeaponLevel3: {
RandomBonusValue: 800
Rates: {
Lv6: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv7: {
- Chance: 50
+ NormalChance: 50
+ EnrichedChance: 80
+ EventNormalChance: 50
+ EventEnrichedChance: 90
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 70
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
}
Lv11: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv12: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv13: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv14: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv15: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 30
+ EventEnrichedChance: 30
}
Lv16: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 30
+ EventEnrichedChance: 30
Bonus: 900
}
Lv17: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 900
}
Lv18: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 900
}
Lv19: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 900
}
Lv20: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 900
}
}
@@ -299,56 +435,94 @@ WeaponLevel4: {
RandomBonusValue: 1400
Rates: {
Lv5: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv6: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv7: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
}
Lv10: {
- Chance: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
}
Lv11: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
}
Lv12: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
}
Lv13: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
}
Lv14: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
}
Lv15: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
}
Lv16: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 1200
}
Lv17: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
Bonus: 1200
}
Lv18: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
Bonus: 1200
}
Lv19: {
- Chance: 5
+ NormalChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
Bonus: 1200
}
Lv20: {
- Chance: 5
+ NormalChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
Bonus: 1200
}
}
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 28e25679f..4252ad5e2 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -3008,21 +3008,32 @@ Examples:
---------------------------------------
-*getequippercentrefinery(<equipment slot>)
+*getequippercentrefinery(<equipment slot>{, <type>})
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 equipment slots see getequipid().
+invoking character by +1. Refine rates are defined in the db/<re/pre-re>/refine_db.conf
+files. For a list of equipment slots see getequipid().
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).
+Refine Chance Type Constants -
+REFINE_CHANCE_TYPE_NORMAL: 0 (Normal Ores)
+REFINE_CHANCE_TYPE_ENRICHED: 1 (Enriched Ores)
+REFINE_CHANCE_TYPE_E_NORMAL: 2 (Event Normal Ores)
+REFINE_CHANCE_TYPE_E_ENRICHED: 3 (Event Enriched Ores)
+
+Refine rate information -
+Normal Ores: http://ro.gnjoy.com/news/probability/View.asp?category=4&seq=1941553&curpage=1
+Enriched Ores: http://ro.gnjoy.com/news/probability/View.asp?category=4&seq=1941565&curpage=1
+Event Normal Ores: http://ro.gnjoy.com/news/probability/View.asp?category=4&seq=1941558&curpage=1
+Event Enriched Ores: http://ro.gnjoy.com/news/probability/View.asp?category=4&seq=1941567&curpage=1
+
// This will find a random number from 0 - 99 and if that is equal to or
// more than the value recovered by this command it will show a message
- if (getequippercentrefinery(EQI_HAND_L) <= rand(100))
+ if (getequippercentrefinery(EQI_HAND_L, REFINE_CHANCE_TYPE_NORMAL) <= rand(100))
mes("Aww");
---------------------------------------
diff --git a/npc/merchants/advanced_refiner.txt b/npc/merchants/advanced_refiner.txt
index e75912f4c..9632f95f7 100644
--- a/npc/merchants/advanced_refiner.txt
+++ b/npc/merchants/advanced_refiner.txt
@@ -93,7 +93,7 @@ payon,157,146,6 script Suhnbi#cash 4_M_03,{
mes "[Suhnbi]";
mes "Clang! Clang! Clang!";
- if (getequippercentrefinery(.@part) > rand(100) || getequippercentrefinery(.@part) > rand(100)) {
+ if (getequippercentrefinery(.@part, REFINE_CHANCE_TYPE_ENRICHED) > rand(100)) {
successrefitem .@part;
next;
emotion e_no1;
@@ -123,7 +123,7 @@ S_RefineValidate:
mes "Would you like to continue?";
next;
if(select("Yes", "No") == 1) {
- if (getequippercentrefinery(getarg(3)) < 100) {
+ if (getequippercentrefinery(getarg(3), REFINE_CHANCE_TYPE_ENRICHED) < 100) {
if (getarg(0)) {
mes "[Suhnbi]";
mes "Wow!!";
diff --git a/npc/re/merchants/advanced_refiner.txt b/npc/re/merchants/advanced_refiner.txt
index 1484d069c..5b3f69593 100644
--- a/npc/re/merchants/advanced_refiner.txt
+++ b/npc/re/merchants/advanced_refiner.txt
@@ -140,7 +140,7 @@ malangdo,221,174,6 script Holink#mal_cash 4_CAT_ADV1,{
mes "You don't belive in refine master Holink, meow?~";
close;
}
- if (getequippercentrefinery(.@part) < 100) {
+ if (getequippercentrefinery(.@part, REFINE_CHANCE_TYPE_ENRICHED) < 100) {
mes "[Holink]";
mes "Meow!!";
if (.@type$ == "armor")
@@ -177,7 +177,7 @@ malangdo,221,174,6 script Holink#mal_cash 4_CAT_ADV1,{
}
delitem .@material,1;
Zeny -= .@price;
- if (getequippercentrefinery(.@part) > rand(100) || getequippercentrefinery(.@part) > rand(100)) {
+ if (getequippercentrefinery(.@part, REFINE_CHANCE_TYPE_ENRICHED) > rand(100)) {
successrefitem .@part;
mes "[Holink]";
mes "Me~ Me~ Meow! Fun fun refining~";
diff --git a/npc/re/merchants/shadow_refiner.txt b/npc/re/merchants/shadow_refiner.txt
index 2f8984498..f03d348b2 100644
--- a/npc/re/merchants/shadow_refiner.txt
+++ b/npc/re/merchants/shadow_refiner.txt
@@ -9,8 +9,9 @@
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
-//= Copyright (C) 2015 Hercules Dev Team
-//= Copyright (C) Dastgir
+//= Copyright (C) 2017 Hercules Dev Team
+//= Copyright (C) Dastgir
+//= Copyright (C) Smokexyz (v2.0)
//=
//= Hercules is free software: you can redistribute it and/or modify
//= it under the terms of the GNU General Public License as published by
@@ -29,148 +30,158 @@
//================= Description ===========================================
//= Shadow item refiner
//================= Current Version =======================================
-//= 1.0
+//= 2.0
//=========================================================================
itemmall,31,76,3 script Shadow Blacksmith#nomal 4_F_JOB_BLACKSMITH,{
+
+ // Configuration
+ .@npc_name$ = "[Shadow Blacksmith]";
+ .@zeny_cost = 20000; // Amount of zeny to be charged for refining.
+
disable_items;
- mes "[Shadow Blacksmith]";
- mes "Do you want to refine a Shadow item?.";
- mes "Please choose the part you want to refine.";
+ mesf("%s", .@npc_name$);
+ mes("Do you want to refine a Shadow item?");
+ mes("Please choose the part you want to refine.");
next;
- setarray .@position$[0],"Armor","Weapon","Shield","Shoes","Earring","Pendant";
- for (.@i=EQI_SHADOW_ARMOR; .@i<=EQI_SHADOW_ACC_L; .@i++){
- .@menu$ = .@menu$+((getequipisequiped(.@i))?getequipname(.@i):"^8C8C8C"+.@position$[.@i-EQI_SHADOW_ARMOR]+" [Not Equipped]^000000")+":";
+ setarray(.@position$[0],"Armor","Weapon","Shield","Shoes","Earring","Pendant");
+ for (.@i=EQI_SHADOW_ARMOR; .@i <= EQI_SHADOW_ACC_L; .@i++){
+ .@menu$ = .@menu$ + (getequipisequiped(.@i) ? getequipname(.@i) : ("^8C8C8C" + .@position$[.@i-EQI_SHADOW_ARMOR] + " [Not Equipped]^000000" + ":"));
}
- .@menu$ = .@menu$+"Refine Info";
- .@SelectedPart = select(.@menu$)+EQI_SHADOW_ARMOR-1;
- if (.@SelectedPart == EQI_SHADOW_ACC_L+1){ // Refine Info
- mes "[Shadow Blacksmith]";
- mes "Shadow item will gain extra bonus effect by the refine level, same as normal weapon/armour items.";
+ .@menu$ = .@menu$ + "Refine Info";
+ .@SelectedPart = select(.@menu$) + EQI_SHADOW_ARMOR - 1;
+ if (.@SelectedPart == EQI_SHADOW_ACC_L + 1){ // Refine Info
+ mesf("%s", .@npc_name$);
+ mes("Shadow items gain extra bonus effects depending on their refine level, similar to normal weapon and armor items.");
next;
- mes "[Shadow Blacksmith]";
- mes "Following are refining effect for each Shadow item parts.";
- mes "Weapon: ATK, MATK + 1 increase for each +1 refine success.";
- mes "Etc: HP + 10 increase for each +1 refine success.";
+ mesf("%s", .@npc_name$);
+ mes("Refining effects for each Shadow item parts are -");
+ mes("Weapon: ATK, MATK + 1 increase for each +1 refine success.");
+ mes("Etc: HP + 10 increase for each +1 refine success.");
next;
- mes "[Shadow Blacksmith]";
- mes "You need Oridecon and Elunium for Shadow item refine ingredient, along with refine fee 20000 zeny.";
+ mesf("%s", .@npc_name$);
+ mesf("You need %s and %s as the ingredient, along with a refine fee %d Zeny.", getitemname(Oridecon), getitemname(Elunium), .@zeny_cost);
next;
- mes "[Shadow Blacksmith]";
- mes "When +5 or higher refining Shadow item can be destroyed, please use Enriched or HD ingredient for the refinement.";
+ mesf("%s", .@npc_name$);
+ mes("When refining to +5 or higher, you risk breaking your Shadow item.");
+ mes("You may also use Enriched or HD ingredients for the refinement.");
close;
}
- while(1){
- mes "[Shadow Blacksmith]";
- mes "20000 zeny will be spent as a refine fee.";
- mes "Choose the ingredient and start refining.";
+ while(true) {
+ mesf("%s", .@npc_name$);
+ mesf("%d Zeny will be spent as a refine fee.", .@zeny_cost);
+ mes("Choose the ingredient and start refining.");
next;
.@index = 0;
if (.@SelectedPart != EQI_SHADOW_WEAPON)
.@index = 1;
- setarray .@s_weapon1[0],Oridecon,Elunium;
- setarray .@s_weapon2[0],Enriched_Oridecon,Enriched_Elunium;
- setarray .@s_weapon3[0],HD_Oridecon,HD_Elunium;
- if (countitem(.@s_weapon1[.@index]))
- .@mate$[0] = getitemname(.@s_weapon1[.@index]);
+ setarray .@s_material1[0], Oridecon, Elunium;
+ setarray .@s_material2[0], Enriched_Oridecon, Enriched_Elunium;
+ setarray .@s_material3[0], HD_Oridecon, HD_Elunium;
+ .@refine_type = REFINE_CHANCE_TYPE_NORMAL;
+ if (countitem(.@s_material1[.@index]))
+ .@mate$[0] = getitemname(.@s_material1[.@index]);
else{
- .@mate$[0] = "^8C8C8C"+ getitemname(.@s_weapon1[.@index]) +"^000000";
+ .@mate$[0] = "^8C8C8C"+ getitemname(.@s_material1[.@index]) +"^000000";
.@miss[0] = 1;
}
- if (countitem(.@s_weapon2[.@index]))
- .@mate$[1] = getitemname(.@s_weapon2[.@index]);
+ if (countitem(.@s_material2[.@index]))
+ .@mate$[1] = getitemname(.@s_material2[.@index]);
else{
- .@mate$[1] = "^8C8C8C"+ getitemname(.@s_weapon2[.@index]) +"^000000";
+ .@mate$[1] = "^8C8C8C"+ getitemname(.@s_material2[.@index]) +"^000000";
.@miss[1] = 1;
}
- if (getequiprefinerycnt(.@SelectedPart) > 6 && countitem(.@s_weapon3[.@index]))
- .@mate$[2] = getitemname(.@s_weapon3[.@index]);
+ if (getequiprefinerycnt(.@SelectedPart) > 6 && countitem(.@s_material3[.@index]))
+ .@mate$[2] = getitemname(.@s_material3[.@index]);
else {
- .@mate$[2] = "^8C8C8C"+ getitemname(.@s_weapon3[.@index]) +"^000000";
+ .@mate$[2] = "^8C8C8C"+ getitemname(.@s_material3[.@index]) +"^000000";
.@miss[2] = 1;
}
//-----------------------------------------------------------------------------
- .@option = select("Cancel",.@mate$[0],.@mate$[1],.@mate$[2]);
+ .@option = select("Cancel", .@mate$[0], .@mate$[1], .@mate$[2]);
if (.@option == 1){
- mes "[Shadow Blacksmith]";
- mes "You've cancelled refining.";
+ mesf("%s", .@npc_name$);
+ mes("You've cancelled refining.");
close;
}
.@option -= 2;
- if (.@option==2){ //HD
+ .@hoihoi = false;
+ if (.@option == 2){ //HD
if (getequiprefinerycnt(.@SelectedPart) < 7){
- mes "[Shadow Blacksmith]";
- mes "HD ingredient is only possible to use for +7 or higher refine level items.";
+ mesf("%s", .@npc_name$);
+ mes("HD ingredients are only possible to be used when refining an item of quality +7 or higher.");
close;
}
- .@hoihoi = 1;
+ .@hoihoi = true;
+ } else if (.@option == 1) {
+ .@refine_type = REFINE_CHANCE_TYPE_ENRICHED;
}
if (.@miss[.@option]){
- mes "[Shadow Blacksmith]";
- mes "You do not have proper ingredient for this refining.";
+ mesf("%s", .@npc_name$);
+ mes("You do not have the proper ingredient to proceed with refining.");
close;
}
.@choose = getd(".@s_weapon"+(.@option+1)+"["+ .@index +"]");
if (Zeny < 20000) {
- mes "[Shadow Blacksmith]";
- mes "You do not have enough refine fee.";
+ mesf("%s", .@npc_name$);
+ mes("You do not have enough Zeny to pay the refine fee.");
close;
}
if (getequiprefinerycnt(.@SelectedPart) > 9) {
- mes "[Shadow Blacksmith]";
- mes "Shadow item refining is only possible until +10 level.";
+ mesf("%s", .@npc_name$);
+ mes("Shadow item refining is only possible up to +10 level.");
close;
}
if (!getequipisenableref(.@SelectedPart)) {
- mes "[Shadow Blacksmith]";
- mes "This item cannot be refined.";
+ mesf("%s", .@npc_name$);
+ mes("This item cannot be refined.");
close;
}
- if (getequippercentrefinery(.@SelectedPart) < 100) {
- mes "[Shadow Blacksmith]";
- mes "Safety guaranteed refine limit for shadow item is until +4.";
- if (!.@hoihoi) {
- mes "If you try more refining, item might get broken when failed. Still want to refine?";
+ if (getequippercentrefinery(.@SelectedPart, .@refine_type) < 100) {
+ mesf("%s", .@npc_name$);
+ mes("Safety guaranteed refine limit for shadow item is until +4.");
+ if (.@hoihoi == false) {
+ mes("If you try more refining, the item might break upon failing. Do you still want to refine?");
}
else {
- mes "If you try more refining, item refine level might go down when failed. Still want to refine?";
+ mes("If you try more refining, the item refine level might go down when failed. Do you still want to refine?");
}
next;
if (select("Proceed","Cancel") == 2) {
- mes "[Shadow Blacksmith]";
- mes "You've cancelled refining.";
+ mesf("%s", .@npc_name$);
+ mes("You've cancelled refining.");
close;
}
}
//-----------------------------------------------------------------------------
- mes "[Shadow Blacksmith]";
- mes "Here we go--!!!";
+ mesf("%s", .@npc_name$);
+ mes("Here we go--!!!");
next;
if (Zeny < 20000) {
- mes "[Shadow Blacksmith]";
- mes "You do not have enough refine fee.";
+ mesf("%s", .@npc_name$);
+ mes("You do not have enough Zeny to pay the refine fee.");
close;
}
- if (!countitem(.@choose)) {
- mes "[Shadow Blacksmith]";
- mes "You do not have enough "+ getitemname(.@choose) +".";
+ if (countitem(.@choose) == 0) {
+ mesf("%s", .@npc_name$);
+ mes("You do not have enough "+ getitemname(.@choose) +".");
close;
}
- delitem .@choose,1;
+ delitem(.@choose, 1);
Zeny -= 20000;
- if (getequippercentrefinery(.@SelectedPart) > rand(100) || ( .@option == 1 && getequippercentrefinery(.@SelectedPart) > rand(100))) {
- successrefitem .@SelectedPart;
- mes "[Shadow Blacksmith]";
- mes "Refine was successful.";
+ if (getequippercentrefinery(.@SelectedPart, .@refine_type) > rand(100)) {
+ successrefitem(.@SelectedPart);
+ mesf("%s", .@npc_name$);
+ mes("Refine was successful.");
next;
}
else {
- if (.@hoihoi)
- downrefitem .@SelectedPart;
+ if (.@hoihoi == true)
+ downrefitem(.@SelectedPart);
else
- failedrefitem .@SelectedPart;
- mes "[Shadow Blacksmith]";
- mes "Oh no.. Refine was failed.";
+ failedrefitem(.@SelectedPart);
+ mesf("%s", .@npc_name$);
+ mes("Oh no.. Refine has failed.");
close;
}
}
diff --git a/src/map/script.c b/src/map/script.c
index bd73fc021..91f1d8cc9 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -9366,20 +9366,32 @@ BUILDIN(getequipweaponlv)
* 0 : false (max refine level or unequip..)
*------------------------------------------*/
BUILDIN(getequippercentrefinery) {
- int i = -1,num;
+ int i = -1, num;
struct map_session_data *sd;
+ int type = 0;
+
+ num = script_getnum(st, 2);
+ type = (script_hasdata(st, 3)) ? script_getnum(st, 3) : REFINE_CHANCE_TYPE_NORMAL;
- num = script_getnum(st,2);
sd = script->rid2sd(st);
- if( sd == NULL )
+ if (sd == NULL)
return true;
+ if (type < REFINE_CHANCE_TYPE_NORMAL || type >= REFINE_CHANCE_TYPE_MAX) {
+ ShowError("buildin_getequippercentrefinery: Invalid type (%d) provided!\n", type);
+ script_pushint(st, 0);
+ return false;
+ }
+
+
if (num > 0 && num <= ARRAYLENGTH(script->equip))
- i=pc->checkequip(sd,script->equip[num-1]);
- if(i >= 0 && sd->status.inventory[i].nameid && sd->status.inventory[i].refine < MAX_REFINE)
- script_pushint(st,status->get_refine_chance(itemdb_wlv(sd->status.inventory[i].nameid), (int)sd->status.inventory[i].refine));
+ i = pc->checkequip(sd, script->equip[num - 1]);
+
+ if (i >= 0 && sd->status.inventory[i].nameid != 0 && sd->status.inventory[i].refine < MAX_REFINE)
+ script_pushint(st,
+ status->get_refine_chance(itemdb_wlv(sd->status.inventory[i].nameid), (int) sd->status.inventory[i].refine, (enum refine_chance_type) type));
else
- script_pushint(st,0);
+ script_pushint(st, 0);
return true;
}
@@ -23412,7 +23424,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getequipisidentify,"i"),
BUILDIN_DEF(getequiprefinerycnt,"i"),
BUILDIN_DEF(getequipweaponlv,"i"),
- BUILDIN_DEF(getequippercentrefinery,"i"),
+ BUILDIN_DEF(getequippercentrefinery,"i?"),
BUILDIN_DEF(successrefitem,"i?"),
BUILDIN_DEF(failedrefitem,"i"),
BUILDIN_DEF(downrefitem,"i?"),
@@ -24057,6 +24069,12 @@ void script_hardcoded_constants(void)
script->set_constant("BL_CHAR",BL_CHAR,false, false);
script->set_constant("BL_ALL",BL_ALL,false, false);
+ script->constdb_comment("Refine Chance Types");
+ script->set_constant("REFINE_CHANCE_TYPE_NORMAL", REFINE_CHANCE_TYPE_NORMAL, false, false);
+ script->set_constant("REFINE_CHANCE_TYPE_ENRICHED", REFINE_CHANCE_TYPE_ENRICHED, false, false);
+ script->set_constant("REFINE_CHANCE_TYPE_E_NORMAL", REFINE_CHANCE_TYPE_E_NORMAL, false, false);
+ script->set_constant("REFINE_CHANCE_TYPE_E_ENRICHED", REFINE_CHANCE_TYPE_E_ENRICHED, false, false);
+
script->constdb_comment("Player permissions");
script->set_constant("PERM_TRADE", PC_PERM_TRADE, false, false);
script->set_constant("PERM_PARTY", PC_PERM_PARTY, false, false);
diff --git a/src/map/skill.c b/src/map/skill.c
index 714c2aa71..b70ddc055 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -15652,7 +15652,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
return;
}
- per = status->get_refine_chance(ditem->wlv, (int)item->refine) * 10;
+ per = status->get_refine_chance(ditem->wlv, (int)item->refine, REFINE_CHANCE_TYPE_NORMAL) * 10;
// Aegis leaked formula. [malufett]
if (sd->status.class == JOB_MECHANIC_T)
diff --git a/src/map/status.c b/src/map/status.c
index c3e5a3f40..7982b15eb 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -12860,13 +12860,17 @@ int status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data)
* @param refine The target refine level
* @return The chance to refine the item, in percent (0~100)
**/
-int status_get_refine_chance(enum refine_type wlv, int refine)
+int status_get_refine_chance(enum refine_type wlv, int refine, enum refine_chance_type type)
{
Assert_ret((int)wlv >= REFINE_TYPE_ARMOR && wlv < REFINE_TYPE_MAX);
- if ( refine < 0 || refine >= MAX_REFINE)
- return 0;
- return status->dbs->refine_info[wlv].chance[refine];
+ if (refine < 0 || refine >= MAX_REFINE)
+ return 0;
+
+ if (type >= REFINE_CHANCE_TYPE_MAX)
+ return 0;
+
+ return status->dbs->refine_info[wlv].chance[type][refine];
}
int status_get_sc_type(sc_type type)
@@ -13191,54 +13195,84 @@ int status_readdb_refine_libconfig_sub(struct config_setting_t *r, const char *n
if ((rate=libconfig->setting_get_member(r, "Rates")) != NULL && config_setting_is_group(rate)) {
struct config_setting_t *t = NULL;
bool duplicate[MAX_REFINE];
- int bonus[MAX_REFINE], rnd_bonus[MAX_REFINE], chance[MAX_REFINE];
- int i;
+ int bonus[MAX_REFINE], rnd_bonus[MAX_REFINE];
+ int chance[REFINE_CHANCE_TYPE_MAX][MAX_REFINE];
+ int i, j;
+
memset(&duplicate, 0, sizeof(duplicate));
memset(&bonus, 0, sizeof(bonus));
memset(&rnd_bonus, 0, sizeof(rnd_bonus));
- for (i = 0; i < MAX_REFINE; i++) {
- chance[i] = 100;
- }
+ for (i = 0; i < REFINE_CHANCE_TYPE_MAX; i++)
+ for (j = 0; j < MAX_REFINE; j++)
+ chance[i][j] = 100; // default value for all rates.
+
i = 0;
+ j = 0;
while ((t = libconfig->setting_get_elem(rate,i++)) != NULL && config_setting_is_group(t)) {
int level = 0, i32;
char *rlvl = config_setting_name(t);
memset(&lv, 0, sizeof(lv));
- if (!strspn(&rlvl[strlen(rlvl)-1], "0123456789") || (level = atoi(strncpy(lv, rlvl+2, 3))) <= 0) {
+
+ if (!strspn(&rlvl[strlen(rlvl) - 1], "0123456789") || (level = atoi(strncpy(lv, rlvl + 2, 3))) <= 0) {
ShowError("status_readdb_refine_libconfig_sub: Invalid refine level format '%s' for entry %s in \"%s\"... skipping.\n", rlvl, name, source);
continue;
}
+
if (level <= 0 || level > MAX_REFINE) {
ShowError("status_readdb_refine_libconfig_sub: Out of range refine level '%s' for entry %s in \"%s\"... skipping.\n", rlvl, name, source);
continue;
}
+
level--;
+
if (duplicate[level]) {
ShowWarning("status_readdb_refine_libconfig_sub: duplicate rate '%s' for entry %s in \"%s\", overwriting previous entry...\n", rlvl, name, source);
} else {
duplicate[level] = true;
}
- if (libconfig->setting_lookup_int(t, "Chance", &i32))
- chance[level] = i32;
+
+ if (libconfig->setting_lookup_int(t, "NormalChance", &i32) != 0)
+ chance[REFINE_CHANCE_TYPE_NORMAL][level] = i32;
+ else
+ chance[REFINE_CHANCE_TYPE_NORMAL][level] = 100;
+
+ if (libconfig->setting_lookup_int(t, "EnrichedChance", &i32) != 0)
+ chance[REFINE_CHANCE_TYPE_ENRICHED][level] = i32;
+ else
+ chance[REFINE_CHANCE_TYPE_ENRICHED][level] = level > 10 ? 0 : 100; // enriched ores up to +10 only.
+
+ if (libconfig->setting_lookup_int(t, "EventNormalChance", &i32) != 0)
+ chance[REFINE_CHANCE_TYPE_E_NORMAL][level] = i32;
+ else
+ chance[REFINE_CHANCE_TYPE_E_NORMAL][level] = 100;
+
+ if (libconfig->setting_lookup_int(t, "EventEnrichedChance", &i32) != 0)
+ chance[REFINE_CHANCE_TYPE_E_ENRICHED][level] = i32;
else
- chance[level] = 100;
- if (libconfig->setting_lookup_int(t, "Bonus", &i32))
+ chance[REFINE_CHANCE_TYPE_E_ENRICHED][level] = level > 10 ? 0 : 100; // enriched ores up to +10 only.
+
+ if (libconfig->setting_lookup_int(t, "Bonus", &i32) != 0)
bonus[level] += i32;
+
if (level >= rnd_bonus_lv - 1)
rnd_bonus[level] = rnd_bonus_v * (level - rnd_bonus_lv + 2);
}
for (i = 0; i < MAX_REFINE; i++) {
- status->dbs->refine_info[type].chance[i] = chance[i];
+ status->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_NORMAL][i] = chance[REFINE_CHANCE_TYPE_NORMAL][i];
+ status->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_E_NORMAL][i] = chance[REFINE_CHANCE_TYPE_E_NORMAL][i];
+ status->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_ENRICHED][i] = chance[REFINE_CHANCE_TYPE_ENRICHED][i];
+ status->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_E_ENRICHED][i] = chance[REFINE_CHANCE_TYPE_E_ENRICHED][i];
status->dbs->refine_info[type].randombonus_max[i] = rnd_bonus[i];
- bonus[i] += bonus_per_level + (i > 0 ? bonus[i-1] : 0);
+ bonus[i] += bonus_per_level + (i > 0 ? bonus[i - 1] : 0);
status->dbs->refine_info[type].bonus[i] = bonus[i];
}
} else {
ShowWarning("status_readdb_refine_libconfig_sub: Missing refine rates for entry '%s' in \"%s\", skipping.\n", name, source);
return 0;
}
- return type+1;
+
+ return type + 1;
}
/**
@@ -13332,15 +13366,6 @@ int status_readdb(void)
for(j = 0; j < MAX_SINGLE_WEAPON_TYPE; j++)
status->dbs->atkmods[i][j] = 100;
- // refine_db.txt
- for(i=0;i<ARRAYLENGTH(status->dbs->refine_info);i++) {
- for(j=0;j<MAX_REFINE; j++) {
- status->dbs->refine_info[i].chance[j] = 100;
- status->dbs->refine_info[i].bonus[j] = 0;
- status->dbs->refine_info[i].randombonus_max[j] = 0;
- }
- }
-
// read databases
//
sv->readdb(map->db_path, "job_db2.txt", ',', 1, 1+MAX_LEVEL, -1, status->readdb_job2);
diff --git a/src/map/status.h b/src/map/status.h
index 1496429a8..de21fa16c 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -2233,9 +2233,17 @@ struct status_change {
#define status_calc_elemental(ed, opt) (status->calc_bl_(&(ed)->bl, SCB_ALL, (opt)))
#define status_calc_npc(nd, opt) (status->calc_bl_(&(nd)->bl, SCB_ALL, (opt)))
+enum refine_chance_type {
+ REFINE_CHANCE_TYPE_NORMAL = 0, // Normal Chance
+ REFINE_CHANCE_TYPE_ENRICHED = 1, // Enriched Ore Chance
+ REFINE_CHANCE_TYPE_E_NORMAL = 2, // Event Normal Ore Chance
+ REFINE_CHANCE_TYPE_E_ENRICHED = 3, // Event Enriched Ore Chance
+ REFINE_CHANCE_TYPE_MAX
+};
+
// bonus values and upgrade chances for refining equipment
struct s_refine_info {
- int chance[MAX_REFINE]; // success chance
+ int chance[REFINE_CHANCE_TYPE_MAX][MAX_REFINE]; // success chance
int bonus[MAX_REFINE]; // cumulative fixed bonus damage
int randombonus_max[MAX_REFINE]; // cumulative maximum random bonus damage
};
@@ -2283,7 +2291,7 @@ struct status_interface {
int (*init) (bool minimal);
void (*final) (void);
/* funcs */
- int (*get_refine_chance) (enum refine_type wlv, int refine);
+ int (*get_refine_chance) (enum refine_type wlv, int refine, enum refine_chance_type type);
// for looking up associated data
sc_type (*skill2sc) (int skill_id);
int (*sc2skill) (sc_type sc);
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 1a2e7a2d5..847edbbd8 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -6776,8 +6776,8 @@ typedef int (*HPMHOOK_pre_status_init) (bool *minimal);
typedef int (*HPMHOOK_post_status_init) (int retVal___, bool minimal);
typedef void (*HPMHOOK_pre_status_final) (void);
typedef void (*HPMHOOK_post_status_final) (void);
-typedef int (*HPMHOOK_pre_status_get_refine_chance) (enum refine_type *wlv, int *refine);
-typedef int (*HPMHOOK_post_status_get_refine_chance) (int retVal___, enum refine_type wlv, int refine);
+typedef int (*HPMHOOK_pre_status_get_refine_chance) (enum refine_type *wlv, int *refine, enum refine_chance_type *type);
+typedef int (*HPMHOOK_post_status_get_refine_chance) (int retVal___, enum refine_type wlv, int refine, enum refine_chance_type type);
typedef sc_type (*HPMHOOK_pre_status_skill2sc) (int *skill_id);
typedef sc_type (*HPMHOOK_post_status_skill2sc) (sc_type retVal___, int skill_id);
typedef int (*HPMHOOK_pre_status_sc2skill) (sc_type *sc);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index a13074cb9..c0b70bf60 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -74360,15 +74360,15 @@ void HP_status_final(void) {
}
return;
}
-int HP_status_get_refine_chance(enum refine_type wlv, int refine) {
+int HP_status_get_refine_chance(enum refine_type wlv, int refine, enum refine_chance_type type) {
int hIndex = 0;
int retVal___ = 0;
if (HPMHooks.count.HP_status_get_refine_chance_pre > 0) {
- int (*preHookFunc) (enum refine_type *wlv, int *refine);
+ int (*preHookFunc) (enum refine_type *wlv, int *refine, enum refine_chance_type *type);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_get_refine_chance_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_status_get_refine_chance_pre[hIndex].func;
- retVal___ = preHookFunc(&wlv, &refine);
+ retVal___ = preHookFunc(&wlv, &refine, &type);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -74376,13 +74376,13 @@ int HP_status_get_refine_chance(enum refine_type wlv, int refine) {
}
}
{
- retVal___ = HPMHooks.source.status.get_refine_chance(wlv, refine);
+ retVal___ = HPMHooks.source.status.get_refine_chance(wlv, refine, type);
}
if (HPMHooks.count.HP_status_get_refine_chance_post > 0) {
- int (*postHookFunc) (int retVal___, enum refine_type wlv, int refine);
+ int (*postHookFunc) (int retVal___, enum refine_type wlv, int refine, enum refine_chance_type type);
for (hIndex = 0; hIndex < HPMHooks.count.HP_status_get_refine_chance_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_status_get_refine_chance_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, wlv, refine);
+ retVal___ = postHookFunc(retVal___, wlv, refine, type);
}
}
return retVal___;