summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorsmokexyz <sagunkho@hotmail.com>2017-05-21 12:00:05 +0800
committersmokexyz <sagunkho@hotmail.com>2017-05-21 12:00:05 +0800
commite171deb58c7ebbc010d0a40b0e2e66651a0d7913 (patch)
tree08250f1ebcba2e0e03f2ad0a164f44a110d15de1 /src/map/script.c
parentbe118c7fad6df29dc691452ef511ac12fea37a06 (diff)
downloadhercules-e171deb58c7ebbc010d0a40b0e2e66651a0d7913.tar.gz
hercules-e171deb58c7ebbc010d0a40b0e2e66651a0d7913.tar.bz2
hercules-e171deb58c7ebbc010d0a40b0e2e66651a0d7913.tar.xz
hercules-e171deb58c7ebbc010d0a40b0e2e66651a0d7913.zip
Refine rate correction from kRO.
Normal Ores: http://ro.gnjoy.com/news/probability/View.asp?category=4&seq=1941553&curpage=1 Enriched Ores: http://ro.gnjoy.com/news/probability/View.asp?category=4&seq=1941565&curpage=1 Event Normal Ores: http://ro.gnjoy.com/news/probability/View.asp?category=4&seq=1941558&curpage=1 Event Enriched Ores: http://ro.gnjoy.com/news/probability/View.asp?category=4&seq=1941567&curpage=1
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c34
1 files changed, 26 insertions, 8 deletions
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);