From c499870528356e28327206fa6380b4ca2d17cab2 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 26 May 2020 23:23:32 -0300 Subject: Tweaking: Try to improve a bit memory and CPU usage --- npc/craft/tweak.txt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'npc/craft') diff --git a/npc/craft/tweak.txt b/npc/craft/tweak.txt index ef1614e3d..35022d1af 100644 --- a/npc/craft/tweak.txt +++ b/npc/craft/tweak.txt @@ -60,24 +60,27 @@ function script SmithTweakSystem { if (!csys_Confirm(.@id)) return false; - // If the item have no bonuses - fail - setarray .@AlwaysTweaks, BlacksmithAxe, Dustynator, Lightbringer, - DemureAxe, Tyranny, Runestaff, AegisShield; + // Collect the item ID delinventorylist(); getinventorylist(); .@x=@inventorylist_id[.@id]; - if (getitemoptionidbyindex(.@id, 0) <= 0 && !is_master() && array_find(.@AlwaysTweaks, .@x) < 0) { - mesc l("This item have no bonuses, and cannot be tweaked."), 1; - return false; - } - // No duplicates if (countitem(.@x) > 1) { mesc l("You are carrying duplicates of the same item. Sorry, but I have no idea which one you want to tweak."), 1; return false; } + // If the item have no bonuses - fail + setarray .@AlwaysTweaks, BlacksmithAxe, Dustynator, Lightbringer, + DemureAxe, Tyranny, Runestaff, AegisShield; + + // Tweaked items + if (getitemoptionidbyindex(.@id, 0) <= 0 && !is_master() && array_find(.@AlwaysTweaks, .@x) < 0) { + mesc l("This item have no bonuses, and cannot be tweaked."), 1; + return false; + } + // Take the money and AP away POL_PlayerMoney(.@price); SMITH_TWEAKS+=1; -- cgit v1.2.3-60-g2f50