summaryrefslogtreecommitdiff
path: root/npc/craft/options.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/craft/options.txt')
-rw-r--r--npc/craft/options.txt36
1 files changed, 28 insertions, 8 deletions
diff --git a/npc/craft/options.txt b/npc/craft/options.txt
index e9d7f87ec..0466b7d05 100644
--- a/npc/craft/options.txt
+++ b/npc/craft/options.txt
@@ -117,6 +117,29 @@ function script csys_Generate {
//return Exception("Invalid ID");
}
+// Confirms if player really wants to tweak a craft.
+// Do not cast after new crafts. Returns false to stop script.
+// csys_Confirm( invindex )
+function script csys_Confirm {
+ .@id=getarg(0);
+
+ // Sanitize input
+ if (.@id < 0)
+ return false;
+
+ // *getequipisenableopt(<equipment slot>) → cannot use here
+ // Not an equipment
+ if (!getiteminfo(.@id, ITEMINFO_LOC))
+ return false;
+
+ mesc l("Really try to tweak this item? All current options will be deleted.");
+ next;
+ if (askyesno() == ASK_NO)
+ return false;
+
+ return true;
+}
+
// Check if you'll have success in applying options or not
// Returns true if you was successful, and also cleans previous options
// If you only want cleaning, just disregard the output.
@@ -140,18 +163,15 @@ function script csys_Check {
// Attribute item options
// Does NOT performs success chance check, and can be used by NPC
-// csys_Apply( invindex{, lvl} )
+// csys_Apply( invindex{, lvl, scope} )
function script csys_Apply {
.@id=getarg(0);
.@lv=getarg(1, getskilllv(TMW2_CRAFT));
+ .@sc=getarg(1, CRAFTSYS_CURRENT);
- csys_Generate(CRAFTSYS_CURRENT);
- // It'll fill the following variables:
- // @csys_attr → Available attributes
- // @csys_penalty → Penalty attribute array
- //
- // use getarraysize(@csys_attr) to know how many are there.
- // Players can active the bonus groups they want to use (in future, TODO)
+ csys_Generate(.@sc);
+ // @csys_attr → Available attributes
+ // @csys_penalty → Penalty attribute array
// Shuffle the arrays
array_shuffle(@csys_attr);