diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-07-07 20:36:00 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-07-07 20:36:00 -0300 |
commit | 6967b9e0b63d19141d4f59b7933a960ac81916d0 (patch) | |
tree | 8ecd9cd2461f3598cb7faece71eb77162aa4ef2a /npc/functions/alchemy.txt | |
parent | 9877fd4ad81120af8e63e96d5d429092014dc017 (diff) | |
parent | 046c659193e1ca8bd13478678d1277df8bf9395c (diff) | |
download | serverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.tar.gz serverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.tar.bz2 serverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.tar.xz serverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.zip |
Merge branch 'master' into legacy
Override all files with 'master' version.
This version is meant to preserve git history as requested by bjorn.
Diffstat (limited to 'npc/functions/alchemy.txt')
-rw-r--r-- | npc/functions/alchemy.txt | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/npc/functions/alchemy.txt b/npc/functions/alchemy.txt new file mode 100644 index 00000000..ea77011e --- /dev/null +++ b/npc/functions/alchemy.txt @@ -0,0 +1,91 @@ +// TMW2 Script +// Author: +// Jesusalva +// Description: +// Alchemy System (oversimplified) + +// Usage: AlchemySystem () +// Returns true on success, false on failure +function script AlchemySystem { + .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 (.@entry < 0) { + .success=false; + } else { + // Determine how many units to make + // This code comes from Moubootaur Legends + // Where sponsors could make up to 25 units + // And you could configure a fixed number to + // avoid prompts... + // ... + // PS. This is not using freeloop() + // Max amount is limited for performance. + if (GSET_FIXED_ALCHEMY) { + .@m=limit(1, GSET_FIXED_ALCHEMY, 25); + } else { + .@max=(is_trusted() ? 25 : 10); + mesc l("How many to brew? (%d-%d)", 1, .@max); + input(.@m, 1, .@max); + } + // Alchemy loop + .@i=0; + while (.@i < .@m) { + .@s=validatecraft(.@craft); + // Could not validate (not enough resources) + if (!.@s) { + mesc l("Insufficient materials to continue."), 1; + if (.@i) + mesc l("Only %d/%d units were produced.", .@i, .@m), 1; + break; + } + .@s=usecraft(.@craft); + .@i++; + // Exploiting?! + if (!.@s) + break; + } + .success=true; + } + deletecraft .@craft; + setskin ""; + return .success; +} + +//////////////////////////////////////////////////////////////////////////////// +// Build the various crafting tables on the world +001-2,92,76,0 script #AlchemyTable000 NPC_NO_SPRITE,{ + title l("Alchemy Lab"); + mes l("This is an alchemy lab."); + mes l("With it, you can combine reagents together to create powerful potions."); + next; + mes b(l("Drag & drop 2 items from your inventory. All items used will be lost.")); + if (AlchemySystem()) + mesc l("Success!"), 3; + else + mesc l("That didn't work!"), 1; + close; + +OnInit: + .distance=2; + end; +} + +// Tonori Region (0~99) +001-2,92,89,0 duplicate(#AlchemyTable000) #AlchemyTable001 NPC_NO_SPRITE +001-2,98,76,0 duplicate(#AlchemyTable000) #AlchemyTable002 NPC_NO_SPRITE +001-2,98,89,0 duplicate(#AlchemyTable000) #AlchemyTable003 NPC_NO_SPRITE + +// Argaes Region (100~199) +026-2,35,117,0 duplicate(#AlchemyTable000) #AlchemyTable100 NPC_NO_SPRITE + +// Candor Region (200~299) +029-2,113,57,0 duplicate(#AlchemyTable000) #AlchemyTable200 NPC_NO_SPRITE + + + + |