summaryrefslogtreecommitdiff
path: root/npc/craft
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-05-27 16:51:27 -0300
committerJesusaves <cpntb1@ymail.com>2019-05-27 16:51:27 -0300
commite8d53b9eecd171acf1461795dd589af16a506a4a (patch)
tree53367c3bda4346c32ead647dbe6d5c4982a9f8be /npc/craft
parentf9b53e1fd26eea3a895d8712813f3daab70986b8 (diff)
downloadserverdata-e8d53b9eecd171acf1461795dd589af16a506a4a.tar.gz
serverdata-e8d53b9eecd171acf1461795dd589af16a506a4a.tar.bz2
serverdata-e8d53b9eecd171acf1461795dd589af16a506a4a.tar.xz
serverdata-e8d53b9eecd171acf1461795dd589af16a506a4a.zip
Testing options craft system... Far from ready or usable
Diffstat (limited to 'npc/craft')
-rw-r--r--npc/craft/options.txt36
-rw-r--r--npc/craft/tweak.txt26
2 files changed, 36 insertions, 26 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);
diff --git a/npc/craft/tweak.txt b/npc/craft/tweak.txt
index c6d966f4e..d46a80db6 100644
--- a/npc/craft/tweak.txt
+++ b/npc/craft/tweak.txt
@@ -21,32 +21,22 @@ function script SmithTweakSystem {
.@id=requestitemindex();
mes "";
- if (.@id < 0)
+ // Ask player to confirm
+ if (!csys_Confirm(.@id))
return false;
- // *getequipisenableopt(<equipment slot>) → cannot use here
- // Not an equipment
- if (!getiteminfo(.@id, ITEMINFO_LOC))
- return false;
-
-
- // Clear all five options
- setitemoptionbyindex(.@id, 0, 0, 0);
- setitemoptionbyindex(.@id, 1, 0, 0);
- setitemoptionbyindex(.@id, 2, 0, 0);
- setitemoptionbyindex(.@id, 3, 0, 0);
- setitemoptionbyindex(.@id, 4, 0, 0);
-
// Check if you fail
- if (rand(0,10000) < 200) {
+ if (!csys_Check(.@id)) {
mesc l("ITEM BREAKS, ALL OPTIONS LOST!"), 1;
return false;
}
// Eh, apply some stuff for testing
- setitemoptionbyindex(.@id, 0, VAR_MAXHPAMOUNT, 2000);
- setitemoptionbyindex(.@id, 1, VAR_STRAMOUNT, 10);
- setitemoptionbyindex(.@id, 2, VAR_VITAMOUNT, -5);
+ if (is_gm() && !CRAFTSYS_CURRENT) {
+ CRAFTSYS_CURRENT=CRGROUP_BASE;
+ CRAFTSYS[CRGROUP_BASE]=10;
+ }
+ csys_Apply(.@id);
mesc l("SUCCESS!"), 3;
return true;
}