diff --git a/Icons/Envoker.tga b/Icons/Envoker.tga new file mode 100644 index 0000000..6d31d3a Binary files /dev/null and b/Icons/Envoker.tga differ diff --git a/Libs/.vscode/settings.json b/Libs/.vscode/settings.json new file mode 100644 index 0000000..a367771 --- /dev/null +++ b/Libs/.vscode/settings.json @@ -0,0 +1,20 @@ +{ + "Lua.diagnostics.globals": [ + "LibStub", + "LibStub", + "SMARTBUFF_TITLE", + "SMARTBUFF_TITLE", + "SMARTBUFF_Options", + "SMARTBUFF_Options", + "SMARTBUFF_OToggleBuff", + "SMARTBUFF_OToggleBuff", + "SMARTDEBUFF_ToggleSF", + "SMARTDEBUFF_ToggleSF", + "SMARTBUFF_OptionsFrame_Toggle", + "SMARTBUFF_OptionsFrame_Toggle", + "SMARTBUFF_TITAN_TT", + "SMARTBUFF_TITAN_TT", + "SMARTBUFF_OToggle", + "SMARTBUFF_OToggle" + ] +} \ No newline at end of file diff --git a/Libs/Broker_SmartBuff/Broker_SmartBuff.lua b/Libs/Broker_SmartBuff/Broker_SmartBuff.lua new file mode 100644 index 0000000..ae1b766 --- /dev/null +++ b/Libs/Broker_SmartBuff/Broker_SmartBuff.lua @@ -0,0 +1,45 @@ +------------------------------------------------------------------------------- +-- Broker: SmartBuff +-- Created by Aeldra (EU-Proudmoore) +-- +-- Data Broker support +------------------------------------------------------------------------------- + +if (not SMARTBUFF_TITLE) then return end + +local F = CreateFrame("Frame", "Broker_SmartBuff"); + +function SMARTBUFF_BROKER_SetIcon() + if (not F.LS) then return end + if (SMARTBUFF_Options and SMARTBUFF_Options.Toggle) then + F.LS.icon = "Interface\\AddOns\\SmartBuff\\Icons\\IconEnabled"; + else + F.LS.icon = "Interface\\AddOns\\SmartBuff\\Icons\\IconDisabled"; + end +end + +F.LS = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("SmartBuff", { + type = "launcher", + label = SMARTBUFF_TITLE, + OnClick = function(_, msg) + if (msg == "RightButton") then + SMARTBUFF_OToggle(); + SMARTBUFF_BROKER_SetIcon(); -- bug fix, credit: SunNova + elseif (msg == "LeftButton" and IsAltKeyDown()) then + if (IsAddOnLoaded("SmartDebuff")) then + SMARTDEBUFF_ToggleSF(); + end + elseif (msg == "LeftButton") then + SMARTBUFF_OptionsFrame_Toggle(); + end + end, + icon = "Interface\\AddOns\\SmartBuff\\Icons\\IconDisabled", + OnTooltipShow = function(tooltip) + if (not tooltip or not tooltip.AddLine) then return end + tooltip:AddLine("|cffffffff"..SMARTBUFF_TITLE.."|r"); + tooltip:AddLine(SMARTBUFF_TITAN_TT); + end, +}); + +F:Hide(); +--print("Borker - SmartBuff loaded"); diff --git a/Libs/Broker_SmartBuff/Broker_SmartBuff.toc b/Libs/Broker_SmartBuff/Broker_SmartBuff.toc new file mode 100644 index 0000000..f3e3f8f --- /dev/null +++ b/Libs/Broker_SmartBuff/Broker_SmartBuff.toc @@ -0,0 +1,10 @@ +## Interface: 90207 +## Title: Broker: Smart|cffffffffBuff|r +## Version: 1.90207 +## Notes: SmartBuff support for Data Broker +## Author: |cff20d2ffAeldra|r (EU-Proudmoore) +## Dependencies: SmartBuff +## X-Category: Miscellaneous + +LibDataBroker-1.1.lua +Broker_SmartBuff.lua diff --git a/Libs/Broker_SmartBuff/LibDataBroker-1.1.lua b/Libs/Broker_SmartBuff/LibDataBroker-1.1.lua new file mode 100644 index 0000000..f47c0cd --- /dev/null +++ b/Libs/Broker_SmartBuff/LibDataBroker-1.1.lua @@ -0,0 +1,90 @@ + +assert(LibStub, "LibDataBroker-1.1 requires LibStub") +assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0") + +local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 4) +if not lib then return end +oldminor = oldminor or 0 + + +lib.callbacks = lib.callbacks or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib) +lib.attributestorage, lib.namestorage, lib.proxystorage = lib.attributestorage or {}, lib.namestorage or {}, lib.proxystorage or {} +local attributestorage, namestorage, callbacks = lib.attributestorage, lib.namestorage, lib.callbacks + +if oldminor < 2 then + lib.domt = { + __metatable = "access denied", + __index = function(self, key) return attributestorage[self] and attributestorage[self][key] end, + } +end + +if oldminor < 3 then + lib.domt.__newindex = function(self, key, value) + if not attributestorage[self] then attributestorage[self] = {} end + if attributestorage[self][key] == value then return end + attributestorage[self][key] = value + local name = namestorage[self] + if not name then return end + callbacks:Fire("LibDataBroker_AttributeChanged", name, key, value, self) + callbacks:Fire("LibDataBroker_AttributeChanged_"..name, name, key, value, self) + callbacks:Fire("LibDataBroker_AttributeChanged_"..name.."_"..key, name, key, value, self) + callbacks:Fire("LibDataBroker_AttributeChanged__"..key, name, key, value, self) + end +end + +if oldminor < 2 then + function lib:NewDataObject(name, dataobj) + if self.proxystorage[name] then return end + + if dataobj then + assert(type(dataobj) == "table", "Invalid dataobj, must be nil or a table") + self.attributestorage[dataobj] = {} + for i,v in pairs(dataobj) do + self.attributestorage[dataobj][i] = v + dataobj[i] = nil + end + end + dataobj = setmetatable(dataobj or {}, self.domt) + self.proxystorage[name], self.namestorage[dataobj] = dataobj, name + self.callbacks:Fire("LibDataBroker_DataObjectCreated", name, dataobj) + return dataobj + end +end + +if oldminor < 1 then + function lib:DataObjectIterator() + return pairs(self.proxystorage) + end + + function lib:GetDataObjectByName(dataobjectname) + return self.proxystorage[dataobjectname] + end + + function lib:GetNameByDataObject(dataobject) + return self.namestorage[dataobject] + end +end + +if oldminor < 4 then + local next = pairs(attributestorage) + function lib:pairs(dataobject_or_name) + local t = type(dataobject_or_name) + assert(t == "string" or t == "table", "Usage: ldb:pairs('dataobjectname') or ldb:pairs(dataobject)") + + local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name + assert(attributestorage[dataobj], "Data object not found") + + return next, attributestorage[dataobj], nil + end + + local ipairs_iter = ipairs(attributestorage) + function lib:ipairs(dataobject_or_name) + local t = type(dataobject_or_name) + assert(t == "string" or t == "table", "Usage: ldb:ipairs('dataobjectname') or ldb:ipairs(dataobject)") + + local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name + assert(attributestorage[dataobj], "Data object not found") + + return ipairs_iter, attributestorage[dataobj], 0 + end +end diff --git a/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua b/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua new file mode 100644 index 0000000..a8377fe --- /dev/null +++ b/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua @@ -0,0 +1,212 @@ +--[[ $Id: CallbackHandler-1.0.lua 1186 2018-07-21 14:19:18Z nevcairiel $ ]] +local MAJOR, MINOR = "CallbackHandler-1.0", 7 +local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) + +if not CallbackHandler then return end -- No upgrade needed + +local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end} + +-- Lua APIs +local tconcat = table.concat +local assert, error, loadstring = assert, error, loadstring +local setmetatable, rawset, rawget = setmetatable, rawset, rawget +local next, select, pairs, type, tostring = next, select, pairs, type, tostring + +-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded +-- List them here for Mikk's FindGlobals script +-- GLOBALS: geterrorhandler + +local xpcall = xpcall + +local function errorhandler(err) + return geterrorhandler()(err) +end + +local function Dispatch(handlers, ...) + local index, method = next(handlers) + if not method then return end + repeat + xpcall(method, errorhandler, ...) + index, method = next(handlers, index) + until not method +end + +-------------------------------------------------------------------------- +-- CallbackHandler:New +-- +-- target - target object to embed public APIs in +-- RegisterName - name of the callback registration API, default "RegisterCallback" +-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback" +-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API. + +function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName) + + RegisterName = RegisterName or "RegisterCallback" + UnregisterName = UnregisterName or "UnregisterCallback" + if UnregisterAllName==nil then -- false is used to indicate "don't want this method" + UnregisterAllName = "UnregisterAllCallbacks" + end + + -- we declare all objects and exported APIs inside this closure to quickly gain access + -- to e.g. function names, the "target" parameter, etc + + + -- Create the registry object + local events = setmetatable({}, meta) + local registry = { recurse=0, events=events } + + -- registry:Fire() - fires the given event/message into the registry + function registry:Fire(eventname, ...) + if not rawget(events, eventname) or not next(events[eventname]) then return end + local oldrecurse = registry.recurse + registry.recurse = oldrecurse + 1 + + Dispatch(events[eventname], eventname, ...) + + registry.recurse = oldrecurse + + if registry.insertQueue and oldrecurse==0 then + -- Something in one of our callbacks wanted to register more callbacks; they got queued + for eventname,callbacks in pairs(registry.insertQueue) do + local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. + for self,func in pairs(callbacks) do + events[eventname][self] = func + -- fire OnUsed callback? + if first and registry.OnUsed then + registry.OnUsed(registry, target, eventname) + first = nil + end + end + end + registry.insertQueue = nil + end + end + + -- Registration of a callback, handles: + -- self["method"], leads to self["method"](self, ...) + -- self with function ref, leads to functionref(...) + -- "addonId" (instead of self) with function ref, leads to functionref(...) + -- all with an optional arg, which, if present, gets passed as first argument (after self if present) + target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]]) + if type(eventname) ~= "string" then + error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2) + end + + method = method or eventname + + local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. + + if type(method) ~= "string" and type(method) ~= "function" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2) + end + + local regfunc + + if type(method) == "string" then + -- self["method"] calling style + if type(self) ~= "table" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2) + elseif self==target then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2) + elseif type(self[method]) ~= "function" then + error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2) + end + + if select("#",...)>=1 then -- this is not the same as testing for arg==nil! + local arg=select(1,...) + regfunc = function(...) self[method](self,arg,...) end + else + regfunc = function(...) self[method](self,...) end + end + else + -- function ref with self=object or self="addonId" or self=thread + if type(self)~="table" and type(self)~="string" and type(self)~="thread" then + error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string or thread expected.", 2) + end + + if select("#",...)>=1 then -- this is not the same as testing for arg==nil! + local arg=select(1,...) + regfunc = function(...) method(arg,...) end + else + regfunc = method + end + end + + + if events[eventname][self] or registry.recurse<1 then + -- if registry.recurse<1 then + -- we're overwriting an existing entry, or not currently recursing. just set it. + events[eventname][self] = regfunc + -- fire OnUsed callback? + if registry.OnUsed and first then + registry.OnUsed(registry, target, eventname) + end + else + -- we're currently processing a callback in this registry, so delay the registration of this new entry! + -- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency + registry.insertQueue = registry.insertQueue or setmetatable({},meta) + registry.insertQueue[eventname][self] = regfunc + end + end + + -- Unregister a callback + target[UnregisterName] = function(self, eventname) + if not self or self==target then + error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2) + end + if type(eventname) ~= "string" then + error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2) + end + if rawget(events, eventname) and events[eventname][self] then + events[eventname][self] = nil + -- Fire OnUnused callback? + if registry.OnUnused and not next(events[eventname]) then + registry.OnUnused(registry, target, eventname) + end + end + if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then + registry.insertQueue[eventname][self] = nil + end + end + + -- OPTIONAL: Unregister all callbacks for given selfs/addonIds + if UnregisterAllName then + target[UnregisterAllName] = function(...) + if select("#",...)<1 then + error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2) + end + if select("#",...)==1 and ...==target then + error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2) + end + + + for i=1,select("#",...) do + local self = select(i,...) + if registry.insertQueue then + for eventname, callbacks in pairs(registry.insertQueue) do + if callbacks[self] then + callbacks[self] = nil + end + end + end + for eventname, callbacks in pairs(events) do + if callbacks[self] then + callbacks[self] = nil + -- Fire OnUnused callback? + if registry.OnUnused and not next(callbacks) then + registry.OnUnused(registry, target, eventname) + end + end + end + end + end + end + + return registry +end + + +-- CallbackHandler purposefully does NOT do explicit embedding. Nor does it +-- try to upgrade old implicit embeds since the system is selfcontained and +-- relies on closures to work. + diff --git a/Libs/LibRangeCheck-2.0/LibRangeCheck-2.0.lua b/Libs/LibRangeCheck-2.0/LibRangeCheck-2.0.lua new file mode 100644 index 0000000..e3d6819 --- /dev/null +++ b/Libs/LibRangeCheck-2.0/LibRangeCheck-2.0.lua @@ -0,0 +1,1131 @@ +--[[ +Name: LibRangeCheck-2.0 +Revision: $Revision: 214 $ +Author(s): mitch0 +Website: http://www.wowace.com/projects/librangecheck-2-0/ +Description: A range checking library based on interact distances and spell ranges +Dependencies: LibStub +License: Public Domain +]] + +--- LibRangeCheck-2.0 provides an easy way to check for ranges and get suitable range checking functions for specific ranges.\\ +-- The checkers use spell and item range checks, or interact based checks for special units where those two cannot be used.\\ +-- The lib handles the refreshing of checker lists in case talents / spells change and in some special cases when equipment changes (for example some of the mage pvp gloves change the range of the Fire Blast spell), and also handles the caching of items used for item-based range checks.\\ +-- A callback is provided for those interested in checker changes. +-- @usage +-- local rc = LibStub("LibRangeCheck-2.0") +-- +-- rc.RegisterCallback(self, rc.CHECKERS_CHANGED, function() print("need to refresh my stored checkers") end) +-- +-- local minRange, maxRange = rc:GetRange('target') +-- if not minRange then +-- print("cannot get range estimate for target") +-- elseif not maxRange then +-- print("target is over " .. minRange .. " yards") +-- else +-- print("target is between " .. minRange .. " and " .. maxRange .. " yards") +-- end +-- +-- local meleeChecker = rc:GetFriendMaxChecker(rc.MeleeRange) or rc:GetFriendMinChecker(rc.MeleeRange) -- use the closest checker (MinChecker) if no valid Melee checker is found +-- for i = 1, 4 do +-- -- TODO: check if unit is valid, etc +-- if meleeChecker("party" .. i) then +-- print("Party member " .. i .. " is in Melee range") +-- end +-- end +-- +-- local safeDistanceChecker = rc:GetHarmMinChecker(30) +-- -- negate the result of the checker! +-- local isSafelyAway = not safeDistanceChecker('target') +-- +-- @class file +-- @name LibRangeCheck-2.0 +local MAJOR_VERSION = "LibRangeCheck-2.0" +local MINOR_VERSION = tonumber(("$Revision: 214 $"):match("%d+")) + 100000 + +local lib, oldminor = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION) +if not lib then + return +end + +local IsClassic = false + or (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_CLASSIC) + or (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_BURNING_CRUSADE_CLASSIC) + or (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_WRATH_CLASSIC) + +-- << STATIC CONFIG + +local UpdateDelay = .5 +local ItemRequestTimeout = 10.0 + +-- interact distance based checks. ranges are based on my own measurements (thanks for all the folks who helped me with this) +local DefaultInteractList = { + [3] = 8, +-- [2] = 9, + [4] = 28, +} + +-- interact list overrides for races +local InteractLists = { + ["Tauren"] = { + [3] = 6, +-- [2] = 7, + [4] = 25, + }, + ["Scourge"] = { + [3] = 7, +-- [2] = 8, + [4] = 27, + }, +} + +local MeleeRange = 2 + +-- list of friendly spells that have different ranges +local FriendSpells = {} +-- list of harmful spells that have different ranges +local HarmSpells = {} + +FriendSpells["DEATHKNIGHT"] = { +} +HarmSpells["DEATHKNIGHT"] = { + 49576, -- ["Death Grip"], -- 30 +} + +FriendSpells["DEMONHUNTER"] = { +} +HarmSpells["DEMONHUNTER"] = { + 185123, -- ["Throw Glaive"], -- 30 +} + +FriendSpells["DRUID"] = { + 774, -- ["Rejuvenation"], -- 40 + 2782, -- ["Remove Corruption"], -- 40 +} +HarmSpells["DRUID"] = { + 5176, -- ["Wrath"], -- 40 + 339, -- ["Entangling Roots"], -- 35 + 6795, -- ["Growl"], -- 30 + 33786, -- ["Cyclone"], -- 20 + 22568, -- ["Ferocious Bite"], -- Melee +} + +FriendSpells["HUNTER"] = {} +HarmSpells["HUNTER"] = { + 75, -- ["Auto Shot"], -- 40 +} + +FriendSpells["MAGE"] = { +} +HarmSpells["MAGE"] = { + 44614, --["Frostfire Bolt"], -- 40 + 5019, -- ["Shoot"], -- 30 +} + +FriendSpells["MONK"] = { + 115450, -- ["Detox"], -- 40 + 115546, -- ["Provoke"], -- 30 +} +HarmSpells["MONK"] = { + 115546, -- ["Provoke"], -- 30 + 115078, -- ["Paralysis"], -- 20 + 100780, -- ["Tiger Palm"], -- Melee +} + +FriendSpells["PALADIN"] = { + 19750, -- ["Flash of Light"], -- 40 +} +HarmSpells["PALADIN"] = { + 62124, -- ["Reckoning"], -- 30 + 20271, -- ["Judgement"], -- 30 + 853, -- ["Hammer of Justice"], -- 10 + 35395, -- ["Crusader Strike"], -- Melee +} + +FriendSpells["PRIEST"] = { + 527, -- ["Purify"], -- 40 + 17, -- ["Power Word: Shield"], -- 40 +} +HarmSpells["PRIEST"] = { + 589, -- ["Shadow Word: Pain"], -- 40 + 5019, -- ["Shoot"], -- 30 +} + +FriendSpells["ROGUE"] = {} +HarmSpells["ROGUE"] = { + 2764, -- ["Throw"], -- 30 + 2094, -- ["Blind"], -- 15 +} + +FriendSpells["SHAMAN"] = { + 8004, -- ["Healing Surge"], -- 40 + 546, -- ["Water Walking"], -- 30 +} +HarmSpells["SHAMAN"] = { + 403, -- ["Lightning Bolt"], -- 40 + 370, -- ["Purge"], -- 30 + 73899, -- ["Primal Strike"],. -- Melee +} + +FriendSpells["WARRIOR"] = {} +HarmSpells["WARRIOR"] = { + 355, -- ["Taunt"], -- 30 + 100, -- ["Charge"], -- 8-25 + 5246, -- ["Intimidating Shout"], -- 8 +} + +FriendSpells["WARLOCK"] = { + 5697, -- ["Unending Breath"], -- 30 +} +HarmSpells["WARLOCK"] = { + 686, -- ["Shadow Bolt"], -- 40 + 5019, -- ["Shoot"], -- 30 +} + +-- Items [Special thanks to Maldivia for the nice list] + +local FriendItems = { + [1] = { + 90175, -- Gin-Ji Knife Set -- doesn't seem to work for pets (always returns nil) + }, + [2] = { + 37727, -- Ruby Acorn + }, + [3] = { + 42732, -- Everfrost Razor + }, + [4] = { + 129055, -- Shoe Shine Kit + }, + [5] = { + 8149, -- Voodoo Charm + 136605, -- Solendra's Compassion + 63427, -- Worgsaw + }, + [6] = { + 164766, -- Iwen's Enchanting Rod + }, + [7] = { + 61323, -- Ruby Seeds + }, + [8] = { + 34368, -- Attuned Crystal Cores + 33278, -- Burning Torch + }, + [10] = { + 32321, -- Sparrowhawk Net + }, + [15] = { + 1251, -- Linen Bandage + 2581, -- Heavy Linen Bandage + 3530, -- Wool Bandage + 3531, -- Heavy Wool Bandage + 6450, -- Silk Bandage + 6451, -- Heavy Silk Bandage + 8544, -- Mageweave Bandage + 8545, -- Heavy Mageweave Bandage + 14529, -- Runecloth Bandage + 14530, -- Heavy Runecloth Bandage + 21990, -- Netherweave Bandage + 21991, -- Heavy Netherweave Bandage + 34721, -- Frostweave Bandage + 34722, -- Heavy Frostweave Bandage +-- 38643, -- Thick Frostweave Bandage +-- 38640, -- Dense Frostweave Bandage + }, + [20] = { + 21519, -- Mistletoe + }, + [25] = { + 31463, -- Zezzak's Shard + }, + [30] = { + 1180, -- Scroll of Stamina + 1478, -- Scroll of Protection II + 3012, -- Scroll of Agility + 1712, -- Scroll of Spirit II + 2290, -- Scroll of Intellect II + 1711, -- Scroll of Stamina II + 34191, -- Handful of Snowflakes + }, + [35] = { + 18904, -- Zorbin's Ultra-Shrinker + }, + [38] = { + 140786, -- Ley Spider Eggs + }, + [40] = { + 34471, -- Vial of the Sunwell + }, + [45] = { + 32698, -- Wrangling Rope + }, + [50] = { + 116139, -- Haunting Memento + }, + [55] = { + 74637, -- Kiryn's Poison Vial + }, + [60] = { + 32825, -- Soul Cannon + 37887, -- Seeds of Nature's Wrath + }, + [70] = { + 41265, -- Eyesore Blaster + }, + [80] = { + 35278, -- Reinforced Net + }, + [90] = { + 133925, -- Fel Lash + }, + [100] = { + 41058, -- Hyldnir Harpoon + }, + [150] = { + 46954, -- Flaming Spears + }, + [200] = { + 75208, -- Rancher's Lariat + }, +} + +local HarmItems = { + [1] = { + }, + [2] = { + 37727, -- Ruby Acorn + }, + [3] = { + 42732, -- Everfrost Razor + }, + [4] = { + 129055, -- Shoe Shine Kit + }, + [5] = { + 8149, -- Voodoo Charm + 136605, -- Solendra's Compassion + 63427, -- Worgsaw + }, + [6] = { + 164766, -- Iwen's Enchanting Rod + }, + [7] = { + 61323, -- Ruby Seeds + }, + [8] = { + 34368, -- Attuned Crystal Cores + 33278, -- Burning Torch + }, + [10] = { + 32321, -- Sparrowhawk Net + }, + [15] = { + 33069, -- Sturdy Rope + }, + [20] = { + 10645, -- Gnomish Death Ray + }, + [25] = { + 24268, -- Netherweave Net + 41509, -- Frostweave Net + 31463, -- Zezzak's Shard + }, + [30] = { + 835, -- Large Rope Net + 7734, -- Six Demon Bag + 34191, -- Handful of Snowflakes + }, + [35] = { + 24269, -- Heavy Netherweave Net + 18904, -- Zorbin's Ultra-Shrinker + }, + [38] = { + 140786, -- Ley Spider Eggs + }, + [40] = { + 28767, -- The Decapitator + }, + [45] = { +-- 32698, -- Wrangling Rope + 23836, -- Goblin Rocket Launcher + }, + [50] = { + 116139, -- Haunting Memento + }, + [55] = { + 74637, -- Kiryn's Poison Vial + }, + [60] = { + 32825, -- Soul Cannon + 37887, -- Seeds of Nature's Wrath + }, + [70] = { + 41265, -- Eyesore Blaster + }, + [80] = { + 35278, -- Reinforced Net + }, + [90] = { + 133925, -- Fel Lash + }, + [100] = { + 33119, -- Malister's Frost Wand + }, + [150] = { + 46954, -- Flaming Spears + }, + [200] = { + 75208, -- Rancher's Lariat + }, +} + +-- This could've been done by checking player race as well and creating tables for those, but it's easier like this +for k, v in pairs(FriendSpells) do + tinsert(v, 28880) -- ["Gift of the Naaru"] +end + +-- >> END OF STATIC CONFIG + +-- cache + +local setmetatable = setmetatable +local tonumber = tonumber +local pairs = pairs +local tostring = tostring +local print = print +local next = next +local type = type +local wipe = wipe +local tinsert = tinsert +local tremove = tremove +local BOOKTYPE_SPELL = BOOKTYPE_SPELL +local GetSpellInfo = GetSpellInfo +local GetSpellBookItemName = GetSpellBookItemName +local GetNumSpellTabs = GetNumSpellTabs +local GetSpellTabInfo = GetSpellTabInfo +local GetItemInfo = GetItemInfo +local UnitAura = UnitAura +local UnitCanAttack = UnitCanAttack +local UnitCanAssist = UnitCanAssist +local UnitExists = UnitExists +local UnitIsDeadOrGhost = UnitIsDeadOrGhost +local CheckInteractDistance = CheckInteractDistance +local IsSpellInRange = IsSpellInRange +local IsItemInRange = IsItemInRange +local UnitClass = UnitClass +local UnitRace = UnitRace +local GetInventoryItemLink = GetInventoryItemLink +local GetSpecialization = GetSpecialization +local GetSpecializationInfo = GetSpecializationInfo +local GetTime = GetTime +local HandSlotId = GetInventorySlotInfo("HandsSlot") +local math_floor = math.floor +local UnitIsVisible = UnitIsVisible + +-- temporary stuff + +local pendingItemRequest +local itemRequestTimeoutAt +local foundNewItems +local cacheAllItems +local friendItemRequests +local harmItemRequests +local lastUpdate = 0 + +-- minRangeCheck is a function to check if spells with minimum range are really out of range, or fail due to range < minRange. See :init() for its setup +local minRangeCheck = function(unit) return CheckInteractDistance(unit, 2) end + +local checkers_Spell = setmetatable({}, { + __index = function(t, spellIdx) + local func = function(unit) + if IsSpellInRange(spellIdx, BOOKTYPE_SPELL, unit) == 1 then + return true + end + end + t[spellIdx] = func + return func + end +}) +local checkers_SpellWithMin = setmetatable({}, { + __index = function(t, spellIdx) + local func = function(unit) + if IsSpellInRange(spellIdx, BOOKTYPE_SPELL, unit) == 1 then + return true + elseif minRangeCheck(unit) then + return true, true + end + end + t[spellIdx] = func + return func + end +}) +local checkers_Item = setmetatable({}, { + __index = function(t, item) + local func = function(unit) + return IsItemInRange(item, unit) + end + t[item] = func + return func + end +}) +local checkers_Interact = setmetatable({}, { + __index = function(t, index) + local func = function(unit) + if CheckInteractDistance(unit, index) then + return true + end + end + t[index] = func + return func + end +}) + +-- helper functions + +local function copyTable(src, dst) + if type(dst) ~= "table" then dst = {} end + if type(src) == "table" then + for k, v in pairs(src) do + if type(v) == "table" then + v = copyTable(v, dst[k]) + end + dst[k] = v + end + end + return dst +end + + +local function initItemRequests(cacheAll) + friendItemRequests = copyTable(FriendItems) + harmItemRequests = copyTable(HarmItems) + cacheAllItems = cacheAll + foundNewItems = nil +end + +local function getNumSpells() + local _, _, offset, numSpells = GetSpellTabInfo(GetNumSpellTabs()) + return offset + numSpells +end + +-- return the spellIndex of the given spell by scanning the spellbook +local function findSpellIdx(spellName) + if not spellName or spellName == "" then + return nil + end + for i = 1, getNumSpells() do + local spell, rank = GetSpellBookItemName(i, BOOKTYPE_SPELL) + if spell == spellName then return i end + end + return nil +end + +-- minRange should be nil if there's no minRange, not 0 +local function addChecker(t, range, minRange, checker, info) + local rc = { ["range"] = range, ["minRange"] = minRange, ["checker"] = checker, ["info"] = info } + for i = 1, #t do + local v = t[i] + if rc.range == v.range then return end + if rc.range > v.range then + tinsert(t, i, rc) + return + end + end + tinsert(t, rc) +end + +local function createCheckerList(spellList, itemList, interactList) + local res = {} + if itemList then + for range, items in pairs(itemList) do + for i = 1, #items do + local item = items[i] + if GetItemInfo(item) then + addChecker(res, range, nil, checkers_Item[item], "item:" .. item) + break + end + end + end + end + + if spellList then + for i = 1, #spellList do + local sid = spellList[i] + local name, _, _, _, minRange, range = GetSpellInfo(sid) + local spellIdx = findSpellIdx(name) + if spellIdx and range then + minRange = math_floor(minRange + 0.5) + range = math_floor(range + 0.5) + -- print("### spell: " .. tostring(name) .. ", " .. tostring(minRange) .. " - " .. tostring(range)) + if minRange == 0 then -- getRange() expects minRange to be nil in this case + minRange = nil + end + if range == 0 then + range = MeleeRange + end + if minRange then + addChecker(res, range, minRange, checkers_SpellWithMin[spellIdx], "spell:" .. sid .. ":" .. tostring(name)) + else + addChecker(res, range, minRange, checkers_Spell[spellIdx], "spell:" .. sid .. ":" .. tostring(name)) + end + end + end + end + + if interactList and not next(res) then + for index, range in pairs(interactList) do + addChecker(res, range, nil, checkers_Interact[index], "interact:" .. index) + end + end + + return res +end + +-- returns minRange, maxRange or nil +local function getRange(unit, checkerList) + local lo, hi = 1, #checkerList + while lo <= hi do + local mid = math_floor((lo + hi) / 2) + local rc = checkerList[mid] + if rc.checker(unit) then + lo = mid + 1 + else + hi = mid - 1 + end + end + if lo > #checkerList then + return 0, checkerList[#checkerList].range + elseif lo <= 1 then + return checkerList[1].range, nil + else + return checkerList[lo].range, checkerList[lo - 1].range + end +end + +local function updateCheckers(origList, newList) + if #origList ~= #newList then + wipe(origList) + copyTable(newList, origList) + return true + end + for i = 1, #origList do + if origList[i].range ~= newList[i].range or origList[i].checker ~= newList[i].checker then + wipe(origList) + copyTable(newList, origList) + return true + end + end +end + +local function rcIterator(checkerList) + local curr = #checkerList + return function() + local rc = checkerList[curr] + if not rc then + return nil + end + curr = curr - 1 + return rc.range, rc.checker + end +end + +local function getMinChecker(checkerList, range) + local checker, checkerRange + for i = 1, #checkerList do + local rc = checkerList[i] + if rc.range < range then + return checker, checkerRange + end + checker, checkerRange = rc.checker, rc.range + end + return checker, checkerRange +end + +local function getMaxChecker(checkerList, range) + for i = 1, #checkerList do + local rc = checkerList[i] + if rc.range <= range then + return rc.checker, rc.range + end + end +end + +local function getChecker(checkerList, range) + for i = 1, #checkerList do + local rc = checkerList[i] + if rc.range == range then + return rc.checker + end + end +end + +local function null() +end + +local function createSmartChecker(friendChecker, harmChecker, miscChecker) + miscChecker = miscChecker or null + friendChecker = friendChecker or miscChecker + harmChecker = harmChecker or miscChecker + return function(unit) + if not UnitExists(unit) then + return nil + end + if UnitIsDeadOrGhost(unit) then + return miscChecker(unit) + end + if UnitCanAttack("player", unit) then + return harmChecker(unit) + elseif UnitCanAssist("player", unit) then + return friendChecker(unit) + else + return miscChecker(unit) + end + end +end + +-- OK, here comes the actual lib + +-- pre-initialize the checkerLists here so that we can return some meaningful result even if +-- someone manages to call us before we're properly initialized. miscRC should be independent of +-- race/class/talents, so it's safe to initialize it here +-- friendRC and harmRC will be properly initialized later when we have all the necessary data for them +lib.checkerCache_Spell = lib.checkerCache_Spell or {} +lib.checkerCache_Item = lib.checkerCache_Item or {} +lib.miscRC = createCheckerList(nil, nil, DefaultInteractList) +lib.friendRC = createCheckerList(nil, nil, DefaultInteractList) +lib.harmRC = createCheckerList(nil, nil, DefaultInteractList) + +lib.failedItemRequests = {} + +-- << Public API + + +--- The callback name that is fired when checkers are changed. +-- @field +lib.CHECKERS_CHANGED = "CHECKERS_CHANGED" +-- "export" it, maybe someone will need it for formatting +--- Constant for Melee range (2yd). +-- @field +lib.MeleeRange = MeleeRange + +function lib:findSpellIndex(spell) + if type(spell) == 'number' then + spell = GetSpellInfo(spell) + end + return findSpellIdx(spell) +end + +-- returns the range estimate as a string +-- deprecated, use :getRange(unit) instead and build your own strings +-- @param checkVisible if set to true, then a UnitIsVisible check is made, and **nil** is returned if the unit is not visible +function lib:getRangeAsString(unit, checkVisible, showOutOfRange) + local minRange, maxRange = self:getRange(unit, checkVisible) + if not minRange then return nil end + if not maxRange then + return showOutOfRange and minRange .. " +" or nil + end + return minRange .. " - " .. maxRange +end + +-- initialize RangeCheck if not yet initialized or if "forced" +function lib:init(forced) + if self.initialized and (not forced) then + return + end + self.initialized = true + local _, playerClass = UnitClass("player") + local _, playerRace = UnitRace("player") + + minRangeCheck = nil + -- first try to find a nice item we can use for minRangeCheck + if HarmItems[15] then + local items = HarmItems[15] + for i = 1, #items do + local item = items[i] + if GetItemInfo(item) then + minRangeCheck = function(unit) + return IsItemInRange(item, unit) + end + break + end + end + end + if not minRangeCheck then + -- ok, then try to find some class specific spell + if playerClass == "WARRIOR" then + -- for warriors, use Intimidating Shout if available + local name = GetSpellInfo(5246) -- ["Intimidating Shout"] + local spellIdx = findSpellIdx(name) + if spellIdx then + minRangeCheck = function(unit) + return (IsSpellInRange(spellIdx, BOOKTYPE_SPELL, unit) == 1) + end + end + elseif playerClass == "ROGUE" then + -- for rogues, use Blind if available + local name = GetSpellInfo(2094) -- ["Blind"] + local spellIdx = findSpellIdx(name) + if spellIdx then + minRangeCheck = function(unit) + return (IsSpellInRange(spellIdx, BOOKTYPE_SPELL, unit) == 1) + end + end + end + end + if not minRangeCheck then + -- fall back to interact distance checks + if playerClass == "HUNTER" or playerRace == "Tauren" then + -- for hunters, use interact4 as it's safer + -- for Taurens interact4 is actually closer than 25yd and interact3 is closer than 8yd, so we can't use that + minRangeCheck = checkers_Interact[4] + else + minRangeCheck = checkers_Interact[3] + end + end + + local interactList = InteractLists[playerRace] or DefaultInteractList + self.handSlotItem = GetInventoryItemLink("player", HandSlotId) + local changed = false + if updateCheckers(self.friendRC, createCheckerList(FriendSpells[playerClass], FriendItems, interactList)) then + changed = true + end + if updateCheckers(self.harmRC, createCheckerList(HarmSpells[playerClass], HarmItems, interactList)) then + changed = true + end + if updateCheckers(self.miscRC, createCheckerList(nil, nil, interactList)) then + changed = true + end + if changed and self.callbacks then + self.callbacks:Fire(self.CHECKERS_CHANGED) + end +end + +--- Return an iterator for checkers usable on friendly units as (**range**, **checker**) pairs. +function lib:GetFriendCheckers() + return rcIterator(self.friendRC) +end + +--- Return an iterator for checkers usable on enemy units as (**range**, **checker**) pairs. +function lib:GetHarmCheckers() + return rcIterator(self.harmRC) +end + +--- Return an iterator for checkers usable on miscellaneous units as (**range**, **checker**) pairs. These units are neither enemy nor friendly, such as people in sanctuaries or corpses. +function lib:GetMiscCheckers() + return rcIterator(self.miscRC) +end + +--- Return a checker suitable for out-of-range checking on friendly units, that is, a checker whose range is equal or larger than the requested range. +-- @param range the range to check for. +-- @return **checker**, **range** pair or **nil** if no suitable checker is available. **range** is the actual range the returned **checker** checks for. +function lib:GetFriendMinChecker(range) + return getMinChecker(self.friendRC, range) +end + +--- Return a checker suitable for out-of-range checking on enemy units, that is, a checker whose range is equal or larger than the requested range. +-- @param range the range to check for. +-- @return **checker**, **range** pair or **nil** if no suitable checker is available. **range** is the actual range the returned **checker** checks for. +function lib:GetHarmMinChecker(range) + return getMinChecker(self.harmRC, range) +end + +--- Return a checker suitable for out-of-range checking on miscellaneous units, that is, a checker whose range is equal or larger than the requested range. +-- @param range the range to check for. +-- @return **checker**, **range** pair or **nil** if no suitable checker is available. **range** is the actual range the returned **checker** checks for. +function lib:GetMiscMinChecker(range) + return getMinChecker(self.miscRC, range) +end + +--- Return a checker suitable for in-range checking on friendly units, that is, a checker whose range is equal or smaller than the requested range. +-- @param range the range to check for. +-- @return **checker**, **range** pair or **nil** if no suitable checker is available. **range** is the actual range the returned **checker** checks for. +function lib:GetFriendMaxChecker(range) + return getMaxChecker(self.friendRC, range) +end + +--- Return a checker suitable for in-range checking on enemy units, that is, a checker whose range is equal or smaller than the requested range. +-- @param range the range to check for. +-- @return **checker**, **range** pair or **nil** if no suitable checker is available. **range** is the actual range the returned **checker** checks for. +function lib:GetHarmMaxChecker(range) + return getMaxChecker(self.harmRC, range) +end + +--- Return a checker suitable for in-range checking on miscellaneous units, that is, a checker whose range is equal or smaller than the requested range. +-- @param range the range to check for. +-- @return **checker**, **range** pair or **nil** if no suitable checker is available. **range** is the actual range the returned **checker** checks for. +function lib:GetMiscMaxChecker(range) + return getMaxChecker(self.miscRC, range) +end + +--- Return a checker for the given range for friendly units. +-- @param range the range to check for. +-- @return **checker** function or **nil** if no suitable checker is available. +function lib:GetFriendChecker(range) + return getChecker(self.friendRC, range) +end + +--- Return a checker for the given range for enemy units. +-- @param range the range to check for. +-- @return **checker** function or **nil** if no suitable checker is available. +function lib:GetHarmChecker(range) + return getChecker(self.harmRC, range) +end + +--- Return a checker for the given range for miscellaneous units. +-- @param range the range to check for. +-- @return **checker** function or **nil** if no suitable checker is available. +function lib:GetMiscChecker(range) + return getChecker(self.miscRC, range) +end + +--- Return a checker suitable for out-of-range checking that checks the unit type and calls the appropriate checker (friend/harm/misc). +-- @param range the range to check for. +-- @return **checker** function. +function lib:GetSmartMinChecker(range) + return createSmartChecker( + getMinChecker(self.friendRC, range), + getMinChecker(self.harmRC, range), + getMinChecker(self.miscRC, range)) +end + +--- Return a checker suitable for in-range checking that checks the unit type and calls the appropriate checker (friend/harm/misc). +-- @param range the range to check for. +-- @return **checker** function. +function lib:GetSmartMaxChecker(range) + return createSmartChecker( + getMaxChecker(self.friendRC, range), + getMaxChecker(self.harmRC, range), + getMaxChecker(self.miscRC, range)) +end + +--- Return a checker for the given range that checks the unit type and calls the appropriate checker (friend/harm/misc). +-- @param range the range to check for. +-- @param fallback optional fallback function that gets called as fallback(unit) if a checker is not available for the given type (friend/harm/misc) at the requested range. The default fallback function return nil. +-- @return **checker** function. +function lib:GetSmartChecker(range, fallback) + return createSmartChecker( + getChecker(self.friendRC, range) or fallback, + getChecker(self.harmRC, range) or fallback, + getChecker(self.miscRC, range) or fallback) +end + +--- Get a range estimate as **minRange**, **maxRange**. +-- @param unit the target unit to check range to. +-- @param checkVisible if set to true, then a UnitIsVisible check is made, and **nil** is returned if the unit is not visible +-- @return **minRange**, **maxRange** pair if a range estimate could be determined, **nil** otherwise. **maxRange** is **nil** if **unit** is further away than the highest possible range we can check. +-- Includes checks for unit validity and friendly/enemy status. +-- @usage +-- local rc = LibStub("LibRangeCheck-2.0") +-- local minRange, maxRange = rc:GetRange('target') +-- local minRangeIfVisible, maxRangeIfVisible = rc:GetRange('target', true) +function lib:GetRange(unit, checkVisible) + if not UnitExists(unit) then + return nil + end + if checkVisible and not UnitIsVisible(unit) then + return nil + end + if UnitIsDeadOrGhost(unit) then + return getRange(unit, self.miscRC) + end + if UnitCanAttack("player", unit) then + return getRange(unit, self.harmRC) + elseif UnitCanAssist("player", unit) then + return getRange(unit, self.friendRC) + else + return getRange(unit, self.miscRC) + end +end + +-- keep this for compatibility +lib.getRange = lib.GetRange + +-- >> Public API + +function lib:OnEvent(event, ...) + if type(self[event]) == 'function' then + self[event](self, event, ...) + end +end + +function lib:LEARNED_SPELL_IN_TAB() + self:scheduleInit() +end + +function lib:CHARACTER_POINTS_CHANGED() + self:scheduleInit() +end + +function lib:PLAYER_TALENT_UPDATE() + self:scheduleInit() +end + +function lib:SPELLS_CHANGED() + self:scheduleInit() +end + +function lib:UNIT_INVENTORY_CHANGED(event, unit) + if self.initialized and unit == "player" and self.handSlotItem ~= GetInventoryItemLink("player", HandSlotId) then + self:scheduleInit() + end +end + +function lib:UNIT_AURA(event, unit) + if self.initialized and unit == "player" then + self:scheduleAuraCheck() + end +end + +function lib:GET_ITEM_INFO_RECEIVED(event, item, success) + -- print("### GET_ITEM_INFO_RECEIVED: " .. tostring(item) .. ", " .. tostring(success)) + if item == pendingItemRequest then + pendingItemRequest = nil + if not success then + self.failedItemRequests[item] = true + end + lastUpdate = UpdateDelay + end +end + +function lib:processItemRequests(itemRequests) + while true do + local range, items = next(itemRequests) + if not range then return end + while true do + local i, item = next(items) + if not i then + itemRequests[range] = nil + break + elseif self.failedItemRequests[item] then + -- print("### processItemRequests: failed: " .. tostring(item)) + tremove(items, i) + elseif item == pendingItemRequest and GetTime() < itemRequestTimeoutAt then + return true; -- still waiting for server response + elseif GetItemInfo(item) then + -- print("### processItemRequests: found: " .. tostring(item)) + if itemRequestTimeoutAt then + -- print("### processItemRequests: new: " .. tostring(item)) + foundNewItems = true + itemRequestTimeoutAt = nil + pendingItemRequest = nil + end + if not cacheAllItems then + itemRequests[range] = nil + break + end + tremove(items, i) + elseif not itemRequestTimeoutAt then + -- print("### processItemRequests: waiting: " .. tostring(item)) + itemRequestTimeoutAt = GetTime() + ItemRequestTimeout + pendingItemRequest = item + if not self.frame:IsEventRegistered("GET_ITEM_INFO_RECEIVED") then + self.frame:RegisterEvent("GET_ITEM_INFO_RECEIVED") + end + return true + elseif GetTime() >= itemRequestTimeoutAt then + -- print("### processItemRequests: timeout: " .. tostring(item)) + if cacheAllItems then + print(MAJOR_VERSION .. ": timeout for item: " .. tostring(item)) + end + self.failedItemRequests[item] = true + itemRequestTimeoutAt = nil + pendingItemRequest = nil + tremove(items, i) + else + return true -- still waiting for server response + end + end + end +end + +function lib:initialOnUpdate() + self:init() + if friendItemRequests then + if self:processItemRequests(friendItemRequests) then return end + friendItemRequests = nil + end + if harmItemRequests then + if self:processItemRequests(harmItemRequests) then return end + harmItemRequests = nil + end + if foundNewItems then + self:init(true) + foundNewItems = nil + end + if cacheAllItems then + print(MAJOR_VERSION .. ": finished cache") + cacheAllItems = nil + end + self.frame:Hide() + self.frame:UnregisterEvent("GET_ITEM_INFO_RECEIVED") +end + +function lib:scheduleInit() + self.initialized = nil + lastUpdate = 0 + self.frame:Show() +end + +function lib:scheduleAuraCheck() + lastUpdate = UpdateDelay + self.frame:Show() +end + + +-- << load-time initialization + +function lib:activate() + if not self.frame then + local frame = CreateFrame("Frame") + self.frame = frame + frame:RegisterEvent("LEARNED_SPELL_IN_TAB") + frame:RegisterEvent("CHARACTER_POINTS_CHANGED") + if not IsClassic then + frame:RegisterEvent("PLAYER_TALENT_UPDATE") + end + frame:RegisterEvent("SPELLS_CHANGED") + local _, playerClass = UnitClass("player") + if playerClass == "MAGE" or playerClass == "SHAMAN" then + -- Mage and Shaman gladiator gloves modify spell ranges + frame:RegisterUnitEvent("UNIT_INVENTORY_CHANGED", "player") + end + end + initItemRequests() + self.frame:SetScript("OnEvent", function(frame, ...) self:OnEvent(...) end) + self.frame:SetScript("OnUpdate", function(frame, elapsed) + lastUpdate = lastUpdate + elapsed + if lastUpdate < UpdateDelay then + return + end + lastUpdate = 0 + self:initialOnUpdate() + end) + self:scheduleInit() +end + +--- BEGIN CallbackHandler stuff + +do + local lib = lib -- to keep a ref even though later we nil lib + --- Register a callback to get called when checkers are updated + -- @class function + -- @name lib.RegisterCallback + -- @usage + -- rc.RegisterCallback(self, rc.CHECKERS_CHANGED, "myCallback") + -- -- or + -- rc.RegisterCallback(self, "CHECKERS_CHANGED", someCallbackFunction) + -- @see CallbackHandler-1.0 documentation for more details + lib.RegisterCallback = lib.RegisterCallback or function(...) + local CBH = LibStub("CallbackHandler-1.0") + lib.RegisterCallback = nil -- extra safety, we shouldn't get this far if CBH is not found, but better an error later than an infinite recursion now + lib.callbacks = CBH:New(lib) + -- ok, CBH hopefully injected or new shiny RegisterCallback + return lib.RegisterCallback(...) + end +end + +--- END CallbackHandler stuff + +lib:activate() +lib = nil diff --git a/Libs/LibStub/LibStub.lua b/Libs/LibStub/LibStub.lua new file mode 100644 index 0000000..0a41ac0 --- /dev/null +++ b/Libs/LibStub/LibStub.lua @@ -0,0 +1,30 @@ +-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info +-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke +local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! +local LibStub = _G[LIBSTUB_MAJOR] + +if not LibStub or LibStub.minor < LIBSTUB_MINOR then + LibStub = LibStub or {libs = {}, minors = {} } + _G[LIBSTUB_MAJOR] = LibStub + LibStub.minor = LIBSTUB_MINOR + + function LibStub:NewLibrary(major, minor) + assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") + minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") + + local oldminor = self.minors[major] + if oldminor and oldminor >= minor then return nil end + self.minors[major], self.libs[major] = minor, self.libs[major] or {} + return self.libs[major], oldminor + end + + function LibStub:GetLibrary(major, silent) + if not self.libs[major] and not silent then + error(("Cannot find a library instance of %q."):format(tostring(major)), 2) + end + return self.libs[major], self.minors[major] + end + + function LibStub:IterateLibraries() return pairs(self.libs) end + setmetatable(LibStub, { __call = LibStub.GetLibrary }) +end diff --git a/README.md b/README.md index f83e0e8..4af137f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# SmartBuff Classic, SoM, TBC Classic & WOTLK CLassic +# SmartBuff Wrath of the Lich King CLassic -For clarity, this repository is ONLY for the Classic version of the client as listed above, and it is not the Retail version of the client. +For clarity, this repository is ONLY for the WOTLK Classic version of the client as listed above, and it is not the Retail or Classic Era. SmartBuff is a buff addon to monitor you, your party or raids buffs easily and quickly allowing you to cast those that are missing - all classes are supported. @@ -15,6 +15,7 @@ Run the mod when ever you wish, if nothing is buffed, there is no penalty or coo - Checks buffs and rebuffs you, raid, party members and pets. - Setup your own buff templates (Solo, Party, Raid, Battleground, MC, Onyxia, BWL, AQ, ZG, Custom 1-5) - Auto switch templates when playing solo, in a party or raid etc. +- Auto switch Gathering Trackers such as Find Herbs, Find Minerals and Find Fish - Individual setup for each buff. - Supports group buffs: 'Gift of the Wild'/'Arcane Brilliance'/'Prayer of Fortitude'/'Prayer of Spirit', incl. group size and reagence checks. - Supports class buffs: all greater blessings of the Paladin. @@ -36,7 +37,7 @@ Run the mod when ever you wish, if nothing is buffed, there is no penalty or coo Minimap button: - Left click: opens SmartBuff options frame - Right click: enables/disables SmartBuff -- Alt-Left click: SmartDebuff +- Alt-Left click: Toggle Gathering Switcher - Shift-Left click: move minimap button @@ -64,10 +65,17 @@ If you prefer to use Smartbuff in a macro rather than scrolling your mouse or us /click SmartBuff_KeyButton + +## Known Issues & Reminders/TODO + +- Rogue poison links need implementing for Lethal / Non-Lethal. + + + ## Contact / Support You will find me on: -- Classic Server: Mik/Castanova/Amarantine/Paramedic on EU-Mirage Raceway +- Classic Server: Gabella/Mik/Castanova/Amarantine/Paramedic on EU-Mirage Raceway - Retail: Challenger, Castanova, Paramedic and many others on EU-Aszune Join me on discord to offer feedback, report bugs and much more: https://discord.gg/R6EkZ94TKK diff --git a/ReadMe.txt b/ReadMe.txt index 3be805b..4457134 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,18 +1,8 @@ *********************************************************************** - -SmartBuff - Retail / Classic TBC / Seasons of Mastery / WOTLK versions by Codermik - -You will find me on: - Classic Server: Mik/Castanova/Amarantine/Paramedic on EU-Mirage Raceway - Retail: Challenger, Castanova, Paramedic and many others on EU-Aszune - -Join me on discord to offer feedback, report bugs and much more: https://discord.gg/R6EkZ94TKK - -If you would like to help support the addon development please see the addon options screen. - +SmartBuff *********************************************************************** -SmartBuff is a buff addon to cast buffs easily and quickly. All classes are supported. +SmartBuff is a buff addon, to cast buffs ease and quickly. All classes are supported. Bind a key and it checks if you, a party/raid member, also hunter and warlock pets, needs your buff and cast it. Use the options menu to configure it you like, as example: buffs, raid subgroups, pets, etc. Run the mod when ever you wish, if nothing is buffed, there is no penalty or cool down. @@ -21,10 +11,10 @@ Features: - Supports all classes - Supports EN/DE/FR clients - Checks buffs and rebuff you, raid/party members, raid/party pets -- Setup your own buff templates (Solo, Party, Raid, Battleground, MC, Onyxia, BWL, AQ, ZG, Custom 1-5) +- Setup your own buff templates (Solo, Party, Raid, Battleground, MC, Ony, BWL, AQ, ZG, Custom 1-5) - Auto switch templates - Individual setup for each buff -- Supports group buffs: 'Gift of the Wild'/'Arcane Brilliance'/'Prayer of Fortitude'/'Prayer of Spirit', incl. group size and reagence check +- Supports group buffs: 'Gift of the Wild'/'Arcane Brilliance'/'Prayer of Fortitude'/'Prayer of Spirit', incl. group size and regeance check - Supports class buffs: all greater blessings of the Paladin - Supports self buffs - Supports weapon buffs (individual for main and off hand): Shaman, all poisons (Rogue), all stones and oils, incl. reagence check @@ -32,17 +22,17 @@ Features: - Supports tracking abilities - Reminder if a buff is missing (Splash/chat/sound) - ReBuff Timer -- Scrollwhell or only one key is needed +- Scrollwheel or only one key is needed - Fast and easy to use - FuBar support - Titan Panel support Usage: -Minimap button: +Minimapbutton: Left click: opens SmartBuff options frame Right click: enables/disables SmartBuff -Alt-Left click: SmartDebuff +Alt-Left click: Toggle Gathering swithing Shift-Left click: move minimap button Chat: @@ -58,3 +48,4 @@ rafp - reset all frame positions Options frame: Right click on buff checkbox: opens buff setup frame + diff --git a/SmartBuff.buffs.lua b/SmartBuff.buffs.lua index 9f1d421..1890f5c 100644 --- a/SmartBuff.buffs.lua +++ b/SmartBuff.buffs.lua @@ -1,11 +1,3 @@ -------------------------------------------------------------------------------- --- SmartBuff --- Originally created by Aeldra (EU-Proudmoore) --- Classic versions by Codermik (Mik/Castanova/Amarantine EU-Mirage Raceway) --- Discord: https://discord.gg/R6EkZ94TKK --- Cast the most important buffs on you, tanks or party/raid members/pets. -------------------------------------------------------------------------------- - local _; local S = SMARTBUFF_GLOBALS; @@ -29,8 +21,6 @@ SMARTBUFF_CONST_ITEM = "ITEM"; SMARTBUFF_CONST_ITEMGROUP = "ITEMGROUP"; SMARTBUFF_CONST_TOY = "TOY"; -SMARTBUFF_ALCHEMY_ADJ = 1; - S.CheckPet = "CHECKPET"; S.CheckPetNeeded = "CHECKPETNEEDED"; S.CheckFishingPole = "CHECKFISHINGPOLE"; @@ -40,9 +30,8 @@ S.Toybox = { }; local function GetItems(items) local t = { }; for _, id in pairs(items) do - local name = GetItemInfo(id); + local _,name = GetItemInfo(id); if (name) then - --print("Item found: "..id..", "..name); tinsert(t, name); end end @@ -50,10 +39,9 @@ local function GetItems(items) end local function InsertItem(t, type, itemId, spellId, duration, link) - local item = GetItemInfo(itemId); + local _,item = GetItemInfo(itemId); -- item link local spell = GetSpellInfo(spellId); if (item and spell) then - --print("Item found: "..item..", "..spell); tinsert(t, {item, duration, type, nil, spell, link}); end end @@ -62,388 +50,442 @@ local function AddItem(itemId, spellId, duration, link) InsertItem(SMARTBUFF_SCROLL, SMARTBUFF_CONST_SCROLL, itemId, spellId, duration, link); end - ----------------------------------------------------------------------------------------------------------------------------------- ---- ---- Initialise Item List ---- ----------------------------------------------------------------------------------------------------------------------------------- +-- +-- Initialise Item Lists +-- function SMARTBUFF_InitItemList() - - -- Reagents - SMARTBUFF_WILDBERRIES = GetItemInfo(17021); -- Wild Berries - SMARTBUFF_WILDTHORNROOT = GetItemInfo(17026); -- Wild Thornroot - SMARTBUFF_WILDQUILLVINE = GetItemInfo(22148); -- Wild Quillvine - SMARTBUFF_ARCANEPOWDER = GetItemInfo(17020); -- Arcane Powder - SMARTBUFF_HOLYCANDLE = GetItemInfo(17028); -- Holy Candle - SMARTBUFF_SACREDCANDLE = GetItemInfo(17029); -- Sacred Candle - SMARTBUFF_SYMBOLOFKINGS = GetItemInfo(21177); -- Symbol of Kings - - -- Stones and oils etc. - SMARTBUFF_HEALTHSTONEGEM1 = GetItemInfo(5512); -- Healthstone Rank 1 - SMARTBUFF_HEALTHSTONEGEM2 = GetItemInfo(5511); -- Healthstone Rank 2 - SMARTBUFF_HEALTHSTONEGEM3 = GetItemInfo(5509); -- Healthstone Rank 3 - SMARTBUFF_HEALTHSTONEGEM4 = GetItemInfo(5510); -- Healthstone Rank 4 - SMARTBUFF_HEALTHSTONEGEM5 = GetItemInfo(9421); -- Healthstone Rank 5 - SMARTBUFF_HEALTHSTONEGEM6 = GetItemInfo(22103); -- Healthstone Rank 6 - SMARTBUFF_HEALTHSTONEGEM7 = GetItemInfo(36889); -- Healthstone Rank 7 - SMARTBUFF_HEALTHSTONEGEM8 = GetItemInfo(36892); -- Healthstone Rank 8 - SMARTBUFF_SOULSTONEGEM1 = GetItemInfo(5232); -- Soulstone Rank 1 - SMARTBUFF_SOULSTONEGEM2 = GetItemInfo(16892); -- Soulstone Rank 2 - SMARTBUFF_SOULSTONEGEM3 = GetItemInfo(16893); -- Soulstone Rank 3 - SMARTBUFF_SOULSTONEGEM4 = GetItemInfo(16895); -- Soulstone Rank 4 - SMARTBUFF_SOULSTONEGEM5 = GetItemInfo(16896); -- Soulstone Rank 5 - SMARTBUFF_SOULSTONEGEM6 = GetItemInfo(22116); -- Soulstone Rank 6 - SMARTBUFF_SOULSTONEGEM7 = GetItemInfo(36895); -- Soulstone Rank 7 - SMARTBUFF_LOCKSPELLSTONE1 = GetItemInfo(41191); -- Warlock Spellstone 1 - SMARTBUFF_LOCKSPELLSTONE2 = GetItemInfo(41192); -- Warlock Spellstone 2 - SMARTBUFF_LOCKSPELLSTONE3 = GetItemInfo(41193); -- Warlock Spellstone 3 - SMARTBUFF_LOCKSPELLSTONE4 = GetItemInfo(41194); -- Warlock Spellstone 4 - SMARTBUFF_LOCKSPELLSTONE5 = GetItemInfo(41195); -- Warlock Spellstone 5 - SMARTBUFF_LOCKSPELLSTONE6 = GetItemInfo(41196); -- Warlock Spellstone 6 - SMARTBUFF_LOCKFIRESTONE1 = GetItemInfo(41170); -- Warlock Firestone 1 - SMARTBUFF_LOCKFIRESTONE2 = GetItemInfo(41169); -- Warlock Firestone 2 - SMARTBUFF_LOCKFIRESTONE3 = GetItemInfo(41171); -- Warlock Firestone 3 - SMARTBUFF_LOCKFIRESTONE4 = GetItemInfo(41172); -- Warlock Firestone 4 - SMARTBUFF_LOCKFIRESTONE5 = GetItemInfo(40773); -- Warlock Firestone 5 - SMARTBUFF_LOCKFIRESTONE6 = GetItemInfo(41173); -- Warlock Firestone 6 - SMARTBUFF_LOCKFIRESTONE7 = GetItemInfo(41174); -- Warlock Firestone 7 - SMARTBUFF_LESSERMANAOIL = GetItemInfo(20747); -- Lesser Mana Oil - SMARTBUFF_BRILLIANTMANAOIL = GetItemInfo(20748); -- Brilliant Mana Oil - SMARTBUFF_BRILLIANTWIZARDOIL = GetItemInfo(20749); -- Brilliant Wizard Oil - SMARTBUFF_SUPERIORMANAOIL = GetItemInfo(22521); -- Superior Mana Oil - SMARTBUFF_SUPERIORWIZARDOIL = GetItemInfo(22522); -- Superior Wizard Oil - SMARTBUFF_EXCEPTIONALWIZARDOIL = GetItemInfo(36900); -- Exceptional Wizard Oil - SMARTBUFF_OILOFIMMOLATION = GetItemInfo(8956); -- Oil of Immolation - SMARTBUFF_SOLIDWSTONE = GetItemInfo(7965); -- Solid Weighstone - SMARTBUFF_SOLIDSSTONE = GetItemInfo(7964); -- Solid Sharpening Stone - SMARTBUFF_ELEMENTALSSTONE = GetItemInfo(18262); -- Solid Weightstone - SMARTBUFF_ADAMANTITEWSTONE = GetItemInfo(28421); -- Adamantite Weightstone - SMARTBUFF_ADAMANTITESSTONE = GetItemInfo(23529); -- Adamantite Sharpening Stone - SMARTBUFF_HEAVYWSTONE = GetItemInfo(3241); -- Heavy Weighstone - SMARTBUFF_HEAVYSSTONE = GetItemInfo(2871); -- Heavy Sharpening Stone - SMARTBUFF_WEIGHSTONE = GetItemInfo(28420); -- Fel Weighstone - SMARTBUFF_FELSHARPENINGSTONE = GetItemInfo(23528); -- Greater Rune of Warding - - -- Poisons (some - SMARTBUFF_INSTANTPOISON1 = GetItemInfo(6947); -- Instant Poison - SMARTBUFF_INSTANTPOISON2 = GetItemInfo(6949); -- Instant Poison II - SMARTBUFF_INSTANTPOISON3 = GetItemInfo(6950); -- Instant Poison III - SMARTBUFF_INSTANTPOISON4 = GetItemInfo(8926); -- Instant Poison IV - SMARTBUFF_INSTANTPOISON5 = GetItemInfo(8927); -- Instant Poison V - SMARTBUFF_INSTANTPOISON6 = GetItemInfo(8928); -- Instant Poison VI - SMARTBUFF_INSTANTPOISON7 = GetItemInfo(21927); -- Instant Poison VII - SMARTBUFF_WOUNDPOISON1 = GetItemInfo(10918); -- Wound Poison - SMARTBUFF_WOUNDPOISON2 = GetItemInfo(10920); -- Wound Poison II - SMARTBUFF_WOUNDPOISON3 = GetItemInfo(10921); -- Wound Poison III - SMARTBUFF_WOUNDPOISON4 = GetItemInfo(10922); -- Wound Poison IV - SMARTBUFF_WOUNDPOISON5 = GetItemInfo(22055); -- Wound Poison V - SMARTBUFF_MINDPOISON1 = GetItemInfo(5237); -- Mind-numbing Poison - SMARTBUFF_MINDPOISON2 = GetItemInfo(6951); -- Mind-numbing Poison II - SMARTBUFF_MINDPOISON3 = GetItemInfo(9186); -- Mind-numbing Poison III - SMARTBUFF_DEADLYPOISON1 = GetItemInfo(2892); -- Deadly Poison - SMARTBUFF_DEADLYPOISON2 = GetItemInfo(2893); -- Deadly Poison II - SMARTBUFF_DEADLYPOISON3 = GetItemInfo(8984); -- Deadly Poison III - SMARTBUFF_DEADLYPOISON4 = GetItemInfo(8985); -- Deadly Poison IV - SMARTBUFF_DEADLYPOISON5 = GetItemInfo(20844); -- Deadly Poison V - SMARTBUFF_DEADLYPOISON6 = GetItemInfo(22053); -- Deadly Poison VI - SMARTBUFF_DEADLYPOISON7 = GetItemInfo(22054); -- Deadly Poison VII - SMARTBUFF_CRIPPLINGPOISON1 = GetItemInfo(3775); -- Crippling Poison - SMARTBUFF_CRIPPLINGPOISON2 = GetItemInfo(3776); -- Crippling Poison II - SMARTBUFF_ANESTHETICPOISON1 = GetItemInfo(21835); -- Anesthetic Poison - + -- Stones and oils + _,SMARTBUFF_LOCKHEALTHSTONE = GetItemInfo(5512); --"Healthstone" + _,SMARTBUFF_LOCKSPELLSTONE = GetItemInfo(41191); --"Spellstone" + _,SMARTBUFF_LOCKFIRESTONE = GetItemInfo(41170); --"Firestone" + _,SMARTBUFF_HSMINOR = GetItemInfo(5512); --"Minor Healthstone" + _,SMARTBUFF_HSLESSER = GetItemInfo(5511); --"Lesser Healthstone" + _,SMARTBUFF_HSTONE = GetItemInfo(5509); --"Healthstone" + _,SMARTBUFF_HSGREATER = GetItemInfo(5510); --"Greater Healthstone" + _,SMARTBUFF_HSMAJOR = GetItemInfo(9421); --"Major Healthstone" + _,SMARTBUFF_HSMASTER = GetItemInfo(22103); --"Master Healthstone" + _,SMARTBUFF_HSDEMONIC = GetItemInfo(36889); --"Demonic Healthstone" + _,SMARTBUFF_HSFEL = GetItemInfo(36892); --"Fel Healthstone" + _,SMARTBUFF_FIRESLESSER = GetItemInfo(41170); --"Lesser Firestone" + _,SMARTBUFF_FIRESSTONE = GetItemInfo(41169); --"Firestone" + _,SMARTBUFF_FIRESGREATER = GetItemInfo(41171); --"Greater Firestone" + _,SMARTBUFF_FIRESMAJOR = GetItemInfo(41172); --"Major Firestone" + _,SMARTBUFF_FIRESMASTER = GetItemInfo(40773); --"Master Firestone" + _,SMARTBUFF_FIRESFEL = GetItemInfo(41173); --"Fel Firestone" + _,SMARTBUFF_FIRESGRAND = GetItemInfo(41174); --"Grand Firestone" + _,SMARTBUFF_SPELLSTONE = GetItemInfo(41191); --"Spellstone" + _,SMARTBUFF_SPELLSGREATER = GetItemInfo(41192); --"Greater Spellstone" + _,SMARTBUFF_SPELLSMAJOR = GetItemInfo(41193); --"Major Spellstone" + _,SMARTBUFF_SPELLSMASTER = GetItemInfo(41194); --"Master Spellstone" + _,SMARTBUFF_SPELLSDEMONIC = GetItemInfo(41195); --"Demonic Spellstone" + _,SMARTBUFF_SPELLSGRAND = GetItemInfo(41196); --"Grand Spellstone" + _,SMARTBUFF_MANAGEM = GetItemInfo(36799); --"Mana Gem" + _,SMARTBUFF_BRILLIANTMANAGEM = GetItemInfo(81901); --"Brilliant Mana Gem" + _,SMARTBUFF_SSROUGH = GetItemInfo(2862); --"Rough Sharpening Stone" + _,SMARTBUFF_SSCOARSE = GetItemInfo(2863); --"Coarse Sharpening Stone" + _,SMARTBUFF_SSHEAVY = GetItemInfo(2871); --"Heavy Sharpening Stone" + _,SMARTBUFF_SSSOLID = GetItemInfo(7964); --"Solid Sharpening Stone" + _,SMARTBUFF_SSDENSE = GetItemInfo(12404); --"Dense Sharpening Stone" + _,SMARTBUFF_SSELEMENTAL = GetItemInfo(18262); --"Elemental Sharpening Stone" + _,SMARTBUFF_SSFEL = GetItemInfo(23528); --"Fel Sharpening Stone" + _,SMARTBUFF_SSADAMANTITE = GetItemInfo(23529); --"Adamantite Sharpening Stone" + _,SMARTBUFF_WSROUGH = GetItemInfo(3239); --"Rough Weightstone" + _,SMARTBUFF_WSCOARSE = GetItemInfo(3240); --"Coarse Weightstone" + _,SMARTBUFF_WSHEAVY = GetItemInfo(3241); --"Heavy Weightstone" + _,SMARTBUFF_WSSOLID = GetItemInfo(7965); --"Solid Weightstone" + _,SMARTBUFF_WSDENSE = GetItemInfo(12643); --"Dense Weightstone" + _,SMARTBUFF_WSFEL = GetItemInfo(28420); --"Fel Weightstone" + _,SMARTBUFF_WSADAMANTITE = GetItemInfo(28421); --"Adamantite Weightstone" + _,SMARTBUFF_SHADOWOIL = GetItemInfo(3824); --"Shadow Oil" + _,SMARTBUFF_FROSTOIL = GetItemInfo(3829); --"Frost Oil" + _,SMARTBUFF_MANAOIL1 = GetItemInfo(20745); --"Minor Mana Oil" + _,SMARTBUFF_MANAOIL2 = GetItemInfo(20747); --"Lesser Mana Oil" + _,SMARTBUFF_MANAOIL3 = GetItemInfo(20748); --"Brilliant Mana Oil" + _,SMARTBUFF_MANAOIL4 = GetItemInfo(22521); --"Superior Mana Oil" + _,SMARTBUFF_WIZARDOIL1 = GetItemInfo(20744); --"Minor Wizard Oil" + _,SMARTBUFF_WIZARDOIL2 = GetItemInfo(20746); --"Lesser Wizard Oil" + _,SMARTBUFF_WIZARDOIL3 = GetItemInfo(20750); --"Wizard Oil" + _,SMARTBUFF_WIZARDOIL4 = GetItemInfo(20749); --"Brilliant Wizard Oil" + _,SMARTBUFF_WIZARDOIL5 = GetItemInfo(22522); --"Superior Wizard Oil" -- Food - SMARTBUFF_GOLDENFISHSTICKS_ITEM = GetItemInfo(27666); -- Golden Fish Sticks - SMARTBUFF_FISHERMANSFEAST_ITEM = GetItemInfo(33052); -- Fisherman's Feast - SMARTBUFF_SKULLFISHSOUP_ITEM = GetItemInfo(33825); -- Skullfish Soup - SMARTBUFF_SPICYHOTTALBUK_ITEM = GetItemInfo(33872); -- Spicy Hot Talbuk - SMARTBUFF_BLACKENEDBASILISK_ITEM = GetItemInfo(27657); -- Blackened Basilisk - SMARTBUFF_BLACKENEDSPOREFISH_ITEM = GetItemInfo(27663); -- Blackened Sporefish - SMARTBUFF_BUZZARDBITES_ITEM = GetItemInfo(27651); -- Buzzard Bites - SMARTBUFF_CLAMBAR_ITEM = GetItemInfo(30155); -- Clam Bar - SMARTBUFF_CRUNCHYSERPENT_ITEM = GetItemInfo(31673); -- Crunchy Serpent - SMARTBUFF_FELTAILDELIGHT_ITEM = GetItemInfo(27662); -- Feltail Delight - SMARTBUFF_GRILLEDMUDFISH_ITEM = GetItemInfo(27664); -- Grilled Mudfish - SMARTBUFF_HELBOARBACON_ITEM = GetItemInfo(29292); -- Hellboar Bacon - SMARTBUFF_MOKNATHAKSHORTRIBS_ITEM = GetItemInfo(31672); -- Mok'Nathal Shortribs - SMARTBUFF_POACHEDBLUEFISH_ITEM = GetItemInfo(27665); -- Poached Bluefish - SMARTBUFF_RAVAGERDOG_ITEM = GetItemInfo(27655); -- Ravager Dog - SMARTBUFF_ROASTEDCLEFTHOOF_ITEM = GetItemInfo(27658); -- Roasted Clefthoof - SMARTBUFF_SPICYCRAWDAD_ITEM = GetItemInfo(27667); -- Spicy Crawdad - SMARTBUFF_TALBUKSTEAK_ITEM = GetItemInfo(27660); -- Talbuk Steak - SMARTBUFF_WARPBURGER_ITEM = GetItemInfo(27659); -- Warp Burger - SMARTBUFF_CHARREDBEARKABOBS_ITEM = GetItemInfo(35563); -- Charred Bear Kabobs - SMARTBUFF_ORONOKSTUBERSPELL_ITEM = GetItemInfo(30361); -- Oronok's Tuber of Spell Power - SMARTBUFF_ORONOKSTUBERAGILITY_ITEM = GetItemInfo(30358); -- Oronok's Tuber of Agility - SMARTBUFF_ORONOKSTUBERHEALS_ITEM = GetItemInfo(30357); -- Oronok's Tuber of Healing - SMARTBUFF_ORONOKSTUBERSTRENGTH_ITEM = GetItemInfo(30359); -- Oronok's Tuber of Strength - SMARTBUFF_HOTAPPLECIDER_ITEM = GetItemInfo(34411); -- Hot Apple Cider - SMARTBUFF_SKYGUARDRATIONS_ITEM = GetItemInfo(32721); -- Skyguard Rations - SMARTBUFF_DIRGESKICKINCHOPS_ITEM = GetItemInfo(21023); -- Dirge's Kickin' Chimaerok Chops - SMARTBUFF_JUICYBEARBURGER_ITEM = GetItemInfo(35565); -- Juicy Bear Burger - SMARTBUFF_NIGHTFINSOUP_ITEM = GetItemInfo(13931); -- Nightfin Soup - - -- Food item IDs - S.FoodItems = GetItems({ - -- WotLK - 39691, 34125, 42779, 42997, 42998, 42999, 43000, 34767, 42995, 34769, 34754, 34758, 34766, 42994, 42996, 34756, 34768, 42993, 34755, 43001, 34757, 34752, 34751, 34750, 34749, 34764, 34765, 34763, 34762, 42942, 43268, 34748, - }); - - -- Conjured mage food / Water IDs - S.FoodMage = GetItems({587, 597, 990, 6129, 10144, 10145, 28612, 33717 }); - S.WaterMage = GetItems({5504, 5505, 5506, 6127, 10138, 10139, 10140, 37420, 27090}); - S.MageManaBuscuit = ({34062}); - - -- Scrolls - SMARTBUFF_SOAGILITY1 = GetItemInfo(3012); -- Scroll of Agility I - SMARTBUFF_SOAGILITY2 = GetItemInfo(1477); -- Scroll of Agility II - SMARTBUFF_SOAGILITY3 = GetItemInfo(4425); -- Scroll of Agility III - SMARTBUFF_SOAGILITY4 = GetItemInfo(10309); -- Scroll of Agility IV - SMARTBUFF_SOAGILITY5 = GetItemInfo(27498); -- Scroll of Agility V - SMARTBUFF_SOAGILITY6 = GetItemInfo(33457); -- Scroll of Agility VI - SMARTBUFF_SOAGILITY7 = GetItemInfo(43463); -- Scroll of Agility VII - SMARTBUFF_SOAGILITY8 = GetItemInfo(43464); -- Scroll of Agility VIII - - SMARTBUFF_SOINTELLECT1 = GetItemInfo(955); -- Scroll of Intellect I - SMARTBUFF_SOINTELLECT2 = GetItemInfo(2290); -- Scroll of Intellect II - SMARTBUFF_SOINTELLECT3 = GetItemInfo(4419); -- Scroll of Intellect III - SMARTBUFF_SOINTELLECT4 = GetItemInfo(10308); -- Scroll of Intellect IV - SMARTBUFF_SOINTELLECT5 = GetItemInfo(27499); -- Scroll of Intellect V - SMARTBUFF_SOINTELLECT6 = GetItemInfo(33458); -- Scroll of Intellect VI - SMARTBUFF_SOINTELLECT7 = GetItemInfo(37091); -- Scroll of Intellect VII - SMARTBUFF_SOINTELLECT8 = GetItemInfo(37092); -- Scroll of Intellect VIII - - SMARTBUFF_SOSTAMINA1 = GetItemInfo(1180); -- Scroll of Stamina I - SMARTBUFF_SOSTAMINA2 = GetItemInfo(1711); -- Scroll of Stamina II - SMARTBUFF_SOSTAMINA3 = GetItemInfo(4422); -- Scroll of Stamina III - SMARTBUFF_SOSTAMINA4 = GetItemInfo(10307); -- Scroll of Stamina IV - SMARTBUFF_SOSTAMINA5 = GetItemInfo(27502); -- Scroll of Stamina V - SMARTBUFF_SOSTAMINA6 = GetItemInfo(33461); -- Scroll of Stamina VI - SMARTBUFF_SOSTAMINA7 = GetItemInfo(37093); -- Scroll of Stamina VII - SMARTBUFF_SOSTAMINA8 = GetItemInfo(37094); -- Scroll of Stamina VIII - - SMARTBUFF_SOSPIRIT1 = GetItemInfo(1181); -- Scroll of Spirit I - SMARTBUFF_SOSPIRIT2 = GetItemInfo(1712); -- Scroll of Spirit II - SMARTBUFF_SOSPIRIT3 = GetItemInfo(4424); -- Scroll of Spirit III - SMARTBUFF_SOSPIRIT4 = GetItemInfo(10306); -- Scroll of Spirit IV - SMARTBUFF_SOSPIRIT5 = GetItemInfo(27501); -- Scroll of Spirit V - SMARTBUFF_SOSPIRIT6 = GetItemInfo(33460); -- Scroll of Spirit VI - SMARTBUFF_SOSPIRIT7 = GetItemInfo(37097); -- Scroll of Spirit VII - SMARTBUFF_SOSPIRIT8 = GetItemInfo(37098); -- Scroll of Spirit VIII - - SMARTBUFF_SOSTRENGHT1 = GetItemInfo(954); -- Scroll of Strength I - SMARTBUFF_SOSTRENGHT2 = GetItemInfo(2289); -- Scroll of Strength II - SMARTBUFF_SOSTRENGHT3 = GetItemInfo(4426); -- Scroll of Strength III - SMARTBUFF_SOSTRENGHT4 = GetItemInfo(10310); -- Scroll of Strength IV - SMARTBUFF_SOSTRENGHT5 = GetItemInfo(27503); -- Scroll of Strength V - SMARTBUFF_SOSTRENGHT6 = GetItemInfo(33462); -- Scroll of Strength VI - SMARTBUFF_SOSTRENGHT7 = GetItemInfo(43465); -- Scroll of Strength VII - SMARTBUFF_SOSTRENGHT8 = GetItemInfo(43466); -- Scroll of Strength VIII + _,SMARTBUFF_BEERBASTEDBOARRIBS = GetItemInfo(2888); --Beer Basted Boar Ribs + _,SMARTBUFF_CRISPYBATWING = GetItemInfo(12224); --Crispy Bat Wing + _,SMARTBUFF_KALDOREISPIDERKABOB = GetItemInfo(5472); --Kaldorei Spider Kabob + _,SMARTBUFF_ROASTEDKODOMEAT = GetItemInfo(5474); --Roasted Kodo Meat + _,SMARTBUFF_HERBBAKEDEGG = GetItemInfo(6888); --Herb Baked Egg + _,SMARTBUFF_SPICEDWOLFMEAT = GetItemInfo(2680); --Spiced Wolf Meat + _,SMARTBUFF_BOILEDCLAMS = GetItemInfo(5525); --Boiled Clams + _,SMARTBUFF_COYOTESTEAK = GetItemInfo(2684); --Coyote Steak + _,SMARTBUFF_CRABCAKE = GetItemInfo(2683); --Crab Cake + _,SMARTBUFF_DRYPORKRIBS = GetItemInfo(2687); --Dry Pork Ribs + _,SMARTBUFF_BLOODSAUSAGE = GetItemInfo(3220); --Blood Sausage + _,SMARTBUFF_CROCOLISKSTEAK = GetItemInfo(3662); --Crocolisk Steak + _,SMARTBUFF_FILLETOFFRENZY = GetItemInfo(5476); --Fillet of Frenzy + _,SMARTBUFF_GORETUSKLIVERPIE = GetItemInfo(724); --Goretusk Liver Pie + _,SMARTBUFF_STRIDERSTEW = GetItemInfo(5477); --Strider Stew + _,SMARTBUFF_GOBLINDEVILEDCLAMS = GetItemInfo(5527); --Goblin Deviled Clams + _,SMARTBUFF_BIGBEARSTEAK = GetItemInfo(3726); --Big Bear Steak + _,SMARTBUFF_CRISPYLIZARDTAIL = GetItemInfo(5479); --Crispy Lizard Tail + _,SMARTBUFF_CROCOLISKGUMBO = GetItemInfo(3664); --Crocolisk Gumbo + _,SMARTBUFF_CURIOUSLYTASTYOMELET = GetItemInfo(3665); --Curiously Tasty Omelet + _,SMARTBUFF_GOOEYSPIDERCAKE = GetItemInfo(3666); --Gooey Spider Cake + _,SMARTBUFF_HOTLIONCHOPS = GetItemInfo(3727); --Hot Lion Chops + _,SMARTBUFF_LEANVENISON = GetItemInfo(5480); --Lean Venison + _,SMARTBUFF_LEANWOLFSTEAK = GetItemInfo(12209); --Lean Wolf Steak + _,SMARTBUFF_MURLOCFINSOUP = GetItemInfo(3663); --Murloc Fin Soup + _,SMARTBUFF_REDRIDGEGOULASH = GetItemInfo(1082); --Redridge Goulash + _,SMARTBUFF_SEASONEDWOLFKABOB = GetItemInfo(1017); --Seasoned Wolf Kabob + _,SMARTBUFF_CARRIONSURPRISE = GetItemInfo(12213); -- Carrion Surprise + _,SMARTBUFF_ROASTRAPTOR = GetItemInfo(12210); -- Roast Raptor + _,SMARTBUFF_GIANTCLAMSCORCHO = GetItemInfo(6038); -- Giant Clam Scorcho + _,SMARTBUFF_HEAVYCROCOLISKSTEW = GetItemInfo(20074); -- Heavy Crocolisk Stew + _,SMARTBUFF_HOTWOLFRIBS = GetItemInfo(13851); -- Hot Wolf Ribs + _,SMARTBUFF_JUNGLESTEW = GetItemInfo(12212); -- Jungle Stew + _,SMARTBUFF_MYSTERYSTEW = GetItemInfo(12214); -- Mystery Stew + _,SMARTBUFF_SOOTHINGTURTLEBISQUE = GetItemInfo(3729); -- Soothing Turtle Bisque + _,SMARTBUFF_TASTYLIONSTEAK = GetItemInfo(3728); -- Tasty Lion Steak + _,SMARTBUFF_SPIDERSAUSAGE = GetItemInfo(17222); -- Spider Sausage + _,SMARTBUFF_HEAVYKODOSTEW = GetItemInfo(12215); -- Heavy Kodo Stew + _,SMARTBUFF_MONSTEROMELET = GetItemInfo(12218); -- Monster Omelet + _,SMARTBUFF_SPICEDCHILICRAB = GetItemInfo(12216); -- Spiced Chili Crab + _,SMARTBUFF_TENDERWOLFSTEAK = GetItemInfo(18045); -- Tender Wolf Steak + _,SMARTBUFF_JUICYBEARBURGER = GetItemInfo(35565); --"Juicy Bear Burger" + _,SMARTBUFF_CRUNCHYSPIDER = GetItemInfo(22645); --"Crunchy Spider Surprise" + _,SMARTBUFF_LYNXSTEAK = GetItemInfo(27635); --"Lynx Steak" + _,SMARTBUFF_CHARREDBEARKABOBS = GetItemInfo(35563); --"Charred Bear Kabobs" + _,SMARTBUFF_BATBITES = GetItemInfo(27636); --"Bat Bites" + _,SMARTBUFF_ROASTEDMOONGRAZE = GetItemInfo(24105); --"Roasted Moongraze Tenderloin" + _,SMARTBUFF_MOKNATHALSHORTRIBS = GetItemInfo(31672); --"Mok'Nathal Shortribs" + _,SMARTBUFF_CRUNCHYSERPENT = GetItemInfo(31673); --"Crunchy Serpent" + _,SMARTBUFF_ROASTEDCLEFTHOOF = GetItemInfo(27658); --"Roasted Clefthoof" + _,SMARTBUFF_FISHERMANSFEAST = GetItemInfo(33052); --"Fisherman's Feast" + _,SMARTBUFF_WARPBURGER = GetItemInfo(27659); --"Warp Burger" + _,SMARTBUFF_RAVAGERDOG = GetItemInfo(27655); --"Ravager Dog" + _,SMARTBUFF_SKULLFISHSOUP = GetItemInfo(33825); --"Skullfish Soup" + _,SMARTBUFF_BUZZARDBITES = GetItemInfo(27651); --"Buzzard Bites" + _,SMARTBUFF_TALBUKSTEAK = GetItemInfo(27660); --"Talbuk Steak" + _,SMARTBUFF_GOLDENFISHSTICKS = GetItemInfo(27666); --"Golden Fish Sticks" + _,SMARTBUFF_SPICYHOTTALBUK = GetItemInfo(33872); --"Spicy Hot Talbuk" + _,SMARTBUFF_FELTAILDELIGHT = GetItemInfo(27662); --"Feltail Delight" + _,SMARTBUFF_BLACKENEDSPOREFISH = GetItemInfo(27663); --"Blackened Sporefish" + _,SMARTBUFF_HOTAPPLECIDER = GetItemInfo(34411); --"Hot Apple Cider" + _,SMARTBUFF_BROILEDBLOODFIN = GetItemInfo(33867); --"Broiled Bloodfin" + _,SMARTBUFF_SPICYCRAWDAD = GetItemInfo(27667); --"Spicy Crawdad" + _,SMARTBUFF_POACHEDBLUEFISH = GetItemInfo(27665); --"Poached Bluefish" + _,SMARTBUFF_BLACKENEDBASILISK = GetItemInfo(27657); --"Blackened Basilisk" + _,SMARTBUFF_GRILLEDMUDFISH = GetItemInfo(27664); --"Grilled Mudfish" + _,SMARTBUFF_CLAMBAR = GetItemInfo(30155); --"Clam Bar" + _,SMARTBUFF_SAGEFISHDELIGHT = GetItemInfo(21217); --"Sagefish Delight" + -- poisons + _,SMARTBUFF_INSTANTPOISON1 = GetItemInfo(6947); -- Instant Poison + _,SMARTBUFF_INSTANTPOISON2 = GetItemInfo(6949); -- Instant Poison II + _,SMARTBUFF_INSTANTPOISON3 = GetItemInfo(6950); -- Instant Poison III + _,SMARTBUFF_INSTANTPOISON4 = GetItemInfo(8926); -- Instant Poison IV + _,SMARTBUFF_INSTANTPOISON5 = GetItemInfo(8927); -- Instant Poison V + _,SMARTBUFF_INSTANTPOISON6 = GetItemInfo(8928); -- Instant Poison VI + _,SMARTBUFF_INSTANTPOISON7 = GetItemInfo(21927); -- Instant Poison VII + _,SMARTBUFF_INSTANTPOISON8 = GetItemInfo(43230); -- Instant Poison VIII + _,SMARTBUFF_INSTANTPOISON9 = GetItemInfo(43231); -- Instant Poison IX + _,SMARTBUFF_WOUNDPOISON1 = GetItemInfo(10918); -- Wound Poison + _,SMARTBUFF_WOUNDPOISON2 = GetItemInfo(10920); -- Wound Poison II + _,SMARTBUFF_WOUNDPOISON3 = GetItemInfo(10921); -- Wound Poison III + _,SMARTBUFF_WOUNDPOISON4 = GetItemInfo(10922); -- Wound Poison IV + _,SMARTBUFF_WOUNDPOISON5 = GetItemInfo(22055); -- Wound Poison V + _,SMARTBUFF_WOUNDPOISON6 = GetItemInfo(43234); -- Wound Poison VI + _,SMARTBUFF_WOUNDPOISON7 = GetItemInfo(43235); -- Wound Poison VII + _,SMARTBUFF_MINDPOISON1 = GetItemInfo(5237); -- Mind-numbing Poison + _,SMARTBUFF_MINDPOISON2 = GetItemInfo(6951); -- Mind-numbing Poison II + _,SMARTBUFF_MINDPOISON3 = GetItemInfo(9186); -- Mind-numbing Poison III + _,SMARTBUFF_DEADLYPOISON1 = GetItemInfo(2892); -- Deadly Poison + _,SMARTBUFF_DEADLYPOISON2 = GetItemInfo(2893); -- Deadly Poison II + _,SMARTBUFF_DEADLYPOISON3 = GetItemInfo(8984); -- Deadly Poison III + _,SMARTBUFF_DEADLYPOISON4 = GetItemInfo(8985); -- Deadly Poison IV + _,SMARTBUFF_DEADLYPOISON5 = GetItemInfo(20844); -- Deadly Poison V + _,SMARTBUFF_DEADLYPOISON6 = GetItemInfo(22053); -- Deadly Poison VI + _,SMARTBUFF_DEADLYPOISON7 = GetItemInfo(22054); -- Deadly Poison VII + _,SMARTBUFF_DEADLYPOISON8 = GetItemInfo(43232); -- Deadly Poison VIII + _,SMARTBUFF_DEADLYPOISON9 = GetItemInfo(43233); -- Deadly Poison IX + _,SMARTBUFF_CRIPPLINGPOISON1 = GetItemInfo(3775); -- Crippling Poison + _,SMARTBUFF_CRIPPLINGPOISON2 = GetItemInfo(3776); -- Crippling Poison II + _,SMARTBUFF_ANESTHETICPOISON1 = GetItemInfo(21835); -- Anesthetic Poison + _,SMARTBUFF_ANESTHETICPOISON2 = GetItemInfo(43237); -- Anesthetic Poison II + + -- Food item IDs + S.FoodItems = GetItems({39691, 34125, 42779, 42997, 42998, 42999, 43000, 34767, 42995, 34769, 34754, 34758, 34766, 42994, 42996, 34756, 34768, 42993, 34755, 43001, 34757, 34752, 34751, 34750, 34749, 34764, 34765, 34763, 34762, 42942, 43268, 34748, }); + + -- Conjured items + ConjuredMageFood = { 5349, 1113, 1114, 1487, 8075, 8076, 22895, 22019, 43518, 43523 }; -- classic > wotlk conjured mage food + ConjuredMageWater = { 5350, 2288, 2136, 3772, 8077, 8078, 8079, 30703, 22018 }; -- classic > wotlk conjured mage water + ConjuredMageGems = { 5514, 5513, 8007, 8008, 22044, 33312}; -- classic > wotlk conjured gems. + ConjuredLockHealthStones = { 5512, 5511, 5509, 5510, 11730, 22103, 36889, 36892, 36894 }; -- classic > wotlk warlock healthstones + ConjuredLockSoulstones = { 5232, 16892, 16893, 16895, 16896, 22116, 36895, }; -- classic > wotlk warlock soulstones + ConjuredLockSpellstones = { 41191, 41192, 41193, 41194, 41195, 41196 }; -- classic > wotlk warlock spellstones + ConjuredLockFirestones = { 41170, 41169, 41171, 41172, 40773, 41173, 41174 }; -- classic > wotlk warlock firestones - SMARTBUFF_SOPROTECTION1 = GetItemInfo(3013); -- Scroll of Protection I - SMARTBUFF_SOPROTECTION2 = GetItemInfo(1478); -- Scroll of Protection II - SMARTBUFF_SOPROTECTION3 = GetItemInfo(4421); -- Scroll of Protection III - SMARTBUFF_SOPROTECTION4 = GetItemInfo(10305); -- Scroll of Protection IV - SMARTBUFF_SOPROTECTION5 = GetItemInfo(27500); -- Scroll of Protection V - SMARTBUFF_SOPROTECTION6 = GetItemInfo(33459); -- Scroll of Protection VI - SMARTBUFF_SOPROTECTION7 = GetItemInfo(43467); -- Scroll of Protection VII - SMARTBUFF_SOPROTECTION8 = GetItemInfo(43468); -- Scroll of Protection VIII - - -- Potions / Elixirs / Flasks Items - SMARTBUFF_ADEPTELIXIR_ITEM = GetItemInfo(28103); -- Adept's Elixir - SMARTBUFF_MAJORDEFENSE_ITEM = GetItemInfo(22834); -- Major Defense - SMARTBUFF_MAJORAGILITY_ITEM = GetItemInfo(22831); -- Major Agility - SMARTBUFF_DRAENICWISDOM_ITEM = GetItemInfo(32067); -- Draenic Wisdom - SMARTBUFF_MAJORFROSTPOWER_ITEM = GetItemInfo(22827); -- Major Frost Power - SMARTBUFF_EARTHEN_ITEM = GetItemInfo(32063); -- Earthen Elixir - SMARTBUFF_MASTERY_ITEM = GetItemInfo(28104); -- Elixir of Mastery - SMARTBUFF_CAMOUFLAGE_ITEM = GetItemInfo(22823); -- Elixir of Camouflage - SMARTBUFF_HEALINGPOWER_ITEM = GetItemInfo(22825); -- Elixir of Healing Power - SMARTBUFF_MAJORFORTITUDE_ITEM = GetItemInfo(32062); -- Elixir of Major Fortitude - SMARTBUFF_MAJORSTRENGTH_ITEM = GetItemInfo(22824); -- Elixir of Major Strength - SMARTBUFF_ONSLAUGHTELIXIR_ITEM = GetItemInfo(28102); -- Onslaught Elixir - SMARTBUFF_GREATERARCANE_ITEM = GetItemInfo(13454); -- Greater Arcane - SMARTBUFF_MONGOOSEELIXIR_ITEM = GetItemInfo(13452); -- Elixir of Mongoose - SMARTBUFF_BRUTEFORCE_ITEM = GetItemInfo(13453); -- Elixir of Brute Force - SMARTBUFF_SAGESELIXIR_ITEM = GetItemInfo(13447); -- Elixir of Sages - SMARTBUFF_SUPERIORDEFENSE_ITEM = GetItemInfo(13445); -- Elixir of Superior Defense - SMARTBUFF_DEMONSLAYING_ITEM = GetItemInfo(9224); -- Elixir of Demon Slaying - SMARTBUFF_MAJORFIREPOWER_ITEM = GetItemInfo(22833); -- Elixir of Major Fire Power - SMARTBUFF_GREATERFIREPOWER_ITEM = GetItemInfo(21546); -- Elixir of Greater Fire Power - SMARTBUFF_SHADOWPOWER_ITEM = GetItemInfo(9264); -- Elixir of Shadow Power - SMARTBUFF_GIANTSELIXIR_ITEM = GetItemInfo(9206); -- Elixir of Giants - SMARTBUFF_GREATERAGILITY_ITEM = GetItemInfo(9187); -- Elixir of Greater Agility - SMARTBUFF_GIFTOFARTHAS_ITEM = GetItemInfo(9088); -- Gift of Arthas - SMARTBUFF_ARANCEELIXIR_ITEM = GetItemInfo(9155); -- Arcane Elixir - SMARTBUFF_GREATERINTELLECT_ITEM = GetItemInfo(9179); -- Elixir of Greater Intellect - SMARTBUFF_MAJORNATUREPROT_ITEM = GetItemInfo(22844); -- Major Natur Protection Potion - SMARTBUFF_MAJORMAGEBLOOD_ITEM = GetItemInfo(22840); -- Major Mageblood - SMARTBUFF_MAJORSHADOWPWR_ITEM = GetItemInfo(22835); -- Major Shadow Power - SMARTBUFF_MAJORIRONSKIN_ITEM = GetItemInfo(32068); -- Major Ironskin - SMARTBUFF_BLINDINGLIGHTFLASK_ITEM = GetItemInfo(22861); -- Flask of Blinding Light - SMARTBUFF_FORTIFICATIONFLASK_ITEM = GetItemInfo(22851); -- Flask of Fortification - SMARTBUFF_RESTORATIONFLASK_ITEM = GetItemInfo(22853); -- Flask of Restoration - SMARTBUFF_PUREDEATHFLASK_ITEM = GetItemInfo(22866); -- Flask of Pure Death - SMARTBUFF_RELENTLESSFLASK_ITEM = GetItemInfo(22854); -- Flask of Relentless Assault - SMARTBUFF_CHROMATICFLASK_ITEM = GetItemInfo(13513); -- Flask of Chromatic Resistance - SMARTBUFF_DISTILLEDFLASK_ITEM = GetItemInfo(13511); -- Flask of Distilled Wisdom - SMARTBUFF_SUPREMEPWRFLASK_ITEM = GetItemInfo(13512); -- Flask of Supreme Power - - SMARTBUFF_FLASKOFFROSTWYRM_ITEM = GetItemInfo(46376); -- Flask of Frost Wyrm - SMARTBUFF_FLASKOFENDLESSRAGE_ITEM = GetItemInfo(46377); -- Flask of Endless Rage - SMARTBUFF_FLASKOFTHENORTH_ITEM = GetItemInfo(47499); -- Flask of the North - SMARTBUFF_FLASKOFSTONEBLOOD_ITEM = GetItemInfo(46379); -- Flask of Stoneblood - - -- Misc Items + -- Scrolls + _,SMARTBUFF_SOAGILITY1 = GetItemInfo(3012); --"Scroll of Agility I" + _,SMARTBUFF_SOAGILITY2 = GetItemInfo(1477); --"Scroll of Agility II" + _,SMARTBUFF_SOAGILITY3 = GetItemInfo(4425); --"Scroll of Agility III"b + _,SMARTBUFF_SOAGILITY4 = GetItemInfo(10309); --"Scroll of Agility IV" + _,SMARTBUFF_SOAGILITY5 = GetItemInfo(27498); --"Scroll of Agility V" + _,SMARTBUFF_SOAGILITY6 = GetItemInfo(33457); --"Scroll of Agility VI" + _,SMARTBUFF_SOAGILITY7 = GetItemInfo(43463); --"Scroll of Agility VII" + _,SMARTBUFF_SOAGILITY8 = GetItemInfo(43464); --"Scroll of Agility VIII" + _,SMARTBUFF_SOAGILITY9 = GetItemInfo(63303); --"Scroll of Agility IX" + _,SMARTBUFF_SOINTELLECT1 = GetItemInfo(955); --"Scroll of Intellect I" + _,SMARTBUFF_SOINTELLECT2 = GetItemInfo(2290); --"Scroll of Intellect II" + _,SMARTBUFF_SOINTELLECT3 = GetItemInfo(4419); --"Scroll of Intellect III" + _,SMARTBUFF_SOINTELLECT4 = GetItemInfo(10308); --"Scroll of Intellect IV" + _,SMARTBUFF_SOINTELLECT5 = GetItemInfo(27499); --"Scroll of Intellect V" + _,SMARTBUFF_SOINTELLECT6 = GetItemInfo(33458); --"Scroll of Intellect VI" + _,SMARTBUFF_SOINTELLECT7 = GetItemInfo(37091); --"Scroll of Intellect VII" + _,SMARTBUFF_SOINTELLECT8 = GetItemInfo(37092); --"Scroll of Intellect VIII" + _,SMARTBUFF_SOINTELLECT9 = GetItemInfo(63305); --"Scroll of Intellect IX" + _,SMARTBUFF_SOSTAMINA1 = GetItemInfo(1180); --"Scroll of Stamina I" + _,SMARTBUFF_SOSTAMINA2 = GetItemInfo(1711); --"Scroll of Stamina II" + _,SMARTBUFF_SOSTAMINA3 = GetItemInfo(4422); --"Scroll of Stamina III" + _,SMARTBUFF_SOSTAMINA4 = GetItemInfo(10307); --"Scroll of Stamina IV" + _,SMARTBUFF_SOSTAMINA5 = GetItemInfo(27502); --"Scroll of Stamina V" + _,SMARTBUFF_SOSTAMINA6 = GetItemInfo(33461); --"Scroll of Stamina VI" + _,SMARTBUFF_SOSTAMINA7 = GetItemInfo(37093); --"Scroll of Stamina VII" + _,SMARTBUFF_SOSTAMINA8 = GetItemInfo(37094); --"Scroll of Stamina VIII" + _,SMARTBUFF_SOSTAMINA9 = GetItemInfo(63306); --"Scroll of Stamina IX" + _,SMARTBUFF_SOSPIRIT1 = GetItemInfo(1181); --"Scroll of Spirit I" + _,SMARTBUFF_SOSPIRIT2 = GetItemInfo(1712); --"Scroll of Spirit II" + _,SMARTBUFF_SOSPIRIT3 = GetItemInfo(4424); --"Scroll of Spirit III" + _,SMARTBUFF_SOSPIRIT4 = GetItemInfo(10306); --"Scroll of Spirit IV" + _,SMARTBUFF_SOSPIRIT5 = GetItemInfo(27501); --"Scroll of Spirit V" + _,SMARTBUFF_SOSPIRIT6 = GetItemInfo(33460); --"Scroll of Spirit VI" + _,SMARTBUFF_SOSPIRIT7 = GetItemInfo(37097); --"Scroll of Spirit VII" + _,SMARTBUFF_SOSPIRIT8 = GetItemInfo(37098); --"Scroll of Spirit VIII" + _,SMARTBUFF_SOSPIRIT9 = GetItemInfo(63307); --"Scroll of Spirit IX" + _,SMARTBUFF_SOSTRENGHT1 = GetItemInfo(954); --"Scroll of Strength I" + _,SMARTBUFF_SOSTRENGHT2 = GetItemInfo(2289); --"Scroll of Strength II" + _,SMARTBUFF_SOSTRENGHT3 = GetItemInfo(4426); --"Scroll of Strength III" + _,SMARTBUFF_SOSTRENGHT4 = GetItemInfo(10310); --"Scroll of Strength IV" + _,SMARTBUFF_SOSTRENGHT5 = GetItemInfo(27503); --"Scroll of Strength V" + _,SMARTBUFF_SOSTRENGHT6 = GetItemInfo(33462); --"Scroll of Strength VI" + _,SMARTBUFF_SOSTRENGHT7 = GetItemInfo(43465); --"Scroll of Strength VII" + _,SMARTBUFF_SOSTRENGHT8 = GetItemInfo(43466); --"Scroll of Strength VIII" + _,SMARTBUFF_FLASKTBC1 = GetItemInfo(22854); --"Flask of Relentless Assault" + _,SMARTBUFF_FLASKTBC2 = GetItemInfo(22866); --"Flask of Pure Death" + _,SMARTBUFF_FLASKTBC3 = GetItemInfo(22851); --"Flask of Fortification" + _,SMARTBUFF_FLASKTBC4 = GetItemInfo(22861); --"Flask of Blinding Light" + _,SMARTBUFF_FLASKTBC5 = GetItemInfo(22853); --"Flask of Mighty Versatility" + _,SMARTBUFF_FLASK1 = GetItemInfo(46377); --"Flask of Endless Rage" + _,SMARTBUFF_FLASK2 = GetItemInfo(46376); --"Flask of the Frost Wyrm" + _,SMARTBUFF_FLASK3 = GetItemInfo(46379); --"Flask of Stoneblood" + _,SMARTBUFF_FLASK4 = GetItemInfo(46378); --"Flask of Pure Mojo" + _,SMARTBUFF_ELIXIRTBC1 = GetItemInfo(22831); --"Elixir of Major Agility" + _,SMARTBUFF_ELIXIRTBC2 = GetItemInfo(28104); --"Elixir of Mastery" + _,SMARTBUFF_ELIXIRTBC3 = GetItemInfo(22825); --"Elixir of Healing Power" + _,SMARTBUFF_ELIXIRTBC4 = GetItemInfo(22834); --"Elixir of Major Defense" + _,SMARTBUFF_ELIXIRTBC5 = GetItemInfo(22824); --"Elixir of Major Strangth" + _,SMARTBUFF_ELIXIRTBC6 = GetItemInfo(32062); --"Elixir of Major Fortitude" + _,SMARTBUFF_ELIXIRTBC7 = GetItemInfo(22840); --"Elixir of Major Mageblood" + _,SMARTBUFF_ELIXIRTBC8 = GetItemInfo(32067); --"Elixir of Draenic Wisdom" + _,SMARTBUFF_ELIXIRTBC9 = GetItemInfo(28103); --"Adept's Elixir" + _,SMARTBUFF_ELIXIRTBC10 = GetItemInfo(22848); --"Elixir of Empowerment" + _,SMARTBUFF_ELIXIRTBC11 = GetItemInfo(28102); --"Onslaught Elixir" + _,SMARTBUFF_ELIXIRTBC12 = GetItemInfo(22835); --"Elixir of Major Shadow Power" + _,SMARTBUFF_ELIXIRTBC13 = GetItemInfo(32068); --"Elixir of Ironskin" + _,SMARTBUFF_ELIXIRTBC14 = GetItemInfo(32063); --"Earthen Elixir" + _,SMARTBUFF_ELIXIRTBC15 = GetItemInfo(22827); --"Elixir of Major Frost Power" + _,SMARTBUFF_ELIXIRTBC16 = GetItemInfo(31679); --"Fel Strength Elixir" + _,SMARTBUFF_ELIXIRTBC17 = GetItemInfo(22833); --"Elixir of Major Firepower" + _,SMARTBUFF_ELIXIR1 = GetItemInfo(39666); --"Elixir of Mighty Agility" + _,SMARTBUFF_ELIXIR2 = GetItemInfo(44332); --"Elixir of Mighty Thoughts" + _,SMARTBUFF_ELIXIR3 = GetItemInfo(40078); --"Elixir of Mighty Fortitude" + _,SMARTBUFF_ELIXIR4 = GetItemInfo(40073); --"Elixir of Mighty Strength" + _,SMARTBUFF_ELIXIR5 = GetItemInfo(40072); --"Elixir of Spirit" + _,SMARTBUFF_ELIXIR6 = GetItemInfo(40097); --"Elixir of Protection" + _,SMARTBUFF_ELIXIR7 = GetItemInfo(44328); --"Elixir of Mighty Defense" + _,SMARTBUFF_ELIXIR8 = GetItemInfo(44331); --"Elixir of Lightning Speed" + _,SMARTBUFF_ELIXIR9 = GetItemInfo(44329); --"Elixir of Expertise" + _,SMARTBUFF_ELIXIR10 = GetItemInfo(44327); --"Elixir of Deadly Strikes" + _,SMARTBUFF_ELIXIR11 = GetItemInfo(44330); --"Elixir of Armor Piercing" + _,SMARTBUFF_ELIXIR12 = GetItemInfo(44325); --"Elixir of Accuracy" + _,SMARTBUFF_ELIXIR13 = GetItemInfo(40076); --"Guru's Elixir" + _,SMARTBUFF_ELIXIR14 = GetItemInfo(9187); --"Elixir of Greater Agility" + _,SMARTBUFF_ELIXIR15 = GetItemInfo(28103); --"Adept's Elixir" + _,SMARTBUFF_ELIXIR16 = GetItemInfo(40070); --"Spellpower Elixir" + + -- fishing pole _, _, _, _, _, _, S.FishingPole = GetItemInfo(6256); --"Fishing Pole" - - -- read professions and check for alchemy. - for i = 1, GetNumSkillLines() do - local skillName, isHeader, _, skillRank, _, _, skillMaxRank, _, _, _, _, _, _ = GetSkillLineInfo(i) - if not isHeader then - if skillName == SMARTBUFF_ALCHEMY_TITLE then - SMARTBUFF_ALCHEMY_ADJ = 2; - SMARTBUFF_AddMsgD(">>>> Player has Alchemy, doubling duration."); - break - end - end - end - - SMARTBUFF_AddMsgD(">>>> Item list's have been initialised and durations for Alchemy checked."); - + SMARTBUFF_AddMsgD("Item list initialized"); end - ----------------------------------------------------------------------------------------------------------------------------------- ---- ---- Initialise Spell Id ---- ----------------------------------------------------------------------------------------------------------------------------------- +-- +-- Initialise SpellId Lists +-- function SMARTBUFF_InitSpellIDs() - - -- Misc - SMARTBUFF_KIRUSSOV = GetSpellInfo(46302); --"K'iru's Song of Victory" - SMARTBUFF_FISHING = GetSpellInfo(7620) or GetSpellInfo(111541); --"Fishing" - SMARTBUFF_FELINTELLIGENCE = GetSpellInfo(54424) -- "Fel Intelligence" - - -- Druid - SMARTBUFF_DRUID_CAT = GetSpellInfo(768); --"Cat Form" - SMARTBUFF_DRUID_TREE = GetSpellInfo(33891); --"Tree of Life" - SMARTBUFF_DRUID_MOONKIN = GetSpellInfo(24858); --"Moonkin Form" - SMARTBUFF_DRUID_TRACK = GetSpellInfo(5225); --"Track Humanoids" - SMARTBUFF_MOTW = GetSpellInfo(1126); --"Mark of the Wild" - SMARTBUFF_GOTWRB1 = GetSpellInfo(21849); --"Gift of the Wild" - SMARTBUFF_THORNS = GetSpellInfo(467); --"Thorns" - SMARTBUFF_IMPTHORNS = GetSpellInfo(16836); --"Improved Thorns" - SMARTBUFF_BARKSKIN = GetSpellInfo(22812); --"Barkskin" - SMARTBUFF_NATURESGRASP = GetSpellInfo(16689); --"Nature's Grasp" - SMARTBUFF_TIGERSFURY = GetSpellInfo(5217); --"Tiger's Fury" - SMARTBUFF_SAVAGEROAR = GetSpellInfo(52610); --"Savage Roar" - SMARTBUFF_OMENOFCLARITY = GetSpellInfo(16864); --"Omen of Clarity" - - -- Druid linked - S.LinkDruidThorns = { SMARTBUFF_THORNS, SMARTBUFF_IMPTHORNS }; - S.LinkDruidGOTW = { SMARTBUFF_MOTW, SMARTBUFF_GOTWRB1} + + SMARTBUFF_TESTSPELL = GetSpellInfo(774); + + -- Paladin - Updated 7/5/2023 ------------------------------------------------------------------ + -- blessings + SMARTBUFF_GBOM = GetSpellInfo(25782); --"Greater Blessing of Might" + SMARTBUFF_GBOK = GetSpellInfo(25898); --"Greater Blessing of Kings" + SMARTBUFF_GBOW = GetSpellInfo(25894); --"Greater Blessing of Wisdom" + SMARTBUFF_GBOS = GetSpellInfo(25899); --"Greater Blessing of Sanctuary" + SMARTBUFF_BOM = GetSpellInfo(19740); --"Blessing of Might" + SMARTBUFF_BOK = GetSpellInfo(20217); --"Blessing of Kings" + SMARTBUFF_BOW = GetSpellInfo(19742); --"Blessing of Wisdom" + SMARTBUFF_BOS = GetSpellInfo(20911); --"Blessing of Sanctuary" + -- hands + SMARTBUFF_HOF = GetSpellInfo(1044); --"Hand of Freedom" + SMARTBUFF_HOP = GetSpellInfo(1022); --"Hand of Protection" + SMARTBUFF_HOSAL = GetSpellInfo(1038); --"Hand of Salvation" + SMARTBUFF_HOSAC = GetSpellInfo(6940); --"Hand of Sacrifice" + -- seals + SMARTBUFF_SOCOMMAND = GetSpellInfo(20375); --"Seal of Command" + SMARTBUFF_SOVENGEANCE = GetSpellInfo(31801); --"Seal of Vengeance" + SMARTBUFF_SOCORRUPTION = GetSpellInfo(53736); --"Seal of Corruption" (Blood Elf) + SMARTBUFF_SOJUSTICE = GetSpellInfo(20164); --"Seal of Justice" + SMARTBUFF_SORIGHTEOUSNESS = GetSpellInfo(21084); --"Seal of Righteousness" + SMARTBUFF_SOWISDOM = GetSpellInfo(20166); --"Seal of Wisdom" + SMARTBUFF_SOLIGHT = GetSpellInfo(20165); --"Seal of Light" + -- auras + SMARTBUFF_CRUSADERAURA = GetSpellInfo(32223); --"Crusader Aura" + SMARTBUFF_DEVOTIONAURA = GetSpellInfo(465); --"Devotion Aura" + SMARTBUFF_RETRIBUTIONAURA = GetSpellInfo(7294); --"Retribution Aura" + SMARTBUFF_FIREAURA = GetSpellInfo(19891); --"Fire Resistance Aura" + SMARTBUFF_FROSTAURA = GetSpellInfo(19888); --"Frost Resistance Aura" + SMARTBUFF_SHADOWAURA = GetSpellInfo(19876); --"Shadow Resistance Aura" + -- other + SMARTBUFF_RIGHTEOUSFURY = GetSpellInfo(25780); --"Righteous Fury" + SMARTBUFF_HOLYSHIELD = GetSpellInfo(20925); --"Holy Shield" + SMARTBUFF_SACREDSHIELD = GetSpellInfo(53601); --"Sacred Shield" + SMARTBUFF_AVENGINGWARTH = GetSpellInfo(31884); --"Avenging Wrath" + SMARTBUFF_BEACONOFLIGHT = GetSpellInfo(53563); --"Beacon of Light" + -- Paladin buff links + S.ChainPaladinAura = { SMARTBUFF_DEVOTIONAURA, SMARTBUFF_RETRIBUTIONAURA, SMARTBUFF_CRUSADERAURA, SMARTBUFF_FIREAURA, SMARTBUFF_FROSTAURA, SMARTBUFF_SHADOWAURA }; -- * + S.ChainPaladinSeal = { SMARTBUFF_SOCOMMAND, SMARTBUFF_SOVENGEANCE, SMARTBUFF_SOCORRUPTION, SMARTBUFF_SOJUSTICE, SMARTBUFF_SORIGHTEOUSNESS, SMARTBUFF_SOWISDOM, SMARTBUFF_SOLIGHT }; -- * + S.ChainPaladinHand = { SMARTBUFF_HOF, SMARTBUFF_HOP, SMARTBUFF_HOSAL, SMARTBUFF_HOSAC }; -- * + S.ChainPaladinBlessing = { SMARTBUFF_GBOM, SMARTBUFF_GBOK, SMARTBUFF_GBOW, SMARTBUFF_BOS, SMARTBUFF_BOM, SMARTBUFF_BOK, SMARTBUFF_BOW, SMARTBUFF_BOS}; -- * + + -- Mage - Updated 7/5/2023 ------------------------------------------------------------------------ + -- buffs + SMARTBUFF_AI = GetSpellInfo(1459); --"Arcane Intellect" + SMARTBUFF_AB = GetSpellInfo(23028); --"Arcane Brilliance" + SMARTBUFF_DALARANB = GetSpellInfo(61316); --"Dalaran Brilliance" + -- Armor + SMARTBUFF_ICEARMOR = GetSpellInfo(7302); --"Ice Armor" + SMARTBUFF_FROSTARMOR = GetSpellInfo(168); --"Frost Armor" + SMARTBUFF_MAGEARMOR = GetSpellInfo(6117); --"Mage Armor" + SMARTBUFF_MOLTENARMOR = GetSpellInfo(30482); --"Molten Armor" + -- Shields + SMARTBUFF_MANASHIELD = GetSpellInfo(1463); --"Mana Shield" + SMARTBUFF_ICEBARRIER = GetSpellInfo(11426); --"Ice Barrier" + -- wards + SMARTBUFF_FIREWARD = GetSpellInfo(543); --"Fire Ward" + SMARTBUFF_FROSTWARD = GetSpellInfo(6143); --"Frost Ward" + -- other + SMARTBUFF_FOCUSMAGIC = GetSpellInfo(54648); --"Focus Magic" + SMARTBUFF_AMPLIFYMAGIC = GetSpellInfo(1008); --"Amplify Magic" + SMARTBUFF_DAMPENMAGIC = GetSpellInfo(604); --"Dampen Magic" + SMARTBUFF_SUMMONWATERELE = GetSpellInfo(31687); --"Summon Water Elemental" + SMARTBUFF_COMBUSTION = GetSpellInfo(11129); --"Combustion" + SMARTBUFF_ARCANEPOWER = GetSpellInfo(12042); --"Arcane Power" + SMARTBUFF_PRESENCEOFMIND = GetSpellInfo(12043); --"Presence of Mind" + SMARTBUFF_ICYVEINS = GetSpellInfo(12472); --"Icy Veins" + -- food and drink + SMARTBUFF_CONJFOOD = GetSpellInfo(587); --"Conjure Food" + SMARTBUFF_CONJWATER = GetSpellInfo(5504); --"Conjure Water" + SMARTBUFF_CONJREFRESHMENT = GetSpellInfo(42955); --"Conjure Refreshment" + SMARTBUFF_RITUALREFRESHMENT = GetSpellInfo(43987); --"Ritual Refreshment" + SMARTBUFF_CREATEMGEM = GetSpellInfo(759); --"Conjure Mana Gem" + -- Mage buff links + S.ChainMageArmor = { SMARTBUFF_ICEARMOR, SMARTBUFF_FROSTARMOR, SMARTBUFF_MAGEARMOR, SMARTBUFF_MOLTENARMOR }; + S.ChainMageBuffs = { SMARTBUFF_AI, SMARTBUFF_AB, SMARTBUFF_DALARANB } + + + -- Druid - Updated 7/5/2023 ------------------------------------------------------------------------ + -- buffs + SMARTBUFF_MOTW = GetSpellInfo(1126); --"Mark of the Wild" + SMARTBUFF_GOTW = GetSpellInfo(21849); --"Gift of the Wild" + SMARTBUFF_THORNS = GetSpellInfo(467); --"Thorns" + SMARTBUFF_BARKSKIN = GetSpellInfo(22812); --"Barkskin" + + -- forms + SMARTBUFF_DRUID_CAT = GetSpellInfo(768); --"Cat Form" + SMARTBUFF_DRUID_TREE = GetSpellInfo(33891); --"Incarnation: Tree of Life" + SMARTBUFF_DRUID_MOONKIN = GetSpellInfo(24858); --"Moonkin Form" + SMARTBUFF_DRUID_BEAR = GetSpellInfo(5487); --"Bear Form" + SMARTBUFF_DRUID_DIREBEAR = GetSpellInfo(9634); --"Dire Bear Form" + -- track humanoids + SMARTBUFF_DRUID_TRACK = GetSpellInfo(5225); --"Track Humanoids" - -- Priest - SMARTBUFF_PWF = GetSpellInfo(1243); --"Power Word: Fortitude" - SMARTBUFF_POFRB1 = GetSpellInfo(21562); --"Prayer of Fortitude" - SMARTBUFF_SP = GetSpellInfo(976); --"Shadow Protection" - SMARTBUFF_POSPRB1 = GetSpellInfo(27683); --"Prayer of Shadow Protection" - SMARTBUFF_INNERFIRE = GetSpellInfo(588); --"Inner Fire" - SMARTBUFF_DS = GetSpellInfo(14752); --"Divine Spirit" - SMARTBUFF_POSRB1 = GetSpellInfo(27681); --"Prayer of Spirit" - SMARTBUFF_PWS = GetSpellInfo(17); --"Power Word: Shield" - SMARTBUFF_SHADOWFORM = GetSpellInfo(15473); --"Shadowform" - SMARTBUFF_FEARWARD = GetSpellInfo(6346); --"Fear Ward" - SMARTBUFF_ELUNESGRACE = GetSpellInfo(2651); --"Elune's Grace" - SMARTBUFF_FEEDBACK = GetSpellInfo(13896); --"Feedback" - SMARTBUFF_SHADOWGUARD = GetSpellInfo(18137); --"Shadowguard" - SMARTBUFF_TOUCHOFWEAKNESS = GetSpellInfo(2652); --"Touch of Weakness" - SMARTBUFF_INNERFOCUS = GetSpellInfo(14751); --"Inner Focus" - SMARTBUFF_RENEW = GetSpellInfo(139); --"Renew" - SMARTBUFF_VAMPIRICEMB = GetSpellInfo(15286); --"Vampiric Embrace" - - S.ChainPriestFortBuffs = { SMARTBUFF_PWF, SMARTBUFF_POFRB1}; - S.ChainPriestSpiritBuffs = { SMARTBUFF_DS, SMARTBUFF_POSRB1}; - S.ChainPriestShadowBuffs = { SMARTBUFF_SP, SMARTBUFF_POSPRB1}; - -- Mage - SMARTBUFF_DALINT = GetSpellInfo(61024); --"Dalaran Intellect" - SMARTBUFF_DALBRILL = GetSpellInfo(61316); --"Dalaran Brilliance" - SMARTBUFF_AI = GetSpellInfo(1459); --"Arcane Intellect" - SMARTBUFF_ABRB1 = GetSpellInfo(23028); --"Arcane Brilliance" - SMARTBUFF_ICEARMOR = GetSpellInfo(7302); --"Ice Armor" - SMARTBUFF_FROSTARMOR = GetSpellInfo(168); --"Frost Armor" - SMARTBUFF_MAGEARMOR = GetSpellInfo(6117); --"Mage Armor" - SMARTBUFF_MOLTENARMOR = GetSpellInfo(30482); --"Molten Armor" - SMARTBUFF_DAMPENMAGIC = GetSpellInfo(604); --"Dampen Magic" - SMARTBUFF_AMPLIFYMAGIC = GetSpellInfo(1008); --"Amplify Magic" - SMARTBUFF_MANASHIELD = GetSpellInfo(1463); --"Mana Shield" - SMARTBUFF_FIREWARD = GetSpellInfo(543); --"Fire Ward" - SMARTBUFF_FROSTWARD = GetSpellInfo(6143); --"Frost Ward" - SMARTBUFF_ICEBARRIER = GetSpellInfo(11426); --"Ice Barrier" - SMARTBUFF_COMBUSTION = GetSpellInfo(11129); --"Combustion" - SMARTBUFF_ARCANEPOWER = GetSpellInfo(12042); --"Arcane Power" - SMARTBUFF_PRESENCEOFMIND = GetSpellInfo(12043); --"Presence of Mind" - SMARTBUFF_ICYVEINS = GetSpellInfo(12472); --"Icy Veins" - SMARTBUFF_SUMMONWATERELE = GetSpellInfo(31687); --"Summon Water Elemental" - SMARTBUFF_FOCUSMAGIC = GetSpellInfo(54646); --"Focus Magic" + -- Priest - Updated 8/5/2023 ---------------------------------------------------------------------- + -- buffs + SMARTBUFF_PWFORTITUDE = GetSpellInfo(1243); --"Power Word: Fortitude" + SMARTBUFF_PRAYERFORTITUDE = GetSpellInfo(21562); --"Prayer of Fortitude" + SMARTBUFF_DIVINESPIRIT = GetSpellInfo(14752); --"Divine Spirit" + SMARTBUFF_PRAYERSPIRIT = GetSpellInfo(27681); --"Prayer of Spirit" + SMARTBUFF_SHADOWPROT = GetSpellInfo(976); --"Shadow Protection" + SMARTBUFF_PRAYERSHADOWPROT = GetSpellInfo(27683); --"Prayer of Shadow Protection" + SMARTBUFF_INNERFOCUS = GetSpellInfo(14751); --"Inner Focus" + SMARTBUFF_INNERFIRE = GetSpellInfo(588); --"Inner Fire" + SMARTBUFF_FEARWARD = GetSpellInfo(6346); --"Fear Ward" + -- forms + SMARTBUFF_SHADOWFORM = GetSpellInfo(15473); --"Shadowform" + -- Shields + SMARTBUFF_PWSHIELD = GetSpellInfo(17); --"Power Word: Shield" + -- other + SMARTBUFF_ELUNESGRACE = GetSpellInfo(2651); --"Elune's Grace" + SMARTBUFF_FEEDBACK = GetSpellInfo(13896); --"Feedback" + SMARTBUFF_SHADOWGUARD = GetSpellInfo(18137); --"Shadowguard" + SMARTBUFF_TOUCHOFWEAKNESS = GetSpellInfo(2652); --"Touch of Weakness" + SMARTBUFF_RENEW = GetSpellInfo(139); --"Renew" + SMARTBUFF_VAMPIRICEMB = GetSpellInfo(15286); --"Vampiric Embrace" + -- Priest buff links + S.LinkPriestSpirit = { SMARTBUFF_DIVINESPIRIT, SMARTBUFF_PRAYERSPIRIT }; + S.LinkPriestShadow = { SMARTBUFF_SHADOWPROT, SMARTBUFF_PRAYERSHADOWPROT }; + - -- Mage chained - S.ChainMageArmor = { SMARTBUFF_ICEARMOR, SMARTBUFF_FROSTARMOR, SMARTBUFF_MAGEARMOR, SMARTBUFF_MOLTENARMOR }; - S.ChainMageBuffs = { SMARTBUFF_DALINT, SMARTBUFF_DALBRILL, SMARTBUFF_AI, SMARTBUFF_ABRB1}; + -- Warrior - Updated 8/5/2023 ---------------------------------------------------------------------- + -- shouts + SMARTBUFF_BATTLESHOUT = GetSpellInfo(6673); --"Battle Shout" + SMARTBUFF_COMMANDINGSHOUT = GetSpellInfo(469); --"Commanding Shout" + -- stances + SMARTBUFF_BATSTANCE = GetSpellInfo(2457); --"Battle Stance" + SMARTBUFF_DEFSTANCE = GetSpellInfo(71); --"Defensive Stance" + SMARTBUFF_BESSTANCE = GetSpellInfo(2458); --"Beserker Stance" + -- other + SMARTBUFF_BERSERKERRAGE = GetSpellInfo(18499); --"Berserker Rage" + SMARTBUFF_BLOODRAGE = GetSpellInfo(2687); --"Bloodrage" + SMARTBUFF_RAMPAGE = GetSpellInfo(29801); --"Rampage" + SMARTBUFF_VIGILANCE = GetSpellInfo(50720); --"Vigilance" + SMARTBUFF_SHIELDBLOCK = GetSpellInfo(2565); --"Shield Block" + -- Warrior buff links + S.ChainWarriorStance = { SMARTBUFF_BATSTANCE, SMARTBUFF_DEFSTANCE, SMARTBUFF_BESSTANCE }; + S.ChainWarriorShout = { SMARTBUFF_BATTLESHOUT, SMARTBUFF_COMMANDINGSHOUT }; - -- Warlock - SMARTBUFF_FELARMOR = GetSpellInfo(28176); --"Fel Armor" - SMARTBUFF_DEMONARMOR = GetSpellInfo(706); --"Demon Armor" - SMARTBUFF_DEMONSKIN = GetSpellInfo(687); --"Demon Skin" - SMARTBUFF_UNENDINGBREATH = GetSpellInfo(5697); --"Unending Breath" - SMARTBUFF_DINVISIBILITY = GetSpellInfo(132); --"Detect Invisibility" - SMARTBUFF_SOULLINK = GetSpellInfo(19028); --"Soul Link" - SMARTBUFF_SHADOWWARD = GetSpellInfo(6229); --"Shadow Ward" - SMARTBUFF_DARKPACT = GetSpellInfo(18220); --"Dark Pact" - SMARTBUFF_LIFETAP = GetSpellInfo(1454); --"Life Tap" - - SMARTBUFF_CREATEHSMIN = GetSpellInfo(6201); --"Create Healthstone (Minor)" - SMARTBUFF_CREATEHSLES = GetSpellInfo(6202); --"Create Healthstone (Lesser)" - SMARTBUFF_CREATEHS = GetSpellInfo(5699); --"Create Healthstone" - SMARTBUFF_CREATEHSGRE = GetSpellInfo(11729); --"Create Healthstone (Greater)" - SMARTBUFF_CREATEHSMAJ = GetSpellInfo(11730); --"Create Healthstone (Major)" - SMARTBUFF_CREATEHSMAS = GetSpellInfo(27230); --"Create Healthstone (Master)" - SMARTBUFF_CREATEHSDEM = GetSpellInfo(47871); --"Create Healthstone (Demonic)" - SMARTBUFF_CREATEHSFEL = GetSpellInfo(47878); --"Create Healthstone (Fel)" - - SMARTBUFF_CREATESSMIN = GetSpellInfo(693); --"Create Soulstone (Minor)" - SMARTBUFF_CREATESSLES = GetSpellInfo(20752); --"Create Soulstone (Lesser)" - SMARTBUFF_CREATESS = GetSpellInfo(20755); --"Create Soulstone" - SMARTBUFF_CREATESSGRE = GetSpellInfo(20756); --"Create Soulstone (Greater)" - SMARTBUFF_CREATESSMAJ = GetSpellInfo(20757); --"Create Soulstone (Major)" - SMARTBUFF_CREATESSMAS = GetSpellInfo(27238); --"Create Soulstone (Master)" - SMARTBUFF_CREATESSDEM = GetSpellInfo(47884); --"Create Soulstone (Demonic)" - - SMARTBUFF_CREATESPSTONE1 = GetSpellInfo(2362); --"Create Spellstone Rank 1" - SMARTBUFF_CREATESPSTONE2 = GetSpellInfo(17727); --"Create Spellstone Rank 2" - SMARTBUFF_CREATESPSTONE3 = GetSpellInfo(17728); --"Create Spellstone Rank 3" - SMARTBUFF_CREATESPSTONE4 = GetSpellInfo(28172); --"Create Spellstone Rank 4" - SMARTBUFF_CREATESPSTONE5 = GetSpellInfo(47886); --"Create Spellstone Rank 5" - SMARTBUFF_CREATESPSTONE6 = GetSpellInfo(47888); --"Create Spellstone Rank 6" - - SMARTBUFF_CREATEFSTONE1 = GetSpellInfo(6366); --"Create Firestone Rank 1" - SMARTBUFF_CREATEFSTONE2 = GetSpellInfo(17951); --"Create Firestone Rank 2" - SMARTBUFF_CREATEFSTONE3 = GetSpellInfo(17952); --"Create Firestone Rank 3" - SMARTBUFF_CREATEFSTONE4 = GetSpellInfo(17953); --"Create Firestone Rank 4" - SMARTBUFF_CREATEFSTONE5 = GetSpellInfo(27250); --"Create Firestone Rank 5" - SMARTBUFF_CREATEFSTONE6 = GetSpellInfo(60219); --"Create Firestone Rank 6" - SMARTBUFF_CREATEFSTONE7 = GetSpellInfo(60220); --"Create Firestone Rank 7" - -- Warlock chained - S.ChainWarlockArmor = { SMARTBUFF_DEMONSKIN, SMARTBUFF_DEMONARMOR, SMARTBUFF_FELARMOR }; + -- Shaman - Updated 8/5/2023 ---------------------------------------------------------------------- + -- shields + SMARTBUFF_LIGHTNINGSHIELD = GetSpellInfo(324); --"Lightning Shield" + SMARTBUFF_WATERSHIELD = GetSpellInfo(24398); --"Water Shield" + SMARTBUFF_EARTHSHIELD = GetSpellInfo(974); --"Earth Shield" + -- weapons + SMARTBUFF_ROCKBITERW = GetSpellInfo(8017); --"Rockbiter Weapon" + SMARTBUFF_FROSTBRANDW = GetSpellInfo(8033); --"Frostbrand Weapon" + SMARTBUFF_FLAMETONGUEW = GetSpellInfo(8024); --"Flametongue Weapon" + SMARTBUFF_WINDFURYW = GetSpellInfo(8232); --"Windfury Weapon" + SMARTBUFF_EARTHLIVINGW = GetSpellInfo(51730); --"Earthliving Weapon" + -- buffs + SMARTBUFF_WATERBREATHING = GetSpellInfo(131); --"Water Breathing" + SMARTBUFF_WATERWALKING = GetSpellInfo(546); --"Water Walking" + -- Shaman chained + S.ChainShamanShield = { SMARTBUFF_LIGHTNINGSHIELD, SMARTBUFF_WATERSHIELD, SMARTBUFF_EARTHSHIELD }; - -- Hunter + + -- Hunter - Updated 10/5/2023 ---------------------------------------------------------------------- SMARTBUFF_TRUESHOTAURA = GetSpellInfo(19506); --"Trueshot Aura" SMARTBUFF_RAPIDFIRE = GetSpellInfo(3045); --"Rapid Fire" SMARTBUFF_CALLPET = GetSpellInfo(883); --"Call Pet" + SMARTBUFF_REVIVEPET = GetSpellInfo(982); --"Revive Pet" SMARTBUFF_AOTH = GetSpellInfo(13165); --"Aspect of the Hawk" SMARTBUFF_AOTM = GetSpellInfo(13163); --"Aspect of the Monkey" SMARTBUFF_AOTW = GetSpellInfo(20043); --"Aspect of the Wild" @@ -456,105 +498,75 @@ function SMARTBUFF_InitSpellIDs() -- Hunter chained S.ChainAspects = { SMARTBUFF_AOTH,SMARTBUFF_AOTM,SMARTBUFF_AOTW,SMARTBUFF_AOTB,SMARTBUFF_AOTC,SMARTBUFF_AOTP,SMARTBUFF_AOTV,SMARTBUFF_AOTDH }; - - -- Shaman - SMARTBUFF_LIGHTNINGSHIELD = GetSpellInfo(324); --"Lightning Shield" - SMARTBUFF_WATERSHIELD = GetSpellInfo(24398); --"Water Shield" - SMARTBUFF_EARTHSHIELD = GetSpellInfo(974); --"Earth Shield" - SMARTBUFF_ROCKBITERW = GetSpellInfo(8017); --"Rockbiter Weapon" - SMARTBUFF_FROSTBRANDW = GetSpellInfo(8033); --"Frostbrand Weapon" - SMARTBUFF_FLAMETONGUEW = GetSpellInfo(8024); --"Flametongue Weapon" - SMARTBUFF_WINDFURYW = GetSpellInfo(8232); --"Windfury Weapon" - SMARTBUFF_EARTHLIVINGW = GetSpellInfo(51730); --"Earthliving Weapon" - SMARTBUFF_WATERBREATHING = GetSpellInfo(131); --"Water Breathing" - SMARTBUFF_WATERWALKING = GetSpellInfo(546); --"Water Walking" - - -- Shaman chained - S.ChainShamanShield = { SMARTBUFF_LIGHTNINGSHIELD, SMARTBUFF_WATERSHIELD, SMARTBUFF_EARTHSHIELD }; - - -- Warrior - SMARTBUFF_BATTLESHOUT = GetSpellInfo(6673); --"Battle Shout" - SMARTBUFF_COMMANDINGSHOUT = GetSpellInfo(469); --"Commanding Shout" - SMARTBUFF_BERSERKERRAGE = GetSpellInfo(18499); --"Berserker Rage" - SMARTBUFF_BLOODRAGE = GetSpellInfo(2687); --"Bloodrage" - SMARTBUFF_RAMPAGE = GetSpellInfo(29801); --"Rampage" - SMARTBUFF_VIGILANCE = GetSpellInfo(50720); --"Vigilance" - SMARTBUFF_SHIELDBLOCK = GetSpellInfo(2565); --"Shield Block" - - -- Warrior chained - S.ChainWarriorShout = { SMARTBUFF_BATTLESHOUT, SMARTBUFF_COMMANDINGSHOUT }; - - - -- Rogue - SMARTBUFF_BLADEFLURRY = GetSpellInfo(13877); --"Blade Flurry" - SMARTBUFF_SAD = GetSpellInfo(5171); --"Slice and Dice" - SMARTBUFF_EVASION = GetSpellInfo(5277); --"Evasion" - SMARTBUFF_HUNGERFORBLOOD = GetSpellInfo(51662); --"Hunger For Blood" - SMARTBUFF_STEALTH = GetSpellInfo(1784); --"Stealth" - - - -- Paladin - SMARTBUFF_RIGHTEOUSFURY = GetSpellInfo(25780); --"Righteous Fury" - SMARTBUFF_HOLYSHIELD = GetSpellInfo(20925); --"Holy Shield" - SMARTBUFF_BOM = GetSpellInfo(19740); --"Blessing of Might" - SMARTBUFF_GBOM = GetSpellInfo(25782); --"Greater Blessing of Might" - SMARTBUFF_BOW = GetSpellInfo(19742); --"Blessing of Wisdom" - SMARTBUFF_GBOW = GetSpellInfo(25894); --"Greater Blessing of Wisdom" - SMARTBUFF_BOSAL = GetSpellInfo(1038); --"Blessing of Salvation" - SMARTBUFF_GBOSAL = GetSpellInfo(25895); --"Greater Blessing of Salvation" - SMARTBUFF_BOK = GetSpellInfo(20217); --"Blessing of Kings" - SMARTBUFF_GBOK = GetSpellInfo(25898); --"Greater Blessing of Kings" - SMARTBUFF_BOSAN = GetSpellInfo(20911); --"Blessing of Sanctuary" - SMARTBUFF_GBOSAN = GetSpellInfo(25899); --"Greater Blessing of Sanctuary" - SMARTBUFF_SOCOMMAND = GetSpellInfo(20375); --"Seal of Command" - SMARTBUFF_SOJUSTICE = GetSpellInfo(20164); --"Seal of Justice" - SMARTBUFF_SOLIGHT = GetSpellInfo(20165); --"Seal of Light" - SMARTBUFF_SORIGHTEOUSNESS = GetSpellInfo(21084); --"Seal of Righteousness" - SMARTBUFF_SOWISDOM = GetSpellInfo(20166); --"Seal of Wisdom" - SMARTBUFF_SOTCRUSADER = GetSpellInfo(21082); --"Seal of the Crusader" - SMARTBUFF_SOVENGEANCE = GetSpellInfo(31801); --"Seal of Vengeance" - SMARTBUFF_SOBLOOD = GetSpellInfo(31892); --"Seal of Blood" - SMARTBUFF_SOCORRUPTION = GetSpellInfo(53736); --"Seal of Corruption" - SMARTBUFF_SOMARTYR = GetSpellInfo(53720); --"Seal of the Martyr" - SMARTBUFF_DEVOTIONAURA = GetSpellInfo(465); --"Devotion Aura" - SMARTBUFF_RETRIBUTIONAURA = GetSpellInfo(7294); --"Retribution Aura" - SMARTBUFF_CONCENTRATIONAURA = GetSpellInfo(19746); --"Concentration Aura" - SMARTBUFF_SHADOWRESISTANCEAURA = GetSpellInfo(19876); --"Shadow Resistance Aura" - SMARTBUFF_FROSTRESISTANCEAURA = GetSpellInfo(19888); --"Frost Resistance Aura" - SMARTBUFF_FIRERESISTANCEAURA = GetSpellInfo(19891); --"Fire Resistance Aura" - SMARTBUFF_SANCTITYAURA = GetSpellInfo(20218); --"Sanctity Aura" - SMARTBUFF_CRUSADERAURA = GetSpellInfo(32223); --"Crusader Aura" - - -- Paladin chained - S.ChainPaladinBOM = { SMARTBUFF_BOM, SMARTBUFF_GBOM }; - S.ChainPaladinBOW = { SMARTBUFF_BOW, SMARTBUFF_GBOW }; - S.ChainPaladinSAL = { SMARTBUFF_BOSAL, SMARTBUFF_GBOSAL }; - S.ChainPaladinBOK = { SMARTBUFF_BOK, SMARTBUFF_GBOK }; - S.ChainPaladinSAN = { SMARTBUFF_BOSAN, SMARTBUFF_GBOSAN }; - S.ChainPaladinSeal = { SMARTBUFF_SOCOMMAND, SMARTBUFF_SOJUSTICE, SMARTBUFF_SOLIGHT, SMARTBUFF_SORIGHTEOUSNESS, SMARTBUFF_SOWISDOM, SMARTBUFF_SOTCRUSADER, SMARTBUFF_SOVENGEANCE, SMARTBUFF_SOBLOOD, SMARTBUFF_SOCORRUPTION, SMARTBUFF_SOMARTYR }; - S.ChainPaladinAura = { SMARTBUFF_DEVOTIONAURA, SMARTBUFF_RETRIBUTIONAURA, SMARTBUFF_CONCENTRATIONAURA, SMARTBUFF_SHADOWRESISTANCEAURA, SMARTBUFF_FROSTRESISTANCEAURA, SMARTBUFF_FIRERESISTANCEAURA, SMARTBUFF_SANCTITYAURA, SMARTBUFF_CRUSADERAURA }; - - -- Death Knight - SMARTBUFF_DANCINGRW = GetSpellInfo(49028); --"Dancing Rune Weapon" - SMARTBUFF_BLOODPRESENCE = GetSpellInfo(48263); --"Blood Presence" - SMARTBUFF_FROSTPRESENCE = GetSpellInfo(48266); --"Frost Presence" - SMARTBUFF_UNHOLYPRESENCE = GetSpellInfo(48265); --"Unholy Presence" - SMARTBUFF_PATHOFFROST = GetSpellInfo(3714); --"Path of Frost" - SMARTBUFF_BONESHIELD = GetSpellInfo(49222); --"Bone Shield" - SMARTBUFF_HORNOFWINTER = GetSpellInfo(57330); --"Horn of Winter" - SMARTBUFF_RAISEDEAD = GetSpellInfo(46584); --"Raise Dead" --- SMARTBUFF_POTGRAVE = GetSpellInfo(155522); --"Power of the Grave" (P) + -- warlock - Updated 19/5/2023 -------------------------------------------------------------------- + -- armor + SMARTBUFF_DEMONSKIN = GetSpellInfo(687); --"Demon Armor" + SMARTBUFF_DEMONARMOR = GetSpellInfo(706); --"Demon Armor" + SMARTBUFF_FELARMOR = GetSpellInfo(28176); --"Fel Armor" + -- pets + SMARTBUFF_SUMMONINFERNAL = GetSpellInfo(1122); --"Summon Inferno" + SMARTBUFF_SUMMONFELHUNTER = GetSpellInfo(691); --"Summon Fellhunter" + SMARTBUFF_SUMMONIMP = GetSpellInfo(688); --"Summon Imp" + SMARTBUFF_SUMMONSUCCUBUS = GetSpellInfo(712); --"Summon Succubus" + SMARTBUFF_SUMMONINCUBUS = GetSpellInfo(713); --"Summon Incubus" + SMARTBUFF_SUMMONVOIDWALKER = GetSpellInfo(697); --"Summon Voidwalker" + -- buffs + SMARTBUFF_UNENDINGBREATH = GetSpellInfo(5697); --"Unending Breath" + -- create stones + SMARTBUFF_CREATEHS = GetSpellInfo(6201); --"Create Healthstone" + SMARTBUFF_CREATESOULS = GetSpellInfo(693); --"Create Soulstone" + SMARTBUFF_CREATESPELLS = GetSpellInfo(2362); --"Create Spellstone" + SMARTBUFF_CREATEFIRES = GetSpellInfo(6366); --"Create Firestone" + -- other + SMARTBUFF_LOCKINVISIBILITY = GetSpellInfo(132); --"Detect Invisibility" + SMARTBUFF_LOCKSENSEDEMONS = GetSpellInfo(5500); --"Sense Demons" + + + -- Death Knight - Updated 20/5/2023 -------------------------------------------------------------------- + SMARTBUFF_DANCINGRW = GetSpellInfo(49028); --"Dancing Rune Weapon" + SMARTBUFF_BLOODPRESENCE = GetSpellInfo(48263); --"Blood Presence" + SMARTBUFF_FROSTPRESENCE = GetSpellInfo(48266); --"Frost Presence" + SMARTBUFF_UNHOLYPRESENCE = GetSpellInfo(48265); --"Unholy Presence" + SMARTBUFF_PATHOFFROST = GetSpellInfo(3714); --"Path of Frost" + SMARTBUFF_BONESHIELD = GetSpellInfo(49222); --"Bone Shield" + SMARTBUFF_HORNOFWINTER = GetSpellInfo(57330); --"Horn of Winter" + SMARTBUFF_RAISEDEAD = GetSpellInfo(46584); --"Raise Dead" -- Death Knight buff links - S.ChainDKPresence = { SMARTBUFF_BLOODPRESENCE, SMARTBUFF_FROSTPRESENCE, SMARTBUFF_UNHOLYPRESENCE }; + S.ChainDKPresence = { SMARTBUFF_BLOODPRESENCE, SMARTBUFF_FROSTPRESENCE, SMARTBUFF_UNHOLYPRESENCE }; + + + -- Rogue - Updated 20/5/2023 -------------------------------------------------------------------- + SMARTBUFF_STEALTH = GetSpellInfo(1784); --"Stealth" + SMARTBUFF_BLADEFLURRY = GetSpellInfo(13877); --"Blade Flurry" + SMARTBUFF_SAD = GetSpellInfo(5171); --"Slice and Dice" + SMARTBUFF_EVASION = GetSpellInfo(5277); --"Evasion" + SMARTBUFF_HUNGERFORBLOOD = GetSpellInfo(60177); --"Hunger For Blood" + SMARTBUFF_TRICKS = GetSpellInfo(57934); --"Tricks of the Trade" + SMARTBUFF_RECUPERATE = GetSpellInfo(185311); --"Crimson Vial + -- Poisons + SMARTBUFF_WOUNDPOISON = GetSpellInfo(8679); --"Wound Poison" + SMARTBUFF_CRIPPLINGPOISON = GetSpellInfo(3408); --"Crippling Poison" + SMARTBUFF_DEADLYPOISON = GetSpellInfo(2823); --"Deadly Poison" + SMARTBUFF_LEECHINGPOISON = GetSpellInfo(108211); --"Leeching Poison" + SMARTBUFF_INSTANTPOISON = GetSpellInfo(315584); --"Instant Poison" + SMARTBUFF_NUMBINGPOISON = GetSpellInfo(5761); --"Numbing Poison" + SMARTBUFF_AMPLIFYPOISON = GetSpellInfo(381664); --"Amplifying Poison" + SMARTBUFF_ATROPHICPOISON = GetSpellInfo(381637); --"Atrophic Poison" + + -- Rogue buff links -- todo (20/5/2023) +-- S.ChainRoguePoisonsLethal = { SMARTBUFF_DEADLYPOISON, SMARTBUFF_WOUNDPOISON, SMARTBUFF_INSTANTPOISON, SMARTBUFF_AGONIZINGPOISON, SMARTBUFF_AMPLIFYPOISON }; +-- S.ChainRoguePoisonsNonLethal = { SMARTBUFF_CRIPPLINGPOISON, SMARTBUFF_LEECHINGPOISON, SMARTBUFF_NUMBINGPOISON, SMARTBUFF_ATROPHICPOISON }; + - -- Tracking SMARTBUFF_FINDMINERALS = GetSpellInfo(2580); --"Find Minerals" SMARTBUFF_FINDHERBS = GetSpellInfo(2383); --"Find Herbs" + SMARTBUFF_FINDFISH = GetSpellInfo(43308); --"Find Fish" SMARTBUFF_FINDTREASURE = GetSpellInfo(2481); --"Find Treasure" SMARTBUFF_TRACKHUMANOIDS = GetSpellInfo(19883); --"Track Humanoids" + SMARTBUFF_DTRACKHUMANOIDS = GetSpellInfo(5225); --"Druid Track Humanoids" SMARTBUFF_TRACKBEASTS = GetSpellInfo(1494); --"Track Beasts" SMARTBUFF_TRACKUNDEAD = GetSpellInfo(19884); --"Track Undead" SMARTBUFF_TRACKHIDDEN = GetSpellInfo(19885); --"Track Hidden" @@ -562,8 +574,6 @@ function SMARTBUFF_InitSpellIDs() SMARTBUFF_TRACKDEMONS = GetSpellInfo(19878); --"Track Demons" SMARTBUFF_TRACKGIANTS = GetSpellInfo(19882); --"Track Giants" SMARTBUFF_TRACKDRAGONKIN = GetSpellInfo(19879); --"Track Dragonkin" - SMARTBUFF_SENSEDEMONS = GetSpellInfo(5500); --"Sense Demons" - SMARTBUFF_SENSEUNDEAD = GetSpellInfo(5502); --"Sense Undead" -- Racial SMARTBUFF_STONEFORM = GetSpellInfo(20594); --"Stoneform" @@ -571,363 +581,403 @@ function SMARTBUFF_InitSpellIDs() SMARTBUFF_BERSERKING = GetSpellInfo(26297); --"Berserking" SMARTBUFF_WOTFORSAKEN = GetSpellInfo(7744); --"Will of the Forsaken" SMARTBUFF_WarStomp = GetSpellInfo(20549); --"War Stomp" - + -- Food - SMARTBUFF_FOOD_AURA = GetSpellInfo(19705); --"Well Fed" + SMARTBUFF_FOOD_AURA = GetSpellInfo(46899); --"Well Fed" SMARTBUFF_FOOD_SPELL = GetSpellInfo(433); --"Food" - SMARTBUFF_DRINK_SPELL = GetSpellInfo(430); --"Drink" + SMARTBUFF_DRINK_SPELL = GetSpellInfo(430); --"Drink" + + -- Misc + SMARTBUFF_KIRUSSOV = GetSpellInfo(46302); --"K'iru's Song of Victory" + SMARTBUFF_FISHING = GetSpellInfo(7620) or GetSpellInfo(111541); --"Fishing" -- Scroll - SMARTBUFF_SBAGILITY = GetSpellInfo(8115); -- Scroll buff: Agility - SMARTBUFF_SBINTELLECT = GetSpellInfo(8096); -- Scroll buff: Intellect - SMARTBUFF_SBSTAMINA = GetSpellInfo(8099); -- Scroll buff: Stamina - SMARTBUFF_SBSPIRIT = GetSpellInfo(8112); -- Scroll buff: Spirit - SMARTBUFF_SBSTRENGHT = GetSpellInfo(8118); -- Scroll buff: Strength - SMARTBUFF_SBPROTECTION = GetSpellInfo(58452); -- Scroll buff: Armor - - --- Classic - Potions / Flasks / Elixirs - SMARTBUFF_ADEPTELIXIR_BUFF = GetSpellInfo(33740); -- Adept's Elixir - SMARTBUFF_MAJORDEFENSE_BUFF = GetSpellInfo(28557); -- Major Defense - SMARTBUFF_MAJORAGILITY_BUFF = GetSpellInfo(28497); -- Major Agility - SMARTBUFF_DRAENICWISDOM_BUFF = GetSpellInfo(39638); -- Draenic Wisdom - SMARTBUFF_MAJORFROSTPOWER_BUFF = GetSpellInfo(28549); -- Major Frost Power - SMARTBUFF_EARTHEN_BUFF = GetSpellInfo(39637); -- Earthen Elixir - SMARTBUFF_MASTERY_BUFF = GetSpellInfo(33741); -- Elixir of Mastery - SMARTBUFF_CAMOUFLAGE_BUFF = GetSpellInfo(28543); -- Elixir of Camouflage - SMARTBUFF_HEALINGPOWER_BUFF = GetSpellInfo(28491); -- Elixir of Healing Power - SMARTBUFF_MAJORFORTITUDE_BUFF = GetSpellInfo(39636); -- Elixir of Major Fortitude - SMARTBUFF_MAJORSTRENGTH_BUFF = GetSpellInfo(28490); -- Elixir of Major Strength - SMARTBUFF_ONSLAUGHTELIXIR_BUFF = GetSpellInfo(33738); -- Onslaught Elixir - SMARTBUFF_GREATERARCANE_BUFF = GetSpellInfo(17573); -- Greater Arcane - SMARTBUFF_MONGOOSEELIXIR_BUFF = GetSpellInfo(17571); -- Elixir of Mongoose - SMARTBUFF_BRUTEFORCE_BUFF = GetSpellInfo(17557); -- Elixir of Brute Force - SMARTBUFF_SAGESELIXIR_BUFF = GetSpellInfo(17555); -- Elixir of Sages - SMARTBUFF_SUPERIORDEFENSE_BUFF = GetSpellInfo(17554); -- Elixir of Superior Defense - SMARTBUFF_DEMONSLAYING_BUFF = GetSpellInfo(11477); -- Elixir of Demon Slaying - SMARTBUFF_MAJORFIREPOWER_BUFF = GetSpellInfo(28556); -- Elixir of Major Fire Power - SMARTBUFF_GREATERFIREPOWER_BUFF = GetSpellInfo(26277); -- Elixir of Greater Fire Power - SMARTBUFF_SHADOWPOWER_BUFF = GetSpellInfo(11476); -- Elixir of Shadow Power - SMARTBUFF_GIANTSELIXIR_BUFF = GetSpellInfo(11472); -- Elixir of Giants - SMARTBUFF_GREATERAGILITY_BUFF = GetSpellInfo(11467); -- Elixir of Greater Agility - SMARTBUFF_GIFTOFARTHAS_BUFF = GetSpellInfo(11466); -- Gift of Arthas - SMARTBUFF_ARANCEELIXIR_BUFF = GetSpellInfo(11461); -- Arcane Elixir - SMARTBUFF_GREATERINTELLECT_BUFF = GetSpellInfo(11465); -- Elixir of Greater Intellect - SMARTBUFF_MAJORNATUREPROT_BUFF = GetSpellInfo(28573); -- Major Natur Protection Potion - SMARTBUFF_MAJORMAGEBLOOD_BUFF = GetSpellInfo(28570); -- Major Mageblood - SMARTBUFF_MAJORSHADOWPWR_BUFF = GetSpellInfo(28558); -- Major Shadow Power - SMARTBUFF_MAJORIRONSKIN_BUFF = GetSpellInfo(39639); -- Major Ironskin - SMARTBUFF_BLINDINGLIGHTFLASK_BUFF = GetSpellInfo(28590); -- Flask of Blinding Light - SMARTBUFF_FORTIFICATIONFLASK_BUFF = GetSpellInfo(28587); -- Flask of Fortification - SMARTBUFF_RESTORATIONFLASK_BUFF = GetSpellInfo(28588); -- Flask of Restoration - SMARTBUFF_PUREDEATHFLASK_BUFF = GetSpellInfo(28591); -- Flask of Pure Death - SMARTBUFF_RELENTLESSFLASK_BUFF = GetSpellInfo(28589); -- Flask of Relentless Assault - SMARTBUFF_CHROMATICFLASK_BUFF = GetSpellInfo(17638); -- Flask of Chromatic Resistance - SMARTBUFF_DISTILLEDFLASK_BUFF = GetSpellInfo(17636); -- Flask of Distilled Wisdom - SMARTBUFF_SUPREMEPWRFLASK_BUFF = GetSpellInfo(17637); -- Flask of Supreme Power - - SMARTBUFF_FLASKOFFROSTWYRM_BUFF = GetSpellInfo(53901); -- Flask of Frost Wyrm - SMARTBUFF_FLASKOFSTONEBLOOD_BUFF = GetSpellInfo(53902); -- Flask of Stoneblood - SMARTBUFF_FLASKOFENDLESSRAGE_BUFF = GetSpellInfo(53903); -- Flask of Endless Rage - SMARTBUFF_FLASKOFTHENORTH_BUFF = GetSpellInfo(67019); -- Flask of the North - + SMARTBUFF_SBAGILITY = GetSpellInfo(8115); --"Scroll buff: Agility" + SMARTBUFF_SBINTELLECT = GetSpellInfo(8096); --"Scroll buff: Intellect" + SMARTBUFF_SBSTAMINA = GetSpellInfo(8099); --"Scroll buff: Stamina" + SMARTBUFF_SBSPIRIT = GetSpellInfo(8112); --"Scroll buff: Spirit" + SMARTBUFF_SBSTRENGHT = GetSpellInfo(8118); --"Scroll buff: Strength" + SMARTBUFF_SBPROTECTION = GetSpellInfo(89344); --"Scroll buff: Armor" + SMARTBUFF_BMiscItem1 = GetSpellInfo(326396); --"WoW's 16th Anniversary" + SMARTBUFF_BMiscItem2 = GetSpellInfo(62574); --"Warts-B-Gone Lip Balm" + SMARTBUFF_BMiscItem3 = GetSpellInfo(98444); --"Vrykul Drinking Horn" + SMARTBUFF_BMiscItem4 = GetSpellInfo(127230); --"Visions of Insanity" + SMARTBUFF_BMiscItem5 = GetSpellInfo(124036); --"Anglers Fishing Raft" + SMARTBUFF_BMiscItem6 = GetSpellInfo(125167); --"Ancient Pandaren Fishing Charm" + SMARTBUFF_BMiscItem7 = GetSpellInfo(138927); --"Burning Essence" + SMARTBUFF_BMiscItem8 = GetSpellInfo(160331); --"Blood Elf Illusion" + SMARTBUFF_BMiscItem9 = GetSpellInfo(158486); --"Safari Hat" + SMARTBUFF_BMiscItem10 = GetSpellInfo(158474); --"Savage Safari Hat" + SMARTBUFF_BMiscItem11 = GetSpellInfo(176151); --"Whispers of Insanity" + SMARTBUFF_BMiscItem12 = GetSpellInfo(193456); --"Gaze of the Legion" + SMARTBUFF_BMiscItem13 = GetSpellInfo(193547); --"Fel Crystal Infusion" + SMARTBUFF_BMiscItem14 = GetSpellInfo(190668); --"Empower" + SMARTBUFF_BMiscItem14_1 = GetSpellInfo(175457); --"Focus Augmentation" + SMARTBUFF_BMiscItem14_2 = GetSpellInfo(175456); --"Hyper Augmentation" + SMARTBUFF_BMiscItem14_3 = GetSpellInfo(175439); --"Stout Augmentation + SMARTBUFF_BMiscItem16 = GetSpellInfo(181642); --"Bodyguard Miniaturization Device" + SMARTBUFF_BMiscItem17 = GetSpellInfo(242551); --"Fel Focus" + + S.LinkSafariHat = { SMARTBUFF_BMiscItem9, SMARTBUFF_BMiscItem10 }; + S.LinkAugment = { SMARTBUFF_BMiscItem14, SMARTBUFF_BMiscItem14_1, SMARTBUFF_BMiscItem14_2, SMARTBUFF_BMiscItem14_3, SMARTBUFF_BAugmentRune, SMARTBUFF_BVieledAugment, SMARTBUFF_BDraconicRune }; + + -- Flasks & Elixirs + SMARTBUFF_BFLASKTBC1 = GetSpellInfo(28520); --"Flask of Relentless Assault" + SMARTBUFF_BFLASKTBC2 = GetSpellInfo(28540); --"Flask of Pure Death" + SMARTBUFF_BFLASKTBC3 = GetSpellInfo(28518); --"Flask of Fortification" + SMARTBUFF_BFLASKTBC4 = GetSpellInfo(28521); --"Flask of Blinding Light" + SMARTBUFF_BFLASKTBC5 = GetSpellInfo(28519); --"Flask of Mighty Versatility" + SMARTBUFF_BFLASK1 = GetSpellInfo(53760); --"Flask of Endless Rage" + SMARTBUFF_BFLASK2 = GetSpellInfo(53755); --"Flask of the Frost Wyrm" + SMARTBUFF_BFLASK3 = GetSpellInfo(53758); --"Flask of Stoneblood" + SMARTBUFF_BFLASK4 = GetSpellInfo(54212); --"Flask of Pure Mojo" + SMARTBUFF_BFLASKCT1 = GetSpellInfo(79471); --"Flask of the Winds" + SMARTBUFF_BFLASKCT2 = GetSpellInfo(79472); --"Flask of Titanic Strength" + SMARTBUFF_BFLASKCT3 = GetSpellInfo(79470); --"Flask of the Draconic Mind" + SMARTBUFF_BFLASKCT4 = GetSpellInfo(79469); --"Flask of Steelskin" + SMARTBUFF_BFLASKCT5 = GetSpellInfo(94160); --"Flask of Flowing Water" + SMARTBUFF_BFLASKCT7 = GetSpellInfo(92679); --"Flask of Battle" + SMARTBUFF_BFLASKMOP1 = GetSpellInfo(105617); --"Alchemist's Flask" + SMARTBUFF_BFLASKMOP2 = GetSpellInfo(105694); --"Flask of the Earth" + SMARTBUFF_BFLASKMOP3 = GetSpellInfo(105693); --"Flask of Falling Leaves" + SMARTBUFF_BFLASKMOP4 = GetSpellInfo(105689); --"Flask of Spring Blossoms" + SMARTBUFF_BFLASKMOP5 = GetSpellInfo(105691); --"Flask of the Warm Sun" + SMARTBUFF_BFLASKMOP6 = GetSpellInfo(105696); --"Flask of Winter's Bite" + SMARTBUFF_BFLASKCT61 = GetSpellInfo(79640); --"Enhanced Intellect" + SMARTBUFF_BFLASKCT62 = GetSpellInfo(79639); --"Enhanced Agility" + SMARTBUFF_BFLASKCT63 = GetSpellInfo(79638); --"Enhanced Strength" + SMARTBUFF_BFLASKWOD1 = GetSpellInfo(156077); --"Draenic Stamina Flask" + SMARTBUFF_BFLASKWOD2 = GetSpellInfo(156071); --"Draenic Strength Flask" + SMARTBUFF_BFLASKWOD3 = GetSpellInfo(156070); --"Draenic Intellect Flask" + SMARTBUFF_BFLASKWOD4 = GetSpellInfo(156073); --"Draenic Agility Flask" + SMARTBUFF_BGRFLASKWOD1 = GetSpellInfo(156084); --"Greater Draenic Stamina Flask" + SMARTBUFF_BGRFLASKWOD2 = GetSpellInfo(156080); --"Greater Draenic Strength Flask" + SMARTBUFF_BGRFLASKWOD3 = GetSpellInfo(156079); --"Greater Draenic Intellect Flask" + SMARTBUFF_BGRFLASKWOD4 = GetSpellInfo(156064); --"Greater Draenic Agility Flask" + SMARTBUFF_BFLASKLEG1 = GetSpellInfo(188035); --"Flask of Ten Thousand Scars" + SMARTBUFF_BFLASKLEG2 = GetSpellInfo(188034); --"Flask of the Countless Armies" + SMARTBUFF_BFLASKLEG3 = GetSpellInfo(188031); --"Flask of the Whispered Pact" + SMARTBUFF_BFLASKLEG4 = GetSpellInfo(188033); --"Flask of the Seventh Demon" + SMARTBUFF_BFLASKBFA1 = GetSpellInfo(251837); --"Flask of Endless Fathoms" + SMARTBUFF_BFLASKBFA2 = GetSpellInfo(251836); --"Flask of the Currents" + SMARTBUFF_BFLASKBFA3 = GetSpellInfo(251839); --"Flask of the Undertow" + SMARTBUFF_BFLASKBFA4 = GetSpellInfo(251838); --"Flask of the Vast Horizon" + SMARTBUFF_BGRFLASKBFA1 = GetSpellInfo(298837); --"Greather Flask of Endless Fathoms" + SMARTBUFF_BGRFLASKBFA2 = GetSpellInfo(298836); --"Greater Flask of the Currents" + SMARTBUFF_BGRFLASKBFA3 = GetSpellInfo(298841); --"Greather Flask of teh Untertow" + SMARTBUFF_BGRFLASKBFA4 = GetSpellInfo(298839); --"Greater Flask of the Vast Horizon" + SMARTBUFF_BFLASKSL1 = GetSpellInfo(307185); --"Spectral Flask of Power" + SMARTBUFF_BFLASKSL2 = GetSpellInfo(307187); --"Spectral Flask of Stamina" + + S.LinkFlaskTBC = { SMARTBUFF_BFLASKTBC1, SMARTBUFF_BFLASKTBC2, SMARTBUFF_BFLASKTBC3, SMARTBUFF_BFLASKTBC4, SMARTBUFF_BFLASKTBC5 }; + S.LinkFlaskCT7 = { SMARTBUFF_BFLASKCT1, SMARTBUFF_BFLASKCT2, SMARTBUFF_BFLASKCT3, SMARTBUFF_BFLASKCT4, SMARTBUFF_BFLASKCT5 }; + S.LinkFlaskMoP = { SMARTBUFF_BFLASKCT61, SMARTBUFF_BFLASKCT62, SMARTBUFF_BFLASKCT63, SMARTBUFF_BFLASKMOP2, SMARTBUFF_BFLASKMOP3, SMARTBUFF_BFLASKMOP4, SMARTBUFF_BFLASKMOP5, SMARTBUFF_BFLASKMOP6 }; + S.LinkFlaskWoD = { SMARTBUFF_BFLASKWOD1, SMARTBUFF_BFLASKWOD2, SMARTBUFF_BFLASKWOD3, SMARTBUFF_BFLASKWOD4, SMARTBUFF_BGRFLASKWOD1, SMARTBUFF_BGRFLASKWOD2, SMARTBUFF_BGRFLASKWOD3, SMARTBUFF_BGRFLASKWOD4 }; + S.LinkFlaskLeg = { SMARTBUFF_BFLASKLEG1, SMARTBUFF_BFLASKLEG2, SMARTBUFF_BFLASKLEG3, SMARTBUFF_BFLASKLEG4 }; + S.LinkFlaskBfA = { SMARTBUFF_BFLASKBFA1, SMARTBUFF_BFLASKBFA2, SMARTBUFF_BFLASKBFA3, SMARTBUFF_BFLASKBFA4, SMARTBUFF_BGRFLASKBFA1, SMARTBUFF_BGRFLASKBFA2, SMARTBUFF_BGRFLASKBFA3, SMARTBUFF_BGRFLASKBFA4 }; + S.LinkFlaskSL = { SMARTBUFF_BFLASKSL1, SMARTBUFF_BFLASKSL2 }; + S.LinkFlaskDF = { SMARTBUFF_BFlaskDF1, SMARTBUFF_BFlaskDF2, SMARTBUFF_BFlaskDF3, SMARTBUFF_BFlaskDF4, SMARTBUFF_BFlaskDF5, SMARTBUFF_BFlaskDF6, SMARTBUFF_BFlaskDF7, SMARTBUFF_BFlaskDF8, SMARTBUFF_BFlaskDF9, SMARTBUFF_BFlaskDF10, SMARTBUFF_BFlaskDF11, SMARTBUFF_BFlaskDF12, SMARTBUFF_BFlaskDF13_1, SMARTBUFF_BFlaskDF13_2, SMARTBUFF_BFlaskDF13_3, SMARTBUFF_BFlaskDF13_4, SMARTBUFF_BFlaskDF14 }; + + SMARTBUFF_BELIXIRTBC1 = GetSpellInfo(54494); --"Major Agility" B + SMARTBUFF_BELIXIRTBC2 = GetSpellInfo(33726); --"Mastery" B + SMARTBUFF_BELIXIRTBC3 = GetSpellInfo(28491); --"Healing Power" B + SMARTBUFF_BELIXIRTBC4 = GetSpellInfo(28502); --"Major Defense" G + SMARTBUFF_BELIXIRTBC5 = GetSpellInfo(28490); --"Major Strength" B + SMARTBUFF_BELIXIRTBC6 = GetSpellInfo(39625); --"Major Fortitude" G + SMARTBUFF_BELIXIRTBC7 = GetSpellInfo(28509); --"Major Mageblood" B + SMARTBUFF_BELIXIRTBC8 = GetSpellInfo(39627); --"Draenic Wisdom" B + SMARTBUFF_BELIXIRTBC9 = GetSpellInfo(54452); --"Adept's Elixir" B + SMARTBUFF_BELIXIRTBC10 = GetSpellInfo(134870); --"Empowerment" B + SMARTBUFF_BELIXIRTBC11 = GetSpellInfo(33720); --"Onslaught Elixir" B + SMARTBUFF_BELIXIRTBC12 = GetSpellInfo(28503); --"Major Shadow Power" B + SMARTBUFF_BELIXIRTBC13 = GetSpellInfo(39628); --"Ironskin" G + SMARTBUFF_BELIXIRTBC14 = GetSpellInfo(39626); --"Earthen Elixir" G + SMARTBUFF_BELIXIRTBC15 = GetSpellInfo(28493); --"Major Frost Power" B + SMARTBUFF_BELIXIRTBC16 = GetSpellInfo(38954); --"Fel Strength Elixir" B + SMARTBUFF_BELIXIRTBC17 = GetSpellInfo(28501); --"Major Firepower" B + SMARTBUFF_BELIXIR1 = GetSpellInfo(28497); --"Mighty Agility" B + SMARTBUFF_BELIXIR2 = GetSpellInfo(60347); --"Mighty Thoughts" G + SMARTBUFF_BELIXIR3 = GetSpellInfo(53751); --"Elixir of Mighty Fortitude" G + SMARTBUFF_BELIXIR4 = GetSpellInfo(53748); --"Mighty Strength" B + SMARTBUFF_BELIXIR5 = GetSpellInfo(53747); --"Elixir of Spirit" B + SMARTBUFF_BELIXIR6 = GetSpellInfo(53763); --"Protection" G + SMARTBUFF_BELIXIR7 = GetSpellInfo(60343); --"Mighty Defense" G + SMARTBUFF_BELIXIR8 = GetSpellInfo(60346); --"Lightning Speed" B + SMARTBUFF_BELIXIR9 = GetSpellInfo(60344); --"Expertise" B + SMARTBUFF_BELIXIR10 = GetSpellInfo(60341); --"Deadly Strikes" B + SMARTBUFF_BELIXIR11 = GetSpellInfo(80532); --"Armor Piercing" + SMARTBUFF_BELIXIR12 = GetSpellInfo(60340); --"Accuracy" B + SMARTBUFF_BELIXIR13 = GetSpellInfo(53749); --"Guru's Elixir" B + SMARTBUFF_BELIXIR14 = GetSpellInfo(11334); --"Elixir of Greater Agility" B + SMARTBUFF_BELIXIR15 = GetSpellInfo(54452); --"Adept's Elixir" B + SMARTBUFF_BELIXIR16 = GetSpellInfo(33721); --"Spellpower Elixir" B + SMARTBUFF_BELIXIRCT1 = GetSpellInfo(79635); --"Elixir of the Master" B + SMARTBUFF_BELIXIRCT2 = GetSpellInfo(79632); --"Elixir of Mighty Speed" B + SMARTBUFF_BELIXIRCT3 = GetSpellInfo(79481); --"Elixir of Impossible Accuracy" B + SMARTBUFF_BELIXIRCT4 = GetSpellInfo(79631); --"Prismatic Elixir" G + SMARTBUFF_BELIXIRCT5 = GetSpellInfo(79480); --"Elixir of Deep Earth" G + SMARTBUFF_BELIXIRCT6 = GetSpellInfo(79477); --"Elixir of the Cobra" B + SMARTBUFF_BELIXIRCT7 = GetSpellInfo(79474); --"Elixir of the Naga" B + SMARTBUFF_BELIXIRCT8 = GetSpellInfo(79468); --"Ghost Elixir" B + SMARTBUFF_BELIXIRMOP1 = GetSpellInfo(105687); --"Elixir of Mirrors" G + SMARTBUFF_BELIXIRMOP2 = GetSpellInfo(105685); --"Elixir of Peace" B + SMARTBUFF_BELIXIRMOP3 = GetSpellInfo(105686); --"Elixir of Perfection" B + SMARTBUFF_BELIXIRMOP4 = GetSpellInfo(105684); --"Elixir of the Rapids" B + SMARTBUFF_BELIXIRMOP5 = GetSpellInfo(105683); --"Elixir of Weaponry" B + SMARTBUFF_BELIXIRMOP6 = GetSpellInfo(105682); --"Mad Hozen Elixir" B + SMARTBUFF_BELIXIRMOP7 = GetSpellInfo(105681); --"Mantid Elixir" G + SMARTBUFF_BELIXIRMOP8 = GetSpellInfo(105688); --"Monk's Elixir" B + -- Draught of Ten Lands + SMARTBUFF_BEXP_POTION = GetSpellInfo(289982); --Draught of Ten Lands + + --if (SMARTBUFF_GOTW) then + -- SMARTBUFF_AddMsgD(SMARTBUFF_GOTW.." found"); + --end + -- Buff map - S.LinkStats = { SMARTBUFF_BOK, SMARTBUFF_MOTW, SMARTBUFF_LOTE, SMARTBUFF_LOTWT, SMARTBUFF_MOTWR1, SMARTBUFF_MOTWR2, SMARTBUFF_MOTWR3, - SMARTBUFF_MOTWR4, SMARTBUFF_MOTWR5, SMARTBUFF_MOTWR6, SMARTBUFF_MOTWR7, SMARTBUFF_GOTWR1, SMARTBUFF_GOTWR2, + S.LinkStats = { SMARTBUFF_BOK, SMARTBUFF_GBOK, SMARTBUFF_MOTW, SMARTBUFF_GOTW, SMARTBUFF_LOTE, SMARTBUFF_LOTWT, GetSpellInfo(159988), -- Bark of the Wild GetSpellInfo(203538), -- Greater Blessing of Kings GetSpellInfo(90363), -- Embrace of the Shale Spider - GetSpellInfo(160077), -- Strength of the Earth - SMARTBUFF_PWF, SMARTBUFF_POFRB1, + GetSpellInfo(160077) -- Strength of the Earth }; - S.LinkFlaskClassic = { SMARTBUFF_BLINDINGLIGHTFLASK_BUFF, SMARTBUFF_FORTIFICATIONFLASK_BUFF, SMARTBUFF_RESTORATIONFLASK_BUFF, SMARTBUFF_PUREDEATHFLASK_BUFF, - SMARTBUFF_RELENTLESSFLASK_BUFF, SMARTBUFF_CHROMATICFLASK_BUFF, SMARTBUFF_DISTILLEDFLASK_BUFF, SMARTBUFF_SUPREMEPWRFLASK_BUFF, - SMARTBUFF_FLASKOFFROSTWYRM_BUFF, SMARTBUFF_FLASKOFSTONEBLOOD_BUFF, SMARTBUFF_FLASKOFENDLESSRAGE_BUFF, SMARTBUFF_FLASKOFTHENORTH_BUFF}; + S.LinkSta = { SMARTBUFF_PWFORTITUDE, SMARTBUFF_PRAYERFORTITUDE, SMARTBUFF_COMMANDINGSHOUT, SMARTBUFF_BLOODPACT, + GetSpellInfo(50256), -- Invigorating Roar + GetSpellInfo(90364), -- Qiraji Fortitude + GetSpellInfo(160014), -- Sturdiness + GetSpellInfo(160003) -- Savage Vigor + }; - - S.LinkSp = { SMARTBUFF_POSPRB1, SMARTBUFF_POSPRB2 } S.LinkAp = { SMARTBUFF_HORNOFWINTER, SMARTBUFF_BATTLESHOUT, SMARTBUFF_TRUESHOTAURA }; - + S.LinkMa = { SMARTBUFF_BOM, SMARTBUFF_DRUID_MKAURA, SMARTBUFF_GRACEOFAIR, SMARTBUFF_POTGRAVE, GetSpellInfo(93435), -- Roar of Courage GetSpellInfo(160039), -- Keen Senses GetSpellInfo(128997), -- Spirit Beast Blessing GetSpellInfo(160073) -- Plainswalking - }; - - SMARTBUFF_AddMsgD(">>>> Spell ID's have been initialised."); + }; + + S.LinkInt = { SMARTBUFF_BOW, SMARTBUFF_AI, SMARTBUFF_AB, SMARTBUFF_DALARANB }; + --SMARTBUFF_AddMsgD("Spell IDs initialized"); end ----------------------------------------------------------------------------------------------------------------------------------- ---- ---- Initialise Spell List ---- ----------------------------------------------------------------------------------------------------------------------------------- function SMARTBUFF_InitSpellList() + if (SMARTBUFF_PLAYERCLASS == nil) then return; end - - -- Druid - if (SMARTBUFF_PLAYERCLASS == "DRUID") then + + -- Paladin + if (SMARTBUFF_PLAYERCLASS == "PALADIN") then -- updated 7/5/2023 Codermik SMARTBUFF_BUFFLIST = { - {SMARTBUFF_MOTW, 30, SMARTBUFF_CONST_GROUP, {1,10,20,30,40,50,60,70,80}, "HPET;WPET", S.LinkDruidGOTW}, - {SMARTBUFF_GOTWRB1, 60, SMARTBUFF_CONST_GROUP, {50,60,70,80}, "HPET;WPET", S.LinkDruidGOTW, {SMARTBUFF_WILDBERRIES,SMARTBUFF_WILDTHORNROOT}}, - {SMARTBUFF_IMPTHORNS, 10, SMARTBUFF_CONST_GROUP, {6,14}, "HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;WPET;DKPET", S.LinkDruidThorns}, - {SMARTBUFF_THORNS, 10, SMARTBUFF_CONST_GROUP, {6,14,24,34,44,54, 64, 74}, "HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;WPET;DKPET", S.LinkDruidThorns}, - {SMARTBUFF_OMENOFCLARITY, 10, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_BARKSKIN, 0.25, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_NATURESGRASP, 0.75, SMARTBUFF_CONST_FORCESELF}, - {SMARTBUFF_TIGERSFURY, 0.1, SMARTBUFF_CONST_SELF, nil, SMARTBUFF_DRUID_CAT}, - {SMARTBUFF_SAVAGEROAR, 0.15, SMARTBUFF_CONST_SELF, nil, SMARTBUFF_DRUID_CAT}, - {SMARTBUFF_DRUID_MOONKIN, -1, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_DRUID_TREE, -1, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_CENARIONWARD, 0.5, SMARTBUFF_CONST_GROUP, {1}, "WARRIOR;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;DEATHKNIGHT"}, + -- blessings. + {SMARTBUFF_GBOM, 60, SMARTBUFF_CONST_GROUP, {52, 60, 70, 73, 79}, nil, S.LinkMa}, + {SMARTBUFF_GBOK, 60, SMARTBUFF_CONST_GROUP, {52, 60, 70, 73, 79}, nil, S.LinkStats}, + {SMARTBUFF_GBOW, 60, SMARTBUFF_CONST_GROUP, {52, 60, 70, 73, 79}, nil, S.LinkInt}, + {SMARTBUFF_GBOS, 60, SMARTBUFF_CONST_GROUP, {60}, nil, S.ChainPaladinBlessing}, + {SMARTBUFF_BOM, 10, SMARTBUFF_CONST_GROUP, {52, 60, 70, 73, 79}, nil, S.LinkMa}, + {SMARTBUFF_BOK, 10, SMARTBUFF_CONST_GROUP, {52, 60, 70, 73, 79}, nil, S.LinkStats}, + {SMARTBUFF_BOW, 10, SMARTBUFF_CONST_GROUP, {52, 60, 70, 73, 79}, nil, S.LinkInt}, + {SMARTBUFF_BOS, 10, SMARTBUFF_CONST_GROUP, {60}, nil, S.ChainPaladinBlessing}, + -- hands + {SMARTBUFF_HOF, 0.1, SMARTBUFF_CONST_GROUP, {26}, "WARRIOR;DEATHKNIGHT;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;HPET;WPET;DKPET", S.ChainPaladinHand}, + {SMARTBUFF_HOP, 0.1, SMARTBUFF_CONST_GROUP, {10, 24, 38}, "WARRIOR;DEATHKNIGHT;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;HPET;WPET;DKPET", S.ChainPaladinHand}, + {SMARTBUFF_HOSAL, 0.1, SMARTBUFF_CONST_GROUP, {26}, "WARRIOR;DEATHKNIGHT;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;HPET;WPET;DKPET", S.ChainPaladinHand}, + {SMARTBUFF_HOSAC, 0.1, SMARTBUFF_CONST_GROUP, {46}, "WARRIOR;DEATHKNIGHT;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;HPET;WPET;DKPET", S.ChainPaladinHand}, + -- seals + {SMARTBUFF_SOCOMMAND, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, + {SMARTBUFF_SOVENGEANCE, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, + {SMARTBUFF_SOCORRUPTION, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, + {SMARTBUFF_SOJUSTICE, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, + {SMARTBUFF_SORIGHTEOUSNESS, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, + {SMARTBUFF_SOWISDOM, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, + {SMARTBUFF_SOLIGHT, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, + -- auras + {SMARTBUFF_CRUSADERAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, + {SMARTBUFF_DEVOTIONAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, + {SMARTBUFF_RETRIBUTIONAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, + {SMARTBUFF_FIREAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, + {SMARTBUFF_FROSTAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, + {SMARTBUFF_SHADOWAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, + -- other + {SMARTBUFF_RIGHTEOUSFURY, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_HOLYSHIELD, 8, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_SACREDSHIELD, 12, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_AVENGINGWARTH, 180, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_BEACONOFLIGHT, 60, SMARTBUFF_CONST_GROUP, {60}, "WARRIOR;DEATHKNIGHT;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;HPET;WPET;DKPET"}, }; end - - -- Priest - if (SMARTBUFF_PLAYERCLASS == "PRIEST") then - SMARTBUFF_BUFFLIST = { - {SMARTBUFF_PWF, 30, SMARTBUFF_CONST_GROUP, {1,12,24,36,48,60,70,80}, "HPET;WPET;DKPET", S.ChainPriestFortBuffs}, - {SMARTBUFF_POFRB1, 60, SMARTBUFF_CONST_GROUP, {48,60,70,80}, "HPET;WPET;DKPET", S.ChainPriestFortBuffs, {SMARTBUFF_SACREDCANDLE}}, - {SMARTBUFF_SP, 30, SMARTBUFF_CONST_GROUP, {30,42,56,68,76}, "HPET;WPET;DKPET", S.ChainPriestShadowBuffs}, - {SMARTBUFF_POSPRB1, 60, SMARTBUFF_CONST_GROUP, {48,60,70,80}, "HPET;WPET;DKPET", S.ChainPriestShadowBuffs, {SMARTBUFF_SACREDCANDLE}}, - {SMARTBUFF_POSRB1, 60, SMARTBUFF_CONST_GROUP, {48,60,70,80}, "HPET;WPET;DKPET", S.ChainPriestSpiritBuffs, {SMARTBUFF_SACREDCANDLE}}, - {SMARTBUFF_DS, 30, SMARTBUFF_CONST_GROUP, {30,40,50,60,70,80}, "HPET;WPET;DKPET", S.ChainPriestSpiritBuffs}, - {SMARTBUFF_VAMPIRICEMB, 30, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_INNERFIRE, 10, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_PWS, 0.5, SMARTBUFF_CONST_GROUP, {6,12,18,24,30,36,42,48,54,60,65,70,75,80}, "MAGE;WARLOCK;DEATHKNIGHT;ROGUE;PALADIN;WARRIOR;DRUID;HUNTER;SHAMAN;HPET;WPET;DKPET"}, - {SMARTBUFF_SHADOWFORM, -1, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_FEARWARD, 10, SMARTBUFF_CONST_GROUP, {20}}, - {SMARTBUFF_ELUNESGRACE, 0.25, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_FEEDBACK, 0.25, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_SHADOWGUARD, 10, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_TOUCHOFWEAKNESS, 10, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_INNERFOCUS, -1, SMARTBUFF_CONST_SELF} - }; - end - -- Mage - if (SMARTBUFF_PLAYERCLASS == "MAGE") then - SMARTBUFF_BUFFLIST = { - {SMARTBUFF_DALINT, 30, SMARTBUFF_CONST_GROUP, {1,14,28,42,56,70,80}, "ROGUE;WARRIOR;DEATHKNIGHT;HPET;WPET", S.ChainMageBuffs}, - {SMARTBUFF_DALBRILL, 60, SMARTBUFF_CONST_GROUP, {56,70,80}, "ROGUE;WARRIOR;DEATHKNIGHT;HPET;WPET;DKPET", S.ChainMageBuffs, {SMARTBUFF_ARCANEPOWDER}}, - {SMARTBUFF_AI, 30, SMARTBUFF_CONST_GROUP, {1,14,28,42,56,70,80}, "ROGUE;WARRIOR;DEATHKNIGHT;HPET;WPET;DKPET", S.ChainMageBuffs}, - {SMARTBUFF_ABRB1, 60, SMARTBUFF_CONST_GROUP, {56,70,80}, "ROGUE;WARRIOR;DEATHKNIGHT;HPET;WPET;DKPET", S.ChainMageBuffs, {SMARTBUFF_ARCANEPOWDER}}, - {SMARTBUFF_FOCUSMAGIC, 30, SMARTBUFF_CONST_GROUP, {20}, "WARRIOR;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;DEATHKNIGHT;HPET;WPET;DKPET"}, - {SMARTBUFF_ICEARMOR, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainMageArmor}, - {SMARTBUFF_FROSTARMOR, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainMageArmor}, - {SMARTBUFF_MAGEARMOR, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainMageArmor}, - {SMARTBUFF_MOLTENARMOR, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainMageArmor}, - {SMARTBUFF_DAMPENMAGIC, 10, SMARTBUFF_CONST_GROUP, {12,24,36,48,60,67,76}, "HPET;WPET;DKPET"}, - {SMARTBUFF_AMPLIFYMAGIC, 10, SMARTBUFF_CONST_GROUP, {18,30,42,54,63,69,77}, "HPET;WPET;DKPET"}, - {SMARTBUFF_MANASHIELD, 1, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_FIREWARD, 0.5, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_FROSTWARD, 0.5, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_ICEBARRIER, 1, SMARTBUFF_CONST_SELF}, + if (SMARTBUFF_PLAYERCLASS == "MAGE") then -- updated 7/5/2023 Codermik + SMARTBUFF_BUFFLIST = { + -- buffs + {SMARTBUFF_AI, 30, SMARTBUFF_CONST_GROUP, {1,14,28,42,56,70,80}, "WARRIOR;DEATHKNIGHT;ROGUE;HPET;WPET;DKPET", S.ChainMageBuffs}, + {SMARTBUFF_AB, 60, SMARTBUFF_CONST_GROUP, {56, 70, 80}, "WARRIOR;DEATHKNIGHT;ROGUE;HPET;WPET;DKPET", S.ChainMageBuffs}, + {SMARTBUFF_DALARANB, 60, SMARTBUFF_CONST_GROUP, {80}, "WARRIOR;DEATHKNIGHT;ROGUE;HPET;WPET;DKPET", S.ChainMageBuffs}, + -- Armor + {SMARTBUFF_ICEARMOR, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainMageArmor}, + {SMARTBUFF_FROSTARMOR, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainMageArmor}, + {SMARTBUFF_MAGEARMOR, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainMageArmor}, + {SMARTBUFF_MOLTENARMOR, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainMageArmor}, + -- Shields + {SMARTBUFF_MANASHIELD, 0.5, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_ICEBARRIER, 0.5, SMARTBUFF_CONST_SELF}, + -- Wards + {SMARTBUFF_FIREWARD, 30, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_FROSTWARD, 30, SMARTBUFF_CONST_SELF}, + -- other + {SMARTBUFF_FOCUSMAGIC, 30, SMARTBUFF_CONST_GROUP}, + {SMARTBUFF_AMPLIFYMAGIC, 10, SMARTBUFF_CONST_GROUP}, + {SMARTBUFF_DAMPENMAGIC, 10, SMARTBUFF_CONST_GROUP}, + {SMARTBUFF_SUMMONWATERELE, -1, SMARTBUFF_CONST_SELF, nil, S.CheckPet}, {SMARTBUFF_COMBUSTION, -1, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_ICYVEINS, 0.33, SMARTBUFF_CONST_SELF}, {SMARTBUFF_ARCANEPOWER, 0.25, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_PRESENCEOFMIND, 0.165, SMARTBUFF_CONST_SELF} + {SMARTBUFF_PRESENCEOFMIND, 0.165, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_ICYVEINS, 0.333, SMARTBUFF_CONST_SELF}, + -- food and drink + {SMARTBUFF_CONJFOOD, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_CONJWATER, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_CONJREFRESHMENT, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_RITUALREFRESHMENT, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_CREATEMGEM, -1, SMARTBUFF_CONST_SELF}, }; end - - -- Warlock - if (SMARTBUFF_PLAYERCLASS == "WARLOCK") then - SMARTBUFF_BUFFLIST = { - {SMARTBUFF_FELARMOR, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainWarlockArmor}, - {SMARTBUFF_DEMONARMOR, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainWarlockArmor}, - {SMARTBUFF_DEMONSKIN, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainWarlockArmor}, - {SMARTBUFF_SOULLINK, 0, SMARTBUFF_CONST_SELF, nil, S.CheckPetNeeded}, - {SMARTBUFF_DINVISIBILITY, 10, SMARTBUFF_CONST_GROUP, {26}, "HPET;WPET;DKPET"}, - {SMARTBUFF_UNENDINGBREATH, 10, SMARTBUFF_CONST_GROUP, {16}, "HPET;WPET;DKPET"}, - {SMARTBUFF_LIFETAP, 0.025, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_SHADOWWARD, 0.5, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_DARKPACT, 0.5, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_SOULSTONE, 15, SMARTBUFF_CONST_GROUP, {18}, "WARRIOR;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;DEATHKNIGHT;MONK;DEMONHUNTER;HPET;WPET;DKPET"}, - - -- healthstones. - {SMARTBUFF_CREATEHSMIN, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_HEALTHSTONEGEM1}, - {SMARTBUFF_CREATEHSLES, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_HEALTHSTONEGEM2}, - {SMARTBUFF_CREATEHS, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_HEALTHSTONEGEM3}, - {SMARTBUFF_CREATEHSGRE, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_HEALTHSTONEGEM4}, - {SMARTBUFF_CREATEHSMAJ, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_HEALTHSTONEGEM5}, - {SMARTBUFF_CREATEHSMAS, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_HEALTHSTONEGEM6}, - {SMARTBUFF_CREATEHSDEM, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_HEALTHSTONEGEM7}, - {SMARTBUFF_CREATEHSFEL, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_HEALTHSTONEGEM8}, - -- soulstones. - {SMARTBUFF_CREATESSMIN, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_SOULSTONEGEM1}, - {SMARTBUFF_CREATESSLES, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_SOULSTONEGEM2}, - {SMARTBUFF_CREATESS, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_SOULSTONEGEM3}, - {SMARTBUFF_CREATESSGRE, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_SOULSTONEGEM4}, - {SMARTBUFF_CREATESSMAJ, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_SOULSTONEGEM5}, - {SMARTBUFF_CREATESSMAS, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_SOULSTONEGEM6}, - {SMARTBUFF_CREATESSDEM, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_SOULSTONEGEM7}, - -- spellstones. - {SMARTBUFF_CREATESPSTONE1, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKSPELLSTONE1}, - {SMARTBUFF_CREATESPSTONE2, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKSPELLSTONE2}, - {SMARTBUFF_CREATESPSTONE3, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKSPELLSTONE3}, - {SMARTBUFF_CREATESPSTONE4, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKSPELLSTONE4}, - {SMARTBUFF_CREATESPSTONE5, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKSPELLSTONE5}, - {SMARTBUFF_CREATESPSTONE6, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKSPELLSTONE6}, - {SMARTBUFF_LOCKSPELLSTONE6, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_LOCKSPELLSTONE5, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_LOCKSPELLSTONE4, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_LOCKSPELLSTONE3, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_LOCKSPELLSTONE2, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_LOCKSPELLSTONE1, 60, SMARTBUFF_CONST_INV}, - -- firestones. - {SMARTBUFF_CREATEFSTONE1, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKFIRESTONE1}, - {SMARTBUFF_CREATEFSTONE2, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKFIRESTONE2}, - {SMARTBUFF_CREATEFSTONE3, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKFIRESTONE3}, - {SMARTBUFF_CREATEFSTONE4, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKFIRESTONE4}, - {SMARTBUFF_CREATEFSTONE5, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKFIRESTONE5}, - {SMARTBUFF_CREATEFSTONE6, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKFIRESTONE6}, - {SMARTBUFF_CREATEFSTONE7, 0.03, SMARTBUFF_CONST_ITEM, nil, SMARTBUFF_LOCKFIRESTONE7}, - {SMARTBUFF_LOCKFIRESTONE7, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_LOCKFIRESTONE6, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_LOCKFIRESTONE5, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_LOCKFIRESTONE4, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_LOCKFIRESTONE3, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_LOCKFIRESTONE2, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_LOCKFIRESTONE1, 60, SMARTBUFF_CONST_INV}, - }; + -- Druid + if (SMARTBUFF_PLAYERCLASS == "DRUID") then -- updated 7/5/2023 Codermik + SMARTBUFF_BUFFLIST = { + -- buffs + {SMARTBUFF_MOTW, 30, SMARTBUFF_CONST_GROUP, {1,10,20,30,40,50,60,70,80}, "HPET;WPET;DKPET"}, + {SMARTBUFF_GOTW, 60, SMARTBUFF_CONST_GROUP, {50,60,70,80}, "HPET;WPET;DKPET"}, + {SMARTBUFF_THORNS, 10, SMARTBUFF_CONST_GROUP, nil, "MAGE;WARLOCK;ROGUE;PALADIN;WARRIOR;DRUID;HUNTER;SHAMAN;DEATHKNIGHT;MONK;DEMONHUNTER;EVOKER;HPET;WPET;DKPET"}, + {SMARTBUFF_BARKSKIN, 0.25, SMARTBUFF_CONST_FORCESELF}, + -- forms + {SMARTBUFF_DRUID_CAT, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_DRUID_TREE, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_DRUID_MOONKIN, -1, SMARTBUFF_CONST_SELF}, + {SSMARTBUFF_DRUID_BEAR, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_DRUID_DIREBEAR, -1, SMARTBUFF_CONST_SELF}, + -- tracking. + {SMARTBUFF_DRUID_TRACK, -1, SMARTBUFF_CONST_SELF, nil, SMARTBUFF_DRUID_CAT} + }; end - -- Hunter - if (SMARTBUFF_PLAYERCLASS == "HUNTER") then + -- Priest + if (SMARTBUFF_PLAYERCLASS == "PRIEST") then -- updated 8/5/2023 Codermik + SMARTBUFF_BUFFLIST = { + -- Buffs + {SMARTBUFF_PWFORTITUDE, 30, SMARTBUFF_CONST_GROUP, {1, 12, 24, 36, 48, 60, 70, 80}, "HPET;WPET;DKPET", S.LinkSta}, + {SMARTBUFF_PRAYERFORTITUDE, 60, SMARTBUFF_CONST_GROUP, {48, 60, 70, 80}, "HPET;WPET;DKPET", S.LinkSta}, + {SMARTBUFF_DIVINESPIRIT, 30, SMARTBUFF_CONST_GROUP, {30, 40, 50, 60, 70, 80}, "WARRIOR;DEATHKNIGHT;ROGUE;HPET;WPET;DKPET", S.LinkPriestSpirit}, + {SMARTBUFF_PRAYERSPIRIT, 60, SMARTBUFF_CONST_GROUP, {60, 70, 80}, "WARRIOR;DEATHKNIGHT;ROGUE;HPET;WPET;DKPET", S.LinkPriestSpirit}, + {SMARTBUFF_SHADOWPROT, 30, SMARTBUFF_CONST_GROUP, {30, 42, 56, 68, 76}, "HPET;WPET;DKPET", S.LinkPriestShadow}, + {SMARTBUFF_PRAYERSHADOWPROT, 60, SMARTBUFF_CONST_GROUP, {56, 70, 77}, "HPET;WPET;DKPET", S.LinkPriestShadow}, + {SMARTBUFF_FEARWARD, 3, SMARTBUFF_CONST_GROUP, {54}, "HPET;WPET;DKPET"}, + {SMARTBUFF_INNERFOCUS, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_INNERFIRE, -1, SMARTBUFF_CONST_FORCESELF}, + {SMARTBUFF_VAMPIRICEMB, 30, SMARTBUFF_CONST_SELF}, + -- form + {SMARTBUFF_SHADOWFORM, -1, SMARTBUFF_CONST_FORCESELF}, + -- shield + {SMARTBUFF_PWSHIELD, 0.5, SMARTBUFF_CONST_GROUP, {6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 65, 70, 75, 80}, "MAGE;WARLOCK;ROGUE;PALADIN;WARRIOR;DRUID;HUNTER;SHAMAN;DEATHKNIGHT;MONK;DEMONHUNTER;EVOKER;HPET;WPET;DKPET"}, + -- other + {SMARTBUFF_ELUNESGRACE, 0.25, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_FEEDBACK, 0.25, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_SHADOWGUARD, 10, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_TOUCHOFWEAKNESS, 10, SMARTBUFF_CONST_SELF}, + }; + end + + -- Warrior + if (SMARTBUFF_PLAYERCLASS == "WARRIOR") then -- updated 8/5/2023 Codermik SMARTBUFF_BUFFLIST = { - {SMARTBUFF_TRUESHOTAURA, -1, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_RAPIDFIRE, 0.2, SMARTBUFF_CONST_SELF}, - - {SMARTBUFF_AOTDH, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, - {SMARTBUFF_AOTH, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, - {SMARTBUFF_AOTM, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, - {SMARTBUFF_AOTV, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, - {SMARTBUFF_AOTW, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, - {SMARTBUFF_AOTB, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, - {SMARTBUFF_AOTC, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, - {SMARTBUFF_AOTP, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, - {SMARTBUFF_CALLPET, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_BATTLESHOUT, 2, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainWarriorShout}, + {SMARTBUFF_COMMANDINGSHOUT, 2, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainWarriorShout}, + {SMARTBUFF_BERSERKERRAGE, 0.165, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_SHIELDBLOCK, 0.1666, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_BLOODRAGE, 0.165, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_RAMPAGE, 0.5, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_VIGILANCE, 30, SMARTBUFF_CONST_GROUP, {40}, "WARRIOR;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;DEATHKNIGHT;HPET;WPET;DKPET"}, }; end -- Shaman - if (SMARTBUFF_PLAYERCLASS == "SHAMAN") then + if (SMARTBUFF_PLAYERCLASS == "SHAMAN") then -- updated 8/5/2023 Codermik SMARTBUFF_BUFFLIST = { + -- shields {SMARTBUFF_LIGHTNINGSHIELD, 10, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainShamanShield}, {SMARTBUFF_WATERSHIELD, 10, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainShamanShield}, - {SMARTBUFF_EARTHSHIELD, 10, SMARTBUFF_CONST_GROUP, {50,60}, "WARRIOR;DEATHKNIGHT;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;HPET;WPET;DKPET", nil, S.ChainShamanShield}, + {SMARTBUFF_EARTHSHIELD, 10, SMARTBUFF_CONST_GROUP, {50,60, 70, 75, 80}, "WARRIOR;DEATHKNIGHT;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;HPET;WPET;DKPET", nil, S.ChainShamanShield}, + -- weapons {SMARTBUFF_WINDFURYW, 30, SMARTBUFF_CONST_WEAPON}, {SMARTBUFF_FLAMETONGUEW, 30, SMARTBUFF_CONST_WEAPON}, {SMARTBUFF_FROSTBRANDW, 30, SMARTBUFF_CONST_WEAPON}, {SMARTBUFF_ROCKBITERW, 30, SMARTBUFF_CONST_WEAPON}, {SMARTBUFF_EARTHLIVINGW, 30, SMARTBUFF_CONST_WEAPON}, + -- buffs {SMARTBUFF_WATERBREATHING, 10, SMARTBUFF_CONST_GROUP, {22}}, {SMARTBUFF_WATERWALKING, 10, SMARTBUFF_CONST_GROUP, {28}} }; end - -- Warrior - if (SMARTBUFF_PLAYERCLASS == "WARRIOR") then + -- Hunter + if (SMARTBUFF_PLAYERCLASS == "HUNTER") then -- updated 10/5/2023 SMARTBUFF_BUFFLIST = { - {SMARTBUFF_BATTLESHOUT, 2, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainWarriorShout}, - {SMARTBUFF_COMMANDINGSHOUT, 2, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainWarriorShout}, - {SMARTBUFF_BERSERKERRAGE, 0.165, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_SHIELDBLOCK, 0.1666, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_BLOODRAGE, 0.165, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_RAMPAGE, 0.5, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_VIGILANCE, 30, SMARTBUFF_CONST_GROUP, {40}, "WARRIOR;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;DEATHKNIGHT;HPET;WPET;DKPET"} + {SMARTBUFF_TRUESHOTAURA, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_RAPIDFIRE, 0.2, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_AOTDH, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, + {SMARTBUFF_AOTH, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, + {SMARTBUFF_AOTM, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, + {SMARTBUFF_AOTV, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, + {SMARTBUFF_AOTW, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, + {SMARTBUFF_AOTB, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, + {SMARTBUFF_AOTC, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, + {SMARTBUFF_AOTP, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainAspects}, + {SMARTBUFF_CALLPET, -1, SMARTBUFF_CONST_SELF, nil, S.CheckPet}, + {SMARTBUFF_REVIVEPET, -1, SMARTBUFF_CONST_SELF}, }; end - -- Rogue - if (SMARTBUFF_PLAYERCLASS == "ROGUE") then + + -- Warlock + if (SMARTBUFF_PLAYERCLASS == "WARLOCK") then -- updated 20/5/2023 SMARTBUFF_BUFFLIST = { - {SMARTBUFF_STEALTH, -1, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_BLADEFLURRY, 0.165, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_SAD, 0.2, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_HUNGERFORBLOOD, 0.5, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_EVASION, 0.2, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_INSTANTPOISON9, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_INSTANTPOISON8, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_INSTANTPOISON7, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_INSTANTPOISON6, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_INSTANTPOISON5, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_INSTANTPOISON4, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_INSTANTPOISON3, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_INSTANTPOISON2, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_INSTANTPOISON1, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_WOUNDPOISON7, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_WOUNDPOISON6, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_WOUNDPOISON5, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_WOUNDPOISON4, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_WOUNDPOISON3, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_WOUNDPOISON2, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_WOUNDPOISON1, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_MINDPOISON1, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_DEADLYPOISON9, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_DEADLYPOISON8, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_DEADLYPOISON7, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_DEADLYPOISON6, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_DEADLYPOISON5, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_DEADLYPOISON4, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_DEADLYPOISON3, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_DEADLYPOISON2, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_DEADLYPOISON1, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_CRIPPLINGPOISON1, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_ANESTHETICPOISON2, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_ANESTHETICPOISON1, 60, SMARTBUFF_CONST_INV} + -- buffs + {SMARTBUFF_DEMONSKIN, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_DEMONARMOR, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_FELARMOR, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_LOCKSENSEDEMONS, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_UNENDINGBREATH, 10, SMARTBUFF_CONST_GROUP, {16}, "HPET;WPET;DKPET"}, + {SMARTBUFF_LOCKINVISIBILITY, 10, SMARTBUFF_CONST_GROUP, {16}, "HPET;WPET;DKPET"}, + -- pets + {SMARTBUFF_SUMMONINFERNAL, -1, SMARTBUFF_CONST_SELF, nil, S.CheckPet}, + {SMARTBUFF_SUMMONFELHUNTER, -1, SMARTBUFF_CONST_SELF, nil, S.CheckPet}, + {SMARTBUFF_SUMMONIMP, -1, SMARTBUFF_CONST_SELF, nil, S.CheckPet}, + {SMARTBUFF_SUMMONSUCCUBUS, -1, SMARTBUFF_CONST_SELF, nil, S.CheckPet}, + {SMARTBUFF_SUMMONINCUBUS, -1, SMARTBUFF_CONST_SELF, nil, S.CheckPet}, + {SMARTBUFF_SUMMONVOIDWALKER, -1, SMARTBUFF_CONST_SELF, nil, S.CheckPet}, + -- create stones + {SMARTBUFF_CREATEHS, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_CREATESOULS, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_CREATESPELLS, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_CREATEFIRES, -1, SMARTBUFF_CONST_SELF}, + -- use healthstones + {SMARTBUFF_HSMINOR, -1, SMARTBUFF_CONST_ITEM}, + {SMARTBUFF_HSLESSER, -1, SMARTBUFF_CONST_ITEM}, + {SMARTBUFF_HSTONE, -1, SMARTBUFF_CONST_ITEM}, + {SMARTBUFF_HSGREATER, -1, SMARTBUFF_CONST_ITEM}, + {SMARTBUFF_HSMAJOR, -1, SMARTBUFF_CONST_ITEM}, + {SMARTBUFF_HSMASTER, -1, SMARTBUFF_CONST_ITEM}, + {SMARTBUFF_HSDEMONIC, -1, SMARTBUFF_CONST_ITEM}, + {SMARTBUFF_HSFEL, -1, SMARTBUFF_CONST_INV}, }; end - -- Paladin - if (SMARTBUFF_PLAYERCLASS == "PALADIN") then - SMARTBUFF_BUFFLIST = { - - {SMARTBUFF_RIGHTEOUSFURY, 30, SMARTBUFF_CONST_SELF}, - {SMARTBUFF_HOLYSHIELD, 0.165, SMARTBUFF_CONST_SELF}, - - {SMARTBUFF_BOW, 5, SMARTBUFF_CONST_GROUP, {14,24,34,44,54,60,65,71,77}, "ROGUE;WARRIOR;HPET;WPET;DKPET", S.ChainPaladinBOW}, - {SMARTBUFF_GBOW, 15, SMARTBUFF_CONST_GROUP, {54,60,65,71,77}, "ROGUE;WARRIOR;HPET;WPET;DKPET", S.ChainPaladinBOW, {SMARTBUFF_SYMBOLOFKINGS}}, - {SMARTBUFF_BOM, 5, SMARTBUFF_CONST_GROUP, {4,12,22,32,42,52,60,70,73,79}, "MAGE;PRIEST;WARLOCK;HPET;WPET;DKPET", S.ChainPaladinBOM}, - {SMARTBUFF_GBOM, 15, SMARTBUFF_CONST_GROUP, {52,60,70,73,79}, "MAGE;PRIEST;WARLOCK;HPET;WPET;DKPET", S.ChainPaladinBOM, {SMARTBUFF_SYMBOLOFKINGS}}, - {SMARTBUFF_BOK, 5, SMARTBUFF_CONST_GROUP, {20}, "HPET;WPET;DKPET", S.ChainPaladinBOK}, - {SMARTBUFF_GBOK, 15, SMARTBUFF_CONST_GROUP, {60}, "HPET;WPET;DKPET", S.ChainPaladinBOK, {SMARTBUFF_SYMBOLOFKINGS}}, - {SMARTBUFF_BOSAL, 5, SMARTBUFF_CONST_GROUP, {26}, "TANK;HPET;WPET;DKPET", S.ChainPaladinSAL}, - {SMARTBUFF_GBOSAL, 15, SMARTBUFF_CONST_GROUP, {60}, "TANK;HPET;WPET;DKPET", S.ChainPaladinSAL, {SMARTBUFF_SYMBOLOFKINGS}}, - {SMARTBUFF_BOSAN, 5, SMARTBUFF_CONST_GROUP, {26,40,50,60}, "HPET;WPET;DKPET", S.ChainPaladinSAN}, - {SMARTBUFF_GBOSAN, 15, SMARTBUFF_CONST_GROUP, {60}, "HPET;WPET;DKPET", S.ChainPaladinSAN, {SMARTBUFF_SYMBOLOFKINGS}}, - - {SMARTBUFF_SOCOMMAND, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, - {SMARTBUFF_SOFURY, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, - {SMARTBUFF_SOJUSTICE, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, - {SMARTBUFF_SOLIGHT, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, - {SMARTBUFF_SORIGHTEOUSNESS, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, - {SMARTBUFF_SOWISDOM, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, - {SMARTBUFF_SOTCRUSADER, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, - {SMARTBUFF_SOVENGEANCE, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, - {SMARTBUFF_SOBLOOD, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, - {SMARTBUFF_SOCORRUPTION, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, - {SMARTBUFF_SOMARTYR, 30, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinSeal}, - - {SMARTBUFF_DEVOTIONAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, - {SMARTBUFF_RETRIBUTIONAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, - {SMARTBUFF_CONCENTRATIONAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, - {SMARTBUFF_SHADOWRESISTANCEAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, - {SMARTBUFF_FROSTRESISTANCEAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, - {SMARTBUFF_FIRERESISTANCEAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, - {SMARTBUFF_SANCTITYAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura}, - {SMARTBUFF_CRUSADERAURA, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainPaladinAura} - - }; - end -- Deathknight - if (SMARTBUFF_PLAYERCLASS == "DEATHKNIGHT") then + if (SMARTBUFF_PLAYERCLASS == "DEATHKNIGHT") then -- updated 20/5/2023 SMARTBUFF_BUFFLIST = { {SMARTBUFF_DANCINGRW, 0.2, SMARTBUFF_CONST_SELF}, {SMARTBUFF_BLOODPRESENCE, -1, SMARTBUFF_CONST_SELF, nil, nil, nil, S.ChainDKPresence}, @@ -940,25 +990,93 @@ function SMARTBUFF_InitSpellList() }; end - + + -- Rogue + if (SMARTBUFF_PLAYERCLASS == "ROGUE") then -- updated 20/5/2023 + SMARTBUFF_BUFFLIST = { + {SMARTBUFF_STEALTH, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_BLADEFLURRY, -1, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_SAD, 0.2, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_TRICKS, 0.5, SMARTBUFF_CONST_GROUP, {75}, "WARRIOR;DEATHKNIGHT;DRUID;SHAMAN;HUNTER;ROGUE;MAGE;PRIEST;PALADIN;WARLOCK;MONK;DEMONHUNTER;EVOKER;HPET;WPET;DKPET"}, + {SMARTBUFF_HUNGERFORBLOOD, 0.5, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_RECUPERATE, 0.5, SMARTBUFF_CONST_SELF}, + {SMARTBUFF_EVASION, 0.2, SMARTBUFF_CONST_SELF}, + }; + end + -- Stones and oils SMARTBUFF_WEAPON = { - {SMARTBUFF_LESSERMANAOIL, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_BRILLIANTMANAOIL, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_BRILLIANTWIZARDOIL, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_SUPERIORMANAOIL, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_SUPERIORWIZARDOIL, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_EXCEPTIONALWIZARDOIL, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_OILOFIMMOLATION, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_SOLIDWSTONE, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_SOLIDSSTONE, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_ELEMENTALSSTONE, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_ADAMANTITEWSTONE, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_ADAMANTITESSTONE, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_HEAVYWSTONE, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_HEAVYSSTONE, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_WEIGHSTONE, 60, SMARTBUFF_CONST_INV}, - {SMARTBUFF_FELSHARPENINGSTONE, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SSROUGH, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SSCOARSE, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SSHEAVY, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SSSOLID, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SSDENSE, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SSELEMENTAL, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SSFEL, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SSADAMANTITE, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WSROUGH, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WSCOARSE, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WSHEAVY, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WSSOLID, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WSDENSE, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WSFEL, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WSADAMANTITE, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SHADOWOIL, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_FROSTOIL, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_MANAOIL4, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_MANAOIL3, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_MANAOIL2, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_MANAOIL1, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WIZARDOIL5, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WIZARDOIL4, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WIZARDOIL3, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WIZARDOIL2, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WIZARDOIL1, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_FIRESLESSER, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_FIRESSTONE, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_FIRESGREATER, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_FIRESMAJOR, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_FIRESMASTER, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_FIRESFEL, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_FIRESGRAND, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SPELLSTONE, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SPELLSGREATER, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SPELLSMAJOR, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SPELLSMASTER, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SPELLSDEMONIC, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_SPELLSGRAND, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_INSTANTPOISON1, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_INSTANTPOISON2, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_INSTANTPOISON3, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_INSTANTPOISON4, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_INSTANTPOISON5, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_INSTANTPOISON6, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_INSTANTPOISON7, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_INSTANTPOISON8, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_INSTANTPOISON9, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WOUNDPOISON1, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WOUNDPOISON2, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WOUNDPOISON3, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WOUNDPOISON4, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WOUNDPOISON5, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WOUNDPOISON6, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_WOUNDPOISON7, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_MINDPOISON1, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_MINDPOISON2, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_MINDPOISON3, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_DEADLYPOISON1, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_DEADLYPOISON2, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_DEADLYPOISON3, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_DEADLYPOISON4, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_DEADLYPOISON5, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_DEADLYPOISON6, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_DEADLYPOISON7, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_DEADLYPOISON8, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_DEADLYPOISON9, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_CRIPPLINGPOISON1, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_CRIPPLINGPOISON2, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_ANESTHETICPOISON1, 60, SMARTBUFF_CONST_INV}, + {SMARTBUFF_ANESTHETICPOISON2, 60, SMARTBUFF_CONST_INV}, }; -- Tracking @@ -973,9 +1091,7 @@ function SMARTBUFF_InitSpellList() {SMARTBUFF_TRACKELEMENTALS, -1, SMARTBUFF_CONST_TRACK}, {SMARTBUFF_TRACKDEMONS, -1, SMARTBUFF_CONST_TRACK}, {SMARTBUFF_TRACKGIANTS, -1, SMARTBUFF_CONST_TRACK}, - {SMARTBUFF_TRACKDRAGONKIN, -1, SMARTBUFF_CONST_TRACK}, - {SMARTBUFF_SENSEDEMONS, -1, SMARTBUFF_CONST_TRACK}, - {SMARTBUFF_SENSEUNDEAD, -1, SMARTBUFF_CONST_TRACK} + {SMARTBUFF_TRACKDRAGONKIN, -1, SMARTBUFF_CONST_TRACK} }; -- Racial @@ -989,155 +1105,351 @@ function SMARTBUFF_InitSpellList() }; -- FOOD - SMARTBUFF_FOOD = { - {SMARTBUFF_GOLDENFISHSTICKS_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_FISHERMANSFEAST_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_SKULLFISHSOUP_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_SPICYHOTTALBUK_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_BLACKENEDBASILISK_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_BLACKENEDSPOREFISH_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_BUZZARDBITES_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_CLAMBAR_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_CRUNCHYSERPENT_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_FELTAILDELIGHT_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_GRILLEDMUDFISH_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_HELBOARBACON_ITEM, 15, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_MOKNATHAKSHORTRIBS_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_POACHEDBLUEFISH_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_RAVAGERDOG_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_ROASTEDCLEFTHOOF_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_SPICYCRAWDAD_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_TALBUKSTEAK_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_WARPBURGER_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_CHARREDBEARKABOBS_ITEM, 15, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_ORONOKSTUBERSPELL_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_ORONOKSTUBERAGILITY_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_ORONOKSTUBERHEALS_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_ORONOKSTUBERSTRENGTH_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_HOTAPPLECIDER_ITEM, 30, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_SKYGUARDRATIONS_ITEM, 15, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_DIRGESKICKINCHOPS_ITEM, 15, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_JUICYBEARBURGER_ITEM, 15, SMARTBUFF_CONST_FOOD}, - {SMARTBUFF_NIGHTFINSOUP_ITEM, 10, SMARTBUFF_CONST_FOOD}, + SMARTBUFF_FOOD = { + {SMARTBUFF_JUICYBEARBURGER, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_CRUNCHYSPIDER, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_LYNXSTEAK, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_CHARREDBEARKABOBS, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_BATBITES, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_ROASTEDMOONGRAZE, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_MOKNATHALSHORTRIBS, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_CRUNCHYSERPENT, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_ROASTEDCLEFTHOOF, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_FISHERMANSFEAST, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_WARPBURGER, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_RAVAGERDOG, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SKULLFISHSOUP, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_BUZZARDBITES, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_TALBUKSTEAK, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_GOLDENFISHSTICKS, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SPICYHOTTALBUK, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_FELTAILDELIGHT, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_BLACKENEDSPOREFISH, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_HOTAPPLECIDER, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_BROILEDBLOODFIN, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SPICYCRAWDAD, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_POACHEDBLUEFISH, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_BLACKENEDBASILISK, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_GRILLEDMUDFISH, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_CLAMBAR, 30, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SAGEFISHDELIGHT, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_HERBBAKEDEGG, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SPICEDWOLFMEAT, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_BEERBASTEDBIARRIBS, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_CRISPYBATWING, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_KALDOREISPIDERKABOB, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_ROASTEDKODOMEAT, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_BOILEDCLAMS, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_COYOTESTEAK, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_CRABCAKE, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_DRYPORKRIBS, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_BLOODSAUSAGE, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_CROCOLISKSTEAK, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_FILLETOFFRENZY, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_GORETUSKLIVERPIE, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_STRIDERSTEW, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_GOBLINDEVILEDCLAMS, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_BIGBEARSTEAK, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_CRISPYLIZARDTAIL, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_CROCOLISKGUMBO, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_CURIOUSLYTASTYOMELET, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_GOOEYSPIDERCAKE, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_HOTLIONCHOPS, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_LEANVENISON, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_LEANWOLFSTEAK, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_MURLOCFINSOUP, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_REDRIDGEGOULASH, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SEASONEDWOLFKABOB, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_CARRIONSURPRISE, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_GIANTCLAMSCORCHO, 15, SMARTBUF_CONST_FOOD}, + {SMARTBUFF_HEAVYCROCOLISKSTEW, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_HOTWOLFRIBS, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_JUNGLESTEW, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_MYSTERYSTEW, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SOOTHINGTURTLEBISQUE, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_TASTYLIONSTEAK, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SPIDERSAUSAGE, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_HEAVYKODOSTEW, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_MONSTEROMELET, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SPICEDCHILICRAB, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_TENDERWOLFSTEAK, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SMOKEDSAGEFISH, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SAGEFISHDELIGHT, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_NIGHTFINSOUP, 15, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_GRILLEDSQUID, 10, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_RUNNTUMTUBERSURPRISE, 10, SMARTBUFF_CONST_FOOD}, + {SMARTBUFF_SMOKEDDESERTDUMPLINGS, 15, SMARTBUFF_CONST_FOOD}, }; - - -- additional wotlk food. + for n, name in pairs(S.FoodItems) do if (name) then + --print("Adding: "..n..". "..name); tinsert(SMARTBUFF_FOOD, 1, {name, 60, SMARTBUFF_CONST_FOOD}); end end + -- Scrolls SMARTBUFF_SCROLL = { + {SMARTBUFF_MiscItem17, 60, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem17, S.LinkFlaskLeg}, + {SMARTBUFF_MiscItem16, 60, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem16}, + {SMARTBUFF_MiscItem15, 60, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem14, S.LinkAugment}, + {SMARTBUFF_MiscItem14, 60, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem14, S.LinkAugment}, + {SMARTBUFF_MiscItem13, 10, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem13}, + {SMARTBUFF_MiscItem12, 60, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem12}, + {SMARTBUFF_MiscItem11, 60, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem11, S.LinkFlaskWoD}, + {SMARTBUFF_MiscItem10, -1, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem10, S.LinkSafariHat}, + {SMARTBUFF_MiscItem9, -1, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem9, S.LinkSafariHat}, + {SMARTBUFF_MiscItem1, -1, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem1}, + {SMARTBUFF_MiscItem2, -1, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem2}, + {SMARTBUFF_MiscItem3, 10, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem3}, + {SMARTBUFF_MiscItem4, 60, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem4, S.LinkFlaskMoP}, + {SMARTBUFF_MiscItem5, 10, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem5}, + {SMARTBUFF_MiscItem6, 60, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem6}, + {SMARTBUFF_MiscItem7, 60, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem7}, + {SMARTBUFF_MiscItem8, 5, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BMiscItem8}, + {SMARTBUFF_AugmentRune, 60, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BAugmentRune, S.LinkAugment}, + {SMARTBUFF_VieledAugment, 60, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_BVieledAugment, S.LinkAugment}, + + {SMARTBUFF_SOAGILITY9, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBAGILITY}, {SMARTBUFF_SOAGILITY8, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBAGILITY}, {SMARTBUFF_SOAGILITY7, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBAGILITY}, - {SMARTBUFF_SOAGILITY6, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBAGILITY}, + {SMARTBUFF_SOAGILITY6, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBAGILITY}, {SMARTBUFF_SOAGILITY5, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBAGILITY}, {SMARTBUFF_SOAGILITY4, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBAGILITY}, {SMARTBUFF_SOAGILITY3, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBAGILITY}, {SMARTBUFF_SOAGILITY2, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBAGILITY}, {SMARTBUFF_SOAGILITY1, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBAGILITY}, - + {SMARTBUFF_SOINTELLECT9, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBINTELLECT}, {SMARTBUFF_SOINTELLECT8, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBINTELLECT}, - {SMARTBUFF_SOINTELLECT7, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBINTELLECT}, - {SMARTBUFF_SOINTELLECT6, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBINTELLECT}, + {SMARTBUFF_SOINTELLECT7, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBINTELLECT}, + {SMARTBUFF_SOINTELLECT6, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBINTELLECT}, {SMARTBUFF_SOINTELLECT5, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBINTELLECT}, {SMARTBUFF_SOINTELLECT4, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBINTELLECT}, {SMARTBUFF_SOINTELLECT3, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBINTELLECT}, {SMARTBUFF_SOINTELLECT2, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBINTELLECT}, {SMARTBUFF_SOINTELLECT1, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBINTELLECT}, - + {SMARTBUFF_SOSTAMINA9, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTAMINA}, {SMARTBUFF_SOSTAMINA8, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTAMINA}, - {SMARTBUFF_SOSTAMINA7, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTAMINA}, - {SMARTBUFF_SOSTAMINA6, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTAMINA}, + {SMARTBUFF_SOSTAMINA7, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTAMINA}, + {SMARTBUFF_SOSTAMINA6, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTAMINA}, {SMARTBUFF_SOSTAMINA5, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTAMINA}, {SMARTBUFF_SOSTAMINA4, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTAMINA}, {SMARTBUFF_SOSTAMINA3, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTAMINA}, {SMARTBUFF_SOSTAMINA2, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTAMINA}, {SMARTBUFF_SOSTAMINA1, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTAMINA}, - + {SMARTBUFF_SOSPIRIT9, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSPIRIT}, {SMARTBUFF_SOSPIRIT8, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSPIRIT}, - {SMARTBUFF_SOSPIRIT7, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSPIRIT}, - {SMARTBUFF_SOSPIRIT6, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSPIRIT}, + {SMARTBUFF_SOSPIRIT7, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSPIRIT}, + {SMARTBUFF_SOSPIRIT6, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSPIRIT}, {SMARTBUFF_SOSPIRIT5, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSPIRIT}, {SMARTBUFF_SOSPIRIT4, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSPIRIT}, {SMARTBUFF_SOSPIRIT3, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSPIRIT}, {SMARTBUFF_SOSPIRIT2, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSPIRIT}, {SMARTBUFF_SOSPIRIT1, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSPIRIT}, - + {SMARTBUFF_SOSTRENGHT9, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTRENGHT}, {SMARTBUFF_SOSTRENGHT8, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTRENGHT}, {SMARTBUFF_SOSTRENGHT7, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTRENGHT}, - {SMARTBUFF_SOSTRENGHT6, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTRENGHT}, + {SMARTBUFF_SOSTRENGHT6, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTRENGHT}, {SMARTBUFF_SOSTRENGHT5, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTRENGHT}, {SMARTBUFF_SOSTRENGHT4, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTRENGHT}, {SMARTBUFF_SOSTRENGHT3, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTRENGHT}, {SMARTBUFF_SOSTRENGHT2, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTRENGHT}, {SMARTBUFF_SOSTRENGHT1, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBSTRENGHT}, - - {SMARTBUFF_SOPROTECTION8, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBPROTECTION}, - {SMARTBUFF_SOPROTECTION7, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBPROTECTION}, - {SMARTBUFF_SOPROTECTION6, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBPROTECTION}, - {SMARTBUFF_SOPROTECTION5, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBPROTECTION}, - {SMARTBUFF_SOPROTECTION4, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBPROTECTION}, - {SMARTBUFF_SOPROTECTION3, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBPROTECTION}, - {SMARTBUFF_SOPROTECTION2, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBPROTECTION}, - {SMARTBUFF_SOPROTECTION1, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBPROTECTION}, - + {SMARTBUFF_SOPROTECTION9, 30, SMARTBUFF_CONST_SCROLL, nil, SMARTBUFF_SBPROTECTION}, }; - - --- Classic Potions / Elixirs / Flasks - + -- ItemId, SpellId, Duration [min] + AddItem(174906, 270058, 60); -- Lightning-Forged Augment Rune + AddItem(153023, 224001, 60); -- Lightforged Augment Rune + AddItem(160053, 270058, 60); --Battle-Scarred Augment Rune + AddItem(164375, 281303, 10); --Bad Mojo Banana + AddItem(129165, 193345, 10); --Barnacle-Encrusted Gem + AddItem(116115, 170869, 60); -- Blazing Wings + AddItem(133997, 203533, 0); --Black Ice + AddItem(122298, 181642, 60); --Bodyguard Miniaturization Device + AddItem(163713, 279934, 30); --Brazier Cap + AddItem(128310, 189363, 10); --Burning Blade + AddItem(116440, 171554, 20); --Burning Defender's Medallion + AddItem(128807, 192225, 60); -- Coin of Many Faces + AddItem(138878, 217668, 5); --Copy of Daglop's Contract + AddItem(143662, 232613, 60); --Crate of Bobbers: Pepe + AddItem(142529, 231319, 60); --Crate of Bobbers: Cat Head + AddItem(142530, 231338, 60); --Crate of Bobbers: Tugboat + AddItem(142528, 231291, 60); --Crate of Bobbers: Can of Worms + AddItem(142532, 231349, 60); --Crate of Bobbers: Murloc Head + AddItem(147308, 240800, 60); --Crate of Bobbers: Enchanted Bobber + AddItem(142531, 231341, 60); --Crate of Bobbers: Squeaky Duck + AddItem(147312, 240801, 60); --Crate of Bobbers: Demon Noggin + AddItem(147307, 240803, 60); --Crate of Bobbers: Carved Wooden Helm + AddItem(147309, 240806, 60); --Crate of Bobbers: Face of the Forest + AddItem(147310, 240802, 60); --Crate of Bobbers: Floating Totem + AddItem(147311, 240804, 60); --Crate of Bobbers: Replica Gondola + AddItem(122117, 179872, 15); --Cursed Feather of Ikzan + AddItem( 54653, 75532, 30); -- Darkspear Pride + AddItem(108743, 160688, 10); --Deceptia's Smoldering Boots + AddItem(129149, 193333, 30); --Death's Door Charm + AddItem(159753, 279366, 5); --Desert Flute + AddItem(164373, 281298, 10); --Enchanted Soup Stone + AddItem(140780, 224992, 5); --Fal'dorei Egg + AddItem(122304, 138927, 10); -- Fandral's Seed Pouch + AddItem(102463, 148429, 10); -- Fire-Watcher's Oath + AddItem(128471, 190655, 30); --Frostwolf Grunt's Battlegear + AddItem(128462, 190653, 30); --Karabor Councilor's Attire + AddItem(161342, 275089, 30); --Gem of Acquiescence + AddItem(127659, 188228, 60); --Ghostly Iron Buccaneer's Hat + AddItem( 54651, 75531, 30); -- Gnomeregan Pride + AddItem(118716, 175832, 5); --Goren Garb + AddItem(138900, 217708, 10); --Gravil Goldbraid's Famous Sausage Hat + AddItem(159749, 277572, 5); --Haw'li's Hot & Spicy Chili + AddItem(163742, 279997, 60); --Heartsbane Grimoire + AddItem(129149, 193333, 60); -- Helheim Spirit Memory + AddItem(140325, 223446, 10); --Home Made Party Mask + AddItem(136855, 210642,0.25); --Hunter's Call + AddItem( 43499, 58501, 10); -- Iron Boot Flask + AddItem(118244, 173956, 60); --Iron Buccaneer's Hat + AddItem(170380, 304369, 120); --Jar of Sunwarmed Sand + AddItem(127668, 187174, 5); --Jewel of Hellfire + AddItem( 26571, 127261, 10); --Kang's Bindstone + AddItem( 68806, 96312, 30); -- Kalytha's Haunted Locket + AddItem(163750, 280121, 10); --Kovork Kostume + AddItem(164347, 281302, 10); --Magic Monkey Banana + AddItem(118938, 176180, 10); --Manastorm's Duplicator + AddItem(163775, 280133, 10); --Molok Morion + AddItem(101571, 144787, 0); --Moonfang Shroud + AddItem(105898, 145255, 10); --Moonfang's Paw + AddItem( 52201, 73320, 10); --Muradin's Favor + AddItem(138873, 217597, 5); --Mystical Frosh Hat + AddItem(163795, 280308, 10); --Oomgut Ritual Drum + AddItem( 1973, 16739, 5); --Orb of Deception + AddItem( 35275, 160331, 30); --Orb of the Sin'dorei + AddItem(158149, 264091, 30); --Overtuned Corgi Goggles + AddItem(130158, 195949, 5); --Path of Elothir + AddItem(127864, 188172, 60); --Personal Spotlight + AddItem(127394, 186842, 5); --Podling Camouflage + AddItem(108739, 162402, 5); --Pretty Draenor Pearl + AddItem(129093, 129999, 10); --Ravenbear Disguise + AddItem(153179, 254485, 5); --Blue Conservatory Scroll + AddItem(153180, 254486, 5); --Yellow Conservatory Scroll + AddItem(153181, 254487, 5); --Red Conservatory Scroll + AddItem(104294, 148529, 15); --Rime of the Time-Lost Mariner + AddItem(119215, 176898, 10); --Robo-Gnomebobulator + AddItem(119134, 176569, 30); --Sargerei Disguise + AddItem(129055, 62089, 60); --Shoe Shine Kit + AddItem(163436, 279977, 30); --Spectral Visage + AddItem(156871, 261981, 60); --Spitzy + AddItem( 66888, 6405, 3); --Stave of Fur and Claw + AddItem(111476, 169291, 5); --Stolen Breath + AddItem(140160, 222630, 10); --Stormforged Vrykul Horn + AddItem(163738, 279983, 30); --Syndicate Mask + AddItem(130147, 195509, 5); --Thistleleaf Branch + AddItem(113375, 166592, 5); --Vindicator's Armor Polish Kit + AddItem(163565, 279407, 5); --Vulpera Scrapper's Armor + AddItem(163924, 280632, 30); --Whiskerwax Candle + AddItem( 97919, 141917, 3); --Whole-Body Shrinka' + AddItem(167698, 293671, 60); --Secret Fish Goggles + AddItem(169109, 299445, 60); --Beeholder's Goggles + AddItem(191341, 371172, 30); -- Tepid Q3 + + -- Potions SMARTBUFF_POTION = { - - {SMARTBUFF_ADEPTELIXIR_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_ADEPTELIXIR_BUFF}, - {SMARTBUFF_MAJORDEFENSE_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MAJORDEFENSE_BUFF}, - {SMARTBUFF_MAJORAGILITY_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MAJORAGILITY_BUFF}, - {SMARTBUFF_DRAENICWISDOM_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_DRAENICWISDOM_BUFF}, - {SMARTBUFF_MAJORFROSTPOWER_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MAJORFROSTPOWER_BUFF}, - {SMARTBUFF_EARTHEN_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_EARTHEN_BUFF}, - {SMARTBUFF_MASTERY_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MASTERY_BUFF}, - {SMARTBUFF_CAMOUFLAGE_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_CAMOUFLAGE_BUFF}, - {SMARTBUFF_HEALINGPOWER_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_HEALINGPOWER_BUFF}, - {SMARTBUFF_MAJORFORTITUDE_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MAJORFORTITUDE_BUFF}, - {SMARTBUFF_MAJORSTRENGTH_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MAJORSTRENGTH_BUFF}, - {SMARTBUFF_ONSLAUGHTELIXIR_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_ONSLAUGHTELIXIR_BUFF}, - {SMARTBUFF_GREATERARCANE_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_GREATERARCANE_BUFF}, - {SMARTBUFF_MONGOOSEELIXIR_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MONGOOSEELIXIR_BUFF}, - {SMARTBUFF_BRUTEFORCE_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BRUTEFORCE_BUFF}, - {SMARTBUFF_SAGESELIXIR_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_SAGESELIXIR_BUFF}, - {SMARTBUFF_SUPERIORDEFENSE_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_SUPERIORDEFENSE_BUFF}, - {SMARTBUFF_DEMONSLAYING_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_DEMONSLAYING_BUFF}, - {SMARTBUFF_MAJORFIREPOWER_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MAJORFIREPOWER_BUFF}, - {SMARTBUFF_GREATERFIREPOWER_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_GREATERFIREPOWER_BUFF}, - {SMARTBUFF_SHADOWPOWER_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_SHADOWPOWER_BUFF}, - {SMARTBUFF_GIANTSELIXIR_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_GIANTSELIXIR_BUFF}, - {SMARTBUFF_GREATERAGILITY_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_GREATERAGILITY_BUFF}, - {SMARTBUFF_GIFTOFARTHAS_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_GIFTOFARTHAS_BUFF}, - {SMARTBUFF_ARANCEELIXIR_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_ARANCEELIXIR_BUFF}, - {SMARTBUFF_GREATERINTELLECT_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_GREATERINTELLECT_BUFF}, - {SMARTBUFF_MAJORNATUREPROT_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MAJORNATUREPROT_BUFF}, - {SMARTBUFF_MAJORMAGEBLOOD_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MAJORMAGEBLOOD_BUFF}, - {SMARTBUFF_MAJORSHADOWPWR_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MAJORSHADOWPWR_BUFF}, - {SMARTBUFF_MAJORIRONSKIN_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_MAJORIRONSKIN_BUFF}, - - {SMARTBUFF_BLINDINGLIGHTFLASK_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BLINDINGLIGHTFLASK_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_FORTIFICATIONFLASK_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_FORTIFICATIONFLASK_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_RESTORATIONFLASK_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_RESTORATIONFLASK_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_PUREDEATHFLASK_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_PUREDEATHFLASK_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_RELENTLESSFLASK_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_RELENTLESSFLASK_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_CHROMATICFLASK_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_CHROMATICFLASK_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_DISTILLEDFLASK_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_DISTILLEDFLASK_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_HEALINGPOWER_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_HEALINGPOWER_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_SUPREMEPWRFLASK_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_SUPREMEPWRFLASK_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_FLASKOFFROSTWYRM_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_FLASKOFFROSTWYRM_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_FLASKOFENDLESSRAGE_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_FLASKOFENDLESSRAGE_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_FLASKOFTHENORTH_ITEM, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_FLASKOFTHENORTH_BUFF, S.LinkFlaskClassic}, - {SMARTBUFF_FLASKOFSTONEBLOOD_ITEM, (60*SMARTBUFF_ALCHEMY_ADJ), SMARTBUFF_CONST_POTION, nil, SMARTBUFF_FLASKOFSTONEBLOOD_BUFF, S.LinkFlaskClassic}, + {SMARTBUFF_ELIXIRTBC1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC1}, + {SMARTBUFF_ELIXIRTBC2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC2}, + {SMARTBUFF_ELIXIRTBC3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC3}, + {SMARTBUFF_ELIXIRTBC4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC4}, + {SMARTBUFF_ELIXIRTBC5, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC5}, + {SMARTBUFF_ELIXIRTBC6, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC6}, + {SMARTBUFF_ELIXIRTBC7, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC7}, + {SMARTBUFF_ELIXIRTBC8, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC8}, + {SMARTBUFF_ELIXIRTBC9, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC9}, + {SMARTBUFF_ELIXIRTBC10, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC10}, + {SMARTBUFF_ELIXIRTBC11, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC11}, + {SMARTBUFF_ELIXIRTBC12, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC12}, + {SMARTBUFF_ELIXIRTBC13, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC13}, + {SMARTBUFF_ELIXIRTBC14, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC14}, + {SMARTBUFF_ELIXIRTBC15, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC15}, + {SMARTBUFF_ELIXIRTBC16, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC16}, + {SMARTBUFF_ELIXIRTBC17, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRTBC17}, + {SMARTBUFF_FLASKTBC1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKTBC1}, --, S.LinkFlaskTBC}, + {SMARTBUFF_FLASKTBC2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKTBC2}, + {SMARTBUFF_FLASKTBC3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKTBC3}, + {SMARTBUFF_FLASKTBC4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKTBC4}, + {SMARTBUFF_FLASKTBC5, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKTBC5}, + {SMARTBUFF_FLASKLEG1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKLEG1, S.LinkFlaskLeg}, + {SMARTBUFF_FLASKLEG2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKLEG2}, + {SMARTBUFF_FLASKLEG3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKLEG3}, + {SMARTBUFF_FLASKLEG4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKLEG4}, + {SMARTBUFF_FLASKWOD1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKWOD1, S.LinkFlaskWoD}, + {SMARTBUFF_FLASKWOD2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKWOD2}, + {SMARTBUFF_FLASKWOD3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKWOD3}, + {SMARTBUFF_FLASKWOD4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKWOD4}, + {SMARTBUFF_GRFLASKWOD1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BGRFLASKWOD1}, + {SMARTBUFF_GRFLASKWOD2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BGRFLASKWOD2}, + {SMARTBUFF_GRFLASKWOD3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BGRFLASKWOD3}, + {SMARTBUFF_GRFLASKWOD4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BGRFLASKWOD4}, + {SMARTBUFF_FLASKMOP1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKMOP1, S.LinkFlaskMoP}, + {SMARTBUFF_FLASKMOP2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKMOP2}, + {SMARTBUFF_FLASKMOP3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKMOP3}, + {SMARTBUFF_FLASKMOP4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKMOP4}, + {SMARTBUFF_FLASKMOP5, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKMOP5}, + {SMARTBUFF_FLASKMOP6, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKMOP6}, + {SMARTBUFF_ELIXIRMOP1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRMOP1}, + {SMARTBUFF_ELIXIRMOP2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRMOP2}, + {SMARTBUFF_ELIXIRMOP3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRMOP3}, + {SMARTBUFF_ELIXIRMOP4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRMOP4}, + {SMARTBUFF_ELIXIRMOP5, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRMOP5}, + {SMARTBUFF_ELIXIRMOP6, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRMOP6}, + {SMARTBUFF_ELIXIRMOP7, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRMOP7}, + {SMARTBUFF_ELIXIRMOP8, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRMOP8}, + {SMARTBUFF_EXP_POTION, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BEXP_POTION}, + {SMARTBUFF_FLASKCT1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKCT1}, + {SMARTBUFF_FLASKCT2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKCT2}, + {SMARTBUFF_FLASKCT3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKCT3}, + {SMARTBUFF_FLASKCT4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKCT4}, + {SMARTBUFF_FLASKCT5, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKCT5}, + {SMARTBUFF_FLASKCT7, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKCT7, S.LinkFlaskCT7}, + {SMARTBUFF_ELIXIRCT1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRCT1}, + {SMARTBUFF_ELIXIRCT2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRCT2}, + {SMARTBUFF_ELIXIRCT3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRCT3}, + {SMARTBUFF_ELIXIRCT4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRCT4}, + {SMARTBUFF_ELIXIRCT5, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRCT5}, + {SMARTBUFF_ELIXIRCT6, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRCT6}, + {SMARTBUFF_ELIXIRCT7, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRCT7}, + {SMARTBUFF_ELIXIRCT8, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIRCT8}, + {SMARTBUFF_FLASK1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASK1}, + {SMARTBUFF_FLASK2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASK2}, + {SMARTBUFF_FLASK3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASK3}, + {SMARTBUFF_FLASK4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASK4}, + {SMARTBUFF_ELIXIR1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR1}, + {SMARTBUFF_ELIXIR2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR2}, + {SMARTBUFF_ELIXIR3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR3}, + {SMARTBUFF_ELIXIR4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR4}, + {SMARTBUFF_ELIXIR5, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR5}, + {SMARTBUFF_ELIXIR6, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR6}, + {SMARTBUFF_ELIXIR7, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR7}, + {SMARTBUFF_ELIXIR8, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR8}, + {SMARTBUFF_ELIXIR9, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR9}, + {SMARTBUFF_ELIXIR10, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR10}, + {SMARTBUFF_ELIXIR11, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR11}, + {SMARTBUFF_ELIXIR12, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR12}, + {SMARTBUFF_ELIXIR13, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR13}, + {SMARTBUFF_ELIXIR14, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR14}, + {SMARTBUFF_ELIXIR15, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR15}, + {SMARTBUFF_ELIXIR16, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BELIXIR16}, + {SMARTBUFF_FLASKBFA1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKBFA1, S.LinkFlaskBfA}, + {SMARTBUFF_FLASKBFA2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKBFA2}, + {SMARTBUFF_FLASKBFA3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKBFA3}, + {SMARTBUFF_FLASKBFA4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKBFA4}, + {SMARTBUFF_GRFLASKBFA1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BGRFLASKBFA1}, + {SMARTBUFF_GRFLASKBFA2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BGRFLASKBFA2}, + {SMARTBUFF_GRFLASKBFA3, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BGRFLASKBFA3}, + {SMARTBUFF_GRFLASKBFA4, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BGRFLASKBFA4}, + {SMARTBUFF_FLASKSL1, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKSL1, S.LinkFlaskSL}, + {SMARTBUFF_FLASKSL2, 60, SMARTBUFF_CONST_POTION, nil, SMARTBUFF_BFLASKSL2}, } - - SMARTBUFF_AddMsgD(">>>> Spell lists have been initialised."); + SMARTBUFF_AddMsgD("Spell list initialized"); + +-- LoadToys(); end diff --git a/SmartBuff.globals.lua b/SmartBuff.globals.lua index b9cad45..2afe79e 100644 --- a/SmartBuff.globals.lua +++ b/SmartBuff.globals.lua @@ -1,13 +1,6 @@ ------------------------------------------------------------------------------- --- SmartBuff --- Originally created by Aeldra (EU-Proudmoore) --- Classic versions by Codermik (Mik/Castanova/Amarantine EU-Mirage Raceway) --- Discord: https://discord.gg/R6EkZ94TKK --- Cast the most important buffs on you, tanks or party/raid members/pets. -------------------------------------------------------------------------------- - -- Globals - +------------------------------------------------------------------------------- SMARTBUFF_GLOBALS = { }; local SG = SMARTBUFF_GLOBALS; @@ -17,7 +10,7 @@ SMARTBUFF_TTC_G = 1; SMARTBUFF_TTC_B = 1; SMARTBUFF_TTC_A = 1; -SMARTBUFF_OPTIONSFRAME_HEIGHT = 820; +SMARTBUFF_OPTIONSFRAME_HEIGHT = 800; SMARTBUFF_OPTIONSFRAME_WIDTH = 500; SMARTBUFF_ACTION_ITEM = "item"; @@ -28,34 +21,146 @@ SMARTBUFF_CONST_AUTOSOUND = "Deathbind Sound"; --SMARTBUFF_CONST_AUTOSOUND = "GLUECREATECHARACTERBUTTON"; --[[ -SystemFont -GameFontNormal -GameFontNormalSmall -GameFontNormalLarge -GameFontHighlight -GameFontHighlightSmall -GameFontHighlightSmallOutline -GameFontHighlightLarge -GameFontDisable -GameFontDisableSmall -GameFontDisableLarge -GameFontGreen -GameFontGreenSmall -GameFontGreenLarge -GameFontRed -GameFontRedSmall -GameFontRedLarge -GameFontWhite -GameFontDarkGraySmall -NumberFontNormalYellow -NumberFontNormalSmallGray -QuestFontNormalSmall +SystemFont +GameFontNormal +GameFontNormalSmall +GameFontNormalLarge +GameFontHighlight +GameFontHighlightSmall +GameFontHighlightSmallOutline +GameFontHighlightLarge +GameFontDisable +GameFontDisableSmall +GameFontDisableLarge +GameFontGreen +GameFontGreenSmall +GameFontGreenLarge +GameFontRed +GameFontRedSmall +GameFontRedLarge +GameFontWhite +GameFontDarkGraySmall +NumberFontNormalYellow +NumberFontNormalSmallGray +QuestFontNormalSmall DialogButtonHighlightText -ErrorFont -TextStatusBarText -CombatLogFont +ErrorFont +TextStatusBarText +CombatLogFont NumberFontNormalLarge NumberFontNormalHuge ]]-- +---------------------------------------------------------------------------- + +-- Returns an unumerated table. +---## Example +---``` +---Enum.Animals = Enum.MakeEnum ( "Dog", "Cat", "Rabbit" ) +---print( Enum.Animals.Cat ) -- prints "Cat" +---``` +---@param ... ... +---@return table +function Enum.MakeEnum(...) + return tInvert({...}) + -- for i = 1, #t do + -- local v = t[i] + -- --t[i] = nil + -- t[v] = i + -- end + -- return t + end + +-- Returns an unumerated table from an existing table. +---## Example +---``` +---Fish = { "Loach", "Pike", "Herring" } +---Enum.Fish = Enum.MakeEnumFromTable(Fish) +---print(Enum.Fish.Herring) -- prints "Herring" +---``` +function Enum.MakeEnumFromTable(t) + return tInvert(t) +end + +-- Returns a table `t` of self-indexed values +-- ## Example +-- ```lua +-- t = dict( "foo", "bar") +-- print(t.foo) -- prints the string "foo" +-- ``` +---@param tbl table +---@return table +function Enum.MakeDict(tbl) + local t = {}; + for k, v in ipairs(tbl) do + t[v] = v; + end + return t; +end + +-- Returns a copy of `list` with `keys` and `values` inverted +-- ## Example +---``` +---t = { "foo" = 1, "bar" = 2}; +---s = tinvert(t); +---print(t.foo); -- prints the number 1 +---print(s[1]); -- prints the string "foo"; +---``` +---@param tbl table +---@return table out +function table.invert(tbl) + local out = {} + for k, v in pairs(tbl) do + out[v] = k + end + return out +end + +local Default, Nil = {}, function () end -- for uniqueness +---@param case any +---@return any +-- Implements a `switch` statement in Lua. +-- ## Example +-- ``` +-- switch(case) = { +-- [1] = function() print("one") end, +-- [2] = print, +-- [3] = math.sin, +-- default = function() print("default") end, +-- } +-- ``` +function switch (case) + return setmetatable({ case }, { + __call = function (t, cases) + local item = #t == 0 and Nil or t[1] + return (cases[item] or cases[Default] or Nil) + end + }) +end + +-- Prints debuggin information using a formatted version of its variable +-- number of arguments following the description given in its first argument. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.format"]) +---@param s any +---@param ... any +function printf(s, ...) + print(" ",SMARTBUFF_TITLE,"::",string.format(s, ...)) +end + +-- Prints debug information to `stdout`. Receives any number of arguments, +-- converting each argument to a string following the same rules of +-- [tostring](command:extension.lua.doc?["en-us/51/manual.html/pdf-tostring"]). +--- +--- [View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-print"]) +--- +function printd(...) + print(" ",SMARTBUFF_TITLE,"::",...) +end +--- Prints the value of any global variable, table value, frame, function result, or any valid Lua expression. Output is color coded for easier reading. Tables display up to 30 values, the rest are skipped and a message is shown. +---@param t any +---@param startkey? any +function dump(t, startkey) + DevTools_Dump(t, startkey) +end diff --git a/SmartBuff.lua b/SmartBuff.lua index 88e0638..eacf20a 100644 --- a/SmartBuff.lua +++ b/SmartBuff.lua @@ -1,43 +1,37 @@ ------------------------------------------------------------------------------- -- SmartBuff -- Originally created by Aeldra (EU-Proudmoore) --- Classic/Retail versions by Codermik (Mik/Castanova/Amarantine EU-Mirage Raceway or Castanova on EU-Aszune) +-- Classic & Retail versions by Codermik & Speedwaystar +-- Retail version fixes / improvements by Codermik & Speedwaystar -- Discord: https://discord.gg/R6EkZ94TKK -- Cast the most important buffs on you, tanks or party/raid members/pets. ------------------------------------------------------------------------------- -SMARTBUFF_DATE = "180123"; -SMARTBUFF_VERSION = "r40."..SMARTBUFF_DATE; -SMARTBUFF_VERSIONMIN = 11403; -- min version -SMARTBUFF_VERSIONNR = 30401; -- max version +SMARTBUFF_DATE = "200523"; + +SMARTBUFF_VERSION = "r41."..SMARTBUFF_DATE; +SMARTBUFF_VERSIONNR = 30401; SMARTBUFF_TITLE = "SmartBuff"; -SMARTBUFF_SUBTITLE = "Supports casting buffs on tanks, selected classes in party or raids."; -SMARTBUFF_DESC = "Cast the most important buffs on you, tanks, party or raid members/pets"; +SMARTBUFF_SUBTITLE = "Supports you in casting buffs"; +SMARTBUFF_DESC = "Cast the most important buffs on you, your tanks, party/raid members/pets"; SMARTBUFF_VERS_TITLE = SMARTBUFF_TITLE .. " " .. SMARTBUFF_VERSION; -SMARTBUFF_OPTIONS_TITLE = SMARTBUFF_VERS_TITLE; +SMARTBUFF_OPTIONS_TITLE = SMARTBUFF_VERS_TITLE.." WOTLK "; --- addon and client information. +-- addon name local addonName = ... -local SmartbuffPrefix = "Smartbuff"; +local SmartbuffPrefix = "SBC1.0"; +local SmartbuffHeader = "Smartbuff"; +local SmartbuffCommands = { "SBCVER", "SBCCMD", "SBCSYC" } local SmartbuffSession = true; -local SmartbuffVerCheck = false; -- for my use when checking guild users/testers versions :) -local wowVersionString, wowBuild, _, wowTOC = GetBuildInfo(); -local isWOTLKC = (_G.WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC and wowTOC >= 30400); -local SmartbuffRevision = 40; +local SmartbuffVerCheck = false; -- for my use when checking guild users/testers versions :) +local buildInfo = select(4, GetBuildInfo()) +local SmartbuffRevision = 41; local SmartbuffVerNotifyList = {} --- Smartbuff now uses LibRangeCheck-2.0 by Mitchnull, not fully implemented --- just yet but I will be moving over to this in the near future. +-- Using LibRangeCheck-2.0 by Mitchnull -- https://www.wowace.com/projects/librangecheck-2-0 local LRC = LibStub("LibRangeCheck-2.0") -local LCD = LibStub and LibStub("LibClassicDurations", true) -if LCD then LCD:Register(SMARTBUFF_TITLE) end - -local UnitAuraFull = UnitAura -if LCD and LCD.UnitAura then UnitAuraFull = function(a, b, c) return LCD:UnitAura(a, b, c) end end - - local SG = SMARTBUFF_GLOBALS; local OG = nil; -- Options global local O = nil; -- Options local @@ -47,12 +41,11 @@ local _; BINDING_HEADER_SMARTBUFF = "SmartBuff"; SMARTBUFF_BOOK_TYPE_SPELL = "spell"; - local GlobalCd = 1.5; local maxSkipCoolDown = 3; local maxRaid = 40; local maxBuffs = 40; -local maxScrollButtons = 50; +local maxScrollButtons = 30; local numBuffs = 0; local isLoaded = false; @@ -64,7 +57,6 @@ local isSetZone = false; local isFirstError = false; local isMounted = false; local isCTRA = true; -local isSetUnits = false; local isKeyUpChanged = false; local isKeyDownChanged = false; local isAuraChanged = false; @@ -86,9 +78,7 @@ local sRealmName = nil; local sPlayerName = nil; local sID = nil; local sPlayerClass = nil; -local iLastSubgroup = 0; local tLastCheck = 0; -local iGroupSetup = -1; local iLastBuffSetup = -1; local sLastTexture = ""; local iLastGroupSetup = -99; @@ -96,7 +86,7 @@ local sLastZone = ""; local tAutoBuff = 0; local tDebuff = 0; local sMsgWarning = ""; -local iCurrentFont = 1; +local iCurrentFont = 6; local iCurrentList = -1; local iLastPlayer = -1; @@ -115,16 +105,17 @@ local cScrBtnBO = nil; local cAddUnitList = { }; local cIgnoreUnitList = { }; +local cPlayerTrackers = { }; +local cDisableTrackSwitch = false; +local cLootOpenedDisable = false; -local cClasses = {"DRUID", "HUNTER", "MAGE", "PALADIN", "PRIEST", "ROGUE", "SHAMAN", "WARLOCK", "WARRIOR", "DEATHKNIGHT", "MONK", "DEMONHUNTER", "HPET", "WPET", "DKPET", "TANK", "HEALER", "DAMAGER"}; -local cIgnoreClasses = { 11, 12, 17, 18 }; -local cOrderGrp = {0, 1, 2, 3, 4, 5, 6, 7, 8}; -local cOrderClass = {0, "WARRIOR", "PRIEST", "DRUID", "PALADIN", "SHAMAN", "MAGE", "WARLOCK", "HUNTER", "ROGUE", "TANK", "HPET", "WPET", "DKPET"}; +local cClasses = {"DRUID", "HUNTER", "MAGE", "PALADIN", "PRIEST", "ROGUE", "SHAMAN", "WARLOCK", "WARRIOR", "DEATHKNIGHT", "MONK", "DEMONHUNTER", "EVOKER", "HPET", "WPET", "DKPET", "TANK", "HEALER", "DAMAGER"}; +local cIgnoreClasses = { 11, 12, 13, 19 }; +local cOrderGrp = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; local cFonts = {"NumberFontNormal", "NumberFontNormalLarge", "NumberFontNormalHuge", "GameFontNormal", "GameFontNormalLarge", "GameFontNormalHuge", "ChatFontNormal", "QuestFont", "MailTextFontNormal", "QuestTitleFont"}; local currentUnit = nil; local currentSpell = nil; -local currentRank = nil; local currentTemplate = nil; local currentSpec = nil; @@ -137,7 +128,7 @@ local IconPaths = { ["Roles"] = "Interface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES", ["Classes"] = "Interface\\WorldStateFrame\\Icons-Classes", }; - + local Icons = { ["WARRIOR"] = { IconPaths.Classes, 0.00, 0.25, 0.00, 0.25 }, ["MAGE"] = { IconPaths.Classes, 0.25, 0.50, 0.00, 0.25 }, @@ -151,6 +142,7 @@ local Icons = { ["DEATHKNIGHT"] = { IconPaths.Classes, 0.25, 0.50, 0.50, 0.75 }, ["MONK"] = { IconPaths.Classes, 0.50, 0.75, 0.50, 0.75 }, ["DEMONHUNTER"] = { IconPaths.Classes, 0.75, 1.00, 0.50, 0.75 }, + ["EVOKER"] = { IconPaths.Classes, 0.75, 1.00, 0.50, 0.75 }, ["PET"] = { IconPaths.Pet, 0.08, 0.92, 0.08, 0.92}, ["TANK"] = { IconPaths.Roles, 0.0, 19/64, 22/64, 41/64 }, ["HEALER"] = { IconPaths.Roles, 20/64, 39/64, 1/64, 20/64 }, @@ -158,8 +150,10 @@ local Icons = { ["NONE"] = { IconPaths.Roles, 20/64, 39/64, 22/64, 41/64 }, }; --- available sounds (14) -local Sounds = { 1141, 3784, 4574, 17318, 15262, 13830, 15273, 10042, 10720, 17316, 3337, 7894, 7914, 10033 } +-- available sounds (34) +local Sounds = { 1141, 3784, 4574, 17318, 15262, 13830, 15273, 10042, 10720, 17316, 3337, 15263, 13267, 8698, 3660, + 15712, 9203, 12279, 3273, 13179, 13327, 9632, 10590, 3322, 718, 149, 15686, 6189, 7095, 6341, 6267, + 7894, 7914, 10033 } local DebugChatFrame = DEFAULT_CHAT_FRAME; @@ -169,7 +163,7 @@ local UnitChannelInfo = _G.UnitChannelInfo or _G.ChannelInfo local GetNumSpecGroups = _G.GetNumSpecGroups or function(...) return 1 end local IsActiveBattlefieldArena = _G.IsActiveBattlefieldArena or function(...) return false end --- Popup +-- Popup to reset everything StaticPopupDialogs["SMARTBUFF_DATA_PURGE"] = { text = SMARTBUFF_OFT_PURGE_DATA, button1 = SMARTBUFF_OFT_YES, @@ -180,7 +174,16 @@ StaticPopupDialogs["SMARTBUFF_DATA_PURGE"] = { hideOnEscape = 1 } --- Rounds a number to the given number of decimal places. +-- Popup to reloadui +StaticPopupDialogs["SMARTBUFF_GUI_RELOAD"] = { + text = SMARTBUFF_OFT_REQ_RELOAD, + button1 = SMARTBUFF_OFT_OKAY, + OnAccept = function() ReloadUI() end, + timeout = 0, + whileDead = 1, + hideOnEscape = 1 +} +-- Rounds a number to the given number of decimal places. local r_mult; local function Round(num, idp) r_mult = 10^(idp or 0); @@ -215,6 +218,20 @@ function SMARTBUFF_PlaySpashSound() PlaySound(Sounds[O.AutoSoundSelection]); end +function SMARTBUFF_ChooseSplashSound() + local menu = {} + local i = 1 + for sound, soundpath in pairs(sounds) do + menu[i] = { text = sound, notCheckable = true, func = function() PlaySound(soundpath) end } + i = i + 1 + end + local dropDown = CreateFrame("Frame", "DropDownMenuFrame", UIParent, "UIDropDownMenuTemplate") + dropDown:SetPoint("CENTER", UIParent, "CENTER") + dropDown:SetScript("OnMouseUp", function (self, button, down) + print("mousedown") + end) +end + -- Reorders values in the table local function treorder(t, i, n) if (t and type(t) == "table" and t[i]) then @@ -232,13 +249,13 @@ end -- Finds a value in the table and returns the index local function tfind(t, s) - if (t and type(t) == "table" and s) then - for k, v in pairs(t) do - if (v and v == s) then + if (t and type(t) == "table" and s) then + for k, v in pairs(t) do + if (v and v == s) then return k; - end - end - end + end + end + end return false; end @@ -253,10 +270,6 @@ local function tcontains(t, s) return false; end -function strim(s) - return (s:gsub("^%s*(.-)%s*$", "%1")) -end - local function ChkS(text) if (text == nil) then text = ""; @@ -264,56 +277,10 @@ local function ChkS(text) return text; end --- check for a given buff. -local function CheckForBuff(buff) - for i=1,40 do - name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = UnitAura("player",i); - if name == buff then - return true; - end - end - return false; -end - -local function IsFlying() - if (O.WarnWhileMounted) then return false; end - local result = GetShapeshiftForm(false) - if ((result == 5 and not CheckForBuff(SMARTBUFF_DRUID_MOONKIN)) or result == 6) and sPlayerClass == "DRUID" then - return true - end - return false -end - -local function UnitInVehicle(unit) - return false -end - -local function UnitHasVehicleUI(unit) - return false -end - -local function UnitGroupRolesAssigned(unit) - -- dont bother if we dont have assigned tanks - if cClassGroups then - if cClassGroups["TANK"] then - for n = 1, maxRaid, 1 do - local u = cClassGroups["TANK"][n] - if u and u == unit then - name, rank, subgroup, level, class, classeng, zone, online, isDead, role = GetRaidRosterInfo(n) - if role and role == "MAINTANK" then - return "TANK" - end - end - end - end - end - return "NONE" -end - local function IsVisibleToPlayer(self) - if (not self) then return false; end + if (not self) then return false; end local w, h = UIParent:GetWidth(), UIParent:GetHeight(); - local x, y = self:GetLeft(), UIParent:GetHeight() - self:GetTop(); + local x, y = self:GetLeft(), UIParent:GetHeight() - self:GetTop(); if (x >= 0 and x < (w - self:GetWidth()) and y >= 0 and y < (h - self:GetHeight())) then return true; end @@ -321,12 +288,8 @@ local function IsVisibleToPlayer(self) end local function CS() - if isWOTLKC then - currentSpec = GetActiveTalentGroup() or nil; - else - if (currentSpec == nil) then - currentSpec = GetSpecialization() or nil; - end + if (currentSpec == nil) then + currentSpec = GetActiveTalentGroup() end if (currentSpec == nil) then currentSpec = 1; @@ -353,7 +316,7 @@ local function InitBuffSettings(cBI, reset) cBuff = B[CS()][CT()][buff]; reset = true; end - + if (reset) then wipe(cBuff); cBuff.EnableS = false; @@ -362,12 +325,12 @@ local function InitBuffSettings(cBI, reset) cBuff.SelfNot = false; cBuff.CIn = false; cBuff.COut = true; - cBuff.MH = false; + cBuff.MH = true; -- default to checked cBuff.OH = false; cBuff.RH = false; cBuff.Reminder = true; cBuff.RBTime = 0; - cBuff.ManaLimit = 0; + cBuff.ManaLimit = 0; if (cBI.Type == SMARTBUFF_CONST_GROUP or cBI.Type == SMARTBUFF_CONST_ITEMGROUP) then for n in pairs(cClasses) do if (cBI.Type == SMARTBUFF_CONST_GROUP and not tcontains(cIgnoreClasses, n) and not string.find(cBI.Params, cClasses[n])) then @@ -377,23 +340,22 @@ local function InitBuffSettings(cBI, reset) end end end - end - + end + -- Upgrades if (cBuff.RBTime == nil) then cBuff.Reminder = true; cBuff.RBTime = 0; end -- to 1.10g if (cBuff.ManaLimit == nil) then cBuff.ManaLimit = 0; end -- to 1.12b if (cBuff.SelfNot == nil) then cBuff.SelfNot = false; end -- to 2.0i if (cBuff.AddList == nil) then cBuff.AddList = { }; end -- to 2.1a - if (cBuff.IgnoreList == nil) then cBuff.IgnoreList = { }; end -- to 2.1a + if (cBuff.IgnoreList == nil) then cBuff.IgnoreList = { }; end -- to 2.1a if (cBuff.RH == nil) then cBuff.RH = false; end -- to 4.0b end local function InitBuffOrder(reset) - if (B[CS()].Order == nil) then - B[CS()].Order = { }; - end - + if not B then B = {} end + if not B[CS()] then B[CS()] = {} end + if not B[CS()].Order then B[CS()].Order = {} end local b; local i; local ord = B[CS()].Order; @@ -401,15 +363,15 @@ local function InitBuffOrder(reset) wipe(ord); SMARTBUFF_AddMsgD("Reset buff order"); end - + -- Remove not longer existing buffs in the order list for k, v in pairs(ord) do if (v and cBuffIndex[v] == nil) then SMARTBUFF_AddMsgD("Remove from buff order: "..v); tremove(ord, k); end - end - + end + i = 1; while (cBuffs[i] and cBuffs[i].BuffS) do b = false; @@ -429,7 +391,7 @@ local function InitBuffOrder(reset) end local function IsMinLevel(minLevel) - if (not minLevel) then + if (not minLevel) then return true; end if (minLevel > UnitLevel("player")) then @@ -438,50 +400,116 @@ local function IsMinLevel(minLevel) return true; end -local function IsPowerLimitOk(bs) - -- Check for power threshold - if (bs.ManaLimit and bs.ManaLimit > 0) then - local powerType, powerToken = UnitPowerType("player"); - -- if bs.ManaLimit <= 100 and powertype is mana then the ManaLimit is % - if (bs.ManaLimit <= 100 and powerType == 0) then - if (((UnitPower("player", powerType) / UnitPowerMax("player", powerType))) * 100 < bs.ManaLimit) then - return false; - end - elseif (UnitPower("player", powerType) < bs.ManaLimit) then - return false; - end - end - return true; -end - local function IsPlayerInGuild() return IsInGuild() -- and GetGuildInfo("player") end -local function SendSmartbuffVersion(player, unit) - if player == UnitName("player") then return end - for count,value in ipairs(SmartbuffVerNotifyList) do - if value[1] == player then return end + +local function IsTalentSkilled(t, i, name) + local _, tName, _, _, tAvailable = GetTalentInfo(t, i); + if (tName) then + isTTreeLoaded = true; + SMARTBUFF_AddMsgD("Talent: "..tName..", Points = "..tAvailable); + if (name and name == tName and tAvailable > 0) then + SMARTBUFF_AddMsgD("Debuff talent found: "..name..", Points = "..tAvailable); + return true, tAvailable; + end + else + SMARTBUFF_AddMsgD("Talent tree not available!"); + isTTreeLoaded = false; + end + return false, 0; +end + +-- toggle the auto gathering switcher. +function ToggleAutoGatherer() + if (not isInit) then return end + O.TrackSwitchActive = not O.TrackSwitchActive; + if not SmartBuffOptionsFrame:IsShown() then -- quiet while in options + if O.TrackSwitchActive then + DEFAULT_CHAT_FRAME:AddMessage("|cff00e0ffSmartbuff Build "..SMARTBUFF_VERSION.." (Client: "..buildInfo..")|cffffffff "..SMARTBUFF_AUTOGATHERON) + else + DEFAULT_CHAT_FRAME:AddMessage("|cff00e0ffSmartbuff Build "..SMARTBUFF_VERSION.." (Client: "..buildInfo..")|cffffffff "..SMARTBUFF_AUTOGATHEROFF) + end + PlaySound(15263); + end +end + +-- Read number of tracking abilities +function ScanPlayerTrackers() + if (not isInit) then return end + local count = C_Minimap.GetNumTrackingTypes(); + local spellcount = 0; + cPlayerTrackers = { }; + for i=1,count do + local name, texture, active, category = C_Minimap.GetTrackingInfo(i); + if category == "spell" then + -- only interested in minerals, herbs and fish here + if name == SMARTBUFF_OFT_MINERALS or name == SMARTBUFF_OFT_HERBS or name == SMARTBUFF_OFT_FINDFISH then + spellcount = spellcount + 1 + tinsert(cPlayerTrackers, {i, name}) + end + end end - local isInBattleground = UnitInBattleground("player") - if not isInBattleground then - tinsert(SmartbuffVerNotifyList, {player, unit, GetTime()}) - C_ChatInfo.SendAddonMessage(SmartbuffPrefix, SmartbuffRevision, "WHISPER", player) + O.TrackMaxPosition = spellcount +end + +-- toggle trackers +local lastFire = GetTime() +function ToggleGatheringTrackers() + if (not isInit) then return end + local tmptable + if O.TrackSwitchActive and not cDisableTrackSwitch and not cLootOpenedDisable then + local currentTime = GetTime() + if (currentTime - lastFire) >= O.TrackSwitchDelay and not InCombatLockdown() then + ScanPlayerTrackers() + currentTime = GetTime() + lastFire = currentTime + if not SmartBuffOptionsFrame:IsShown() then + tmptable = cPlayerTrackers[O.TrackPosition] + local tmptablesize = #cPlayerTrackers + if tmptablesize <= 1 then + -- turn the auto switch off, it will only benefit when more than one gathering tracking is available. + DEFAULT_CHAT_FRAME:AddMessage("|cff00e0ffSmartbuff Gathering Switcher : |cffffffff"..SMARTBUFF_TRACKINGDISABLE) + O.TrackSwitchActive = false + end + if tmptable then + if tmptable[2] == "Find Fish" and O.TrackSwitchFish then + C_Minimap.SetTracking(tmptable[1], true) + elseif tmptable[2] == "Find Fish" and not O.TrackSwitchFish then + O.TrackPosition = O.TrackPosition + 1 + if O.TrackPosition > O.TrackMaxPosition then + O.TrackPosition = 1 + end + tmptable = cPlayerTrackers[O.TrackPosition] + C_Minimap.SetTracking(tmptable[1], true) + elseif tmptable[2] ~= "Find Fish" then + C_Minimap.SetTracking(tmptable[1], true) + end + O.TrackPosition = O.TrackPosition + 1 + if O.TrackPosition > O.TrackMaxPosition then + O.TrackPosition = 1 + end + end + end + end end end + -- SMARTBUFF_OnLoad function SMARTBUFF_OnLoad(self) - self:RegisterEvent("ADDON_LOADED"); self:RegisterEvent("PLAYER_LOGIN"); self:RegisterEvent("PLAYER_ENTERING_WORLD"); self:RegisterEvent("UNIT_NAME_UPDATE"); - self:RegisterEvent("GROUP_ROSTER_UPDATE"); self:RegisterEvent("PLAYER_REGEN_ENABLED"); self:RegisterEvent("PLAYER_REGEN_DISABLED"); self:RegisterEvent("PLAYER_STARTED_MOVING"); self:RegisterEvent("PLAYER_STOPPED_MOVING"); + self:RegisterEvent("LOOT_OPENED") + self:RegisterEvent("LOOT_CLOSED") + self:RegisterEvent("PLAYER_TALENT_UPDATE"); self:RegisterEvent("SPELLS_CHANGED"); self:RegisterEvent("ACTIONBAR_HIDEGRID"); self:RegisterEvent("UNIT_AURA"); @@ -490,90 +518,107 @@ function SMARTBUFF_OnLoad(self) self:RegisterEvent("UPDATE_MOUSEOVER_UNIT"); self:RegisterEvent("UNIT_SPELLCAST_FAILED"); self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED"); - - -- One of them allows SmartBuff to be closed with the Escape key + --auto template events + self:RegisterEvent("ZONE_CHANGED_NEW_AREA") + self:RegisterEvent("GROUP_ROSTER_UPDATE") + --One of them allows SmartBuff to be closed with the Escape key tinsert(UISpecialFrames, "SmartBuffOptionsFrame"); UIPanelWindows["SmartBuffOptionsFrame"] = nil; - - -- setup command line. + SlashCmdList["SMARTBUFF"] = SMARTBUFF_command; SLASH_SMARTBUFF1 = "/sbo"; SLASH_SMARTBUFF2 = "/sbuff"; SLASH_SMARTBUFF3 = "/smartbuff"; + SLASH_SMARTBUFF4 = "/sb"; + SlashCmdList["SMARTBUFFMENU"] = SMARTBUFF_OptionsFrame_Toggle; - SLASH_SMARTBUFFMENU1 = "/sbm"; + SLASH_SMARTBUFFMENU1 = "/sbm"; + SlashCmdList["SmartReloadUI"] = function(msg) ReloadUI(); end; SLASH_SmartReloadUI1 = "/rui"; - + SMARTBUFF_InitSpellIDs(); + end - -- END SMARTBUFF_OnLoad -------------------------------------------------------------------------------------------------------------------------------------- --- SmartBuff Event Handler --------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- +-- SMARTBUFF_OnEvent function SMARTBUFF_OnEvent(self, event, ...) local arg1, arg2, arg3, arg4, arg5 = ...; - -- UNIT_NAME_UPDATE / PLAYER_ENTERING_WORLD - if ((event == "UNIT_NAME_UPDATE" and arg1 == "player") or event == "PLAYER_ENTERING_WORLD") then - if IsPlayerInGuild() and event == "PLAYER_ENTERING_WORLD" then - C_ChatInfo.SendAddonMessage(SmartbuffPrefix, SmartbuffRevision, "GUILD") + if ((event == "UNIT_NAME_UPDATE" and arg1 == "player") or event == "PLAYER_ENTERING_WORLD") then + if IsPlayerInGuild() and event == "PLAYER_ENTERING_WORLD" then + C_ChatInfo.SendAddonMessage(SmartbuffPrefix, SmartbuffHeader..""..SmartbuffCommands[1]..""..SmartbuffRevision..""..SMARTBUFF_VERSION, "GUILD") end - isPlayer = true; + isPlayer = true; if (event == "PLAYER_ENTERING_WORLD" and isInit and O.Toggle) then isSetZone = true; tStartZone = GetTime(); end - -- ADDON_LOADED elseif(event == "ADDON_LOADED" and arg1 == SMARTBUFF_TITLE) then isLoaded = true; end -- PLAYER_LOGIN - if event == "PLAYER_LOGIN" then - local prefixResult = C_ChatInfo.RegisterAddonMessagePrefix(SmartbuffPrefix) + if event == "PLAYER_LOGIN" then + local prefixResult = C_ChatInfo.RegisterAddonMessagePrefix(SmartbuffPrefix) + end + + -- these two stop the tracking switcher when a loot window is opened + -- otherwise if autoloot isnt on it can close the loot window when it + -- does a switch.. gotta love these things.. + + if event == "LOOT_OPENED" then + cLootOpenedDisable = true + SMARTBUFF_AddMsgD("Loot window opened"); + end + if event == "LOOT_CLOSED" then + cLootOpenedDisable = false + SMARTBUFF_AddMsgD("Loot window closed"); end - -- CHAT_MSG_ADDON + -- CHAT_MSG_ADDON if event == "CHAT_MSG_ADDON" then + local pktHeader, pktCmd, pktData1, pktData2 if arg1 == SmartbuffPrefix then - -- its us. if arg2 then - arg2 = tonumber(arg2) - if arg2 > SmartbuffRevision and SmartbuffSession then - -- detected a newer version of the addon, lets let the player know. - DEFAULT_CHAT_FRAME:AddMessage(SMARTBUFF_MSG_NEWVER1..SMARTBUFF_VERSION..SMARTBUFF_MSG_NEWVER2..arg2..SMARTBUFF_MSG_NEWVER3) - SmartbuffSession = false - end - -- guild version check - for my use testing the addon with the guild testers. -- - if arg5 and arg5 ~= UnitName("player") and SmartbuffVerCheck then - DEFAULT_CHAT_FRAME:AddMessage("|cff00e0ffSmartbuff : |cffFFFF00"..arg5.." ("..arg3..")|cffffffff has revision |cffFFFF00r"..arg2.."|cffffffff installed.") - end + pktHeader, pktCmd, pktData1, pktData2 = strsplit("", arg2, 4) + if pktHeader == SmartbuffHeader then + if pktCmd == SmartbuffCommands[1] then -- version packet + pktData1 = tonumber(pktData1) + if pktData1 > SmartbuffRevision and SmartbuffSession then + DEFAULT_CHAT_FRAME:AddMessage(SMARTBUFF_MSG_NEWVER1..SMARTBUFF_VERSION..SMARTBUFF_MSG_NEWVER2..pktData1..SMARTBUFF_MSG_NEWVER3) + SmartbuffSession = false + end + if SmartbuffVerCheck then + if arg5 and arg5 ~= UnitName("player") then + DEFAULT_CHAT_FRAME:AddMessage("|cff00e0ffSmartbuff Versions: |cffFFFF00"..arg5.."|cffffffff has "..pktData2.." installed.") + end + end + elseif pktCmd == SmartbuffCommands[2] then -- command packet (future feature) + elseif pktCmd == SmartbuffCommands[3] then -- sync packet (future feature) + else + SMARTBUFF_AddMsgD("Warning: Received an unknown command packet to the addon."); + end + else + SMARTBUFF_AddMsgD("Warning: Not a valid packet header sent to the addon."); + end end end end - - -- SMARTBUFF_UPDATE + if (event == "SMARTBUFF_UPDATE" and isLoaded and isPlayer and not isInit and not InCombatLockdown()) then SMARTBUFF_Options_Init(self); end - + if (not isInit or O == nil) then return; end; - - -- GROUP_ROSTER_UPDATE - if (event == "GROUP_ROSTER_UPDATE") then - isSetUnits = true; - - -- PLAYER_REGEN_DISABLED - elseif (event == "PLAYER_REGEN_DISABLED") then + + if (event == "PLAYER_REGEN_DISABLED") then SMARTBUFF_Ticker(true); - if (O.Toggle) then if (O.InCombat) then for spell, data in pairs(cBuffsCombat) do @@ -597,11 +642,15 @@ function SMARTBUFF_OnEvent(self, event, ...) end SMARTBUFF_SyncBuffTimers(); SMARTBUFF_Check(1, true); + if SMARTBUFF_IsFishingPoleEquiped() and O.WarnCombatFishingRod then -- i'll add an option to turn this off later + -- warn the player he/she is in combat with a fishing pole equipped. + DEFAULT_CHAT_FRAME:AddMessage("|cffff0000Smartbuff Warning: |cffff6060"..SMARTBUFF_OFT_FRODWARN) + PlaySound(12197); + end end - - -- PLAYER_REGEN_ENABLED + elseif (event == "PLAYER_REGEN_ENABLED") then - SMARTBUFF_Ticker(true); + SMARTBUFF_Ticker(true); if (O.Toggle) then if (O.InCombat) then SmartBuff_KeyButton:SetAttribute("type", nil); @@ -612,14 +661,25 @@ function SMARTBUFF_OnEvent(self, event, ...) SMARTBUFF_Check(1, true); end - -- PLAYER_STARTED_MOVING / PLAYER_STOPPED_MOVING elseif (event == "PLAYER_STARTED_MOVING") then isPlayerMoving = true; elseif (event == "PLAYER_STOPPED_MOVING") then isPlayerMoving = false; - -- SPELLS_CHANGED / ACTIONBAR_HIDEGRID + elseif (event == "PLAYER_TALENT_UPDATE") then + if(SmartBuffOptionsFrame:IsVisible()) then + SmartBuffOptionsFrame:Hide(); + end + if (currentSpec ~= GetActiveTalentGroup()) then + currentSpec = GetActiveTalentGroup(); + if (B[currentSpec] == nil) then + B[currentSpec] = { }; + end + SMARTBUFF_AddMsg(format(SMARTBUFF_MSG_SPECCHANGED, tostring(currentSpec)), true); + isSetBuffs = true; + end + elseif (event == "SPELLS_CHANGED" or event == "ACTIONBAR_HIDEGRID") then isSetBuffs = true; end @@ -627,15 +687,14 @@ function SMARTBUFF_OnEvent(self, event, ...) if (not O.Toggle) then return; end; - - -- UNIT_AURA + if (event == "UNIT_AURA") then if (UnitAffectingCombat("player") and (arg1 == "player" or string.find(arg1, "^party") or string.find(arg1, "^raid"))) then isSyncReq = true; - end + end -- checks if aspect of cheetah or pack is active and cancel it if someone gets dazed if (sPlayerClass == "HUNTER" and O.AntiDaze and (arg1 == "player" or string.find(arg1, "^party") or string.find(arg1, "^raid") or string.find(arg1, "pet"))) then - local _, _, stuntex = GetSpellInfo(1604); --get Dazed icon + local _, _, stuntex = GetSpellInfo(1604); --get Dazed icon if (SMARTBUFF_IsDebuffTexture(arg1, stuntex)) then buff = nil; if (arg1 == "player" and SMARTBUFF_CheckBuff(arg1, SMARTBUFF_AOTC)) then @@ -651,18 +710,16 @@ function SMARTBUFF_OnEvent(self, event, ...) end if (O.ToggleAutoChat) then SMARTBUFF_AddMsgWarn("!!! CANCEL "..buff.." !!!", true); - end + end end - end - end + end + end end - - -- UI_ERROR_MESSAGE + if (event == "UI_ERROR_MESSAGE") then SMARTBUFF_AddMsgD(string.format("Error message: %s",arg1)); end - -- UNIT_SPELLCAST_FAILED if (event == "UNIT_SPELLCAST_FAILED") then currentUnit = arg1; SMARTBUFF_AddMsgD(string.format("Spell failed: %s",arg1)); @@ -670,41 +727,28 @@ function SMARTBUFF_OnEvent(self, event, ...) if (UnitName(currentUnit) ~= sPlayerName and O.BlacklistTimer > 0) then cBlacklist[currentUnit] = GetTime(); if (currentUnit and UnitName(currentUnit)) then - SMARTBUFF_AddMsgD(UnitName(currentUnit).." ("..currentUnit..") blacklisted ("..O.BlacklistTimer.."sec)"); end end end currentUnit = nil; - - -- UNIT_SPELLCAST_SUCCEEDED - elseif (event == "UNIT_SPELLCAST_SUCCEEDED") then + + elseif (event == "UNIT_SPELLCAST_SUCCEEDED") then if (arg1 and arg1 == "player") then local unit = nil; local spell = nil; local target = nil; - - -- temporary dirty hack to force a spell list refresh and check when a warlock stone is created. - -- yes yes, i know its horrible but its temporary as a quick fix - i will tidy this up later. - if (sPlayerClass == "WARLOCK") then - -- only really interested if im a warlock, otherwise just skip over. - if arg3 == 2362 or arg3 == 17727 or arg3 == 17728 or arg3 == 28172 or arg3 == 47886 or arg3 == 47888 or - arg3 == 6366 or arg3 == 17951 or arg3 == 17952 or arg3 == 17954 or arg3 == 27250 or arg3 == 60219 then - isSetBuffs = true; - end - end - if (arg1 and arg2) then if (not arg3) then arg3 = ""; end if (not arg4) then arg4 = ""; end - SMARTBUFF_AddMsgD("Spellcast succeeded: " .. arg1 .. ", " .. arg2 .. ", " .. arg3 .. ", " .. arg4) + SMARTBUFF_AddMsgD("Spellcast succeeded: target " .. arg1 .. ", spellID " .. arg3 .. " (" ..GetSpellInfo(arg3) .. "), " .. arg4) if (string.find(arg1, "party") or string.find(arg1, "raid")) then spell = arg2; - end - end + end + end if (currentUnit and currentSpell and currentUnit ~= "target") then unit = currentUnit; spell = currentSpell; - end + end if (unit) then local name = UnitName(unit); if (cBuffTimer[unit] == nil) then @@ -715,81 +759,61 @@ function SMARTBUFF_OnEvent(self, event, ...) SMARTBUFF_AddMsg(name .. ": " .. spell .. " " .. SMARTBUFF_MSG_BUFFED); currentUnit = nil; currentSpell = nil; - currentRank = nil; end - end + end if (isClearSplash) then isClearSplash = false; SMARTBUFF_Splash_Clear(); - end - end + end + end + end + + if event == "ZONE_CHANGED_NEW_AREA" or event == "GROUP_ROSTER_UPDATE" then + SMARTBUFF_SetTemplate() end end +-- END SMARTBUFF_OnEvent + -------------------------------------------------------------------------------------------------------------------------------------- --- SMARTBUFF_OnUpdate -------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- function SMARTBUFF_OnUpdate(self, elapsed) - if not self.Elapsed then + if not self.Elapsed then self.Elapsed = 0.2 end self.Elapsed = self.Elapsed - elapsed - if self.Elapsed > 0 then - return + if self.Elapsed > 0 then + return end self.Elapsed = 0.2 - if (not isInit) then if (isLoaded and GetTime() > tAutoBuff + 0.5) then tAutoBuff = GetTime(); - _, tName = GetTalentInfo(1, 1, 1); - if (tName) then + local specID = GetActiveTalentGroup() + if (specID) then SMARTBUFF_OnEvent(self, "SMARTBUFF_UPDATE"); end - end - else - if (isSetZone and GetTime() > (tStartZone + 4)) then - SMARTBUFF_CheckLocation(); end + else SMARTBUFF_Ticker(); SMARTBUFF_Check(1); + ToggleGatheringTrackers(); end end -------------------------------------------------------------------------------------------------------------------------------------- --- SMARTBUFF_Ticker ---------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- function SMARTBUFF_Ticker(force) if (force or GetTime() > tTicker + 1) then tTicker = GetTime(); - - if (isSetUnits) then - isSetUnits = false; - SMARTBUFF_SetUnits(); - isSyncReq = true; - end - if (isSyncReq or tTicker > tSync + 10) then SMARTBUFF_SyncBuffTimers(); end - if (isAuraChanged) then isAuraChanged = false; SMARTBUFF_Check(1, true); end - - end + end end -------------------------------------------------------------------------------------------------------------------------------------- --- --- SMARTBUFF_AddMsg --- SMARTBUFF_AddMsgErr --- SMARTBUFF_AddMsgWarn --- SMARTBUFF_AddMsgD --- -------------------------------------------------------------------------------------------------------------------------------------- +-- Will dump the value of msg to the default chat window function SMARTBUFF_AddMsg(msg, force) if (DEFAULT_CHAT_FRAME and (force or not O.ToggleMsgNormal)) then DEFAULT_CHAT_FRAME:AddMessage(YLL .. msg .. "|r"); @@ -821,82 +845,85 @@ function SMARTBUFF_AddMsgD(msg, r, g, b) end end +Enum.SmartBuffGroup = { + Solo = 1, + Party = 2, + Raid = 3, + Battleground = 4, + Arena = 5, + ICC = 6, + TOC = 7, + Ulduar = 7, + Ony = 8, + Naxx = 9, + Custom1 = 10, + Custom2 = 11, + Custom3 = 12, + Custom4 = 13, + Custom5 = 14 +} -------------------------------------------------------------------------------------------------------------------------------------- --- SMARTBUFF_SetUnits() --- Creates a array of units in a party or raid. -------------------------------------------------------------------------------------------------------------------------------------- - -function SMARTBUFF_SetUnits() - --if (not isInit or not O.Toggle) then return; end - if (InCombatLockdown()) then - isSetUnits = true; - return; - end - if (SmartBuffOptionsFrame:IsVisible()) then return; end - - local i = 0; - local n = 0; - local j = 0; - local s = nil; - local psg = 0; - local b = false; - local iBFA = SMARTBUFF_IsActiveBattlefield(); - - if (iBFA > 0) then - SMARTBUFF_CheckLocation(); - end - - -- player - -- pet - -- party1-4 - -- partypet1-4 - -- raid1-40 - -- raidpet1-40 - - iGroupSetup = -1; - if (IsInRaid()) then - iGroupSetup = 3; - elseif (GetNumSubgroupMembers() ~= 0) then - iGroupSetup = 2; - else - iGroupSetup = 1; - end - - if (iGroupSetup ~= iLastGroupSetup) then - iLastGroupSetup = iGroupSetup; - wipe(cBlacklist); - wipe(cBuffTimer); - if (SMARTBUFF_TEMPLATES[iGroupSetup] == nil) then - SMARTBUFF_SetBuffs(); +-- Set the current template and create an array of units +function SMARTBUFF_SetTemplate() + if (InCombatLockdown()) then return end + if (SmartBuffOptionsFrame:IsVisible()) then return end + local newTemplate = currentTemplate + if O.AutoSwitchTemplate then + newTemplate = SMARTBUFF_TEMPLATES[Enum.SmartBuffGroup.Solo]; + cDisableTrackSwitch = false; -- on unless otherwise changed + local name, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceID, instanceGroupSize, LfgDungeonID = GetInstanceInfo() + if IsInRaid() then + newTemplate = SMARTBUFF_TEMPLATES[Enum.SmartBuffGroup.Raid]; + elseif IsInGroup() then + newTemplate = SMARTBUFF_TEMPLATES[Enum.SmartBuffGroup.Party]; end - local tmp = SMARTBUFF_TEMPLATES[iGroupSetup]; - if (O.AutoSwitchTemplate and currentTemplate ~= tmp and iBFA == 0) then - SMARTBUFF_AddMsg(SMARTBUFF_OFT_AUTOSWITCHTMP .. ": " .. currentTemplate .. " -> " .. tmp); - currentTemplate = tmp; - SMARTBUFF_SetBuffs(); + -- check instance type (allows solo raid clearing, etc) + if instanceType == "raid" then + newTemplate = SMARTBUFF_TEMPLATES[Enum.SmartBuffGroup.Raid]; + cDisableTrackSwitch = true; + elseif instanceType == "party" then + newTemplate = SMARTBUFF_TEMPLATES[Enum.SmartBuffGroup.Party]; + cDisableTrackSwitch = true; end - SMARTBUFF_MiniGroup_Show(); - end - + end + -- if autoswitch on instance change is enabled, load new instance template if any + local isRaidInstanceTemplate = false + if O.AutoSwitchTemplateInst then + local zone = GetRealZoneText() + local instances = Enum.MakeEnumFromTable(SMARTBUFF_INSTANCES); + local i = instances[zone] + if i and SMARTBUFF_TEMPLATES[i + Enum.SmartBuffGroup.Arena] then + newTemplate = SMARTBUFF_TEMPLATES[i + Enum.SmartBuffGroup.Arena] + isRaidInstanceTemplate = true + end + end + if currentTemplate ~= newTemplate then + SMARTBUFF_AddMsgD("Current tmpl: " .. currentTemplate or "nil" .. " - new tmpl: " .. newTemplate or "nil"); + SMARTBUFF_AddMsg(SMARTBUFF_TITLE.." :: "..SMARTBUFF_OFT_AUTOSWITCHTMP .. ": " .. currentTemplate .. " -> " .. newTemplate); + end + + currentTemplate = newTemplate; + + SMARTBUFF_SetBuffs(); + wipe(cBlacklist); + wipe(cBuffTimer); wipe(cUnits); wipe(cGroups); cClassGroups = nil; wipe(cAddUnitList); wipe(cIgnoreUnitList); - -- Raid Setup - if (iGroupSetup == 3) then + -- Raid Setup, including smart instance templates + if currentTemplate == (SMARTBUFF_TEMPLATES[Enum.SmartBuffGroup.Raid]) or isRaidInstanceTemplate then cClassGroups = { }; - local name, server, rank, subgroup, level, class, classeng, zone, online, isDead, role; + local name, server, rank, subgroup, level, class, classeng, zone, online, isDead; local sRUnit = nil; - + j = 1; for n = 1, maxRaid, 1 do - -- GetRaidRosterInfo role returns "MAINTANK" or "MAINASSIST" - name, rank, subgroup, level, class, classeng, zone, online, isDead, role = GetRaidRosterInfo(n); + name, rank, subgroup, level, class, classeng, zone, online, isDead = GetRaidRosterInfo(n); if (name) then - server = nil; + server = nil; i = string.find(name, "-", 1, true); if (i and i > 0) then server = string.sub(name, i + 1); @@ -904,15 +931,17 @@ function SMARTBUFF_SetUnits() SMARTBUFF_AddMsgD(name .. ", " .. server); end sRUnit = "raid"..n; - - SMARTBUFF_AddUnitToClass("raid", n, role); + + --SMARTBUFF_AddMsgD(name .. ", " .. sRUnit .. ", " .. UnitName(sRUnit)); + + SMARTBUFF_AddUnitToClass("raid", n); SmartBuff_AddToUnitList(1, sRUnit, subgroup); SmartBuff_AddToUnitList(2, sRUnit, subgroup); - + if (name == sPlayerName and not server) then psg = subgroup; - end - + end + if (O.ToggleGrp[subgroup]) then s = ""; if (name == UnitName(sRUnit)) then @@ -924,65 +953,42 @@ function SMARTBUFF_SetUnits() j = j + 1; end end - -- attempt to announce the addon version (if they have it) - if online then SendSmartbuffVersion(name, sRUnit) end end end --end for - + if (not b or B[CS()][currentTemplate].SelfFirst) then SMARTBUFF_AddSoloSetup(); - iLastSubgroup = psg; end - - if (iLastSubgroup ~= psg) then - SMARTBUFF_AddMsgWarn(SMARTBUFF_TITLE .. ": " .. SMARTBUFF_MSG_SUBGROUP); - if (O.ToggleSubGrpChanged) then - O.ToggleGrp[psg] = true; - if (SmartBuffOptionsFrame:IsVisible()) then - SMARTBUFF_ShowSubGroupsOptions(); - else - SMARTBUFF_OptionsFrame_Open(); - end - end - iLastSubgroup = psg; - end - + SMARTBUFF_AddMsgD("Raid Unit-Setup finished"); - + -- Party Setup - elseif (iGroupSetup == 2) then - - cClassGroups = { }; + elseif (currentTemplate == (SMARTBUFF_TEMPLATES[Enum.SmartBuffGroup.Party])) then + cClassGroups = { }; if (B[CS()][currentTemplate].SelfFirst) then SMARTBUFF_AddSoloSetup(); - end + end + cGroups[1] = { }; cGroups[1][0] = "player"; - SMARTBUFF_AddUnitToClass("player", 0, nil); + SMARTBUFF_AddUnitToClass("player", 0); for j = 1, 4, 1 do cGroups[1][j] = "party"..j; - SMARTBUFF_AddUnitToClass("party", j, nil); + SMARTBUFF_AddUnitToClass("party", j); SmartBuff_AddToUnitList(1, "party"..j, 1); SmartBuff_AddToUnitList(2, "party"..j, 1); - name, _, _, _, _, _, _, online, _, _ = GetRaidRosterInfo(j); - if name and online then SendSmartbuffVersion(name, "party") end end SMARTBUFF_AddMsgD("Party Unit-Setup finished"); - -- Solo Setup - else + else SMARTBUFF_AddSoloSetup(); SMARTBUFF_AddMsgD("Solo Unit-Setup finished"); end - - collectgarbage(); + --collectgarbage(); end -------------------------------------------------------------------------------------------------------------------------------------- --- SMARTBUFF_AddUnitToClass -------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------- -function SMARTBUFF_AddUnitToClass(unit, i, proll) +function SMARTBUFF_AddUnitToClass(unit, i) local u = unit; local up = "pet"; if (unit ~= "player") then @@ -995,42 +1001,13 @@ function SMARTBUFF_AddUnitToClass(unit, i, proll) end cUnits[1][i] = u; SMARTBUFF_AddMsgD("Unit added: " .. UnitName(u) .. ", " .. u); - local _, uc = UnitClass(u); if (uc and not cClassGroups[uc]) then cClassGroups[uc] = { }; - else - if u and uc then - cClassGroups[uc][i] = u; - end end - - if uc and proll == "MAINTANK" then - if (not cClassGroups["TANK"]) then - cClassGroups["TANK"] = { }; - end - cClassGroups["TANK"][i] = u; - end; - - if (uc and uc == "HUNTER") then - if (not cClassGroups["HPET"]) then - cClassGroups["HPET"] = { }; - end - cClassGroups["HPET"][i] = up; - - elseif (uc and uc == "DEATHKNIGHT") then - if (not cClassGroups["DKPET"]) then - cClassGroups["DKPET"] = { }; - end - cClassGroups["DKPET"][i] = up; - - elseif (uc and (uc == "WARLOCK" or uc == "MAGE")) then - if (not cClassGroups["WPET"]) then - cClassGroups["WPET"] = { }; - end - cClassGroups["WPET"][i] = up; + if (uc) then + cClassGroups[uc][i] = u; end - end end @@ -1039,127 +1016,103 @@ function SMARTBUFF_AddSoloSetup() cGroups[0][0] = "player"; cUnits[0] = { }; cUnits[0][0] = "player"; - if (sPlayerClass == "HUNTER" or sPlayerClass == "WARLOCK" or sPlayerClass == "MAGE") then cGroups[0][1] = "pet"; end + if (sPlayerClass == "HUNTER" or sPlayerClass == "WARLOCK" or sPlayerClass == "DEATHKNIGHT" or sPlayerClass == "MAGE") then cGroups[0][1] = "pet"; end if (B[CS()][currentTemplate] and B[CS()][currentTemplate].SelfFirst) then if (not cClassGroups) then cClassGroups = { }; - end + end cClassGroups[0] = { }; cClassGroups[0][0] = "player"; end end - -- END SMARTBUFF_SetUnits -------------------------------------------------------------------------------------------------------------------------------------- --- SMARTBUFF_GetSpellID --- Read available spells / abilities from spell book including spellid's -------------------------------------------------------------------------------------------------------------------------------------- +-- Get Spell ID from spellbook function SMARTBUFF_GetSpellID(spellname) - - if (spellname) then spellname = string.lower(spellname); else return nil; end - - local i = 0; - local nSpells = 0; - local id = nil; + local i, id = 1, nil; local spellN, spellId, skillType; - - -- Get number of spells - for i = 1, GetNumSpellTabs() do - local _, _, _, n = GetSpellTabInfo(i); - nSpells = nSpells + n; - end - - i = 0; - while (i < nSpells) do - i = i + 1; + if (spellname) then + spellname = string.lower(spellname); + else + return nil; + end + while GetSpellBookItemName(i, BOOKTYPE_SPELL) do spellN = GetSpellBookItemName(i, BOOKTYPE_SPELL); skillType, spellId = GetSpellBookItemInfo(i, BOOKTYPE_SPELL); - if (skillType == "FLYOUT") then for j = 1, GetNumFlyouts() do local fid = GetFlyoutID(j); local name, description, numSlots, isKnown = GetFlyoutInfo(fid) - if (isKnown) then + if (isKnown) then for s = 1, numSlots do - local flySpellID, overrideSpellID, isKnown, spellN, slotSpecID = GetFlyoutSlotInfo(fid, s); - if (isKnown and string.lower(spellN) == spellname) then - return flySpellID; - end - end - end - end + local flySpellID, overrideSpellID, isKnown, spellN, slotSpecID = GetFlyoutSlotInfo(fid, s); + if (isKnown and string.lower(spellN) == spellname) then + return flySpellID; + end + end + end + end end - if (spellN ~= nil and string.lower(spellN) == spellname) then id = spellId; break; end + i = i + 1; end - if (id) then if (IsPassiveSpell(id) or skillType == "FUTURESPELL" or not IsSpellKnown(id)) then id = nil; i = nil; - end + end end - return id, i; end +-- END SMARTBUFF_GetSpellID - -------------------------------------------------------------------------------------------------------------------------------------- --- SMARTBUFF_SetBuffs() --- Setup the buff array -------------------------------------------------------------------------------------------------------------------------------------- +-- Set the buff array function SMARTBUFF_SetBuffs() - if (B == nil) then return; end - + local n = 1; - local buff = nil; + local buff = nil; local ct = currentTemplate; - + if (B[CS()] == nil) then B[CS()] = { }; end - + SMARTBUFF_InitItemList(); SMARTBUFF_InitSpellList(); - + if (B[CS()][ct] == nil) then B[CS()][ct] = { }; B[CS()][ct].SelfFirst = false; end - - if (B[CS()][ct].GrpBuffSize == nil) then - B[CS()][ct].GrpBuffSize = 3; - end - + wipe(cBuffs); wipe(cBuffIndex); numBuffs = 0; - + for _, buff in pairs(SMARTBUFF_BUFFLIST) do n = SMARTBUFF_SetBuff(buff, n, true); - end + end for _, buff in pairs(SMARTBUFF_WEAPON) do n = SMARTBUFF_SetBuff(buff, n); - end + end for _, buff in pairs(SMARTBUFF_RACIAL) do n = SMARTBUFF_SetBuff(buff, n); end - + for _, buff in pairs(SMARTBUFF_TRACKING) do n = SMARTBUFF_SetBuff(buff, n); end - - for _, buff in pairs(SMARTBUFF_POTION) do + + for _, buff in pairs(SMARTBUFF_POTION) do n = SMARTBUFF_SetBuff(buff, n); - end + end for _, buff in pairs(SMARTBUFF_SCROLL) do n = SMARTBUFF_SetBuff(buff, n); @@ -1168,100 +1121,102 @@ function SMARTBUFF_SetBuffs() for _, buff in pairs(SMARTBUFF_FOOD) do n = SMARTBUFF_SetBuff(buff, n); end - + wipe(cBuffsCombat); SMARTBUFF_SetInCombatBuffs(); - + InitBuffOrder(); - + numBuffs = n - 1; isSetBuffs = false; end - -------------------------------------------------------------------------------------------------------------------------------------- --- SMARTBUFF_SetBuff -------------------------------------------------------------------------------------------------------------------------------------- function SMARTBUFF_SetBuff(buff, i, ia) - - if (buff == nil or buff[1] == nil or i > maxScrollButtons) then return i; end - + if (buff == nil or buff[1] == nil) then return i; end cBuffs[i] = nil; - cBuffs[i] = { }; + cBuffs[i] = { }; cBuffs[i].BuffS = buff[1]; cBuffs[i].DurationS = ceil(buff[2] * 60); cBuffs[i].Type = buff[3]; - cBuffs[i].CanCharge = false; + cBuffs[i].CanCharge = false; - if (SMARTBUFF_IsSpell(cBuffs[i].Type) or cBuffs[i].Type == SMARTBUFF_CONST_TRACK) then + if (SMARTBUFF_IsSpell(cBuffs[i].Type)) then cBuffs[i].IDS, cBuffs[i].BookID = SMARTBUFF_GetSpellID(cBuffs[i].BuffS); end - - if (cBuffs[i].IDS == nil and not(SMARTBUFF_IsItem(cBuffs[i].Type))) then + if (cBuffs[i].IDS == nil and not(SMARTBUFF_IsItem(cBuffs[i].Type) or cBuffs[i].Type == SMARTBUFF_CONST_TRACK)) then cBuffs[i] = nil; return i; end if (buff[4] ~= nil) then cBuffs[i].LevelsS = buff[4] else cBuffs[i].LevelsS = nil end if (buff[5] ~= nil) then cBuffs[i].Params = buff[5] else cBuffs[i].Params = SG.NIL end - + cBuffs[i].Links = buff[6]; + cBuffs[i].Chain = buff[7]; if (cBuffs[i].IDS ~= nil) then cBuffs[i].IconS = GetSpellTexture(cBuffs[i].BuffS); else if (cBuffs[i].Type == SMARTBUFF_CONST_TRACK) then - - - elseif (cBuffs[i].Type == SMARTBUFF_CONST_ITEMGROUP) then + local b = false; + for n = 1, C_Minimap.GetNumTrackingTypes() do + local trackN, trackT, trackA, trackC = C_Minimap.GetTrackingInfo(n); + if (trackN ~= nil) then + if (trackN == cBuffs[i].BuffS) then + b = true; + cBuffs[i].IDS = nil; + cBuffs[i].IconS = trackT; + end + end + end + if (not b) then + cBuffs[i] = nil; + return i; + end + elseif (ia or cBuffs[i].Type == SMARTBUFF_CONST_ITEMGROUP) then local _, _, _, _, minLevel, _, _, _, _, texture = GetItemInfo(cBuffs[i].BuffS); if (not IsMinLevel(minLevel)) then cBuffs[i] = nil; - return i; + return i; end cBuffs[i].IconS = texture; - else - local itemsName, _, _, _, minLevel = GetItemInfo(cBuffs[i].BuffS); + local _, _, _, _, minLevel = GetItemInfo(cBuffs[i].BuffS); if (not IsMinLevel(minLevel)) then cBuffs[i] = nil; - return i; + return i; end - local _, _, count, texture = SMARTBUFF_FindItem(cBuffs[i].BuffS, cBuffs[i].Chain); - if (count <= 0) then + + if count then + if (count <= 0) then + cBuffs[i] = nil; + return i; + end + else cBuffs[i] = nil; return i; - else --- print("Found: "..cBuffs[i].BuffS..", count: "..count) - end + end cBuffs[i].IconS = texture; end end - - cBuffs[i].Links = buff[6]; - cBuffs[i].Chain = buff[7]; - cBuffs[i].BuffG = buff[8]; - cBuffs[i].IDG = SMARTBUFF_GetSpellID(cBuffs[i].BuffG); - if (cBuffs[i].IDG ~= nil) then + SMARTBUFF_AddMsgD("Add "..buff[1]); + + cBuffs[i].BuffG = nil; --buff[6]; -- Disabled for Cataclysm + cBuffs[i].IDG = nil; --SMARTBUFF_GetSpellID(cBuffs[i].BuffG); + if (cBuffs[i].IDG ~= nil) then cBuffs[i].IconG = GetSpellTexture(cBuffs[i].BuffG); else cBuffs[i].IconG = nil; end - if (buff[9] ~= nil) then cBuffs[i].DurationG = ceil(buff[9] * 60); else cBuffs[i].DurationG = nil; end - if (buff[10] ~= nil) then cBuffs[i].LevelsG = buff[10]; else cBuffs[i].LevelsG = nil; end - if (buff[11] ~= nil) then cBuffs[i].ReagentG = buff[11]; else cBuffs[i].ReagentG = nil; end - cBuffIndex[cBuffs[i].BuffS] = i; if (cBuffs[i].IDG ~= nil) then cBuffIndex[cBuffs[i].BuffG] = i; end - InitBuffSettings(cBuffs[i]); - + return i + 1; end - function SMARTBUFF_SetInCombatBuffs() local ct = currentTemplate; if (ct == nil or B[CS()] == nil or B[CS()][ct] == nil) then @@ -1284,10 +1239,12 @@ function SMARTBUFF_SetInCombatBuffs() end -- END SMARTBUFF_SetBuffs + function SMARTBUFF_IsTalentFrameVisible() return PlayerTalentFrame and PlayerTalentFrame:IsVisible(); end + -- Main Check functions function SMARTBUFF_PreCheck(mode, force) if (not isInit) then return false end @@ -1302,62 +1259,70 @@ function SMARTBUFF_PreCheck(mode, force) end return false; end - + if (mode == 1 and not force) then if ((GetTime() - tLastCheck) < O.AutoTimer) then return false; end end + tLastCheck = GetTime(); + + -- If buffs can't casted, hide UI elements + if (UnitInVehicle("player") or UnitHasVehicleUI("player")) then + if (not InCombatLockdown() and SmartBuff_KeyButton:IsVisible()) then + SmartBuff_KeyButton:Hide(); + end + return false; + else + SMARTBUFF_ShowSAButton(); + end - tLastCheck = GetTime(); - SMARTBUFF_ShowSAButton(); - --end - SMARTBUFF_SetButtonTexture(SmartBuff_KeyButton, imgSB); - if (SmartBuffOptionsFrame:IsVisible()) then return false; end - + if (SmartBuffOptionsFrame:IsVisible()) then return false; end + -- check for mount-spells - if (sPlayerClass == "PALADIN" and (IsMounted() or IsFlying()) and not O.WarnWhileMounted and not SMARTBUFF_CheckBuff("player", SMARTBUFF_CRUSADERAURA)) then + if (sPlayerClass == "PALADIN" and (IsMounted() or IsFlying()) and not SMARTBUFF_CheckBuff("player", SMARTBUFF_CRUSADERAURA)) then + return true; + elseif (sPlayerClass == "DEATHKNIGHT" and IsMounted() and not SMARTBUFF_CheckBuff("player", SMARTBUFF_PATHOFFROST)) then return true; end - - if ((mode == 1 and not O.ToggleAuto) or not O.WarnWhileMounted and (IsMounted() or IsFlying() or LootFrame:IsVisible()) + if ((mode == 1 and not O.ToggleAuto) or IsMounted() or IsFlying() or LootFrame:IsVisible() or UnitOnTaxi("player") or UnitIsDeadOrGhost("player") or UnitIsCorpse("player") or (mode ~= 1 and (SMARTBUFF_IsPicnic("player") or SMARTBUFF_IsFishing("player"))) or (UnitInVehicle("player") or UnitHasVehicleUI("player")) or (not O.BuffInCities and IsResting() and not UnitIsPVP("player"))) then - + if (UnitIsDeadOrGhost("player")) then SMARTBUFF_CheckBuffTimers(); - end - + end + return false; end - if (UnitAffectingCombat("player")) then isCombat = true; else isCombat = false; end - + if (not isCombat and isSetBuffs) then SMARTBUFF_SetBuffs(); isSyncReq = true; - end - + end + sMsgWarning = ""; isFirstError = true; - + return true; end + -- Bufftimer check functions function SMARTBUFF_CheckBuffTimers() local n = 0; - local ct = currentTemplate; + local ct = currentTemplate; local cGrp = cUnits; for subgroup in pairs(cGrp) do - n = 0; + n = 0; if (cGrp[subgroup] ~= nil) then for _, unit in pairs(cGrp[subgroup]) do if (unit) then @@ -1382,27 +1347,27 @@ function SMARTBUFF_CheckUnitBuffTimers(unit) local fd = nil; if (uc == "HUNTER") then fd = SMARTBUFF_IsFeignDeath(unit); - end + end if (not fd) then if (cBuffTimer[unit]) then cBuffTimer[unit] = nil; - SMARTBUFF_AddMsgD(UnitName(unit) .. ": unit timer reset"); + SMARTBUFF_AddMsgD(UnitName(unit) .. ": unit timer reseted"); end if (cBuffTimer[uc]) then cBuffTimer[uc] = nil; - SMARTBUFF_AddMsgD(uc .. ": class timer reset"); + SMARTBUFF_AddMsgD(uc .. ": class timer reseted"); end return true; end end end - -- END SMARTBUFF_CheckUnitBuffTimers + -- Reset the buff timers and set them to running out soon function SMARTBUFF_ResetBuffTimers() if (not isInit) then return; end - + local ct = currentTemplate; local t = GetTime(); local rbTime = 0; @@ -1414,12 +1379,12 @@ function SMARTBUFF_ResetBuffTimers() local unit = nil; local obj = nil; local uc = nil; - + local cGrp = cGroups; for subgroup in pairs(cGrp) do - n = 0; + n = 0; if (cGrp[subgroup] ~= nil) then - + for _, unit in pairs(cGrp[subgroup]) do if (unit and UnitExists(unit) and UnitIsConnected(unit) and UnitIsFriend("player", unit) and UnitIsPlayer(unit) and not UnitIsDeadOrGhost(unit)) then _, uc = UnitClass(unit); @@ -1429,25 +1394,25 @@ function SMARTBUFF_ResetBuffTimers() buff = nil; rbTime = 0; buffS = cBuffs[i].BuffS; - + rbTime = B[CS()][ct][buffS].RBTime; if (rbTime <= 0) then rbTime = O.RebuffTimer; end - + if (cBuffs[i].BuffG and B[CS()][ct][buffS].EnableG and cBuffs[i].IDG ~= nil and cBuffs[i].DurationG > 0) then d = cBuffs[i].DurationG; buff = cBuffs[i].BuffG; obj = subgroup; end - + if (d > 0 and buff) then if (not cBuffTimer[obj]) then cBuffTimer[obj] = { }; end cBuffTimer[obj][buff] = t - d + rbTime - 1; - end - + end + buff = nil; if (buffS and B[CS()][ct][buffS].EnableS and cBuffs[i].IDS ~= nil and cBuffs[i].DurationS > 0 and uc and B[CS()][ct][buffS][uc]) then @@ -1455,27 +1420,27 @@ function SMARTBUFF_ResetBuffTimers() buff = buffS; obj = unit; end - + if (d > 0 and buff) then if (not cBuffTimer[obj]) then cBuffTimer[obj] = { }; end cBuffTimer[obj][buff] = t - d + rbTime - 1; end - + i = i + 1; end + end end end end - --isAuraChanged = true; SMARTBUFF_Check(1, true); end function SMARTBUFF_ShowBuffTimers() if (not isInit) then return; end - + local ct = currentTemplate; local t = GetTime(); local rbTime = 0; @@ -1483,11 +1448,11 @@ function SMARTBUFF_ShowBuffTimers() local d = 0; local tl = 0; local buffS = nil; - + for unit in pairs(cBuffTimer) do for buff in pairs(cBuffTimer[unit]) do - if (unit and buff and cBuffTimer[unit][buff]) then - + if (unit and buff and cBuffTimer[unit][buff]) then + d = -1; buffS = nil; if (cBuffIndex[buff]) then @@ -1501,7 +1466,7 @@ function SMARTBUFF_ShowBuffTimers() end i = i + 1; end - + if (buffS and B[CS()][ct][buffS] ~= nil) then if (d > 0) then rbTime = B[CS()][ct][buffS].RBTime; @@ -1509,7 +1474,7 @@ function SMARTBUFF_ShowBuffTimers() rbTime = O.RebuffTimer; end tl = cBuffTimer[unit][buff] + d - t; - if (tl >= 0) then + if (tl >= 0) then local s = ""; if (string.find(unit, "^party") or string.find(unit, "^raid") or string.find(unit, "^player") or string.find(unit, "^pet")) then local un = UnitName(unit); @@ -1524,45 +1489,39 @@ function SMARTBUFF_ShowBuffTimers() else s = "Class " .. unit; end - -- SMARTBUFF_AddMsg(string.format("%s: %s, time left: %.0f, rebuff time: %.0f", s, buff, tl, rbTime)); + SMARTBUFF_AddMsg(string.format("%s: %s, time left: %.0f, rebuff time: %.0f", s, buff, tl, rbTime)); else cBuffTimer[unit][buff] = nil; end else - --SMARTBUFF_AddMsgD("Removed: " .. buff); cBuffTimer[unit][buff] = nil; end end - + end end end - + end -- END SMARTBUFF_ResetBuffTimers + -- Synchronize the internal buff timers with the UI timers function SMARTBUFF_SyncBuffTimers() if (not isInit or isSync or isSetBuffs or SMARTBUFF_IsTalentFrameVisible()) then return; end isSync = true; tSync = GetTime(); - - local ct = currentTemplate; + + local ct = currentTemplate; local rbTime = 0; local i = 0; local buffS = nil; local unit = nil; local uc = nil; - - local cGrp = nil; - if (sPlayerClass == "PALADIN" and cClassGroups) then - cGrp = cClassGroups; - else - cGrp = cGroups; - end - + + local cGrp = cGroups; for subgroup in pairs(cGrp) do - n = 0; + n = 0; if (cGrp[subgroup] ~= nil) then for _, unit in pairs(cGrp[subgroup]) do if (unit and UnitExists(unit) and UnitIsConnected(unit) and UnitIsFriend("player", unit) and UnitIsPlayer(unit) and not UnitIsDeadOrGhost(unit)) then @@ -1571,46 +1530,35 @@ function SMARTBUFF_SyncBuffTimers() while (cBuffs[i] and cBuffs[i].BuffS) do rbTime = 0; buffS = cBuffs[i].BuffS; - + + -- TOCHECK rbTime = B[CS()][ct][buffS].RBTime; if (rbTime <= 0) then rbTime = O.RebuffTimer; end - - if (cBuffs[i].BuffG and B[CS()][ct][buffS].EnableG and cBuffs[i].IDG ~= nil and cBuffs[i].DurationG > 0) then - SMARTBUFF_SyncBuffTimer(unit, subgroup, cBuffs[i], true); - end - + if (buffS and B[CS()][ct][buffS].EnableS and cBuffs[i].IDS ~= nil and cBuffs[i].DurationS > 0) then if (cBuffs[i].Type ~= SMARTBUFF_CONST_SELF or (cBuffs[i].Type == SMARTBUFF_CONST_SELF and SMARTBUFF_IsPlayer(unit))) then - SMARTBUFF_SyncBuffTimer(unit, unit, cBuffs[i], false); + SMARTBUFF_SyncBuffTimer(unit, unit, cBuffs[i]); end end - + i = i + 1; end -- END while end end -- END for end end -- END for - + isSync = false; isSyncReq = false; end -function SMARTBUFF_SyncBuffTimer(unit, grp, cBuff, isGrpBuff) +function SMARTBUFF_SyncBuffTimer(unit, grp, cBuff) if (not unit or not grp or not cBuff) then return end - - local buff, d; - if (isGrpBuff) then - d = cBuff.DurationG; - buff = cBuff.BuffG; - else - d = cBuff.DurationS; - buff = cBuff.BuffS; - end - + local d = cBuff.DurationS; + local buff = cBuff.BuffS; if (d and d > 0 and buff) then local t = GetTime(); local ret, _, _, timeleft = SMARTBUFF_CheckUnitBuffs(unit, buff, cBuff.Type, cBuff.Links, cBuff.Chain); @@ -1640,11 +1588,11 @@ function SMARTBUFF_IsShapeshifted() local i; for i = 1, GetNumShapeshiftForms(), 1 do local icon, active, castable, spellId = GetShapeshiftFormInfo(i); - local name = GetSpellInfo(spellId); + local name = GetSpellInfo(spellId); if (active and castable and name ~= SMARTBUFF_DRUID_TREANT) then return true, name; end - end + end end return false, nil; end @@ -1654,9 +1602,7 @@ end local IsChecking = false; function SMARTBUFF_Check(mode, force) if (IsChecking or not SMARTBUFF_PreCheck(mode, force)) then return; end - IsChecking = true; - local ct = currentTemplate; local unit = nil; local units = nil; @@ -1678,255 +1624,81 @@ function SMARTBUFF_Check(mode, force) local rank; local reagent; local nGlobal = 0; - local tmpDisabled = { }; - - local buffs = nil; - if (SMARTBUFF_Buffs[CS()]) then - buffs = SMARTBUFF_Buffs[CS()][ct]; - end - - SMARTBUFF_checkBlacklist(); - + + SMARTBUFF_checkBlacklist(); + -- 1. check in combat buffs if (InCombatLockdown()) then -- and O.InCombat for spell in pairs(cBuffsCombat) do if (spell) then local ret, actionType, spellName, slot, unit, buffType = SMARTBUFF_BuffUnit("player", 0, mode, spell) + SMARTBUFF_AddMsgD("Check combat spell: " .. spell .. ", ret = " .. ret); if (ret and ret == 0) then IsChecking = false; return; end end - end + end end - + -- 2. buff target, if enabled if ((mode == 0 or mode == 5) and O.BuffTarget) then - local actionType, spellName, slot, buffType, rankText; - i, actionType, spellName, slot, _, buffType, rankText = SMARTBUFF_BuffUnit("target", 0, mode); + local actionType, spellName, slot, buffType; + i, actionType, spellName, slot, _, buffType = SMARTBUFF_BuffUnit("target", 0, mode); if (i <= 1) then if (i == 0) then --tLastCheck = GetTime() - O.AutoTimer + GlobalCd; end IsChecking = false; - return i, actionType, spellName, slot, "target", buffType, rankText; - end - end - + return i, actionType, spellName, slot, "target", buffType; + end + end + -- 3. check groups - local cGrp = nil; - local cOrd = nil; - cGrp = cGroups; - cOrd = cOrderGrp; - - isMounted = (IsMounted() or IsFlying()) and not O.WarnWhileMounted; + local cGrp = cGroups; + local cOrd = cOrderGrp; + isMounted = IsMounted() or IsFlying(); for _, subgroup in pairs(cOrd) do if (cGrp[subgroup] ~= nil or (type(subgroup) == "number" and subgroup == 1)) then - + if (cGrp[subgroup] ~= nil) then units = cGrp[subgroup]; else - units = nil; - end - - if (cUnits and type(subgroup) == "number" and subgroup == 1) then - unitsGrp = cUnits[1]; - else - unitsGrp = units; - end - - -- check group buff - if (buffs and unitsGrp and not isMounted) then - - i = 1; - local rbTime = 0; - while (cBuffs[i] and cBuffs[i].BuffS) do - local cBuff = cBuffs[i]; - local buffnS = cBuff.BuffS; - local buffnG = cBuff.BuffG; - local bs = buffs[buffnS]; - - if (buffnG and tmpDisabled[buffnG] == nil and bs and bs.EnableG and cBuff.IDG ~= nil - and ((isCombat and bs.CIn) or (not isCombat and bs.COut)) and IsPowerLimitOk(bs) - --and UnitMana("player") >= bs.ManaLimit - and (sPlayerClass ~= "PALADIN" or not cClassGroups or (sPlayerClass == "PALADIN" and (bs[subgroup] or (type(subgroup) == "number" and subgroup == 0))))) then - - local tmpUnits = { }; - local btl = 9999; - local bExp = false; - local target = ""; - - if (sPlayerClass == "PALADIN" and cClassGroups) then - for _, unit in pairs(units) do - local u = UnitClass(unit); - if (u) then - target = SMARTBUFF_MSG_CLASS .. " " .. u; - SMARTBUFF_AddMsgD(target); - break; - end - end - else - --target = SMARTBUFF_MSG_GROUP .. " " .. subgroup; - target = SMARTBUFF_MSG_GROUP; - end - - if (type(subgroup) == "number" and subgroup == 0) then - target = sPlayerName; - end - - rbTime = bs.RBTime; - if (rbTime <= 0) then - rbTime = SMARTBUFF_Options.RebuffTimer; - end - - if (cBuffTimer[subgroup] ~= nil and cBuffTimer[subgroup][buffnG] ~= nil) then - btl = cBuff.DurationG - (GetTime() - cBuffTimer[subgroup][buffnG]); - if (rbTime > 0 and rbTime >= btl) then - bExp = true; - if (mode == 1) then - -- clean up buff timer, if expired - if (btl < 0) then - cBuffTimer[subgroup][buffnG] = nil; - tLastCheck = GetTime() - SMARTBUFF_Options.AutoTimer + 0.5; - return; - end - end - end - end - - SMARTBUFF_AddMsgD("Checking0 " .. buffnG); - n = 0; - m = 0; - j = 0; - uLevelL = 100; - uLevelU = 0; - unitL = nil; - unitU = nil; - unitB = nil; - for _, unit in pairs(unitsGrp) do - j = j + 1; - SMARTBUFF_AddMsgD("Checking1 " .. buffnG .. " " .. unit); - if (unit and UnitIsPlayer(unit) and not SMARTBUFF_IsInList(unit, UnitName(unit), bs.IgnoreList)) then - SMARTBUFF_AddMsgD("Checking2 " .. buffnG .. " " .. unit); - n = n + 1; - if (UnitExists(unit) and not UnitIsDeadOrGhost(unit) and not UnitIsCorpse(unit) and UnitIsConnected(unit) and UnitIsVisible(unit) and not UnitOnTaxi(unit) and UnitInRange(unit) == 1) then - tmpUnits[n] = unit; - uLevel = UnitLevel(unit); - if (uLevel < uLevelL) then - uLevelL = uLevel; - unitL = unit; - end - if (uLevel > uLevelU) then - uLevelU = uLevel; - unitU = unit; - unitB = unit; - end - local ret, idx, buffname; - ret, idx, buffname = SMARTBUFF_CheckUnitBuffs(unit, nil, buffnG); - if (ret ~= nil or bExp) then - m = m + 1; - end - end - end - - end -- end for units - - if (mode == 1 and m >= buffs.GrpBuffSize and n >= buffs.GrpBuffSize) then - SMARTBUFF_SetMissingBuffMessage(target, buffnG, false, 1, btl, bExp, false); - SMARTBUFF_SetButtonTexture(SmartBuff_KeyButton, cBuff.IconG); - return; - end - - if (unitL ~= nil and unitU ~=nil and unitB ~= nil and cBuff.IDG ~= nil) then - idU, rank = SMARTBUFF_CheckUnitLevel(unitU, cBuff.IDG, cBuff.LevelsG); - idL, rank = SMARTBUFF_CheckUnitLevel(unitL, cBuff.IDG, cBuff.LevelsG); - - if (idL ~= nil and idU ~= nil and idL == idU and rank > 0 and m >= buffs.GrpBuffSize and n >= buffs.GrpBuffSize) then - - reagent = cBuff.ReagentG[rank]; - if (reagent and mode ~= 1) then - rc = SMARTBUFF_CountReagent(reagent); - if (rc > 0) then - currentUnit = nil; - currentSpell = nil; - - SMARTBUFF_AddMsgD("Buffing group (" .. unitB .. ") " .. subgroup .. ", " .. idU .. ", " .. j .. ", "); - j = SMARTBUFF_doCast(unitB, idU, buffnG, nil, SMARTBUFF_CONST_ALL) - - if (j == 0) then - SMARTBUFF_AddMsg(target .. ": " .. buffnG .. " " .. SMARTBUFF_MSG_BUFFED); - SMARTBUFF_AddMsg(SMARTBUFF_MSG_STOCK .. " " .. reagent .. " = " .. (rc - 1)); - - if (sPlayerClass == "PALADIN") then - local _, uc = UnitClass(unitB); - if (cBuffTimer[uc] == nil) then - cBuffTimer[uc] = { }; - end - cBuffTimer[uc][buffnG] = GetTime(); - else - if (cBuffTimer[subgroup] == nil) then - cBuffTimer[subgroup] = { }; - end - cBuffTimer[subgroup][buffnG] = GetTime(); - end - - -- cleanup single buff timer - for _, unit in pairs(tmpUnits) do - if (cBuffTimer[unit] and cBuffTimer[unit][buffnS]) then - cBuffTimer[unit][buffnS] = nil; - end - end - - --tLastCheck = GetTime() - SMARTBUFF_Options.AutoTimer + GlobalCd; - return 0, SMARTBUFF_ACTION_SPELL, buffnG, -1, unitB, cBuff.Type; - end - else - SMARTBUFF_AddMsgWarn(SMARTBUFF_MSG_NOREAGENT .. " " .. reagent .. "! " .. buffnG .. " " .. SMARTBUFF_MSG_DEACTIVATED); - tmpDisabled[buffnG] = true; - --tinsert(tmpDisabled, buffnG); - --bs.EnableG = false; - end - elseif (reagent and mode == 1) then - SMARTBUFF_SetMissingBuffMessage(target, buffnG, false, 1, btl, bExp, false); - SMARTBUFF_SetButtonTexture(SmartBuff_KeyButton, cBuff.IconG); - return; - else - --SMARTBUFF_AddMsgD("Reagent = nil"); - end - end - end - end - - i = i + 1; - end -- END while buffs + units = nil; end - + + if (cUnits and type(subgroup) == "number" and subgroup == 1) then + unitsGrp = cUnits[1]; + else + unitsGrp = units; + end + -- check buffs if (units) then for _, unit in pairs(units) do if (isSetBuffs) then break; end - if ((UnitInRange(unit) or unit == "player")) then -- unit range checking doesnt work with "player", and only party or raid units. - local spellName, actionType, slot, buffType, rankText; - i, actionType, spellName, slot, _, buffType, rankText = SMARTBUFF_BuffUnit(unit, subgroup, mode); - if (i <= 1) then - if (i == 0 and mode ~= 1) then - --tLastCheck = GetTime() - O.AutoTimer + GlobalCd; - if (actionType == SMARTBUFF_ACTION_ITEM) then - --tLastCheck = tLastCheck + 2; - end - end - IsChecking = false; - return i, actionType, spellName, slot, unit, buffType, rankText; + SMARTBUFF_AddMsgD("Checking single unit = "..unit); + local spellName, actionType, slot, buffType; + i, actionType, spellName, slot, _, buffType = SMARTBUFF_BuffUnit(unit, subgroup, mode); + + if (i <= 1) then + if (i == 0 and mode ~= 1) then + --tLastCheck = GetTime() - O.AutoTimer + GlobalCd; + if (actionType == SMARTBUFF_ACTION_ITEM) then + --tLastCheck = tLastCheck + 2; end - end + end + IsChecking = false; + return i, actionType, spellName, slot, unit, buffType; + end end end - + end end -- for groups - - if (mode == 0) then + + if (mode == 0) then if (sMsgWarning == "" or sMsgWarning == " ") then SMARTBUFF_AddMsg(SMARTBUFF_MSG_NOTHINGTODO); else @@ -1934,7 +1706,6 @@ function SMARTBUFF_Check(mode, force) sMsgWarning = ""; end end - --tLastCheck = GetTime(); IsChecking = false; end -- END SMARTBUFF_Check @@ -1952,7 +1723,6 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) local uct = nil; local ucf = nil; local r; - local rankText; local i; local bt = 0; local cd = 0; @@ -1968,35 +1738,27 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) local cBuff = nil; local iId = nil; local iSlot = -1; - + if (UnitIsPVP("player")) then isPvP = true end - - SMARTBUFF_CheckUnitBuffTimers(unit); - - --SMARTBUFF_AddMsgD("Checking " .. unit); - - if (UnitExists(unit) and UnitIsFriend("player", unit) and not UnitIsDeadOrGhost(unit) and not UnitIsCorpse(unit) - and UnitIsConnected(unit) and UnitIsVisible(unit) and not UnitOnTaxi(unit) and not cBlacklist[unit] - and ((not UnitIsPVP(unit) and (not isPvP or O.BuffPvP)) or (UnitIsPVP(unit) and (isPvP or O.BuffPvP)))) then - --and not SmartBuff_UnitIsIgnored(unit) - + + SMARTBUFF_CheckUnitBuffTimers(unit); + + if (UnitExists(unit) and UnitIsFriend("player", unit) and not UnitIsDeadOrGhost(unit) and not UnitIsCorpse(unit) and (UnitInRange(unit) or unit == "player") + and UnitIsConnected(unit) and UnitIsVisible(unit) and not UnitOnTaxi(unit) and not cBlacklist[unit] and ((not UnitIsPVP(unit) and (not isPvP or O.BuffPvP)) + or (UnitIsPVP(unit) and (isPvP or O.BuffPvP)))) then + _, uc = UnitClass(unit); un = UnitName(unit); ur = UnitGroupRolesAssigned(unit); uct = UnitCreatureType(unit); ucf = UnitCreatureFamily(unit); if (uct == nil) then uct = ""; end - if (ucf == nil) then ucf = ""; end - - -- debug --- if (un) then SMARTBUFF_AddMsgD("Grp "..subgroup.." checking "..un.." ("..unit.."/"..uc.."/"..ur.."/"..uct.."/"..ucf..")", 0, 1, 0.5); end + if (ucf == nil) then ucf = ""; end isShapeshifted, sShapename = SMARTBUFF_IsShapeshifted(); - --while (cBuffs[i] and cBuffs[i].BuffS) do - for i, buffnS in pairs(B[CS()].Order) do + for i, buffnS in pairs(B[CS()].Order) do if (isSetBuffs or SmartBuffOptionsFrame:IsVisible()) then break; end cBuff = cBuffs[cBuffIndex[buffnS]]; - --buffnS = cBuff.BuffS; bs = GetBuffSettings(buffnS); bExpire = false; handtype = ""; @@ -2005,103 +1767,154 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) bUsable = false; iId = nil; iSlot = -1; - - if (not cBuff or not bs) then bUsable = false end + if (cBuff and bs) then bUsable = bs.EnableS end - + if (bUsable and spell and spell ~= buffnS) then bUsable = false; + SMARTBUFF_AddMsgD("Exclusive check on " .. spell .. ", current spell = " .. buffnS); end - if (bUsable and cBuff.Type == SMARTBUFF_CONST_SELF and not SMARTBUFF_IsPlayer(unit)) then bUsable = false end if (bUsable and not cBuff.Type == SMARTBUFF_CONST_TRACK and not SMARTBUFF_IsItem(cBuff.Type) and not IsUsableSpell(buffnS)) then bUsable = false end if (bUsable and bs.SelfNot and SMARTBUFF_IsPlayer(unit)) then bUsable = false end if (bUsable and cBuff.Params == SG.CheckFishingPole and SMARTBUFF_IsFishingPoleEquiped()) then bUsable = false end - - -- Check for power threshold - if (bUsable) then - bUsable = IsPowerLimitOk(bs); - end - + -- Check for buffs which depends on a pet if (bUsable and cBuff.Params == SG.CheckPet and UnitExists("pet")) then bUsable = false end if (bUsable and cBuff.Params == SG.CheckPetNeeded and not UnitExists("pet")) then bUsable = false end - + -- Check for mount auras + if (bUsable and (sPlayerClass == "PALADIN" or sPlayerClass == "DEATHKNIGHT")) then isMounted = false; - if (bUsable and sPlayerClass == "PALADIN") then - isMounted = (IsMounted() or IsFlying()) and not O.WarnWhileMounted; - if ((buffnS ~= SMARTBUFF_CRUSADERAURA and isMounted) or (buffnS == SMARTBUFF_CRUSADERAURA and not isMounted)) then - bUsable = false; - end - end + if (sPlayerClass == "PALADIN") then + isMounted = IsMounted() or IsFlying(); + if ((buffnS ~= SMARTBUFF_CRUSADERAURA and isMounted) or (buffnS == SMARTBUFF_CRUSADERAURA and not isMounted)) then + bUsable = false; + end + elseif (sPlayerClass == "DEATHKNIGHT") then + isMounted = IsMounted(); + if (buffnS ~= SMARTBUFF_PATHOFFROST and isMounted) then + bUsable = false; + end + end + end - -- check for hunter pet spawn and ignore call pet if its already active - if (bUsable and sPlayerClass == "HUNTER") then - if (buffnS == SMARTBUFF_CALLPET and IsPetActive()) then - bUsable = false; + -- tracking switching, check if we are active and not disabled while in a raid. + if (bUsable and O.TrackSwitchActive and not cDisableTrackSwitch) and (buffnS == SMARTBUFF_FINDMINERALS or buffnS == SMARTBUFF_FINDHERBS or buffnS == SMARTBUFF_FINDFISH) then + SMARTBUFF_AddMsgD(buffnS..SMARTBUFF_TRACKSWITCHMSG) + bUsable = false; + end + + -- check for mage conjured items + if (bUsable and sPlayerClass == "MAGE") then + local lookupData + if (buffnS == SMARTBUFF_CONJFOOD or buffnS == SMARTBUFF_CONJREFRESHMENT) then lookupData = ConjuredMageFood + elseif (buffnS == SMARTBUFF_CONJWATER or buffnS == SMARTBUFF_CONJREFRESHMENT) then lookupData = ConjuredMageWater + elseif buffnS == SMARTBUFF_CREATEMGEM then lookupData = ConjuredMageGems end + if lookupData then + for count, value in next, lookupData do + if value then + itemInfo = GetItemInfo(value) + if SMARTBUFF_CheckBagItem(itemInfo) then + bUsable = false; + end + end + end end - end + end + + -- check for warlock conjured items + if (bUsable and sPlayerClass == "WARLOCK") then + local itemInfo, bag, slot, count, maxHealth, currentHealth, lookupData + itemInfo = GetItemInfo(6265) -- 6265 is id for soul shards + if SMARTBUFF_CheckBagItem(itemInfo) then -- only if we have soul shards + -- point to the correct data. + if buffnS == SMARTBUFF_CREATEHS then lookupData = ConjuredLockHealthStones + elseif buffnS == SMARTBUFF_CREATESOULS then lookupData = ConjuredLockSoulstones + elseif buffnS == SMARTBUFF_CREATESPELLS then lookupData = ConjuredLockSpellstones + elseif buffnS == SMARTBUFF_CREATEFIRES then lookupData = ConjuredLockFirestones end + if lookupData then + for count, value in next, lookupData do + if value then + itemInfo = GetItemInfo(value) + if SMARTBUFF_CheckBagItem(itemInfo) then + bUsable = false; + end + end + end + end + else + SMARTBUFF_AddMsgD(itemInfo.." is missing in bag, cannot continue."); + end + -- am i being prompted to use a healthstone, + -- check my health so im not spammed. + currentHealth = UnitHealth("player") + maxHealth = UnitHealthMax("player"); + for count, value in next, ConjuredLockHealthStones do + if value then + _,itemInfo = GetItemInfo(value) + if buffnS == itemInfo and currentHealth == maxHealth then + bUsable = false; + end + end + end + end - -- check if daily island buff is active - if (bUsable and CheckForBuff(SMARTBUFF_KIRUSSOV) and (sPlayerClass == "PRIEST" or sPlayerClass == "MAGE")) then - -- island buff is more powerful than the class buffs which prevents the addon moving past this. - if (buffnS == SMARTBUFF_AI or buffnS == SMARTBUFF_ABRB1 or buffnS == SMARTBUFF_PWF or buffnS == SMARTBUFF_POFRB1) then + -- extra testing for revive pet on hunters, + -- only allow if the pet is actually dead + if (bUsable and sPlayerClass == "HUNTER") and buffnS == SMARTBUFF_REVIVEPET then + if not UnitIsDead("pet") then + SMARTBUFF_AddMsgD("Pet appears to be very much alive!"); bUsable = false; + else + SMARTBUFF_AddMsgD("Pet appears to be dead, revive available."); end end - -- check for Fel Intelligence - if (bUsable and CheckForBuff(SMARTBUFF_FELINTELLIGENCE) and (sPlayerClass == "PRIEST" or sPlayerClass == "MAGE")) then - if (buffnS == SMARTBUFF_AI or buffnS == SMARTBUFF_ABRB1 or buffnS == SMARTBUFF_DS or buffnS == SMARTBUFF_POSRB1) then - bUsable = false; - end - end if (bUsable and not (cBuff.Type == SMARTBUFF_CONST_TRACK or SMARTBUFF_IsItem(cBuff.Type))) then -- check if you have enough mana/rage/energy to cast local isUsable, notEnoughMana = IsUsableSpell(buffnS); if (notEnoughMana) then bUsable = false; - --SMARTBUFF_AddMsgD("Buff " .. cBuff.BuffS .. ", not enough mana!"); + SMARTBUFF_AddMsgD("Buff " .. cBuff.BuffS .. ", not enough mana!"); elseif (mode ~= 1 and isUsable == nil and buffnS ~= SMARTBUFF_PWS) then bUsable = false; - --SMARTBUFF_AddMsgD("Buff " .. cBuff.BuffS .. " is not usable!"); + SMARTBUFF_AddMsgD("Buff " .. cBuff.BuffS .. " is not usable!"); end - end - + end + if (bUsable and bs.EnableS and (cBuff.IDS ~= nil or SMARTBUFF_IsItem(cBuff.Type) or cBuff.Type == SMARTBUFF_CONST_TRACK) and ((mode ~= 1 and ((isCombat and bs.CIn) or (not isCombat and bs.COut))) - or (mode == 1 and bs.Reminder and ((not isCombat and bs.COut) - or (isCombat and (bs.CIn or O.ToggleAutoCombat)))))) then - - --print("Check: "..buffnS) - + or (mode == 1 and bs.Reminder and ((not isCombat and bs.COut) + or (isCombat and (bs.CIn or O.ToggleAutoCombat)))))) then + if (not bs.SelfOnly or (bs.SelfOnly and SMARTBUFF_IsPlayer(unit))) then -- get current spell cooldown cd = 0; cds = 0; if (cBuff.IDS) then cds, cd = GetSpellCooldown(buffnS); - cd = (cds + cd) - time; + cd = (cds + cd) - GetTime(); if (cd < 0) then cd = 0; end - --SMARTBUFF_AddMsgD(buffnS.." cd = "..cd); + SMARTBUFF_AddMsgD(buffnS.." cd = "..cd); end - + -- check if spell has cooldown if (cd <= 0 or (mode == 1 and cd <= 1.5)) then if (cBuff.IDS and sMsgWarning == SMARTBUFF_MSG_CD) then sMsgWarning = " "; end - + rbTime = bs.RBTime; if (rbTime <= 0) then rbTime = O.RebuffTimer; end - - --SMARTBUFF_AddMsgD(uc.." "..CT()); + + SMARTBUFF_AddMsgD(uc.." "..CT()); + if (not SMARTBUFF_IsInList(unit, un, bs.IgnoreList) and (((cBuff.Type == SMARTBUFF_CONST_GROUP or cBuff.Type == SMARTBUFF_CONST_ITEMGROUP) and (bs[ur] or (bs.SelfOnly and SMARTBUFF_IsPlayer(unit)) @@ -2112,91 +1925,80 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) or (cBuff.Type ~= SMARTBUFF_CONST_GROUP and SMARTBUFF_IsPlayer(unit)) or SMARTBUFF_IsInList(unit, un, bs.AddList))) then buff = nil; - - --Tracking ability ------------------------------------------------------------------------ - - if (cBuff.Type == SMARTBUFF_CONST_TRACK) then - if wowTOC >= 20502 then - -- assume we are TBC Classic or higher - local count = (C_Minimap.GetNumTrackingTypes())+1; -- GetNumTrackingTypes doesnt count "none" so add one to include it. - local trackingFound; - for n = 1, count do - local trackN, trackT, trackA, trackC = C_Minimap.GetTrackingInfo(n); - if trackN == buffnS and trackA then - trackingFound = true; - break; - else - trackingFound = false; - end - end - if not trackingFound then - if (sPlayerClass ~= "DRUID" or ((not isShapeshifted and buffnS ~= SMARTBUFF_DRUID_TRACK) or (isShapeshifted and buffnS ~= SMARTBUFF_DRUID_TRACK) or (isShapeshifted and buffnS == SMARTBUFF_DRUID_TRACK and sShapename == SMARTBUFF_DRUID_CAT))) then - buff = buffnS; - end - end - else - -- we are below the minimal tbc build, assume its classic era / season of mastery. - local iconTrack = GetTrackingTexture(); - if (iconTrack ~= nil) then - SMARTBUFF_AddMsgD("Track already enabled: " .. iconTrack); - else - if (sPlayerClass ~= "DRUID" or ((not isShapeshifted and buffnS ~= SMARTBUFF_DRUID_TRACK) or (isShapeshifted and buffnS ~= SMARTBUFF_DRUID_TRACK) or (isShapeshifted and buffnS == SMARTBUFF_DRUID_TRACK and sShapename == SMARTBUFF_DRUID_CAT))) then - buff = buffnS; - SMARTBUFF_AddMsgD("Missing tracking: "..buffnS); - end - end - end - - -- Food, Scroll, Potion or conjured items ------------------------------------------------------------------------ - elseif (cBuff.Type == SMARTBUFF_CONST_FOOD or cBuff.Type == SMARTBUFF_CONST_SCROLL or cBuff.Type == SMARTBUFF_CONST_POTION or - cBuff.Type == SMARTBUFF_CONST_ITEM or cBuff.Type == SMARTBUFF_CONST_ITEMGROUP) then - - if (cBuff.Type == SMARTBUFF_CONST_ITEM) then - bt = nil; - buff = nil; - if (cBuff.Params ~= SG.NIL) then - local cr = SMARTBUFF_CountReagent(cBuff.Params, cBuff.Chain); - if (cr == 0) then - buff = cBuff.Params; - end - end - - -- only prompt / apply food when I am not moving - this would constantly use food - -- in your bags if you were moving - bugfix 03/12/2021. + -- Tracking ability ------------------------------------------------------------------------ + if (cBuff.Type == SMARTBUFF_CONST_TRACK) then + local count = C_Minimap.GetNumTrackingTypes(); + for n = 1, C_Minimap.GetNumTrackingTypes() do + local trackN, trackT, trackA, trackC = C_Minimap.GetTrackingInfo(n); + if (trackN ~= nil and not trackA) then + SMARTBUFF_AddMsgD(n..". "..trackN.." ("..trackC..")"); + if (trackN == buffnS) then + if (sPlayerClass == "DRUID" and buffnS == SMARTBUFF_DRUID_TRACK) then + if (isShapeshifted and sShapename == SMARTBUFF_DRUID_CAT) then + buff = buffnS; + C_Minimap.SetTracking(n, 1); -- bugfix: not referencing C_Minimap. 7/5/2023 + end + else + buff = buffnS; + C_Minimap.SetTracking(n, 1); + end + if (buff ~= nil) then + SMARTBUFF_AddMsgD("Tracking enabled: "..buff); + buff = nil; + end + end + end + end + -- Food, Scroll, Potion or conjured items ------------------------------------------------------------------------ + elseif (cBuff.Type == SMARTBUFF_CONST_FOOD or cBuff.Type == SMARTBUFF_CONST_SCROLL or cBuff.Type == SMARTBUFF_CONST_POTION or cBuff.Type == SMARTBUFF_CONST_ITEM or + cBuff.Type == SMARTBUFF_CONST_ITEMGROUP) then + + if (cBuff.Type == SMARTBUFF_CONST_ITEM) then + bt = nil; + buff = nil; + if (cBuff.Params ~= SG.NIL) then + local cr = SMARTBUFF_CountReagent(cBuff.Params, cBuff.Chain); + SMARTBUFF_AddMsgD(cr.." "..cBuff.Params.." found"); + if (cr == 0) then + buff = cBuff.Params; + end + end + + -- dont attempt to use food while moving or we will waste them. elseif (cBuff.Type == SMARTBUFF_CONST_FOOD and isPlayerMoving == false) then if (not SMARTBUFF_IsPicnic(unit)) then buff, index, buffname, bt, charges = SMARTBUFF_CheckUnitBuffs(unit, SMARTBUFF_FOOD_AURA, cBuff.Type, cBuff.Links, cBuff.Chain); end - else - if (cBuff.Params ~= SG.NIL) then - if (cBuff.Links and cBuff.Links == SG.CheckFishingPole) then - if (SMARTBUFF_IsFishingPoleEquiped()) then - buff, index, buffname, bt, charges = SMARTBUFF_CheckUnitBuffs(unit, cBuff.Params, cBuff.Type); - else - buff = nil; - end - else - buff, index, buffname, bt, charges = SMARTBUFF_CheckUnitBuffs(unit, cBuff.Params, cBuff.Type, cBuff.Links, cBuff.Chain); - end - else - buff = nil; - end - end - + if (cBuff.Params ~= SG.NIL) then + if (cBuff.Links and cBuff.Links == SG.CheckFishingPole) then + if (SMARTBUFF_IsFishingPoleEquiped()) then + buff, index, buffname, bt, charges = SMARTBUFF_CheckUnitBuffs(unit, cBuff.Params, cBuff.Type); + else + buff = nil; + end + else + buff, index, buffname, bt, charges = SMARTBUFF_CheckUnitBuffs(unit, cBuff.Params, cBuff.Type, cBuff.Links, cBuff.Chain); + end + SMARTBUFF_AddMsgD("Buff time ("..cBuff.Params..") = "..tostring(bt)); + else + buff = nil; + end + end + if (buff == nil and cBuff.DurationS >= 1 and rbTime > 0) then if (charges == nil) then charges = -1; end if (charges > 1) then cBuff.CanCharge = true; end bufftarget = nil; end - + if (bt and bt <= rbTime) then buff = buffnS; bExpire = true; - end - + end + if (buff) then if (cBuff.Type ~= SMARTBUFF_CONST_ITEM) then local cr, iid = SMARTBUFF_CountReagent(buffnS, cBuff.Chain); @@ -2204,34 +2006,45 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) buff = buffnS; if (cBuff.Type == SMARTBUFF_CONST_ITEMGROUP or cBuff.Type == SMARTBUFF_CONST_SCROLL) then cds, cd = GetItemCooldown(iid); - cd = (cds + cd) - time; + cd = (cds + cd) - GetTime(); + SMARTBUFF_AddMsgD(cr.." "..buffnS.." found, cd = "..cd); if (cd > 0) then buff = nil; end end + SMARTBUFF_AddMsgD(cr .. " " .. buffnS .. " found"); else + SMARTBUFF_AddMsgD("No " .. buffnS .. " found"); buff = nil; bExpire = false; end end end - + -- Weapon buff ------------------------------------------------------------------------ - elseif (cBuff.Type == SMARTBUFF_CONST_WEAPON or cBuff.Type == SMARTBUFF_CONST_INV) then - local bMh, tMh, cMh, idMh, bOh, tOh, cOh, idOh = GetWeaponEnchantInfo(); + elseif (cBuff.Type == SMARTBUFF_CONST_WEAPON or cBuff.Type == SMARTBUFF_CONST_INV) then + SMARTBUFF_AddMsgD("Check weapon Buff"); + hasMainHandEnchant, mainHandExpiration, mainHandCharges, mainHandEnchantID, hasOffHandEnchant, offHandExpiration, offHandCharges, offHandEnchantID = GetWeaponEnchantInfo(); + bMh = hasMainHandEnchant; + tMh = mainHandExpiration; + cMh = mainHandCharges; + bOh = hasOffHandEnchant; + tOh = offHandExpiration; + cOh = offHandCharges; + + if (bs.MH) then - iSlot = 16; + iSlot = INVSLOT_MAINHAND; iId = GetInventoryItemID("player", iSlot); if (iId and SMARTBUFF_CanApplyWeaponBuff(buffnS, iSlot)) then if (bMh) then if (rbTime > 0 and cBuff.DurationS >= 1) then - --if (tMh == nil) then tMh = 0; end tMh = floor(tMh/1000); charges = cMh; if (charges == nil) then charges = -1; end if (charges > 1) then cBuff.CanCharge = true; end - --SMARTBUFF_AddMsgD(un .. " (WMH): " .. buffnS .. string.format(" %.0f sec left", tMh) .. ", " .. charges .. " charges left"); + SMARTBUFF_AddMsgD(un .. " (WMH): " .. buffnS .. string.format(" %.0f sec left", tMh) .. ", " .. charges .. " charges left"); if (tMh <= rbTime or (O.CheckCharges and cBuff.CanCharge and charges > 0 and charges <= O.MinCharges)) then buff = buffnS; bt = tMh; @@ -2246,24 +2059,23 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) SMARTBUFF_AddMsgD("Weapon Buff cannot be cast, no mainhand weapon equipped or wrong weapon/stone type"); end end - - if (bs.OH and not bExpire and handtype == "") then - iSlot = 17; + + if (bs.OH and not bExpire and not buffloc) then + iSlot = INVSLOT_OFFHAND iId = GetInventoryItemID("player", iSlot); if (iId and SMARTBUFF_CanApplyWeaponBuff(buffnS, iSlot)) then if (bOh) then if (rbTime > 0 and cBuff.DurationS >= 1) then - --if (tOh == nil) then tOh = 0; end tOh = floor(tOh/1000); charges = cOh; if (charges == nil) then charges = -1; end if (charges > 1) then cBuff.CanCharge = true; end - --SMARTBUFF_AddMsgD(un .. " (WOH): " .. buffnS .. string.format(" %.0f sec left", tOh) .. ", " .. charges .. " charges left"); + SMARTBUFF_AddMsgD(un .. " (WOH): " .. buffnS .. string.format(" %.0f sec left", tOh) .. ", " .. charges .. " charges left"); if (tOh <= rbTime or (O.CheckCharges and cBuff.CanCharge and charges > 0 and charges <= O.MinCharges)) then buff = buffnS; bt = tOh; - bExpire = true; - end + bExpire = true; + end end else handtype = "off"; @@ -2277,35 +2089,32 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) if (buff and cBuff.Type == SMARTBUFF_CONST_INV) then local cr = SMARTBUFF_CountReagent(buffnS, cBuff.Chain); if (cr > 0) then - --SMARTBUFF_AddMsgD(cr .. " " .. buffnS .. " found"); + SMARTBUFF_AddMsgD(cr .. " " .. buffnS .. " found"); else - --SMARTBUFF_AddMsgD("No " .. buffnS .. " found"); + SMARTBUFF_AddMsgD("No " .. buffnS .. " found"); buff = nil; end - end - - -- Normal buff ------------------------------------------------------------------------ + end + -- Normal buff ------------------------------------------------------------------------ else - local index = nil; - -- check timer object + local index = nil; + -- check timer object buff, index, buffname, bt, charges = SMARTBUFF_CheckUnitBuffs(unit, buffnS, cBuff.Type, cBuff.Links, cBuff.Chain); if (charges == nil) then charges = -1; end - if (charges > 1) then cBuff.CanCharge = true; end - if (unit ~= "target" and buff == nil and cBuff.DurationS >= 1 and rbTime > 0) then + if (charges > 1) then cBuff.CanCharge = true; end + if (unit ~= "target" and buff == nil and cBuff.DurationS >= 1 and rbTime > 0) then if (SMARTBUFF_IsPlayer(unit)) then if (cBuffTimer[unit] ~= nil and cBuffTimer[unit][buffnS] ~= nil) then local tbt = cBuff.DurationS - (time - cBuffTimer[unit][buffnS]); if (not bt or bt - tbt > rbTime) then bt = tbt; end - end + end bufftarget = nil; - --SMARTBUFF_AddMsgD(un .. " (P): " .. index .. ". " .. GetPlayerBuffTexture(index) .. "(" .. charges .. ") - " .. buffnS .. string.format(" %.0f sec left", bt)); elseif (cBuffTimer[unit] ~= nil and cBuffTimer[unit][buffnS] ~= nil) then - bt = cBuff.DurationS - (time - cBuffTimer[unit][buffnS]); + bt = cBuff.DurationS - (time - cBuffTimer[unit][buffnS]); bufftarget = nil; - --SMARTBUFF_AddMsgD(un .. " (S): " .. buffnS .. string.format(" %.0f sec left", bt)); elseif (cBuff.BuffG ~= nil and cBuffTimer[subgroup] ~= nil and cBuffTimer[subgroup][cBuff.BuffG] ~= nil) then bt = cBuff.DurationG - (time - cBuffTimer[subgroup][cBuff.BuffG]); if (type(subgroup) == "number") then @@ -2313,15 +2122,12 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) else bufftarget = SMARTBUFF_MSG_CLASS .. " " .. UnitClass(unit); end - --SMARTBUFF_AddMsgD(bufftarget .. ": " .. cBuff.BuffG .. string.format(" %.0f sec left", bt)); elseif (cBuff.BuffG ~= nil and cBuffTimer[uc] ~= nil and cBuffTimer[uc][cBuff.BuffG] ~= nil) then bt = cBuff.DurationG - (time - cBuffTimer[uc][cBuff.BuffG]); bufftarget = SMARTBUFF_MSG_CLASS .. " " .. UnitClass(unit); - --SMARTBUFF_AddMsgD(bufftarget .. ": " .. cBuff.BuffG .. string.format(" %.0f sec left", bt)); else bt = nil; end - if ((bt and bt <= rbTime) or (O.CheckCharges and cBuff.CanCharge and charges > 0 and charges <= O.MinCharges)) then if (buffname) then buff = buffname; @@ -2331,51 +2137,49 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) bExpire = true; end end - + -- check if the group buff is active, in this case it is not possible to cast the single buff if (buffname and mode ~= 1 and buffname ~= buffnS) then buff = nil; - --SMARTBUFF_AddMsgD("Group buff is active, single buff canceled!"); - --print("Group buff is active, single buff canceled!"); end end -- END normal buff -- check if shapeshifted and cancel buff if it is not possible to cast it if (buff and cBuff.Type ~= SMARTBUFF_CONST_TRACK and cBuff.Type ~= SMARTBUFF_CONST_FORCESELF) then - --isShapeshifted = true; - --sShapename = "Moonkingestalt"; if (isShapeshifted) then if (string.find(cBuff.Params, sShapename)) then - --SMARTBUFF_AddMsgD("Cast " .. buff .. " while shapeshifted"); else if(cBuff.Params == SMARTBUFF_DRUID_CAT) then buff = nil; - end + end if (buff and mode ~= 1 and not O.InShapeshift and (sShapename ~= SMARTBUFF_DRUID_MOONKIN and sShapename ~= SMARTBUFF_DRUID_TREANT)) then - --sMsgWarning = SMARTBUFF_MSG_SHAPESHIFT .. ": " .. sShapename; buff = nil; end end - else - if(cBuff.Params == SMARTBUFF_DRUID_CAT) then + elseif(cBuff.Params == SMARTBUFF_DRUID_CAT) then buff = nil; - end end end - - if (buff) then + + if (buff) then + + if (cBuff.IDS) then + SMARTBUFF_AddMsgD("Checking " ..i .. " - " .. cBuff.IDS .. " " .. buffnS); + end + -- Cast mode --------------------------------------------------------------------------------------- if (mode == 0 or mode == 5) then currentUnit = nil; currentSpell = nil; - --try to apply weapon buffs on main/off hand - if (cBuff.Type == SMARTBUFF_CONST_INV) then + + --try to apply weapon buffs on main/off hand + if (cBuff.Type == SMARTBUFF_CONST_INV) then if (iSlot and (handtype ~= "" or bExpire)) then local bag, slot, count = SMARTBUFF_FindItem(buffnS, cBuff.Chain); if (count > 0) then sMsgWarning = ""; - return 0, SMARTBUFF_ACTION_ITEM, buffnS, iSlot, "player", cBuff.Type; + return 0, SMARTBUFF_ACTION_ITEM, GetItemInfo(buffnS), iSlot, "player", cBuff.Type; end end r = 50; @@ -2383,9 +2187,9 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) if (iId and (handtype ~= "" or bExpire)) then sMsgWarning = ""; return 0, SMARTBUFF_ACTION_SPELL, buffnS, iSlot, "player", cBuff.Type; - --return 0, SMARTBUFF_ACTION_SPELL, buffnS, iId, "player", cBuff.Type; - end - r = 50; + end + r = 50; + -- eat food or use scroll or potion elseif (cBuff.Type == SMARTBUFF_CONST_FOOD or cBuff.Type == SMARTBUFF_CONST_SCROLL or cBuff.Type == SMARTBUFF_CONST_POTION) then local bag, slot, count = SMARTBUFF_FindItem(buffnS, cBuff.Chain); @@ -2393,7 +2197,8 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) sMsgWarning = ""; return 0, SMARTBUFF_ACTION_ITEM, buffnS, 0, "player", cBuff.Type; end - r = 20; + r = 20; + -- use item on a unit elseif (cBuff.Type == SMARTBUFF_CONST_ITEMGROUP) then local bag, slot, count = SMARTBUFF_FindItem(buffnS, cBuff.Chain); @@ -2401,66 +2206,65 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) sMsgWarning = ""; return 0, SMARTBUFF_ACTION_ITEM, buffnS, 0, unit, cBuff.Type; end - r = 20; + r = 20; + -- create item elseif (cBuff.Type == SMARTBUFF_CONST_ITEM) then r = 20; - local bag, slot, count = SMARTBUFF_FindItem(buff, cBuff.Chain); + local bag, slot, count = SMARTBUFF_FindItem(buff, cBuff.Chain); if (count == 0) then r = SMARTBUFF_doCast(unit, cBuff.IDS, buffnS, cBuff.LevelsS, cBuff.Type); if (r == 0) then currentUnit = unit; currentSpell = buffnS; end - end + end + -- cast spell else - r, _, rankText = SMARTBUFF_doCast(unit, cBuff.IDS, buffnS, cBuff.LevelsS, cBuff.Type); - if (r == 0) then + r = SMARTBUFF_doCast(unit, cBuff.IDS, buffnS, cBuff.LevelsS, cBuff.Type); + if (r == 0) then currentUnit = unit; currentSpell = buffnS; end end - + -- Check mode --------------------------------------------------------------------------------------- elseif (mode == 1) then currentUnit = nil; currentSpell = nil; if (bufftarget == nil) then bufftarget = un; end - - if (SMARTBUFF_CheckUnitLevel(unit, cBuff.IDS, cBuff.LevelsS) ~= nil or cBuff.IDS ~= nil or SMARTBUFF_IsItem(cBuff.Type) or cBuff.Type == SMARTBUFF_CONST_TRACK) then + + if (cBuff.IDS ~= nil or SMARTBUFF_IsItem(cBuff.Type) or cBuff.Type == SMARTBUFF_CONST_TRACK) then -- clean up buff timer, if expired - if (bt and bt < 0 and bExpire) then + if (bt and bt < 0 and bExpire) then bt = 0; if (cBuffTimer[unit] ~= nil and cBuffTimer[unit][buffnS] ~= nil) then cBuffTimer[unit][buffnS] = nil; - --SMARTBUFF_AddMsgD(un .. " (S): " .. buffnS .. " timer reset"); end if (cBuff.IDG ~= nil) then if (cBuffTimer[subgroup] ~= nil and cBuffTimer[subgroup][cBuff.BuffG] ~= nil) then cBuffTimer[subgroup][cBuff.BuffG] = nil; - --SMARTBUFF_AddMsgD("Group " .. subgroup .. ": " .. buffnS .. " timer reset"); - end + end if (cBuffTimer[uc] ~= nil and cBuffTimer[uc][cBuff.BuffG] ~= nil) then cBuffTimer[uc][cBuff.BuffG] = nil; - --SMARTBUFF_AddMsgD("Class " .. uc .. ": " .. cBuff.BuffG .. " timer reset"); end end tLastCheck = time - O.AutoTimer + 0.5; return 0; end - + SMARTBUFF_SetMissingBuffMessage(bufftarget, buff, cBuff.IconS, cBuff.CanCharge, charges, bt, bExpire); SMARTBUFF_SetButtonTexture(SmartBuff_KeyButton, cBuff.IconS); return 0; end end - + if (r == 0) then -- target buffed -- Message will printed in the "SPELLCAST_STOP" event sMsgWarning = ""; - return 0, SMARTBUFF_ACTION_SPELL, buffnS, -1, unit, cBuff.Type, rankText; + return 0, SMARTBUFF_ACTION_SPELL, buffnS, -1, unit, cBuff.Type; elseif (r == 1) then -- spell cooldown if (mode == 0) then SMARTBUFF_AddMsgWarn(buffnS .. " " .. SMARTBUFF_MSG_CD); end @@ -2503,26 +2307,17 @@ function SMARTBUFF_BuffUnit(unit, subgroup, mode, spell) -- no spell selected if (mode == 0) then SMARTBUFF_AddMsgD(SMARTBUFF_MSG_CHAT); end end - else - -- finished - if (mode == 0) then SMARTBUFF_AddMsgD(un .. " nothing to buff"); end end - else - -- target does not need this buff - if (mode == 0) then SMARTBUFF_AddMsgD(un .. " does not need " .. buffnS); end end else -- cooldown if (sMsgWarning == "") then sMsgWarning = SMARTBUFF_MSG_CD; end - --SMARTBUFF_AddMsgD("Spell on cd: "..buffnS); end end -- group or self end - --i = i + 1; end -- for buff - end return 3; end @@ -2548,8 +2343,8 @@ function SMARTBUFF_SetMissingBuffMessage(target, buff, icon, bCanCharge, nCharge local s; local sd = O.SplashDuration; local si = ""; - - if (OG.SplashIcon and icon) then + + if (OG.SplashIcon and icon) then local n = O.SplashIconSize; if (n == nil or n <= 0) then n = O.CurrentFontSize; @@ -2561,7 +2356,7 @@ function SMARTBUFF_SetMissingBuffMessage(target, buff, icon, bCanCharge, nCharge sd = 1; f:Clear(); end - + f:SetTimeVisible(sd); if (not nCharges) then nCharges = 0; end if (O.CheckCharges and bCanCharge and nCharges > 0 and nCharges <= O.MinCharges and bExpire) then @@ -2585,7 +2380,7 @@ function SMARTBUFF_SetMissingBuffMessage(target, buff, icon, bCanCharge, nCharge end f:AddMessage(s, O.ColSplashFont.r, O.ColSplashFont.g, O.ColSplashFont.b, 1.0); end - + -- show chat buff message if (O.ToggleAutoChat) then if (O.CheckCharges and bCanCharge and nCharges > 0 and nCharges <= O.MinCharges and bExpire) then @@ -2596,7 +2391,7 @@ function SMARTBUFF_SetMissingBuffMessage(target, buff, icon, bCanCharge, nCharge SMARTBUFF_AddMsgWarn(target.." "..SMARTBUFF_MSG_NEEDS.." "..buff, true); end end - + -- play sound if (O.ToggleAutoSound) then PlaySound(Sounds[O.AutoSoundSelection]); @@ -2604,33 +2399,29 @@ function SMARTBUFF_SetMissingBuffMessage(target, buff, icon, bCanCharge, nCharge end -local cWeaponStandard = {0, 1, 4, 5, 6, 7, 8, 10, 13, 15, 16}; -- "Daggers", "Axes", "Swords", "Maces", "Staves", "Fist Weapons", "Polearms", "Thrown" -local cWeaponBlunt = {4, 5, 10, 13}; -- "Maces", "Staves", "Fist Weapons" -local cWeaponSharp = {0, 1, 6, 7, 8, 15}; -- "Daggers", "Axes", "Swords", "Polearms" - -- check if a spell/reagent could applied on a weapon function SMARTBUFF_CanApplyWeaponBuff(buff, slot) local cWeaponTypes = nil; if (string.find(buff, SMARTBUFF_WEAPON_SHARP_PATTERN)) then - cWeaponTypes = cWeaponSharp; + cWeaponTypes = SMARTBUFF_WEAPON_SHARP; elseif (string.find(buff, SMARTBUFF_WEAPON_BLUNT_PATTERN)) then - cWeaponTypes = cWeaponBlunt; + cWeaponTypes = SMARTBUFF_WEAPON_BLUNT; else - cWeaponTypes = cWeaponStandard; + cWeaponTypes = SMARTBUFF_WEAPON_STANDARD; end - + local itemLink = GetInventoryItemLink("player", slot); - if (itemLink == nil) then return false end - - local itemType, itemSubType, _, _, _, _, classId, subclassId = select(6, GetItemInfo(itemLink)); - --if (itemType and itemSubType) then - -- SMARTBUFF_AddMsgD("Type: "..itemType..", Subtype: "..itemSubType); - --end - - if (tcontains(cWeaponTypes, subclassId)) then - return true, itemSubType; - end + local _, _, itemCode = string.find(itemLink, "(%d+):"); + local _, _, _, _, _, itemType, itemSubType = GetItemInfo(itemCode); + if (cWeaponTypes and itemSubType) then + for _, weapon in pairs(cWeaponTypes) do + if (string.find(itemSubType, weapon)) then + return true, weapon; + end + end + + end return false; end -- END SMARTBUFF_CanApplyWeaponBuff @@ -2651,25 +2442,22 @@ end -- Casts a spell function SMARTBUFF_doCast(unit, id, spellName, levels, type) if (id == nil) then return 9; end - if (type == SMARTBUFF_CONST_TRACK) then - local iconTrack = GetTrackingTexture(); - if (iconTrack ~= nil and iconTrack ~= "Interface\\Minimap\\Tracking\\None") then - SMARTBUFF_AddMsgD("Track already enabled: "..iconTrack); - return 7; - end + if (type == SMARTBUFF_CONST_TRACK and (GetTrackingTexture() ~= "Interface\\Minimap\\Tracking\\None")) then + return 7; end - + -- check if spell has cooldown local _, cd = GetSpellCooldown(spellName) if (not cd) then -- move on elseif (cd > maxSkipCoolDown) then return 4; - elseif (cd > 0) then + elseif (cd > 0) then return 1; end - -- switched to using the LibRangeCheck-2.0 library by mitchnull for range checking. + -- Rangecheck + --SMARTBUFF_AddMsgD("Spell has range: "..spellName.." = "..ChkS(SpellHasRange(spellName))); if ((type == SMARTBUFF_CONST_GROUP or type == SMARTBUFF_CONST_ITEMGROUP)) then local minRange, maxRange = LRC:GetRange(unit) if (UnitInRange(unit) or unit == "player" or (unit == "target" and O.BuffTarget)) then @@ -2683,20 +2471,14 @@ function SMARTBUFF_doCast(unit, id, spellName, levels, type) return 3; end end - - -- check if target is to low for this spell - local newId, rank, rankText = SMARTBUFF_CheckUnitLevel(unit, id, levels); - if (newId == nil) then - return 5; - end -- check if you have enough mana/energy/rage to cast local isUsable, notEnoughMana = IsUsableSpell(spellName); if (notEnoughMana) then return 6; end - - return 0, rank, rankText; + + return 0; end -- END SMARTBUFF_doCast @@ -2721,13 +2503,9 @@ function UnitBuffByBuffName(target,buffname,filter) end end --- --- SMARTBUFF_CheckUnitBuffs --- Function to return the name of the buff to cast. --- +-- Will return the name of the buff to cast function SMARTBUFF_CheckUnitBuffs(unit, buffN, buffT, buffL, buffC) if (not unit or (not buffN and not buffL)) then return end - local i, n, v; local buff = nil; local defBuff = nil; @@ -2738,13 +2516,11 @@ function SMARTBUFF_CheckUnitBuffs(unit, buffN, buffT, buffL, buffC) local icon = nil; local time = GetTime(); local uname = UnitName(unit) or "?"; - if (buffN) then defBuff = buffN; else defBuff = buffL[1]; end - -- Stance/Presence/Seal check, these are not in the aura list n = cBuffIndex[defBuff]; if (cBuffs[n] and cBuffs[n].Type == SMARTBUFF_CONST_STANCE) then @@ -2768,9 +2544,9 @@ function SMARTBUFF_CheckUnitBuffs(unit, buffN, buffT, buffL, buffC) end end end - return defBuff, nil, nil, nil, nil; + return defBuff, nil, nil, nil, nil; end - + -- Check linked buffs if (buffL) then if (not O.LinkSelfBuffCheck and buffT == SMARTBUFF_CONST_SELF) then @@ -2783,7 +2559,12 @@ function SMARTBUFF_CheckUnitBuffs(unit, buffN, buffT, buffL, buffC) SMARTBUFF_AddMsgD("Check linked buff ("..uname.."): "..v); buff, icon, count, _, duration, timeleft, caster = UnitBuffByBuffName(unit, v); if (buff) then - timeleft = timeleft - time; + timeleft = timeleft - GetTime(); + if (timeleft > 0) then + timeleft = timeleft; + else + timeleft = time; + end SMARTBUFF_AddMsgD("Linked buff found: "..buff..", "..timeleft..", "..icon); return nil, n, defBuff, timeleft, count; end @@ -2791,17 +2572,19 @@ function SMARTBUFF_CheckUnitBuffs(unit, buffN, buffT, buffL, buffC) end end end - + -- Check chained buffs if (defBuff and buffC and #buffC > 1) then local t = B[CS()].Order; if (t and #t > 1) then + --SMARTBUFF_AddMsgD("Check chained buff ("..uname.."): "..defBuff); for i = 1, #t, 1 do if (t[i] and tfind(buffC, t[i])) then v = GetBuffSettings(t[i]); if (v and v.EnableS) then local b, tl, im = SMARTBUFF_CheckBuff(unit, t[i]); if (b and im) then + --SMARTBUFF_AddMsgD("Chained buff found: "..t[i]..", "..tl); if (SMARTBUFF_CheckBuffLink(unit, t[i], v.Type, v.Links)) then return nil, i, defBuff, tl, -1; end @@ -2813,79 +2596,29 @@ function SMARTBUFF_CheckUnitBuffs(unit, buffN, buffT, buffL, buffC) end end end - + -- Check default buff if (defBuff) then + SMARTBUFF_AddMsgD("Check default buff ("..uname.."): "..defBuff); buff, icon, count, _, duration, timeleft, caster = UnitBuffByBuffName(unit, defBuff); if (buff) then --- print("Found buff: "..buff.. " on unit: "..unit) - timeleft = timeleft - time; + timeleft = timeleft - GetTime(); + if (timeleft > 0) then + timeleft = timeleft; + else + timeleft = time; + end if (SMARTBUFF_IsPlayer(caster)) then SMARTBUFF_UpdateBuffDuration(defBuff, duration); end SMARTBUFF_AddMsgD("Default buff found: "..buff..", "..timeleft..", "..icon); return nil, 0, defBuff, timeleft, count; - else --- print("Not Found Buff: "..defBuff.. " on unit: "..unit) end - end + end -- Buff not found, return default buff return defBuff, nil, nil, nil, nil; - -end - - --- Will return the lower Id of the spell, if the unit level is lower -function SMARTBUFF_CheckUnitLevel(unit, spellId, spellLevels) - if (spellLevels == nil or spellId == nil) then - return spellId; - end - - local Id = spellId; - local uLevel = UnitLevel(unit); - local spellName, _, icon, castTime, minRange, maxRange = GetSpellInfo(Id); - local sRank = GetSpellSubtext(Id); - if (sRank == nil or sRank == "") then - return Id; - end - - local _, _, spellRank = string.find(sRank, "(%d+)"); - if (spellRank == nil) then - return Id; - end - - spellRank = tonumber(spellRank); - local i = spellRank; - - --SMARTBUFF_AddMsgD(spellName .. sRank .. ":" .. spellRank .. ", " .. spellLevels[i]); - - while (i >= 1) do - if (uLevel >= (spellLevels[i] - 10)) then - break; - end - i = i - 1; - end - - if (i == spellRank) then - return Id; - end - - local rankText; - if (i > 0) then - local n = spellRank - i; - Id = Id - n; - rankText = "("..string.gsub(sRank, "(%d+)", n)..")"; - --SMARTBUFF_AddMsgD(uLevel .. " " .. spellName .. " Rank " .. i .. " - ID = " .. Id); - else - Id = nil; - --SMARTBUFF_AddMsgD(spellName .. ": no rank available for this level"); - end; - - return Id, i, rankText; end --- END SMARTBUFF_CheckUnitLevel - function SMARTBUFF_CheckBuffLink(unit, defBuff, buffT, buffL) @@ -2901,7 +2634,12 @@ function SMARTBUFF_CheckBuffLink(unit, defBuff, buffT, buffL) SMARTBUFF_AddMsgD("Check linked buff ("..uname.."): "..v); buff, icon, count, _, duration, timeleft, caster = UnitBuffByBuffName(unit, v); if (buff) then - timeleft = timeleft - time; + timeleft = timeleft - GetTime(); + if (timeleft > 0) then + timeleft = timeleft; + else + timeleft = time; + end SMARTBUFF_AddMsgD("Linked buff found: "..buff..", "..timeleft..", "..icon); return nil, n, defBuff, timeleft, count; end @@ -2938,23 +2676,23 @@ function SMARTBUFF_UpdateBuffDuration(buff, duration) if (i ~= nil and cBuffs[i] ~= nil and buff == cBuffs[i].BuffS) then if (cBuffs[i].DurationS ~= nil and cBuffs[i].DurationS > 0 and cBuffs[i].DurationS ~= duration) then SMARTBUFF_AddMsgD("Updated buff duration: "..buff.." = "..duration.."sec, old = "..cBuffs[i].DurationS); - cBuffs[i].DurationS = duration; + cBuffs[i].DurationS = duration; end end end -function UnitAuraBySpellName(target, spellname, filter) +function UnitAuraBySpellName(target,spellname,filter) for i = 1,40 do name = UnitAura(target, i, filter); if not name then return end if name == spellname then - return UnitAuraFull(target, i, filter); + return UnitAura(target, i, filter); end end end -function SMARTBUFF_CheckBuff(unit, buffName, isMine) +function SMARTBUFF_CheckBuff(unit, buffName, isMine) if (not unit or not buffName) then return false, 0; end @@ -2963,6 +2701,11 @@ function SMARTBUFF_CheckBuff(unit, buffName, isMine) SMARTBUFF_AddMsgD(UnitName(unit).." buff found: "..buff, 0, 1, 0.5); if (buff == buffName) then timeleft = timeleft - GetTime(); + if (timeleft > 0) then + timeleft = timeleft; + else + timeleft = time; + end if (isMine and caster) then if (SMARTBUFF_IsPlayer(caster)) then return true, timeleft, caster; @@ -2977,14 +2720,13 @@ end -- END SMARTBUFF_CheckUnitBuffs --- Will return the name/description of the buff +-- Will return the name/description of the buff function SMARTBUFF_GetBuffName(unit, buffIndex, line) local i = buffIndex; local name = nil; if (i < 0 or i > maxBuffs) then return nil; - end - --SmartBuffTooltip:SetOwner(SmartBuffFrame, "ANCHOR_NONE"); + end SmartBuffTooltip:ClearLines(); SmartBuffTooltip:SetUnitBuff(unit, i); local obj = _G["SmartBuffTooltipTextLeft" .. line]; @@ -3018,7 +2760,6 @@ function SMARTBUFF_IsFishing(unit) -- spell, rank, displayName, icon, startTime, endTime, isTradeSkill = UnitChannelInfo("unit") local spell = UnitChannelInfo(unit); if (spell ~= nil and SMARTBUFF_FISHING ~= nil and spell == SMARTBUFF_FISHING) then - --SMARTBUFF_AddMsgD("Channeling "..SMARTBUFF_FISHING); return true; end return false; @@ -3026,16 +2767,16 @@ end function SMARTBUFF_IsFishingPoleEquiped() if (not SG or not SG.FishingPole) then return false end - + local link = GetInventoryItemLink("player", GetInventorySlotInfo("MainHandSlot")); if (not link) then return false end - + local _, _, _, _, _, _, subType = GetItemInfo(link); if (not subType) then return false end - + --print(SG.FishingPole.." - "..subType); if (SG.FishingPole == subType) then return true end - + return false; end -- END SMARTBUFF_IsFishing @@ -3061,7 +2802,7 @@ function SMARTBUFF_IsDebuffTexture(unit, debufftex) -- name,rank,icon,count,type = UnitDebuff("unit", id or "name"[,"rank"]) while (UnitDebuff(unit, i)) do name, icon, _, _ = UnitDebuff(unit, i); - --SMARTBUFF_AddMsgD(i .. ". " .. name .. ", " .. icon); + --SMARTBUFF_AddMsgD(i .. ". " .. name .. ", " .. icon); if (string.find(icon, debufftex)) then active = true; break @@ -3074,66 +2815,54 @@ end -- Returns the number of a reagent currently in player's bag +-- we now search on ItemLink in addition to itemText, in order to support Dragonflight item qualities function SMARTBUFF_CountReagent(reagent, chain) if (reagent == nil) then return -1, nil; end - - local toy = SG.Toybox[reagent]; - if (toy) then - return 1, toy[1]; - end - - local n = 0; + local total = 0; local id = nil; local bag = 0; local slot = 0; - local itemsInfo; - local itemLink, itemName, count; - if (chain == nil) then chain = { reagent }; end + if not (chain) then chain = { reagent }; end for bag = 0, NUM_BAG_FRAMES do for slot = 1, C_Container.GetContainerNumSlots(bag) do - itemLink = C_Container.GetContainerItemLink(bag, slot); - if (itemLink ~= nil) then - itemName = string.match(itemLink, "%[.-%]"); + bagItemID = C_Container.GetContainerItemID(bag, slot) + if bagItemID then + containerInfo = C_Container.GetContainerItemInfo(bag, slot); + --SMARTBUFF_AddMsgD("Reagent found: " .. C_Container.GetContainerItemLink(bag.slot)); for i = 1, #chain, 1 do - if (chain[i] and string.find(itemName, chain[i], 1, true)) then - itemsInfo = C_Container.GetContainerItemInfo(bag, slot); - id = C_Container.GetContainerItemID(bag, slot); - n = n + itemsInfo.stackCount; + local buffItemID = tonumber(string.match(chain[i], "item:(%d+)")) + if bagItemID == buffItemID then + + id = buffItemID + total = total + containerInfo.stackCount; end end end end end - return n, id; + return total, id; end +-- these two functions are basically identical and should be merged function SMARTBUFF_FindItem(reagent, chain) if (reagent == nil) then return nil, nil, -1, nil; end - local n = 0; local bag = 0; local slot = 0; - local itemsInfo; - local itemLink, itemName, texture, count; - if (chain == nil) then chain = { reagent }; end + if not (chain) then chain = { reagent }; end for bag = 0, NUM_BAG_FRAMES do for slot = 1, C_Container.GetContainerNumSlots(bag) do - itemLink = C_Container.GetContainerItemLink(bag, slot); - if (itemLink ~= nil) then - itemName = string.match(itemLink, "%[.-%]"); + bagItemID = C_Container.GetContainerItemID(bag, slot); + if (bagItemID) then + --SMARTBUFF_AddMsgD("Reagent found: " .. C_Container.GetContainerItemLink(bag.slot)); for i = 1, #chain, 1 do - if (chain[i] and string.find(itemLink, "["..chain[i].."]", 1, true)) then - -- itemInfo now returns a table, thanks bliz :) - itemsInfo = C_Container.GetContainerItemInfo(bag, slot); - if itemsInfo then - return bag, slot, itemsInfo.stackCount, texture; - else - return nil, nil, 0, nil; - end + if tonumber(string.match(chain[i], "item:(%d+)")) == bagItemID then + containerInfo = C_Container.GetContainerItemInfo(bag, slot); + return bag, slot, containerInfo.stackCount, containerInfo.iconFileID; end end end @@ -3144,60 +2873,28 @@ end -- END Reagent functions ---------------------------------------------------------------------------------------------------- --- check the current zone and set buff template ---------------------------------------------------------------------------------------------------- -function SMARTBUFF_CheckLocation() - if (not O.AutoSwitchTemplate and not O.AutoSwitchTemplateInst) then return; end - - local zone = GetRealZoneText(); - if (zone == nil) then - SMARTBUFF_AddMsgD("No zone found, try again..."); - tStartZone = GetTime(); - isSetZone = true; - return; - end - - isSetZone = false; - local tmp = nil; - local b = false; - - SMARTBUFF_AddMsgD("Current zone: "..zone..", last zone: "..sLastZone); - if (zone ~= sLastZone) then - sLastZone = zone; - if (IsActiveBattlefieldArena()) then - tmp = SMARTBUFF_TEMPLATES[5]; - elseif (SMARTBUFF_IsActiveBattlefield(zone) == 1) then - tmp = SMARTBUFF_TEMPLATES[4]; - else - if (O.AutoSwitchTemplateInst) then - local i = 1; - for _ in pairs(SMARTBUFF_INSTANCES) do - if (string.find(string.lower(zone), string.lower(SMARTBUFF_INSTANCES[i]))) then - b = true; - break; - end - i = i + 1; - end - tmp = nil; - if (b) then - if (SMARTBUFF_TEMPLATES[i + 5] ~= nil) then - tmp = SMARTBUFF_TEMPLATES[i + 5] - end - end +-- Locate item in the bags, used to locate conjured items etc. +function SMARTBUFF_CheckBagItem(itemName) + local bag = 0; + local slot = 0; + local bagItemID, bagItemName, itemQuery; + if not itemName then return false; end + itemQuery = itemName; itemName = { itemName }; + for bag = 0, NUM_BAG_FRAMES do + for slot = 1, C_Container.GetContainerNumSlots(bag) do + bagItemID = C_Container.GetContainerItemID(bag, slot); + if (bagItemID) then + bagItemName = GetItemInfo(bagItemID) + if string.match(bagItemName, itemQuery) then + return true + end end - end - --SMARTBUFF_AddMsgD("Current tmpl: " .. currentTemplate .. " - new tmpl: " .. tmp); - if (tmp and currentTemplate ~= tmp) then - SMARTBUFF_AddMsg(SMARTBUFF_OFT_AUTOSWITCHTMP .. ": " .. currentTemplate .. " -> " .. tmp); - currentTemplate = tmp; - SMARTBUFF_SetBuffs(); end - end + end + return false end - -- checks if the player is inside a battlefield function SMARTBUFF_IsActiveBattlefield(zone) local i, status, map, instanceId, teamSize; @@ -3210,7 +2907,7 @@ function SMARTBUFF_IsActiveBattlefield(zone) end if (status and status == "active" and map) then if (teamSize and type(teamSize) == "number" and teamSize > 0) then - return 2; + return 2; end return 1; end @@ -3256,30 +2953,39 @@ end -- Init the SmartBuff variables --------------------------------------------------------------------------------------- +local smVerWarn = true function SMARTBUFF_Options_Init(self) + if (isInit) then return; end + -- test if this is the intended client + if (buildInfo < SMARTBUFF_VERSIONNR) or (buildInfo > 100000) then + if smVerWarn then + DEFAULT_CHAT_FRAME:AddMessage("|cff00e0ffSmartbuff Build "..SMARTBUFF_VERSION.." (Client: "..buildInfo..")|cffffffff "..SMARTBUFF_NOTINTENDEDCLIENT) + end + smVerWarn = false; + return + end + self:UnregisterEvent("CHAT_MSG_CHANNEL"); self:UnregisterEvent("UPDATE_MOUSEOVER_UNIT"); - - --DebugChatFrame:AddMessage("Starting init SB"); - + _, sPlayerClass = UnitClass("player"); sRealmName = GetRealmName(); sPlayerName = UnitName("player"); sID = sRealmName .. ":" .. sPlayerName; - --AutoSelfCast = GetCVar("autoSelfCast"); - + SMARTBUFF_PLAYERCLASS = sPlayerClass; - + + if (not SMARTBUFF_Buffs) then SMARTBUFF_Buffs = { }; end B = SMARTBUFF_Buffs; if (not SMARTBUFF_Options) then SMARTBUFF_Options = { }; end O = SMARTBUFF_Options; - - SMARTBUFF_BROKER_SetIcon(); -- bug fix, credit: SunNova - if (O.Toggle == nil) then O.Toggle = true; end + SMARTBUFF_BROKER_SetIcon(); + + if (O.Toggle == nil) then O.Toggle = true; end if (O.ToggleAuto == nil) then O.ToggleAuto = true; end if (O.AutoTimer == nil) then O.AutoTimer = 5; end if (O.BlacklistTimer == nil) then O.BlacklistTimer = 5; end @@ -3287,60 +2993,55 @@ function SMARTBUFF_Options_Init(self) if (O.ToggleAutoChat == nil) then O.ToggleAutoChat = false; end if (O.ToggleAutoSplash == nil) then O.ToggleAutoSplash = true; end if (O.ToggleAutoSound == nil) then O.ToggleAutoSound = true; end - if (O.AutoSoundSelection == nil) then O.AutoSoundSelection = 1; end; + if (O.AutoSoundSelection == nil) then O.AutoSoundSelection = 4; end; if (O.CheckCharges == nil) then O.CheckCharges = true; end --if (O.ToggleAutoRest == nil) then O.ToggleAutoRest = true; end if (O.RebuffTimer == nil) then O.RebuffTimer = 20; end if (O.SplashDuration == nil) then O.SplashDuration = 2; end - if (O.SplashIconSize == nil) then O.SplashIconSize = 12; end - + if (O.SplashIconSize == nil) then O.SplashIconSize = 16; end if (O.BuffTarget == nil) then O.BuffTarget = false; end if (O.BuffPvP == nil) then O.BuffPvP = false; end if (O.BuffInCities == nil) then O.BuffInCities = true; end if (O.LinkSelfBuffCheck == nil) then O.LinkSelfBuffCheck = true; end if (O.LinkGrpBuffCheck == nil) then O.LinkGrpBuffCheck = true; end if (O.AntiDaze == nil) then O.AntiDaze = true; end - - if (O.ScrollWheel ~= nil and O.ScrollWheelUp == nil) then O.ScrollWheelUp = O.ScrollWheel; end - if (O.ScrollWheel ~= nil and O.ScrollWheelDown == nil) then O.ScrollWheelDown = O.ScrollWheel; end + if (O.WarnCombatFishingRod == nil) then O.WarnCombatFishingRod = true; end + if (O.ScrollWheel ~= nil and O.ScrollWheelUp == nil) then O.ScrollWheelUp = O.ScrollWheel; end + if (O.ScrollWheel ~= nil and O.ScrollWheelDown == nil) then O.ScrollWheelDown = O.ScrollWheel; end if (O.ScrollWheelUp == nil) then O.ScrollWheelUp = true; end if (O.ScrollWheelDown == nil) then O.ScrollWheelDown = true; end - - if (O.InCombat == nil) then O.InCombat = true; end - if (O.AutoSwitchTemplate == nil) then O.AutoSwitchTemplate = true; end - if (O.AutoSwitchTemplateInst == nil) then O.AutoSwitchTemplateInst = true; end - if (O.InShapeshift == nil) then O.InShapeshift = true; end - if (O.WarnWhileMounted == nil) then O.WarnWhileMounted = false; end - - if (O.ToggleGrp == nil) then O.ToggleGrp = {true, true, true, true, true, true, true, true}; end - if (O.ToggleSubGrpChanged == nil) then O.ToggleSubGrpChanged = false; end - - if (O.ToggleMsgNormal == nil) then O.ToggleMsgNormal = false; end - if (O.ToggleMsgWarning == nil) then O.ToggleMsgWarning = false; end - if (O.ToggleMsgError == nil) then O.ToggleMsgError = false; end - + if (O.InCombat == nil) then O.InCombat = true; end + if (O.AutoSwitchTemplate == nil) then O.AutoSwitchTemplate = true; end + if (O.AutoSwitchTemplateInst == nil) then O.AutoSwitchTemplateInst = true; end + if (O.InShapeshift == nil) then O.InShapeshift = true; end + O.ToggleGrp = {true, true, true, true, true, true, true, true}; + if (O.ToggleMsgNormal == nil) then O.ToggleMsgNormal = true; end + if (O.ToggleMsgWarning == nil) then O.ToggleMsgWarning = false; end + if (O.ToggleMsgError == nil) then O.ToggleMsgError = false; end if (O.HideMmButton == nil) then O.HideMmButton = false; end - if (O.HideSAButton == nil) then O.HideSAButton = false; end - - if (O.MinCharges == nil) then + if (O.HideSAButton == nil) then O.HideSAButton = true; end + -- tracking switcher, only works for herbs and minerals + if (O.TrackSwitchActive == nil) then O.TrackSwitchActive = true; end + if (O.TrackSwitchFish == nil) then O.TrackSwitchFish = false; end + if (O.TrackSwitchDelay == nil) then O.TrackSwitchDelay = 2; end + if (O.TrackMaxPosition == nil) then O.TrackMaxPosition = 1; end + if (O.TrackPosition == nil) then O.TrackPosition = 1; end + -- leaving this here in classic just in case we even need it, its possible blizzard make the same + -- changes to the secure action button as they did in the retail version.. + if (O.SBButtonFix == nil) then O.SBButtonFix = false; end + if (O.SBButtonDownVal == nil) then O.SBButtonDownVal = GetCVarBool("ActionButtonUseKeyDown"); end + + if (O.MinCharges == nil) then if (sPlayerClass == "SHAMAN" or sPlayerClass == "PRIEST") then O.MinCharges = 1; else O.MinCharges = 3; end end - - if (O.ShowMiniGrp == nil) then - if (sPlayerClass == "DRUID" or sPlayerClass == "MAGE" or sPlayerClass == "PRIEST") then - O.ShowMiniGrp = true; - else - O.ShowMiniGrp = false; - end - end - + if (not O.AddList) then O.AddList = { }; end if (not O.IgnoreList) then O.IgnoreList = { }; end - + if (O.LastTemplate == nil) then O.LastTemplate = SMARTBUFF_TEMPLATES[1]; end local b = false; while (SMARTBUFF_TEMPLATES[i] ~= nil) do @@ -3350,39 +3051,38 @@ function SMARTBUFF_Options_Init(self) end i = i + 1; end - if (not b) then + if (not b) then O.LastTemplate = SMARTBUFF_TEMPLATES[1]; - end - + end + currentTemplate = O.LastTemplate; - --currentSpec = GetSpecialization(); - currentSpec = 1; - + currentSpec = GetActiveTalentGroup() + if (O.OldWheelUp == nil) then O.OldWheelUp = ""; end if (O.OldWheelDown == nil) then O.OldWheelDown = ""; end - + SMARTBUFF_InitActionButtonPos(); - + if (O.SplashX == nil) then O.SplashX = 100; end if (O.SplashY == nil) then O.SplashY = -100; end - if (O.CurrentFont == nil) then O.CurrentFont = 9; end + if (O.CurrentFont == nil) then O.CurrentFont = 6; end if (O.ColSplashFont == nil) then O.ColSplashFont = { }; O.ColSplashFont.r = 1.0; O.ColSplashFont.g = 1.0; - O.ColSplashFont.b = 1.0; + O.ColSplashFont.b = 1.0; end iCurrentFont = O.CurrentFont; - + if (O.Debug == nil) then O.Debug = false; end - + -- Cosmos support - if(EarthFeature_AddButton) then + if(EarthFeature_AddButton) then EarthFeature_AddButton( { id = SMARTBUFF_TITLE; name = SMARTBUFF_TITLE; subtext = SMARTBUFF_TITLE; - tooltip = ""; + tooltip = ""; icon = imgSB; callback = SMARTBUFF_OptionsFrame_Toggle; test = nil; @@ -3392,19 +3092,20 @@ function SMARTBUFF_Options_Init(self) end if (IsAddOnLoaded("Parrot")) then - isParrot = true; + isParrot = true; end - - SMARTBUFF_FindItem("ScanBagsForSBInit"); - - DEFAULT_CHAT_FRAME:AddMessage("|cff00e0ff"..SMARTBUFF_VERS_TITLE .. "|cffffffff " .. SMARTBUFF_MSG_LOADED.."|cffFFFF00 /sbm - |cffffffff"..SMARTBUFF_OFT_MENU); + + SMARTBUFF_FindItem("ScanBagsForSBInit"); + + DEFAULT_CHAT_FRAME:AddMessage("|cff00e0ffSmartbuff Build "..SMARTBUFF_VERSION.." (Client: "..buildInfo..")|cffffffff "..SMARTBUFF_MSG_LOADED) + isInit = true; - + SMARTBUFF_CheckMiniMapButton(); SMARTBUFF_MinimapButton_OnUpdate(SmartBuff_MiniMapButton); SMARTBUFF_ShowSAButton(); SMARTBUFF_Splash_Hide(); - + if (O.UpgradeToDualSpec == nil) then for n = 1, GetNumSpecGroups(), 1 do if (B[n] == nil) then @@ -3424,40 +3125,37 @@ function SMARTBUFF_Options_Init(self) end end O.UpgradeToDualSpec = true; - SMARTBUFF_AddMsg("Upgraded to dual spec", true); end - + for k, v in pairs(cClasses) do if (SMARTBUFF_CLASSES[k] == nil) then SMARTBUFF_CLASSES[k] = v; end end - - if (O.VersionNr == nil or O.VersionNr < SMARTBUFF_VERSIONNR) then + + -- major version changes are backwards incompatible by definition, so trigger a RESET ALL + O.VersionNr = O.VersionNr or SMARTBUFF_VERSIONNR -- don't reset if O.VersionNr == nil + if O.VersionNr < SMARTBUFF_VERSIONNR then O.VersionNr = SMARTBUFF_VERSIONNR; + StaticPopup_Show("SMARTBUFF_DATA_PURGE"); + SMARTBUFF_SetTemplate(); SMARTBUFF_SetBuffs(); InitBuffOrder(true); - --print("Upgrade SmartBuff to "..SMARTBUFF_VERSION); end - + if (SMARTBUFF_OptionsGlobal == nil) then SMARTBUFF_OptionsGlobal = { }; end OG = SMARTBUFF_OptionsGlobal; if (OG.SplashIcon == nil) then OG.SplashIcon = true; end if (OG.SplashMsgShort == nil) then OG.SplashMsgShort = false; end if (OG.FirstStart == nil) then OG.FirstStart = "V0"; end - + SMARTBUFF_Splash_ChangeFont(0); + SMARTBUFF_BuffOrderReset(); if (OG.FirstStart ~= SMARTBUFF_VERSION) then - OG.FirstStart = SMARTBUFF_VERSION; + SmartBuffOptionsCredits_lblText:SetText(SMARTBUFF_CREDITS); SMARTBUFF_OptionsFrame_Open(true); - - if (OG.Tutorial == nil) then - OG.Tutorial = SMARTBUFF_VERSIONNR; - SMARTBUFF_ToggleTutorial(); - end - SmartBuffWNF_lblText:SetText(SMARTBUFF_WHATSNEW); - SmartBuffWNF:Show(); + SmartBuffWNF:Show(); else SMARTBUFF_SetBuffs(); end @@ -3466,22 +3164,30 @@ function SMARTBUFF_Options_Init(self) SmartBuff_KeyButton:ClearAllPoints(); SmartBuff_KeyButton:SetPoint("CENTER", UIParent, "CENTER", 0, 100); end - - SMARTBUFF_SetUnits(); + + SMARTBUFF_SetTemplate(); SMARTBUFF_RebindKeys(); - isSyncReq = true; - -- finally, client version check - if wowTOC > SMARTBUFF_VERSIONNR or wowTOC < SMARTBUFF_VERSIONMIN then - DEFAULT_CHAT_FRAME:AddMessage("|cff00e0ffSmartbuff : |cffff6060This version was NOT intended for client version ("..wowTOC..") - you may encounter lua errors or other issues so please check for an update! - Join Discord for all the latest information at |cffFFFF00https://discord.gg/R6EkZ94TKK.") - end + -- regardless of the option in settings, grab info on gathering trackers + ScanPlayerTrackers(); + + isSyncReq = true; end -- END SMARTBUFF_Options_Init -function SMARTBUFF_InitActionButtonPos() +function SMARTBUFF_ToggleWhatsNewWindow() + SmartBuffWNF_lblText:SetText(SMARTBUFF_WHATSNEW); + if SmartBuffWNF:IsShown() then + SmartBuffWNF:Hide(); + else + SmartBuffWNF:Show(); + end +end + +function SMARTBUFF_InitActionButtonPos() if (InCombatLockdown()) then return end - + isInitBtn = true; if (O.ActionBtnX == nil) then SMARTBUFF_SetButtonPos(SmartBuff_KeyButton); @@ -3489,10 +3195,9 @@ function SMARTBUFF_InitActionButtonPos() SmartBuff_KeyButton:ClearAllPoints(); SmartBuff_KeyButton:SetPoint("TOPLEFT", UIParent, "TOPLEFT", O.ActionBtnX, O.ActionBtnY); end - --print(format("x = %.0f, y = %.0f", O.ActionBtnX, O.ActionBtnY)); end -function SMARTBUFF_ResetAll() +function SMARTBUFF_ResetAll() wipe(SMARTBUFF_Buffs); wipe(SMARTBUFF_Options); ReloadUI(); @@ -3502,7 +3207,6 @@ function SMARTBUFF_SetButtonPos(self) local x, y = self:GetLeft(), self:GetTop() - UIParent:GetHeight(); O.ActionBtnX = x; O.ActionBtnY = y; - --print(format("x = %.0f, y = %.0f", x, y)); end function SMARTBUFF_RebindKeys() @@ -3511,55 +3215,39 @@ function SMARTBUFF_RebindKeys() for i = 1, GetNumBindings(), 1 do local s = ""; local command, key1, key2 = GetBinding(i); - - --if (command and key1) then - -- SMARTBUFF_AddMsgD(i .. " = " .. command .. " - " .. key1; - --end - if (key1 and key1 == "MOUSEWHEELUP" and command ~= "SmartBuff_KeyButton") then O.OldWheelUp = command; - --SMARTBUFF_AddMsgD("Old wheel up: " .. command); elseif (key1 and key1 == "MOUSEWHEELDOWN" and command ~= "SmartBuff_KeyButton") then O.OldWheelDown = command; - --SMARTBUFF_AddMsgD("Old wheel down: " .. command); - end - + end if (command and command == "SMARTBUFF_BIND_TRIGGER") then - --s = i .. " = " .. command; if (key1) then - --s = s .. ", key1 = " .. key1 .. " rebound"; SetBindingClick(key1, "SmartBuff_KeyButton"); end if (key2) then - --s = s .. ", key2 = " .. key2 .. " rebound"; SetBindingClick(key2, "SmartBuff_KeyButton"); end - --SMARTBUFF_AddMsgD(s); break; end end - + if (O.ScrollWheelUp) then isKeyUpChanged = true; SetOverrideBindingClick(SmartBuffFrame, false, "MOUSEWHEELUP", "SmartBuff_KeyButton", "MOUSEWHEELUP"); - --SMARTBUFF_AddMsgD("Set wheel up"); else if (isKeyUpChanged) then isKeyUpChanged = false; SetOverrideBinding(SmartBuffFrame, false, "MOUSEWHEELUP"); - --SMARTBUFF_AddMsgD("Set old wheel up: " .. O.OldWheelUp); end end - + if (O.ScrollWheelDown) then isKeyDownChanged = true; SetOverrideBindingClick(SmartBuffFrame, false, "MOUSEWHEELDOWN", "SmartBuff_KeyButton", "MOUSEWHEELDOWN"); - --SMARTBUFF_AddMsgD("Set wheel down"); else if (isKeyDownChanged) then isKeyDownChanged = false; SetOverrideBinding(SmartBuffFrame, false, "MOUSEWHEELDOWN"); - --SMARTBUFF_AddMsgD("Set old wheel down: " .. O.OldWheelDown); end end isRebinding = false; @@ -3590,10 +3278,10 @@ function SMARTBUFF_command(msg) SMARTBUFF_AddMsgWarn(SMARTBUFF_VERS_TITLE.." not initialized correctly!", true); return; end - + if(msg == "toggle" or msg == "t") then SMARTBUFF_OToggle(); - SMARTBUFF_SetUnits(); + SMARTBUFF_SetTemplate(); elseif (msg == "menu") then SMARTBUFF_OptionsFrame_Toggle(); elseif (msg == "rbt") then @@ -3604,9 +3292,9 @@ function SMARTBUFF_command(msg) if (SMARTBUFF_PreCheck(0)) then SMARTBUFF_checkBlacklist(); SMARTBUFF_BuffUnit("target", 0, 0); - end + end elseif (msg == "debug") then - O.Debug = SMARTBUFF_toggleBool(O.Debug, "Debug active = "); + O.Debug = SMARTBUFF_toggleBool(O.Debug, "Debug active = "); elseif (msg == "open") then SMARTBUFF_OptionsFrame_Open(true); elseif (msg == "sync") then @@ -3623,36 +3311,14 @@ function SMARTBUFF_command(msg) SmartBuff_KeyButton:SetPoint("CENTER", UIParent, "CENTER"); SmartBuffOptionsFrame:ClearAllPoints(); SmartBuffOptionsFrame:SetPoint("CENTER", UIParent, "CENTER"); - SmartBuff_MiniGroup:ClearAllPoints(); - SmartBuff_MiniGroup:SetPoint("CENTER", UIParent, "CENTER"); - elseif (msg == "tmg") then - --SMARTBUFF_OToggleMiniGrp(); - O.ShowMiniGrp = SMARTBUFF_toggleBool(O.ShowMiniGrp, "MiniGrp active = "); - SMARTBUFF_MiniGroup_Show(); - - elseif (msg == "test") then - - -- Test Code ****************************************** - -- **************************************************** - - --SMARTBUFF_WEAPON_SHARP_PATTERN - --Schwerer Gewichtsstein - --Schwerer Wetzstein - --local a, b = SMARTBUFF_CanApplyWeaponBuff("Schwerer Wetzstein", 16); - --print(a); - --print(b); - - --local spellname = "Mind--numbing Poison"; - --SMARTBUFF_AddMsg("Original: " .. spellname, true); - --if (string.find(spellname, "%-%-") ~= nil) then - -- spellname = string.gsub(spellname, "%-%-", "%-"); - --end - --SMARTBUFF_AddMsg("Modified: " .. spellname, true); - -- **************************************************** - -- **************************************************** - + elseif (msg == "changes") then + SMARTBUFF_OptionsFrame_Open(true); + SmartBuffWNF_lblText:SetText(SMARTBUFF_WHATSNEW); + SmartBuffWNF:Show(); + elseif (msg == "reload") then + SMARTBUFF_BuffOrderReset(); + SMARTBUFF_OptionsFrame_Open(true); else - --SMARTBUFF_Check(0); SMARTBUFF_AddMsg(SMARTBUFF_VERS_TITLE, true); SMARTBUFF_AddMsg("Syntax: /sbo [command] or /sbuff [command] or /smartbuff [command]", true); SMARTBUFF_AddMsg("toggle - " .. SMARTBUFF_OFT, true); @@ -3663,6 +3329,8 @@ function SMARTBUFF_command(msg) SMARTBUFF_AddMsg("rafp - " .. "Reset all frame positions", true); SMARTBUFF_AddMsg("sync - " .. "Sync buff timers with UI", true); SMARTBUFF_AddMsg("rb - " .. "Reset key/mouse bindings", true); + SMARTBUFF_AddMsg("changes - " .. "Display changelog", true); + SMARTBUFF_AddMsg("reload - " .. "Reset buff list", true) end end -- END SMARTBUFF_command @@ -3674,13 +3342,8 @@ function SMARTBUFF_OToggle() O.Toggle = SMARTBUFF_toggleBool(O.Toggle, "Active = "); SMARTBUFF_CheckMiniMapButton(); if (O.Toggle) then - SMARTBUFF_MiniGroup_Show(); - SMARTBUFF_SetUnits(); - else - if (SmartBuff_MiniGroup:IsVisible()) then - SmartBuff_MiniGroup:Hide(); - end - end + SMARTBUFF_SetTemplate(); + end end function SMARTBUFF_OToggleAuto() @@ -3698,33 +3361,21 @@ end function SMARTBUFF_OToggleAutoSound() O.ToggleAutoSound = not O.ToggleAutoSound; end - ---function SMARTBUFF_OToggleCheckCharges() --- O.ToggleCheckCharges = not O.ToggleCheckCharges; ---end ---function SMARTBUFF_OToggleAutoRest() --- O.ToggleAutoRest = not O.ToggleAutoRest; ---end - function SMARTBUFF_OAutoSwitchTmp() O.AutoSwitchTemplate = not O.AutoSwitchTemplate; end function SMARTBUFF_OAutoSwitchTmpInst() O.AutoSwitchTemplateInst = not O.AutoSwitchTemplateInst; end - function SMARTBUFF_OBuffTarget() O.BuffTarget = not O.BuffTarget; end - function SMARTBUFF_OBuffPvP() O.BuffPvP = not O.BuffPvP; end - function SMARTBUFF_OBuffInCities() O.BuffInCities = not O.BuffInCities; end - function SMARTBUFF_OLinkSelfBuffCheck() O.LinkSelfBuffCheck = not O.LinkSelfBuffCheck; end @@ -3734,7 +3385,6 @@ end function SMARTBUFF_OAntiDaze() O.AntiDaze = not O.AntiDaze; end - function SMARTBUFF_OScrollWheelUp() O.ScrollWheelUp = not O.ScrollWheelUp; isKeyUpChanged = true; @@ -3749,20 +3399,6 @@ end function SMARTBUFF_OInCombat() O.InCombat = not O.InCombat; end - -function SMARTBUFF_OToggleGrp(i) - O.ToggleGrp[i] = not O.ToggleGrp[i]; - if (SmartBuff_MiniGroup:IsVisible()) then - SMARTBUFF_SetUnits(); - end -end -function SMARTBUFF_OToggleMiniGrp() - O.ShowMiniGrp = not O.ShowMiniGrp; -end -function SMARTBUFF_OToggleSubGrpChanged() - O.ToggleSubGrpChanged = not O.ToggleSubGrpChanged; -end - function SMARTBUFF_OToggleMsgNormal() O.ToggleMsgNormal = not O.ToggleMsgNormal; end @@ -3772,7 +3408,6 @@ end function SMARTBUFF_OToggleMsgError() O.ToggleMsgError = not O.ToggleMsgError; end - function SMARTBUFF_OHideMmButton() O.HideMmButton = not O.HideMmButton; SMARTBUFF_CheckMiniMapButton(); @@ -3784,25 +3419,18 @@ end function SMARTBUFF_OSelfFirst() B[CS()][currentTemplate].SelfFirst = not B[CS()][currentTemplate].SelfFirst; end -function SMARTBUFF_OWarnWhenMountedButton() - O.WarnWhileMounted = not O.WarnWhileMounted; +function SMARTBUFF_OTrackSwitchFish() + O.TrackSwitchFish = not O.TrackSwitchFish; end function SMARTBUFF_OToggleBuff(s, i) local bs = GetBuffSettings(cBuffs[i].BuffS); if (bs == nil) then return; - end - + end + if (s == "S") then bs.EnableS = not bs.EnableS; - if (bs.IDG ~= nil) then - bs.EnableG = bs.EnableS; - else - bs.EnableG = false; - end - SMARTBUFF_AddMsgD("OToggleBuff = "..cBuffs[i].BuffS..", "..tostring(bs.EnableS)..", "..tostring(bs.EnableG)); - if (bs.EnableS) then SmartBuff_BuffSetup_Show(i); else @@ -3813,36 +3441,45 @@ function SMARTBUFF_OToggleBuff(s, i) elseif (s == "G") then bs.EnableG = not bs.EnableG; end - + end function SMARTBUFF_OToggleDebug() O.Debug = not O.Debug; end +function SMARTBUFF_ToggleFixBuffing() + O.SBButtonFix = not O.SBButtonFix; + if not O.SBButtonFix then SetCVar("ActionButtonUseKeyDown", O.SBButtonDownVal ); end +end + function SMARTBUFF_OptionsFrame_Toggle() if (not isInit) then return; end - + if(SmartBuffOptionsFrame:IsVisible()) then if(iLastBuffSetup > 0) then SmartBuff_BuffSetup:Hide(); iLastBuffSetup = -1; SmartBuff_PlayerSetup:Hide(); - end + end SmartBuffOptionsFrame:Hide(); + -- if we were a new build then request a reloadui. + if (OG.FirstStart ~= SMARTBUFF_VERSION) then + OG.FirstStart = SMARTBUFF_VERSION; + StaticPopup_Show("SMARTBUFF_GUI_RELOAD"); + end else SmartBuffOptionsCredits_lblText:SetText(SMARTBUFF_CREDITS); SmartBuffOptionsFrame:Show(); SmartBuff_PlayerSetup:Hide(); end - + SMARTBUFF_MinimapButton_CheckPos(); end function SMARTBUFF_OptionsFrame_Open(force) if (not isInit) then return; end if(not SmartBuffOptionsFrame:IsVisible() or force) then - SmartBuffOptionsCredits_lblText:SetText(SMARTBUFF_CREDITS); SmartBuffOptionsFrame:Show(); end end @@ -3862,17 +3499,17 @@ function SmartBuff_BuffSetup_Show(i) SmartBuff_PlayerSetup:Hide(); return; end - + if(SmartBuff_BuffSetup:IsVisible() and i == iLastBuffSetup) then SmartBuff_BuffSetup:Hide(); iLastBuffSetup = -1; SmartBuff_PlayerSetup:Hide(); return; - else + else if (btype == SMARTBUFF_CONST_GROUP or btype == SMARTBUFF_CONST_ITEMGROUP) then hidden = false; end - + if (icon2 and bs.EnableG) then SmartBuff_BuffSetup_BuffIcon2:SetNormalTexture(icon2); SmartBuff_BuffSetup_BuffIcon2:Show(); @@ -3891,15 +3528,14 @@ function SmartBuff_BuffSetup_Show(i) SmartBuff_BuffSetup_BuffIcon1:SetPoint("TOPLEFT", 24, -30); SmartBuff_BuffSetup_BuffIcon1:Hide(); end - + local obj = SmartBuff_BuffSetup_BuffText; if (name) then obj:SetText(name); - --SMARTBUFF_AddMsgD(name); else obj:SetText(""); end - + SmartBuff_BuffSetup_cbSelf:SetChecked(bs.SelfOnly); SmartBuff_BuffSetup_cbSelfNot:SetChecked(bs.SelfNot); SmartBuff_BuffSetup_cbCombatIn:SetChecked(bs.CIn); @@ -3909,8 +3545,7 @@ function SmartBuff_BuffSetup_Show(i) SmartBuff_BuffSetup_cbRH:SetChecked(bs.RH); SmartBuff_BuffSetup_cbReminder:SetChecked(bs.Reminder); SmartBuff_BuffSetup_txtManaLimit:SetNumber(bs.ManaLimit); - - --SMARTBUFF_AddMsgD("Test Buff setup show 1"); + if (cBuffs[i].DurationS > 0) then SmartBuff_BuffSetup_RBTime:SetMinMaxValues(0, cBuffs[i].DurationS); _G[SmartBuff_BuffSetup_RBTime:GetName().."High"]:SetText(cBuffs[i].DurationS); @@ -3929,8 +3564,7 @@ function SmartBuff_BuffSetup_Show(i) else SmartBuff_BuffSetup_RBTime:Hide(); end - --SMARTBUFF_AddMsgD("Test Buff setup show 2"); - + SmartBuff_BuffSetup_txtManaLimit:Hide(); if (cBuffs[i].Type == SMARTBUFF_CONST_INV or cBuffs[i].Type == SMARTBUFF_CONST_WEAPON) then SmartBuff_BuffSetup_cbMH:Show(); @@ -3942,15 +3576,14 @@ function SmartBuff_BuffSetup_Show(i) SmartBuff_BuffSetup_cbRH:Hide(); if (cBuffs[i].Type ~= SMARTBUFF_CONST_FOOD and cBuffs[i].Type ~= SMARTBUFF_CONST_SCROLL and cBuffs[i].Type ~= SMARTBUFF_CONST_POTION) then SmartBuff_BuffSetup_txtManaLimit:Show(); - --SMARTBUFF_AddMsgD("Show ManaLimit"); end end - + if (cBuffs[i].Type == SMARTBUFF_CONST_GROUP or cBuffs[i].Type == SMARTBUFF_CONST_ITEMGROUP) then SmartBuff_BuffSetup_cbSelf:Show(); SmartBuff_BuffSetup_cbSelfNot:Show(); SmartBuff_BuffSetup_btnPriorityList:Show(); - SmartBuff_BuffSetup_btnIgnoreList:Show(); + SmartBuff_BuffSetup_btnIgnoreList:Show(); else SmartBuff_BuffSetup_cbSelf:Hide(); SmartBuff_BuffSetup_cbSelfNot:Hide(); @@ -3958,11 +3591,10 @@ function SmartBuff_BuffSetup_Show(i) SmartBuff_BuffSetup_btnIgnoreList:Hide(); SmartBuff_PlayerSetup:Hide(); end - + local cb = nil; local btn = nil; n = 0; - --SMARTBUFF_AddMsgD("Test Buff setup show 3"); for _ in pairs(cClasses) do n = n + 1; cb = _G["SmartBuff_BuffSetup_cbClass"..n]; @@ -3977,13 +3609,12 @@ function SmartBuff_BuffSetup_Show(i) end end iLastBuffSetup = i; - --SMARTBUFF_AddMsgD("Test Buff setup show 4"); SmartBuff_BuffSetup:Show(); - + if (SmartBuff_PlayerSetup:IsVisible()) then SmartBuff_PS_Show(iCurrentList); end - end + end end function SmartBuff_BuffSetup_ManaLimitChanged(self) @@ -4004,7 +3635,7 @@ function SmartBuff_BuffSetup_OnClick() end local name = cBuffs[i].BuffS; local cBuff = GetBuffSettings(name); - + cBuff.SelfOnly = SmartBuff_BuffSetup_cbSelf:GetChecked(); cBuff.SelfNot = SmartBuff_BuffSetup_cbSelfNot:GetChecked(); cBuff.CIn = SmartBuff_BuffSetup_cbCombatIn:GetChecked(); @@ -4013,10 +3644,10 @@ function SmartBuff_BuffSetup_OnClick() cBuff.OH = SmartBuff_BuffSetup_cbOH:GetChecked(); cBuff.RH = SmartBuff_BuffSetup_cbRH:GetChecked(); cBuff.Reminder = SmartBuff_BuffSetup_cbReminder:GetChecked(); - + cBuff.RBTime = SmartBuff_BuffSetup_RBTime:GetValue(); _G[SmartBuff_BuffSetup_RBTime:GetName().."Text"]:SetText(cBuff.RBTime .. "\nsec"); - + if (cBuffs[i].Type == SMARTBUFF_CONST_GROUP or cBuffs[i].Type == SMARTBUFF_CONST_ITEMGROUP) then local n = 0; local cb = nil; @@ -4027,7 +3658,7 @@ function SmartBuff_BuffSetup_OnClick() cBuff[cClasses[n]] = false; else cBuff[cClasses[n]] = cb:GetChecked(); - end + end end end --SMARTBUFF_AddMsgD("Buff setup saved"); @@ -4041,7 +3672,7 @@ function SmartBuff_BuffSetup_ToolTip(mode) local ids = cBuffs[i].IDS; local idg = cBuffs[i].IDG; local btype = cBuffs[i].Type - + GameTooltip:ClearLines(); if (SMARTBUFF_IsItem(btype)) then local bag, slot, count, texture = SMARTBUFF_FindItem(cBuffs[i].BuffS, cBuffs[i].Chain); @@ -4054,9 +3685,11 @@ function SmartBuff_BuffSetup_ToolTip(mode) end else if (mode == 1 and ids) then - GameTooltip:SetHyperlink("spell:" .. ids); + local link = GetSpellLink(ids); + if (link) then GameTooltip:SetHyperlink(link); end elseif (mode == 2 and idg) then - GameTooltip:SetHyperlink("spell:" .. idg); + local link = GetSpellLink(idg); + if (link) then GameTooltip:SetHyperlink(link); end end end GameTooltip:Show(); @@ -4074,16 +3707,13 @@ function SMARTBUFF_Options_OnShow() local bottom = GetScreenHeight() - math.abs(SmartBuffOptionsFrame:GetBottom()); local left = SmartBuffOptionsFrame:GetLeft(); local right = SmartBuffOptionsFrame:GetRight(); - - --SMARTBUFF_AddMsgD("X: " .. GetScreenWidth() .. ", " .. left .. ", " .. right); - --SMARTBUFF_AddMsgD("Y: " .. GetScreenHeight() .. ", " .. top .. ", " .. bottom); - + if (GetScreenWidth() < left + 20 or GetScreenHeight() < top + 20 or right < 20 or bottom < 20) then SmartBuffOptionsFrame:SetPoint("TOPLEFT", UIParent, "CENTER", -SmartBuffOptionsFrame:GetWidth() / 2, SmartBuffOptionsFrame:GetHeight() / 2); end - + SmartBuff_ShowControls("SmartBuffOptionsFrame", true); - + SmartBuffOptionsFrame_cbSB:SetChecked(O.Toggle); SmartBuffOptionsFrame_cbAuto:SetChecked(O.ToggleAuto); SmartBuffOptionsFrameAutoTimer:SetValue(O.AutoTimer); @@ -4092,20 +3722,19 @@ function SMARTBUFF_Options_OnShow() SmartBuffOptionsFrame_cbAutoChat:SetChecked(O.ToggleAutoChat); SmartBuffOptionsFrame_cbAutoSplash:SetChecked(O.ToggleAutoSplash); SmartBuffOptionsFrame_cbAutoSound:SetChecked(O.ToggleAutoSound); - --SmartBuffOptionsFrame_cbCheckCharges:SetChecked(O.ToggleCheckCharges); - --SmartBuffOptionsFrame_cbAutoRest:SetChecked(O.ToggleAutoRest); + SmartBuffOptionsFrame_cbAutoSwitchTmp:SetChecked(O.AutoSwitchTemplate); SmartBuffOptionsFrame_cbAutoSwitchTmpInst:SetChecked(O.AutoSwitchTemplateInst); SmartBuffOptionsFrame_cbBuffPvP:SetChecked(O.BuffPvP); SmartBuffOptionsFrame_cbBuffTarget:SetChecked(O.BuffTarget); SmartBuffOptionsFrame_cbBuffInCities:SetChecked(O.BuffInCities); - SmartBuffOptionsFrame_cbInShapeshift:SetChecked(O.InShapeshift); - SmartBuffOptionsFrame_cbWarnWhenMounted:SetChecked(O.WarnWhileMounted); - + SmartBuffOptionsFrame_cbInShapeshift:SetChecked(O.InShapeshift); + SmartBuffOptionsFrame_cbFixBuffIssue:SetChecked(O.SBButtonFix); + SmartBuffOptionsFrame_cbAntiDaze:SetChecked(O.AntiDaze); SmartBuffOptionsFrame_cbLinkGrpBuffCheck:SetChecked(O.LinkGrpBuffCheck); SmartBuffOptionsFrame_cbLinkSelfBuffCheck:SetChecked(O.LinkSelfBuffCheck); - + SmartBuffOptionsFrame_cbScrollWheelUp:SetChecked(O.ScrollWheelUp); SmartBuffOptionsFrame_cbScrollWheelDown:SetChecked(O.ScrollWheelDown); SmartBuffOptionsFrame_cbInCombat:SetChecked(O.InCombat); @@ -4114,28 +3743,22 @@ function SMARTBUFF_Options_OnShow() SmartBuffOptionsFrame_cbMsgError:SetChecked(O.ToggleMsgError); SmartBuffOptionsFrame_cbHideMmButton:SetChecked(O.HideMmButton); SmartBuffOptionsFrame_cbHideSAButton:SetChecked(O.HideSAButton); - + + SmartBuffOptionsFrame_cbGatherAutoSwitch:SetChecked(O.TrackSwitchActive); + SmartBuffOptionsFrame_cbGatherAutoSwitchFish:SetChecked(O.TrackSwitchFish); + SmartBuffOptionsFrameRebuffTimer:SetValue(O.RebuffTimer); SmartBuff_SetSliderText(SmartBuffOptionsFrameRebuffTimer, SMARTBUFF_OFT_REBUFFTIMER, O.RebuffTimer, INT_SPELL_DURATION_SEC); SmartBuffOptionsFrameBLDuration:SetValue(O.BlacklistTimer); SmartBuff_SetSliderText(SmartBuffOptionsFrameBLDuration, SMARTBUFF_OFT_BLDURATION, O.BlacklistTimer, INT_SPELL_DURATION_SEC); - SMARTBUFF_ShowSubGroupsOptions(); SMARTBUFF_SetCheckButtonBuffs(0); SmartBuffOptionsFrame_cbSelfFirst:SetChecked(B[CS()][currentTemplate].SelfFirst); - - SMARTBUFF_Splash_Show(); - - SMARTBUFF_AddMsgD("Option frame updated: " .. currentTemplate); -end -function SMARTBUFF_ShowSubGroupsMini() - SMARTBUFF_ShowSubGroups("SmartBuff_MiniGroup", O.ToggleGrp); -end + SMARTBUFF_Splash_Show(); -function SMARTBUFF_ShowSubGroupsOptions() - SMARTBUFF_ShowSubGroups("SmartBuffOptionsFrame", O.ToggleGrp); + SMARTBUFF_AddMsgD("Option frame updated: " .. currentTemplate); end function SMARTBUFF_ShowSubGroups(frame, grpTable) @@ -4152,23 +3775,18 @@ function SMARTBUFF_Options_OnHide() if (SmartBuffWNF:IsVisible()) then SmartBuffWNF:Hide(); end - SMARTBUFF_ToggleTutorial(true); SmartBuffOptionsFrame:SetHeight(SMARTBUFF_OPTIONSFRAME_HEIGHT); - --SmartBuff_BuffSetup:SetHeight(SMARTBUFF_OPTIONSFRAME_HEIGHT); wipe(cBuffsCombat); - SMARTBUFF_SetInCombatBuffs(); + SMARTBUFF_SetInCombatBuffs(); SmartBuff_BuffSetup:Hide(); SmartBuff_PlayerSetup:Hide(); - SMARTBUFF_SetUnits(); SMARTBUFF_Splash_Hide(); SMARTBUFF_RebindKeys(); - --collectgarbage(); end function SmartBuff_ShowControls(sName, bShow) local children = {_G[sName]:GetChildren()}; for i, child in pairs(children) do - --SMARTBUFF_AddMsgD(i .. ": " .. child:GetName()); if (i > 1 and string.find(child:GetName(), "^"..sName..".+")) then if (bShow) then child:Show(); @@ -4195,9 +3813,9 @@ function SmartBuffOptionsFrameSlider_OnLoad(self, low, high, step, labels) self:SetMinMaxValues(low, high); self:SetValueStep(step); self:SetStepsPerPage(step); - + if (step < 1) then return; end - + self.GetValueBase = self.GetValue; self.GetValue = function() local n = self:GetValueBase(); @@ -4209,7 +3827,7 @@ function SmartBuffOptionsFrameSlider_OnLoad(self, low, high, step, labels) return r; end return low; - end; + end; end function SmartBuff_SetSliderText(self, text, value, valformat, setval) @@ -4228,7 +3846,7 @@ function SmartBuff_BuffSetup_RBTime_OnValueChanged(self) _G[SmartBuff_BuffSetup_RBTime:GetName().."Text"]:SetText(WH..format("%.0f", self:GetValue()).."\nsec|r"); end -function SMARTBUFF_SetCheckButtonBuffs(mode) +function SMARTBUFF_SetCheckButtonBuffs(mode) local objS; local objG; local i = 1; @@ -4237,24 +3855,24 @@ function SMARTBUFF_SetCheckButtonBuffs(mode) if (mode == 0) then SMARTBUFF_SetBuffs(); end - + SmartBuffOptionsFrame_cbAntiDaze:Hide(); - - if (sPlayerClass == "HUNTER" or sPlayerClass == "ROGUE" or sPlayerClass == "WARRIOR") then + + if (sPlayerClass == "HUNTER" or sPlayerClass == "ROGUE" or sPlayerClass == "WARRIOR") then SmartBuffOptionsFrameBLDuration:Hide(); if (sPlayerClass == "HUNTER") then SmartBuffOptionsFrame_cbLinkGrpBuffCheck:Hide(); SmartBuffOptionsFrame_cbAntiDaze:Show(); end end - + if (sPlayerClass == "DRUID" or sPlayerClass == "SHAMAN") then SmartBuffOptionsFrame_cbInShapeshift:Show(); else SmartBuffOptionsFrame_cbInShapeshift:Hide(); end - - SMARTBUFF_BuffOrderOnScroll(); + + SMARTBUFF_BuffOrderOnScroll(); end @@ -4262,7 +3880,6 @@ function SMARTBUFF_DropDownTemplate_OnShow(self) local i = 0; for _, tmp in pairs(SMARTBUFF_TEMPLATES) do i = i + 1; - --SMARTBUFF_AddMsgD(i .. "." .. tmp); if (tmp == currentTemplate) then break; end @@ -4274,9 +3891,9 @@ end function SMARTBUFF_DropDownTemplate_Initialize() local info = UIDropDownMenu_CreateInfo(); - info.text = ALL; - info.value = -1; - info.func = SMARTBUFF_DropDownTemplate_OnClick; + info.text = ALL; + info.value = -1; + info.func = SMARTBUFF_DropDownTemplate_OnClick; for k, v in pairs(SMARTBUFF_TEMPLATES) do info.text = SMARTBUFF_TEMPLATES[k]; info.value = k; @@ -4289,14 +3906,13 @@ end function SMARTBUFF_DropDownTemplate_OnClick(self) local i = self.value; local tmp = nil; - UIDropDownMenu_SetSelectedValue(SmartBuffOptionsFrame_ddTemplates, i); + UIDropDownMenu_SetSelectedValue(SmartBuffOptionsFrame_ddTemplates, i); tmp = SMARTBUFF_TEMPLATES[i]; - --SMARTBUFF_AddMsgD("Selected/Current Buff-Template: " .. tmp .. "/" .. currentTemplate); if (currentTemplate ~= tmp) then SmartBuff_BuffSetup:Hide(); iLastBuffSetup = -1; SmartBuff_PlayerSetup:Hide(); - + currentTemplate = tmp; SMARTBUFF_Options_OnShow(); O.LastTemplate = currentTemplate; @@ -4307,7 +3923,7 @@ end -- Splash screen functions --------------------------------------------------------------------------------------- function SMARTBUFF_Splash_Show() - if (not isInit) then return; end + if (not isInit) then return; end SMARTBUFF_Splash_ChangeFont(1); SmartBuffSplashFrame:EnableMouse(true); SmartBuffSplashFrame:Show(); @@ -4316,7 +3932,7 @@ function SMARTBUFF_Splash_Show() end function SMARTBUFF_Splash_Hide() - if (not isInit) then return; end + if (not isInit) then return; end SMARTBUFF_Splash_Clear(); SMARTBUFF_Splash_ChangePos(); SmartBuffSplashFrame:EnableMouse(false); @@ -4339,9 +3955,9 @@ end function SMARTBUFF_Splash_ChangeFont(mode) local f = SmartBuffSplashFrame; - + if (mode > 1) then - SMARTBUFF_Splash_ChangePos(); + SMARTBUFF_Splash_ChangePos(); iCurrentFont = iCurrentFont + 1; end if (not cFonts[iCurrentFont]) then @@ -4350,7 +3966,7 @@ function SMARTBUFF_Splash_ChangeFont(mode) O.CurrentFont = iCurrentFont; f:ClearAllPoints(); f:SetPoint("TOPLEFT", O.SplashX, O.SplashY); - + local fo = f:GetFontObject(); local fName, fHeight, fFlags = _G[cFonts[iCurrentFont]]:GetFont(); if (mode > 1 or O.CurrentFontSize == nil) then @@ -4358,12 +3974,12 @@ function SMARTBUFF_Splash_ChangeFont(mode) end fo:SetFont(fName, O.CurrentFontSize, fFlags); SmartBuffSplashFrameOptions.size:SetValue(O.CurrentFontSize); - + f:SetInsertMode("TOP"); f:SetJustifyV("MIDDLE"); if (mode > 0) then local si = ""; - if (OG.SplashIcon) then + if (OG.SplashIcon) then local n = O.SplashIconSize; if (n == nil or n <= 0) then n = O.CurrentFontSize; @@ -4392,7 +4008,7 @@ end function SmartBuff_PS_GetList() if (iLastBuffSetup <= 0) then return { } end - + local name = cBuffs[iLastBuffSetup].BuffS; if (name) then if (iCurrentList == 1) then @@ -4433,7 +4049,7 @@ function SmartBuff_PS_Show(i) obj:ClearFocus(); SmartBuff_PlayerSetup_EditBox:ClearFocus(); SmartBuff_PlayerSetup:Show(); - SmartBuff_PS_SelectPlayer(0); + SmartBuff_PS_SelectPlayer(0); end function SmartBuff_PS_AddPlayer() @@ -4442,7 +4058,7 @@ function SmartBuff_PS_AddPlayer() if (un and UnitIsPlayer("target") and (UnitInRaid("target") or UnitInParty("target") or O.Debug)) then if (not cList[un]) then cList[un] = true; - SmartBuff_PS_SelectPlayer(0); + SmartBuff_PS_SelectPlayer(0); end end end @@ -4456,19 +4072,18 @@ function SmartBuff_PS_RemovePlayer() cList[player] = nil; break; end - end - SmartBuff_PS_SelectPlayer(0); + end + SmartBuff_PS_SelectPlayer(0); end function SmartBuff_AddToUnitList(idx, unit, subgroup) iCurrentList = idx; local cList = SmartBuff_PS_GetList(); - local cUnitList = SmartBuff_PS_GetUnitList(); + local cUnitList = SmartBuff_PS_GetUnitList(); if (unit and subgroup) then local un = UnitName(unit); if (un and cList[un]) then cUnitList[unit] = subgroup; - --print("Added to UnitList:" .. un .. "(" .. unit .. ")"); end end end @@ -4477,19 +4092,18 @@ function SmartBuff_PS_SelectPlayer(iOp) local idx = iLastPlayer + iOp; local cList = SmartBuff_PS_GetList(); local s = ""; - + local tn = 0; for player in pairs(cList) do tn = tn + 1; s = s .. player .. "\n"; end - + -- update list in textbox if (iOp == 0) then SmartBuff_PlayerSetup_EditBox:SetText(s); - --SmartBuff_PlayerSetup_EditBox:ClearFocus(); end - + -- highlight selected player if (tn > 0) then if (idx > tn) then idx = tn; end @@ -4514,47 +4128,22 @@ end function SmartBuff_PS_Resize() local h = SmartBuffOptionsFrame:GetHeight(); local b = true; - + if (h < 200) then SmartBuffOptionsFrame:SetHeight(SMARTBUFF_OPTIONSFRAME_HEIGHT); - --SmartBuff_BuffSetup:SetHeight(SMARTBUFF_OPTIONSFRAME_HEIGHT); b = true; else SmartBuffOptionsFrame:SetHeight(40); - --SmartBuff_BuffSetup:SetHeight(40); b = false; end - SmartBuff_ShowControls("SmartBuffOptionsFrame", b); + SmartBuff_ShowControls("SmartBuffOptionsFrame", b); if (b) then SMARTBUFF_SetCheckButtonBuffs(1); end end -- END Playerlist functions - --- Mini group functions --------------------------------------------------------------------------------------- -function SMARTBUFF_MiniGroup_OnShow() - SmartBuff_MiniGroup_Title:SetText(SMARTBUFF_TITLE.." - "..currentTemplate); - SMARTBUFF_ShowSubGroupsMini(); -end - -function SMARTBUFF_MiniGroup_OnHide() -end - -function SMARTBUFF_MiniGroup_Show() - --if (O.ShowMiniGrp) then - if (O.ShowMiniGrp and iGroupSetup == 3) then - SmartBuff_MiniGroup:Show(); - else - if (SmartBuff_MiniGroup:IsVisible()) then - SmartBuff_MiniGroup:Hide(); - end - end -end --- END Mini group functions - - --- Secure button functions, NEW TBC --------------------------------------------------------------------------------------- +-- Secure button functions function SMARTBUFF_ShowSAButton() if (not InCombatLockdown()) then if (O.HideSAButton) then @@ -4574,88 +4163,84 @@ end local lastBuffType = ""; function SMARTBUFF_OnPreClick(self, button, down) if (not isInit) then return end - local mode = 0; if (button) then if (button == "MOUSEWHEELUP" or button == "MOUSEWHEELDOWN") then mode = 5; end end - + if (not InCombatLockdown()) then self:SetAttribute("type", nil); self:SetAttribute("unit", nil); self:SetAttribute("spell", nil); self:SetAttribute("item", nil); self:SetAttribute("macrotext", nil); - self:SetAttribute("target-slot", nil); + self:SetAttribute("target-slot", nil); self:SetAttribute("target-item", nil); self:SetAttribute("action", nil); end - - --sScript = self:GetScript("OnClick"); - --self:SetScript("OnClick", SMARTBUFF_OnClick); - + + -- leaving in for classic, its possible blizzard decide to make the + -- same changes they did in retail.. you never know! + + if O.SBButtonFix then + -- macros really dont like the cvar set to 1 so lets test we are + -- actually clicking the action button rather than using the scroll + -- mouse to ensure buffing works for both. + if button == "LeftButton" or button == "RightButton" then + -- clicked manually either the action button or macro + -- using a mouse button - crazy blizzard issues strike + -- again :) + C_CVar.SetCVar("ActionButtonUseKeyDown", 0 ); + else + -- assume this is a scroll mouse. + C_CVar.SetCVar("ActionButtonUseKeyDown", 1 ); + end + end + local td; if (lastBuffType == "") then td = 0.8; else td = GlobalCd; end - --SMARTBUFF_AddMsgD("Last buff type: " .. lastBuffType .. ", set cd: " .. td); - - local casting = UnitCastingInfo("player") or UnitChannelInfo("player"); - --print(casting); - if (casting ~= nil) then - --print("Casting", casting, "-> Reset AutoBuff timer"); + + if (UnitCastingInfo("player")) then tAutoBuff = GetTime() + 0.7; return; end - + if (GetTime() < (tAutoBuff + td)) then return end - - --SMARTBUFF_AddMsgD("next buff check"); + tAutoBuff = GetTime(); lastBuffType = ""; currentUnit = nil; currentSpell = nil; - currentRank = nil; - + if (not InCombatLockdown()) then - local ret, actionType, spellName, slot, unit, buffType, rankText = SMARTBUFF_Check(mode); + local ret, actionType, spellName, slot, unit, buffType = SMARTBUFF_Check(mode); if (ret and ret == 0 and actionType and spellName and unit) then lastBuffType = buffType; self:SetAttribute("type", actionType); self:SetAttribute("unit", unit); - if (actionType == SMARTBUFF_ACTION_SPELL) then + if (actionType == SMARTBUFF_ACTION_SPELL) then if (slot and slot > 0 and unit == "player") then self:SetAttribute("type", "macro"); self:SetAttribute("macrotext", string.format("/use %s\n/use %i\n/click StaticPopup1Button1", spellName, slot)); - --self:SetAttribute("target-item", slot); SMARTBUFF_AddMsgD("Weapon buff "..spellName..", "..slot); else - --rankText = "(Rang 1)"; - local name = spellName; - if (rankText ~= nil) then - name = spellName..rankText; - end - SMARTBUFF_AddMsgD("SetAttribute 'spell' = "..name); - self:SetAttribute("spell", name); + self:SetAttribute("spell", spellName); end - + if (cBuffIndex[spellName]) then currentUnit = unit; currentSpell = spellName; end - + elseif (actionType == SMARTBUFF_ACTION_ITEM and slot) then - --if (spellname ~= nil and string.find(spellname, "%-%-") ~= nil) then - -- spellname = string.gsub(spellname, "%-%-", "%-"); - --end self:SetAttribute("item", spellName); if (slot > 0) then - --self:SetAttribute("target-slot", slot); - self:SetAttribute("type", "macro"); self:SetAttribute("macrotext", string.format("/use %s\n/use %i\n/click StaticPopup1Button1", spellName, slot)); end @@ -4664,8 +4249,6 @@ function SMARTBUFF_OnPreClick(self, button, down) else SMARTBUFF_AddMsgD("Preclick: not supported actiontype -> " .. actionType); end - - --isClearSplash = true; tLastCheck = GetTime() - O.AutoTimer + GlobalCd; end end @@ -4673,7 +4256,6 @@ end function SMARTBUFF_OnPostClick(self, button, down) if (not isInit) then return end - if (button) then if (button == "MOUSEWHEELUP") then CameraZoomIn(1); @@ -4681,54 +4263,9 @@ function SMARTBUFF_OnPostClick(self, button, down) CameraZoomOut(1); end end - + if (InCombatLockdown()) then return end - - --[[ - if (O.Toggle) then - if (O.InCombat) then - for spell, data in pairs(cBuffsCombat) do - if (data and data.Unit and data.ActionType) then - SmartBuff_KeyButton:SetAttribute("unit", data.Unit); - SmartBuff_KeyButton:SetAttribute("type", data.ActionType); - SmartBuff_KeyButton:SetAttribute("spell", spell); - SmartBuff_KeyButton:SetAttribute("item", nil); - SmartBuff_KeyButton:SetAttribute("target-slot", nil); - SmartBuff_KeyButton:SetAttribute("action", nil); - SMARTBUFF_AddMsgD("Enter Combat, set button: " .. spell .. " on " .. data.Unit .. ", " .. data.ActionType); - break; - end - end - end - end - ]]-- - - --local posX, posY = GetPlayerMapPosition("player"); - --SMARTBUFF_AddMsgD("X = " .. posX .. ", Y = " .. posY); - --if (UnitCreatureType("target")) then - -- SMARTBUFF_AddMsgD(UnitCreatureType("target")); - --end - - --[[ - local r = IsSpellInRange("Nachwachsen", "target") - if(r and r == 1) then - SMARTBUFF_AddMsgD("Spell in range"); - elseif(r and r == 0) then - SMARTBUFF_AddMsgD("OOR"); - end - ]]-- - - --[[ - local s = ""; - local button = SecureStateChild_GetEffectiveButton(self); - local type = SecureButton_GetModifiedAttribute(self, "type", button, ""); - local unit = SecureButton_GetModifiedAttribute(self, "unit", button, ""); - local spell = SecureButton_GetModifiedAttribute(self, "spell", button, ""); - if (type and unit and spell) then - s = s .. type .. ", " .. unit .. ", " .. spell; - end - ]]-- - + self:SetAttribute("type", nil); self:SetAttribute("unit", nil); self:SetAttribute("spell", nil); @@ -4737,19 +4274,21 @@ function SMARTBUFF_OnPostClick(self, button, down) self:SetAttribute("target-item", nil); self:SetAttribute("macrotext", nil); self:SetAttribute("action", nil); - + SMARTBUFF_SetButtonTexture(SmartBuff_KeyButton, imgSB); - --SMARTBUFF_AddMsgD("Button reseted, " .. button); - --self:SetScript("OnClick", sScript); + + -- ensure we reset the cvar back to the original players setting + -- if it was previously changed due to casting issues. + if O.SBButtonFix then + C_CVar.SetCVar("ActionButtonUseKeyDown", O.SBButtonDownVal ); + end + end function SMARTBUFF_SetButtonTexture(button, texture, text) - --if (InCombatLockdown()) then return; end - if (button and texture and texture ~= sLastTexture) then sLastTexture = texture; button:SetNormalTexture(texture); - --SMARTBUFF_AddMsgD("Button slot texture set -> " .. texture); if (text) then --button.title:SetText(spell); end @@ -4766,41 +4305,37 @@ function SMARTBUFF_CheckMiniMapButton() else SmartBuff_MiniMapButton:SetNormalTexture(imgIconOff); end - + if (O.HideMmButton) then SmartBuff_MiniMapButton:Hide(); else SmartBuff_MiniMapButton:Show(); end - + -- Update the Titan Panel icon if (TitanPanelBarButton and TitanPanelSmartBuffButton_SetIcon ~= nil) then TitanPanelSmartBuffButton_SetIcon(); end - + -- Update the FuBar icon if (IsAddOnLoaded("FuBar") and IsAddOnLoaded("FuBar_SmartBuffFu") and SMARTBUFF_Fu_SetIcon ~= nil) then SMARTBUFF_Fu_SetIcon(); end - + -- Update the Broker icon - if (IsAddOnLoaded("Broker_SmartBuff") and SMARTBUFF_BROKER_SetIcon ~= nil) then SMARTBUFF_BROKER_SetIcon(); - end - end function SMARTBUFF_MinimapButton_CheckPos() if (not isInit or not SmartBuff_MiniMapButton) then return; end local x = SmartBuff_MiniMapButton:GetLeft(); - local y = SmartBuff_MiniMapButton:GetTop(); + local y = SmartBuff_MiniMapButton:GetTop(); if (x == nil or y == nil) then return; end x = x - Minimap:GetLeft(); - y = y - Minimap:GetTop(); + y = y - Minimap:GetTop(); if (math.abs(x) < 180 and math.abs(y) < 180) then O.MMCPosX = x; O.MMCPosY = y; - --SMARTBUFF_AddMsgD("x = " .. O.MMCPosX .. ", y = " .. O.MMCPosY); end end @@ -4811,7 +4346,7 @@ function SMARTBUFF_MinimapButton_OnUpdate(self, move) end local xpos, ypos; - self:ClearAllPoints(); + self:ClearAllPoints() if (move or O.MMCPosX == nil) then local pos, r local xmin, ymin = Minimap:GetLeft(), Minimap:GetBottom(); @@ -4820,35 +4355,29 @@ function SMARTBUFF_MinimapButton_OnUpdate(self, move) ypos = ypos/Minimap:GetEffectiveScale()-ymin-70; pos = math.deg(math.atan2(ypos,xpos)); r = math.sqrt(xpos*xpos + ypos*ypos); - --SMARTBUFF_AddMsgD("x = " .. xpos .. ", y = " .. ypos .. ", r = " .. r .. ", pos = " .. pos); - + if (r < 75) then r = 75; elseif(r > 105) then r = 105; end - + xpos = 52-r*cos(pos); ypos = r*sin(pos)-52; O.MMCPosX = xpos; O.MMCPosY = ypos; - --SMARTBUFF_AddMsgD("Update minimap button position"); else xpos = O.MMCPosX; ypos = O.MMCPosY; - --SMARTBUFF_AddMsgD("Load minimap button position"); end - self:ClearAllPoints(); +self:ClearAllPoints() self:SetPoint("TOPLEFT", "Minimap", "TOPLEFT", xpos, ypos); - --SMARTBUFF_AddMsgD("x = " .. O.MMCPosX .. ", y = " .. O.MMCPosY); - --SmartBuff_MiniMapButton:SetUserPlaced(true); - --SMARTBUFF_AddMsgD("Update minimap button"); end -- END Minimap button functions - -- Scroll frame functions --------------------------------------------------------------------------------------- + local ScrBtnSize = 20; local ScrLineHeight = 18; local function SetPosScrollButtons(parent, cBtn) @@ -4863,39 +4392,35 @@ end local StartY, EndY; local function CreateScrollButton(name, parent, cBtn, onClick, onDragStop) - local btn = CreateFrame("CheckButton", name, parent, "OptionsCheckButtonTemplate"); - btn:SetWidth(ScrBtnSize); - btn:SetHeight(ScrBtnSize); - --btn:RegisterForClicks("LeftButtonUp"); - btn:RegisterForClicks("AnyUp"); - btn:SetScript("OnClick", onClick); - --btn:SetScript("OnMouseUp", onClick); - + local btn = CreateFrame("CheckButton", name, parent, "UICheckButtonTemplate"); + btn:SetWidth(ScrBtnSize); + btn:SetHeight(ScrBtnSize); + btn:SetScript("OnClick", onClick); + if (onDragStop ~= nil) then btn:SetMovable(true); btn:RegisterForDrag("LeftButton"); - btn:SetScript("OnDragStart", function(self, b) - StartY = self:GetTop(); - self:StartMoving(); + btn:SetScript("OnDragStart", function(self, b) + StartY = self:GetTop(); + self:StartMoving(); end ); - btn:SetScript("OnDragStop", function(self, b) - EndY = self:GetTop(); - local i = tonumber(self:GetID()) + FauxScrollFrame_GetOffset(parent); - local n = math.floor((StartY-EndY) / ScrLineHeight); - self:StopMovingOrSizing(); - SetPosScrollButtons(parent, cBtn); - onDragStop(i, n); + btn:SetScript("OnDragStop", function(self, b) + EndY = self:GetTop(); + local i = tonumber(self:GetID()) + FauxScrollFrame_GetOffset(parent); + local n = math.floor((StartY-EndY) / ScrLineHeight); + self:StopMovingOrSizing(); + SetPosScrollButtons(parent, cBtn); + onDragStop(i, n); end ); end local text = btn:CreateFontString(nil, nil, "GameFontNormal"); text:SetJustifyH("LEFT"); - --text:SetAllPoints(btn); text:SetPoint("TOPLEFT", btn, "TOPLEFT", ScrBtnSize, 0); text:SetWidth(parent:GetWidth()-ScrBtnSize); - text:SetHeight(ScrBtnSize); + text:SetHeight(ScrBtnSize); btn:SetFontString(text); btn:SetHighlightFontObject("GameFontHighlight"); @@ -4904,11 +4429,11 @@ local function CreateScrollButton(name, parent, cBtn, onClick, onDragStop) highlight:SetPoint("TOPLEFT", btn, "TOPLEFT", 0, -2); highlight:SetWidth(parent:GetWidth()); highlight:SetHeight(ScrLineHeight-3); - + highlight:SetTexture("Interface/QuestFrame/UI-QuestTitleHighlight"); btn:SetHighlightTexture(highlight); - return btn; + end @@ -4926,14 +4451,14 @@ end local function OnScroll(self, cData, sBtnName) local num = #cData; local n, numToDisplay; - + if (num <= maxScrollButtons) then numToDisplay = num-1; else numToDisplay = maxScrollButtons; end - - FauxScrollFrame_Update(self, num, numToDisplay, ScrLineHeight); + + FauxScrollFrame_Update(self, num, floor(numToDisplay/3+0.5), ScrLineHeight); local t = B[CS()][CT()]; for i = 1, maxScrollButtons, 1 do n = i + FauxScrollFrame_GetOffset(self); @@ -4941,7 +4466,7 @@ local function OnScroll(self, cData, sBtnName) if (btn) then if (n <= num) then btn:SetNormalFontObject("GameFontNormalSmall"); - btn:SetHighlightFontObject("GameFontHighlightSmall"); + btn:SetHighlightFontObject("GameFontHighlightSmall"); btn:SetText(cData[n]); btn:SetChecked(t[cData[n]].EnableS); btn:Show(); @@ -4963,11 +4488,11 @@ function SMARTBUFF_BuffOrderOnScroll(self, arg1) cScrBtnBO = { }; CreateScrollButtons(self, cScrBtnBO, name, SMARTBUFF_BuffOrderBtnOnClick, SMARTBUFF_BuffOrderBtnOnDragStop); end - + if (B[CS()].Order == nil) then B[CS()].Order = { }; - end - + end + local t = { }; for _, v in pairs(B[CS()].Order) do if (v) then @@ -4984,8 +4509,6 @@ function SMARTBUFF_BuffOrderBtnOnClick(self, button) if (button == "LeftButton") then SMARTBUFF_OToggleBuff("S", i); else - local b = not self:GetChecked(); - self:SetChecked(b); SmartBuff_BuffSetup_Show(i); end end @@ -5000,17 +4523,3 @@ function SMARTBUFF_BuffOrderReset() SMARTBUFF_BuffOrderOnScroll(); end - --- Help plate functions --------------------------------------------------------------------------------------- - -local HelpPlateList = { - FramePos = { x = 20, y = -20 }, - FrameSize = { width = 480, height = 500 }, - [1] = { ButtonPos = { x = 344, y = -80 }, HighLightBox = { x = 260, y = -50, width = 204, height = 410 }, ToolTipDir = "DOWN", ToolTipText = "Spell list\nDrag'n'Drop to change the priority order" }, - [2] = { ButtonPos = { x = 105, y = -110 }, HighLightBox = { x = 10, y = -30, width = 230, height = 125 }, ToolTipDir = "DOWN", ToolTipText = "Buff reminder options" }, - [3] = { ButtonPos = { x = 105, y = -250 }, HighLightBox = { x = 10, y = -165, width = 230, height = 135 }, ToolTipDir = "DOWN", ToolTipText = "Character based options" }, - [4] = { ButtonPos = { x = 200, y = -320 }, HighLightBox = { x = 10, y = -300, width = 230, height = 90 }, ToolTipDir = "RIGHT", ToolTipText = "Additional UI options" }, -} - -function SMARTBUFF_ToggleTutorial(close) -end diff --git a/SmartBuff.toc b/SmartBuff.toc index 3df8bb4..b48e20d 100644 --- a/SmartBuff.toc +++ b/SmartBuff.toc @@ -1,19 +1,19 @@ ## Interface: 30401 -## Title: |TInterface\Addons\Smartbuff\Icons\IconEnabled:0|t SmartBuff |cffffffff(WOTLK Classic)|r -## Version: 40.30401 -## Author: |cff20d2ffCodermik (Mik / Castanova on EU-Mirage Raceway) & Aeldra|r (EU-Proudmoore) -## Notes: Cast the most important buffs on you or party, raid, pets and assigned tanks. Use /sbm for options menu. +## Title: SmartBuff |cffffffff(Classic)|r by |cff00ff00Codermik & Aeldra|r +## Version: 41.30401 +## Author: |cff20d2ffCodermik & Aeldra|r (EU-Proudmoore) +## Contributing Author: |cff20d2ffSpeedwaystar +## Notes: Cast the most important buffs on you or party/raid members/pets. Use /sbm for options menu. ## DefaultState: Enabled ## LoadOnDemand: 0 ## SavedVariables: SMARTBUFF_OptionsGlobal ## SavedVariablesPerCharacter: SMARTBUFF_Options, SMARTBUFF_Buffs -lib\LibStub\LibStub.lua -lib\CallbackHandler-1.0\CallbackHandler-1.0.lua -lib\LibClassicDurations\LibClassicDurations.xml -lib\LibRangeCheck-2.0\LibRangeCheck-2.0.lua +Libs\LibStub\LibStub.lua +Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua +Libs\LibRangeCheck-2.0\LibRangeCheck-2.0.lua SmartBuff.globals.lua SmartBuff.xml -lib\Broker_SmartBuff\LibDataBroker-1.1.lua -lib\Broker_SmartBuff\Broker_SmartBuff.lua +Libs\Broker_SmartBuff\LibDataBroker-1.1.lua +Libs\Broker_SmartBuff\Broker_SmartBuff.lua diff --git a/SmartBuff.xml b/SmartBuff.xml index c825d24..71690fe 100644 --- a/SmartBuff.xml +++ b/SmartBuff.xml @@ -8,95 +8,94 @@