Add nearbyPlayers wa
This commit is contained in:
7
LegionWA/NearbyPlayers/Event.lua
Normal file
7
LegionWA/NearbyPlayers/Event.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
-- COMBAT_LOG_EVENT_UNFILTERED
|
||||
function(allstates, e, ...)
|
||||
local caster = select(6, ...)
|
||||
local target = select(10, ...)
|
||||
|
||||
aura_env.processEvent(allstates, caster, target)
|
||||
end
|
||||
81
LegionWA/NearbyPlayers/Init.lua
Normal file
81
LegionWA/NearbyPlayers/Init.lua
Normal file
@@ -0,0 +1,81 @@
|
||||
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
|
||||
}
|
||||
|
||||
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(allstates, caster, target)
|
||||
end
|
||||
Reference in New Issue
Block a user