summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/pre-re/refine_db.conf124
-rw-r--r--db/re/refine_db.conf324
-rw-r--r--npc/merchants/advanced_refiner.txt4
-rw-r--r--src/map/script.c34
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/status.c77
-rw-r--r--src/map/status.h12
7 files changed, 436 insertions, 141 deletions
diff --git a/db/pre-re/refine_db.conf b/db/pre-re/refine_db.conf
index 0d59c8faa..523c2605c 100644
--- a/db/pre-re/refine_db.conf
+++ b/db/pre-re/refine_db.conf
@@ -39,10 +39,10 @@ Armors/WeaponLevel1~4: { // Specifies weapon level or armor type
// Random bonus start level. This is only applied for weapons, and not displayed client-side.
Rates: { // Per level configuration of the refine rates.
Lv1~10: { // Level of refine
- Chance: value (int, optional, defaults to 100) // Chance of successful refine (100 = 100%)
+ NormalChance: value (int, optional, defaults to 100) // Chance of successful refine (100 = 100%)
Bonus: value (int, optional, defaults to 0) // Bonus for this level of refine
}
- // Note: Refine levels that use default values need not be listed. (Example: Lv1: Chance: 100 Bonus: 0)
+ // Note: Refine levels that use default values need not be listed. (Example: Lv1: NormalChance: 100 Bonus: 0)
}
}
**************************************************************************/
@@ -53,22 +53,40 @@ Armors: {
RandomBonusValue: 0
Rates: {
Lv5: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv6: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv7: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
}
Lv10: {
- Chance: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
}
}
}
@@ -78,13 +96,22 @@ WeaponLevel1: {
RandomBonusValue: 300
Rates: {
Lv8: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv9: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 55
}
}
}
@@ -94,16 +121,28 @@ WeaponLevel2: {
RandomBonusValue: 500
Rates: {
Lv7: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv8: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
}
}
}
@@ -113,19 +152,34 @@ WeaponLevel3: {
RandomBonusValue: 800
Rates: {
Lv6: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv7: {
- Chance: 50
+ NormalChance: 50
+ EnrichedChance: 80
+ EventNormalChance: 50
+ EventEnrichedChance: 90
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 70
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
}
}
}
@@ -135,22 +189,40 @@ WeaponLevel4: {
RandomBonusValue: 1300
Rates: {
Lv5: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv6: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv7: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
}
Lv10: {
- Chance: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
}
}
}
diff --git a/db/re/refine_db.conf b/db/re/refine_db.conf
index 927e2d6bf..3c0e66070 100644
--- a/db/re/refine_db.conf
+++ b/db/re/refine_db.conf
@@ -39,10 +39,10 @@ Armors/WeaponLevel1~4: { // Specifies weapon level or armor type
// Random bonus start level. This is only applied for weapons, and not displayed client-side.
Rates: { // Per level configuration of the refine rates.
Lv1~10: { // Level of refine
- Chance: value (int, optional, defaults to 100) // Chance of successful refine (100 = 100%)
+ NormalChance: value (int, optional, defaults to 100) // Chance of successful refine (100 = 100%)
Bonus: value (int, optional, defaults to 0) // Bonus for this level of refine
}
- // Note: Refine levels that use default values need not be listed. (Example: Lv1: Chance: 100 Bonus: 0)
+ // Note: Refine levels that use default values need not be listed. (Example: Lv1: NormalChance: 100 Bonus: 0)
}
}
// A note about renewal Armors, there may or may not be another bonus, according to iRO wiki: Every upgrade gives floor[( 3 + current upgrade ) / 4]
@@ -66,67 +66,105 @@ Armors: {
Bonus: 100
}
Lv5: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
Bonus: 200
}
Lv6: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
Bonus: 200
}
Lv7: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
Bonus: 200
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
Bonus: 200
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
Bonus: 300
}
Lv10: {
- Chance: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
Bonus: 300
}
Lv11: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 300
}
Lv12: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 300
}
Lv13: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
Bonus: 400
}
Lv14: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
Bonus: 400
}
Lv15: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 400
}
Lv16: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 400
}
Lv17: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
Bonus: 500
}
Lv18: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
Bonus: 500
}
Lv19: {
- Chance: 5
+ NormalChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
Bonus: 500
}
Lv20: {
- Chance: 5
+ NormalChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
Bonus: 500
}
}
@@ -137,47 +175,76 @@ WeaponLevel1: {
RandomBonusValue: 300
Rates: {
Lv8: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv9: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 55
}
Lv11: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv12: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv13: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv14: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv15: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 30
+ EventEnrichedChance: 30
}
Lv16: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 30
+ EventEnrichedChance: 30
Bonus: 300
}
Lv17: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 300
}
Lv18: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 300
}
Lv19: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 300
}
Lv20: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 300
}
}
@@ -188,50 +255,82 @@ WeaponLevel2: {
RandomBonusValue: 500
Rates: {
Lv7: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv8: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 85
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
}
Lv11: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv12: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv13: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv14: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv15: {
- Chance:18
+ NormalChance:18
+ EventNormalChance: 30
+ EventEnrichedChance: 30
}
Lv16: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 30
+ EventEnrichedChance: 30
Bonus: 600
}
Lv17: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 600
}
Lv18: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 600
}
Lv19: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 600
}
Lv20: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 600
}
}
@@ -242,53 +341,88 @@ WeaponLevel3: {
RandomBonusValue: 800
Rates: {
Lv6: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv7: {
- Chance: 50
+ NormalChance: 50
+ EnrichedChance: 80
+ EventNormalChance: 50
+ EventEnrichedChance: 90
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 70
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv10: {
- Chance: 20
+ NormalChance: 19
+ EnrichedChance: 30
+ EventNormalChance: 19
+ EventEnrichedChance: 45
}
Lv11: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv12: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 40
+ EventEnrichedChance: 40
}
Lv13: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv14: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 35
+ EventEnrichedChance: 35
}
Lv15: {
- Chance: 18
+ NormalChance: 18
+ EventNormalChance: 30
+ EventEnrichedChance: 30
}
Lv16: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 30
+ EventEnrichedChance: 30
Bonus: 900
}
Lv17: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 900
}
Lv18: {
- Chance: 17
+ NormalChance: 17
+ EventNormalChance: 20
+ EventEnrichedChance: 20
Bonus: 900
}
Lv19: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 900
}
Lv20: {
- Chance: 15
+ NormalChance: 15
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 900
}
}
@@ -299,56 +433,94 @@ WeaponLevel4: {
RandomBonusValue: 1400
Rates: {
Lv5: {
- Chance: 60
+ NormalChance: 60
+ EnrichedChance: 90
+ EventNormalChance: 60
+ EventEnrichedChance: 95
}
Lv6: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv7: {
- Chance: 40
+ NormalChance: 40
+ EnrichedChance: 70
+ EventNormalChance: 40
+ EventEnrichedChance: 80
}
Lv8: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 60
}
Lv9: {
- Chance: 20
+ NormalChance: 20
+ EnrichedChance: 40
+ EventNormalChance: 20
+ EventEnrichedChance: 50
}
Lv10: {
- Chance: 10
+ NormalChance: 9
+ EnrichedChance: 20
+ EventNormalChance: 9
+ EventEnrichedChance: 35
}
Lv11: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
}
Lv12: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 20
+ EventEnrichedChance: 20
}
Lv13: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
}
Lv14: {
- Chance: 8
+ NormalChance: 8
+ EventNormalChance: 16
+ EventEnrichedChance: 16
}
Lv15: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
}
Lv16: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 15
+ EventEnrichedChance: 15
Bonus: 1200
}
Lv17: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
Bonus: 1200
}
Lv18: {
- Chance: 7
+ NormalChance: 7
+ EventNormalChance: 14
+ EventEnrichedChance: 14
Bonus: 1200
}
Lv19: {
- Chance: 5
+ NormalChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
Bonus: 1200
}
Lv20: {
- Chance: 5
+ NormalChance: 5
+ EventNormalChance: 10
+ EventEnrichedChance: 10
Bonus: 1200
}
}
diff --git a/npc/merchants/advanced_refiner.txt b/npc/merchants/advanced_refiner.txt
index e75912f4c..0d53dab87 100644
--- a/npc/merchants/advanced_refiner.txt
+++ b/npc/merchants/advanced_refiner.txt
@@ -93,7 +93,7 @@ payon,157,146,6 script Suhnbi#cash 4_M_03,{
mes "[Suhnbi]";
mes "Clang! Clang! Clang!";
- if (getequippercentrefinery(.@part) > rand(100) || getequippercentrefinery(.@part) > rand(100)) {
+ if (getequippercentrefinery(.@part, true) > rand(100)) {
successrefitem .@part;
next;
emotion e_no1;
@@ -123,7 +123,7 @@ S_RefineValidate:
mes "Would you like to continue?";
next;
if(select("Yes", "No") == 1) {
- if (getequippercentrefinery(getarg(3)) < 100) {
+ if (getequippercentrefinery(getarg(3), true) < 100) {
if (getarg(0)) {
mes "[Suhnbi]";
mes "Wow!!";
diff --git a/src/map/script.c b/src/map/script.c
index 599285e1e..f90df31d8 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -9338,20 +9338,32 @@ BUILDIN(getequipweaponlv)
* 0 : false (max refine level or unequip..)
*------------------------------------------*/
BUILDIN(getequippercentrefinery) {
- int i = -1,num;
+ int i = -1, num;
struct map_session_data *sd;
+ int type = 0;
+
+ num = script_getnum(st, 2);
+ type = (script_hasdata(st, 3)) ? script_getnum(st, 3) : REFINE_CHANCE_TYPE_NORMAL;
- num = script_getnum(st,2);
sd = script->rid2sd(st);
- if( sd == NULL )
+ if (sd == NULL)
return true;
+ if (type < REFINE_CHANCE_TYPE_NORMAL || type >= REFINE_CHANCE_TYPE_MAX) {
+ ShowError("buildin_getequippercentrefinery: Invalid type (%d) provided!\n", type);
+ script_pushint(st, 0);
+ return false;
+ }
+
+
if (num > 0 && num <= ARRAYLENGTH(script->equip))
- i=pc->checkequip(sd,script->equip[num-1]);
- if(i >= 0 && sd->status.inventory[i].nameid && sd->status.inventory[i].refine < MAX_REFINE)
- script_pushint(st,status->get_refine_chance(itemdb_wlv(sd->status.inventory[i].nameid), (int)sd->status.inventory[i].refine));
+ i = pc->checkequip(sd, script->equip[num - 1]);
+
+ if (i >= 0 && sd->status.inventory[i].nameid != 0 && sd->status.inventory[i].refine < MAX_REFINE)
+ script_pushint(st,
+ status->get_refine_chance(itemdb_wlv(sd->status.inventory[i].nameid), (int) sd->status.inventory[i].refine, (enum refine_chance_type) type));
else
- script_pushint(st,0);
+ script_pushint(st, 0);
return true;
}
@@ -23316,7 +23328,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getequipisidentify,"i"),
BUILDIN_DEF(getequiprefinerycnt,"i"),
BUILDIN_DEF(getequipweaponlv,"i"),
- BUILDIN_DEF(getequippercentrefinery,"i"),
+ BUILDIN_DEF(getequippercentrefinery,"i?"),
BUILDIN_DEF(successrefitem,"i?"),
BUILDIN_DEF(failedrefitem,"i"),
BUILDIN_DEF(downrefitem,"i?"),
@@ -23959,6 +23971,12 @@ void script_hardcoded_constants(void)
script->set_constant("BL_CHAR",BL_CHAR,false, false);
script->set_constant("BL_ALL",BL_ALL,false, false);
+ script->constdb_comment("Refine Chance Types");
+ script->set_constant("REFINE_CHANCE_TYPE_NORMAL", REFINE_CHANCE_TYPE_NORMAL, false, false);
+ script->set_constant("REFINE_CHANCE_TYPE_ENRICHED", REFINE_CHANCE_TYPE_ENRICHED, false, false);
+ script->set_constant("REFINE_CHANCE_TYPE_E_NORMAL", REFINE_CHANCE_TYPE_E_NORMAL, false, false);
+ script->set_constant("REFINE_CHANCE_TYPE_E_ENRICHED", REFINE_CHANCE_TYPE_E_ENRICHED, false, false);
+
script->constdb_comment("Player permissions");
script->set_constant("PERM_TRADE", PC_PERM_TRADE, false, false);
script->set_constant("PERM_PARTY", PC_PERM_PARTY, false, false);
diff --git a/src/map/skill.c b/src/map/skill.c
index 714c2aa71..b70ddc055 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -15652,7 +15652,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
return;
}
- per = status->get_refine_chance(ditem->wlv, (int)item->refine) * 10;
+ per = status->get_refine_chance(ditem->wlv, (int)item->refine, REFINE_CHANCE_TYPE_NORMAL) * 10;
// Aegis leaked formula. [malufett]
if (sd->status.class == JOB_MECHANIC_T)
diff --git a/src/map/status.c b/src/map/status.c
index c3e5a3f40..7982b15eb 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -12860,13 +12860,17 @@ int status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data)
* @param refine The target refine level
* @return The chance to refine the item, in percent (0~100)
**/
-int status_get_refine_chance(enum refine_type wlv, int refine)
+int status_get_refine_chance(enum refine_type wlv, int refine, enum refine_chance_type type)
{
Assert_ret((int)wlv >= REFINE_TYPE_ARMOR && wlv < REFINE_TYPE_MAX);
- if ( refine < 0 || refine >= MAX_REFINE)
- return 0;
- return status->dbs->refine_info[wlv].chance[refine];
+ if (refine < 0 || refine >= MAX_REFINE)
+ return 0;
+
+ if (type >= REFINE_CHANCE_TYPE_MAX)
+ return 0;
+
+ return status->dbs->refine_info[wlv].chance[type][refine];
}
int status_get_sc_type(sc_type type)
@@ -13191,54 +13195,84 @@ int status_readdb_refine_libconfig_sub(struct config_setting_t *r, const char *n
if ((rate=libconfig->setting_get_member(r, "Rates")) != NULL && config_setting_is_group(rate)) {
struct config_setting_t *t = NULL;
bool duplicate[MAX_REFINE];
- int bonus[MAX_REFINE], rnd_bonus[MAX_REFINE], chance[MAX_REFINE];
- int i;
+ int bonus[MAX_REFINE], rnd_bonus[MAX_REFINE];
+ int chance[REFINE_CHANCE_TYPE_MAX][MAX_REFINE];
+ int i, j;
+
memset(&duplicate, 0, sizeof(duplicate));
memset(&bonus, 0, sizeof(bonus));
memset(&rnd_bonus, 0, sizeof(rnd_bonus));
- for (i = 0; i < MAX_REFINE; i++) {
- chance[i] = 100;
- }
+ for (i = 0; i < REFINE_CHANCE_TYPE_MAX; i++)
+ for (j = 0; j < MAX_REFINE; j++)
+ chance[i][j] = 100; // default value for all rates.
+
i = 0;
+ j = 0;
while ((t = libconfig->setting_get_elem(rate,i++)) != NULL && config_setting_is_group(t)) {
int level = 0, i32;
char *rlvl = config_setting_name(t);
memset(&lv, 0, sizeof(lv));
- if (!strspn(&rlvl[strlen(rlvl)-1], "0123456789") || (level = atoi(strncpy(lv, rlvl+2, 3))) <= 0) {
+
+ if (!strspn(&rlvl[strlen(rlvl) - 1], "0123456789") || (level = atoi(strncpy(lv, rlvl + 2, 3))) <= 0) {
ShowError("status_readdb_refine_libconfig_sub: Invalid refine level format '%s' for entry %s in \"%s\"... skipping.\n", rlvl, name, source);
continue;
}
+
if (level <= 0 || level > MAX_REFINE) {
ShowError("status_readdb_refine_libconfig_sub: Out of range refine level '%s' for entry %s in \"%s\"... skipping.\n", rlvl, name, source);
continue;
}
+
level--;
+
if (duplicate[level]) {
ShowWarning("status_readdb_refine_libconfig_sub: duplicate rate '%s' for entry %s in \"%s\", overwriting previous entry...\n", rlvl, name, source);
} else {
duplicate[level] = true;
}
- if (libconfig->setting_lookup_int(t, "Chance", &i32))
- chance[level] = i32;
+
+ if (libconfig->setting_lookup_int(t, "NormalChance", &i32) != 0)
+ chance[REFINE_CHANCE_TYPE_NORMAL][level] = i32;
+ else
+ chance[REFINE_CHANCE_TYPE_NORMAL][level] = 100;
+
+ if (libconfig->setting_lookup_int(t, "EnrichedChance", &i32) != 0)
+ chance[REFINE_CHANCE_TYPE_ENRICHED][level] = i32;
+ else
+ chance[REFINE_CHANCE_TYPE_ENRICHED][level] = level > 10 ? 0 : 100; // enriched ores up to +10 only.
+
+ if (libconfig->setting_lookup_int(t, "EventNormalChance", &i32) != 0)
+ chance[REFINE_CHANCE_TYPE_E_NORMAL][level] = i32;
+ else
+ chance[REFINE_CHANCE_TYPE_E_NORMAL][level] = 100;
+
+ if (libconfig->setting_lookup_int(t, "EventEnrichedChance", &i32) != 0)
+ chance[REFINE_CHANCE_TYPE_E_ENRICHED][level] = i32;
else
- chance[level] = 100;
- if (libconfig->setting_lookup_int(t, "Bonus", &i32))
+ chance[REFINE_CHANCE_TYPE_E_ENRICHED][level] = level > 10 ? 0 : 100; // enriched ores up to +10 only.
+
+ if (libconfig->setting_lookup_int(t, "Bonus", &i32) != 0)
bonus[level] += i32;
+
if (level >= rnd_bonus_lv - 1)
rnd_bonus[level] = rnd_bonus_v * (level - rnd_bonus_lv + 2);
}
for (i = 0; i < MAX_REFINE; i++) {
- status->dbs->refine_info[type].chance[i] = chance[i];
+ status->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_NORMAL][i] = chance[REFINE_CHANCE_TYPE_NORMAL][i];
+ status->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_E_NORMAL][i] = chance[REFINE_CHANCE_TYPE_E_NORMAL][i];
+ status->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_ENRICHED][i] = chance[REFINE_CHANCE_TYPE_ENRICHED][i];
+ status->dbs->refine_info[type].chance[REFINE_CHANCE_TYPE_E_ENRICHED][i] = chance[REFINE_CHANCE_TYPE_E_ENRICHED][i];
status->dbs->refine_info[type].randombonus_max[i] = rnd_bonus[i];
- bonus[i] += bonus_per_level + (i > 0 ? bonus[i-1] : 0);
+ bonus[i] += bonus_per_level + (i > 0 ? bonus[i - 1] : 0);
status->dbs->refine_info[type].bonus[i] = bonus[i];
}
} else {
ShowWarning("status_readdb_refine_libconfig_sub: Missing refine rates for entry '%s' in \"%s\", skipping.\n", name, source);
return 0;
}
- return type+1;
+
+ return type + 1;
}
/**
@@ -13332,15 +13366,6 @@ int status_readdb(void)
for(j = 0; j < MAX_SINGLE_WEAPON_TYPE; j++)
status->dbs->atkmods[i][j] = 100;
- // refine_db.txt
- for(i=0;i<ARRAYLENGTH(status->dbs->refine_info);i++) {
- for(j=0;j<MAX_REFINE; j++) {
- status->dbs->refine_info[i].chance[j] = 100;
- status->dbs->refine_info[i].bonus[j] = 0;
- status->dbs->refine_info[i].randombonus_max[j] = 0;
- }
- }
-
// read databases
//
sv->readdb(map->db_path, "job_db2.txt", ',', 1, 1+MAX_LEVEL, -1, status->readdb_job2);
diff --git a/src/map/status.h b/src/map/status.h
index 1496429a8..de21fa16c 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -2233,9 +2233,17 @@ struct status_change {
#define status_calc_elemental(ed, opt) (status->calc_bl_(&(ed)->bl, SCB_ALL, (opt)))
#define status_calc_npc(nd, opt) (status->calc_bl_(&(nd)->bl, SCB_ALL, (opt)))
+enum refine_chance_type {
+ REFINE_CHANCE_TYPE_NORMAL = 0, // Normal Chance
+ REFINE_CHANCE_TYPE_ENRICHED = 1, // Enriched Ore Chance
+ REFINE_CHANCE_TYPE_E_NORMAL = 2, // Event Normal Ore Chance
+ REFINE_CHANCE_TYPE_E_ENRICHED = 3, // Event Enriched Ore Chance
+ REFINE_CHANCE_TYPE_MAX
+};
+
// bonus values and upgrade chances for refining equipment
struct s_refine_info {
- int chance[MAX_REFINE]; // success chance
+ int chance[REFINE_CHANCE_TYPE_MAX][MAX_REFINE]; // success chance
int bonus[MAX_REFINE]; // cumulative fixed bonus damage
int randombonus_max[MAX_REFINE]; // cumulative maximum random bonus damage
};
@@ -2283,7 +2291,7 @@ struct status_interface {
int (*init) (bool minimal);
void (*final) (void);
/* funcs */
- int (*get_refine_chance) (enum refine_type wlv, int refine);
+ int (*get_refine_chance) (enum refine_type wlv, int refine, enum refine_chance_type type);
// for looking up associated data
sc_type (*skill2sc) (int skill_id);
int (*sc2skill) (sc_type sc);