summaryrefslogtreecommitdiff
path: root/npc/craft/options.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-05-30 15:46:44 -0300
committerJesusaves <cpntb1@ymail.com>2019-05-30 15:46:44 -0300
commit890700b108fd4f1ea0b748b6a4eb0b49d85c90ab (patch)
treee41ad6100887aba2acd4a3a7bc304b3ef5390a6b /npc/craft/options.txt
parentddb4c03f64d652f941174c22715d56a25ed51e2f (diff)
downloadserverdata-890700b108fd4f1ea0b748b6a4eb0b49d85c90ab.tar.gz
serverdata-890700b108fd4f1ea0b748b6a4eb0b49d85c90ab.tar.bz2
serverdata-890700b108fd4f1ea0b748b6a4eb0b49d85c90ab.tar.xz
serverdata-890700b108fd4f1ea0b748b6a4eb0b49d85c90ab.zip
Several fixes and now NPCs have their own craft system.
So NPCs craft now may give bonuses too - existing craft bonuses maintaned.
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;
+}
+