Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="iso-8859-1" ?>
- <!DOCTYPE muclient>
- <muclient>
- <plugin name="Fern" author="Iorden" id="eee9954f248f3ed1f71daf33" language="Lua" purpose="Alchemy functions for Lusternia" save_state="y" date_written="2009-04-30 21:11:27" requires="4.37" version="1.0">
- <description trim="y">
- <![CDATA[ ALCHEMY SYSTEM ON
- turns on the system
- ALCHEMY SYSTEM OFF
- turns off the system
- BREW [<amount>] <potion> [TO <target container>]
- Brews the desired amount of potion and stores it on the selected container (keg by default).
- The ingredients must be carried on the inventory.
- for example:
- BREW 10 HEALTH TO KEG123456
- BREW 15 BODORU TO RIFT
- BREW 1 BROMIDE TO AMETHYST
- ]]>
- </description>
- </plugin>
- <!-- Get our standard constants
- -->
- <include name="constants.lua" />
- <!-- Triggers
- -->
- <triggers>
- <trigger enabled="y" group="Alchemy" match="^A (.*) alembic releases a sweet smelling cloud of white dust\, as the ingredients crystallize into sugar\.$" regexp="y" send_to="12" sequence="100">
- <send>AddTriggerEx ("", "You have recovered balance on all limbs.", "Alchemy:sugar()", 1+16384+32768, custom_colour.Custom15, 0, "", "", 12, 1) AnsiNote(ANSI(1,37).."GOT SUGAR"..ANSI(0))</send>
- </trigger>
- <trigger enabled="y" group="Alchemy" match="^The keg is full and cannot hold more\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
- <send>Alchemy:fail("4")</send>
- </trigger>
- <trigger enabled="y" group="Alchemy" match="^You do not possess a empty..$" omit_from_output="y" regexp="y" sequence="100" />
- <trigger enabled="y" group="Alchemy" match="^A (.*) alembic has no fluid in it.$" omit_from_output="y" regexp="y" sequence="100" />
- <trigger enabled="y" group="Alchemy" match="^I cannot tell what it is you wish to combine.$" omit_from_output="y" regexp="y" sequence="100" />
- <trigger enabled="y" group="Alchemy" match="^A (.*) alembic doesn\'t contain that\.$" omit_from_output="y" regexp="y" sequence="100" />
- <trigger enabled="y" group="Alchemy" match="^Sparkling motes of light dance within a (\w+) alembic\, which rattles and chirps with oddly bird\-like noises\. The ingredients within quickly vaporize\, their essence infusing into (.*)\.$" regexp="y" send_to="12" sequence="100">
- <send>Alchemy:container(0)</send>
- </trigger>
- <trigger enabled="y" group="Alchemy" match="^You must specify a valid alchemical ingredient\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
- <send>Alchemy:fail("1")</send>
- </trigger>
- <trigger enabled="y" group="Alchemy" match="^You do not have enough of that to put into the Alembic\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
- <send>Alchemy:fail("1")</send>
- </trigger>
- <trigger enabled="y" group="Alchemy" match="^You must be in an alchemical laboratory to do this\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
- <send>Alchemy:fail("3")</send>
- </trigger>
- <trigger enabled="y" group="Alchemy" match="^You are baffled by the complexity of that\, and wouldn\'t even know where to begin\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
- <send>Alchemy:fail("2")</send>
- </trigger>
- <trigger enabled="y" group="Alchemy" match="^An (\w+) vial is not empty\. You must empty it before you can fill it again\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
- <send>AnsiNote( ANSI(1,37,41).."Out of empty vials... DON'T FLUSH THE ALEMBIC"..ANSI(0))</send>
- </trigger>
- <trigger enabled="y" group="Alchemy" match="^Your energy reserves are too depleted to create this potion\.$" omit_from_output="y" regexp="y" send_to="12" sequence="100">
- <send>Alchemy:fail("6")</send>
- </trigger>
- <trigger enabled="y" group="Alchemy" match="^You put a (.*) in a brass alembic in preparation for amalgamation\.$" name="remove_checks" regexp="y" send_to="12" sequence="100">
- <send>Alchemy:remove_check("%1")</send>
- </trigger>
- </triggers>
- <!-- Aliases
- -->
- <aliases>
- <alias match="^AlchemyConfig time (\d*)$" enabled="y" group="Alchemy" regexp="y" send_to="12" ignore_case="y" sequence="100">
- <send>AnsiNote(ANSI(1,37).."Delay for error checking: %1"..ANSI(0)) Alchemy["failsafe_time"]=%1</send>
- </alias>
- <alias match="^Alchemy System (on|off)$" enabled="y" regexp="y" send_to="12" ignore_case="y" sequence="100">
- <send>Alchemy:activate("%1")</send>
- </alias>
- <alias match="^brew\s+((\d*)(\s+))?((vial|keg|unit)(\s+))?(\w+)(\s+to\s+(\w+))?\s*$" enabled="y" group="Alchemy" regexp="y" send_to="12" ignore_case="y" sequence="100">
- <send>Alchemy:brew("%2","%5","%7","%9")</send>
- </alias>
- </aliases>
- <!-- Script
- -->
- <script>
- <![CDATA[ --[[
- Lua script for the Alchemy System, needs more comments but I'm too lazy and this was made in a hurry so...
- --]]
- require "wait"
- if not Alchemy then -- Avoid re-initialization issues
- --loads of boring tables of data D:
- Skills = {
- ["basic"]="alchemy",
- ["brewmeister"]="brewmeister",
- ["lorecraft"]="lorecraft",
- ["solid"]="solid",
- ["rift"]="rift"
- }
- container_type_Table = {
- ["unit"]=1,
- ["vial"]=1,
- ["fill"]=1,
- ["keg"]=100,
- }
- Alchemy = {
- errors={},
- ["target_container"]="keg",
- ["potion"]="",
- ["failsafe_time"]=2,
- error_code = {
- ["0"]="Unknown error",
- ["1"]="You seem to be carrying insufficient supplies.",
- ["2"]="Seems that you are not skilled enough for brewing this potion.",
- ["3"]="You must be in an alchemical laboratory to do this.",
- ["4"]="-------Full container, DON'T FLUSH THE ALEMBIC--------",
- ["5"]="-------Operation interrupted--------",
- ["6"]="-------Out of power, get a powerstone or charge reserves at nexus--------"
- },
- alembic_check = {},
- -- basic alchemy
- salt={
- power = 0,
- Potion_Type = Skills.basic,
- ingredients={
- ["salt"] = 1
- },
- unriftables={}
- },
- sulfur={
- power= 0,
- Potion_Type = Skills.basic,
- ingredients={
- ["sulfur"]=1
- },
- unriftables={}
- },
- liniment={
- Potion_Type = Skills.basic,
- power=1,
- ingredients={
- ["arnica"]=4,
- ["chervil"]=2,
- ["yarrow"]=2,
- ["horehound"]=1,
- ["flax"]=2
- },
- unriftables={}
- },
- health={
- Potion_Type = Skills.basic,
- power=2,
- ingredients={
- ["galingale"]=8,
- ["sargassum"]=2,
- ["juniper"]=1,
- ["yarrow"]=1
- },
- unriftables={}
- },
- bromide={
- Potion_Type = Skills.basic,
- power=2,
- ingredients={
- ["rosehip"]=3,
- ["marjoram"]=3,
- ["weed"]=3,
- ["calamus"]=2,
- ["reishi"]=2
- },
- unriftables={}
- },
- quicksilver={
- Potion_Type = Skills.basic,
- power=0.5,
- ingredients={
- ["kafe"]=4,
- ["pennyroyal"]=2,
- ["sage"]=4,
- ["mercury"]=1
- },
- unriftables={}
- },
- mana={
- Potion_Type = Skills.basic,
- power=2,
- ingredients={
- ["marjoram"]=6,
- ["flax"]=4,
- ["reishi"]=1,
- ["kafe"]=1
- },
- unriftables={}
- },
- antidote={
- Potion_Type = Skills.basic,
- power=3,
- ingredients={
- ["reishi"]=6,
- ["wormwood"]=6,
- ["myrtle"]=2
- },
- unriftables={}
- },
- mindoru={
- Potion_Type = Skills.rift,
- power=1,
- ingredients={
- ["chervil"]=10,
- ["mistletoe"]=1,
- ["juniper"]=10
- },
- unriftables={}
- },
- suporu={
- Potion_Type = Skills.rift,
- power=1,
- ingredients={
- ["chervil"]=10,
- ["mistletoe"]=1,
- ["weed"]=10
- },
- unriftables={}
- },
- bodoru={
- Potion_Type = Skills.rift,
- power=1,
- ingredients={
- ["chervil"]=10,
- ["mistletoe"]=1,
- ["colewort"]=10
- },
- unriftables={}
- },
- mending={
- Potion_Type = Skills.basic,
- power=3,
- ingredients={
- ["arnica"]=5,
- ["coltsfoot"]=5,
- ["juniper"]=5,
- ["rosehip"]=3
- },
- unriftables={}
- },
- love={
- Potion_Type = Skills.basic,
- power=4,
- ingredients={
- ["rosehip"]=5,
- ["weed"]=5,
- ["marjoram"]=3,
- ["coltsfoot"]=3,
- ["faeleaf"]=1
- },
- unriftables={}
- },
- regeneration={
- Potion_Type = Skills.basic,
- power=3,
- ingredients={
- ["arnica"]=5,
- ["flax"]=5,
- ["mistletoe"]=3,
- ["sparkleberry"]=2,
- ["chervil"]=2,
- ["kombu"]=1
- },
- unriftables={}
- },
- allheale={
- Potion_Type = Skills.basic,
- power=5,
- ingredients={
- ["reishi"]=7,
- ["kombu"]=6,
- ["sargassum"]=5,
- ["arnica"]=3,
- ["yarrow"]=2,
- ["pennyroyal"]=2,
- ["sparkleberry"]=2,
- ["merbloom"]=2
- },
- unriftables={}
- },
- moonwater = {
- power = 5,
- Potion_Type = Skills.basic,
- ingredients={
- },
- unriftables={
- ["essence"] = 4
- }
- },
- nightsweats = {
- power = 5,
- Potion_Type = Skills.basic,
- ingredients={
- },
- unriftables={
- ["essence"] = 4
- }
- },
- unholywater = {
- power = 5,
- Potion_Type = Skills.basic,
- ingredients={
- },
- unriftables={
- ["essence"] = 4
- }
- },
- holywater = {
- power = 5,
- Potion_Type = Skills.basic,
- ingredients={
- },
- unriftables={
- ["essence"] = 4
- }
- },
- -- lorecraft
- fire = {
- power = 2,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["myrtle"] = 2,
- ["kafe"] = 2,
- ["horehound"] = 3,
- ["coltsfoot"] = 1,
- ["sage"] = 2
- },
- unriftables={}
- },
- jasmine = {
- power = 1,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["spices"] = 15
- },
- unriftables={}
- },
- frost = {
- power = 2,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["merbloom"] = 4,
- ["juniper"] = 2,
- ["kombu"] = 1,
- ["mistletoe"] = 1,
- ["sargassum"] = 1
- },
- unriftables={}
- },
- invisibility = {
- power = 2,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["kafe"] = 5,
- ["rosehip"] = 5,
- ["coltsfoot"] = 5
- },
- unriftables={}
- },
- vanilla = {
- power = 1,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["spices"] = 15
- },
- unriftables={}
- },
- galvanism = {
- power = 2,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["coltsfoot"] = 10,
- ["colewort"] = 5,
- ["arnica"] = 5
- },
- unriftables={}
- },
- sanguine = {
- power = 3,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["chervil"] = 5,
- ["yarrow"] = 5
- },
- unriftables={}
- },
- dragonsblood = {
- power = 1,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["spices"] = 15
- },
- unriftables={}
- },
- preservation = {
- power = 1,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["coltsfoot"] = 3,
- ["colewort"] = 10,
- ["flax"] = 2
- },
- unriftables={}
- },
- choleric = {
- power = 3,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["pennyroyal"] = 5,
- ["sage"] = 5
- },
- unriftables={}
- },
- sandalwood = {
- power = 1,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["spices"] = 15
- },
- unriftables={}
- },
- phlegmatic = {
- power = 3,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["horehound"] = 5,
- ["kombu"] = 5
- },
- unriftables={}
- },
- melancholic = {
- power = 3,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["myrtle"] = 5,
- ["galingale"] = 5
- },
- unriftables={}
- },
- musk = {
- power = 1,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["spices"] = 15
- },
- unriftables={}
- },
- sharpness = {
- power = 2,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["arnica"] = 5,
- ["kafe"] = 5,
- ["flax"] = 3,
- ["coltsfoot"] = 2
- },
- unriftables={}
- },
- heart = {
- power = 100,
- Potion_Type = Skills.solid,
- ingredients={
- ["gold"] = 100
- },
- unriftables={}
- },
- vitae = {
- power = 8,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["sparkleberry"] = 10,
- ["faeleaf"] = 10,
- ["mistletoe"] = 10,
- ["calamus"] = 5,
- ["merbloom"] = 5,
- ["galingale"] = 3
- },
- unriftables={}
- },
- philosopherstone = {
- power = 25,
- Potion_Type = Skills.solid,
- ingredients={
- ["gold"] = 10,
- ["silver"] = 10,
- ["platinum"] = 10,
- ["mercury"] = 10
- },
- unriftables={}
- },
- -- brewmeister
- palemalt = {
- power = 0.5,
- Potion_Type = Skills.rift,
- ingredients={
- ["grain"] = 3,
- ["sugar"] = 3
- },
- unriftables={}
- },
- absinthe = {
- power = 4,
- Potion_Type = Skills.lorecraft,
- ingredients={
- ["wormwood"] = 5,
- ["faeleaf"] = 3,
- ["mistletoe"] = 3,
- ["reishi"] = 2,
- },
- unriftables={
- ["dreamleech"] = 1
- }
- },
- ambermalt = {
- power = 2,
- Potion_Type = Skills.rift,
- ingredients={
- ["grain"] = 8,
- ["sugar"] = 3
- },
- unriftables={}
- },
- magicink = {
- power = 5,
- Potion_Type = Skills.brewmeister,
- ingredients={
- ["goldtint"] = 10,
- ["sparkleberry"] = 10
- },
- unriftables={}
- },
- whitetea = {
- power = 2,
- Potion_Type = Skills.rift,
- ingredients={
- ["rawtea"] = 10
- },
- unriftables={}
- },
- oolongtea = {
- power = 2,
- Potion_Type = Skills.rift,
- ingredients={
- ["rawtea"] = 10
- },
- unriftables={}
- },
- darkmalt = {
- power = 2,
- Potion_Type = Skills.rift,
- ingredients={
- ["grain"] = 15
- },
- unriftables={}
- },
- greentea = {
- power = 2,
- Potion_Type = Skills.rift,
- ingredients={
- ["rawtea"] = 10
- },
- unriftables={}
- },
- blacktea = {
- power = 2,
- Potion_Type = Skills.rift,
- ingredients={
- ["rawtea"] = 10
- },
- unriftables={}
- }
- }
- end
- function Alchemy:brew (amount, container_type, brew, target_container)
- --parse variables and set default values
- local size = 0
- Alchemy.errors={}
- --brewmeister beers
- if not (tonumber(brew) == nil) then
- Send("flush Alembic")
- Send("brew "..brew)
- return
- end
- if (brew=="stop") then
- Alchemy:fail("5")
- end
- --set defaults
- if (string.len(amount)==0) then
- amount = 10
- end
- if (string.len(container_type)==0) then
- container_type = "fill"
- end
- if (string.len(target_container)==0) then
- target_container = "keg"
- end
- Alchemy["target_container"]=target_container
- local note = "preparing to brew "..amount.." "..container_type
- if tonumber(amount)>1 then note = note.."s"
- end
- --clear checks
- for k,v in pairs(Alchemy.alembic_check) do
- Alchemy.alembic_check[k]=nil
- end
- -- main script
- brew = string.lower(brew)
- for Alchemy_item, _ in pairs(Alchemy) do
- if brew == Alchemy_item then
- brew = tostring(brew)
- Alchemy["potion"]=brew
- note = note.." of ".. brew .."..."
- AnsiNote(ANSI(1,37) .. note .. ANSI(0))
- Alchemy:main(brew,container_type_Table[container_type]*amount)
- return
- end
- end
- AnsiNote(ANSI(1,37) .. "hmm... are you sure this " .. brew .. " is a potion?" .. ANSI(0))
- end
- function Alchemy:check_supplies (brew,tobrew)
- local subtotal=tobrew
- local success=true
- for ingredient,quantity in pairs(Alchemy[brew].ingredients) do
- if gear:inv(ingredient)<tobrew then
- AnsiNote( ANSI(1,37,41).."Missing "..tobrew-gear:inv(ingredient).." "..ingredient.. ANSI(0))
- success=false
- end
- end
- return success
- end
- function Alchemy:alembic (brew,amount,action)
- if (action=="add") then
- Send("flush alembic")
- for ingredient,quantity in pairs(Alchemy[brew].ingredients) do
- --Send("outr "..quantity*amount.." "..ingredient)
- Send("combine "..ingredient.." fully")
- Send("add "..quantity*amount.." "..ingredient)
- Alchemy.alembic_check[ingredient]=1
- --Note(ingredient.." "..Alchemy.alembic_check[ingredient])
- end
- for ingredient,quantity in pairs(Alchemy[brew].unriftables) do
- for times=1,quantity*amount do
- Send("add "..ingredient)
- if(Alchemy.alembic_check[ingredient]== nil)then
- Alchemy.alembic_check[ingredient]=1
- else
- Alchemy.alembic_check[ingredient]=Alchemy.alembic_check[ingredient]+1
- end
- --Note(ingredient.." "..Alchemy.alembic_check[ingredient])
- end
- end
- end
- if (action=="take") then
- for ingredient,quantity in pairs(Alchemy[brew].ingredients) do
- Send("take all "..ingredient.." from alembic")
- end
- for ingredient,quantity in pairs(Alchemy[brew].unriftables) do
- for times=1,quantity*amount do
- Send("take "..ingredient.." from alembic")
- end
- end
- end
- end
- function Alchemy:amalgamate (brew)
- if not (next(Alchemy.errors)==nil) then
- return false
- else
- Send("amalgamate "..brew)
- return true
- end
- end
- function Alchemy:fail(code)
- if Alchemy.errors[code]==nil then
- Alchemy.errors[code]=code
- end
- end
- function Alchemy:remove_check(wildcards)
- for ingredient,checks in pairs(Alchemy.alembic_check) do
- if(string.find(wildcards,ingredient)==nil) then
- Alchemy.alembic_check[ingredient]=Alchemy.alembic_check[ingredient]-1
- end
- end
- end
- function Alchemy:main(brew,tobrew)
- --if using treant, make use of those nifty variables to check if enough supplies in rift
- -- Actually scrap that, too much of a hassle an I can always get to it later
- --if(Alchemy:check_supplies(brew,tobrew)==true) or (IsTrigger("riftcheck__")==1 or 1==1) then
- if(true) then
- local batch=0
- --check powerstone charges goes here
- if(tobrew>10) then
- batch=10
- Alchemy:alembic(brew,batch,"add")
- wait.make (function ()
- wait.time(Alchemy["failsafe_time"])
- AnsiNote(ANSI(1,37).."readying alembic..." ..ANSI(0))
- if(not Alchemy:amalgamate(brew)) then
- Alchemy:alembic(brew,batch,"take")
- Alchemy:failmessage(brew,tobrew)
- --AnsiNote( ANSI(1,37,41).."Some error caused the operation to be interrupted with "..tobrew.." units of "..brew.." left to brew"..ANSI(0))
- Alchemy.errors={}
- else
- tobrew=tobrew-10
- wait.time(10)
- --insert fill container here
- Alchemy:main(brew,tobrew)
- end
- end)--function
- else
- batch=tobrew
- Alchemy:alembic(brew,batch,"add")
- wait.make (function ()
- wait.time(Alchemy["failsafe_time"])
- AnsiNote(ANSI(1,37).."readying alembic..."..ANSI(0))
- if(not Alchemy:amalgamate(brew)) then
- Alchemy:alembic(brew,amount,"take")
- Alchemy:failmessage(brew,tobrew)
- --AnsiNote( ANSI(1,37,41).."Some error caused the operation to be interrupted with "..tobrew.." units of "..brew.." left to brew"..ANSI(0))
- Alchemy.errors={}
- else
- wait.time(10)
- --insert fill container here
- AnsiNote( ANSI(1,37).."Finished successfully!!"..ANSI(0))
- end
- end)
- end
- end --if
- end
- function Alchemy:failmessage(brew,tobrew)
- for _,error_id in pairs(Alchemy.errors) do
- AnsiNote( ANSI(1,37,41)..Alchemy.error_code[error_id]..ANSI(0))
- if error_id=="1" then
- AnsiNote( ANSI(1,37,41).."The desired operation requires you to have the following ingredients in your inventory:"..ANSI(0))
- for ingredient,quantity in pairs(Alchemy[brew].ingredients) do
- AnsiNote( ANSI(1,37,41)..tobrew*quantity.." "..ingredient.. ANSI(0))
- end
- for ingredient,quantity in pairs(Alchemy[brew].unriftables) do
- AnsiNote( ANSI(1,37,41)..tobrew*quantity.." "..ingredient.. ANSI(0))
- end
- end
- end
- end
- function Alchemy:container(rift)
- if rift==1 then
- Send("take 10 "..Alchemy["potion"].." from alembic")
- Send("inr all "..Alchemy["potion"])
- return
- end
- if (Alchemy["target_container"]=="rift" or Alchemy[Alchemy["potion"]].Potion_Type==Skills.rift) then
- AddTriggerEx ("", "You have recovered balance on all limbs.", "Alchemy:container(1)", 1+16384+32768, custom_colour.Custom15, 0, "", "", 12, 1)
- return
- end
- if Alchemy[Alchemy["potion"]].Potion_Type==Skills.solid then
- Send("take all "..Alchemy["potion"].." from alembic")
- return
- end
- if Alchemy["target_container"]=="vial" then
- Alchemy["target_container"]="empty"
- end
- if Alchemy["target_container"]=="keg" then
- Send("fill "..Alchemy["target_container"])
- return
- end
- for times=1,10 do
- Send("fill "..Alchemy["target_container"])
- end
- end
- function Alchemy:sugar()
- Send("take 10 sugar from alembic")
- Send("inr all sugar")
- end
- function Alchemy:activate(enable)
- if enable == "on" then
- EnableTriggerGroup ("Alchemy", true)
- EnableAliasGroup ("Alchemy", true)
- AnsiNote(ANSI(1,37) .. "Alchemy system enabled" .. ANSI(0))
- else
- EnableTriggerGroup ("Alchemy", false)
- EnableAliasGroup ("Alchemy", false)
- AnsiNote(ANSI(1,37) .. "Alchemy system disabled" .. ANSI(0))
- end
- end
- ]]>
- </script>
- </muclient>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement