summaryrefslogtreecommitdiff
path: root/src/emap/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-22 01:05:48 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-22 01:05:48 +0300
commit3fde4db8cdc341839282e6c521c0a9214ad23a7c (patch)
tree443d3e893f152dcdadae9456dcd7a8be4fb2c5b5 /src/emap/script.c
parent6f0de26cf8919b92000857a065ad2b0e86167994 (diff)
downloadevol-hercules-3fde4db8cdc341839282e6c521c0a9214ad23a7c.tar.gz
evol-hercules-3fde4db8cdc341839282e6c521c0a9214ad23a7c.tar.bz2
evol-hercules-3fde4db8cdc341839282e6c521c0a9214ad23a7c.tar.xz
evol-hercules-3fde4db8cdc341839282e6c521c0a9214ad23a7c.zip
Add script command successrefindex for success item refine by index.
New script command: successrefindex index, num; index - inventory index num - how many levels to up. Example: successrefindex .@index, 3;
Diffstat (limited to 'src/emap/script.c')
-rw-r--r--src/emap/script.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/emap/script.c b/src/emap/script.c
index 40d0473..8c0b15c 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -35,6 +35,11 @@
#include "emap/struct/sessionext.h"
#include "emap/utils/formatutils.h"
+uint32 MakeDWord(uint16 word0, uint16 word1)
+{
+ return ((uint32)(word0)) | ((uint32)(word1 << 0x10));
+}
+
BUILDIN(l)
{
format_sub(st, 1);
@@ -1306,3 +1311,49 @@ BUILDIN(downRefIndex)
clif->misceffect(&sd->bl, 2);
return true;
}
+
+BUILDIN(successRefIndex)
+{
+ getSD()
+ getInventoryIndex(2)
+
+ if (sd->status.inventory[n].nameid <= 0 || sd->status.inventory[n].amount <= 0)
+ return false;
+
+ const int up = script_getnum(st, 3);
+
+ logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[n],sd->inventory_data[n]);
+
+ if (sd->status.inventory[n].refine >= MAX_REFINE)
+ return true;
+
+ sd->status.inventory[n].refine += up;
+ sd->status.inventory[n].refine = cap_value( sd->status.inventory[n].refine, 0, MAX_REFINE);
+ if (sd->status.inventory[n].equip)
+ pc->unequipitem(sd, n, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE);
+ clif->refine(sd->fd, 0, n, sd->status.inventory[n].refine);
+ clif->delitem(sd, n, 1, DELITEM_MATERIALCHANGE);
+ logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[n],sd->inventory_data[n]);
+ clif->additem(sd, n, 1, 0);
+ clif->misceffect(&sd->bl, 3);
+
+ if (sd->status.inventory[n].refine == 10 &&
+ sd->status.inventory[n].card[0] == CARD0_FORGE &&
+ sd->status.char_id == (int)MakeDWord(sd->status.inventory[n].card[2], sd->status.inventory[n].card[3]))
+ { // Fame point system [DracoRPG]
+ switch (sd->inventory_data[n]->wlv)
+ {
+ case 1:
+ pc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
+ break;
+ case 2:
+ pc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
+ break;
+ case 3:
+ pc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
+ break;
+ }
+ }
+
+ return true;
+}