-- Override the health/moss sipping/eating functions so that they only change state -- of ACS variables and display debugging notes. require "flc.kutils" require "flc.klib" require "flc.events" require "flc.katcp" require "flc.version" assert((tonumber(version.get()) >= 1.5), "ACS2 Autosipper plugin requires FLC package version 1.5 or later.") use_atcp = false events.SetEvent(events.FLC_ATCP_ON, function() use_atcp = true end) events.SetEvent(events.FLC_ATCP_OFF, function() use_atcp = false end) Autosipper = {} Autosipper.sip = function (cure) balances.healthmana = false if(CTRL_DEBUG) then world.Note('ACS: SIPPING ' .. string.upper(cure) .. '. [Overriden by Autosipper plugin]') end end Autosipper.moss = function () balances.moss = false if(CTRL_DEBUG) then world.Note('ACS: EATING MOSS. [Overriden by Autosipper plugin]') end end Autosipper.set_stats = function() end Autosipper.get_stats = function() if use_atcp then local vitals = katcp.GetVitals() if vitals then prompt.health = tonumber(vitals.curr_health) prompt.mana = tonumber(vitals.curr_mana) prompt.maxhealth = tonumber(vitals.max_health) prompt.maxmana = tonumber(vitals.max_mana) else prompt.health = klib.GetCurrHealth() prompt.maxhealth = klib.GetMaxHealth() prompt.mana = klib.GetCurrMana() prompt.maxmana = klib.GetMaxMana() end else prompt.health = klib.GetCurrHealth() prompt.maxhealth = klib.GetMaxHealth() prompt.mana = klib.GetCurrMana() prompt.maxmana = klib.GetMaxMana() end if(CTRL_DEBUG) then world.Note("ACS: MAX HEALTH/MANA SET. [Overriden by Autosipper plugin]") end end events.SetEvent(events.FLC_STATS, Autosipper.get_stats) function autosipper_plugin_install() if IsPluginInstalled("3c4b3e476bbd5891190cd22a") then sip = Autosipper.sip moss = Autosipper.moss set_stats = Autosipper.set_stats get_stats = Autosipper.get_stats kutils.DoNote("Autosipper plugin is found - overriding ACS aliases.") end end AUTOSIPPER_AUTHOR = "Keldar" AUTOSIPPER_VERSION = 1.3