This commit is contained in:
2024-08-24 22:45:34 +02:00
parent d163cf93eb
commit 9749f5a6eb
20 changed files with 484 additions and 484 deletions

View File

@@ -1,42 +1,42 @@
-- QUEST_POI_UPDATE QUEST_DETAIL QUEST_COMPLETE QUEST_GREETING QUEST_PROGRESS GOSSIP_SHOW
function(e)
if e == "QUEST_POI_UPDATE" then
CloseGossip()
elseif e == "QUEST_DETAIL" then
AcceptQuest()
elseif e == "QUEST_COMPLETE" then
if GetNumQuestChoices() <= 1 then
GetQuestReward(1)
end
elseif e == "GOSSIP_SHOW" then
local quests = GetNumGossipAvailableQuests()
local completedQuests = GetNumGossipActiveQuests()
local options = GetNumGossipOptions()
if completedQuests > 0 and options == 0 then
for i = 1, completedQuests do
SelectGossipActiveQuest(i)
end
end
if quests > 0 and options == 0 then
SelectGossipAvailableQuest(1)
end
if options == 1 and quests + completedQuests == 0 then
SelectGossipOption(1)
end
elseif e == "QUEST_GREETING" then
local quests = GetNumGossipAvailableQuests()
local completedQuests = GetNumGossipActiveQuests()
if completedQuests > 0 then
for i = 1, completedQuests do
SelectActiveQuest(1)
end
end
if quests > 0 then
SelectAvailableQuest(1)
end
elseif e == "QUEST_PROGRESS" then
if IsQuestCompletable(i) then
CompleteQuest()
end
end
-- QUEST_POI_UPDATE QUEST_DETAIL QUEST_COMPLETE QUEST_GREETING QUEST_PROGRESS GOSSIP_SHOW
function(e)
if e == "QUEST_POI_UPDATE" then
CloseGossip()
elseif e == "QUEST_DETAIL" then
AcceptQuest()
elseif e == "QUEST_COMPLETE" then
if GetNumQuestChoices() <= 1 then
GetQuestReward(1)
end
elseif e == "GOSSIP_SHOW" then
local quests = GetNumGossipAvailableQuests()
local completedQuests = GetNumGossipActiveQuests()
local options = GetNumGossipOptions()
if completedQuests > 0 and options == 0 then
for i = 1, completedQuests do
SelectGossipActiveQuest(i)
end
end
if quests > 0 and options == 0 then
SelectGossipAvailableQuest(1)
end
if options == 1 and quests + completedQuests == 0 then
SelectGossipOption(1)
end
elseif e == "QUEST_GREETING" then
local quests = GetNumGossipAvailableQuests()
local completedQuests = GetNumGossipActiveQuests()
if completedQuests > 0 then
for i = 1, completedQuests do
SelectActiveQuest(1)
end
end
if quests > 0 then
SelectAvailableQuest(1)
end
elseif e == "QUEST_PROGRESS" then
if IsQuestCompletable(i) then
CompleteQuest()
end
end
end

View File

@@ -1,4 +1,4 @@
-- BAG_UPDATE
function(e)
aura_env.update()
-- BAG_UPDATE
function(e)
aura_env.update()
end

View File

@@ -1,30 +1,30 @@
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])
end
local hideGlow = function(container, 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
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])
end
local hideGlow = function(container, 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
end

View File

@@ -1,18 +1,18 @@
Haven't found a way of determining whether an item is soulbound or not without tooltip scanning which I don't want to do
local cTip = CreateFrame("GameTooltip","PrivTooltip",nil,"GameTooltipTemplate")
local function IsSoulbound(bag, slot)
cTip:SetOwner(UIParent, "ANCHOR_NONE")
cTip:SetBagItem(bag, slot)
cTip:Show()
for i = 1,cTip:NumLines() do
if(_G[name.."TooltipTextLeft"..i]:GetText()==ITEM_SOULBOUND) then
cTip:Hide()
return true
end
end
cTip:Hide()
return false
end
Haven't found a way of determining whether an item is soulbound or not without tooltip scanning which I don't want to do
local cTip = CreateFrame("GameTooltip","PrivTooltip",nil,"GameTooltipTemplate")
local function IsSoulbound(bag, slot)
cTip:SetOwner(UIParent, "ANCHOR_NONE")
cTip:SetBagItem(bag, slot)
cTip:Show()
for i = 1,cTip:NumLines() do
if(_G[name.."TooltipTextLeft"..i]:GetText()==ITEM_SOULBOUND) then
cTip:Hide()
return true
end
end
cTip:Hide()
return false
end
Some guy says this is good

View File

@@ -1,20 +1,20 @@
function(progress, r1, g1, b1, a1, r2, g2, b2, a2)
-- if aura_env.state.IsActive then
-- ActionButton_ShowOverlayGlow(aura_env.region.icon)
-- else
-- ActionButton_HideOverlayGlow(aura_env.region.icon)
-- end
if aura_env.state.IsActive then
aura_env.region.icon:SetDesaturated(false)
return r1, g1, b1, a1
end
if aura_env.IsOnCooldown then
aura_env.region.icon:SetDesaturated(true)
return r1, g1, b1, a1
end
aura_env.region.icon:SetDesaturated(false)
return r2, g2, b2, 0.6
function(progress, r1, g1, b1, a1, r2, g2, b2, a2)
-- if aura_env.state.IsActive then
-- ActionButton_ShowOverlayGlow(aura_env.region.icon)
-- else
-- ActionButton_HideOverlayGlow(aura_env.region.icon)
-- end
if aura_env.statee.IsActive then
aura_env.region.icon:SetDesaturated(false)
return r1, g1, b1, a1
end
if aura_env.IsOnCooldown then
aura_env.region.icon:SetDesaturated(true)
return r1, g1, b1, a1
end
aura_env.region.icon:SetDesaturated(false)
return r2, g2, b2, 0.6
end

View File

@@ -1,4 +1,4 @@
function(allstates)
aura_env.HandleEvent(allstates)
return true
function(allstates)
aura_env.HandleEvent(allstates)
return true
end

View File

@@ -1,100 +1,100 @@
local CooldownType = {
New = function(self)
local o = {}
setmetatable(o, self)
self.__index = self
return o
end,
}
local NullType = CooldownType:New()
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
end
return false, 0, 0
end
local Cooldown = {
New = function(self, type, spellid, keybind)
local o = {
["type"] = type,
["spellid"] = spellid,
["name"] = GetSpellInfo(spellid),
["icon"] = GetSpellTexture(spellid),
["keybind"] = keybind,
}
setmetatable(o, self)
self.__index = self
return o
end,
GetCooldownInfo = function(self)
local start, duration = GetSpellCooldown(self.spellid)
return start > 0 and duration > aura_env.gcdThreshold, start, duration
end,
GetActiveInfo = function(self)
return self.type:GetActiveInfo()
end
}
aura_env.cooldowns = {
[5394] = Cooldown:New(TotemType, 5394, "C"), -- Healing Stream Totem
[2484] = Cooldown:New(TotemType, 2484, "SY"), -- Earthbind Totem
[8143] = Cooldown:New(TotemType, 8143, "S5"), -- Tremor Totem
[8177] = Cooldown:New(TotemType, 8177, "5"), -- Grounding Totem
[108273] = Cooldown:New(TotemType, 108273, "S4"), -- Windwalk Totem
[108270] = Cooldown:New(TotemType, 108270, "SF"), -- Stone Bulwark Totem
}
aura_env.gcdThreshold = 1.5
aura_env.Update = function(allstates, cd)
local state = allstates[cd.spellid] or {}
state.IsOnCooldown = cd:GetCooldownInfo()
state.IsActive = cd:GetActiveInfo()
state.Keybind = cd.keybind
if state.IsOnCooldown and not state.IsActive then
local _, start, duration = cd:GetCooldownInfo()
state.progressType = "timed"
state.duration = duration
state.expirationTime = start + duration
elseif state.IsOnCooldown and state.IsActive then
local _, start, duration = cd:GetActiveInfo()
state.progressType = "timed"
state.duration = duration
state.expirationTime = start + duration
end
state.changed = true
state.show = true
state.name = cd.name
state.icon = cd.icon
state.spellid = cd.spellid
allstates[cd.spellid] = state
end
aura_env.UpdateAll = function(allstates)
for _, v in pairs(aura_env.cooldowns) do
aura_env.Update(allstates, v)
end
end
aura_env.HandleEvent = function(allstates)
-- TODO: Handle events better
-- On cooldown begin -> trigger update on relevant spell
-- On totem die -> same
-- On buff remove
-- On debuff remove
-- On... Whatever else might happen
aura_env.UpdateAll(allstates)
end
local CooldownType = {
New = function(self)
local o = {}
setmetatable(o, self)
self.__index = self
return o
end,
}
local NullType = CooldownType:New()
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
end
return false, 0, 0
end
local Cooldown = {
New = function(self, type, spellid, keybind)
local o = {
["type"] = type,
["spellid"] = spellid,
["name"] = GetSpellInfo(spellid),
["icon"] = GetSpellTexture(spellid),
["keybind"] = keybind,
}
setmetatable(o, self)
self.__index = self
return o
end,
GetCooldownInfo = function(self)
local start, duration = GetSpellCooldown(self.spellid)
return start > 0 and duration > aura_env.gcdThreshold, start, duration
end,
GetActiveInfo = function(self)
return self.type:GetActiveInfo()
end
}
aura_env.cooldowns = {
[5394] = Cooldown:New(TotemType, 5394, "C"), -- Healing Stream Totem
[2484] = Cooldown:New(TotemType, 2484, "SY"), -- Earthbind Totem
[8143] = Cooldown:New(TotemType, 8143, "S5"), -- Tremor Totem
[8177] = Cooldown:New(TotemType, 8177, "5"), -- Grounding Totem
[108273] = Cooldown:New(TotemType, 108273, "S4"), -- Windwalk Totem
[108270] = Cooldown:New(TotemType, 108270, "SF"), -- Stone Bulwark Totem
}
aura_env.gcdThreshold = 1.5
aura_env.Update = function(allstates, cd)
local state = allstates[cd.spellid] or {}
state.IsOnCooldown = cd:GetCooldownInfo()
state.IsActive = cd:GetActiveInfo()
state.Keybind = cd.keybind
if state.IsOnCooldown and not state.IsActive then
local _, start, duration = cd:GetCooldownInfo()
state.progressType = "timed"
state.duration = duration
state.expirationTime = start + duration
elseif state.IsOnCooldown and state.IsActive then
local _, start, duration = cd:GetActiveInfo()
state.progressType = "timed"
state.duration = duration
state.expirationTime = start + duration
end
state.changed = true
state.show = true
state.name = cd.name
state.icon = cd.icon
state.spellid = cd.spellid
allstates[cd.spellid] = state
end
aura_env.UpdateAll = function(allstates)
for _, v in pairs(aura_env.cooldowns) do
aura_env.Update(allstates, v)
end
end
aura_env.HandleEvent = function(allstates)
-- TODO: Handle events better
-- On cooldown begin -> trigger update on relevant spell
-- On totem die -> same
-- On buff remove
-- On debuff remove
-- On... Whatever else might happen
aura_env.UpdateAll(allstates)
end

View File

@@ -1,5 +1,5 @@
-- ACTIONBAR_UPDATE_COOLDOWN
function(allstates, e)
aura_env.processEvent(allstates)
return true
-- ACTIONBAR_UPDATE_COOLDOWN
function(allstates, e)
aura_env.processEvent(allstates)
return true
end

View File

@@ -1,68 +1,68 @@
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
}
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
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
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,
progressType = "timed",
expirationTime = GetTime() + iconDisplayDuration,
duration = iconDisplayDuration,
autoHide = true,
}
end
aura_env.cache[spellId].ready = isReady
end
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
}
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
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
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,
progressType = "timed",
expirationTime = GetTime() + iconDisplayDuration,
duration = iconDisplayDuration,
autoHide = true,
}
end
aura_env.cache[spellId].ready = isReady
end
end

View File

@@ -1,28 +1,28 @@
-- COMBAT_LOG_EVENT_UNFILTERED
function(allstates, e, ...)
local iconDisplayDuration = 0.5
local se = select(2, ...)
if (se ~= "SPELL_AURA_APPLIED") then return end
local target = select(9, ...)
if (target ~= UnitName("player")) then return end
local auraType = select(15, ...)
if (auraType ~= "DEBUFF") then return end
local spellId = select(12, ...)
print(select(3, GetSpellInfo(spellId)))
allstates[spellId] = {
show = true,
changed = true,
index = GetTime(),
resort = true,
icon = select(3, GetSpellInfo(spellId)),
name = select(13, ...),
progressType = "timed",
expirationTime = GetTime() + iconDisplayDuration,
duration = iconDisplayDuration,
autoHide = true,
}
return true
-- COMBAT_LOG_EVENT_UNFILTERED
function(allstates, e, ...)
local iconDisplayDuration = 0.5
local se = select(2, ...)
if (se ~= "SPELL_AURA_APPLIED") then return end
local target = select(9, ...)
if (target ~= UnitName("player")) then return end
local auraType = select(15, ...)
if (auraType ~= "DEBUFF") then return end
local spellId = select(12, ...)
print(select(3, GetSpellInfo(spellId)))
allstates[spellId] = {
show = true,
changed = true,
index = GetTime(),
resort = true,
icon = select(3, GetSpellInfo(spellId)),
name = select(13, ...),
progressType = "timed",
expirationTime = GetTime() + iconDisplayDuration,
duration = iconDisplayDuration,
autoHide = true,
}
return true
end

View File

@@ -1,5 +1,5 @@
-- DevTools_Dump(aura_env.region)
-- aura_env.region:SetParent(aura_env.state.frame)
aura_env.region:ClearAllPoints()
aura_env.region:SetPoint("TOPLEFT", aura_env.state.frame.AuraWatch, "TOPLEFT", 0, 0)
aura_env.region:Show()
-- DevTools_Dump(aura_env.region)
-- aura_env.region:SetParent(aura_env.state.frame)
aura_env.region:ClearAllPoints()
aura_env.region:SetPoint("TOPLEFT", aura_env.statee.frame.AuraWatch, "TOPLEFT", 0, 0)
aura_env.region:Show()

View File

@@ -1,29 +1,29 @@
local raidFrames = ElvUF_Raid
local group1, group2, group3, group4, group5, group6 = raidFrames:GetChildren()
local groups = { group1, group2, group3, group4, group5, group6 }
aura_env.players = {}
for _, group in ipairs(groups) do
local playerFrame1, playerFrame2, playerFrame3, playerFrame4, playerFrame5 = group:GetChildren()
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
end
end
local specs = {
-- We can't get unit spec..........
-- Best we can do is class
-- That fucking sucks
}
aura_env.Player = {
new = function(self, player)
setmetatable({}, self)
self.frame = nil
self.danger = 0
return self
end,
}
local raidFrames = ElvUF_Raid
local group1, group2, group3, group4, group5, group6 = raidFrames:GetChildren()
local groups = { group1, group2, group3, group4, group5, group6 }
aura_env.players = {}
for _, group in ipairs(groups) do
local playerFrame1, playerFrame2, playerFrame3, playerFrame4, playerFrame5 = group:GetChildren()
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
end
end
local specs = {
-- We can't get unit spec..........
-- Best we can do is class
-- That fucking sucks
}
aura_env.Player = {
new = function(self, player)
setmetatable({}, self)
self.frame = nil
self.danger = 0
return self
end,
}

View File

@@ -1,22 +1,22 @@
-- TSU
function(allstates, e)
if aura_env.players == nil then
aura_env.players = {}
end
for _,player in ipairs(aura_env.players) do
allstates[player.Name:GetText()] = {
show = true,
changed = true,
name = 0.13,
frame = player,
icon = player.RaidIcon,
progressType = "static",
value = 1,
total = 1,
autoHide = true,
resort = true,
}
end
return true
-- TSU
function(allstates, e)
if aura_env.players == nil then
aura_env.players = {}
end
for _,player in ipairs(aura_env.players) do
allstates[player.Name:GetText()] = {
show = true,
changed = true,
name = 0.13,
frame = player,
icon = player.RaidIcon,
progressType = "static",
value = 1,
total = 1,
autoHide = true,
resort = true,
}
end
return true
end

View File

@@ -1,7 +1,7 @@
-- COMBAT_LOG_EVENT_UNFILTERED
function(allstates, e, ...)
local caster = select(6, ...)
local target = select(10, ...)
aura_env.processEvent(allstates, caster, target)
-- COMBAT_LOG_EVENT_UNFILTERED
function(allstates, e, ...)
local caster = select(6, ...)
local target = select(10, ...)
aura_env.processEvent(allstates, caster, target)
end

View File

@@ -1,90 +1,90 @@
if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end
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"
}
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
}
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
}
PlayerInfo = {
class = nil,
race = nil,
name = nil,
isHostile = nil,
}
function Player:New(guid)
o = {}
setmetatable(o, self)
self.__index = self
o.guid = guid or ""
o.lastSighted = GetTime()
o.info = PlayerInfo:New(guid)
return o
end
function PlayerInfo:New(guid)
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
return o
end
aura_env.processEvent = function(caster, target)
PlayerController:process(caster)
PlayerController:process(target)
end
if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end
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"
}
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
}
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
}
PlayerInfo = {
class = nil,
race = nil,
name = nil,
isHostile = nil,
}
function Player:New(guid)
o = {}
setmetatable(o, self)
self.__index = self
o.guid = guid or ""
o.lastSighted = GetTime()
o.info = PlayerInfo:New(guid)
return o
end
function PlayerInfo:New(guid)
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
return o
end
aura_env.processEvent = function(caster, target)
PlayerController:process(caster)
PlayerController:process(target)
end

View File

@@ -1,8 +1,8 @@
-- SPELL_UPDATE_CHARGES
function(e)
local charges = aura_env.getCharges()
if (charges ~= aura_env.currentCharges) then
aura_env.currentCharges = charges
return true
end
-- SPELL_UPDATE_CHARGES
function(e)
local charges = aura_env.getCharges()
if (charges ~= aura_env.currentCharges) then
aura_env.currentCharges = charges
return true
end
end

View File

@@ -1,5 +1,5 @@
aura_env.getCharges = function()
return select(1, GetSpellCharges(53600))
end
aura_env.getCharges = function()
return select(1, GetSpellCharges(53600))
end
aura_env.currentCharges = 0

View File

@@ -1,3 +1,3 @@
function()
return aura_env.getCharges()
function()
return aura_env.getCharges()
end

View File

@@ -1,8 +1,8 @@
aura_env.findAura = function(LFname)
for i = 1, 40 do
local name = UnitAura("player", i)
if (name == LFname) then
return i
end
end
aura_env.findAura = function(LFname)
for i = 1, 40 do
local name = UnitAura("player", i)
if (name == LFname) then
return i
end
end
end

View File

@@ -1,3 +1,3 @@
function()
return -select(17, UnitAura("player", aura_env.findAura("Shield of the Righteous"))) .. "%"
function()
return -select(17, UnitAura("player", aura_env.findAura("Shield of the Righteous"))) .. "%"
end