Compare commits

...

4 Commits

2 changed files with 13 additions and 20 deletions

View File

@ -1,5 +1,5 @@
--[[ $Id: CallbackHandler-1.0.lua 1284 2022-09-25 09:15:30Z nevcairiel $ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 7
--[[ $Id: CallbackHandler-1.0.lua 26 2022-12-12 15:09:39Z nevcairiel $ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 8
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
if not CallbackHandler then return end -- No upgrade needed
@ -7,21 +7,16 @@ if not CallbackHandler then return end -- No upgrade needed
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
-- Lua APIs
local error = error
local securecallfunction, error = securecallfunction, error
local setmetatable, rawget = setmetatable, rawget
local next, select, pairs, type, tostring = next, select, pairs, type, tostring
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, ...)
securecallfunction(method, ...)
index, method = next(handlers, index)
until not method
end

View File

@ -27,21 +27,19 @@ local function setPlayerCoords()
child['playerCoords'] = playerCoords
end
local colorlist = {
['friendly'] = "00ff00",
['arena'] = "ffff00",
['sanctuary'] = "9999ff",
['arena'] = "ff1919",
['combat'] = "ff1919",
['hostile'] = "ff1919",
['friendly'] = "19ff19",
['sanctuary'] = "68ccef",
['contested'] = "ffb200",
}
local function pvpColor(txt)
local col
local pvpType, isFFA, faction = GetZonePVPInfo()
local pvpType = GetZonePVPInfo()
if(colorlist[pvpType]) then
col = colorlist[pvpType]
elseif(pvpType == "hostile" or pvpType == "combat" or pvpType=="contested") then
col = faction == select(2,UnitFactionGroup('player')) and "886600" or "ff0000"
else
return txt
return child:colorize(txt, colorlist[pvpType])
end
return child:colorize(txt, col)
return txt
end
local function OnDataUpdate()
setPlayerCoords()