<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<!-- Saved on Monday, August 07, 2006, 1:30 PM -->
<!-- MuClient version 3.74 -->

<!-- Plugin "PotionQuaffer v2" generated by Plugin Wizard -->

<muclient>
<plugin
   name="PotionQuafferv2"
   author="Onoitsu2/Bottomfeeder"
   id="59358039c72bc395fb31922e"
   language="Lua"
   purpose="Ease Potion Quaffing and Total Remaining and Reporting To Group"
   save_state="y"
   date_written="2006-08-07 12:30:21"
   requires="3.74"
   version="1.3"
   >
<description trim="n">
<![CDATA[
PotionQuafferv2 Helpfile
EQUAL SIGNS are OPTIONAL, and SPACES between command, equals, and value are also OPTIONAL!!
All Commands Are CaSe Insensitive!!

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Onoitsu2 did all the heavy lifting, I just worked out a couple bugs and added the buffpot
crap into the mix. -Bottomfeeder
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

healpot (short: hp)- gets set heal potion from set bag, and quaffs it 
manapot (short: mp)- gets set mana potion from set bag, and quaffs it 
buffpot (short: bp)- gets set an auxillary buff potion from set bag, and quaffs it

potionbag = NAME  - sets the name of the bag to retrive potions from 
                     (can be none, use a space for NAME i.e. potionbag =  )

healpot = NAME    - sets the name to use to retrieve and quaff heal potions 
                    (i.e. jade elixir)
healdesc = DESC   - sets the heal description to use to autoset values using pots command 
                    (i.e. Jade Elixir)

manapot = NAME    - sets the name to use to retrieve and quaff mana potions 
                    (i.e. tea)
manadesc = DESC   - sets the mana description to use to autoset values using pots command 
                    (i.e. Green Herbal Tea)

---
buffpot = NAME    - sets the name to use to retrieve and quaff buff potions 
                    (i.e. refreshing)
buffdesc = DESC   - sets the buff description to use to autoset values using pots command 
                    (i.e. Refreshing Idea)
---

healnum = #       - sets number of heal pots manually if not automatically done when examined bag
mananum = #       - sets number of mana pots manually if not automatically done when examined bag
buffnum = #       - sets number of buff pots manually if not automatically done when examined bag

pots              - examines bag set, and sets potion numbers to those detected 
                    (auto detect only work if you can see it in the bag, WITHOUT 
                    having to 'press enter to continue'

potgalert (on|off)   - turns on or off the alert to gtell channel of how 
                       many potions remain (sent after each potion use)

pquaff list       - lists current settings for plugin

pquaff help       - displays this help file

pquaff clear      - to be used ONLY if this plugin stops functioning properly, 
                    his will clear ALL settings to being as if you are 
                    installing the plugin for the first time.

buy (#) (heal|mana|buff) - will attempt to buy # of heal or mana pots, from 
                      the current store, 
                      THE NUMBER IS OPTIONAL, AND OMITTING IT WILL ATTEMPT TO BUY 1 POTION

Recommended Ideas:
If you use the numberpad to move about in the game, you know the simplicity of it, 
and how fast it is... Well go into the Keypad settings for the world 
(Ctrl + Shift + 1 [ONE]) and CHECK 'Show Contents If CTRL Held Down'
Once checked, look at the values for the keypad, and set one of these 
to healpot OR manapot, and then UNCHECK What you just checked, and hit OK, 
then when moving about all you need is to hit CTRL and the keypad number you set
To use a heal potion, or mana potion.

]]>
</description>

</plugin>


<!--  Get our standard constants -->

<include name="constants.lua"/>

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   ignore_case="y"
   make_italic="y"
   match="^You buy((\s(.*)\s\*\s)|\s)(?:@healdesc) from \w+ for \d+ gold.$"
   name="Shop_Heal"
   regexp="y"
   script="Shop_Heal"
   sequence="50"
  >
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   ignore_case="y"
   make_italic="y"
   match="^You buy((\s(.*)\s\*\s)|\s)(?:@manadesc) from \w+ for \d+ gold.$"
   name="Shop_Mana"
   regexp="y"
   script="Shop_Mana"
   sequence="50"
  >
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   ignore_case="y"
   make_italic="y"
   match="^You buy((\s(.*)\s\*\s)|\s)(?:@buffdesc) from \w+ for \d+ gold.$"
   name="Shop_Buff"
   regexp="y"
   script="Shop_Buff"
   sequence="50"
  >
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   ignore_case="y"
   make_italic="y"
   match="^You receive (@healdesc) from (.*?)\.$"
   name="Handed_Heal"
   regexp="y"
   script="Handed_Heal"
   sequence="50"
  >
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   ignore_case="y"
   make_italic="y"
   match="^You receive (@manadesc) from (.*?)\.$"
   name="Handed_Mana"
   regexp="y"
   script="Handed_Mana"
   sequence="50"
  >
  </trigger>
  <trigger
   enabled="y"
   expand_variables="y"
   ignore_case="y"
   make_italic="y"
   match="^You receive (@buffdesc) from (.*?)\.$"
   name="Handed_Buff"
   regexp="y"
   script="Handed_Buff"
   sequence="50"
  >
  </trigger>
  <trigger
   enabled="n"
   group="PotionMonitor"
   match="^\[Enter key for more or \'q\' to stop\]$"
   name="AutoEnter"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="1"
  >
  <send>SendNoEcho("")</send>
  </trigger>
  <trigger
   enabled="n"
   expand_variables="y"
   group="PotionMonitor"
   ignore_case="y"
   make_italic="y"
   match="^\s*\((\s\d|\d*)\)\s(?:\((\w+)\)\s)*(@healdesc)\s\((.*)\)$"
   name="Locate_Heal"
   regexp="y"
   script="Heal_Found"
   sequence="50"
  >
  </trigger>
  <trigger
   enabled="n"
   expand_variables="y"
   group="PotionMonitor"
   ignore_case="y"
   make_italic="y"
   match="^\s*\((\s\d|\d*)\)\s(?:\((\w+)\)\s)*(@manadesc)\s\((.*)\)$"
   name="Locate_Mana"
   regexp="y"
   script="Mana_Found"
   sequence="50"
  >
  </trigger>
  <trigger
   enabled="n"
   expand_variables="y"
   group="PotionMonitor"
   ignore_case="y"
   make_italic="y"
   match="^\s*\((\s\d|\d*)\)\s(?:\((\w+)\)\s)*(@buffdesc)\s\((.*)\)$"
   name="Locate_Buff"
   regexp="y"
   script="Buff_Found"
   sequence="50"
  >
  </trigger>
</triggers>

<!--  Aliases  -->

<aliases>
  <alias
  name="Buy_Heal_Pots"
   match="^buy(\s(\d{0,}))? heal$"
   enabled="y"
   expand_variables="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  <send>if string.lower("%0") == "buy heal" then
          Send("buy '@healpot'")
        else
          Send("buy %2 '@healpot'")
        end -- if
        if GetVariable("potionbag") ~= "" and GetVariable("potionbag") ~= nil then
          SendNoEcho("put 'all.@healpot' '@potionbag'")
        end -- if
        --Note("Type 'pots' for auto detection of potions, or 'healnum #'")</send>
  </alias>
  <alias
  name="Buy_Mana_Pots"
   match="^buy(\s(\d{0,}))? mana$"
   enabled="y"
   expand_variables="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  <send>if string.lower("%0") == "buy mana" then
          Send("buy '@manapot'")
        else
          Send("buy %2 '@manapot'")
        end -- if
        if GetVariable("potionbag") ~= "" and GetVariable("potionbag") ~= nil then
          SendNoEcho("put 'all.@manapot' '@potionbag'")
        end -- if
        --Note("Type 'pots' for auto detection of potions, or 'mananum #'")</send>
  </alias>
  <alias
  name="Buy_Buff_Pots"
   match="^buy(\s(\d{0,}))? buff$"
   enabled="y"
   expand_variables="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  <send>if string.lower("%0") == "buy buff" then
          Send("buy '@buffpot'")
        else
          Send("buy %2 '@buffpot'")
        end -- if
        if GetVariable("potionbag") ~= "" and GetVariable("potionbag") ~= nil then
          SendNoEcho("put 'all.@buffpot' '@potionbag'")
        end -- if
        --Note("Type 'pots' for auto detection of potions, or 'buffnum #'")</send>
  </alias>
  <alias
   name="Healpot"
   match="^(hp|healpot|healpot\s?\=?\s?(.*?)|healdesc\s?\=?\s?(.*?)|healnum\s?\=?\s?(\d+))$"
   enabled="y"
   regexp="y"
   script="Use_Set_Heal"
   omit_from_output="y"
   ignore_case="y"
   sequence="100"
  >
  </alias>
  <alias
   name="Manapot"
   match="^(mp|manapot|manapot\s?\=?\s?(.*?)|manadesc\s?\=?\s?(.*?)|mananum\s?\=?\s?(\d+))$"
   enabled="y"
   regexp="y"
   script="Use_Set_Mana"
   omit_from_output="y"
   ignore_case="y"
   sequence="100"
  >
  </alias>
  <alias
   name="Buffpot"
   match="^(bp|buffpot|buffpot\s?\=?\s?(.*?)|buffdesc\s?\=?\s?(.*?)|buffnum\s?\=?\s?(\d+))$"
   enabled="y"
   regexp="y"
   script="Use_Set_Buff"
   omit_from_output="y"
   ignore_case="y"
   sequence="100"
  >
  </alias>
  <alias
   name="PotionBag"
   match="^potionbag\s?\=?\s?(.*?)$"
   enabled="y"
   regexp="y"
   script="Potion_Bag_Set"
   omit_from_output="y"
   ignore_case="y"
   sequence="100"
  >
  </alias>
  <alias
   name="AlertToggle"
   match="^potgalert (on|off)$"
   enabled="y"
   regexp="y"
   script="AlertToggle"
   omit_from_output="y"
   ignore_case="y"
   sequence="100"
  >
  </alias>
  <alias
   name="PotsLocate"
   match="^pots$"
   enabled="y"
   regexp="y"
   script="Pots_Locate"
   omit_from_output="y"
   ignore_case="y"
   sequence="100"
  >
  </alias>
</aliases>

<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   ignore_case="y"
   match="pquaff help"
   enabled="y"
  >
  </alias>
  <alias
   script="pquaff_clear"
   ignore_case="y"
   omit_from_command_history="y"
   match="pquaff clear"
   enabled="y"
  >
  </alias>
  <alias
   script="pquaff_list"
   ignore_case="y"
   match="pquaff list"
   enabled="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[

function resetvar(var, value, hreset)
  if GetVariable(var) == nil or GetVariable(var) == "" or hreset then
    SetVariable(var,value)
  end -- if
end

function Shop_Heal(sName,sLine,wildcards)
  local num = tonumber(GetVariable("healnum"))
  if wildcards[3] == false then
    num = num + 1
  else
    num = num + wildcards[3]
  end -- if
  SetVariable("healnum",num)
  SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
end -- Shop_Heal

function Shop_Mana(sName,sLine,wildcards)
  local num = tonumber(GetVariable("mananum"))
  if wildcards[3] == false then
    num = num + 1
  else
    num = num + wildcards[3]
  end -- if
  SetVariable("mananum",num)
  SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
end -- Shop_Mana

function Shop_Buff(sName,sLine,wildcards)
  local num = tonumber(GetVariable("buffnum"))
  if wildcards[3] == false then
    num = num + 1
  else
    num = num + wildcards[3]
  end -- if
  SetVariable("buffnum",num)
  SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
end -- Shop_Buff

function Handed_Heal(sName,sLine,wildcards)
  if GetVariable("potionbag") ~= "" and GetVariable("potionbag")  ~= nil then
    SendNoEcho("put '" .. GetVariable("healpot") .. "' '" .. GetVariable("potionbag") .. "'")
  end -- if
  SetVariable("healnum",tonumber(GetVariable("healnum"))+1)
  SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
end -- Handed_Heal

function Handed_Mana(sName,sLine,wildcards)
  if GetVariable("potionbag") ~= "" and GetVariable("potionbag")  ~= nil then
    SendNoEcho("put '" .. GetVariable("manapot") .. "' '" .. GetVariable("potionbag") .. "'")
  end -- if
  SetVariable("mananum",tonumber(GetVariable("mananum"))+1)
  SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
end -- Handed_Mana

function Handed_Buff(sName,sLine,wildcards)
  if GetVariable("potionbag") ~= "" and GetVariable("potionbag")  ~= nil then
    SendNoEcho("put '" .. GetVariable("buffpot") .. "' '" .. GetVariable("potionbag") .. "'")
  end -- if
  SetVariable("buffnum",tonumber(GetVariable("buffnum"))+1)
  SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
end -- Handed_Buff

function Pots_Locate(sName,sLine,wildcards)
  EnableTriggerGroup("PotionMonitor",true)
  SetVariable("healnum",0)
  SetVariable("mananum",0)
  SetVariable("buffnum",0)
  if GetVariable("potionbag") ~= "" and GetVariable("potionbag")  ~= nil then
    SendNoEcho("examine '" .. GetVariable("potionbag") .. "'")
  else
    SendNoEcho("inventory")
  end -- if
  DoAfterSpecial(6,'EnableTriggerGroup("PotionMonitor",false)',12)
  if GetVariable("alert") == "on" then
    DoAfterSpecial(5,'SendNoEcho("gtell I have @G" .. GetVariable("healnum") .. " @gHeal @YPots Total! (@BPotion_Quaffer @RPlugin@Y)")',12)
    DoAfterSpecial(5,'SendNoEcho("gtell I have @G" .. GetVariable("mananum") .. " @CMana @YPots Total! (@BPotion_Quaffer @RPlugin@Y)")',12)
    DoAfterSpecial(5,'SendNoEcho("gtell I have @G" .. GetVariable("buffnum") .. " @BBuff @YPots Total! (@BPotion_Quaffer @RPlugin@Y)")',12)
  end -- if
end -- Pots_Locate

function AlertToggle(sName,sLine,wildcards)
  if string.lower(wildcards[1]) == "on" then
    ColourNote("white","green","Potion Quaffer Group Alert Enabled!")
    SetVariable("alert","on")
  else
    ColourNote("white","red","Potion Quaffer Group Alert Disabled!")
    SetVariable("alert","off")
  end -- if
  SaveState()
end -- AlertToggle

function Potion_Bag_Set(sName,sLine,wildcards)
  if GetVariable("potionbag") ~= "" and GetVariable("potionbag") ~= nil then
    ColourNote("white","burlywood","Potion Bag Set To: " .. wildcards[1])
    ColourNote("white","burlywood"," Previous Bag Was: " .. GetVariable("potionbag"))
    SetVariable("potionbag",wildcards[1])
  else
    ColourNote("white","burlywood","Potion Bag Set To: " .. wildcards[1])
    SetVariable("potionbag",wildcards[1])
  end -- if
  SaveState()
end -- Potion_Bag_Set

function Use_Set_Heal(sName,sLine,wildcards)
  if string.lower(wildcards[0]) == "healpot" or string.lower(wildcards[0]) == "hp" then
    if GetVariable("healpot") == "unknown" or GetVariable("healpot") == nil then
      Note("")
      Note("Potion Quaffer: Heal Setup")
      Note("You must set up this command with the name of a potion")
      Note("ie. 'healpot = jade elixir'")
      Note("If you will be using the 'pots' command, you also need to set the description")
      Note("i.e. 'healdesc = jade elixir'")
    else
      if tonumber(GetVariable("healnum")) > 0 then
        if GetVariable("potionbag") ~= "" and GetVariable("potionbag") ~= nil then
          Send("get '" .. GetVariable("healpot") .. "' '" .. GetVariable("potionbag") .. "'")
        end -- if
        Send("quaff '" .. GetVariable("healpot") .. "'")
        SetVariable("healnum",tonumber(GetVariable("healnum"))-1)
        if tonumber(GetVariable("healnum")) > 2 then
          ColourNote("white","green",GetVariable("healnum") .. " Heal Pot(s) Left!")
          SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
        else
          ColourNote("white","red",GetVariable("healnum") .. " Heal Pot(s) Left!")
          SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
        end -- if
        if GetVariable("alert") == "on" then
          SendNoEcho("gtell I have @G" .. GetVariable("healnum") .. " @gHeal @YPots @RLeft@Y! (@BPotion_Quaffer @RPlugin@Y)")
        end -- if
      else
        ColourNote("white","red","NO HEAL POTS LEFT!")
        if GetVariable("alert") == "on" then
          SendNoEcho("gtell @RI AM OUT OF @gHEAL @RPOTS!@Y")
        end -- if
      end -- if
    end -- if
  elseif string.sub(string.lower(wildcards[0]),1,8) == "healdesc" then
    ColourNote("black","powderblue","Healpot Description (What You See Item As) is: " .. wildcards[3])
    SetVariable("healdesc",wildcards[3])
  elseif string.sub(string.lower(wildcards[0]),1,7) == "healnum" then
    ColourNote("white","green","Number Of Healpots Set To: " .. wildcards[4])
    SetVariable("healnum",wildcards[4])
    SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
  else
    ColourNote("white","green","Healpot set to: " .. wildcards[2])
    SetVariable("healpot",wildcards[2])
  end -- if
  SaveState()
end -- Use_Set_Heal

function Use_Set_Mana(sName,sLine,wildcards)
  if string.lower(wildcards[0]) == "manapot" or string.lower(wildcards[0]) == "mp" then
    if GetVariable("manapot") == "unknown" or GetVariable("manapot") == nil then
      Note("")
      Note("Potion Quaffer: Mana Setup")
      Note("You must set up this command with the name of a potion")
      Note("ie. 'manapot = tea'")
      Note("If you will be using the 'pots' command, you also need to set the description")
      Note("i.e. 'manadesc = green tea'")
    else
      if tonumber(GetVariable("mananum")) > 0 then
        if GetVariable("potionbag") ~= "" then
          Send("get '" .. GetVariable("manapot") .. "' '" .. GetVariable("potionbag") .. "'")
        end -- if
        Send("quaff '" .. GetVariable("manapot") .. "'")
        SetVariable("mananum",tonumber(GetVariable("mananum"))-1)
        if tonumber(GetVariable("mananum")) > 2 then
          ColourNote("white","green",GetVariable("mananum") .. " Mana Pot(s) Left!")
          SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
        else
          ColourNote("white","red",GetVariable("mananum") .. " Mana Pot(s) Left!")
          SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
        end -- if
        if GetVariable("alert") == "on" then
          SendNoEcho("gtell I have @G" .. GetVariable("mananum") .. " @CMana @YPots @RLeft@Y! (@BPotion_Quaffer @RPlugin@Y)")
        end -- if
      else
        ColourNote("white","red","NO MANA POTS LEFT!")
        if GetVariable("alert") == "on" then
          SendNoEcho("gtell @I AM OUT OF @CMANA @RPOTS!@Y")
        end -- if
      end -- if
    end -- if
  elseif string.sub(string.lower(wildcards[0]),1,8) == "manadesc" then
    ColourNote("black","powderblue","Manapot Description (What You See Item As) is: " .. wildcards[3])
    SetVariable("manadesc",wildcards[3])
  elseif string.sub(string.lower(wildcards[0]),1,7) == "mananum" then
    ColourNote("white","green","Number Of Manapots Set To: " .. wildcards[4])
    SetVariable("mananum",wildcards[4])
    SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
  else
    ColourNote("white","green","Manapot set to: " .. wildcards[2])
    SetVariable("manapot",wildcards[2])
  end -- if
  SaveState()
end -- Use_Set_Mana

function Use_Set_Buff(sName,sLine,wildcards)
  if string.lower(wildcards[0]) == "buffpot" or string.lower(wildcards[0]) == "bp" then
    if GetVariable("buffpot") == "unknown" or GetVariable("buffpot") == nil then
      Note("")
      Note("Potion Quaffer: Buff Setup")
      Note("You must set up this command with the name of a potion")
      Note("ie. 'buffpot = refreshing'")
      Note("If you will be using the 'pots' command, you also need to set the description")
      Note("i.e. 'buffdesc = Refreshing Idea'")
    else
      if tonumber(GetVariable("buffnum")) > 0 then
        if GetVariable("potionbag") ~= "" then
          Send("get '" .. GetVariable("buffpot") .. "' '" .. GetVariable("potionbag") .. "'")
        end -- if
        Send("quaff '" .. GetVariable("buffpot") .. "'")
        SetVariable("buffnum",tonumber(GetVariable("buffnum"))-1)
        if tonumber(GetVariable("buffnum")) > 2 then
          ColourNote("white","green",GetVariable("buffnum") .. " Buff Pot(s) Left!")
          SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
        else
          ColourNote("white","red",GetVariable("buffnum") .. " Buff Pot(s) Left!")
          SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
        end -- if
        if GetVariable("alert") == "on" then
          SendNoEcho("gtell I have @G" .. GetVariable("buffnum") .. " @CBuff @YPots @RLeft@Y! (@BPotion_Quaffer @RPlugin@Y)")
        end -- if
      else
        ColourNote("white","red","NO BUFF POTS LEFT!")
        if GetVariable("alert") == "on" then
          SendNoEcho("gtell @I AM OUT OF @CBUFF @RPOTS!@Y")
        end -- if
      end -- if
    end -- if
  elseif string.sub(string.lower(wildcards[0]),1,8) == "buffdesc" then
    ColourNote("black","powderblue","Buffpot Description (What You See Item As) is: " .. wildcards[3])
    SetVariable("buffdesc",wildcards[3])
  elseif string.sub(string.lower(wildcards[0]),1,7) == "buffnum" then
    ColourNote("white","green","Number Of Buffpots Set To: " .. wildcards[4])
    SetVariable("buffnum",wildcards[4])
    SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
  else
    ColourNote("white","green","Buffpot set to: " .. wildcards[2])
    SetVariable("buffpot",wildcards[2])
  end -- if
  SaveState()
end -- Use_Set_Buff

function Heal_Found(sName,sLine,wildcards)
  if wildcards[1] ~= " " and wildcards[1] ~= "" then
    SetVariable("healnum",wildcards[1])
  else
    SetVariable("healnum",1)
  end -- if
  ColourNote("white","green",GetVariable("healnum") .. " Heal Potion(s) Detected!")
    SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
  SaveState()
  EnableTrigger("Heal_Found",false)
end -- Heal_Found

function Mana_Found(sName,sLine,wildcards)
  if wildcards[1] ~= " " and wildcards[1] ~= "" then
    SetVariable("mananum",wildcards[1])
  else
    SetVariable("mananum",1)
  end -- if
  ColourNote("white","green",GetVariable("mananum") .. " Mana Potion(s) Detected!")
    SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
  SaveState()
  EnableTrigger("Mana_Found",false)
end -- Mana_Found

function Buff_Found(sName,sLine,wildcards)
  if wildcards[1] ~= " " and wildcards[1] ~= "" then
    SetVariable("buffnum",wildcards[1])
  else
    SetVariable("buffnum",1)
  end -- if
  ColourNote("white","green",GetVariable("buffnum") .. " Buff Potion(s) Detected!")
    SetStatus("[PotionQuaffer v2] Heals: " .. GetVariable("healnum") .. " Manas: " .. GetVariable("mananum") .. " Buffs: " .. GetVariable("buffnum"))
  SaveState()
  EnableTrigger("Buff_Found",false)
end -- Buff_Found

function pquaff_reset(hreset)
  resetvar("healnum", 0, hreset)
  resetvar("healpot", "unknown", hreset)
  resetvar("healdesc", "unknown", hreset)
  resetvar("mananum", 0, hreset)
  resetvar("manapot", "unknown", hreset)
  resetvar("manadesc", "unknown", hreset)
  resetvar("buffnum", 0, hreset)
  resetvar("buffpot", "unknown", hreset)
  resetvar("buffdesc", "unknown", hreset)
  resetvar("potionbag", "unknown", hreset)
  resetvar("alert", "off", hreset)
  SaveState()
end

function OnPluginInstall()
  pquaff_reset()
  OnHelp()
end

function OnHelp ()
  Note (GetPluginInfo (GetPluginID (), 3))
end

function pquaff_clear(sName,sLine,wildcards)
  pquaff_reset(true)
  ColourNote("white","red","ALL POTION QUAFFER SETTINGS REMOVED!!")
  ColourNote("white","red","Reloading Plugin in 2 seconds...")
  DoAfterSpecial(2,'ReloadPlugin("59358039c72bc395fb31922e")',12)
end -- pquaff_clear

function pquaff_list(sName,sLine,wildcards)
  ColourNote("blue","black","PotionQuaffer:","red","black"," Heal Potion      = ","darkred","black",GetVariable("healpot"))
  ColourNote("blue","black","PotionQuaffer:","red","black"," Heal Description = ","darkred","black",GetVariable("healdesc"))
  ColourNote("blue","black","PotionQuaffer:","red","black"," Heals Remaining  = ","darkred","black",GetVariable("healnum"))

  ColourNote("blue","black","PotionQuaffer:","deepskyblue","black"," Mana Potion      = ","blue","black",GetVariable("manapot"))
  ColourNote("blue","black","PotionQuaffer:","deepskyblue","black"," Mana Description = ","blue","black",GetVariable("manadesc"))
  ColourNote("blue","black","PotionQuaffer:","deepskyblue","black"," Manas Remaining  = ","blue","black",GetVariable("mananum"))

  ColourNote("blue","black","PotionQuaffer:","lightgreen","black"," Buff Potion      = ","green","black",GetVariable("buffpot"))
  ColourNote("blue","black","PotionQuaffer:","lightgreen","black"," Buff Description = ","green","black",GetVariable("buffdesc"))
  ColourNote("blue","black","PotionQuaffer:","lightgreen","black"," Buffs Remaining  = ","green","black",GetVariable("buffnum"))

  ColourNote("blue","black","PotionQuaffer:","lightblue","black"," Potion Bag       = ","darkblue","black",GetVariable("potionbag"))
  ColourNote("blue","black","PotionQuaffer:","lightblue","black"," Group Alert      = ","darkblue","black",GetVariable("alert"))
  Note("")
end -- pquaff_list
]]>
</script> 

</muclient>
