diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/emap/init.c | 1 | ||||
-rw-r--r-- | src/emap/script.c | 51 | ||||
-rw-r--r-- | src/emap/script.h | 1 |
3 files changed, 53 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c index cdbe31a..7313d74 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -118,6 +118,7 @@ HPExport void plugin_init (void) addScriptCommand("isunitwalking", "?", isUnitWalking); addScriptCommand("failedrefindex", "i", failedRefIndex); addScriptCommand("downrefindex", "ii", downRefIndex); + addScriptCommand("successrefindex", "ii", successRefIndex); do_init_langs(); 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; +} diff --git a/src/emap/script.h b/src/emap/script.h index 4ce5ec2..3cf023a 100644 --- a/src/emap/script.h +++ b/src/emap/script.h @@ -46,5 +46,6 @@ BUILDIN(clientCommand); BUILDIN(isUnitWalking); BUILDIN(failedRefIndex); BUILDIN(downRefIndex); +BUILDIN(successRefIndex); #endif // EVOL_MAP_SCRIPT |