-- ACE declarations shardacewotlk = LibStub("AceAddon-3.0"):NewAddon("shardacewotlk", "AceEvent-3.0", "AceConsole-3.0") local BD = LibStub("ButtonDaemon-1.0") local AceDB = LibStub("AceDB-3.0") local AceConfig = LibStub("AceConfig-3.0") local dialog = LibStub("AceConfigDialog-3.0") -- Option tabs and handlers local options = { type = 'group', childGroups = "tab", args = { main = { type = 'group', name ='Main Buttons', order = 1, args = { radius = { type = 'range', name = "Radius", desc = "Set the Radius for placing the main buttons", handler = shardacewotlk, min = 15, max = 1000, step = 1, --pattern = "%d", get = "getRadius", set = "setRadius", order = 1, }, angle = { type = 'range', name = "Start Angle", desc = "Set the starting Angle for placing the main buttons", handler = shardacewotlk, min = 0, max = 359, step = 1, --pattern = "%d", get = "getAngle", set = "setAngle", order = 2, }, override = { type = 'toggle', name = "Custom Increment", desc = "Toggle over-riding increment angle", handler = shardacewotlk, get = "getOverrideState", set = "setOverrideState", order = 3, }, increment = { type = 'range', name = "Increment Angle", desc = "Set the Increment Angle for placing the main buttons", handler = shardacewotlk, min = -359, max = 359, step = 1, --pattern = "%d", get = "getIncrement", set = "setIncrement", order = 4, }, reverse = { type = 'toggle', name = "Reverse Placement", desc = "Toggle direction of button placement. Does not apply to custom Increment Angles", handler = shardacewotlk, get = "getReverseState", set = "setReverseState", order = 5, }, anchor = { type = 'input', name = "Anchor Frame", desc = "Set the Frame to place the main buttons around. Defaults to Minimap", handler = shardacewotlk, --pattern = "%d", get = "getAnchor", set = "setAnchor", order = 6, }, straight = { type = 'toggle', name = "Toggle Alignment", desc = "Toggle alignment of main buttons between circular and straight", handler = shardacewotlk, get = "getStraightState", set = "setStraightState", order = 7, }, offx = { type = 'range', name = "X Offset", desc = "Set the X Offset for Placing the main buttons", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "getMainOffX", set = "setMainOffX", order = 8, }, offy = { type = 'range', name = "Y Offset", desc = "Set the Y Offset for Placing the main buttons", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "getMainOffY", set = "setMainOffY", order = 9, }, }, }, firstrow = { type = 'group', name ='1st Row', order = 2, args = { initx = { type = 'range', name = "Initial X", desc = "Set the Initial X Posistion for Placing the first row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get1InitX", set = "set1InitX", order = 1, }, inity = { type = 'range', name = "Initial Y", desc = "Set the Initial Y Posistion for Placing the first row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get1InitY", set = "set1InitY", order = 2, }, offx = { type = 'range', name = "X Offset", desc = "Set the X Offset for Placing the first row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get1OffX", set = "set1OffX", order = 3, }, offy = { type = 'range', name = "Y Offset", desc = "Set the Y Offset for Placing the first row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get1OffY", set = "set1OffY", order = 4, }, }, }, secondrow = { type = 'group', name ='2nd Row', order = 3, args = { initx = { type = 'range', name = "Initial X", desc = "Set the Initial X Posistion for Placing the second row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get2InitX", set = "set2InitX", order = 1, }, inity = { type = 'range', name = "Initial Y", desc = "Set the Initial Y Posistion for Placing the second row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get2InitY", set = "set2InitY", order = 2, }, offx = { type = 'range', name = "X Offset", desc = "Set the X Offset for Placing the second row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get2OffX", set = "set2OffX", order = 3, }, offy = { type = 'range', name = "Y Offset", desc = "Set the Y Offset for Placing the second row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get2OffY", set = "set2OffY", order = 4, }, }, }, thirdrow = { type = 'group', name ='3rd Row', order = 4, args = { initx = { type = 'range', name = "Initial X", desc = "Set the Initial X Posistion for Placing the third row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get3InitX", set = "set3InitX", order = 1, }, inity = { type = 'range', name = "Initial Y", desc = "Set the Initial Y Posistion for Placing the third row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get3InitY", set = "set3InitY", order = 2, }, offx = { type = 'range', name = "X Offset", desc = "Set the X Offset for Placing the third row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get3OffX", set = "set3OffX", order = 3, }, offy = { type = 'range', name = "Y Offset", desc = "Set the Y Offset for Placing the third row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get3OffY", set = "set3OffY", order = 4, }, }, }, fourthrow = { type = 'group', name ='4th Row', order = 5, args = { initx = { type = 'range', name = "Initial X", desc = "Set the Initial X Posistion for Placing the forth row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get4InitX", set = "set4InitX", order = 1, }, inity = { type = 'range', name = "Initial Y", desc = "Set the Initial Y Posistion for Placing the forth row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get4InitY", set = "set4InitY", order = 2, }, offx = { type = 'range', name = "X Offset", desc = "Set the X Offset for Placing the forth row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get4OffX", set = "set4OffX", order = 3, }, offy = { type = 'range', name = "Y Offset", desc = "Set the Y Offset for Placing the forth row", handler = shardacewotlk, min = -100, max = 100, step = 1, --pattern = "%d", get = "get4OffY", set = "set4OffY", order = 4, }, }, }, shardmanager = { type = 'group', name ='Soul Shards', order = 7, args = { sortshards = { type = 'toggle', name = "Sort Shards", desc = "Toggle shard sorting", handler = shardacewotlk, get = "getSortShards", set = "setSortShards", order = 1, }, shardbag = { type = 'range', name = "Primary Shard Bag", desc = "Set bag into which shards are sorted", handler = shardacewotlk, min = 0, max = 4, step = 1, get = "getShardBag", set = "setShardBag", order = 2, }, shardbagtwo = { type = 'range', name = "Secondary Shard Bag", desc = "Set bag into which shards are sorted", handler = shardacewotlk, min = 0, max = 4, step = 1, get = "getShardBagTwo", set = "setShardBagTwo", order = 3, }, reversesort = { type = 'toggle', name = "Reverse Sort", desc = "Toggle reverse sorting", handler = shardacewotlk, get = "getReverseSort", set = "setReverseSort", order = 4, }, destroyshards = { type = 'toggle', name = "Shard Destruction", desc = "Toggle destruction of shards once maximum has been reached", handler = shardacewotlk, get = "getDestroyShards", set = "setDestroyShards", order = 5, }, maxshards = { type = 'range', name = "Maximum Shards", desc = "Maximum number of shards after which they are destroyed upon creation", handler = shardacewotlk, min = 0, max = 100, step = 1, get = "getMaxShards", set = "setMaxShards", order = 6, }, }, }, messages = { type = 'group', name = 'Messages', order = 8, args = { soulstonemsg = { type = 'input', name = "Soulstone Cast", desc = "When soulstone cast on a player", handler = shardacewotlk, get = "getSoulstoneMsg", set = "setSoulstoneMsg", order = 1, }, enablesoulstonemsg = { type = 'toggle', name = "Enable Soulstone Messages", desc = "Enable soulstone cast message", handler = shardacewotlk, get = "getEnableSoulstoneMsg", set = "setEnableSoulstoneMsg", order = 2, }, ritualofsoulsmsg = { type = 'input', name = "Ritual Of Souls", desc = "When casting Ritual of Souls", handler = shardacewotlk, get = "getRitualOfSoulsMsg", set = "setRitualOfSoulsMsg", order = 3, }, enableritualofsoulsmsg = { type = 'toggle', name = "Enable Ritual Of Souls Message", desc = "Enable Ritual Of Souls message", handler = shardacewotlk, get = "getEnableRitualOfSoulsMsg", set = "setEnableRitualOfSoulsMsg", order = 4, }, ritualofsummoningsmsg = { type = 'input', name = "Ritual Of Summoning", desc = "When casting Ritual Of Summoning", handler = shardacewotlk, get = "getRitualOfSummoningMsg", set = "setRitualOfSummoningMsg", order = 5, }, enableritualofsummoningmsg = { type = 'toggle', name = "Enable Ritual Of Summoning Message", desc = "Enable Ritual Of Summoning message", handler = shardacewotlk, get = "getEnableRitualOfSummoningMsg", set = "setEnableRitualOfSummoningMsg", order = 6, }, ritualofdoommsg = { type = 'input', name = "Ritual Of Doom", desc = "When casting Ritual Of Doom", handler = shardacewotlk, get = "getRitualOfDoomMsg", set = "setRitualOfDoomMsg", order = 7, }, enableritualofdoommsg = { type = 'toggle', name = "Enable Ritual Of Doom Message", desc = "Enable Ritual Of Doom message", handler = shardacewotlk, get = "getEnableRitualOfDoomMsg", set = "setEnableRitualOfDoomMsg", order = 8, }, }, }, miscoptions = { type = 'group', name ='Miscellaneous', order = 9, args = { showtooltips = { type = 'toggle', name = "Show tool-tips", desc = "Show tool-tips of spells associated with Shard Ace buttons", handler = shardacewotlk, get = "getShowTooltips", set = "setShowTooltips", order = 1, }, soundstate = { type = 'toggle', name = "Play soulstone sound", desc = "Play a sound file upon expiry of your applied soulstone. The file name is soulstone.mp3 and you can replace this with your own file.", handler = shardacewotlk, get = "getSoundState", set = "setSoundState", order = 2, }, saymessages = { type = 'toggle', name = "Say messsages", desc = "Post messages to /s instead of the party or raid. Soulstone message will always go to party or raid.", handler = shardacewotlk, get = "getSayMessages", set = "setSayMessages", order = 3, }, }, }, } } function shardacewotlk:getMainOffX() return self.db.profile.mainoffx end function shardacewotlk:setMainOffX(info, s) self.db.profile.mainoffx = s self:PosistionButtons() end function shardacewotlk:getMainOffY() return self.db.profile.mainoffy end function shardacewotlk:setMainOffY(info, s) self.db.profile.mainoffy = s self:PosistionButtons() end function shardacewotlk:getStraightState() return self.db.profile.straight end function shardacewotlk:setStraightState() self.db.profile.straight = not self.db.profile.straight self:PosistionButtons() end function shardacewotlk:getRadius() return self.db.profile.radius end function shardacewotlk:setRadius(info, s) self.db.profile.radius = s self:PosistionButtons() end function shardacewotlk:getAngle() return self.db.profile.angle end function shardacewotlk:setAngle(info, s) self.db.profile.angle = s self:PosistionButtons() end function shardacewotlk:getReverseState() if self.db.profile.reverse == -1 then return true else return false end end function shardacewotlk:setReverseState() self.db.profile.reverse = self.db.profile.reverse * -1 self:PosistionButtons() end function shardacewotlk:getOverrideState() return self.db.profile.override end function shardacewotlk:setOverrideState() self.db.profile.override = not self.db.profile.override self:PosistionButtons() end function shardacewotlk:getIncrement() return self.db.profile.increment end function shardacewotlk:setIncrement(info, s) self.db.profile.increment = s self:PosistionButtons() end function shardacewotlk:getAnchor() return self.db.profile.anchor end function shardacewotlk:setAnchor(info, s) self.db.profile.anchor = s if strlower(s) == "cursor" then self.db.profile.curx, self.db.profile.cury = GetCursorPosition() self.anchor:SetPoint("CENTER",UIParent,"BOTTOMLEFT",self.db.profile.curx / UIParent:GetEffectiveScale(), self.db.profile.cury / UIParent:GetEffectiveScale() ) else self.anchor:SetPoint("CENTER",UIParent,"BOTTOMLEFT",_G[s]:GetCenter() ) end self:PosistionButtons() end function shardacewotlk:get1InitX() return self.db.profile.oneinitx end function shardacewotlk:set1InitX(info, s) self.db.profile.oneinitx = s self:PosistionButtons() end function shardacewotlk:get1InitY() return self.db.profile.oneinity end function shardacewotlk:set1InitY(info, s) self.db.profile.oneinity = s self:PosistionButtons() end function shardacewotlk:get1OffX() return self.db.profile.oneoffx end function shardacewotlk:set1OffX(info, s) self.db.profile.oneoffx = s self:PosistionButtons() end function shardacewotlk:get1OffY() return self.db.profile.oneoffy end function shardacewotlk:set1OffY(info, s) self.db.profile.oneoffy = s self:PosistionButtons() end function shardacewotlk:get2InitX() return self.db.profile.twoinitx end function shardacewotlk:set2InitX(info, s) self.db.profile.twoinitx = s self:PosistionButtons() end function shardacewotlk:get2InitY() return self.db.profile.twoinity end function shardacewotlk:set2InitY(info, s) self.db.profile.twoinity = s self:PosistionButtons() end function shardacewotlk:get2OffX() return self.db.profile.twooffx end function shardacewotlk:set2OffX(info, s) self.db.profile.twooffx = s self:PosistionButtons() end function shardacewotlk:get2OffY() return self.db.profile.twooffy end function shardacewotlk:set2OffY(info, s) self.db.profile.twooffy = s self:PosistionButtons() end function shardacewotlk:get3InitX() return self.db.profile.threeinitx end function shardacewotlk:set3InitX(info, s) self.db.profile.threeinitx = s self:PosistionButtons() end function shardacewotlk:get3InitY() return self.db.profile.threeinity end function shardacewotlk:set3InitY(info, s) self.db.profile.threeinity = s self:PosistionButtons() end function shardacewotlk:get3OffX() return self.db.profile.threeoffx end function shardacewotlk:set3OffX(info, s) self.db.profile.threeoffx = s self:PosistionButtons() end function shardacewotlk:get3OffY() return self.db.profile.threeoffy end function shardacewotlk:set3OffY(info, s) self.db.profile.threeoffy = s self:PosistionButtons() end function shardacewotlk:get4InitX() return self.db.profile.fourinitx end function shardacewotlk:set4InitX(info, s) self.db.profile.fourinitx = s self:PosistionButtons() end function shardacewotlk:get4InitY() return self.db.profile.fourinity end function shardacewotlk:set4InitY(info, s) self.db.profile.fourinity = s self:PosistionButtons() end function shardacewotlk:get4OffX() return self.db.profile.fouroffx end function shardacewotlk:set4OffX(info, s) self.db.profile.fouroffx = s self:PosistionButtons() end function shardacewotlk:get4OffY() return self.db.profile.fouroffy end function shardacewotlk:set4OffY(info, s) self.db.profile.fouroffy = s self:PosistionButtons() end function shardacewotlk:getSortShards() return self.db.profile.sortshards end function shardacewotlk:setSortShards() self.db.profile.sortshards = not self.db.profile.sortshards end function shardacewotlk:getShardBag() return self.db.profile.shardbag end function shardacewotlk:setShardBagTwo(info, s) self.db.profile.shardbagtwo = s end function shardacewotlk:getShardBagTwo() return self.db.profile.shardbagtwo end function shardacewotlk:setShardBag(info, s) self.db.profile.shardbag = s end function shardacewotlk:getReverseSort() return self.db.profile.reversesort end function shardacewotlk:setReverseSort() self.db.profile.reversesort = not self.db.profile.reversesort end function shardacewotlk:getDestroyShards() return self.db.profile.destroyshards end function shardacewotlk:setDestroyShards() self.db.profile.destroyshards = not self.db.profile.destroyshards end function shardacewotlk:getMaxShards() return self.db.profile.maxshards end function shardacewotlk:setMaxShards(info, s) self.db.profile.maxshards = s end function shardacewotlk:getSoulstoneMsg() return self.db.profile.soulstonemessage end function shardacewotlk:setSoulstoneMsg(info, s) self.db.profile.soulstonemessage = s end function shardacewotlk:getEnableSoulstoneMsg() return self.db.profile.enablesoulstonemessage end function shardacewotlk:setEnableSoulstoneMsg() self.db.profile.enablesoulstonemessage = not self.db.profile.enablesoulstonemessage end function shardacewotlk:getRitualOfSoulsMsg() return self.db.profile.ritualofsoulsmessage end function shardacewotlk:setRitualOfSoulsMsg(info, s) self.db.profile.ritualofsoulsmessage = s end function shardacewotlk:getEnableRitualOfSoulsMsg() return self.db.profile.enableritualofsoulsmessage end function shardacewotlk:setEnableRitualOfSoulsMsg() self.db.profile.enableritualofsoulsmessage = not self.db.profile.enableritualofsoulsmessage end function shardacewotlk:getRitualOfSummoningMsg() return self.db.profile.ritualofsummoningmessage end function shardacewotlk:setRitualOfSummoningMsg(info, s) self.db.profile.ritualofsummoningmessage = s end function shardacewotlk:getEnableRitualOfSummoningMsg() return self.db.profile.enableritualofsummoningmessage end function shardacewotlk:setEnableRitualOfSummoningMsg() self.db.profile.enableritualofsummoningmessage = not self.db.profile.enableritualofsummoningmessage end function shardacewotlk:getRitualOfDoomMsg() return self.db.profile.ritualofdoommessage end function shardacewotlk:setRitualOfDoomMsg(info, s) self.db.profile.ritualofdoommessage = s end function shardacewotlk:getEnableRitualOfDoomMsg() return self.db.profile.enableritualofdoommessage end function shardacewotlk:setEnableRitualOfDoomMsg() self.db.profile.enableritualofdoommessage = not self.db.profile.enableritualofdoommessage end function shardacewotlk:getShowTooltips() return self.db.profile.showtooltips end function shardacewotlk:setShowTooltips() self.db.profile.showtooltips = not self.db.profile.showtooltips self:SetupTooltips() end function shardacewotlk:getSoundState() return self.db.profile.soundstate end function shardacewotlk:setSoundState() self.db.profile.soundstate = not self.db.profile.soundstate end function shardacewotlk:getSayMessages() return self.db.profile.saymessages end function shardacewotlk:setSayMessages() self.db.profile.saymessages = not self.db.profile.saymessages end -- Item and Spell IDs shardacewotlk.SoulShardID = 6265 shardacewotlk.HealthstoneID = { [5512] = 1, [19004] = 1, [19005] = 1, [5511] = 1, [19006] = 1, [19007] = 1, [5509] = 1, [19008] = 1, [19009] = 1, [5510] = 1, [19010] = 1, [19011] = 1, [9421] = 1, [19012] = 1, [19013] = 1, [22103] = 1, [22104] = 1, [22105] = 1, [36889] = 1, [36890] = 1, [36891] = 1, [36892] = 1, [36893] = 1, [36894] = 1, } shardacewotlk.SoulstoneID = { [5232] = 1, [16892] = 1, [16893] = 1, [16895] = 1, [16896] = 1, [22116] = 1, [36895] = 1, } --MZshardacewotlk.SpellstoneID = { -- [41191]=1, -- [41192]=1, -- [41193]=1, -- [41194]=1, -- [41195]=1, -- [41196]=1, --} --shardacewotlk.FirestoneID = { -- [41170]=1, -- [41169]=1, -- [41171]=1, -- [41172]=1, -- [40773]=1, -- [41173]=1, -- [41174]=1, --} shardacewotlk.spellID = { CreateSS = 693, CreateSP = 2362, CreateFS = 6366, CreateHS = 6201, FelDomination = 18708, Enslave = 1098, Sacrifice = 18788, SoulLink = 19028, Empower = 47193, Imp = 688, Voidwalker = 697, Succubus = 712, Felhunter = 691, Infernal = 1122, Doomguard = 18540, Felguard = 30146, DetectInvis = 132, UnendingBreath = 5697, SenseDemons = 5500, DemonSkin = 687, DemonArmor = 706, FelArmor = 28176, ShadowWard = 6229, Metamorph = 47241, Felsteed = 5784, Dreadsteed = 23161, Summon = 698, Eye = 126, Banish = 710, SoulWell = 29893, SummonCircle = 48018, PortCircle = 48020, } -- Other local variables local shardCount, lastSort local CreateButtonsFlag, SetupButtonsFlag, PosistionButtonsFlag local SoulstoneTarget -- Subroutines function shardacewotlk:FindShard(sTable,sbag,sbag2) for bag = 0, 4, 1 do local bagname = GetBagName(bag) or "" local size = GetContainerNumSlots(bag) local nonshardbagindex = 1 if (size > 0)then for slot = 1, size, 1 do local ItemReturned = GetContainerItemLink(bag,slot) if (ItemReturned) then local _,_,itemID = string.find(ItemReturned, "item:(%d+):%d+:%d+:%d+") itemID = tonumber(itemID) if itemID == self.SoulShardID then if not bag == sbag and not bag == sbag2 then tinsert(sTable, {bag, slot}) else tinsert(sTable, nonshardbagindex,{bag, slot}) nonshardbaginsex = nonshardbagindex + 1 end end end end end end end function shardacewotlk:FindSpace(eTable, sbag, Revsort) local theshardbag = sbag local size = GetContainerNumSlots(theshardbag) local a, b, c = 1, 1, 1 if(size > 0)then if self:getReverseSort() then a = size c = -1 else b = size end for slot = a, b, c do local ItemReturned = GetContainerItemLink(theshardbag,slot) if (ItemReturned) then local _,_,itemID = string.find(ItemReturned, "item:(%d+):%d+:%d+:%d+") itemID = tonumber(itemID) if (not itemID) then tinsert(eTable, {theshardbag, slot}) elseif(itemID ~= self.SoulShardID)then tinsert(eTable, {theshardbag, slot}) end else tinsert(eTable, {theshardbag, slot}) end end end end function shardacewotlk:SortShardsIntoBags(sbag, sbag2, Revsort) -- sbag = 0-4, bag to sort into. Revsort: true = sort into sbag from bottom up local delay = GetTime() - lastSort if delay < 1 then return end local sTable = {} local eTable = {} self:FindShard(sTable,sbag,sbag2) if self:getMaxShards() >= 0 and self:getDestroyShards() then if #sTable > self:getMaxShards() then for i = #sTable, self:getMaxShards()+1, -1 do PickupContainerItem(sTable[i][1], sTable[i][2]) if CursorHasItem() then local _, CursorHeldItemID, _ = GetCursorInfo() if (CursorHeldItemID == self.SoulShardID) then DeleteCursorItem() sTable[i] = nil end end end end end if not (sbag == sbag2) then self:FindSpace(eTable, sbag2, Revsort) end self:FindSpace(eTable, sbag, Revsort) local sLength = #sTable local eLength = #eTable local temp = sLength if(eLength > temp)then temp = eLength end for i = 1, temp, 1 do if #eTable == 0 or #sTable == 0 then break end if(not CursorHasItem())then if sTable[#sTable][1] ~= sbag and not (sTable[#sTable][1] == sbag2 and eTable[#eTable][1] == sbag2) then PickupContainerItem(sTable[#sTable][1],sTable[#sTable][2]) PickupContainerItem(eTable[#eTable][1],eTable[#eTable][2]) sTable[#sTable] = nil eTable[#eTable] = nil else sTable[#sTable] = nil end end end lastSort = GetTime() end function shardacewotlk:ScanInv() self.Timers.BagTimer = nil if not shardCount then shardCount = self.buttons[1]:CreateFontString("DDShardCount", "OVERLAY") shardCount:SetFontObject(GameFontHighlightSmall) shardCount:SetTextColor(1,1,1,1) shardCount:SetAllPoints() shardCount:SetText(GetItemCount(self.SoulShardID)) else shardCount:SetText(GetItemCount(self.SoulShardID)) end local hsCount = 0 for itemID,_ in pairs(self.HealthstoneID) do hsCount = hsCount + GetItemCount(itemID) end --MZ [5] -> [3] if hsCount == 0 then self.buttons[3]:Desaturate(true) else self.buttons[3]:Desaturate(false) end local ssCount = 0 for itemID,_ in pairs(self.SoulstoneID) do ssCount = ssCount + GetItemCount(itemID) end if ssCount == 0 then self.buttons[2]:Desaturate(true) else self.buttons[2]:Desaturate(false) end local spCount = 0 --MZ for itemID,_ in pairs(self.SpellstoneID) do -- spCount = spCount + GetItemCount(itemID) -- end -- if spCount == 0 then -- self.buttons[3]:Desaturate(true) -- else -- self.buttons[3]:Desaturate(false) -- end local fsCount = 0 -- for itemID,_ in pairs(self.FirestoneID) do -- fsCount = fsCount + GetItemCount(itemID) -- end -- if fsCount == 0 then -- self.buttons[4]:Desaturate(true) -- else -- self.buttons[4]:Desaturate(false) -- end if (self:getSortShards() and not CursorHasItem()) then self:SortShardsIntoBags(self:getShardBag(),self:getShardBagTwo(),self:getReverseSort()) end end function shardacewotlk:SetupTooltips() if self:getShowTooltips() then for _, button in ipairs({self.buttons[1]:GetChildren()}) do button:SetScript("OnEnter", function(self) GameTooltip_SetDefaultAnchor(GameTooltip, UIParent); GameTooltip:SetHyperlink(GetSpellLink(self:GetAttribute("spell"),"") or "spell:23161") end) button:SetScript("OnLeave", function(self) GameTooltip:Hide() end ) end --MZ for i=2, 5, 1 do for i=2, 3, 1 do self.buttons[i]:SetScript("OnEnter", function(self) GameTooltip_SetDefaultAnchor(GameTooltip, UIParent); GameTooltip:SetHyperlink(GetSpellLink(self:GetAttribute("spell2"),"")) end) self.buttons[i]:SetScript("OnLeave", function(self) GameTooltip:Hide() end ) end else for _, button in ipairs({self.buttons[1]:GetChildren()}) do button:SetScript("OnEnter", nil) button:SetScript("OnLeave", nil) end --MZ for i=2, 5, 1 do for i=2, 3, 1 do self.buttons[i]:SetScript("OnEnter", nil) self.buttons[i]:SetScript("OnLeave", nil) end end end function shardacewotlk:CreateButtons() if InCombatLockdown() then CreateButtonsFlag = true return end self.buttons = self.buttons or { BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", "Interface\\AddOns\\shardacewotlk\\blank", "SecureHandlerClickTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.CreateSS)), "SecureActionButtonTemplate"), --MZ BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.CreateSP)), "SecureActionButtonTemplate"), -- BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.CreateFS)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.CreateHS)), "SecureActionButtonTemplate"), } self.firstrow = self.firstrow or { BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.FelDomination)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Enslave)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Sacrifice)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.SoulLink)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Empower)), "SecureActionButtonTemplate"), } self.secondrow = self.secondrow or { BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Imp)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Voidwalker)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Succubus)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Felhunter)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Infernal)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Doomguard)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Felguard)), "SecureActionButtonTemplate"), } self.thirdrow = self.thirdrow or { BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.DetectInvis)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.UnendingBreath)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.SenseDemons)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.DemonSkin)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.FelArmor)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.ShadowWard)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Metamorph)), "SecureActionButtonTemplate"), } self.forthrow = self.forthrow or { BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Dreadsteed)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Summon)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Eye)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.Banish)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.SoulWell)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.SummonCircle)), "SecureActionButtonTemplate"), BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", select(3,GetSpellInfo(self.spellID.PortCircle)), "SecureActionButtonTemplate"), } self.anchor = self.anchor or BD:NewButton("Interface\\AddOns\\shardacewotlk\\BtnRound", "Interface\\AddOns\\shardacewotlk\\blank", nil) self.anchor:Hide() if strlower(self.db.profile.anchor or "") == "cursor" then self.anchor:SetPoint("CENTER",UIParent,"BOTTOMLEFT",self.db.profile.curx / UIParent:GetEffectiveScale(), self.db.profile.cury / UIParent:GetEffectiveScale() ) else self.anchor:SetPoint("CENTER",UIParent,"BOTTOMLEFT",_G[self.db.profile.anchor or "Minimap"]:GetCenter() ) end -- self.buttons[1]:RegisterForDrag("LeftButton") -- self.buttons[1]:SetScript("OnDragStart", function(self) self:StartMoving() end) -- self.buttons[1]:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) end function shardacewotlk:PosistionButtons() if InCombatLockdown() then PositionButtonsFlag = true return end for _, button in pairs(self.buttons) do button:ClearAllPoints() button:SetPoint("BOTTOMRIGHT", UIParent, "TOPLEFT", 0,0) button:SetParent("UIParent") button:Show() button:Resize(26, 26) end for _, button in pairs(self.firstrow) do button:SetPoint("BOTTOMRIGHT", UIParent, "TOPLEFT", 0,0) button:SetParent(self.buttons[1]) button:Resize(26, 26) end for _, button in pairs(self.secondrow) do button:SetPoint("BOTTOMRIGHT", UIParent, "TOPLEFT", 0,0) button:SetParent(self.buttons[1]) button:Resize(26, 26) end for _, button in pairs(self.thirdrow) do button:SetPoint("BOTTOMRIGHT", UIParent, "TOPLEFT", 0,0) button:SetParent(self.buttons[1]) button:Resize(26, 26) end for _, button in pairs(self.forthrow) do button:SetPoint("BOTTOMRIGHT", UIParent, "TOPLEFT", 0,0) button:SetParent(self.buttons[1]) button:Resize(26, 26) end if self:getStraightState() then local x,y = BD:GetXY(self:getRadius(), self:getAngle()) BD:ArrangeStraight(self.anchor, x, y, self:getMainOffX(), self:getMainOffY(), self.buttons) else BD:ArrangeCircle(self.anchor, self:getRadius(), self:getAngle(), self:getOverrideState() and self:getIncrement() or (((math.deg(math.acos(13/self:getRadius())))-90)*2)* self.db.profile.reverse, self.buttons) end BD:ArrangeStraight(self.buttons[1], self:get1InitX(), self:get1InitY(), self:get1OffX(), self:get1OffY(), self.firstmap) BD:ArrangeStraight(self.buttons[1], self:get2InitX(), self:get2InitY(), self:get2OffX(), self:get2OffY(), self.secondmap) BD:ArrangeStraight(self.buttons[1], self:get3InitX(), self:get3InitY(), self:get3OffX(), self:get3OffY(), self.thirdmap) BD:ArrangeStraight(self.buttons[1], self:get4InitX(), self:get4InitY(), self:get4OffX(), self:get4OffY(), self.forthmap) end function shardacewotlk:SetupButtons() if InCombatLockdown() then SetupButtonsFlag = true return end local tmpspell, mount =0,0 for i = 1, GetNumCompanions("MOUNT") do _,_,spellNum,_,_ = GetCompanionInfo("MOUNT", i) if spellNum == self.spellID.Felsteed then mount = spellNum elseif spellNum == self.spellID.Dreadsteed then mount = spellNum break end end local hsmacro = "" local ssmacro = "" local spmacro = "" local fsmacro = "" for id,_ in pairs(self.HealthstoneID) do hsmacro = format("/use item:%s\n%s", id, hsmacro) end for id,_ in pairs(self.SoulstoneID) do ssmacro = format("/use item:%s\n%s", id, ssmacro) end --MZ for id,_ in pairs(self.SpellstoneID) do -- spmacro = format("/use item:%s\n/use 16\n%s", id, spmacro) -- end -- for id,_ in pairs(self.FirestoneID) do -- fsmacro = format("/use item:%s\n/use 16\n%s", id, fsmacro) -- end self.buttons[1]:RegisterForClicks("AnyUp") self.buttons[1]:SetAttribute("_onclick", [[ if FlyOutButtonsOpen then for i, button in ipairs(MenuButtons) do button:Hide() end FlyOutButtonsOpen = false else for i, button in ipairs(MenuButtons) do button:Show() end FlyOutButtonsOpen = true end ]]) self.buttons[2]:SetAttribute("type2", "spell") self.buttons[2]:SetAttribute("spell2", GetSpellInfo(GetSpellInfo(self.spellID.CreateSS))) -- self.buttons[3]:SetAttribute("type2", "spell") -- self.buttons[3]:SetAttribute("spell2", GetSpellInfo(GetSpellInfo(self.spellID.CreateSP))) -- self.buttons[4]:SetAttribute("type2", "spell") -- self.buttons[4]:SetAttribute("spell2", GetSpellInfo(GetSpellInfo(self.spellID.CreateFS))) --MZ [5] -> [3] self.buttons[3]:SetAttribute("type2", "spell") self.buttons[3]:SetAttribute("spell2", GetSpellInfo(GetSpellInfo(self.spellID.CreateHS))) self.buttons[2]:SetAttribute("type1", "macro") self.buttons[2]:SetAttribute("macro1", ATTRIBUTE_NOOP) self.buttons[2]:SetAttribute("macrotext1", ssmacro) --MZ self.buttons[3]:SetAttribute("type1", "macro") -- self.buttons[3]:SetAttribute("macro1", ATTRIBUTE_NOOP) -- self.buttons[3]:SetAttribute("macrotext1", spmacro) --MZ self.buttons[4]:SetAttribute("type1", "macro") -- self.buttons[4]:SetAttribute("macro1", ATTRIBUTE_NOOP) -- self.buttons[4]:SetAttribute("macrotext1", fsmacro) --MZ [5] -> [3] self.buttons[3]:SetAttribute("type1", "macro") self.buttons[3]:SetAttribute("macro1", ATTRIBUTE_NOOP) self.buttons[3]:SetAttribute("macrotext1", hsmacro) self.firstrow[1]:SetAttribute("type", "spell") self.firstrow[1]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.FelDomination))) self.firstrow[2]:SetAttribute("type", "spell") self.firstrow[2]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Enslave))) self.firstrow[3]:SetAttribute("type", "spell") self.firstrow[3]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Sacrifice))) self.firstrow[4]:SetAttribute("type", "spell") self.firstrow[4]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.SoulLink))) self.firstrow[5]:SetAttribute("type", "spell") self.firstrow[5]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Empower))) self.secondrow[1]:SetAttribute("type", "spell") self.secondrow[1]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Imp))) self.secondrow[2]:SetAttribute("type", "spell") self.secondrow[2]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Voidwalker))) self.secondrow[3]:SetAttribute("type", "spell") self.secondrow[3]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Succubus))) self.secondrow[4]:SetAttribute("type", "spell") self.secondrow[4]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Felhunter))) self.secondrow[5]:SetAttribute("type", "spell") self.secondrow[5]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Infernal))) self.secondrow[6]:SetAttribute("type", "spell") self.secondrow[6]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Doomguard))) self.secondrow[7]:SetAttribute("type", "spell") self.secondrow[7]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Felguard))) -- self.thirdrow[1]:SetAttribute("type", "spell") -- self.thirdrow[1]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.DetectInvis))) self.thirdrow[2]:SetAttribute("type", "spell") self.thirdrow[2]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.UnendingBreath))) self.thirdrow[3]:SetAttribute("type", "spell") self.thirdrow[3]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.SenseDemons))) -- tmpspell = GetSpellInfo(GetSpellInfo(self.spellID.DemonArmor)) -- if tmpspell == nil then tmpspell = GetSpellInfo(GetSpellInfo(self.spellID.DemonSkin)) -- end self.thirdrow[4]:SetAttribute("type", "spell") self.thirdrow[4]:SetAttribute("spell", tmpspell) self.thirdrow[5]:SetAttribute("type", "spell") self.thirdrow[5]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.FelArmor))) self.thirdrow[6]:SetAttribute("type", "spell") self.thirdrow[6]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.ShadowWard))) self.thirdrow[7]:SetAttribute("type", "spell") self.thirdrow[7]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Metamorph))) self.forthrow[1]:SetAttribute("type", "spell") self.forthrow[1]:SetAttribute("spell", GetSpellInfo(mount)) self.forthrow[2]:SetAttribute("type", "spell") self.forthrow[2]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Summon))) self.forthrow[3]:SetAttribute("type", "spell") self.forthrow[3]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Eye))) self.forthrow[4]:SetAttribute("type", "spell") self.forthrow[4]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.Banish))) self.forthrow[5]:SetAttribute("type", "spell") self.forthrow[5]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.SoulWell))) self.forthrow[6]:SetAttribute("type", "spell") self.forthrow[6]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.SummonCircle))) self.forthrow[7]:SetAttribute("type", "spell") self.forthrow[7]:SetAttribute("spell", GetSpellInfo(GetSpellInfo(self.spellID.PortCircle))) self.firstmap = {} self.secondmap = {} self.thirdmap = {} self.forthmap = {} for num, button in pairs(self.firstrow) do if button:GetAttribute("spell") then tinsert(self.firstmap, button) end --button:Hide() end for num, button in pairs(self.secondrow) do if button:GetAttribute("spell") then tinsert(self.secondmap, button) end --button:Hide() end for num, button in pairs(self.thirdrow) do if button:GetAttribute("spell") then tinsert(self.thirdmap, button) end --button:Hide() end for num, button in pairs(self.forthrow) do if button:GetAttribute("spell") then tinsert(self.forthmap, button) end --button:Hide() end self:SetupTooltips() end function shardacewotlk:Timer() if self.Timers.BagTimer then local timeleft = self.Timers.BagTimer - time() if (timeleft < 1) then self:ScanInv() end end if self.Timers.SoulTimer then local timeleft = self.Timers.SoulTimer - time() if(timeleft > 60)then soulTime:SetText((floor(timeleft / 60)) +1) else soulTime:SetText(timeleft) end soulTime:Show() if(timeleft < 1)then self.Timers.SoulTimer = nil soulTime:Hide() if self:getSoundState() then PlaySoundFile("Interface\\AddOns\\ShardAceWoTLK\\Soulstone.mp3") end self.db.profile.SoulTime = nil DEFAULT_CHAT_FRAME:AddMessage("|cffffff00** Soulstone Cooldown over, ready to use **|r") UIErrorsFrame:AddMessage("** Soulstone Cooldown over, ready to use **", 0.92, 0.75, 0.05, 1.0, 12) end end if self.Timers.HSTimer then local timeleft = self.Timers.HSTimer - time() if(timeleft > 60)then healthTime:SetText((floor(timeleft / 60)) +1) else healthTime:SetText(timeleft) end healthTime:Show() if(timeleft < 1)then self.Timers.HSTimer = nil self.db.profile.HSTimer = nil healthTime:Hide() end end if self.Timers.FelDomTimer then local timeleft = self.Timers.FelDomTimer - time() if timeleft >= 1 then self.firstrow[1]:Desaturate(true) else self.firstrow[1]:Desaturate(false) self.Timers.FelDomTimer = nil self.db.profile.FelDomTimer = nil end end if self.Timers.ShadowWardTimer then local timeleft = self.Timers.ShadowWardTimer - time() if timeleft >= 1 then self.thirdrow[6]:Desaturate(true) else self.thirdrow[6]:Desaturate(false) self.Timers.ShadowWardTimer = nil self.db.profile.ShadowWardTimer = nil end end if self.Timers.EmpowerTimer then local timeleft = self.Timers.EmpowerTimer - time() if timeleft >= 1 then self.firstrow[5]:Desaturate(true) else self.firstrow[5]:Desaturate(false) self.Timers.EmpowerTimer = nil self.db.profile.EmpowerTimer = nil end end if self.Timers.MetamorphTimer then local timeleft = self.Timers.MetamorphTimer - time() if timeleft >= 1 then self.thirdrow[7]:Desaturate(true) else self.thirdrow[7]:Desaturate(false) self.Timers.MetamorphTimer = nil self.db.profile.MetamorphTimer = nil end end if self.Timers.InfernalTimer then local timeleft = self.Timers.InfernalTimer - time() if timeleft >= 1 then self.secondrow[5]:Desaturate(true) else self.secondrow[5]:Desaturate(false) self.Timers.InfernalTimer = nil self.db.profile.InfernalTimer = nil end end if not self.Timers.BagTimer and not self.Timers.SoulTimer and not self.Timers.HSTimer and not self.Timers.FelDomTimer and not self.Timers.ShadowWardTimer and not self.Timers.EmpowerTimer and not self.Timers.MetamorphTimer then self.timerFrame:Hide() end end function shardacewotlk:SendMyMessage(MsgPassed,Chnl) if Chnl then if (Chnl == "RAID") then if UnitExists("raid1") then SendChatMessage(MsgPassed,"RAID") else if UnitExists("party1") then SendChatMessage(MsgPassed,"PARTY") else SendChatMessage(MsgPassed,Chnl) end end end else if self:getSayMessages() and not AlwaysPartyRaid then SendChatMessage(MsgPassed,"SAY") else if UnitExists("raid1") then SendChatMessage(MsgPassed,"RAID") else if UnitExists("party1") then SendChatMessage(MsgPassed,"PARTY") else SendChatMessage(MsgPassed,"SAY") end end end end end -- Event handlers function shardacewotlk:UNIT_SPELLCAST_SENT(event, unit, spell, rank, target) if spell == GetSpellInfo(20707) then -- Soulstone Resurrection SoulstoneTarget = target end end function shardacewotlk:UNIT_SPELLCAST_START(event, unit, spell, rank, target) end function shardacewotlk:UNIT_SPELLCAST_SUCCEEDED(event, unit, spell, rank, target) if unit == "player" then -- Set timers and make any announcements for that spell if spell == GetSpellInfo(20707) then self.Timers.SoulTimer = time() + 1800 self.db.profile.SoulTime = self.Timers.SoulTimer self.timerFrame:Show() self:Timer() if (self:getEnableSoulstoneMsg()) then local SoulstoneMsgToDisplay = string.gsub(self:getSoulstoneMsg(),"%%t",SoulstoneTarget) self:SendMyMessage(SoulstoneMsgToDisplay,"RAID") end elseif spell == GetSpellInfo(5723) or spell == GetSpellInfo(5720) or spell == GetSpellInfo(6263) or spell == GetSpellInfo(11732) or spell == GetSpellInfo(27235) or spell == GetSpellInfo(6262) then self.Timers.HSTimer = time() + 120 self.db.profile.HSTimer = self.Timers.HSTimer self.timerFrame:Show() self:Timer() elseif spell == GetSpellInfo(18708) then self.Timers.FelDomTimer = time() + 900 self.db.profile.FelDomTimer = self.Timers.FelDomTimer self.timerFrame:Show() self:Timer() elseif spell == GetSpellInfo(self.spellID.ShadowWard) then self.Timers.ShadowWardTimer = time() + 30 self.db.profile.ShadowWardTimer = self.Timers.ShadowWardTimer self.timerFrame:Show() self:Timer() elseif spell == GetSpellInfo(self.spellID.Empower) then self.Timers.EmpowerTimer = time() + 60 self.db.profile.EmpowerTimer = self.Timers.EmpowerTimer self.timerFrame:Show() self:Timer() elseif spell == GetSpellInfo(self.spellID.Metamorph) then self.Timers.MetamorphTimer = time() + 180 self.db.profile.MetamorphTimer = self.Timers.MetamorphTimer self.timerFrame:Show() self:Timer() elseif spell == GetSpellInfo(self.spellID.Infernal) then self.Timers.InfernalTimer = time() + 1200 self.db.profile.InfernalTimer = self.Timers.InfernalTimer self.timerFrame:Show() self:Timer() -- Other announcements elseif spell == GetSpellInfo(29893) then -- Ritual Of Souls if self:getEnableRitualOfSoulsMsg() then self:SendMyMessage(self:getRitualOfSoulsMsg()) end elseif spell == GetSpellInfo(698) then -- Ritual Of Summoning if self:getEnableRitualOfSummoningMsg() then self:SendMyMessage(self:getRitualOfSummoningMsg()) end elseif spell == GetSpellInfo(18540) then -- Ritual Of Doom if self:getEnableRitualOfDoomMsg() then self:SendMyMessage(self:getRitualOfDoomMsg()) end end end end function shardacewotlk:BAG_UPDATE() if not (self.Timers.BagTimer) then self.Timers.BagTimer = time () + 1 self.timerFrame:Show() end end function shardacewotlk:PLAYER_REGEN_ENABLED() if CreateButtonsFlag then self:CreateButtons() CreateButtonsFlag = nil end if SetupButtonsFlag then self:SetupButtons() SetupButtonsFlag = nil end if PosistionButtonsFlag then self:PosistionButtons() PosistionButtonsFlag = nil end end function shardacewotlk:SPELLS_CHANGED() self:SetupButtons() self:PosistionButtons() end -- Initialization function shardacewotlk:OnInitialize() self.db = AceDB:New("ShardAceWoTLKDB",{ profile = { radius = 105, angle = 270, reverse = 1, increment = 15, mainoffx = 28, mainoffy = 0, oneinitx = -28, oneinity = 28, oneoffx = -28, oneoffy = 0, twoinitx = -28, twoinity = 0, twooffx = -28, twooffy = 0, threeinitx = -28, threeinity = -28, threeoffx = -28, threeoffy = 0, fourinitx = -28, fourinity = -56, fouroffx = -28, fouroffy = 0, sortshards = 0, shardbag = 4, shardbagtwo = 3, reversesort = 0, destroyshards = 0, maxshards = 40, soulstonemessage = 'Soulstone cast on %t.', enablesoulstonemessage = true, ritualofsoulsmessage = 'Please click for cookies of green goodness.', enableritualofsoulsmessage = true, ritualofsummoningmessage = 'Please click for demonic taxi stone of evil.', enableritualofsummoningmessage = true, ritualofdoommessage = 'Wanted: Five brave volunteers to help summon my Doomguard. Clicky clicky!', enableritualofdoommessage = true, showtooltips = true, soundstate = true, saymessages = false, } },UnitName("player").." - "..GetRealmName()) options.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) AceConfig:RegisterOptionsTable("shardacewotlk", options) --LibStub("AceConfig-3.0"):RegisterOptionsTable("Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)) if self.db:GetCurrentProfile() == "profile" then self.db:SetProfile(UnitName("Player") .. " - " .. GetRealmName()) self.db:CopyProfile("profile") self.db:DeleteProfile("profile") end dialog:AddToBlizOptions("shardacewotlk", "ShardAce WoTLK") end function shardacewotlk:OnEnable() self:CreateButtons() self:SPELLS_CHANGED() self.buttons[1]:Execute( [[MenuButtons = newtable(self:GetChildren())]]) for _, button in ipairs({self.buttons[1]:GetChildren()}) do self.buttons[1]:WrapScript(button, "OnClick", [[ if button == "LeftButton" then return button, "hide" else return button, nil end ]], [[for i, button in ipairs(MenuButtons) do button:Hide() FlyOutButtonsOpen = false end]] ) end self:RegisterEvent("LEARNED_SPELL_IN_TAB", "SPELLS_CHANGED") self:RegisterEvent("SPELLS_CHANGED", "SPELLS_CHANGED") self:RegisterEvent("PLAYER_REGEN_ENABLED") self:RegisterEvent("BAG_UPDATE") self:RegisterEvent("UNIT_SPELLCAST_SENT") self:RegisterEvent("UNIT_SPELLCAST_START") self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") soulTime = self.buttons[2]:CreateFontString("DDSoulTime", "OVERLAY") soulTime:SetFontObject(GameFontHighlightSmall) soulTime:SetTextColor(1,1,1,1) soulTime:SetAllPoints() --MZ [5] -> [3] healthTime = self.buttons[3]:CreateFontString("DDHealthTime", "OVERLAY") healthTime:SetFontObject(GameFontHighlightSmall) healthTime:SetTextColor(1,1,1,1) healthTime:SetAllPoints() self.timerFrame = CreateFrame("Frame","DDTimerFrame") self.timerFrame:Hide() self.Timers = {} self.timerFrame:SetScript("OnUpdate", function(self, arg1) shardacewotlk.Timer(shardacewotlk, arg1) end) local timems = time() if self.db.profile.SoulTime or 0 > timems then self.Timers.SoulTimer = self.db.profile.SoulTime self.timerFrame:Show() self:Timer() end if self.db.profile.HSTimer or 0 > timems then self.Timers.HSTimer = self.db.profile.HSTimer self.timerFrame:Show() self:Timer() end if self.db.profile.FelDomTimer or 0 > timems then self.Timers.FelDomTimer = self.db.profile.FelDomTimer self.timerFrame:Show() self:Timer() end if self.db.profile.ShadowWardTimer or 0 > timems then self.Timers.ShadowWardTimer = self.db.profile.ShadowWardTimer self.timerFrame:Show() self:Timer() end if self.db.profile.EmpowerTimer or 0 > timems then self.Timers.EmpowerTimer = self.db.profile.EmpowerTimer self.timerFrame:Show() self:Timer() end if self.db.profile.MetamorphTimer or 0 > timems then self.Timers.MetamorphTimer = self.db.profile.MetamorphTimer self.timerFrame:Show() self:Timer() end if self.db.profile.InfernalTimer or 0 > timems then self.Timers.InfernalTimer = self.db.profile.InfernalTimer self.timerFrame:Show() self:Timer() end lastSort = GetTime() end