From 3b9733fa9e62c0fb999c817e93303f26b58d5d13 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 16 Jan 2024 22:53:51 -0300 Subject: Add extra powerful item manipulation commands --- npc/commands/rent.txt | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'npc/commands') diff --git a/npc/commands/rent.txt b/npc/commands/rent.txt index 2be2ccc61..8417a04e4 100644 --- a/npc/commands/rent.txt +++ b/npc/commands/rent.txt @@ -27,8 +27,68 @@ OnCall: rentitem(.@item, .@time); end; +OnCraftBypass: + if (getarraysize(.@atcmd_parameters$) < 8) { + dispbottom l("Usage: @craft item opt1 val1 opt2 val2 opt3 val3 opt4 val4"); + end; + } + + .@item=atoi(.@atcmd_parameters$[0]); + .@opt1=atoi(.@atcmd_parameters$[1]); + .@val1=atoi(.@atcmd_parameters$[2]); + .@opt2=atoi(.@atcmd_parameters$[3]); + .@val2=atoi(.@atcmd_parameters$[4]); + .@opt3=atoi(.@atcmd_parameters$[5]); + .@val3=atoi(.@atcmd_parameters$[6]); + .@opt4=atoi(.@atcmd_parameters$[7]); + .@val4=atoi(.@atcmd_parameters$[8]); + CsysNpcCraft(.@item, .@opt1, .@val1, .@opt2, .@val2, + .@opt3, .@val3, .@opt4, .@val4); + end; + +OnCraftSuper: + if (getarraysize(.@atcmd_parameters$) < 8) { + dispbottom l("Usage: @craft2 item refine opt1 val1 opt2 val2 opt3 val3 opt4 val4 opt5 val5"); + end; + } + .@item=atoi(.@atcmd_parameters$[0]); + .@refi=atoi(.@atcmd_parameters$[1]); + .@crd1=atoi(.@atcmd_parameters$[2]); + .@crd2=atoi(.@atcmd_parameters$[3]); + .@crd3=atoi(.@atcmd_parameters$[4]); + .@crd4=atoi(.@atcmd_parameters$[5]); + .@opt1=atoi(.@atcmd_parameters$[6]); + .@val1=atoi(.@atcmd_parameters$[7]); + .@opt2=atoi(.@atcmd_parameters$[8]); + .@val2=atoi(.@atcmd_parameters$[9]); + .@opt3=atoi(.@atcmd_parameters$[10]); + .@val3=atoi(.@atcmd_parameters$[11]); + .@opt4=atoi(.@atcmd_parameters$[12]); + .@val4=atoi(.@atcmd_parameters$[13]); + .@opt5=atoi(.@atcmd_parameters$[14]); + .@val5=atoi(.@atcmd_parameters$[15]); + getitem(.@item, 1, 1, .@refi, 0, .@crd1, .@crd2, .@crd3, .@crd4); + delinventorylist(); // Needed, because we'll rely on rfind() + getinventorylist(); + .@index=array_rfind(@inventorylist_id, .@item); + + // Apply the bonuses if needed + if (.@opt1) + setitemoptionbyindex(.@index, 0, .@opt1, .@val1); + if (.@opt2) + setitemoptionbyindex(.@index, 1, .@opt2, .@val2); + if (.@opt3) + setitemoptionbyindex(.@index, 2, .@opt3, .@val3); + if (.@opt4) + setitemoptionbyindex(.@index, 3, .@opt4, .@val4); + if (.@opt5) + setitemoptionbyindex(.@index, 4, .@opt5, .@val5); + end; + OnInit: bindatcmd "rentitem", "@rentitem::OnCall", 80, 99, 1; + bindatcmd "craft", "@rentitem::OnCraftBypass", 99, 99, 1; + bindatcmd "craft2", "@rentitem::OnCraftSuper", 99, 99, 1; end; } -- cgit v1.2.3-70-g09d2