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.txt69
1 files changed, 69 insertions, 0 deletions
diff --git a/npc/craft/options.txt b/npc/craft/options.txt
index 02b088e32..8e6d61edd 100644
--- a/npc/craft/options.txt
+++ b/npc/craft/options.txt
@@ -695,3 +695,72 @@ function script csysGUI_RaiseOpt {
return false;
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+////////////////////////////////////////
+/////////////////
+///////
+// Misc Functions for Options Craft
+
+// CsysNpcCraft( itemid, {bonus 1, value 1], {bonus 2, value 2}... )
+// Create a craft item in a NPC's stead. Needless to say, never fails.
+function script CsysNpcCraft {
+ // Illegal param number
+ if (getargcount() % 2 != 1)
+ return Exception("Invalid craft NPC argument count", RB_DEFAULT|RB_IRCBROADCAST);
+
+ // Setup variables
+ .@it=getarg(0);
+ .@opt1=getarg(1,0);
+ .@val1=getarg(2,0);
+ .@opt2=getarg(3,0);
+ .@val2=getarg(4,0);
+ .@opt3=getarg(5,0);
+ .@val3=getarg(6,0);
+ .@opt4=getarg(7,0);
+ .@val4=getarg(8,0);
+ .@opt5=getarg(9,0);
+ .@val5=getarg(10,0);
+
+ getitem(.@it, 1);
+ delinventorylist(); // Needed, because we'll rely on rfind()
+ getinventorylist();
+ .@index=array_rfind(@inventorylist_id, .@it);
+
+ // Apply the bonuses if needed
+ if (.@opt1)
+ setitemoptionbyindex(.@it, 0, .@opt1, .@val1);
+ if (.@opt2)
+ setitemoptionbyindex(.@it, 1, .@opt2, .@val2);
+ if (.@opt3)
+ setitemoptionbyindex(.@it, 2, .@opt3, .@val3);
+ if (.@opt4)
+ setitemoptionbyindex(.@it, 3, .@opt4, .@val4);
+ if (.@opt5)
+ setitemoptionbyindex(.@it, 4, .@opt5, .@val5);
+
+ return;
+}
+