summaryrefslogtreecommitdiff
path: root/npc/functions/craft/alchemy.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-03-13 09:45:01 -0300
committerJesusaves <cpntb1@ymail.com>2019-03-13 09:45:01 -0300
commit0e6ee986dccd10a025088711a5bb58756bd70bcc (patch)
treeb0b11ae3efe297943cf5db4ff5d166917cd38b12 /npc/functions/craft/alchemy.txt
parent9dd7472d72c318c2b4f30f8c806872fc0ca9b6fe (diff)
downloadserverdata-0e6ee986dccd10a025088711a5bb58756bd70bcc.tar.gz
serverdata-0e6ee986dccd10a025088711a5bb58756bd70bcc.tar.bz2
serverdata-0e6ee986dccd10a025088711a5bb58756bd70bcc.tar.xz
serverdata-0e6ee986dccd10a025088711a5bb58756bd70bcc.zip
Implement Alchemy System for Xanthem's House.
Now he only needs to buy--err, find the recipes :>
Diffstat (limited to 'npc/functions/craft/alchemy.txt')
-rw-r--r--npc/functions/craft/alchemy.txt44
1 files changed, 44 insertions, 0 deletions
diff --git a/npc/functions/craft/alchemy.txt b/npc/functions/craft/alchemy.txt
new file mode 100644
index 000000000..d0b8efa01
--- /dev/null
+++ b/npc/functions/craft/alchemy.txt
@@ -0,0 +1,44 @@
+// TMW2 Script
+// Author:
+// Jesusalva
+// Description:
+// Alchemy System (Player, Guild, NPC)
+// Notes:
+// Base for Evol MR
+
+// Usage: AlchemySystem ({scope})
+// Scopes: CRAFT_NPC, CRAFT_PLAYER, CRAFT_GUILD
+// If an invalid scope is passed, .knowledge won't be set but will be required
+// Returns true on success, false on failure
+function script AlchemySystem {
+ // Set .scope, .knowledge and .success
+ .scope=getarg(0, CRAFT_PLAYER);
+ if (.scope == CRAFT_PLAYER)
+ copyarray(.knowledge,RECIPES_ALCHEMY,getarraysize(RECIPES_ALCHEMY));
+ else if (.scope == CRAFT_GUILD)
+ copyarray(.knowledge,$@RECIPES_ALCHEMY[getcharid(2)],getarraysize($@RECIPES_ALCHEMY[getcharid(2)]));
+ .success=false;
+
+ setskin "craft2";
+ .@var$ = requestcraft(2);
+ .@craft = initcraft(.@var$);
+ .@entry = findcraftentry(.@craft, CRAFT_ALCHEMY);
+ if (debug || $@GM_OVERRIDE) mes "found craft entry: " + .@entry;
+ if (debug || $@GM_OVERRIDE) mes "knowledge value: " + .knowledge[.@entry];
+ if (.@entry < 0) {
+ .success=false;
+ } else {
+ // Check against COOKING_RECIPES
+ // using CraftCarpCocktail for example (Craft ID)
+ // Checking somehow if you know it (array_find?)
+ if (.scope == CRAFT_NPC || .knowledge[.@entry]) {
+ usecraft .@craft;
+ .success=true;
+ } else {
+ .success=false;
+ }
+ }
+ deletecraft .@craft;
+ setskin "";
+ return .success;
+}