From a720df5cdc94819d7a6d47df013b900f8286d2eb Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 15 Apr 2021 15:23:24 -0300 Subject: Transmutation Magic, Initial Version --- npc/magic/config.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'npc/magic/config.txt') diff --git a/npc/magic/config.txt b/npc/magic/config.txt index a179982c..2a6a9559 100644 --- a/npc/magic/config.txt +++ b/npc/magic/config.txt @@ -401,6 +401,27 @@ function script mcharge { return; } +// transcheck( {item 1, amount 1}, {item 2, amount 2}... ) +// returns true upon success +function script transcheck { + if (getargcount() < 2 || getargcount() % 2 != 0) + return Exception("Faulty transcheck invoked - error"); + + // Count items + for (.@i=0;.@i < getargcount(); .@i++) { + if (countitem(getarg(.@i)) < getarg(.@i+1)) + return false; + .@i++; + } + + // Delete Items + for (.@i=0;.@i < getargcount(); .@i++) { + delitem getarg(.@i), getarg(.@i+1); + .@i++; + } + return true; +} + - script Magic Load NPC_HIDDEN,{ OnInit: end; -- cgit v1.2.3-70-g09d2