Code format
This commit is contained in:
@@ -1,30 +1,23 @@
|
||||
local function getItemLink(container, slot)
|
||||
return select(7, GetContainerItemInfo(container, slot)) or ""
|
||||
end
|
||||
local function getBindType(container, slot)
|
||||
return select(14, GetItemInfo(getItemLink(container, slot))) or 0
|
||||
end
|
||||
local function isBoe(container, slot)
|
||||
return getBindType(container, slot) == 1
|
||||
end
|
||||
|
||||
local function getItemLink(container, slot) return select(7, GetContainerItemInfo(container, slot)) or "" end
|
||||
local function getBindType(container, slot) return select(14, GetItemInfo(getItemLink(container, slot))) or 0 end
|
||||
local function isBoe(container, slot) return getBindType(container, slot) == 1 end
|
||||
|
||||
local showGlow = function(container, slot)
|
||||
ActionButton_ShowOverlayGlow(_G["ElvUI_ContainerFrameBag" .. container .. "Slot" .. slot])
|
||||
ActionButton_ShowOverlayGlow(_G["ElvUI_ContainerFrameBag" .. container .. "Slot" .. slot])
|
||||
end
|
||||
local hideGlow = function(container, slot)
|
||||
ActionButton_HideOverlayGlow(_G["ElvUI_ContainerFrameBag" .. container .. "Slot" .. slot])
|
||||
ActionButton_HideOverlayGlow(_G["ElvUI_ContainerFrameBag" .. container .. "Slot" .. slot])
|
||||
end
|
||||
|
||||
aura_env.update = function()
|
||||
for container = 0, 4 do
|
||||
for slot = 1, GetContainerNumSlots(container) do
|
||||
print(C_Item.IsBound(ItemLocation:CreateFromBagAndSlot(container, slot)))
|
||||
if isBoe(container, slot) then
|
||||
showGlow(container, slot)
|
||||
else
|
||||
hideGlow(container, slot)
|
||||
end
|
||||
end
|
||||
end
|
||||
for container = 0, 4 do
|
||||
for slot = 1, GetContainerNumSlots(container) do
|
||||
print(C_Item.IsBound(ItemLocation:CreateFromBagAndSlot(container, slot)))
|
||||
if isBoe(container, slot) then
|
||||
showGlow(container, slot)
|
||||
else
|
||||
hideGlow(container, slot)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -8,16 +8,12 @@ local CooldownType = {
|
||||
}
|
||||
|
||||
local NullType = CooldownType:New()
|
||||
NullType.GetActiveInfo = function(self)
|
||||
return false, 0, 0
|
||||
end
|
||||
NullType.GetActiveInfo = function(self) return false, 0, 0 end
|
||||
local TotemType = CooldownType:New()
|
||||
TotemType.GetActiveInfo = function(self)
|
||||
for i = 1, 4 do
|
||||
local present, name, start, duration = GetTotemInfo(i)
|
||||
if present and name == self.name then
|
||||
return true, start, duration
|
||||
end
|
||||
if present and name == self.name then return true, start, duration end
|
||||
end
|
||||
return false, 0, 0
|
||||
end
|
||||
@@ -41,9 +37,7 @@ local Cooldown = {
|
||||
return start > 0 and duration > aura_env.gcdThreshold, start, duration
|
||||
end,
|
||||
|
||||
GetActiveInfo = function(self)
|
||||
return self.type:GetActiveInfo()
|
||||
end
|
||||
GetActiveInfo = function(self) return self.type:GetActiveInfo() end,
|
||||
}
|
||||
|
||||
aura_env.cooldowns = {
|
||||
|
@@ -1,73 +1,72 @@
|
||||
aura_env.trackedSpells = {
|
||||
20271, -- Judgement
|
||||
26573, -- Consecration
|
||||
209202, -- Eye of Tyr
|
||||
213652, -- Hand of the Protector
|
||||
31935, -- Avenger's Shield
|
||||
53600, -- Shield of the Righteous
|
||||
1044, -- Hand of Freedom
|
||||
155145, -- Arcane Torrent
|
||||
853, -- Hammer of Justice
|
||||
6940, -- Hand of Sacrifice
|
||||
31850, -- Ardent Defender
|
||||
86659, -- Guardian of Ancient Kings
|
||||
204018, -- Blessing of Spellwarding
|
||||
--
|
||||
108416, -- Dark Pact
|
||||
196447, -- Channel Demonfire
|
||||
104773, -- Unending Resolve
|
||||
196586, -- Dimensional Rift
|
||||
20271, -- Judgement
|
||||
26573, -- Consecration
|
||||
209202, -- Eye of Tyr
|
||||
213652, -- Hand of the Protector
|
||||
31935, -- Avenger's Shield
|
||||
53600, -- Shield of the Righteous
|
||||
1044, -- Hand of Freedom
|
||||
155145, -- Arcane Torrent
|
||||
853, -- Hammer of Justice
|
||||
6940, -- Hand of Sacrifice
|
||||
31850, -- Ardent Defender
|
||||
86659, -- Guardian of Ancient Kings
|
||||
204018, -- Blessing of Spellwarding
|
||||
--
|
||||
108416, -- Dark Pact
|
||||
196447, -- Channel Demonfire
|
||||
104773, -- Unending Resolve
|
||||
196586, -- Dimensional Rift
|
||||
}
|
||||
local iconDisplayDuration = 0.4
|
||||
local gcdDuration = 1.5
|
||||
|
||||
aura_env.cache = {}
|
||||
for k, spellId in pairs(aura_env.trackedSpells) do
|
||||
aura_env.cache[spellId] = {
|
||||
ready = true,
|
||||
hasCharges = false,
|
||||
}
|
||||
if GetSpellCharges(spellId) then
|
||||
aura_env.cache[spellId].hasCharges = true
|
||||
aura_env.cache[spellId].charges = select(1, GetSpellCharges(spellId))
|
||||
end
|
||||
aura_env.cache[spellId] = {
|
||||
ready = true,
|
||||
hasCharges = false,
|
||||
}
|
||||
if GetSpellCharges(spellId) then
|
||||
aura_env.cache[spellId].hasCharges = true
|
||||
aura_env.cache[spellId].charges = select(1, GetSpellCharges(spellId))
|
||||
end
|
||||
end
|
||||
|
||||
aura_env.processEvent = function(allstates)
|
||||
for k, spellId in pairs(aura_env.trackedSpells) do
|
||||
-- Handle spells with charges
|
||||
local isReady
|
||||
if (aura_env.cache[spellId].hasCharges) then
|
||||
local charges = select(1, GetSpellCharges(spellId))
|
||||
if (charges > aura_env.cache[spellId].charges) then
|
||||
isReady = true
|
||||
aura_env.cache[spellId].charges = charges
|
||||
else
|
||||
isReady = false
|
||||
aura_env.cache[spellId].charges = charges
|
||||
end
|
||||
else
|
||||
isReady = select(2, GetSpellCooldown(spellId)) < gcdDuration
|
||||
end
|
||||
for k, spellId in pairs(aura_env.trackedSpells) do
|
||||
-- Handle spells with charges
|
||||
local isReady
|
||||
if aura_env.cache[spellId].hasCharges then
|
||||
local charges = select(1, GetSpellCharges(spellId))
|
||||
if charges > aura_env.cache[spellId].charges then
|
||||
isReady = true
|
||||
aura_env.cache[spellId].charges = charges
|
||||
else
|
||||
isReady = false
|
||||
aura_env.cache[spellId].charges = charges
|
||||
end
|
||||
else
|
||||
isReady = select(2, GetSpellCooldown(spellId)) < gcdDuration
|
||||
end
|
||||
|
||||
if not aura_env.cache[spellId].ready and isReady then
|
||||
local icon = select(3, GetSpellInfo(spellId))
|
||||
allstates[spellId] = {
|
||||
show = true,
|
||||
changed = true,
|
||||
index = GetTime(),
|
||||
resort = true,
|
||||
|
||||
if (not aura_env.cache[spellId].ready and isReady) then
|
||||
local icon = select(3, GetSpellInfo(spellId))
|
||||
allstates[spellId] = {
|
||||
show = true,
|
||||
changed = true,
|
||||
index = GetTime(),
|
||||
resort = true,
|
||||
icon = icon,
|
||||
|
||||
icon = icon,
|
||||
progressType = "timed",
|
||||
expirationTime = GetTime() + iconDisplayDuration,
|
||||
duration = iconDisplayDuration,
|
||||
autoHide = true,
|
||||
}
|
||||
end
|
||||
|
||||
progressType = "timed",
|
||||
expirationTime = GetTime() + iconDisplayDuration,
|
||||
duration = iconDisplayDuration,
|
||||
autoHide = true,
|
||||
}
|
||||
end
|
||||
|
||||
aura_env.cache[spellId].ready = isReady
|
||||
end
|
||||
end
|
||||
aura_env.cache[spellId].ready = isReady
|
||||
end
|
||||
end
|
||||
|
@@ -7,9 +7,7 @@ for _, group in ipairs(groups) do
|
||||
local playerFrames = { playerFrame1, playerFrame2, playerFrame3, playerFrame4, playerFrame5 }
|
||||
|
||||
for _, player in ipairs(playerFrames) do
|
||||
if player.Name:IsVisible() then
|
||||
aura_env.players[#aura_env.players + 1] = player
|
||||
end
|
||||
if player.Name:IsVisible() then aura_env.players[#aura_env.players + 1] = player end
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -3,88 +3,81 @@ if not WeakAurasSaved.Cyka.Cache then WeakAurasSaved.Cyka.Cache = {} end
|
||||
if not WeakAurasSaved.Cyka.Cache.PlayerInfo then WeakAurasSaved.Cyka.Cache.PlayerInfo = {} end
|
||||
|
||||
local allianceRaces = {
|
||||
"Draenai",
|
||||
"Dwarf",
|
||||
"Gnome",
|
||||
"Human",
|
||||
"Night Elf",
|
||||
"Worgen"
|
||||
"Draenai",
|
||||
"Dwarf",
|
||||
"Gnome",
|
||||
"Human",
|
||||
"Night Elf",
|
||||
"Worgen",
|
||||
}
|
||||
|
||||
PlayerController = {
|
||||
nearbyPlayers = {},
|
||||
addPlayer = function(self, name)
|
||||
self.nearbyPlayers[name] = Player:New(name)
|
||||
end,
|
||||
getPlayers = function(self)
|
||||
|
||||
end,
|
||||
process = function(guid)
|
||||
if (self.nearbyPlayers[guid] == nil) then
|
||||
self.addPlayer(guid)
|
||||
else
|
||||
|
||||
end
|
||||
end
|
||||
nearbyPlayers = {},
|
||||
addPlayer = function(self, name) self.nearbyPlayers[name] = Player:New(name) end,
|
||||
getPlayers = function(self) end,
|
||||
process = function(guid)
|
||||
if self.nearbyPlayers[guid] == nil then
|
||||
self.addPlayer(guid)
|
||||
else
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
Player = {
|
||||
guid = nil,
|
||||
lastSighted = nil,
|
||||
info = nil,
|
||||
update = function(self)
|
||||
self.lastSighted = GetTime()
|
||||
end,
|
||||
getFormatted = function(self)
|
||||
-- Color by class
|
||||
-- Format time
|
||||
return info.name .. " " .. self.lastSighted
|
||||
end
|
||||
guid = nil,
|
||||
lastSighted = nil,
|
||||
info = nil,
|
||||
update = function(self) self.lastSighted = GetTime() end,
|
||||
getFormatted = function(self)
|
||||
-- Color by class
|
||||
-- Format time
|
||||
return info.name .. " " .. self.lastSighted
|
||||
end,
|
||||
}
|
||||
PlayerInfo = {
|
||||
class = nil,
|
||||
race = nil,
|
||||
name = nil,
|
||||
isHostile = nil,
|
||||
class = nil,
|
||||
race = nil,
|
||||
name = nil,
|
||||
isHostile = nil,
|
||||
}
|
||||
|
||||
function Player:New(guid)
|
||||
o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
|
||||
o.guid = guid or ""
|
||||
o.lastSighted = GetTime()
|
||||
o.info = PlayerInfo:New(guid)
|
||||
o.guid = guid or ""
|
||||
o.lastSighted = GetTime()
|
||||
o.info = PlayerInfo:New(guid)
|
||||
|
||||
return o
|
||||
return o
|
||||
end
|
||||
function PlayerInfo:New(guid)
|
||||
o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
|
||||
local info
|
||||
if WeakAurasSaved.Cyka.Cache.PlayerInfo[guid] then
|
||||
info = WeakAurasSaved.Cyka.Cache.PlayerInfo[guid]
|
||||
else
|
||||
info = GetPlayerInfoByGUID(guid)
|
||||
WeakAurasSaved.Cyka.Cache.PlayerInfo[guid] = {
|
||||
class = info.class,
|
||||
race = info.race,
|
||||
name = info.name,
|
||||
isHostile = allianceRaces[race] ~= nil
|
||||
}
|
||||
end
|
||||
o.class = info.class or ""
|
||||
o.race = info.race or ""
|
||||
o.name = info.name or ""
|
||||
o.isHostile = info.isHostile or true
|
||||
local info
|
||||
if WeakAurasSaved.Cyka.Cache.PlayerInfo[guid] then
|
||||
info = WeakAurasSaved.Cyka.Cache.PlayerInfo[guid]
|
||||
else
|
||||
info = GetPlayerInfoByGUID(guid)
|
||||
WeakAurasSaved.Cyka.Cache.PlayerInfo[guid] = {
|
||||
class = info.class,
|
||||
race = info.race,
|
||||
name = info.name,
|
||||
isHostile = allianceRaces[race] ~= nil,
|
||||
}
|
||||
end
|
||||
o.class = info.class or ""
|
||||
o.race = info.race or ""
|
||||
o.name = info.name or ""
|
||||
o.isHostile = info.isHostile or true
|
||||
|
||||
return o
|
||||
return o
|
||||
end
|
||||
|
||||
aura_env.processEvent = function(caster, target)
|
||||
PlayerController:process(caster)
|
||||
PlayerController:process(target)
|
||||
PlayerController:process(caster)
|
||||
PlayerController:process(target)
|
||||
end
|
||||
|
@@ -1,5 +1,3 @@
|
||||
aura_env.getCharges = function()
|
||||
return select(1, GetSpellCharges(53600))
|
||||
end
|
||||
aura_env.getCharges = function() return select(1, GetSpellCharges(53600)) end
|
||||
|
||||
aura_env.currentCharges = 0
|
||||
aura_env.currentCharges = 0
|
||||
|
@@ -1,8 +1,6 @@
|
||||
aura_env.findAura = function(LFname)
|
||||
for i = 1, 40 do
|
||||
local name = UnitAura("player", i)
|
||||
if (name == LFname) then
|
||||
return i
|
||||
end
|
||||
end
|
||||
end
|
||||
for i = 1, 40 do
|
||||
local name = UnitAura("player", i)
|
||||
if name == LFname then return i end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user