summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-05-06 00:19:06 +0200
committerGitHub <noreply@github.com>2019-05-06 00:19:06 +0200
commit574801d93c55b5ac41f9bdbd660f747f1c5aaa76 (patch)
tree473c9ada31454ae62f73215ade30687cd61a3b4e
parent31f47be4b26e69d2880e12530d021ce6c8c802ea (diff)
parent86a3d6ce9b259baf29d7cc05a8e75aa2b1e3ac24 (diff)
downloadhercules-574801d93c55b5ac41f9bdbd660f747f1c5aaa76.tar.gz
hercules-574801d93c55b5ac41f9bdbd660f747f1c5aaa76.tar.bz2
hercules-574801d93c55b5ac41f9bdbd660f747f1c5aaa76.tar.xz
hercules-574801d93c55b5ac41f9bdbd660f747f1c5aaa76.zip
Merge pull request #2446 from hemagx/refinery_ui_update
Implement Refinery ui and Refine code refactor
-rw-r--r--Hercules.xcodeproj/project.pbxproj22
-rw-r--r--conf/map/battle/feature.conf10
-rw-r--r--conf/messages.conf3
-rw-r--r--db/pre-re/refine_db.conf185
-rw-r--r--db/re/refine_db.conf624
-rw-r--r--doc/script_commands.txt6
-rw-r--r--npc/merchants/advanced_refiner.txt19
-rw-r--r--npc/merchants/hd_refine.txt15
-rw-r--r--npc/merchants/refine.txt17
-rw-r--r--npc/re/merchants/hd_refiner.txt11
-rw-r--r--npc/re/merchants/refine.txt11
-rw-r--r--npc/re/merchants/shadow_refiner.txt10
-rw-r--r--src/common/HPMDataCheck.h14
-rw-r--r--src/common/HPMSymbols.inc.h7
-rw-r--r--src/common/mmo.h8
-rw-r--r--src/map/HPMmap.c2
-rw-r--r--src/map/Makefile.in6
-rw-r--r--src/map/atcommand.c46
-rw-r--r--src/map/battle.c14
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/clif.c105
-rw-r--r--src/map/clif.h7
-rw-r--r--src/map/itemdb.c1
-rw-r--r--src/map/itemdb.h1
-rw-r--r--src/map/log.c4
-rw-r--r--src/map/log.h2
-rw-r--r--src/map/map.c4
-rw-r--r--src/map/packets.h6
-rw-r--r--src/map/packets_struct.h70
-rw-r--r--src/map/pc.h5
-rw-r--r--src/map/refine.c669
-rw-r--r--src/map/refine.h148
-rw-r--r--src/map/refine.p.h144
-rw-r--r--src/map/script.c23
-rw-r--r--src/map/searchstore.c4
-rw-r--r--src/map/searchstore.h2
-rw-r--r--src/map/skill.c3
-rw-r--r--src/map/status.c209
-rw-r--r--src/map/status.h41
-rw-r--r--src/plugins/HPMHooking.c2
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc60
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc98
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc26
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc665
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.sources.inc2
-rw-r--r--vcproj-12/map-server.vcxproj3
-rw-r--r--vcproj-12/map-server.vcxproj.filters9
-rw-r--r--vcproj-14/map-server.vcxproj3
-rw-r--r--vcproj-14/map-server.vcxproj.filters9
-rw-r--r--vcproj-15/map-server.vcxproj3
-rw-r--r--vcproj-15/map-server.vcxproj.filters11
51 files changed, 2969 insertions, 402 deletions
diff --git a/Hercules.xcodeproj/project.pbxproj b/Hercules.xcodeproj/project.pbxproj
index 1126c3780..403e7357a 100644
--- a/Hercules.xcodeproj/project.pbxproj
+++ b/Hercules.xcodeproj/project.pbxproj
@@ -164,6 +164,8 @@
A5BBC249219D076900E26B8D /* packets.c in Sources */ = {isa = PBXBuildFile; fileRef = A5BBC218219D076900E26B8D /* packets.c */; };
A5BBC251219D081800E26B8D /* packets.c in Sources */ = {isa = PBXBuildFile; fileRef = A5BBC218219D076900E26B8D /* packets.c */; };
A5BBC252219D081900E26B8D /* packets.c in Sources */ = {isa = PBXBuildFile; fileRef = A5BBC218219D076900E26B8D /* packets.c */; };
+ A5C5CF5F227F959700485106 /* refine.c in Sources */ = {isa = PBXBuildFile; fileRef = A5C5CF59227F959600485106 /* refine.c */; };
+ A5C5CF60227F959700485106 /* stylist.c in Sources */ = {isa = PBXBuildFile; fileRef = A5C5CF5A227F959600485106 /* stylist.c */; };
A5F7946C191CA34E002293AB /* sysinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = A5F79469191CA34E002293AB /* sysinfo.c */; };
A5F7946D191CA34E002293AB /* sysinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = A5F79469191CA34E002293AB /* sysinfo.c */; };
A5F7946E191CA34E002293AB /* sysinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = A5F79469191CA34E002293AB /* sysinfo.c */; };
@@ -494,6 +496,15 @@
A5BBC24E219D07A800E26B8D /* messages_ad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = messages_ad.h; path = src/map/messages_ad.h; sourceTree = SOURCE_ROOT; };
A5BBC24F219D07A800E26B8D /* messages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = messages.h; path = src/map/messages.h; sourceTree = SOURCE_ROOT; };
A5BBC250219D07A800E26B8D /* messages_sak.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = messages_sak.h; path = src/map/messages_sak.h; sourceTree = SOURCE_ROOT; };
+ A5C5CF56227F955100485106 /* packets_ac_struct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = packets_ac_struct.h; path = src/login/packets_ac_struct.h; sourceTree = SOURCE_ROOT; };
+ A5C5CF57227F955100485106 /* packets_ca_struct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = packets_ca_struct.h; path = src/login/packets_ca_struct.h; sourceTree = SOURCE_ROOT; };
+ A5C5CF58227F956900485106 /* packets_hc_struct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = packets_hc_struct.h; path = src/char/packets_hc_struct.h; sourceTree = SOURCE_ROOT; };
+ A5C5CF59227F959600485106 /* refine.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = refine.c; path = src/map/refine.c; sourceTree = SOURCE_ROOT; };
+ A5C5CF5A227F959600485106 /* stylist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stylist.c; path = src/map/stylist.c; sourceTree = SOURCE_ROOT; };
+ A5C5CF5B227F959700485106 /* stylist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stylist.h; path = src/map/stylist.h; sourceTree = SOURCE_ROOT; };
+ A5C5CF5C227F959700485106 /* refine.p.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = refine.p.h; path = src/map/refine.p.h; sourceTree = SOURCE_ROOT; };
+ A5C5CF5D227F959700485106 /* mapdefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mapdefines.h; path = src/map/mapdefines.h; sourceTree = SOURCE_ROOT; };
+ A5C5CF5E227F959700485106 /* refine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = refine.h; path = src/map/refine.h; sourceTree = SOURCE_ROOT; };
A5F79468191CA34E002293AB /* HPMDataCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HPMDataCheck.h; path = src/common/HPMDataCheck.h; sourceTree = "<group>"; };
A5F79469191CA34E002293AB /* sysinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sysinfo.c; path = src/common/sysinfo.c; sourceTree = "<group>"; };
A5F7946A191CA34E002293AB /* sysinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sysinfo.h; path = src/common/sysinfo.h; sourceTree = "<group>"; };
@@ -607,6 +618,8 @@
A56CC68618564387009EB79C /* login.h */,
A56CC68718564387009EB79C /* loginlog.c */,
A56CC68818564387009EB79C /* loginlog.h */,
+ A5C5CF56227F955100485106 /* packets_ac_struct.h */,
+ A5C5CF57227F955100485106 /* packets_ca_struct.h */,
);
path = "login-server";
sourceTree = "<group>";
@@ -652,6 +665,7 @@
A5467AD21A16FCB4008AFAA6 /* loginif.h */,
A5467AD41A16FCDC008AFAA6 /* mapif.c */,
A5467AD51A16FCDC008AFAA6 /* mapif.h */,
+ A5C5CF58227F956900485106 /* packets_hc_struct.h */,
A56CC75B185657D9009EB79C /* pincode.c */,
A56CC75C185657D9009EB79C /* pincode.h */,
);
@@ -708,6 +722,7 @@
A56CC78F18565812009EB79C /* mail.h */,
A56CC79018565812009EB79C /* map.c */,
A56CC79118565812009EB79C /* map.h */,
+ A5C5CF5D227F959700485106 /* mapdefines.h */,
A56CC79218565812009EB79C /* mapreg_sql.c */,
A56CC79318565812009EB79C /* mapreg.h */,
A56CC79418565812009EB79C /* mercenary.c */,
@@ -742,6 +757,9 @@
A56CC7A618565812009EB79C /* pet.h */,
A56CC7A718565812009EB79C /* quest.c */,
A56CC7A818565812009EB79C /* quest.h */,
+ A5C5CF59227F959600485106 /* refine.c */,
+ A5C5CF5E227F959700485106 /* refine.h */,
+ A5C5CF5C227F959700485106 /* refine.p.h */,
755495851FEE5A1F00CE4B7D /* rodex.c */,
755495861FEE5A1F00CE4B7D /* rodex.h */,
A56CC7A918565812009EB79C /* script.c */,
@@ -754,6 +772,8 @@
A56CC7B018565812009EB79C /* status.h */,
A56CC7B118565812009EB79C /* storage.c */,
A56CC7B218565812009EB79C /* storage.h */,
+ A5C5CF5A227F959600485106 /* stylist.c */,
+ A5C5CF5B227F959700485106 /* stylist.h */,
A56CC7B318565812009EB79C /* trade.c */,
A56CC7B418565812009EB79C /* trade.h */,
A56CC7B518565812009EB79C /* unit.c */,
@@ -1385,11 +1405,13 @@
A56CC7BF18565812009EB79C /* clif.c in Sources */,
A5F7946E191CA34E002293AB /* sysinfo.c in Sources */,
A56CC7D018565812009EB79C /* npc_chat.c in Sources */,
+ A5C5CF5F227F959700485106 /* refine.c in Sources */,
A56CC6CE185643BB009EB79C /* console.c in Sources */,
A56CC73018564C05009EB79C /* grammar.c in Sources */,
A56CC7DA18565812009EB79C /* skill.c in Sources */,
A56CC6EC185643BB009EB79C /* md5calc.c in Sources */,
A56CC73918564C05009EB79C /* scanner.c in Sources */,
+ A5C5CF60227F959700485106 /* stylist.c in Sources */,
A56CC701185643BB009EB79C /* random.c in Sources */,
A56CC7CD18565812009EB79C /* mapreg_sql.c in Sources */,
A56CC7D318565812009EB79C /* path.c in Sources */,
diff --git a/conf/map/battle/feature.conf b/conf/map/battle/feature.conf
index 5e40f2898..0cb293d60 100644
--- a/conf/map/battle/feature.conf
+++ b/conf/map/battle/feature.conf
@@ -88,4 +88,14 @@ features: {
// true: enable (Default)
// false: disable
enable_achievement_system: true
+
+ // Enable Refinery UI (requires 2016-10-05Ragexe/RE)
+ // true: enable (Default)
+ // false: disable
+ enable_refinery_ui: false
+
+ // Replace Refine NPCs with Refinery UI
+ // true: enable
+ // false: disable (default)
+ replace_refine_npcs: false
}
diff --git a/conf/messages.conf b/conf/messages.conf
index 772b882c9..2788f264d 100644
--- a/conf/messages.conf
+++ b/conf/messages.conf
@@ -449,7 +449,8 @@
// Return pet to egg message
451: You can't return your pet because your inventory is full.
452: usage @camerainfo range rotation latitude
-//453-497 FREE
+453: Refinery UI is not available
+//454-497 FREE
// Messages of others (not for GM commands)
// ----------------------------------------
diff --git a/db/pre-re/refine_db.conf b/db/pre-re/refine_db.conf
index dd3bcdb41..725b8c225 100644
--- a/db/pre-re/refine_db.conf
+++ b/db/pre-re/refine_db.conf
@@ -37,6 +37,30 @@ Armors/WeaponLevel1~4: { // Specifies weap
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.
+ RefineryUISettings: (
+ {
+ Level: (int or array of int) // Holds either the individule refine level meant for this setting or an array defining a range
+ of Low to Max level
+ BlacksmithBlessing: (int) (optional) // How many Blacksmith Blessing required for this range to be safe from breaking
+ Announce: "(string)" (optional) // Sends an announcement server wide when a player reach this refine level using
+ Refinery UI, this feature is only available starting from 2017-08-30 RagexeRE or
+ 2017-09-06 Ragexe the field accepts the following values and it defaults to not announce
+ Success to set the announcement on item refine successful
+ Failure to set the announcement on item refine failure
+ Always to always announce it
+ Items: {
+ AegisName: {
+ Type: "(string)" // The type to determine the chances used for this item, REFINE_CHANCE_TYPE_*
+ constants are used in here
+ Cost: (int) (optional) // Amount of zeny required
+ FailureBehavior: "(string)" (optional) // The expected behvaior on failure for this item, the following strings are used in here
+ Destroy (default) sets the item to be destroyed on failure
+ Keep keeps the item after failure
+ Downgrade downgrades the item by one level on failure
+ }
+ }
+ }
+ )
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%).
@@ -54,6 +78,39 @@ Armors: {
StatsPerLevel: 66
RandomBonusStartLevel: 0
RandomBonusValue: 0
+ RefineryUISettings: (
+ {
+ Level: [1, 7]
+ Items: {
+ Elunium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 2000
+ }
+ Enriched_Elunium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 2000
+ }
+ }
+ },
+ {
+ Level: [8, 10]
+ Items: {
+ Elunium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 2000
+ }
+ Enriched_Elunium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 2000
+ }
+ HD_Elunium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ )
Rates: {
Lv5: {
NormalChance: 60
@@ -97,6 +154,38 @@ WeaponLevel1: {
StatsPerLevel: 200
RandomBonusStartLevel: 8
RandomBonusValue: 300
+ RefineryUISettings: (
+ {
+ Level: [1, 7]
+ Items: {
+ Phracon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 50
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 50
+ }
+ }
+ },
+ {
+ Level: [8, 10]
+ Items: {
+ Phracon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 50
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 50
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ }
+ }
+ },
+ )
Rates: {
Lv8: {
NormalChance: 60
@@ -122,6 +211,38 @@ WeaponLevel2: {
StatsPerLevel: 300
RandomBonusStartLevel: 7
RandomBonusValue: 500
+ RefineryUISettings: (
+ {
+ Level: [1, 7]
+ Items: {
+ Emveretarcon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 200
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 200
+ }
+ }
+ },
+ {
+ Level: [8, 10]
+ Items: {
+ Emveretarcon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 200
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 200
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ }
+ }
+ },
+ )
Rates: {
Lv7: {
NormalChance: 60
@@ -153,6 +274,38 @@ WeaponLevel3: {
StatsPerLevel: 500
RandomBonusStartLevel: 6
RandomBonusValue: 800
+ RefineryUISettings: (
+ {
+ Level: [1, 7]
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 5000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 5000
+ }
+ }
+ },
+ {
+ Level: [8, 10]
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 5000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 5000
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ }
+ }
+ },
+ )
Rates: {
Lv6: {
NormalChance: 60
@@ -190,6 +343,38 @@ WeaponLevel4: {
StatsPerLevel: 700
RandomBonusStartLevel: 5
RandomBonusValue: 1300
+ RefineryUISettings: (
+ {
+ Level: [1, 7]
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 5000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 5000
+ }
+ }
+ },
+ {
+ Level: [8, 10]
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 5000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 5000
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ }
+ }
+ },
+ )
Rates: {
Lv5: {
NormalChance: 60
diff --git a/db/re/refine_db.conf b/db/re/refine_db.conf
index 4974e0033..c83f71334 100644
--- a/db/re/refine_db.conf
+++ b/db/re/refine_db.conf
@@ -37,6 +37,30 @@ Armors/WeaponLevel1~4: { // Specifies weap
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.
+ RefineryUISettings: (
+ {
+ Level: (int or array of int) // Holds either the individule refine level meant for this setting or an array defining a range
+ of Low to Max level
+ BlacksmithBlessing: (int) (optional) // How many Blacksmith Blessing required for this range to be safe from breaking
+ Announce: "(string)" (optional) // Sends an announcement server wide when a player reach this refine level using
+ Refinery UI, this feature is only available starting from 2017-08-30 RagexeRE or
+ 2017-09-06 Ragexe the field accepts the following values and it defaults to not announce
+ Success to set the announcement on item refine successful
+ Failure to set the announcement on item refine failure
+ Always to always announce it
+ Items: {
+ AegisName: {
+ Type: "(string)" // The type to determine the chances used for this item, REFINE_CHANCE_TYPE_*
+ constants are used in here
+ Cost: (int) (optional) // Amount of zeny required
+ FailureBehavior: "(string)" (optional) // The expected behvaior on failure for this item, the following strings are used in here
+ Destroy (default) sets the item to be destroyed on failure
+ Keep keeps the item after failure
+ Downgrade downgrades the item by one level on failure
+ }
+ }
+ }
+ )
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%).
@@ -54,6 +78,126 @@ Armors: {
StatsPerLevel: 0
RandomBonusStartLevel: 0
RandomBonusValue: 0
+ RefineryUISettings: (
+ {
+ Level: [1, 7]
+ Items: {
+ Elunium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 2000
+ }
+ Enriched_Elunium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 2000
+ }
+ }
+ },
+ {
+ Level: 8
+ BlacksmithBlessing: 1
+ Items: {
+ Elunium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 2000
+ }
+ Enriched_Elunium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 2000
+ }
+ HD_Elunium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 9
+ BlacksmithBlessing: 2
+ Items: {
+ Elunium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 2000
+ }
+ Enriched_Elunium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 2000
+ }
+ HD_Elunium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 10
+ BlacksmithBlessing: 4
+ Announce: "Success"
+ Items: {
+ Elunium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 2000
+ }
+ Enriched_Elunium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 2000
+ }
+ HD_Elunium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 11
+ BlacksmithBlessing: 7
+ Announce: "Always"
+ Items: {
+ Carnium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Carnium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 12
+ BlacksmithBlessing: 11
+ Announce: "Always"
+ Items: {
+ Carnium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Carnium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: [13, 20]
+ Announce: "Always"
+ Items: {
+ Carnium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Carnium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ )
Rates: {
Lv1: {
Bonus: 100
@@ -175,6 +319,126 @@ WeaponLevel1: {
StatsPerLevel: 200
RandomBonusStartLevel: 8
RandomBonusValue: 300
+ RefineryUISettings: (
+ {
+ Level: [1, 7]
+ Items: {
+ Phracon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 50
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 50
+ }
+ }
+ },
+ {
+ Level: 8
+ BlacksmithBlessing: 1
+ Items: {
+ Phracon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 50
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 50
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 9
+ BlacksmithBlessing: 2
+ Items: {
+ Phracon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 50
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 50
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 10
+ BlacksmithBlessing: 4
+ Announce: "Success"
+ Items: {
+ Phracon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 50
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 50
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 11
+ BlacksmithBlessing: 7
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 12
+ BlacksmithBlessing: 11
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: [13, 20]
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ )
Rates: {
Lv8: {
NormalChance: 60
@@ -255,6 +519,126 @@ WeaponLevel2: {
StatsPerLevel: 300
RandomBonusStartLevel: 7
RandomBonusValue: 500
+ RefineryUISettings: (
+ {
+ Level: [1, 7]
+ Items: {
+ Emveretarcon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 200
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 200
+ }
+ }
+ },
+ {
+ Level: 8
+ BlacksmithBlessing: 1
+ Items: {
+ Emveretarcon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 200
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 200
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 9
+ BlacksmithBlessing: 2
+ Items: {
+ Emveretarcon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 200
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 200
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 10
+ BlacksmithBlessing: 4
+ Announce: "Success"
+ Items: {
+ Emveretarcon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 200
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 200
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 11
+ BlacksmithBlessing: 7
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 12
+ BlacksmithBlessing: 11
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: [13, 20]
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ )
Rates: {
Lv7: {
NormalChance: 60
@@ -341,6 +725,126 @@ WeaponLevel3: {
StatsPerLevel: 500
RandomBonusStartLevel: 6
RandomBonusValue: 800
+ RefineryUISettings: (
+ {
+ Level: [1, 7]
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 5000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 5000
+ }
+ }
+ },
+ {
+ Level: 8
+ BlacksmithBlessing: 1
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 5000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 5000
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 9
+ BlacksmithBlessing: 2
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 5000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 5000
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 10
+ BlacksmithBlessing: 4
+ Announce: "Success"
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 5000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 5000
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 11
+ BlacksmithBlessing: 7
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 12
+ BlacksmithBlessing: 11
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: [13, 20]
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ )
Rates: {
Lv6: {
NormalChance: 60
@@ -433,6 +937,126 @@ WeaponLevel4: {
StatsPerLevel: 700
RandomBonusStartLevel: 5
RandomBonusValue: 1400
+ RefineryUISettings: (
+ {
+ Level: [1, 7]
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 20000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ }
+ }
+ },
+ {
+ Level: 8
+ BlacksmithBlessing: 1
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 20000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 9
+ BlacksmithBlessing: 2
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 20000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 10
+ BlacksmithBlessing: 4
+ Announce: "Success"
+ Items: {
+ Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 20000
+ }
+ Enriched_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ }
+ HD_Oridecon: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 11
+ BlacksmithBlessing: 7
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: 12
+ BlacksmithBlessing: 11
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ {
+ Level: [13, 20]
+ Announce: "Always"
+ Items: {
+ Bradium: {
+ Type: "REFINE_CHANCE_TYPE_NORMAL"
+ Cost: 100000
+ }
+ HD_Bradium: {
+ Type: "REFINE_CHANCE_TYPE_ENRICHED"
+ Cost: 20000
+ FailureBehavior: "Downgrade"
+ }
+ }
+ },
+ )
Rates: {
Lv5: {
NormalChance: 60
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 4d8053da0..516454365 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -10463,3 +10463,9 @@ Force close roulette window.
Works for 20141008 main clients, 20140903 re, any zero.
---------------------------------------
+*openrefineryui()
+
+Opens refinery user interface for the player
+returns true on success and false on failure
+
+---------------------------------------
diff --git a/npc/merchants/advanced_refiner.txt b/npc/merchants/advanced_refiner.txt
index 9632f95f7..ec263e192 100644
--- a/npc/merchants/advanced_refiner.txt
+++ b/npc/merchants/advanced_refiner.txt
@@ -44,14 +44,19 @@
//=========================================================================
payon,157,146,6 script Suhnbi#cash 4_M_03,{
- disable_items;
- mes "[Suhnbi]";
- mes "I am the Armsmith";
- mes "I can refine all kinds of weapons,";
- mes "armor and equipment, so let me";
- mes "know what you want to refine.";
- next;
+ mes("[Suhnbi]");
+ mes("I am the Armsmith");
+ mes("I can refine all kinds of weapons,");
+ mes("armor and equipment, so let me");
+ mes("know what you want to refine.");
+ if (getbattleflag("features/replace_refine_npcs") == 1) {
+ if (openrefineryui())
+ close();
+ }
+ next();
+
+ disable_items;
setarray .@position$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
.@menu$ = "";
for(.@i = 1; .@i<=10; ++.@i) {
diff --git a/npc/merchants/hd_refine.txt b/npc/merchants/hd_refine.txt
index a7fc5e922..1a5a43621 100644
--- a/npc/merchants/hd_refine.txt
+++ b/npc/merchants/hd_refine.txt
@@ -39,6 +39,17 @@
//== Blacksmith Mighty Hammer (+7~9) =======================
- script ::MightyHammer FAKE_NPC,{
+ mes("[Blacksmith Mighty Hammer]");
+ mes("I'm a blacksmith skilled in refining weapons and armors.");
+ mes("I can refine an item of your choice among the items you are equipped with.");
+ mes("Which item do you want to refine?");
+
+ if (getbattleflag("features/replace_refine_npcs") == 1) {
+ if (openrefineryui())
+ close();
+ }
+ next();
+
disable_items;
mes "[Blacksmith Mighty Hammer]";
mes "Unlike others, I am a blacksmith who refines a very limited number of items.";
@@ -179,6 +190,10 @@ lhz_in02,280,19,3 duplicate(MightyHammer) Mighty Hammer#lhz 4_M_DWARF
//== Basta (+10 and up) ====================================
- script ::Basta FAKE_NPC,{
+ if (getbattleflag("features/replace_refine_npcs") == 1) {
+ if (openrefineryui())
+ end();
+ }
disable_items;
mes "[Basta]";
mes "I'm the best Blacksmith in the whole world, Basta.";
diff --git a/npc/merchants/refine.txt b/npc/merchants/refine.txt
index 7f1b4d9a3..19ebf4a8e 100644
--- a/npc/merchants/refine.txt
+++ b/npc/merchants/refine.txt
@@ -589,14 +589,19 @@ lhz_in02,282,20,7 script Fulerr 4_M_LGTMAN,{
// If you enable this function, be sure to edit the value of .@safe to the max
// safe refine in refine_db.txt as well.
function script refinemain {
+ mesf("[%s]", getarg(0));
+ mes("I'm the Armsmith.");
+ mes("I can refine all kinds of weapons, armor and equipment, so let me");
+ mes("know what you want me to refine.");
+
+ if (getbattleflag("features/replace_refine_npcs") == 1) {
+ if (openrefineryui())
+ close();
+ }
+ next();
+
disable_items;
.@features = getarg(1);
- mes "[" + getarg(0) + "]";
- mes "I'm the Armsmith.";
- mes "I can refine all kinds of weapons, armor and equipment, so let me";
- mes "know what you want me to refine.";
- next;
-
setarray .@position$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
.@menu$ = "";
for(.@i = 1; .@i <= 10; ++.@i) {
diff --git a/npc/re/merchants/hd_refiner.txt b/npc/re/merchants/hd_refiner.txt
index 17979642e..2dcc74bae 100644
--- a/npc/re/merchants/hd_refiner.txt
+++ b/npc/re/merchants/hd_refiner.txt
@@ -39,6 +39,17 @@
//== Blacksmith Mighty Hammer (+7~9) =======================
- script ::MightyHammer FAKE_NPC,{
+ mes("[Blacksmith Mighty Hammer]");
+ mes("I'm a blacksmith skilled in refining weapons and armors.");
+ mes("I can refine an item of your choice among the items you are equipped with.");
+ mes("Which item do you want to refine?");
+
+ if (getbattleflag("features/replace_refine_npcs") == 1) {
+ if (openrefineryui())
+ close();
+ }
+ next();
+
disable_items;
mes "[Blacksmith Mighty Hammer]";
mes "Unlike others, I am a blacksmith who refines a very limited number of items.";
diff --git a/npc/re/merchants/refine.txt b/npc/re/merchants/refine.txt
index 6356acfca..879e9a5f1 100644
--- a/npc/re/merchants/refine.txt
+++ b/npc/re/merchants/refine.txt
@@ -56,6 +56,17 @@ payon_in01,18,132,3 script Vestri#pay 4_M_DWARF,{
// On official servers, if an item is unsuccessfully refined it will break at a
// 20% rate and downgrade at an 80% rate.
function script refinenew {
+ mesf("[%s]", getarg(0));
+ mes("I'm a blacksmith skilled in refining weapons and armors.");
+ mes("I can refine an item of your choice among the items you are equipped with.");
+ mes("Which item do you want to refine?");
+
+ if (getbattleflag("features/replace_refine_npcs") == 1) {
+ if (openrefineryui())
+ close();
+ }
+ next();
+
disable_items;
mes "["+ getarg(0) +"]";
mes "I am the best Armsmith ever!";
diff --git a/npc/re/merchants/shadow_refiner.txt b/npc/re/merchants/shadow_refiner.txt
index f03d348b2..db9668b6d 100644
--- a/npc/re/merchants/shadow_refiner.txt
+++ b/npc/re/merchants/shadow_refiner.txt
@@ -39,11 +39,17 @@ itemmall,31,76,3 script Shadow Blacksmith#nomal 4_F_JOB_BLACKSMITH,{
.@npc_name$ = "[Shadow Blacksmith]";
.@zeny_cost = 20000; // Amount of zeny to be charged for refining.
- disable_items;
mesf("%s", .@npc_name$);
mes("Do you want to refine a Shadow item?");
mes("Please choose the part you want to refine.");
- next;
+
+ if (getbattleflag("features/replace_refine_npcs") == 1) {
+ if (openrefineryui())
+ close();
+ }
+ next();
+
+ disable_items;
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" + ":"));
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h
index 966e63d29..db0594ff6 100644
--- a/src/common/HPMDataCheck.h
+++ b/src/common/HPMDataCheck.h
@@ -892,6 +892,19 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
#else
#define MAP_QUEST_H
#endif // MAP_QUEST_H
+ #ifdef MAP_REFINE_H
+ { "refine_interface", sizeof(struct refine_interface), SERVER_TYPE_MAP },
+ { "s_refine_requirement", sizeof(struct s_refine_requirement), SERVER_TYPE_MAP },
+ #else
+ #define MAP_REFINE_H
+ #endif // MAP_REFINE_H
+ #ifdef MAP_REFINE_P_H
+ { "refine_interface_dbs", sizeof(struct refine_interface_dbs), SERVER_TYPE_MAP },
+ { "refine_interface_private", sizeof(struct refine_interface_private), SERVER_TYPE_MAP },
+ { "s_refine_info", sizeof(struct s_refine_info), SERVER_TYPE_MAP },
+ #else
+ #define MAP_REFINE_P_H
+ #endif // MAP_REFINE_P_H
#ifdef MAP_RODEX_H
{ "rodex_interface", sizeof(struct rodex_interface), SERVER_TYPE_MAP },
#else
@@ -954,7 +967,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
#ifdef MAP_STATUS_H
{ "regen_data", sizeof(struct regen_data), SERVER_TYPE_MAP },
{ "regen_data_sub", sizeof(struct regen_data_sub), SERVER_TYPE_MAP },
- { "s_refine_info", sizeof(struct s_refine_info), SERVER_TYPE_MAP },
{ "s_status_dbs", sizeof(struct s_status_dbs), SERVER_TYPE_MAP },
{ "sc_display_entry", sizeof(struct sc_display_entry), SERVER_TYPE_MAP },
{ "status_change", sizeof(struct status_change), SERVER_TYPE_MAP },
diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h
index 9410f0586..f92899114 100644
--- a/src/common/HPMSymbols.inc.h
+++ b/src/common/HPMSymbols.inc.h
@@ -245,6 +245,9 @@ struct pincode_interface *pincode;
#ifdef MAP_QUEST_H /* quest */
struct quest_interface *quest;
#endif // MAP_QUEST_H
+#ifdef MAP_REFINE_H /* refine */
+struct refine_interface *refine;
+#endif // MAP_REFINE_H
#ifdef COMMON_RANDOM_H /* rnd */
struct rnd_interface *rnd;
#endif // COMMON_RANDOM_H
@@ -601,6 +604,10 @@ HPExport const char *HPM_shared_symbols(int server_type)
if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("quest", quest))
return "quest";
#endif // MAP_QUEST_H
+#ifdef MAP_REFINE_H /* refine */
+ if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("refine", refine))
+ return "refine";
+#endif // MAP_REFINE_H
#ifdef COMMON_RANDOM_H /* rnd */
if ((server_type&(SERVER_TYPE_ALL)) != 0 && !HPM_SYMBOL("rnd", rnd))
return "rnd";
diff --git a/src/common/mmo.h b/src/common/mmo.h
index aafa54008..eb74d62b3 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -1366,6 +1366,10 @@ enum questinfo_type {
#define MAX_ITEMLIST MAX_STORAGE
#endif
+#ifndef MAX_REFINE_REQUIREMENTS
+ #define MAX_REFINE_REQUIREMENTS 4
+#endif
+
// sanity checks...
#if MAX_ZENY > INT_MAX
#error MAX_ZENY is too big
@@ -1379,4 +1383,8 @@ enum questinfo_type {
#error MAX_SKILL has been replaced by MAX_SKILL_DB. Please update your custom definitions.
#endif
+#if MAX_REFINE_REQUIREMENTS > 4
+#error MAX_REFINE_REQUIREMENTS is bigger than allowed, this is a hardcoded limit in the client
+#endif
+
#endif /* COMMON_MMO_H */
diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c
index cbfa8e8c4..e89f47c12 100644
--- a/src/map/HPMmap.c
+++ b/src/map/HPMmap.c
@@ -81,6 +81,8 @@
#include "map/pet.h"
#include "map/quest.h"
#include "map/rodex.h"
+#include "map/refine.h"
+#include "map/refine.p.h"
#include "map/script.h"
#include "map/searchstore.h"
#include "map/skill.h"
diff --git a/src/map/Makefile.in b/src/map/Makefile.in
index edb3fdaad..f851de756 100644
--- a/src/map/Makefile.in
+++ b/src/map/Makefile.in
@@ -44,7 +44,7 @@ MAP_C = achievement.c atcommand.c battle.c battleground.c buyingstore.c channel.
chrif.c clan.c clif.c date.c duel.c elemental.c guild.c homunculus.c HPMmap.c \
instance.c intif.c irc-bot.c itemdb.c log.c mail.c map.c mapreg_sql.c \
mercenary.c mob.c npc.c npc_chat.c party.c path.c pc.c pc_groups.c \
- pet.c quest.c rodex.c script.c searchstore.c skill.c status.c storage.c \
+ pet.c quest.c refine.c rodex.c script.c searchstore.c skill.c status.c storage.c \
stylist.c trade.c unit.c vending.c
MAP_OBJ = $(addprefix obj_sql/, $(patsubst %c,%o,$(MAP_C)))
MAP_H = achievement.h atcommand.h battle.h battleground.h buyingstore.h channel.h chat.h \
@@ -54,9 +54,9 @@ MAP_H = achievement.h atcommand.h battle.h battleground.h buyingstore.h channel.
messages_sak.h messages_zero.h mob.h npc.h packets.h packets_keys_main.h \
packets_keys_zero.h packets_shuffle_main.h packets_shuffle_re.h \
packets_shuffle_zero.h packets_struct.h party.h path.h pc.h pc_groups.h \
- pet.h quest.h rodex.h script.h searchstore.h skill.h status.h storage.h \
+ pet.h quest.h refine.h rodex.h script.h searchstore.h skill.h status.h storage.h \
stylist.h trade.h unit.h vending.h
-MAP_PH =
+MAP_PH = refine.p.h
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 8bca17fa1..09303912b 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -48,6 +48,7 @@
#include "map/pc_groups.h" // groupid2name
#include "map/pet.h"
#include "map/quest.h"
+#include "map/refine.h"
#include "map/script.h"
#include "map/searchstore.h"
#include "map/skill.h"
@@ -1270,20 +1271,20 @@ ACMD(item2)
struct item_data *item_data;
char item_name[100];
int item_id, number = 0, bound = 0;
- int identify = 0, refine = 0, attr = 0;
+ int identify = 0, refine_level = 0, attr = 0;
int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
memset(item_name, '\0', sizeof(item_name));
if (!strcmpi(info->command,"itembound2") && (!*message || (
- sscanf(message, "\"%99[^\"]\" %12d %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, &bound) < 10 &&
- sscanf(message, "%99s %12d %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, &bound) < 10 ))) {
+ sscanf(message, "\"%99[^\"]\" %12d %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine_level, &attr, &c1, &c2, &c3, &c4, &bound) < 10 &&
+ sscanf(message, "%99s %12d %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine_level, &attr, &c1, &c2, &c3, &c4, &bound) < 10 ))) {
clif->message(fd, msg_fd(fd,296)); // Please enter all parameters (usage: @itembound2 <item name/ID> <quantity>
clif->message(fd, msg_fd(fd,297)); // <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4> <bound_type>).
return false;
} else if (!*message
- || ( sscanf(message, "\"%99[^\"]\" %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9
- && sscanf(message, "%99s %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9
+ || ( sscanf(message, "\"%99[^\"]\" %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine_level, &attr, &c1, &c2, &c3, &c4) < 9
+ && sscanf(message, "%99s %12d %12d %12d %12d %12d %12d %12d %12d", item_name, &number, &identify, &refine_level, &attr, &c1, &c2, &c3, &c4) < 9
)) {
clif->message(fd, msg_fd(fd,984)); // Please enter all parameters (usage: @item2 <item name/ID> <quantity>
clif->message(fd, msg_fd(fd,985)); // <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4>).
@@ -1319,20 +1320,20 @@ ACMD(item2)
get_count = 1;
if (item_data->type == IT_PETEGG) {
identify = 1;
- refine = 0;
+ refine_level = 0;
}
if (item_data->type == IT_PETARMOR)
- refine = 0;
+ refine_level = 0;
} else {
identify = 1;
- refine = attr = 0;
+ refine_level = attr = 0;
}
- refine = cap_value(refine, 0, MAX_REFINE);
+ refine_level = cap_value(refine_level, 0, MAX_REFINE);
for (i = 0; i < loop; i++) {
memset(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = item_id;
item_tmp.identify = identify;
- item_tmp.refine = refine;
+ item_tmp.refine = refine_level;
item_tmp.attribute = attr;
item_tmp.bound = (unsigned char)bound;
item_tmp.card[0] = c1;
@@ -2215,12 +2216,12 @@ ACMD(killmonster)
*------------------------------------------*/
ACMD(refine)
{
- int j, position = 0, refine = 0, current_position, final_refine;
+ int j, position = 0, refine_level = 0, current_position, final_refine;
int count;
memset(atcmd_output, '\0', sizeof(atcmd_output));
- if (!*message || sscanf(message, "%12d %12d", &position, &refine) < 2) {
+ if (!*message || sscanf(message, "%12d %12d", &position, &refine_level) < 2) {
clif->message(fd, msg_fd(fd,996)); // Please enter a position and an amount (usage: @refine <equip position> <+/- amount>).
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,997), EQP_HEAD_LOW); // %d: Lower Headgear
clif->message(fd, atcmd_output);
@@ -2245,7 +2246,7 @@ ACMD(refine)
return false;
}
- refine = cap_value(refine, -MAX_REFINE, MAX_REFINE);
+ refine_level = cap_value(refine_level, -MAX_REFINE, MAX_REFINE);
count = 0;
for (j = 0; j < EQI_MAX; j++) {
@@ -2263,7 +2264,7 @@ ACMD(refine)
if(position && !(sd->status.inventory[idx].equip & position))
continue;
- final_refine = cap_value(sd->status.inventory[idx].refine + refine, 0, MAX_REFINE);
+ final_refine = cap_value(sd->status.inventory[idx].refine + refine_level, 0, MAX_REFINE);
if (sd->status.inventory[idx].refine != final_refine) {
sd->status.inventory[idx].refine = final_refine;
current_position = sd->status.inventory[idx].equip;
@@ -9828,6 +9829,22 @@ ACMD(camerainfo)
return true;
}
+ACMD(refineryui)
+{
+#if PACKETVER_MAIN_NUM >= 20161005 || PACKETVER_RE_NUM >= 20161005 || defined(PACKETVER_ZERO)
+ if (battle_config.enable_refinery_ui == 0) {
+ clif->message(fd, msg_fd(fd, 453));
+ return false;
+ }
+
+ clif->OpenRefineryUI(sd);
+ return true;
+#else
+ clif->message(fd, msg_fd(fd, 453));
+ return false;
+#endif
+}
+
/**
* Fills the reference of available commands in atcommand DBMap
**/
@@ -10111,6 +10128,7 @@ static void atcommand_basecommands(void)
ACMD_DEF(reloadclans),
ACMD_DEF(setzone),
ACMD_DEF(camerainfo),
+ ACMD_DEF(refineryui),
};
int i;
diff --git a/src/map/battle.c b/src/map/battle.c
index b06de267d..2f33e2ea9 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -7419,6 +7419,8 @@ static const struct battle_data {
{ "ping_time", &battle_config.ping_time, 20, 0, 99999999, },
{ "option_drop_max_loop", &battle_config.option_drop_max_loop, 10, 1, 100000, },
{ "drop_connection_on_quit", &battle_config.drop_connection_on_quit, 0, 0, 1, },
+ {"features/enable_refinery_ui", &battle_config.enable_refinery_ui, 1, 0, 1, },
+ {"features/replace_refine_npcs", &battle_config.replace_refine_npcs, 1, 0, 1, },
};
static bool battle_set_value_sub(int index, int value)
@@ -7544,6 +7546,18 @@ static void battle_adjust_conf(void)
}
#endif
+#if !(PACKETVER_MAIN_NUM >= 20161130 || PACKETVER_RE_NUM >= 20161109 || defined(PACKETVER_ZERO))
+ if (battle_config.enable_refinery_ui == 1) {
+ ShowWarning("conf/map/battle/feature.conf refinery ui is enabled but it requires PACKETVER 2016-11-09 RagexeRE/2016-11-30 Ragexe or newer, disabling...\n");
+ battle_config.enable_refinery_ui = 0;
+ }
+
+ if (battle_config.replace_refine_npcs == 1) {
+ ShowWarning("conf/map/battle/feature.conf replace refine npcs is enabled but it requires PACKETVER 2016-11-09 RagexeRE/2016-11-30 Ragexe or newer, disabling...\n");
+ battle_config.replace_refine_npcs = 0;
+ }
+#endif
+
#ifndef CELL_NOSTACK
if (battle_config.custom_cell_stack_limit != 1)
ShowWarning("Battle setting 'custom_cell_stack_limit' takes no effect as this server was compiled without Cell Stack Limit support.\n");
diff --git a/src/map/battle.h b/src/map/battle.h
index 8743274ee..1640a4e7f 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -587,6 +587,8 @@ struct Battle_Config {
int option_drop_max_loop;
int drop_connection_on_quit;
+ int enable_refinery_ui;
+ int replace_refine_npcs;
};
/* criteria for battle_config.idletime_critera */
diff --git a/src/map/clif.c b/src/map/clif.c
index 299c69a1c..462991510 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -49,6 +49,7 @@
#include "map/pet.h"
#include "map/quest.h"
#include "map/rodex.h"
+#include "map/refine.h"
#include "map/script.h"
#include "map/skill.h"
#include "map/status.h"
@@ -22492,6 +22493,104 @@ static void clif_parse_ResetCooldown(int fd, struct map_session_data *sd)
atcommand->exec(fd, sd, cmd, true);
}
+static void clif_OpenRefineryUI(struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20161130 || PACKETVER_RE_NUM >= 20161109 || defined(PACKETVER_ZERO)
+ nullpo_retv(sd);
+
+ if (battle_config.enable_refinery_ui == 0)
+ return;
+
+ struct PACKET_ZC_REFINE_OPEN_WINDOW p;
+ p.packetType = HEADER_ZC_REFINE_OPEN_WINDOW;
+ clif->send(&p, sizeof(p), &sd->bl, SELF);
+
+ sd->state.refine_ui = 1;
+#endif
+}
+
+static void clif_parse_AddItemRefineryUI(int fd, struct map_session_data *sd) __attribute__((nonnull(2)));
+static void clif_parse_AddItemRefineryUI(int fd, struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20161005 || PACKETVER_RE_NUM >= 20161005 || defined(PACKETVER_ZERO)
+ if (battle_config.enable_refinery_ui == 0)
+ return;
+
+ const struct PACKET_CZ_REFINE_ADD_ITEM *p = RFIFO2PTR(fd);
+ refine->refinery_add_item(sd, p->index - 2);
+#endif
+}
+
+static void clif_AddItemRefineryUIAck(struct map_session_data *sd, int item_index, struct s_refine_requirement *req)
+{
+#if PACKETVER_MAIN_NUM >= 20161130 || PACKETVER_RE_NUM >= 20161109 || defined(PACKETVER_ZERO)
+ nullpo_retv(sd);
+ nullpo_retv(req);
+ Assert_retv(item_index >= 0 && item_index < sd->status.inventorySize);
+
+ if (battle_config.enable_refinery_ui == 0)
+ return;
+
+ char buf[sizeof(struct PACKET_ZC_REFINE_ADD_ITEM) + sizeof(struct PACKET_ZC_REFINE_ADD_ITEM_SUB) * MAX_REFINE_REQUIREMENTS];
+ struct PACKET_ZC_REFINE_ADD_ITEM *p = (struct PACKET_ZC_REFINE_ADD_ITEM *)buf;
+
+ p->packetType = HEADER_ZC_REFINE_ADD_ITEM;
+ p->packtLength = sizeof(*p) + sizeof(p->req[0]) * req->req_count;
+ p->itemIndex = item_index + 2;
+ p->blacksmithBlessing = req->blacksmith_blessing;
+
+ int weapon_level = itemdb_wlv(sd->status.inventory[item_index].nameid);
+ for (int i = 0; i < req->req_count; ++i) {
+ p->req[i].chance = refine->get_refine_chance(weapon_level, sd->status.inventory[item_index].refine, req->req[i].type);
+ p->req[i].itemId = req->req[i].nameid;
+ p->req[i].zeny = req->req[i].cost;
+ }
+
+ clif->send(p, p->packtLength, &sd->bl, SELF);
+#endif
+}
+
+static void clif_parse_RefineryUIRefine(int fd, struct map_session_data *sd) __attribute__((nonnull(2)));
+static void clif_parse_RefineryUIRefine(int fd, struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20161005 || PACKETVER_RE_NUM >= 20161005 || defined(PACKETVER_ZERO)
+ if (battle_config.enable_refinery_ui == 0)
+ return;
+
+ const struct PACKET_CZ_REFINE_ITEM_REQUEST *p = RFIFO2PTR(fd);
+ refine->refinery_refine_request(sd, p->index - 2, p->itemId, (p->blacksmithBlessing == 1) ? true : false);
+#endif
+}
+
+static void clif_parse_RefineryUIClose(int fd, struct map_session_data *sd) __attribute__((nonnull(2)));
+static void clif_parse_RefineryUIClose(int fd, struct map_session_data *sd)
+{
+#if PACKETVER_MAIN_NUM >= 20161130 || PACKETVER_RE_NUM >= 20161109 || defined(PACKETVER_ZERO)
+ if (battle_config.enable_refinery_ui == 0)
+ return;
+
+ sd->state.refine_ui = 0;
+ return;
+#endif
+}
+
+static void clif_announce_refine_status(struct map_session_data *sd, int item_id, int refine_level, bool success, enum send_target target)
+{
+#if PACKETVER_MAIN_NUM >= 20170906 || PACKETVER_RE_NUM >= 20170830 || defined(PACKETVER_ZERO)
+ nullpo_retv(sd);
+
+ Assert_retv(refine_level > 0 && refine_level <= INT8_MAX);
+
+ struct PACKET_ZC_REFINE_STATUS p;
+ p.packetType = HEADER_ZC_REFINE_STATUS;
+ safestrncpy(p.name, sd->status.name, NAME_LENGTH);
+ p.itemId = item_id;
+ p.refine_level = refine_level;
+ p.status = (success) ? true : false;
+ clif->send(&p, sizeof(p), &sd->bl, target);
+#endif
+}
+
/*==========================================
* Main client packet processing function
*------------------------------------------*/
@@ -23705,4 +23804,10 @@ void clif_defaults(void)
clif->pResetCooldown = clif_parse_ResetCooldown;
clif->loadConfirm = clif_loadConfirm;
clif->send_selforarea = clif_send_selforarea;
+ clif->OpenRefineryUI = clif_OpenRefineryUI;
+ clif->pAddItemRefineryUI = clif_parse_AddItemRefineryUI;
+ clif->AddItemRefineryUIAck = clif_AddItemRefineryUIAck;
+ clif->pRefineryUIClose = clif_parse_RefineryUIClose;
+ clif->pRefineryUIRefine = clif_parse_RefineryUIRefine;
+ clif->announce_refine_status = clif_announce_refine_status;
}
diff --git a/src/map/clif.h b/src/map/clif.h
index aaf053274..19c321ed3 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -55,6 +55,7 @@ struct skill_unit;
struct unit_data;
struct view_data;
struct achievement_data; // map/achievement.h
+struct s_refine_requirement;
enum clif_messages;
enum rodex_add_item;
@@ -1611,6 +1612,12 @@ struct clif_interface {
void (*pResetCooldown) (int fd, struct map_session_data *sd);
void (*loadConfirm) (struct map_session_data *sd);
void (*send_selforarea) (int fd, struct block_list *bl, const void *buf, int len);
+ void (*OpenRefineryUI) (struct map_session_data *sd);
+ void (*pAddItemRefineryUI) (int fd, struct map_session_data *sd);
+ void (*AddItemRefineryUIAck) (struct map_session_data *sd, int item_index, struct s_refine_requirement *req);
+ void (*pRefineryUIClose) (int fd, struct map_session_data *sd);
+ void (*pRefineryUIRefine) (int fd, struct map_session_data *sd);
+ void (*announce_refine_status) (struct map_session_data *sd, int item_id, int refine_level, bool success, enum send_target target);
};
#ifdef HERCULES_CORE
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index a61bbd008..11d778f8a 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -27,6 +27,7 @@
#include "map/map.h"
#include "map/mob.h" // MAX_MOB_DB
#include "map/pc.h" // W_MUSICAL, W_WHIP
+#include "map/refine.h"
#include "map/script.h" // item script processing
#include "common/HPM.h"
#include "common/conf.h"
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 315787993..e032def0c 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -130,6 +130,7 @@ enum item_itemid {
ITEMID_INDIGO_PTS = 6361,
ITEMID_YELLOW_WISH_PTS = 6362,
ITEMID_LIME_GREEN_PTS = 6363,
+ ITEMID_BLACKSMITH_BLESSING = 6635,
ITEMID_STONE = 7049,
ITEMID_FIRE_BOTTLE = 7135,
ITEMID_ACID_BOTTLE = 7136,
diff --git a/src/map/log.c b/src/map/log.c
index efb7fefbc..5bbca02a9 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -106,7 +106,7 @@ static char log_chattype2char(e_log_chat_type type)
}
/// check if this item should be logged according the settings
-static bool should_log_item(int nameid, int amount, int refine, struct item_data *id)
+static bool should_log_item(int nameid, int amount, int refine_level, struct item_data *id)
{
int filter = logs->config.filter;
@@ -123,7 +123,7 @@ static bool should_log_item(int nameid, int amount, int refine, struct item_data
( filter&LOG_FILTER_PETITEM && ( id->type == IT_PETEGG || id->type == IT_PETARMOR ) ) ||
( filter&LOG_FILTER_PRICE && id->value_buy >= logs->config.price_items_log ) ||
( filter&LOG_FILTER_AMOUNT && abs(amount) >= logs->config.amount_items_log ) ||
- ( filter&LOG_FILTER_REFINE && refine >= logs->config.refine_items_log ) ||
+ ( filter&LOG_FILTER_REFINE && refine_level >= logs->config.refine_items_log ) ||
( filter&LOG_FILTER_CHANCE && ( ( id->maxchance != -1 && id->maxchance <= logs->config.rare_items_log ) || id->nameid == ITEMID_EMPERIUM ) )
)
return true;
diff --git a/src/map/log.h b/src/map/log.h
index db802575d..116d99bfd 100644
--- a/src/map/log.h
+++ b/src/map/log.h
@@ -155,7 +155,7 @@ struct log_interface {
char (*picktype2char) (e_log_pick_type type);
char (*chattype2char) (e_log_chat_type type);
- bool (*should_log_item) (int nameid, int amount, int refine, struct item_data *id);
+ bool (*should_log_item) (int nameid, int amount, int refine_level, struct item_data *id);
};
#ifdef HERCULES_CORE
diff --git a/src/map/map.c b/src/map/map.c
index 7d2cc87d4..2b95ec27a 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -58,6 +58,7 @@
#include "map/storage.h"
#include "map/stylist.h"
#include "map/rodex.h"
+#include "map/refine.h"
#include "map/trade.h"
#include "map/unit.h"
#include "map/achievement.h"
@@ -6190,6 +6191,7 @@ int do_final(void)
atcommand->final_msg();
skill->final();
status->final();
+ refine->final();
unit->final();
bg->final();
duel->final();
@@ -6407,6 +6409,7 @@ static void map_load_defaults(void)
npc_chat_defaults();
rodex_defaults();
stylist_defaults();
+ refine_defaults();
}
/**
* --run-once handler
@@ -6711,6 +6714,7 @@ int do_init(int argc, char *argv[])
map->read_zone_db();/* read after item and skill initialization */
mob->init(minimal);
pc->init(minimal);
+ refine->init(minimal);
status->init(minimal);
party->init(minimal);
guild->init(minimal);
diff --git a/src/map/packets.h b/src/map/packets.h
index 99404cbe3..bffec4f43 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -1805,6 +1805,12 @@ packet(0x96e,clif->ackmergeitems);
packet(0x0a88,clif->pResetCooldown);
#endif
+#if PACKETVER_MAIN_NUM >= 20161130 || PACKETVER_RE_NUM >= 20161109 || defined(PACKETVER_ZERO)
+ packet(0x0aa1, clif->pAddItemRefineryUI);
+ packet(0x0aa3, clif->pRefineryUIRefine);
+ packet(0x0aa4, clif->pRefineryUIClose);
+#endif
+
// 2017-02-28aRagexeRE
#if PACKETVER >= 20170228
// new packets
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 45683596f..33b7759ce 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -3319,6 +3319,76 @@ struct PACKET_ZC_SE_PC_BUY_CASHITEM_RESULT {
DEFINE_PACKET_HEADER(ZC_SE_PC_BUY_CASHITEM_RESULT, 0x0849);
#endif
+#if PACKETVER_MAIN_NUM >= 20161130 || PACKETVER_RE_NUM >= 20161109 || defined(PACKETVER_ZERO)
+struct PACKET_ZC_REFINE_OPEN_WINDOW {
+ int16 packetType;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_REFINE_OPEN_WINDOW, 0x0aa0);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20161005 || PACKETVER_RE_NUM >= 20161005 || defined(PACKETVER_ZERO)
+struct PACKET_CZ_REFINE_ADD_ITEM {
+ int16 packetType;
+ int16 index;
+};
+DEFINE_PACKET_HEADER(CZ_REFINE_ADD_ITEM, 0x0aa1);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20161130 || PACKETVER_RE_NUM >= 20161109 || defined(PACKETVER_ZERO)
+struct PACKET_ZC_REFINE_ADD_ITEM_SUB {
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
+ uint32 itemId;
+#else
+ uint16 itemId;
+#endif
+ int8 chance;
+ int32 zeny;
+} __attribute__((packed));
+
+struct PACKET_ZC_REFINE_ADD_ITEM {
+ int16 packetType;
+ int16 packtLength;
+ int16 itemIndex;
+ int8 blacksmithBlessing;
+ struct PACKET_ZC_REFINE_ADD_ITEM_SUB req[];
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_REFINE_ADD_ITEM, 0x0aa2);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20161005 || PACKETVER_RE_NUM >= 20161005 || defined(PACKETVER_ZERO)
+struct PACKET_CZ_REFINE_ITEM_REQUEST {
+ int16 packetType;
+ int16 index;
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
+ uint32 itemId;
+#else
+ uint16 itemId;
+#endif
+ int8 blacksmithBlessing;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_REFINE_ITEM_REQUEST, 0x0aa3);
+
+struct PACKET_CZ_REFINE_WINDOW_CLOSE {
+ int16 packetType;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_REFINE_WINDOW_CLOSE, 0x0aa4);
+#endif
+
+#if PACKETVER_MAIN_NUM >= 20170906 || PACKETVER_RE_NUM >= 20170830 || defined(PACKETVER_ZERO)
+struct PACKET_ZC_REFINE_STATUS {
+ int16 packetType;
+ char name[NAME_LENGTH];
+#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
+ uint32 itemId;
+#else
+ uint16 itemId;
+#endif
+ int8 refine_level;
+ int8 status;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_REFINE_STATUS, 0x0ada);
+#endif
+
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
#endif // not NetBSD < 6 / Solaris
diff --git a/src/map/pc.h b/src/map/pc.h
index b2069d4df..42c9d204e 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -237,6 +237,7 @@ struct map_session_data {
unsigned int standalone : 1;/* [Ind/Hercules <3] */
unsigned int loggingout : 1;
unsigned int warp_clean : 1;
+ unsigned int refine_ui : 1;
} state;
struct {
unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
@@ -660,10 +661,10 @@ END_ZEROED_BLOCK;
#define pc_issit(sd) ( (sd)->vd.dead_sit == 2 )
#define pc_isidle(sd) ( (sd)->chat_id != 0 || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(sockt->last_tick, (sd)->idletime) >= battle->bc->idle_no_share )
#define pc_istrading(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )
-#define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chat_id != 0 || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )
+#define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chat_id != 0 || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend || (sd)->state.refine_ui == 1)
/* equals pc_cant_act except it doesn't check for chat rooms */
-#define pc_cant_act2(sd) ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )
+#define pc_cant_act2(sd) ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend || (sd)->state.refine_ui == 1)
#define pc_setdir(sd,b,h) ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) )
#define pc_setchatid(sd,n) ( (sd)->chat_id = (n) )
diff --git a/src/map/refine.c b/src/map/refine.c
new file mode 100644
index 000000000..1ff893c56
--- /dev/null
+++ b/src/map/refine.c
@@ -0,0 +1,669 @@
+/**
+* This file is part of Hercules.
+* http://herc.ws - http://github.com/HerculesWS/Hercules
+*
+* Copyright (C) 2019 Hercules Dev Team
+*
+* Hercules 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 <http://www.gnu.org/licenses/>.
+*/
+
+#define HERCULES_CORE
+
+#include "refine.p.h"
+#include "common/cbasetypes.h"
+#include "common/nullpo.h"
+#include "common/random.h"
+#include "common/showmsg.h"
+#include "common/strlib.h"
+#include "common/utils.h"
+#include "map/itemdb.h"
+#include "map/map.h"
+#include "map/pc.h"
+#include "map/script.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/** @file
+* Implementation of the refine interface.
+*/
+
+static struct refine_interface refine_s;
+static struct refine_interface_private refine_p;
+static struct refine_interface_dbs refine_dbs;
+struct refine_interface *refine;
+
+/// @copydoc refine_interface::refinery_refine_request()
+static void refine_refinery_refine_request(struct map_session_data *sd, int item_index, int material_id, bool use_blacksmith_blessing)
+{
+ nullpo_retv(sd);
+
+ if (item_index < 0 || item_index >= sd->status.inventorySize)
+ return;
+
+ if (!refine->p->is_refinable(sd, item_index))
+ return;
+
+ int weapon_level = itemdb_wlv(sd->status.inventory[item_index].nameid);
+ int refine_level = sd->status.inventory[item_index].refine;
+ int i = 0;
+ const struct s_refine_requirement *req = &refine->p->dbs->refine_info[weapon_level].refine_requirements[refine_level];
+ ARR_FIND(0, req->req_count, i, req->req[i].nameid == material_id);
+
+ if (i == req->req_count)
+ return;
+
+ if (use_blacksmith_blessing && req->blacksmith_blessing == 0)
+ return;
+
+ if (sd->status.zeny < req->req[i].cost)
+ return;
+
+ if (use_blacksmith_blessing) {
+ int count = 0;
+ for (int k = 0; k < sd->status.inventorySize; ++k) {
+ if (sd->status.inventory[k].nameid == ITEMID_BLACKSMITH_BLESSING)
+ count += sd->status.inventory[k].amount;
+ }
+
+ if (count < req->blacksmith_blessing)
+ return;
+ }
+
+ int idx;
+ if ((idx = pc->search_inventory(sd, req->req[i].nameid)) == INDEX_NOT_FOUND)
+ return;
+
+ if (use_blacksmith_blessing) {
+ int amount = req->blacksmith_blessing;
+ for (int k = 0; k < sd->status.inventorySize; ++k) {
+ if (sd->status.inventory[k].nameid != ITEMID_BLACKSMITH_BLESSING)
+ continue;
+
+ int delamount = (amount < sd->status.inventory[k].amount) ? amount : sd->status.inventory[k].amount;
+ if (pc->delitem(sd, k, delamount, 0, DELITEM_NORMAL, LOG_TYPE_REFINE) != 0)
+ break;
+
+ amount -= delamount;
+ if (amount == 0)
+ break;
+ }
+ }
+
+ if (pc->delitem(sd, idx, 1, 0, DELITEM_NORMAL, LOG_TYPE_REFINE) != 0)
+ return;
+
+ if (pc->payzeny(sd, req->req[i].cost, LOG_TYPE_REFINE, NULL) != 0)
+ return;
+
+ int refine_chance = refine->get_refine_chance(weapon_level, refine_level, req->req[i].type);
+ if (rnd() % 100 >= refine_chance) {
+ clif->misceffect(&sd->bl, 2);
+
+ int failure_behabior = (use_blacksmith_blessing) ? REFINE_FAILURE_BEHAVIOR_KEEP : req->req[i].failure_behavior;
+ switch (failure_behabior) {
+ case REFINE_FAILURE_BEHAVIOR_KEEP:
+ clif->refine(sd->fd, 1, 0, sd->status.inventory[item_index].refine);
+ refine->refinery_add_item(sd, item_index);
+ break;
+ case REFINE_FAILURE_BEHAVIOR_DOWNGRADE:
+ sd->status.inventory[item_index].refine -= 1;
+ sd->status.inventory[item_index].refine = cap_value(sd->status.inventory[item_index].refine, 0, MAX_REFINE);
+ clif->refine(sd->fd, 2, item_index, sd->status.inventory[item_index].refine);
+ logs->pick_pc(sd, LOG_TYPE_REFINE, 1, &sd->status.inventory[item_index], sd->inventory_data[item_index]);
+ refine->refinery_add_item(sd, item_index);
+ break;
+ case REFINE_FAILURE_BEHAVIOR_DESTROY:
+ default:
+ clif->refine(sd->fd, 1, item_index, sd->status.inventory[item_index].refine);
+ pc->delitem(sd, item_index, 1, 0, DELITEM_FAILREFINE, LOG_TYPE_REFINE);
+ break;
+ }
+
+ if ((req->announce & REFINE_ANNOUNCE_FAILURE) != 0)
+ clif->announce_refine_status(sd, sd->status.inventory[item_index].nameid, sd->status.inventory[item_index].refine, false, ALL_CLIENT);
+ } else {
+ sd->status.inventory[item_index].refine += 1;
+ sd->status.inventory[item_index].refine = cap_value(sd->status.inventory[item_index].refine, 0, MAX_REFINE);
+
+ clif->misceffect(&sd->bl, 3);
+ clif->refine(sd->fd, 0, item_index, sd->status.inventory[item_index].refine);
+ logs->pick_pc(sd, LOG_TYPE_REFINE, 1, &sd->status.inventory[item_index], sd->inventory_data[item_index]);
+ refine->refinery_add_item(sd, item_index);
+
+ if ((req->announce & REFINE_ANNOUNCE_SUCCESS) != 0)
+ clif->announce_refine_status(sd, sd->status.inventory[item_index].nameid, sd->status.inventory[item_index].refine, true, ALL_CLIENT);
+ }
+}
+
+/// @copydoc refine_interface::refinery_add_item()
+static void refine_refinery_add_item(struct map_session_data *sd, int item_index)
+{
+ nullpo_retv(sd);
+
+ if (item_index < 0 || item_index >= sd->status.inventorySize)
+ return;
+
+ if (!refine->p->is_refinable(sd, item_index))
+ return;
+
+ int weapon_level = itemdb_wlv(sd->status.inventory[item_index].nameid);
+ int refine_level = sd->status.inventory[item_index].refine;
+ clif->AddItemRefineryUIAck(sd, item_index, &refine->p->dbs->refine_info[weapon_level].refine_requirements[refine_level]);
+}
+
+/// @copydoc refine_interface_private::is_refinable()
+static bool refine_is_refinable(struct map_session_data *sd, int item_index)
+{
+ nullpo_retr(false, sd);
+ Assert_retr(false, item_index >= 0 && item_index < sd->status.inventorySize);
+
+ if (sd->status.inventory[item_index].nameid == 0)
+ return false;
+
+ struct item_data *itd = itemdb->search(sd->status.inventory[item_index].nameid);
+
+ if (itd == &itemdb->dummy)
+ return false;
+
+ if (itd->type != IT_WEAPON && itd->type != IT_ARMOR)
+ return false;
+
+ if (itd->flag.no_refine == 1)
+ return false;
+
+ if (sd->status.inventory[item_index].identify == 0)
+ return false;
+
+ if (sd->status.inventory[item_index].refine >= MAX_REFINE || sd->status.inventory[item_index].expire_time > 0)
+ return false;
+
+ if ((sd->status.inventory[item_index].attribute & ATTR_BROKEN) != 0)
+ return false;
+
+ return true;
+}
+
+/// @copydoc refine_interface::get_randombonus_max()
+static int refine_get_randombonus_max(enum refine_type equipment_type, int refine_level)
+{
+ Assert_ret((int)equipment_type >= REFINE_TYPE_ARMOR && equipment_type < REFINE_TYPE_MAX);
+ Assert_ret(refine_level > 0 && refine_level <= MAX_REFINE);
+
+ return refine->p->dbs->refine_info[equipment_type].randombonus_max[refine_level - 1];
+}
+
+/// @copydoc refine_interface::get_bonus()
+static int refine_get_bonus(enum refine_type equipment_type, int refine_level)
+{
+ Assert_ret((int)equipment_type >= REFINE_TYPE_ARMOR && equipment_type < REFINE_TYPE_MAX);
+ Assert_ret(refine_level > 0 && refine_level <= MAX_REFINE);
+
+ return refine->p->dbs->refine_info[equipment_type].bonus[refine_level - 1];
+}
+
+/// @copydoc refine_interface::get_refine_chance()
+static int refine_get_refine_chance(enum refine_type wlv, int refine_level, enum refine_chance_type type)
+{
+ Assert_ret((int)wlv >= REFINE_TYPE_ARMOR && wlv < REFINE_TYPE_MAX);
+
+ if (refine_level < 0 || refine_level >= MAX_REFINE)
+ return 0;
+
+ if (type >= REFINE_CHANCE_TYPE_MAX)
+ return 0;
+
+ return refine->p->dbs->refine_info[wlv].chance[type][refine_level];
+}
+
+/// @copydoc refine_interface_private::announce_behavior_string2enum()
+static bool refine_announce_behavior_string2enum(const char *str, unsigned int *result)
+{
+ nullpo_retr(false, str);
+ nullpo_retr(false, result);
+
+ if (strcasecmp(str, "Success") == 0)
+ *result = REFINE_ANNOUNCE_SUCCESS;
+ else if (strcasecmp(str, "Failure") == 0)
+ *result = REFINE_ANNOUNCE_FAILURE;
+ else if (strcasecmp(str, "Always") == 0)
+ *result = REFINE_ANNOUNCE_ALWAYS;
+ else
+ return false;
+
+ return true;
+}
+
+/// @copydoc refine_interface_private::failure_behavior_string2enum()
+static bool refine_failure_behavior_string2enum(const char *str, enum refine_ui_failure_behavior *result)
+{
+ nullpo_retr(false, str);
+ nullpo_retr(false, result);
+
+ if (strcasecmp(str, "Destroy") == 0)
+ *result = REFINE_FAILURE_BEHAVIOR_DESTROY;
+ else if (strcasecmp(str, "Keep") == 0)
+ *result = REFINE_FAILURE_BEHAVIOR_KEEP;
+ else if (strcasecmp(str, "Downgrade") == 0)
+ *result = REFINE_FAILURE_BEHAVIOR_DOWNGRADE;
+ else
+ return false;
+
+ return true;
+}
+
+/// @copydoc refine_interface_private::readdb_refinery_ui_settings_items()
+static bool refine_readdb_refinery_ui_settings_items(const struct config_setting_t *elem, struct s_refine_requirement *req, const char *name, const char *source)
+{
+ nullpo_retr(false, elem);
+ nullpo_retr(false, req);
+ nullpo_retr(false, name);
+ nullpo_retr(false, source);
+ Assert_retr(false, req->req_count < MAX_REFINE_REQUIREMENTS);
+
+ const char *aegis_name = config_setting_name(elem);
+ struct item_data *itd;
+
+ if ((itd = itemdb->search_name(aegis_name)) == NULL) {
+ ShowWarning("refine_readdb_requirements_items: Invalid item '%s' passed to requirements of '%s' in \"%s\" skipping...\n", aegis_name, name, source);
+ return false;
+ }
+
+ for (int i = 0; i < req->req_count; ++i) {
+ if (req->req[i].nameid == itd->nameid) {
+ ShowWarning("refine_readdb_requirements_items: Duplicated item '%s' passed to requirements of '%s' in \"%s\" skipping...\n", aegis_name, name, source);
+ return false;
+ }
+ }
+
+ const char *type_string = NULL;
+ if (libconfig->setting_lookup_string(elem, "Type", &type_string) == CONFIG_FALSE) {
+ ShowWarning("refine_readdb_requirements_items: no type passed to item '%s' of requirements of '%s' in \"%s\" skipping...\n", aegis_name, name, source);
+ return false;
+ }
+
+ int type;
+ if (!script->get_constant(type_string, &type)) {
+ ShowWarning("refine_readdb_requirements_items: invalid type '%s' passed to item '%s' of requirements of '%s' in \"%s\" skipping...\n", type_string, aegis_name, name, source);
+ return false;
+ }
+
+ int cost = 0;
+ if (libconfig->setting_lookup_int(elem, "Cost", &cost) == CONFIG_TRUE) {
+ if (cost < 1) {
+ ShowWarning("refine_readdb_requirements_items: invalid cost value %d passed to item '%s' of requirements of '%s' in \"%s\" defaulting to 0...\n", cost, aegis_name, name, source);
+ cost = 0;
+ }
+ }
+
+ enum refine_ui_failure_behavior behavior = REFINE_FAILURE_BEHAVIOR_DESTROY;
+ const char *behavior_string = NULL;
+ if (libconfig->setting_lookup_string(elem, "FailureBehavior", &behavior_string) != CONFIG_FALSE) {
+ if (!refine->p->failure_behavior_string2enum(behavior_string, &behavior)) {
+ ShowWarning("refine_readdb_requirements_items: invalid failure behavior value %s passed to item '%s' of requirements of '%s' in \"%s\" defaulting to 'Destroy'...\n", behavior_string, aegis_name, name, source);
+ }
+ }
+
+ req->req[req->req_count].nameid = itd->nameid;
+ req->req[req->req_count].type = type;
+ req->req[req->req_count].cost = cost;
+ req->req[req->req_count].failure_behavior = behavior;
+ req->req_count++;
+
+ return true;
+}
+
+/// @copydoc refine_interface_private::readdb_refinery_ui_settings_sub()
+static bool refine_readdb_refinery_ui_settings_sub(const struct config_setting_t *elem, int type, const char *name, const char *source)
+{
+ nullpo_retr(false, elem);
+ nullpo_retr(false, name);
+ nullpo_retr(false, source);
+ Assert_retr(0, type >= REFINE_TYPE_ARMOR && type < REFINE_TYPE_MAX);
+
+ struct config_setting_t *level_t;
+ bool levels[MAX_REFINE] = {0};
+
+ if ((level_t = libconfig->setting_get_member(elem, "Level")) == NULL) {
+ ShowWarning("refine_readdb_requirements_sub: a requirements element missing level field for entry '%s' in \"%s\" skipping...\n", name, source);
+ return false;
+ }
+
+ if (config_setting_is_scalar(level_t)) {
+ if (!config_setting_is_number(level_t)) {
+ ShowWarning("refine_readdb_requirements_sub: expected 'Level' field to be an integer '%s' in \"%s\" skipping...\n", name, source);
+ return false;
+ }
+
+ int refine_level = libconfig->setting_get_int(level_t);
+ if (refine_level < 1 || refine_level > MAX_REFINE) {
+ ShowWarning("refine_readdb_requirements_sub: Invalid 'Level' given value %d expected a value between %d and %d '%s' in \"%s\" skipping...\n", refine_level, 1, MAX_REFINE, name, source);
+ return false;
+ }
+
+ levels[refine_level - 1] = true;
+ } else if (config_setting_is_aggregate(level_t)) {
+ if (libconfig->setting_length(level_t) != 2) {
+ ShowWarning("refine_readdb_requirements_sub: invalid length for Level array, expected 2 found %d for entry '%s' in \"%s\" skipping...\n", libconfig->setting_length(level_t), name, source);
+ return false;
+ }
+
+ int levels_range[2];
+ const struct config_setting_t *level_entry = NULL;
+ int i = 0,
+ k = 0;
+ while ((level_entry = libconfig->setting_get_elem(level_t, i++)) != NULL) {
+ if (!config_setting_is_number(level_entry)) {
+ ShowWarning("refine_readdb_requirements_sub: expected 'Level' array field to be an integer '%s' in \"%s\" skipping...\n", name, source);
+ return false;
+ }
+
+ levels_range[k] = libconfig->setting_get_int(level_entry);
+ if (levels_range[k] < 1 || levels_range[k] > MAX_REFINE) {
+ ShowWarning("refine_readdb_requirements_sub: Invalid 'Level' given value %d expected a value between %d and %d in entry'%s' in \"%s\" skipping...\n", levels_range[k], 1, MAX_REFINE, name, source);
+ return false;
+ }
+
+ ++k;
+ }
+
+ if (!(levels_range[0] < levels_range[1])) {
+ ShowWarning("refine_readdb_requirements_sub: Invalid 'Level' range was given low %d high %d in entry'%s' in \"%s\" skipping...\n", levels_range[0], levels_range[1], name, source);
+ return false;
+ }
+
+ for (i = levels_range[0] - 1; i < levels_range[1]; ++i) {
+ levels[i] = true;
+ }
+ }
+
+ struct s_refine_requirement req = {0};
+ if (libconfig->setting_lookup_int(elem, "BlacksmithBlessing", &req.blacksmith_blessing) == CONFIG_TRUE) {
+ if (req.blacksmith_blessing < 1 || req.blacksmith_blessing > INT8_MAX) {
+ ShowWarning("refine_readdb_requirements_sub: Invalid 'BlacksmithBlessing' amount was given value %d expected a value between %d and %d in entry'%s' in \"%s\" defaulting to 0...\n", req.blacksmith_blessing, 1, INT8_MAX, name, source);
+ req.blacksmith_blessing = 0;
+ }
+ }
+
+ req.announce = 0;
+ const char *announce_behavior = NULL;
+ if (libconfig->setting_lookup_string(elem, "Announce", &announce_behavior) != CONFIG_FALSE) {
+ if (!refine->p->announce_behavior_string2enum(announce_behavior, &req.announce)) {
+ ShowWarning("refine_readdb_requirements_sub: invalid announce behavior value '%s' in entry '%s' in \"%s\" defaulting to not announce...\n", announce_behavior, name, source);
+ }
+ }
+
+ struct config_setting_t *items_t;
+ if ((items_t = libconfig->setting_get_member(elem, "Items")) == NULL) {
+ ShowWarning("refine_readdb_requirements_sub: a requirements element missing Items element for entry '%s' in \"%s\" skipping...\n", name, source);
+ return false;
+ }
+
+ if (libconfig->setting_length(items_t) < 1) {
+ ShowWarning("refine_readdb_requirements_sub: an Items element containing no items passed for entry '%s' in \"%s\" skipping...\n", name, source);
+ return false;
+ }
+
+ int loaded_items = 0;
+ for (int i = 0; i < libconfig->setting_length(items_t); ++i) {
+ if (req.req_count >= MAX_REFINE_REQUIREMENTS) {
+ ShowWarning("refine_readdb_requirements_sub: Too many items passed to requirements maximum possible items is %d entry '%s' in \"%s\" skipping...\n", MAX_REFINE_REQUIREMENTS, name, source);
+ continue;
+ }
+
+ struct config_setting_t *item_t = libconfig->setting_get_elem(items_t, i);
+
+ if (!refine->p->readdb_refinery_ui_settings_items(item_t, &req, name, source))
+ continue;
+
+ loaded_items++;
+ }
+
+ if (loaded_items == 0) {
+ ShowWarning("refine_readdb_requirements_sub: no valid items for requirements is passed for entry '%s' in \"%s\" skipping...\n", name, source);
+ return false;
+ }
+
+ for (int i = 0; i < MAX_REFINE; ++i) {
+ if (!levels[i])
+ continue;
+
+ refine->p->dbs->refine_info[type].refine_requirements[i] = req;
+ }
+
+ return true;
+}
+
+/// @copydoc refine_interface_private::readdb_refinery_ui_settings()
+static int refine_readdb_refinery_ui_settings(const struct config_setting_t *r, int type, const char *name, const char *source)
+{
+ nullpo_retr(0, r);
+ nullpo_retr(0, name);
+ nullpo_retr(0, source);
+ Assert_retr(0, type >= REFINE_TYPE_ARMOR && type < REFINE_TYPE_MAX);
+
+ int i = 0;
+ const struct config_setting_t *elem = NULL;
+ while ((elem = libconfig->setting_get_elem(r, i++)) != NULL) {
+ refine->p->readdb_refinery_ui_settings_sub(elem, type, name, source);
+ }
+
+ int retval = 0;
+ for (i = 0; i < MAX_REFINE; ++i) {
+ if (refine->p->dbs->refine_info[type].refine_requirements[i].req_count > 0)
+ retval++;
+ }
+
+ return retval;
+}
+
+/// @copydoc refine_interface_private::readdb_refine_libconfig_sub()
+static int refine_readdb_refine_libconfig_sub(struct config_setting_t *r, const char *name, const char *source)
+{
+ struct config_setting_t *rate = NULL;
+ int type = REFINE_TYPE_ARMOR, bonus_per_level = 0, rnd_bonus_v = 0, rnd_bonus_lv = 0;
+ char lv[4];
+ nullpo_ret(r);
+ nullpo_ret(name);
+ nullpo_ret(source);
+
+ if (strncmp(name, "Armors", 6) == 0) {
+ type = REFINE_TYPE_ARMOR;
+ } else if (strncmp(name, "WeaponLevel", 11) != 0 || !strspn(&name[strlen(name)-1], "0123456789") || (type = atoi(strncpy(lv, name+11, 2))) == REFINE_TYPE_ARMOR) {
+ ShowError("status_readdb_refine_libconfig_sub: Invalid key name for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ }
+ if (type < REFINE_TYPE_ARMOR || type >= REFINE_TYPE_MAX) {
+ ShowError("status_readdb_refine_libconfig_sub: Out of range level for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ }
+
+ struct config_setting_t *refinery_ui_settings;
+ if ((refinery_ui_settings = libconfig->setting_get_member(r, "RefineryUISettings")) == NULL) {
+ ShowWarning("status_readdb_refine_libconfig_sub: Missing Requirements for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ }
+
+ if (refine->p->readdb_refinery_ui_settings(refinery_ui_settings, type, name, source) != MAX_REFINE) {
+ ShowWarning("status_readdb_refine_libconfig_sub: Not all refine levels have requrements entry for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ }
+
+ if (!libconfig->setting_lookup_int(r, "StatsPerLevel", &bonus_per_level)) {
+ ShowWarning("status_readdb_refine_libconfig_sub: Missing StatsPerLevel for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ }
+ if (!libconfig->setting_lookup_int(r, "RandomBonusStartLevel", &rnd_bonus_lv)) {
+ ShowWarning("status_readdb_refine_libconfig_sub: Missing RandomBonusStartLevel for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ }
+ if (!libconfig->setting_lookup_int(r, "RandomBonusValue", &rnd_bonus_v)) {
+ ShowWarning("status_readdb_refine_libconfig_sub: Missing RandomBonusValue for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ }
+
+ if ((rate=libconfig->setting_get_member(r, "Rates")) != NULL && config_setting_is_group(rate)) {
+ bool duplicate[MAX_REFINE];
+ int bonus[MAX_REFINE], rnd_bonus[MAX_REFINE];
+ int chance[REFINE_CHANCE_TYPE_MAX][MAX_REFINE];
+
+ memset(&duplicate, 0, sizeof(duplicate));
+ memset(&bonus, 0, sizeof(bonus));
+ memset(&rnd_bonus, 0, sizeof(rnd_bonus));
+
+ for (int i = 0; i < REFINE_CHANCE_TYPE_MAX; i++)
+ for (int j = 0; j < MAX_REFINE; j++)
+ chance[i][j] = 100; // default value for all rates.
+
+ struct config_setting_t *t = NULL;
+ for (int i = 0; (t = libconfig->setting_get_elem(rate, i++)) != NULL && config_setting_is_group(t); ++i) {
+ 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) {
+ 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, "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[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 (int i = 0; i < MAX_REFINE; i++) {
+ refine->p->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_NORMAL][i] = chance[REFINE_CHANCE_TYPE_NORMAL][i];
+ refine->p->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_E_NORMAL][i] = chance[REFINE_CHANCE_TYPE_E_NORMAL][i];
+ refine->p->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_ENRICHED][i] = chance[REFINE_CHANCE_TYPE_ENRICHED][i];
+ refine->p->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_E_ENRICHED][i] = chance[REFINE_CHANCE_TYPE_E_ENRICHED][i];
+ refine->p->dbs->refine_info[type].randombonus_max[i] = rnd_bonus[i];
+ bonus[i] += bonus_per_level + (i > 0 ? bonus[i - 1] : 0);
+ refine->p->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;
+}
+
+/// @copydoc refine_interface_private::readdb_refine_libconfig()
+static int refine_readdb_refine_libconfig(const char *filename)
+{
+ nullpo_retr(0, filename);
+
+ bool duplicate[REFINE_TYPE_MAX];
+ struct config_t refine_db_conf;
+ struct config_setting_t *r;
+ char filepath[256];
+ int i = 0, count = 0;
+
+ safesnprintf(filepath, sizeof(filepath), "%s/%s", map->db_path, filename);
+ if (!libconfig->load_file(&refine_db_conf, filepath))
+ return 0;
+
+ memset(&duplicate, 0, sizeof(duplicate));
+
+ while((r = libconfig->setting_get_elem(refine_db_conf.root, i++))) {
+ char *name = config_setting_name(r);
+ int type = refine->p->readdb_refine_libconfig_sub(r, name, filename);
+ if (type != 0) {
+ if (duplicate[type - 1]) {
+ ShowWarning("status_readdb_refine_libconfig: duplicate entry for %s in \"%s\", overwriting previous entry...\n", name, filename);
+ } else {
+ duplicate[type - 1] = true;
+ }
+ count++;
+ }
+ }
+ libconfig->destroy(&refine_db_conf);
+ ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filename);
+
+ return count;
+}
+
+/// @copydoc refine_interface::init()
+static int refine_init(bool minimal)
+{
+ if (minimal)
+ return 0;
+
+ refine->p->readdb_refine_libconfig(DBPATH"refine_db.conf");
+ return 0;
+}
+
+/// @copydoc refine_interface::final()
+static void refine_final(void)
+{
+}
+
+void refine_defaults(void)
+{
+ refine = &refine_s;
+ refine->p = &refine_p;
+ refine->p->dbs = &refine_dbs;
+
+ refine->p->readdb_refine_libconfig = refine_readdb_refine_libconfig;
+ refine->p->readdb_refine_libconfig_sub = refine_readdb_refine_libconfig_sub;
+ refine->p->announce_behavior_string2enum = refine_announce_behavior_string2enum;
+ refine->p->failure_behavior_string2enum = refine_failure_behavior_string2enum;
+ refine->p->readdb_refinery_ui_settings_items = refine_readdb_refinery_ui_settings_items;
+ refine->p->readdb_refinery_ui_settings_sub = refine_readdb_refinery_ui_settings_sub;
+ refine->p->readdb_refinery_ui_settings = refine_readdb_refinery_ui_settings;
+ refine->p->is_refinable = refine_is_refinable;
+
+ refine->init = refine_init;
+ refine->final = refine_final;
+ refine->refinery_refine_request = refine_refinery_refine_request;
+ refine->refinery_add_item = refine_refinery_add_item;
+ refine->get_refine_chance = refine_get_refine_chance;
+ refine->get_bonus = refine_get_bonus;
+ refine->get_randombonus_max = refine_get_randombonus_max;
+}
diff --git a/src/map/refine.h b/src/map/refine.h
new file mode 100644
index 000000000..410811e06
--- /dev/null
+++ b/src/map/refine.h
@@ -0,0 +1,148 @@
+/**
+* This file is part of Hercules.
+* http://herc.ws - http://github.com/HerculesWS/Hercules
+*
+* Copyright (C) 2019 Hercules Dev Team
+*
+* Hercules 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef MAP_REFINE_H
+#define MAP_REFINE_H
+
+/** @file
+ * Refine Interface.
+ **/
+#include "common/hercules.h"
+#include "common/mmo.h"
+
+/* Defines */
+/**
+* Max Refine available to your server
+* Changing this limit requires edits to refine_db.conf
+**/
+#ifdef RENEWAL
+ #define MAX_REFINE 20
+#else
+ #define MAX_REFINE 10
+#endif
+
+/* Forward Declarations */
+struct refine_interface_private;
+
+/* Enums */
+enum refine_type {
+ REFINE_TYPE_ARMOR = 0,
+ REFINE_TYPE_WEAPON1 = 1,
+ REFINE_TYPE_WEAPON2 = 2,
+ REFINE_TYPE_WEAPON3 = 3,
+ REFINE_TYPE_WEAPON4 = 4,
+#ifndef REFINE_TYPE_MAX
+ REFINE_TYPE_MAX = 5
+#endif
+};
+
+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
+};
+
+enum refine_ui_failure_behavior {
+ REFINE_FAILURE_BEHAVIOR_DESTROY,
+ REFINE_FAILURE_BEHAVIOR_KEEP,
+ REFINE_FAILURE_BEHAVIOR_DOWNGRADE
+};
+
+/* Structure */
+struct s_refine_requirement {
+ int blacksmith_blessing;
+ int req_count;
+ unsigned int announce;
+
+ struct {
+ int nameid;
+ int cost;
+ enum refine_chance_type type;
+ enum refine_ui_failure_behavior failure_behavior;
+ } req[MAX_REFINE_REQUIREMENTS];
+};
+
+/**
+ * Refine Interface
+ **/
+struct refine_interface {
+ struct refine_interface_private *p;
+
+ /**
+ * Initialize refine system
+ * @param minimal sets refine system to minimal mode in which it won't load or initialize itself
+ * @return returns 0 in-case of success 1 otherwise
+ **/
+ int (*init)(bool minimal);
+
+ /**
+ * Finalize refine system
+ **/
+ void (*final)(void);
+
+ /**
+ * Get the chance to upgrade a piece of equipment.
+ * @param wlv The weapon type of the item to refine (see see enum refine_type)
+ * @param refine The target refine level
+ * @return The chance to refine the item, in percent (0~100)
+ **/
+ int (*get_refine_chance) (enum refine_type wlv, int refine_level, enum refine_chance_type type);
+
+ /**
+ * Gets the attack/deffense bonus for the given equipment type and refine level
+ * @param equipment_type the equipment type
+ * @param refine_level the equipment refine level
+ * @return returns the bonus from refine db
+ **/
+ int (*get_bonus) (enum refine_type equipment_type, int refine_level);
+
+ /**
+ * Gets the maximum attack/deffense random bonus for the given equipment type and refine level
+ * @param equipment_type the equipment type
+ * @param refine_level the equipment refine level
+ * @return returns the bonus from refine db
+ **/
+ int(*get_randombonus_max) (enum refine_type equipment_type, int refine_level);
+
+ /**
+ * Validates and send Item addition packet to the client for refinery UI
+ * @param sd player session data.
+ * @param item_index the requested item index in inventory.
+ **/
+ void (*refinery_add_item) (struct map_session_data *sd, int item_index);
+
+ /**
+ * Processes an refine request through Refinery UI
+ * @param sd player session data
+ * @param item_index the index of the requested item
+ * @param material_id the refine material chosen by player
+ * @param use_blacksmith_blessing sets either if blacksmith blessing is requested to be used or not
+ **/
+ void (*refinery_refine_request) (struct map_session_data *sd, int item_index, int material_id, bool use_blacksmith_blessing);
+};
+
+#ifdef HERCULES_CORE
+void refine_defaults(void);
+#endif
+
+HPShared struct refine_interface *refine;
+#endif
diff --git a/src/map/refine.p.h b/src/map/refine.p.h
new file mode 100644
index 000000000..3247d15c9
--- /dev/null
+++ b/src/map/refine.p.h
@@ -0,0 +1,144 @@
+/**
+* This file is part of Hercules.
+* http://herc.ws - http://github.com/HerculesWS/Hercules
+*
+* Copyright (C) 2019 Hercules Dev Team
+*
+* Hercules 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef MAP_REFINE_P_H
+#define MAP_REFINE_P_H
+
+/** @file
+ * Private header for the refine interface.
+ **/
+
+#include "refine.h"
+#include "common/conf.h"
+/* Enums */
+enum refine_announce_condition {
+ REFINE_ANNOUNCE_SUCCESS = 0x1,
+ REFINE_ANNOUNCE_FAILURE = 0x2,
+ REFINE_ANNOUNCE_ALWAYS = REFINE_ANNOUNCE_SUCCESS | REFINE_ANNOUNCE_FAILURE,
+};
+
+/* Structures */
+struct s_refine_info {
+ 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
+ struct s_refine_requirement refine_requirements[MAX_REFINE]; //< The requirements used for refinery UI
+};
+
+struct refine_interface_dbs {
+ struct s_refine_info refine_info[REFINE_TYPE_MAX];
+};
+
+/**
+ * Refine Private Interface
+ **/
+struct refine_interface_private {
+ struct refine_interface_dbs *dbs;
+
+ /**
+ * Processes a refine_db.conf entry.
+ *
+ * @param r Libconfig setting entry. It is expected to be valid and it
+ * won't be freed (it is care of the caller to do so if
+ * necessary)
+ * @param n Ordinal number of the entry, to be displayed in case of
+ * validation errors.
+ * @param source Source of the entry (file name), to be displayed in case of
+ * validation errors.
+ * @return # of the validated entry, or 0 in case of failure.
+ **/
+ int (*readdb_refine_libconfig_sub) (struct config_setting_t *r, const char *name, const char *source);
+
+ /**
+ * Reads from a libconfig-formatted refine_db.conf file.
+ *
+ * @param *filename File name, relative to the database path.
+ * @return The number of found entries.
+ **/
+ int (*readdb_refine_libconfig) (const char *filename);
+
+ /**
+ * Converts refine database announce behvaior string to enum refine_announce_condition
+ * @param str the string to convert
+ * @param result pointer to where the converted value will be held
+ * @return true on success, false otherwise.
+ **/
+ bool (*announce_behavior_string2enum) (const char *str, unsigned int *result);
+
+ /**
+ * Converts refine database failure behvaior string to enum refine_ui_failure_behavior
+ * @param str the string to convert
+ * @param result pointer to where the converted value will be held
+ * @return true on success, false otherwise.
+ **/
+ bool (*failure_behavior_string2enum) (const char *str, enum refine_ui_failure_behavior *result);
+
+ /**
+ * Processes a refine_db.conf RefineryUISettings items entry.
+ *
+ * @param elem Libconfig setting entry. It is expected to be valid and it
+ * won't be freed (it is care of the caller to do so if
+ * necessary)
+ * @param req a pointer to requirements struct to fill with the item data
+ * @param name the current element name
+ * @param source Source of the entry (file name), to be displayed in case of
+ * validation errors.
+ * @return true on success, false otherwise.
+ **/
+ bool (*readdb_refinery_ui_settings_items) (const struct config_setting_t *elem, struct s_refine_requirement *req, const char *name, const char *source);
+
+ /**
+ * Processes a refine_db.conf RefineryUISettings entry.
+ *
+ * @param elem Libconfig setting entry. It is expected to be valid and it
+ * won't be freed (it is care of the caller to do so if
+ * necessary)
+ * @param type the type index in refine database to fill the data
+ * @param name the current element name
+ * @param source Source of the entry (file name), to be displayed in case of
+ * validation errors.
+ * @return true on success, false otherwise.
+ **/
+ bool (*readdb_refinery_ui_settings_sub) (const struct config_setting_t *elem, int type, const char *name, const char *source);
+
+ /**
+ * Reads a refine_db.conf RefineryUISettings entry and sends it to be processed.
+ *
+ * @param r Libconfig setting entry. It is expected to be valid and it
+ * won't be freed (it is care of the caller to do so if
+ * necessary)
+ * @param type the type index in refine database to fill the data
+ * @param name the current element name
+ * @param source Source of the entry (file name), to be displayed in case of
+ * validation errors.
+ * @return true on success, false otherwise.
+ **/
+ int (*readdb_refinery_ui_settings) (const struct config_setting_t *r, int type, const char *name, const char *source);
+
+ /**
+ * Checks if a given item in player's inventory is refineable.
+ * @param sd player session data.
+ * @param item_index the item index in player's inventory.
+ * @return true if item is refineable, false otherwise.
+ **/
+ bool (*is_refinable) (struct map_session_data *sd, int item_index);
+};
+
+#endif
diff --git a/src/map/script.c b/src/map/script.c
index 4fb24708b..5843ac292 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -52,6 +52,7 @@
#include "map/pet.h"
#include "map/pet.h"
#include "map/quest.h"
+#include "map/refine.h"
#include "map/skill.h"
#include "map/status.h"
#include "map/status.h"
@@ -9505,7 +9506,7 @@ static BUILDIN(getequippercentrefinery)
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));
+ refine->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);
@@ -25285,6 +25286,25 @@ static BUILDIN(closeroulette)
return true;
}
+static BUILDIN(openrefineryui)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+
+ if (sd == NULL) {
+ script_pushint(st, 0);
+ return true;
+ }
+
+ if (battle_config.enable_refinery_ui == 0) {
+ script_pushint(st, 0);
+ return true;
+ }
+
+ clif->OpenRefineryUI(sd);
+ script_pushint(st, 1);
+ return true;
+}
+
/**
* Adds a built-in script function.
*
@@ -26038,6 +26058,7 @@ static void script_parse_builtin(void)
BUILDIN_DEF(getInventorySize, ""),
BUILDIN_DEF(closeroulette, ""),
+ BUILDIN_DEF(openrefineryui, ""),
};
int i, len = ARRAYLENGTH(BUILDIN);
RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up
diff --git a/src/map/searchstore.c b/src/map/searchstore.c
index 0c6fa3555..c991e38c4 100644
--- a/src/map/searchstore.c
+++ b/src/map/searchstore.c
@@ -345,7 +345,7 @@ static void searchstore_clearremote(struct map_session_data *sd)
}
/// receives results from a store-specific callback
-static bool searchstore_result(struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine, const struct item_option *option)
+static bool searchstore_result(struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine_level, const struct item_option *option)
{
struct s_search_store_info_item* ssitem;
@@ -364,7 +364,7 @@ static bool searchstore_result(struct map_session_data *sd, unsigned int store_i
ssitem->amount = amount;
ssitem->price = price;
memcpy(ssitem->card, card, sizeof(ssitem->card));
- ssitem->refine = refine;
+ ssitem->refine = refine_level;
memcpy(ssitem->option, option, sizeof(ssitem->option));
return true;
diff --git a/src/map/searchstore.h b/src/map/searchstore.h
index e5ccfd300..71d562679 100644
--- a/src/map/searchstore.h
+++ b/src/map/searchstore.h
@@ -109,7 +109,7 @@ struct searchstore_interface {
void (*click) (struct map_session_data* sd, int account_id, int store_id, int nameid);
bool (*queryremote) (struct map_session_data* sd, int account_id);
void (*clearremote) (struct map_session_data* sd);
- bool (*result) (struct map_session_data* sd, unsigned int store_id, int account_id, const char* store_name, int nameid, unsigned short amount, unsigned int price, const int* card, unsigned char refine, const struct item_option *option);
+ bool (*result) (struct map_session_data* sd, unsigned int store_id, int account_id, const char* store_name, int nameid, unsigned short amount, unsigned int price, const int* card, unsigned char refine_level, const struct item_option *option);
};
#ifdef HERCULES_CORE
diff --git a/src/map/skill.c b/src/map/skill.c
index 633a73d67..2b2c2b6f1 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -44,6 +44,7 @@
#include "map/path.h"
#include "map/pc.h"
#include "map/pet.h"
+#include "map/refine.h"
#include "map/script.h"
#include "map/status.h"
#include "map/unit.h"
@@ -16204,7 +16205,7 @@ static void skill_weaponrefine(struct map_session_data *sd, int idx)
return;
}
- per = status->get_refine_chance(ditem->wlv, (int)item->refine, REFINE_CHANCE_TYPE_NORMAL) * 10;
+ per = refine->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 f06bb0330..5300f65c4 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -38,6 +38,7 @@
#include "map/path.h"
#include "map/pc.h"
#include "map/pet.h"
+#include "map/refine.h"
#include "map/script.h"
#include "map/skill.h"
#include "map/skill.h"
@@ -2577,18 +2578,18 @@ static int status_calc_pc_(struct map_session_data *sd, enum e_status_calc_opt o
r = 0;
if (r)
- wa->atk2 = status->dbs->refine_info[wlv].bonus[r-1] / 100;
+ wa->atk2 = refine->get_bonus(wlv, r) / 100;
#ifdef RENEWAL
wa->matk += sd->inventory_data[index]->matk;
wa->wlv = wlv;
if( r && sd->weapontype1 != W_BOW ) // renewal magic attack refine bonus
- wa->matk += status->dbs->refine_info[wlv].bonus[r-1] / 100;
+ wa->matk += refine->get_bonus(wlv, r) / 100;
#endif
//Overrefined bonus.
if (r)
- wd->overrefine = status->dbs->refine_info[wlv].randombonus_max[r-1] / 100;
+ wd->overrefine = refine->get_randombonus_max(wlv, r) / 100;
wa->range += sd->inventory_data[index]->range;
if(sd->inventory_data[index]->script) {
@@ -2623,7 +2624,7 @@ static int status_calc_pc_(struct map_session_data *sd, enum e_status_calc_opt o
r = 0;
if (r)
- refinedef += status->dbs->refine_info[REFINE_TYPE_ARMOR].bonus[r-1];
+ refinedef += refine->get_bonus(REFINE_TYPE_ARMOR, r);
if(sd->inventory_data[index]->script) {
if( i == EQI_HAND_L ) //Shield
@@ -12508,10 +12509,10 @@ static int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk,
if ( bl->type == BL_PC && !(flag & 2) ) {
const struct map_session_data *sd = BL_UCCAST(BL_PC, bl);
- short index = sd->equip_index[EQI_HAND_R], refine;
+ short index = sd->equip_index[EQI_HAND_R], refine_level;
if ( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON
- && (refine = sd->status.inventory[index].refine) < 16 && refine ) {
- int r = status->dbs->refine_info[watk->wlv].randombonus_max[refine + (4 - watk->wlv)] / 100;
+ && (refine_level = sd->status.inventory[index].refine) < 16 && refine_level) {
+ int r = refine->get_randombonus_max(watk->wlv, refine_level + (4 - watk->wlv) + 1) / 100;
if ( r )
max += (rnd() % 100) % r + 1;
}
@@ -12623,10 +12624,10 @@ static void status_get_matk_sub(struct block_list *bl, int flag, unsigned short
#ifdef RENEWAL
if ( sd && !(flag & 2) ) {
- short index = sd->equip_index[EQI_HAND_R], refine;
+ short index = sd->equip_index[EQI_HAND_R], refine_level;
if ( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON
- && (refine = sd->status.inventory[index].refine) < 16 && refine ) {
- int r = status->dbs->refine_info[sd->inventory_data[index]->wlv].randombonus_max[refine + (4 - sd->inventory_data[index]->wlv)] / 100;
+ && (refine_level = sd->status.inventory[index].refine) < 16 && refine_level) {
+ int r = refine->get_randombonus_max(sd->inventory_data[index]->wlv, refine_level + (4 - sd->inventory_data[index]->wlv) + 1) / 100;
if ( r )
*matk_max += (rnd() % 100) % r + 1;
}
@@ -13076,25 +13077,6 @@ static int status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data)
return 0;
}
-/**
- * Get the chance to upgrade a piece of equipment.
- * @param wlv The weapon type of the item to refine (see see enum refine_type)
- * @param refine The target refine level
- * @return The chance to refine the item, in percent (0~100)
- */
-static 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;
-
- if (type >= REFINE_CHANCE_TYPE_MAX)
- return 0;
-
- return status->dbs->refine_info[wlv].chance[type][refine];
-}
-
static int status_get_sc_type(sc_type type)
{
@@ -13405,171 +13387,6 @@ static bool status_readdb_sizefix(char *fields[], int columns, int current)
return true;
}
-/**
- * Processes a refine_db.conf entry.
- *
- * @param r Libconfig setting entry. It is expected to be valid and it
- * won't be freed (it is care of the caller to do so if
- * necessary)
- * @param n Ordinal number of the entry, to be displayed in case of
- * validation errors.
- * @param source Source of the entry (file name), to be displayed in case of
- * validation errors.
- * @return # of the validated entry, or 0 in case of failure.
- */
-static int status_readdb_refine_libconfig_sub(struct config_setting_t *r, const char *name, const char *source)
-{
- struct config_setting_t *rate = NULL;
- int type = REFINE_TYPE_ARMOR, bonus_per_level = 0, rnd_bonus_v = 0, rnd_bonus_lv = 0;
- char lv[4];
- nullpo_ret(r);
- nullpo_ret(name);
- nullpo_ret(source);
-
- if (strncmp(name, "Armors", 6) == 0) {
- type = REFINE_TYPE_ARMOR;
- } else if (strncmp(name, "WeaponLevel", 11) != 0 || !strspn(&name[strlen(name)-1], "0123456789") || (type = atoi(strncpy(lv, name+11, 2))) == REFINE_TYPE_ARMOR) {
- ShowError("status_readdb_refine_libconfig_sub: Invalid key name for entry '%s' in \"%s\", skipping.\n", name, source);
- return 0;
- }
- if (type < REFINE_TYPE_ARMOR || type >= REFINE_TYPE_MAX) {
- ShowError("status_readdb_refine_libconfig_sub: Out of range level for entry '%s' in \"%s\", skipping.\n", name, source);
- return 0;
- }
- if (!libconfig->setting_lookup_int(r, "StatsPerLevel", &bonus_per_level)) {
- ShowWarning("status_readdb_refine_libconfig_sub: Missing StatsPerLevel for entry '%s' in \"%s\", skipping.\n", name, source);
- return 0;
- }
- if (!libconfig->setting_lookup_int(r, "RandomBonusStartLevel", &rnd_bonus_lv)) {
- ShowWarning("status_readdb_refine_libconfig_sub: Missing RandomBonusStartLevel for entry '%s' in \"%s\", skipping.\n", name, source);
- return 0;
- }
- if (!libconfig->setting_lookup_int(r, "RandomBonusValue", &rnd_bonus_v)) {
- ShowWarning("status_readdb_refine_libconfig_sub: Missing RandomBonusValue for entry '%s' in \"%s\", skipping.\n", name, source);
- return 0;
- }
-
- 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];
- 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 < 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) {
- 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, "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[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[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);
- 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;
-}
-
-/**
- * Reads from a libconfig-formatted refine_db.conf file.
- *
- * @param *filename File name, relative to the database path.
- * @return The number of found entries.
- */
-static int status_readdb_refine_libconfig(const char *filename)
-{
- bool duplicate[REFINE_TYPE_MAX];
- struct config_t refine_db_conf;
- struct config_setting_t *r;
- char filepath[256];
- int i = 0, count = 0;
-
- safesnprintf(filepath, sizeof(filepath), "%s/%s", map->db_path, filename);
- if (!libconfig->load_file(&refine_db_conf, filepath))
- return 0;
-
- memset(&duplicate,0,sizeof(duplicate));
-
- while((r = libconfig->setting_get_elem(refine_db_conf.root,i++))) {
- char *name = config_setting_name(r);
- int type = status->readdb_refine_libconfig_sub(r, name, filename);
- if (type != 0) {
- if (duplicate[type-1]) {
- ShowWarning("status_readdb_refine_libconfig: duplicate entry for %s in \"%s\", overwriting previous entry...\n", name, filename);
- } else {
- duplicate[type-1] = true;
- }
- count++;
- }
- }
- libconfig->destroy(&refine_db_conf);
- ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filename);
-
- return count;
-}
-
static bool status_readdb_scconfig(char *fields[], int columns, int current)
{
int val = 0;
@@ -13627,7 +13444,6 @@ static int status_readdb(void)
//
sv->readdb(map->db_path, "job_db2.txt", ',', 1, 1+MAX_LEVEL, -1, status->readdb_job2);
sv->readdb(map->db_path, DBPATH"size_fix.txt", ',', MAX_SINGLE_WEAPON_TYPE, MAX_SINGLE_WEAPON_TYPE, ARRAYLENGTH(status->dbs->atkmods), status->readdb_sizefix);
- status->readdb_refine_libconfig(DBPATH"refine_db.conf");
sv->readdb(map->db_path, "sc_config.txt", ',', 2, 2, SC_MAX, status->readdb_scconfig);
status->read_job_db();
@@ -13685,7 +13501,6 @@ void status_defaults(void)
status->natural_heal_prev_tick = 0;
status->natural_heal_diff_tick = 0;
/* funcs */
- status->get_refine_chance = status_get_refine_chance;
// for looking up associated data
status->skill2sc = status_skill2sc;
status->sc2skill = status_sc2skill;
@@ -13819,8 +13634,6 @@ void status_defaults(void)
status->natural_heal_timer = status_natural_heal_timer;
status->readdb_job2 = status_readdb_job2;
status->readdb_sizefix = status_readdb_sizefix;
- status->readdb_refine_libconfig = status_readdb_refine_libconfig;
- status->readdb_refine_libconfig_sub = status_readdb_refine_libconfig_sub;
status->readdb_scconfig = status_readdb_scconfig;
status->read_job_db = status_read_job_db;
status->read_job_db_sub = status_read_job_db_sub;
diff --git a/src/map/status.h b/src/map/status.h
index 17af22703..79aaca95f 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -49,27 +49,6 @@ struct pet_data;
)
/**
- * Max Refine available to your server
- * Changing this limit requires edits to refine_db.txt
- **/
-#ifdef RENEWAL
- #define MAX_REFINE 20
-#else
- #define MAX_REFINE 10
-#endif
-
-enum refine_type {
- REFINE_TYPE_ARMOR = 0,
- REFINE_TYPE_WEAPON1 = 1,
- REFINE_TYPE_WEAPON2 = 2,
- REFINE_TYPE_WEAPON3 = 3,
- REFINE_TYPE_WEAPON4 = 4,
-#ifndef REFINE_TYPE_MAX
- REFINE_TYPE_MAX = 5
-#endif
-};
-
-/**
* SC configuration type
* @see db/sc_config.txt for more information
**/
@@ -2249,21 +2228,6 @@ 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[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
-};
-
struct s_status_dbs {
BEGIN_ZEROED_BLOCK; /* Everything within this block will be memset to 0 when status_defaults() is executed */
int max_weight_base[CLASS_COUNT];
@@ -2277,8 +2241,6 @@ BEGIN_ZEROED_BLOCK; /* Everything within this block will be memset to 0 when sta
int RelevantBLTypes[SI_MAX]; // "icon" -> enum bl_type (for clif->status_change to identify for which bl types to send packets)
bool DisplayType[SC_MAX];
/* */
- struct s_refine_info refine_info[REFINE_TYPE_MAX];
- /* */
int atkmods[3][MAX_SINGLE_WEAPON_TYPE];//ATK weapon modification for size (size_fix.txt)
char job_bonus[CLASS_COUNT][MAX_LEVEL];
sc_conf_type sc_conf[SC_MAX];
@@ -2307,7 +2269,6 @@ struct status_interface {
int (*init) (bool minimal);
void (*final) (void);
/* funcs */
- 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);
@@ -2427,8 +2388,6 @@ struct status_interface {
int (*natural_heal_timer) (int tid, int64 tick, int id, intptr_t data);
bool (*readdb_job2) (char *fields[], int columns, int current);
bool (*readdb_sizefix) (char *fields[], int columns, int current);
- int (*readdb_refine_libconfig) (const char *filename);
- int (*readdb_refine_libconfig_sub) (struct config_setting_t *r, const char *name, const char *source);
bool (*readdb_scconfig) (char *fields[], int columns, int current);
void (*read_job_db) (void);
void (*read_job_db_sub) (int idx, const char *name, struct config_setting_t *jdb);
diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c
index f95a3a92d..8e7ed4823 100644
--- a/src/plugins/HPMHooking.c
+++ b/src/plugins/HPMHooking.c
@@ -106,6 +106,8 @@ PRAGMA_GCC5(GCC diagnostic ignored "-Wdiscarded-qualifiers")
#include "map/pet.h"
#include "map/quest.h"
#include "map/rodex.h"
+#include "map/refine.h"
+#include "map/refine.p.h"
#include "map/script.h"
#include "map/skill.h"
#include "map/status.h"
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 715e19a48..f6fa6a5e8 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -2702,6 +2702,18 @@ typedef void (*HPMHOOK_pre_clif_loadConfirm) (struct map_session_data **sd);
typedef void (*HPMHOOK_post_clif_loadConfirm) (struct map_session_data *sd);
typedef void (*HPMHOOK_pre_clif_send_selforarea) (int *fd, struct block_list **bl, const void **buf, int *len);
typedef void (*HPMHOOK_post_clif_send_selforarea) (int fd, struct block_list *bl, const void *buf, int len);
+typedef void (*HPMHOOK_pre_clif_OpenRefineryUI) (struct map_session_data **sd);
+typedef void (*HPMHOOK_post_clif_OpenRefineryUI) (struct map_session_data *sd);
+typedef void (*HPMHOOK_pre_clif_pAddItemRefineryUI) (int *fd, struct map_session_data **sd);
+typedef void (*HPMHOOK_post_clif_pAddItemRefineryUI) (int fd, struct map_session_data *sd);
+typedef void (*HPMHOOK_pre_clif_AddItemRefineryUIAck) (struct map_session_data **sd, int *item_index, struct s_refine_requirement **req);
+typedef void (*HPMHOOK_post_clif_AddItemRefineryUIAck) (struct map_session_data *sd, int item_index, struct s_refine_requirement *req);
+typedef void (*HPMHOOK_pre_clif_pRefineryUIClose) (int *fd, struct map_session_data **sd);
+typedef void (*HPMHOOK_post_clif_pRefineryUIClose) (int fd, struct map_session_data *sd);
+typedef void (*HPMHOOK_pre_clif_pRefineryUIRefine) (int *fd, struct map_session_data **sd);
+typedef void (*HPMHOOK_post_clif_pRefineryUIRefine) (int fd, struct map_session_data *sd);
+typedef void (*HPMHOOK_pre_clif_announce_refine_status) (struct map_session_data **sd, int *item_id, int *refine_level, bool *success, enum send_target *target);
+typedef void (*HPMHOOK_post_clif_announce_refine_status) (struct map_session_data *sd, int item_id, int refine_level, bool success, enum send_target target);
#endif // MAP_CLIF_H
#ifdef COMMON_CORE_H /* cmdline */
typedef void (*HPMHOOK_pre_cmdline_init) (void);
@@ -4342,8 +4354,8 @@ typedef char (*HPMHOOK_pre_logs_picktype2char) (e_log_pick_type *type);
typedef char (*HPMHOOK_post_logs_picktype2char) (char retVal___, e_log_pick_type type);
typedef char (*HPMHOOK_pre_logs_chattype2char) (e_log_chat_type *type);
typedef char (*HPMHOOK_post_logs_chattype2char) (char retVal___, e_log_chat_type type);
-typedef bool (*HPMHOOK_pre_logs_should_log_item) (int *nameid, int *amount, int *refine, struct item_data **id);
-typedef bool (*HPMHOOK_post_logs_should_log_item) (bool retVal___, int nameid, int amount, int refine, struct item_data *id);
+typedef bool (*HPMHOOK_pre_logs_should_log_item) (int *nameid, int *amount, int *refine_level, struct item_data **id);
+typedef bool (*HPMHOOK_post_logs_should_log_item) (bool retVal___, int nameid, int amount, int refine_level, struct item_data *id);
#endif // MAP_LOG_H
#ifdef LOGIN_LOGIN_H /* login */
typedef int (*HPMHOOK_pre_login_mmo_auth) (struct login_session_data **sd, bool *isServer);
@@ -6617,6 +6629,40 @@ typedef bool (*HPMHOOK_post_quest_questinfo_validate_mercenary_class) (bool retV
typedef void (*HPMHOOK_pre_quest_questinfo_vector_clear) (int *m);
typedef void (*HPMHOOK_post_quest_questinfo_vector_clear) (int m);
#endif // MAP_QUEST_H
+#ifdef MAP_REFINE_H /* refine */
+typedef int (*HPMHOOK_pre_refine_init) (bool *minimal);
+typedef int (*HPMHOOK_post_refine_init) (int retVal___, bool minimal);
+typedef void (*HPMHOOK_pre_refine_final) (void);
+typedef void (*HPMHOOK_post_refine_final) (void);
+typedef int (*HPMHOOK_pre_refine_get_refine_chance) (enum refine_type *wlv, int *refine_level, enum refine_chance_type *type);
+typedef int (*HPMHOOK_post_refine_get_refine_chance) (int retVal___, enum refine_type wlv, int refine_level, enum refine_chance_type type);
+typedef int (*HPMHOOK_pre_refine_get_bonus) (enum refine_type *equipment_type, int *refine_level);
+typedef int (*HPMHOOK_post_refine_get_bonus) (int retVal___, enum refine_type equipment_type, int refine_level);
+typedef int (*HPMHOOK_pre_refine_get_randombonus_max) (enum refine_type *equipment_type, int *refine_level);
+typedef int (*HPMHOOK_post_refine_get_randombonus_max) (int retVal___, enum refine_type equipment_type, int refine_level);
+typedef void (*HPMHOOK_pre_refine_refinery_add_item) (struct map_session_data **sd, int *item_index);
+typedef void (*HPMHOOK_post_refine_refinery_add_item) (struct map_session_data *sd, int item_index);
+typedef void (*HPMHOOK_pre_refine_refinery_refine_request) (struct map_session_data **sd, int *item_index, int *material_id, bool *use_blacksmith_blessing);
+typedef void (*HPMHOOK_post_refine_refinery_refine_request) (struct map_session_data *sd, int item_index, int material_id, bool use_blacksmith_blessing);
+#endif // MAP_REFINE_H
+#ifdef MAP_REFINE_P_H /* PRIV__refine */
+typedef int (*HPMHOOK_pre_PRIV__refine_readdb_refine_libconfig_sub) (struct config_setting_t **r, const char **name, const char **source);
+typedef int (*HPMHOOK_post_PRIV__refine_readdb_refine_libconfig_sub) (int retVal___, struct config_setting_t *r, const char *name, const char *source);
+typedef int (*HPMHOOK_pre_PRIV__refine_readdb_refine_libconfig) (const char **filename);
+typedef int (*HPMHOOK_post_PRIV__refine_readdb_refine_libconfig) (int retVal___, const char *filename);
+typedef bool (*HPMHOOK_pre_PRIV__refine_announce_behavior_string2enum) (const char **str, unsigned int **result);
+typedef bool (*HPMHOOK_post_PRIV__refine_announce_behavior_string2enum) (bool retVal___, const char *str, unsigned int *result);
+typedef bool (*HPMHOOK_pre_PRIV__refine_failure_behavior_string2enum) (const char **str, enum refine_ui_failure_behavior **result);
+typedef bool (*HPMHOOK_post_PRIV__refine_failure_behavior_string2enum) (bool retVal___, const char *str, enum refine_ui_failure_behavior *result);
+typedef bool (*HPMHOOK_pre_PRIV__refine_readdb_refinery_ui_settings_items) (const struct config_setting_t **elem, struct s_refine_requirement **req, const char **name, const char **source);
+typedef bool (*HPMHOOK_post_PRIV__refine_readdb_refinery_ui_settings_items) (bool retVal___, const struct config_setting_t *elem, struct s_refine_requirement *req, const char *name, const char *source);
+typedef bool (*HPMHOOK_pre_PRIV__refine_readdb_refinery_ui_settings_sub) (const struct config_setting_t **elem, int *type, const char **name, const char **source);
+typedef bool (*HPMHOOK_post_PRIV__refine_readdb_refinery_ui_settings_sub) (bool retVal___, const struct config_setting_t *elem, int type, const char *name, const char *source);
+typedef int (*HPMHOOK_pre_PRIV__refine_readdb_refinery_ui_settings) (const struct config_setting_t **r, int *type, const char **name, const char **source);
+typedef int (*HPMHOOK_post_PRIV__refine_readdb_refinery_ui_settings) (int retVal___, const struct config_setting_t *r, int type, const char *name, const char *source);
+typedef bool (*HPMHOOK_pre_PRIV__refine_is_refinable) (struct map_session_data **sd, int *item_index);
+typedef bool (*HPMHOOK_post_PRIV__refine_is_refinable) (bool retVal___, struct map_session_data *sd, int item_index);
+#endif // MAP_REFINE_P_H
#ifdef COMMON_RANDOM_H /* rnd */
typedef void (*HPMHOOK_pre_rnd_init) (void);
typedef void (*HPMHOOK_post_rnd_init) (void);
@@ -7064,8 +7110,8 @@ typedef bool (*HPMHOOK_pre_searchstore_queryremote) (struct map_session_data **s
typedef bool (*HPMHOOK_post_searchstore_queryremote) (bool retVal___, struct map_session_data *sd, int account_id);
typedef void (*HPMHOOK_pre_searchstore_clearremote) (struct map_session_data **sd);
typedef void (*HPMHOOK_post_searchstore_clearremote) (struct map_session_data *sd);
-typedef bool (*HPMHOOK_pre_searchstore_result) (struct map_session_data **sd, unsigned int *store_id, int *account_id, const char **store_name, int *nameid, unsigned short *amount, unsigned int *price, const int **card, unsigned char *refine, const struct item_option **option);
-typedef bool (*HPMHOOK_post_searchstore_result) (bool retVal___, struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine, const struct item_option *option);
+typedef bool (*HPMHOOK_pre_searchstore_result) (struct map_session_data **sd, unsigned int *store_id, int *account_id, const char **store_name, int *nameid, unsigned short *amount, unsigned int *price, const int **card, unsigned char *refine_level, const struct item_option **option);
+typedef bool (*HPMHOOK_post_searchstore_result) (bool retVal___, struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine_level, const struct item_option *option);
#endif // MAP_SEARCHSTORE_H
#ifdef COMMON_SHOWMSG_H /* showmsg */
typedef void (*HPMHOOK_pre_showmsg_init) (void);
@@ -7702,8 +7748,6 @@ 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, 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);
@@ -7934,10 +7978,6 @@ typedef bool (*HPMHOOK_pre_status_readdb_job2) (char **fields[], int *columns, i
typedef bool (*HPMHOOK_post_status_readdb_job2) (bool retVal___, char *fields[], int columns, int current);
typedef bool (*HPMHOOK_pre_status_readdb_sizefix) (char **fields[], int *columns, int *current);
typedef bool (*HPMHOOK_post_status_readdb_sizefix) (bool retVal___, char *fields[], int columns, int current);
-typedef int (*HPMHOOK_pre_status_readdb_refine_libconfig) (const char **filename);
-typedef int (*HPMHOOK_post_status_readdb_refine_libconfig) (int retVal___, const char *filename);
-typedef int (*HPMHOOK_pre_status_readdb_refine_libconfig_sub) (struct config_setting_t **r, const char **name, const char **source);
-typedef int (*HPMHOOK_post_status_readdb_refine_libconfig_sub) (int retVal___, struct config_setting_t *r, const char *name, const char *source);
typedef bool (*HPMHOOK_pre_status_readdb_scconfig) (char **fields[], int *columns, int *current);
typedef bool (*HPMHOOK_post_status_readdb_scconfig) (bool retVal___, char *fields[], int columns, int current);
typedef void (*HPMHOOK_pre_status_read_job_db) (void);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 671d8ad8a..9c0b1905e 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -2292,6 +2292,18 @@ struct {
struct HPMHookPoint *HP_clif_loadConfirm_post;
struct HPMHookPoint *HP_clif_send_selforarea_pre;
struct HPMHookPoint *HP_clif_send_selforarea_post;
+ struct HPMHookPoint *HP_clif_OpenRefineryUI_pre;
+ struct HPMHookPoint *HP_clif_OpenRefineryUI_post;
+ struct HPMHookPoint *HP_clif_pAddItemRefineryUI_pre;
+ struct HPMHookPoint *HP_clif_pAddItemRefineryUI_post;
+ struct HPMHookPoint *HP_clif_AddItemRefineryUIAck_pre;
+ struct HPMHookPoint *HP_clif_AddItemRefineryUIAck_post;
+ struct HPMHookPoint *HP_clif_pRefineryUIClose_pre;
+ struct HPMHookPoint *HP_clif_pRefineryUIClose_post;
+ struct HPMHookPoint *HP_clif_pRefineryUIRefine_pre;
+ struct HPMHookPoint *HP_clif_pRefineryUIRefine_post;
+ struct HPMHookPoint *HP_clif_announce_refine_status_pre;
+ struct HPMHookPoint *HP_clif_announce_refine_status_post;
struct HPMHookPoint *HP_cmdline_init_pre;
struct HPMHookPoint *HP_cmdline_init_post;
struct HPMHookPoint *HP_cmdline_final_pre;
@@ -5126,6 +5138,36 @@ struct {
struct HPMHookPoint *HP_quest_questinfo_validate_mercenary_class_post;
struct HPMHookPoint *HP_quest_questinfo_vector_clear_pre;
struct HPMHookPoint *HP_quest_questinfo_vector_clear_post;
+ struct HPMHookPoint *HP_refine_init_pre;
+ struct HPMHookPoint *HP_refine_init_post;
+ struct HPMHookPoint *HP_refine_final_pre;
+ struct HPMHookPoint *HP_refine_final_post;
+ struct HPMHookPoint *HP_refine_get_refine_chance_pre;
+ struct HPMHookPoint *HP_refine_get_refine_chance_post;
+ struct HPMHookPoint *HP_refine_get_bonus_pre;
+ struct HPMHookPoint *HP_refine_get_bonus_post;
+ struct HPMHookPoint *HP_refine_get_randombonus_max_pre;
+ struct HPMHookPoint *HP_refine_get_randombonus_max_post;
+ struct HPMHookPoint *HP_refine_refinery_add_item_pre;
+ struct HPMHookPoint *HP_refine_refinery_add_item_post;
+ struct HPMHookPoint *HP_refine_refinery_refine_request_pre;
+ struct HPMHookPoint *HP_refine_refinery_refine_request_post;
+ struct HPMHookPoint *HP_PRIV__refine_readdb_refine_libconfig_sub_pre;
+ struct HPMHookPoint *HP_PRIV__refine_readdb_refine_libconfig_sub_post;
+ struct HPMHookPoint *HP_PRIV__refine_readdb_refine_libconfig_pre;
+ struct HPMHookPoint *HP_PRIV__refine_readdb_refine_libconfig_post;
+ struct HPMHookPoint *HP_PRIV__refine_announce_behavior_string2enum_pre;
+ struct HPMHookPoint *HP_PRIV__refine_announce_behavior_string2enum_post;
+ struct HPMHookPoint *HP_PRIV__refine_failure_behavior_string2enum_pre;
+ struct HPMHookPoint *HP_PRIV__refine_failure_behavior_string2enum_post;
+ struct HPMHookPoint *HP_PRIV__refine_readdb_refinery_ui_settings_items_pre;
+ struct HPMHookPoint *HP_PRIV__refine_readdb_refinery_ui_settings_items_post;
+ struct HPMHookPoint *HP_PRIV__refine_readdb_refinery_ui_settings_sub_pre;
+ struct HPMHookPoint *HP_PRIV__refine_readdb_refinery_ui_settings_sub_post;
+ struct HPMHookPoint *HP_PRIV__refine_readdb_refinery_ui_settings_pre;
+ struct HPMHookPoint *HP_PRIV__refine_readdb_refinery_ui_settings_post;
+ struct HPMHookPoint *HP_PRIV__refine_is_refinable_pre;
+ struct HPMHookPoint *HP_PRIV__refine_is_refinable_post;
struct HPMHookPoint *HP_rnd_init_pre;
struct HPMHookPoint *HP_rnd_init_post;
struct HPMHookPoint *HP_rnd_final_pre;
@@ -6194,8 +6236,6 @@ struct {
struct HPMHookPoint *HP_status_init_post;
struct HPMHookPoint *HP_status_final_pre;
struct HPMHookPoint *HP_status_final_post;
- struct HPMHookPoint *HP_status_get_refine_chance_pre;
- struct HPMHookPoint *HP_status_get_refine_chance_post;
struct HPMHookPoint *HP_status_skill2sc_pre;
struct HPMHookPoint *HP_status_skill2sc_post;
struct HPMHookPoint *HP_status_sc2skill_pre;
@@ -6426,10 +6466,6 @@ struct {
struct HPMHookPoint *HP_status_readdb_job2_post;
struct HPMHookPoint *HP_status_readdb_sizefix_pre;
struct HPMHookPoint *HP_status_readdb_sizefix_post;
- struct HPMHookPoint *HP_status_readdb_refine_libconfig_pre;
- struct HPMHookPoint *HP_status_readdb_refine_libconfig_post;
- struct HPMHookPoint *HP_status_readdb_refine_libconfig_sub_pre;
- struct HPMHookPoint *HP_status_readdb_refine_libconfig_sub_post;
struct HPMHookPoint *HP_status_readdb_scconfig_pre;
struct HPMHookPoint *HP_status_readdb_scconfig_post;
struct HPMHookPoint *HP_status_read_job_db_pre;
@@ -9037,6 +9073,18 @@ struct {
int HP_clif_loadConfirm_post;
int HP_clif_send_selforarea_pre;
int HP_clif_send_selforarea_post;
+ int HP_clif_OpenRefineryUI_pre;
+ int HP_clif_OpenRefineryUI_post;
+ int HP_clif_pAddItemRefineryUI_pre;
+ int HP_clif_pAddItemRefineryUI_post;
+ int HP_clif_AddItemRefineryUIAck_pre;
+ int HP_clif_AddItemRefineryUIAck_post;
+ int HP_clif_pRefineryUIClose_pre;
+ int HP_clif_pRefineryUIClose_post;
+ int HP_clif_pRefineryUIRefine_pre;
+ int HP_clif_pRefineryUIRefine_post;
+ int HP_clif_announce_refine_status_pre;
+ int HP_clif_announce_refine_status_post;
int HP_cmdline_init_pre;
int HP_cmdline_init_post;
int HP_cmdline_final_pre;
@@ -11871,6 +11919,36 @@ struct {
int HP_quest_questinfo_validate_mercenary_class_post;
int HP_quest_questinfo_vector_clear_pre;
int HP_quest_questinfo_vector_clear_post;
+ int HP_refine_init_pre;
+ int HP_refine_init_post;
+ int HP_refine_final_pre;
+ int HP_refine_final_post;
+ int HP_refine_get_refine_chance_pre;
+ int HP_refine_get_refine_chance_post;
+ int HP_refine_get_bonus_pre;
+ int HP_refine_get_bonus_post;
+ int HP_refine_get_randombonus_max_pre;
+ int HP_refine_get_randombonus_max_post;
+ int HP_refine_refinery_add_item_pre;
+ int HP_refine_refinery_add_item_post;
+ int HP_refine_refinery_refine_request_pre;
+ int HP_refine_refinery_refine_request_post;
+ int HP_PRIV__refine_readdb_refine_libconfig_sub_pre;
+ int HP_PRIV__refine_readdb_refine_libconfig_sub_post;
+ int HP_PRIV__refine_readdb_refine_libconfig_pre;
+ int HP_PRIV__refine_readdb_refine_libconfig_post;
+ int HP_PRIV__refine_announce_behavior_string2enum_pre;
+ int HP_PRIV__refine_announce_behavior_string2enum_post;
+ int HP_PRIV__refine_failure_behavior_string2enum_pre;
+ int HP_PRIV__refine_failure_behavior_string2enum_post;
+ int HP_PRIV__refine_readdb_refinery_ui_settings_items_pre;
+ int HP_PRIV__refine_readdb_refinery_ui_settings_items_post;
+ int HP_PRIV__refine_readdb_refinery_ui_settings_sub_pre;
+ int HP_PRIV__refine_readdb_refinery_ui_settings_sub_post;
+ int HP_PRIV__refine_readdb_refinery_ui_settings_pre;
+ int HP_PRIV__refine_readdb_refinery_ui_settings_post;
+ int HP_PRIV__refine_is_refinable_pre;
+ int HP_PRIV__refine_is_refinable_post;
int HP_rnd_init_pre;
int HP_rnd_init_post;
int HP_rnd_final_pre;
@@ -12939,8 +13017,6 @@ struct {
int HP_status_init_post;
int HP_status_final_pre;
int HP_status_final_post;
- int HP_status_get_refine_chance_pre;
- int HP_status_get_refine_chance_post;
int HP_status_skill2sc_pre;
int HP_status_skill2sc_post;
int HP_status_sc2skill_pre;
@@ -13171,10 +13247,6 @@ struct {
int HP_status_readdb_job2_post;
int HP_status_readdb_sizefix_pre;
int HP_status_readdb_sizefix_post;
- int HP_status_readdb_refine_libconfig_pre;
- int HP_status_readdb_refine_libconfig_post;
- int HP_status_readdb_refine_libconfig_sub_pre;
- int HP_status_readdb_refine_libconfig_sub_post;
int HP_status_readdb_scconfig_pre;
int HP_status_readdb_scconfig_post;
int HP_status_read_job_db_pre;
@@ -13564,6 +13636,8 @@ struct {
struct pcre_interface libpcre;
struct pet_interface pet;
struct quest_interface quest;
+ struct refine_interface refine;
+ struct refine_interface_private PRIV__refine;
struct rnd_interface rnd;
struct rodex_interface rodex;
struct script_interface script;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index b33cc6f4e..6c0b6db36 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -1170,6 +1170,12 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(clif->pResetCooldown, HP_clif_pResetCooldown) },
{ HP_POP(clif->loadConfirm, HP_clif_loadConfirm) },
{ HP_POP(clif->send_selforarea, HP_clif_send_selforarea) },
+ { HP_POP(clif->OpenRefineryUI, HP_clif_OpenRefineryUI) },
+ { HP_POP(clif->pAddItemRefineryUI, HP_clif_pAddItemRefineryUI) },
+ { HP_POP(clif->AddItemRefineryUIAck, HP_clif_AddItemRefineryUIAck) },
+ { HP_POP(clif->pRefineryUIClose, HP_clif_pRefineryUIClose) },
+ { HP_POP(clif->pRefineryUIRefine, HP_clif_pRefineryUIRefine) },
+ { HP_POP(clif->announce_refine_status, HP_clif_announce_refine_status) },
/* cmdline_interface */
{ HP_POP(cmdline->init, HP_cmdline_init) },
{ HP_POP(cmdline->final, HP_cmdline_final) },
@@ -2624,6 +2630,23 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(quest->questinfo_validate_quests, HP_quest_questinfo_validate_quests) },
{ HP_POP(quest->questinfo_validate_mercenary_class, HP_quest_questinfo_validate_mercenary_class) },
{ HP_POP(quest->questinfo_vector_clear, HP_quest_questinfo_vector_clear) },
+/* refine_interface */
+ { HP_POP(refine->init, HP_refine_init) },
+ { HP_POP(refine->final, HP_refine_final) },
+ { HP_POP(refine->get_refine_chance, HP_refine_get_refine_chance) },
+ { HP_POP(refine->get_bonus, HP_refine_get_bonus) },
+ { HP_POP(refine->get_randombonus_max, HP_refine_get_randombonus_max) },
+ { HP_POP(refine->refinery_add_item, HP_refine_refinery_add_item) },
+ { HP_POP(refine->refinery_refine_request, HP_refine_refinery_refine_request) },
+/* refine_interface_private */
+ { HP_POP(refine->p->readdb_refine_libconfig_sub, HP_PRIV__refine_readdb_refine_libconfig_sub) },
+ { HP_POP(refine->p->readdb_refine_libconfig, HP_PRIV__refine_readdb_refine_libconfig) },
+ { HP_POP(refine->p->announce_behavior_string2enum, HP_PRIV__refine_announce_behavior_string2enum) },
+ { HP_POP(refine->p->failure_behavior_string2enum, HP_PRIV__refine_failure_behavior_string2enum) },
+ { HP_POP(refine->p->readdb_refinery_ui_settings_items, HP_PRIV__refine_readdb_refinery_ui_settings_items) },
+ { HP_POP(refine->p->readdb_refinery_ui_settings_sub, HP_PRIV__refine_readdb_refinery_ui_settings_sub) },
+ { HP_POP(refine->p->readdb_refinery_ui_settings, HP_PRIV__refine_readdb_refinery_ui_settings) },
+ { HP_POP(refine->p->is_refinable, HP_PRIV__refine_is_refinable) },
/* rnd_interface */
{ HP_POP(rnd->init, HP_rnd_init) },
{ HP_POP(rnd->final, HP_rnd_final) },
@@ -3167,7 +3190,6 @@ struct HookingPointData HookingPoints[] = {
/* status_interface */
{ HP_POP(status->init, HP_status_init) },
{ HP_POP(status->final, HP_status_final) },
- { HP_POP(status->get_refine_chance, HP_status_get_refine_chance) },
{ HP_POP(status->skill2sc, HP_status_skill2sc) },
{ HP_POP(status->sc2skill, HP_status_sc2skill) },
{ HP_POP(status->sc2scb_flag, HP_status_sc2scb_flag) },
@@ -3283,8 +3305,6 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(status->natural_heal_timer, HP_status_natural_heal_timer) },
{ HP_POP(status->readdb_job2, HP_status_readdb_job2) },
{ HP_POP(status->readdb_sizefix, HP_status_readdb_sizefix) },
- { HP_POP(status->readdb_refine_libconfig, HP_status_readdb_refine_libconfig) },
- { HP_POP(status->readdb_refine_libconfig_sub, HP_status_readdb_refine_libconfig_sub) },
{ HP_POP(status->readdb_scconfig, HP_status_readdb_scconfig) },
{ HP_POP(status->read_job_db, HP_status_read_job_db) },
{ HP_POP(status->read_job_db_sub, HP_status_read_job_db_sub) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 4bfa46abe..44fb02b62 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -29881,6 +29881,162 @@ void HP_clif_send_selforarea(int fd, struct block_list *bl, const void *buf, int
}
return;
}
+void HP_clif_OpenRefineryUI(struct map_session_data *sd) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_OpenRefineryUI_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_OpenRefineryUI_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_OpenRefineryUI_pre[hIndex].func;
+ preHookFunc(&sd);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.OpenRefineryUI(sd);
+ }
+ if (HPMHooks.count.HP_clif_OpenRefineryUI_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_OpenRefineryUI_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_OpenRefineryUI_post[hIndex].func;
+ postHookFunc(sd);
+ }
+ }
+ return;
+}
+void HP_clif_pAddItemRefineryUI(int fd, struct map_session_data *sd) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_pAddItemRefineryUI_pre > 0) {
+ void (*preHookFunc) (int *fd, struct map_session_data **sd);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pAddItemRefineryUI_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_pAddItemRefineryUI_pre[hIndex].func;
+ preHookFunc(&fd, &sd);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.pAddItemRefineryUI(fd, sd);
+ }
+ if (HPMHooks.count.HP_clif_pAddItemRefineryUI_post > 0) {
+ void (*postHookFunc) (int fd, struct map_session_data *sd);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pAddItemRefineryUI_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_pAddItemRefineryUI_post[hIndex].func;
+ postHookFunc(fd, sd);
+ }
+ }
+ return;
+}
+void HP_clif_AddItemRefineryUIAck(struct map_session_data *sd, int item_index, struct s_refine_requirement *req) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_AddItemRefineryUIAck_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, int *item_index, struct s_refine_requirement **req);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_AddItemRefineryUIAck_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_AddItemRefineryUIAck_pre[hIndex].func;
+ preHookFunc(&sd, &item_index, &req);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.AddItemRefineryUIAck(sd, item_index, req);
+ }
+ if (HPMHooks.count.HP_clif_AddItemRefineryUIAck_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, int item_index, struct s_refine_requirement *req);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_AddItemRefineryUIAck_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_AddItemRefineryUIAck_post[hIndex].func;
+ postHookFunc(sd, item_index, req);
+ }
+ }
+ return;
+}
+void HP_clif_pRefineryUIClose(int fd, struct map_session_data *sd) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_pRefineryUIClose_pre > 0) {
+ void (*preHookFunc) (int *fd, struct map_session_data **sd);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pRefineryUIClose_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_pRefineryUIClose_pre[hIndex].func;
+ preHookFunc(&fd, &sd);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.pRefineryUIClose(fd, sd);
+ }
+ if (HPMHooks.count.HP_clif_pRefineryUIClose_post > 0) {
+ void (*postHookFunc) (int fd, struct map_session_data *sd);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pRefineryUIClose_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_pRefineryUIClose_post[hIndex].func;
+ postHookFunc(fd, sd);
+ }
+ }
+ return;
+}
+void HP_clif_pRefineryUIRefine(int fd, struct map_session_data *sd) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_pRefineryUIRefine_pre > 0) {
+ void (*preHookFunc) (int *fd, struct map_session_data **sd);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pRefineryUIRefine_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_pRefineryUIRefine_pre[hIndex].func;
+ preHookFunc(&fd, &sd);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.pRefineryUIRefine(fd, sd);
+ }
+ if (HPMHooks.count.HP_clif_pRefineryUIRefine_post > 0) {
+ void (*postHookFunc) (int fd, struct map_session_data *sd);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pRefineryUIRefine_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_pRefineryUIRefine_post[hIndex].func;
+ postHookFunc(fd, sd);
+ }
+ }
+ return;
+}
+void HP_clif_announce_refine_status(struct map_session_data *sd, int item_id, int refine_level, bool success, enum send_target target) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_clif_announce_refine_status_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, int *item_id, int *refine_level, bool *success, enum send_target *target);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_announce_refine_status_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_clif_announce_refine_status_pre[hIndex].func;
+ preHookFunc(&sd, &item_id, &refine_level, &success, &target);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.clif.announce_refine_status(sd, item_id, refine_level, success, target);
+ }
+ if (HPMHooks.count.HP_clif_announce_refine_status_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, int item_id, int refine_level, bool success, enum send_target target);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_announce_refine_status_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_clif_announce_refine_status_post[hIndex].func;
+ postHookFunc(sd, item_id, refine_level, success, target);
+ }
+ }
+ return;
+}
/* cmdline_interface */
void HP_cmdline_init(void) {
int hIndex = 0;
@@ -45278,15 +45434,15 @@ char HP_logs_chattype2char(e_log_chat_type type) {
}
return retVal___;
}
-bool HP_logs_should_log_item(int nameid, int amount, int refine, struct item_data *id) {
+bool HP_logs_should_log_item(int nameid, int amount, int refine_level, struct item_data *id) {
int hIndex = 0;
bool retVal___ = false;
if (HPMHooks.count.HP_logs_should_log_item_pre > 0) {
- bool (*preHookFunc) (int *nameid, int *amount, int *refine, struct item_data **id);
+ bool (*preHookFunc) (int *nameid, int *amount, int *refine_level, struct item_data **id);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_logs_should_log_item_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_logs_should_log_item_pre[hIndex].func;
- retVal___ = preHookFunc(&nameid, &amount, &refine, &id);
+ retVal___ = preHookFunc(&nameid, &amount, &refine_level, &id);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -45294,13 +45450,13 @@ bool HP_logs_should_log_item(int nameid, int amount, int refine, struct item_dat
}
}
{
- retVal___ = HPMHooks.source.logs.should_log_item(nameid, amount, refine, id);
+ retVal___ = HPMHooks.source.logs.should_log_item(nameid, amount, refine_level, id);
}
if (HPMHooks.count.HP_logs_should_log_item_post > 0) {
- bool (*postHookFunc) (bool retVal___, int nameid, int amount, int refine, struct item_data *id);
+ bool (*postHookFunc) (bool retVal___, int nameid, int amount, int refine_level, struct item_data *id);
for (hIndex = 0; hIndex < HPMHooks.count.HP_logs_should_log_item_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_logs_should_log_item_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, nameid, amount, refine, id);
+ retVal___ = postHookFunc(retVal___, nameid, amount, refine_level, id);
}
}
return retVal___;
@@ -68265,6 +68421,410 @@ void HP_quest_questinfo_vector_clear(int m) {
}
return;
}
+/* refine_interface */
+int HP_refine_init(bool minimal) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_refine_init_pre > 0) {
+ int (*preHookFunc) (bool *minimal);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_init_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_refine_init_pre[hIndex].func;
+ retVal___ = preHookFunc(&minimal);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.refine.init(minimal);
+ }
+ if (HPMHooks.count.HP_refine_init_post > 0) {
+ int (*postHookFunc) (int retVal___, bool minimal);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_init_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_refine_init_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, minimal);
+ }
+ }
+ return retVal___;
+}
+void HP_refine_final(void) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_refine_final_pre > 0) {
+ void (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_final_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_refine_final_pre[hIndex].func;
+ preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.refine.final();
+ }
+ if (HPMHooks.count.HP_refine_final_post > 0) {
+ void (*postHookFunc) (void);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_final_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_refine_final_post[hIndex].func;
+ postHookFunc();
+ }
+ }
+ return;
+}
+int HP_refine_get_refine_chance(enum refine_type wlv, int refine_level, enum refine_chance_type type) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_refine_get_refine_chance_pre > 0) {
+ int (*preHookFunc) (enum refine_type *wlv, int *refine_level, enum refine_chance_type *type);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_get_refine_chance_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_refine_get_refine_chance_pre[hIndex].func;
+ retVal___ = preHookFunc(&wlv, &refine_level, &type);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.refine.get_refine_chance(wlv, refine_level, type);
+ }
+ if (HPMHooks.count.HP_refine_get_refine_chance_post > 0) {
+ int (*postHookFunc) (int retVal___, enum refine_type wlv, int refine_level, enum refine_chance_type type);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_get_refine_chance_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_refine_get_refine_chance_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, wlv, refine_level, type);
+ }
+ }
+ return retVal___;
+}
+int HP_refine_get_bonus(enum refine_type equipment_type, int refine_level) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_refine_get_bonus_pre > 0) {
+ int (*preHookFunc) (enum refine_type *equipment_type, int *refine_level);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_get_bonus_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_refine_get_bonus_pre[hIndex].func;
+ retVal___ = preHookFunc(&equipment_type, &refine_level);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.refine.get_bonus(equipment_type, refine_level);
+ }
+ if (HPMHooks.count.HP_refine_get_bonus_post > 0) {
+ int (*postHookFunc) (int retVal___, enum refine_type equipment_type, int refine_level);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_get_bonus_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_refine_get_bonus_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, equipment_type, refine_level);
+ }
+ }
+ return retVal___;
+}
+int HP_refine_get_randombonus_max(enum refine_type equipment_type, int refine_level) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_refine_get_randombonus_max_pre > 0) {
+ int (*preHookFunc) (enum refine_type *equipment_type, int *refine_level);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_get_randombonus_max_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_refine_get_randombonus_max_pre[hIndex].func;
+ retVal___ = preHookFunc(&equipment_type, &refine_level);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.refine.get_randombonus_max(equipment_type, refine_level);
+ }
+ if (HPMHooks.count.HP_refine_get_randombonus_max_post > 0) {
+ int (*postHookFunc) (int retVal___, enum refine_type equipment_type, int refine_level);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_get_randombonus_max_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_refine_get_randombonus_max_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, equipment_type, refine_level);
+ }
+ }
+ return retVal___;
+}
+void HP_refine_refinery_add_item(struct map_session_data *sd, int item_index) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_refine_refinery_add_item_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, int *item_index);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_refinery_add_item_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_refine_refinery_add_item_pre[hIndex].func;
+ preHookFunc(&sd, &item_index);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.refine.refinery_add_item(sd, item_index);
+ }
+ if (HPMHooks.count.HP_refine_refinery_add_item_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, int item_index);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_refinery_add_item_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_refine_refinery_add_item_post[hIndex].func;
+ postHookFunc(sd, item_index);
+ }
+ }
+ return;
+}
+void HP_refine_refinery_refine_request(struct map_session_data *sd, int item_index, int material_id, bool use_blacksmith_blessing) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_refine_refinery_refine_request_pre > 0) {
+ void (*preHookFunc) (struct map_session_data **sd, int *item_index, int *material_id, bool *use_blacksmith_blessing);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_refinery_refine_request_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_refine_refinery_refine_request_pre[hIndex].func;
+ preHookFunc(&sd, &item_index, &material_id, &use_blacksmith_blessing);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.refine.refinery_refine_request(sd, item_index, material_id, use_blacksmith_blessing);
+ }
+ if (HPMHooks.count.HP_refine_refinery_refine_request_post > 0) {
+ void (*postHookFunc) (struct map_session_data *sd, int item_index, int material_id, bool use_blacksmith_blessing);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_refine_refinery_refine_request_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_refine_refinery_refine_request_post[hIndex].func;
+ postHookFunc(sd, item_index, material_id, use_blacksmith_blessing);
+ }
+ }
+ return;
+}
+/* refine_interface_private */
+int HP_PRIV__refine_readdb_refine_libconfig_sub(struct config_setting_t *r, const char *name, const char *source) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_PRIV__refine_readdb_refine_libconfig_sub_pre > 0) {
+ int (*preHookFunc) (struct config_setting_t **r, const char **name, const char **source);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_readdb_refine_libconfig_sub_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_PRIV__refine_readdb_refine_libconfig_sub_pre[hIndex].func;
+ retVal___ = preHookFunc(&r, &name, &source);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.PRIV__refine.readdb_refine_libconfig_sub(r, name, source);
+ }
+ if (HPMHooks.count.HP_PRIV__refine_readdb_refine_libconfig_sub_post > 0) {
+ int (*postHookFunc) (int retVal___, struct config_setting_t *r, const char *name, const char *source);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_readdb_refine_libconfig_sub_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_PRIV__refine_readdb_refine_libconfig_sub_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, r, name, source);
+ }
+ }
+ return retVal___;
+}
+int HP_PRIV__refine_readdb_refine_libconfig(const char *filename) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_PRIV__refine_readdb_refine_libconfig_pre > 0) {
+ int (*preHookFunc) (const char **filename);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_readdb_refine_libconfig_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_PRIV__refine_readdb_refine_libconfig_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.PRIV__refine.readdb_refine_libconfig(filename);
+ }
+ if (HPMHooks.count.HP_PRIV__refine_readdb_refine_libconfig_post > 0) {
+ int (*postHookFunc) (int retVal___, const char *filename);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_readdb_refine_libconfig_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_PRIV__refine_readdb_refine_libconfig_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename);
+ }
+ }
+ return retVal___;
+}
+bool HP_PRIV__refine_announce_behavior_string2enum(const char *str, unsigned int *result) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_PRIV__refine_announce_behavior_string2enum_pre > 0) {
+ bool (*preHookFunc) (const char **str, unsigned int **result);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_announce_behavior_string2enum_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_PRIV__refine_announce_behavior_string2enum_pre[hIndex].func;
+ retVal___ = preHookFunc(&str, &result);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.PRIV__refine.announce_behavior_string2enum(str, result);
+ }
+ if (HPMHooks.count.HP_PRIV__refine_announce_behavior_string2enum_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *str, unsigned int *result);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_announce_behavior_string2enum_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_PRIV__refine_announce_behavior_string2enum_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, str, result);
+ }
+ }
+ return retVal___;
+}
+bool HP_PRIV__refine_failure_behavior_string2enum(const char *str, enum refine_ui_failure_behavior *result) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_PRIV__refine_failure_behavior_string2enum_pre > 0) {
+ bool (*preHookFunc) (const char **str, enum refine_ui_failure_behavior **result);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_failure_behavior_string2enum_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_PRIV__refine_failure_behavior_string2enum_pre[hIndex].func;
+ retVal___ = preHookFunc(&str, &result);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.PRIV__refine.failure_behavior_string2enum(str, result);
+ }
+ if (HPMHooks.count.HP_PRIV__refine_failure_behavior_string2enum_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *str, enum refine_ui_failure_behavior *result);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_failure_behavior_string2enum_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_PRIV__refine_failure_behavior_string2enum_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, str, result);
+ }
+ }
+ return retVal___;
+}
+bool HP_PRIV__refine_readdb_refinery_ui_settings_items(const struct config_setting_t *elem, struct s_refine_requirement *req, const char *name, const char *source) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_items_pre > 0) {
+ bool (*preHookFunc) (const struct config_setting_t **elem, struct s_refine_requirement **req, const char **name, const char **source);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_items_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_PRIV__refine_readdb_refinery_ui_settings_items_pre[hIndex].func;
+ retVal___ = preHookFunc(&elem, &req, &name, &source);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.PRIV__refine.readdb_refinery_ui_settings_items(elem, req, name, source);
+ }
+ if (HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_items_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const struct config_setting_t *elem, struct s_refine_requirement *req, const char *name, const char *source);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_items_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_PRIV__refine_readdb_refinery_ui_settings_items_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, elem, req, name, source);
+ }
+ }
+ return retVal___;
+}
+bool HP_PRIV__refine_readdb_refinery_ui_settings_sub(const struct config_setting_t *elem, int type, const char *name, const char *source) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_sub_pre > 0) {
+ bool (*preHookFunc) (const struct config_setting_t **elem, int *type, const char **name, const char **source);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_sub_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_PRIV__refine_readdb_refinery_ui_settings_sub_pre[hIndex].func;
+ retVal___ = preHookFunc(&elem, &type, &name, &source);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.PRIV__refine.readdb_refinery_ui_settings_sub(elem, type, name, source);
+ }
+ if (HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_sub_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const struct config_setting_t *elem, int type, const char *name, const char *source);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_sub_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_PRIV__refine_readdb_refinery_ui_settings_sub_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, elem, type, name, source);
+ }
+ }
+ return retVal___;
+}
+int HP_PRIV__refine_readdb_refinery_ui_settings(const struct config_setting_t *r, int type, const char *name, const char *source) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if (HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_pre > 0) {
+ int (*preHookFunc) (const struct config_setting_t **r, int *type, const char **name, const char **source);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_PRIV__refine_readdb_refinery_ui_settings_pre[hIndex].func;
+ retVal___ = preHookFunc(&r, &type, &name, &source);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.PRIV__refine.readdb_refinery_ui_settings(r, type, name, source);
+ }
+ if (HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_post > 0) {
+ int (*postHookFunc) (int retVal___, const struct config_setting_t *r, int type, const char *name, const char *source);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_readdb_refinery_ui_settings_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_PRIV__refine_readdb_refinery_ui_settings_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, r, type, name, source);
+ }
+ }
+ return retVal___;
+}
+bool HP_PRIV__refine_is_refinable(struct map_session_data *sd, int item_index) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_PRIV__refine_is_refinable_pre > 0) {
+ bool (*preHookFunc) (struct map_session_data **sd, int *item_index);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_is_refinable_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_PRIV__refine_is_refinable_pre[hIndex].func;
+ retVal___ = preHookFunc(&sd, &item_index);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.PRIV__refine.is_refinable(sd, item_index);
+ }
+ if (HPMHooks.count.HP_PRIV__refine_is_refinable_post > 0) {
+ bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int item_index);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__refine_is_refinable_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_PRIV__refine_is_refinable_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, sd, item_index);
+ }
+ }
+ return retVal___;
+}
/* rnd_interface */
void HP_rnd_init(void) {
int hIndex = 0;
@@ -74267,15 +74827,15 @@ void HP_searchstore_clearremote(struct map_session_data *sd) {
}
return;
}
-bool HP_searchstore_result(struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine, const struct item_option *option) {
+bool HP_searchstore_result(struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine_level, const struct item_option *option) {
int hIndex = 0;
bool retVal___ = false;
if (HPMHooks.count.HP_searchstore_result_pre > 0) {
- bool (*preHookFunc) (struct map_session_data **sd, unsigned int *store_id, int *account_id, const char **store_name, int *nameid, unsigned short *amount, unsigned int *price, const int **card, unsigned char *refine, const struct item_option **option);
+ bool (*preHookFunc) (struct map_session_data **sd, unsigned int *store_id, int *account_id, const char **store_name, int *nameid, unsigned short *amount, unsigned int *price, const int **card, unsigned char *refine_level, const struct item_option **option);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_searchstore_result_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_searchstore_result_pre[hIndex].func;
- retVal___ = preHookFunc(&sd, &store_id, &account_id, &store_name, &nameid, &amount, &price, &card, &refine, &option);
+ retVal___ = preHookFunc(&sd, &store_id, &account_id, &store_name, &nameid, &amount, &price, &card, &refine_level, &option);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -74283,13 +74843,13 @@ bool HP_searchstore_result(struct map_session_data *sd, unsigned int store_id, i
}
}
{
- retVal___ = HPMHooks.source.searchstore.result(sd, store_id, account_id, store_name, nameid, amount, price, card, refine, option);
+ retVal___ = HPMHooks.source.searchstore.result(sd, store_id, account_id, store_name, nameid, amount, price, card, refine_level, option);
}
if (HPMHooks.count.HP_searchstore_result_post > 0) {
- bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine, const struct item_option *option);
+ bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine_level, const struct item_option *option);
for (hIndex = 0; hIndex < HPMHooks.count.HP_searchstore_result_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_searchstore_result_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, sd, store_id, account_id, store_name, nameid, amount, price, card, refine, option);
+ retVal___ = postHookFunc(retVal___, sd, store_id, account_id, store_name, nameid, amount, price, card, refine_level, option);
}
}
return retVal___;
@@ -82853,33 +83413,6 @@ void HP_status_final(void) {
}
return;
}
-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, 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, &type);
- }
- if (*HPMforce_return) {
- *HPMforce_return = false;
- return retVal___;
- }
- }
- {
- 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, 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, type);
- }
- }
- return retVal___;
-}
sc_type HP_status_skill2sc(int skill_id) {
int hIndex = 0;
sc_type retVal___ = SC_NONE;
@@ -85981,60 +86514,6 @@ bool HP_status_readdb_sizefix(char *fields[], int columns, int current) {
}
return retVal___;
}
-int HP_status_readdb_refine_libconfig(const char *filename) {
- int hIndex = 0;
- int retVal___ = 0;
- if (HPMHooks.count.HP_status_readdb_refine_libconfig_pre > 0) {
- int (*preHookFunc) (const char **filename);
- *HPMforce_return = false;
- for (hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_pre; hIndex++) {
- preHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_pre[hIndex].func;
- retVal___ = preHookFunc(&filename);
- }
- if (*HPMforce_return) {
- *HPMforce_return = false;
- return retVal___;
- }
- }
- {
- retVal___ = HPMHooks.source.status.readdb_refine_libconfig(filename);
- }
- if (HPMHooks.count.HP_status_readdb_refine_libconfig_post > 0) {
- int (*postHookFunc) (int retVal___, const char *filename);
- for (hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_post; hIndex++) {
- postHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, filename);
- }
- }
- return retVal___;
-}
-int HP_status_readdb_refine_libconfig_sub(struct config_setting_t *r, const char *name, const char *source) {
- int hIndex = 0;
- int retVal___ = 0;
- if (HPMHooks.count.HP_status_readdb_refine_libconfig_sub_pre > 0) {
- int (*preHookFunc) (struct config_setting_t **r, const char **name, const char **source);
- *HPMforce_return = false;
- for (hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_sub_pre; hIndex++) {
- preHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_sub_pre[hIndex].func;
- retVal___ = preHookFunc(&r, &name, &source);
- }
- if (*HPMforce_return) {
- *HPMforce_return = false;
- return retVal___;
- }
- }
- {
- retVal___ = HPMHooks.source.status.readdb_refine_libconfig_sub(r, name, source);
- }
- if (HPMHooks.count.HP_status_readdb_refine_libconfig_sub_post > 0) {
- int (*postHookFunc) (int retVal___, struct config_setting_t *r, const char *name, const char *source);
- for (hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_sub_post; hIndex++) {
- postHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_sub_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, r, name, source);
- }
- }
- return retVal___;
-}
bool HP_status_readdb_scconfig(char *fields[], int columns, int current) {
int hIndex = 0;
bool retVal___ = false;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.sources.inc b/src/plugins/HPMHooking/HPMHooking_map.sources.inc
index 59ee43ab7..786b60288 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.sources.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.sources.inc
@@ -73,6 +73,8 @@ HPMHooks.source.pc = *pc;
HPMHooks.source.libpcre = *libpcre;
HPMHooks.source.pet = *pet;
HPMHooks.source.quest = *quest;
+HPMHooks.source.refine = *refine;
+HPMHooks.source.PRIV__refine = *refine->p;
HPMHooks.source.rnd = *rnd;
HPMHooks.source.rodex = *rodex;
HPMHooks.source.script = *script;
diff --git a/vcproj-12/map-server.vcxproj b/vcproj-12/map-server.vcxproj
index 72bae9d97..34f55be49 100644
--- a/vcproj-12/map-server.vcxproj
+++ b/vcproj-12/map-server.vcxproj
@@ -213,6 +213,8 @@
<ClInclude Include="..\src\config\renewal.h" />
<ClInclude Include="..\src\config\secure.h" />
<ClInclude Include="..\src\config\classes\general.h" />
+ <ClInclude Include="..\src\map\refine.h" />
+ <ClInclude Include="..\src\map\refine.p.h" />
<ClInclude Include="..\src\map\rodex.h" />
<ClInclude Include="..\src\map\script.h" />
<ClInclude Include="..\src\map\searchstore.h" />
@@ -288,6 +290,7 @@
<ClCompile Include="..\src\map\pc_groups.c" />
<ClCompile Include="..\src\map\pet.c" />
<ClCompile Include="..\src\map\quest.c" />
+ <ClCompile Include="..\src\map\refine.c" />
<ClCompile Include="..\src\map\rodex.c" />
<ClCompile Include="..\src\map\script.c" />
<ClCompile Include="..\src\map\searchstore.c" />
diff --git a/vcproj-12/map-server.vcxproj.filters b/vcproj-12/map-server.vcxproj.filters
index 6734c65bf..aae670525 100644
--- a/vcproj-12/map-server.vcxproj.filters
+++ b/vcproj-12/map-server.vcxproj.filters
@@ -220,6 +220,9 @@
<ClCompile Include="..\src\map\rodex.c">
<Filter>map</Filter>
</ClCompile>
+ <ClCompile Include="..\src\map\refine.c">
+ <Filter>map</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\map\achievement.h">
@@ -501,6 +504,12 @@
<ClInclude Include="..\src\map\rodex.h">
<Filter>map</Filter>
</ClInclude>
+ <ClInclude Include="..\src\map\refine.p.h">
+ <Filter>map</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\map\refine.h">
+ <Filter>map</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="common">
diff --git a/vcproj-14/map-server.vcxproj b/vcproj-14/map-server.vcxproj
index b17990588..ed91f231d 100644
--- a/vcproj-14/map-server.vcxproj
+++ b/vcproj-14/map-server.vcxproj
@@ -211,6 +211,8 @@
<ClInclude Include="..\src\config\renewal.h" />
<ClInclude Include="..\src\config\secure.h" />
<ClInclude Include="..\src\config\classes\general.h" />
+ <ClInclude Include="..\src\map\refine.h" />
+ <ClInclude Include="..\src\map\refine.p.h" />
<ClInclude Include="..\src\map\rodex.h" />
<ClInclude Include="..\src\map\script.h" />
<ClInclude Include="..\src\map\searchstore.h" />
@@ -286,6 +288,7 @@
<ClCompile Include="..\src\map\pc_groups.c" />
<ClCompile Include="..\src\map\pet.c" />
<ClCompile Include="..\src\map\quest.c" />
+ <ClCompile Include="..\src\map\refine.c" />
<ClCompile Include="..\src\map\rodex.c" />
<ClCompile Include="..\src\map\script.c" />
<ClCompile Include="..\src\map\searchstore.c" />
diff --git a/vcproj-14/map-server.vcxproj.filters b/vcproj-14/map-server.vcxproj.filters
index c8e64d8fd..3f1b6ca4b 100644
--- a/vcproj-14/map-server.vcxproj.filters
+++ b/vcproj-14/map-server.vcxproj.filters
@@ -220,6 +220,9 @@
<ClCompile Include="..\src\map\clan.c">
<Filter>map</Filter>
</ClCompile>
+ <ClCompile Include="..\src\map\refine.c">
+ <Filter>map</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\map\achievement.h">
@@ -501,6 +504,12 @@
<ClInclude Include="..\src\map\clan.h">
<Filter>map</Filter>
</ClInclude>
+ <ClInclude Include="..\src\map\refine.h">
+ <Filter>map</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\map\refine.p.h">
+ <Filter>map</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="common">
diff --git a/vcproj-15/map-server.vcxproj b/vcproj-15/map-server.vcxproj
index c7a83fa39..8becb90cc 100644
--- a/vcproj-15/map-server.vcxproj
+++ b/vcproj-15/map-server.vcxproj
@@ -212,6 +212,8 @@
<ClInclude Include="..\src\config\renewal.h" />
<ClInclude Include="..\src\config\secure.h" />
<ClInclude Include="..\src\config\classes\general.h" />
+ <ClInclude Include="..\src\map\refine.h" />
+ <ClInclude Include="..\src\map\refine.p.h" />
<ClInclude Include="..\src\map\rodex.h" />
<ClInclude Include="..\src\map\script.h" />
<ClInclude Include="..\src\map\searchstore.h" />
@@ -287,6 +289,7 @@
<ClCompile Include="..\src\map\pc_groups.c" />
<ClCompile Include="..\src\map\pet.c" />
<ClCompile Include="..\src\map\quest.c" />
+ <ClCompile Include="..\src\map\refine.c" />
<ClCompile Include="..\src\map\rodex.c" />
<ClCompile Include="..\src\map\script.c" />
<ClCompile Include="..\src\map\searchstore.c" />
diff --git a/vcproj-15/map-server.vcxproj.filters b/vcproj-15/map-server.vcxproj.filters
index 2a3d1b489..087a700e9 100644
--- a/vcproj-15/map-server.vcxproj.filters
+++ b/vcproj-15/map-server.vcxproj.filters
@@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\src\map\achievement.c">
- <Filter>map</Filter>
+ <Filter>map</Filter>
</ClCompile>
<ClCompile Include="..\src\map\atcommand.c">
<Filter>map</Filter>
@@ -220,6 +220,9 @@
<ClCompile Include="..\src\map\rodex.c">
<Filter>map</Filter>
</ClCompile>
+ <ClCompile Include="..\src\map\refine.c">
+ <Filter>map</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\map\achievement.h">
@@ -501,6 +504,12 @@
<ClInclude Include="..\src\map\rodex.h">
<Filter>map</Filter>
</ClInclude>
+ <ClInclude Include="..\src\map\refine.p.h">
+ <Filter>map</Filter>
+ </ClInclude>
+ <ClInclude Include="..\src\map\refine.h">
+ <Filter>map</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="common">