From 890700b108fd4f1ea0b748b6a4eb0b49d85c90ab Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 30 May 2019 15:46:44 -0300 Subject: Several fixes and now NPCs have their own craft system. So NPCs craft now may give bonuses too - existing craft bonuses maintaned. --- npc/craft/options.txt | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'npc/craft') 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; +} + -- cgit v1.2.3-60-g2f50