forked from Dusk/ShaguTweaks-ClassicAPI
42 lines
2.4 KiB
Lua
42 lines
2.4 KiB
Lua
local root=(arg[1] or '.') .. '/'
|
|
assert(loadfile(root..'mods/unitframes-classcolor.lua'))
|
|
local modules={}
|
|
ShaguTweaks={T=setmetatable({},{__index=function(t,k) return k end})}
|
|
function ShaguTweaks.GetGlobalEnv() return _G end
|
|
function ShaguTweaks:register(module) modules[module.title]=module; return module end
|
|
function ShaguTweaks.hooksecurefunc(object,name,callback)
|
|
if type(object)~='table' then return end
|
|
local original=object[name]; object[name]=function(self,a,b,c,d) original(self,a,b,c,d); callback(self,a,b,c,d) end
|
|
end
|
|
PlayerPortrait={alpha=1}; function PlayerPortrait:SetAlpha(v) self.alpha=v end
|
|
local health={visible=true}; local mana={visible=true}
|
|
dofile(root..'mods/unitframes-hide-player-portrait.lua')
|
|
modules['Hide Player Portrait']:enable()
|
|
assert(PlayerPortrait.alpha==0 and health.visible and mana.visible)
|
|
PlayerPortrait:SetAlpha(1); assert(PlayerPortrait.alpha==0)
|
|
MAX_PARTY_MEMBERS=0
|
|
local deferred
|
|
function CreateFrame() return {SetScript=function(self,event,callback) if callback then deferred={frame=self,callback=callback} end end,Hide=function() end} end
|
|
function UnitClass() return 'Warlock','WARLOCK' end
|
|
function TargetFrame_CheckFaction() end
|
|
local function texture()
|
|
return {SetTexture=function(self,p) self.path=p end,SetVertexColor=function(self,r,g,b,a) self.r=r end}
|
|
end
|
|
PlayerFrameNameBackground=texture(); TargetFrameNameBackground=texture()
|
|
PlayerFrameHealthBar={SetStatusBarTexture=function(self,p) self.path=p end,GetStatusBarColor=function() return 1,1,1,1 end,SetStatusBarColor=function() end}
|
|
dofile(root..'mods/unitframes-classcolor.lua')
|
|
modules['Modern Class Colors']:enable()
|
|
this=deferred.frame; deferred.callback(); this=nil
|
|
local expected='Interface\\AddOns\\ShaguTweaks\\img\\BlizzardRetailBar'
|
|
assert(PlayerFrameNameBackground.path==expected and TargetFrameNameBackground.path==expected and PlayerFrameHealthBar.path==expected)
|
|
print('Lua 5.0: portrait-only alpha lock and matching modern name/health artwork passed')
|
|
-- Hiding the player name never affects the grouped player frame.
|
|
dofile(root..'mods/unitframes-hide-player-name.lua')
|
|
local nameHidden=false
|
|
ShaguTweaks.StandalonePlayerFrame={name={Hide=function() nameHidden=true end}}
|
|
ShaguTweaks_config={['Standalone Player Frame']=0}
|
|
modules['Hide Player Name']:enable();assert(not nameHidden)
|
|
ShaguTweaks_config['Standalone Player Frame']=1
|
|
modules['Hide Player Name']:enable();assert(nameHidden)
|
|
print('Hide Player Name: standalone-only guard passed')
|