Diff
checker
텍스트
텍스트
이미지
문서
Excel
폴더
Legal
Enterprise
데스크톱
요금제
로그인
데스크톱 앱 다운로드
텍스트 비교
두 텍스트 파일의 차이점을 찾아보세요
도구
기록
실시간 편집
변경 없는 행 숨기기
줄바꿈 비활성화
레이아웃
나란히 보기
합쳐 보기
비교 단위
스마트
단어
글자
구문 강조
언어 선택
제외
텍스트 변환
첫 변경으로
수정
Diffchecker Desktop
가장 안전하게 Diffchecker를 사용하는 방법. 데스크톱 앱을 사용하면 비교 데이터가 외부로 전송되지 않습니다!
데스크톱 앱 받기
Untitled diff
생성일
9년 전
비교 결과 만료 없음
초기화
내보내기
공유
설명
20 삭제
행
총
삭제
글자
총
삭제
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
211 행
복사
26 추가
행
총
추가
글자
총
추가
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
221 행
복사
-- mana, lowmana, power, poweralt
-- mana, lowmana, power, poweralt
local Mana = Grid2.statusPrototype:new("mana",false)
local Mana = Grid2.statusPrototype:new("mana",false)
local LowMana = Grid2.statusPrototype:new("lowmana",false)
local LowMana = Grid2.statusPrototype:new("lowmana",false)
local Power = Grid2.statusPrototype:new("power",false)
local Power = Grid2.statusPrototype:new("power",false)
local PowerAlt = Grid2.statusPrototype:new("poweralt",false)
local PowerAlt = Grid2.statusPrototype:new("poweralt",false)
local max = math.max
local max = math.max
local fmt = string.format
local fmt = string.format
local next = next
local next = next
local tostring = tostring
local tostring = tostring
local UnitMana = UnitMana
local UnitMana = UnitMana
local UnitManaMax = UnitManaMax
local UnitManaMax = UnitManaMax
local UnitPowerType = UnitPowerType
local UnitPowerType = UnitPowerType
local UnitPower = UnitPower
local UnitPower = UnitPower
local UnitPowerMax = UnitPowerMax
local UnitPowerMax = UnitPowerMax
local UnitIsPlayer = UnitIsPlayer
local UnitIsPlayer = UnitIsPlayer
local UnitGroupRolesAssigned = UnitGroupRolesAssigned
local UnitGroupRolesAssigned = UnitGroupRolesAssigned
local statuses = {} -- Enabled statuses
local statuses = {} -- Enabled statuses
-- Methods shared by all statuses
-- Methods shared by all statuses
local status_OnEnable, status_OnDisable
local status_OnEnable, status_OnDisable
do
do
local frame
local frame
local function Frame_OnEvent(self, event, unit, powerType)
local function Frame_OnEvent(self, event, unit, powerType)
for status in next,statuses do
for status in next,statuses do
status:UpdateUnitPower(unit, powerType)
status:UpdateUnitPower(unit, powerType)
end
end
end
end
function status_OnEnable(status)
function status_OnEnable(status)
if not next(statuses) then
if not next(statuses) then
if not frame then frame = CreateFrame("Frame", nil, Grid2LayoutFrame) end
if not frame then frame = CreateFrame("Frame", nil, Grid2LayoutFrame) end
frame:SetScript("OnEvent", Frame_OnEvent)
frame:SetScript("OnEvent", Frame_OnEvent)
frame:RegisterEvent("UNIT_POWER")
frame:RegisterEvent("UNIT_POWER")
frame:RegisterEvent("UNIT_MAXPOWER")
frame:RegisterEvent("UNIT_MAXPOWER")
frame:RegisterEvent("UNIT_DISPLAYPOWER")
frame:RegisterEvent("UNIT_DISPLAYPOWER")
end
end
statuses[status] = true
statuses[status] = true
end
end
function status_OnDisable(status)
function status_OnDisable(status)
statuses[status] = nil
statuses[status] = nil
if (not next(statuses)) and frame then
if (not next(statuses)) and frame then
frame:SetScript("OnEvent", nil)
frame:SetScript("OnEvent", nil)
frame:UnregisterEvent("UNIT_POWER")
frame:UnregisterEvent("UNIT_POWER")
frame:UnregisterEvent("UNIT_MAXPOWER")
frame:UnregisterEvent("UNIT_MAXPOWER")
frame:UnregisterEvent("UNIT_DISPLAYPOWER")
frame:UnregisterEvent("UNIT_DISPLAYPOWER")
end
end
end
end
end
end
-- Mana status
-- Mana status
Mana.GetColor = Grid2.statusLibrary.GetColor
Mana.GetColor = Grid2.statusLibrary.GetColor
Mana.OnEnable = status_OnEnable
Mana.OnEnable = status_OnEnable
Mana.OnDisable= status_OnDisable
Mana.OnDisable= status_OnDisable
function Mana:UpdateUnitPowerStandard(unit, powerType)
function Mana:UpdateUnitPowerStandard(unit, powerType)
if powerType=="MANA" then
if powerType=="MANA" then
self:UpdateIndicators(unit)
self:UpdateIndicators(unit)
end
end
end
end
function Mana:UpdateUnitPowerHealer(unit, powerType)
function Mana:UpdateUnitPowerHealer(unit, powerType)
if powerType=="MANA" and (unit=="player" or UnitGroupRolesAssigned(unit) == "HEALER") then
if powerType=="MANA" and (unit=="player" or UnitGroupRolesAssigned(unit) == "HEALER") then
self:UpdateIndicators(unit)
self:UpdateIndicators(unit)
end
end
end
end
function Mana:IsActiveStandard(unit)
function Mana:IsActiveStandard(unit)
return UnitPowerType(unit) == 0
return UnitPowerType(unit) == 0
end
end
function Mana:IsActiveHealer(unit)
function Mana:IsActiveHealer(unit)
return UnitPowerType(unit) == 0 and (unit=="player" or UnitGroupRolesAssigned(unit) == "HEALER")
return UnitPowerType(unit) == 0 and (unit=="player" or UnitGroupRolesAssigned(unit) == "HEALER")
end
end
function Mana:GetPercent(unit)
function Mana:GetPercent(unit)
return UnitMana(unit) / UnitManaMax(unit)
return UnitMana(unit) / UnitManaMax(unit)
end
end
function Mana:GetText(unit)
function Mana:GetText(unit)
return fmt("%.1fk", UnitMana(unit) / 1000)
return fmt("%.1fk", UnitMana(unit) / 1000)
end
end
function Mana:UpdateDB()
function Mana:UpdateDB()
Mana.IsActive = self.dbx.showOnlyHealers and Mana.IsActiveHealer or Mana.IsActiveStandard
Mana.IsActive = self.dbx.showOnlyHealers and Mana.IsActiveHealer or Mana.IsActiveStandard
Mana.UpdateUnitPower = self.dbx.showOnlyHealers and Mana.UpdateUnitPowerHealer or Mana.UpdateUnitPowerStandard
Mana.UpdateUnitPower = self.dbx.showOnlyHealers and Mana.UpdateUnitPowerHealer or Mana.UpdateUnitPowerStandard
end
end
Grid2.setupFunc["mana"] = function(baseKey, dbx)
Grid2.setupFunc["mana"] = function(baseKey, dbx)
Grid2:RegisterStatus(Mana, {"percent", "text", "color"}, baseKey, dbx)
Grid2:RegisterStatus(Mana, {"percent", "text", "color"}, baseKey, dbx)
Mana:UpdateDB()
Mana:UpdateDB()
return Mana
return Mana
end
end
Grid2:DbSetStatusDefaultValue( "mana", {type = "mana", color1= {r=0,g=0,b=1,a=1}} )
Grid2:DbSetStatusDefaultValue( "mana", {type = "mana", color1= {r=0,g=0,b=1,a=1}} )
-- Low Mana status
-- Low Mana status
LowMana.GetColor = Grid2.statusLibrary.GetColor
LowMana.GetColor = Grid2.statusLibrary.GetColor
LowMana.OnEnable = status_OnEnable
LowMana.OnEnable = status_OnEnable
LowMana.OnDisable = status_OnDisable
LowMana.OnDisable = status_OnDisable
function LowMana:UpdateUnitPower(unit, powerType)
function LowMana:UpdateUnitPower(unit, powerType)
if powerType=="MANA" then
if powerType=="MANA" then
self:UpdateIndicators(unit)
self:UpdateIndicators(unit)
end
end
end
end
function LowMana:IsActive(unit)
function LowMana:IsActive(unit)
return (UnitPowerType(unit) == 0) and (Mana:GetPercent(unit) < self.dbx.threshold)
return (UnitPowerType(unit) == 0) and (Mana:GetPercent(unit) < self.dbx.threshold)
end
end
Grid2.setupFunc["lowmana"] = function(baseKey, dbx)
Grid2.setupFunc["lowmana"] = function(baseKey, dbx)
Grid2:RegisterStatus(LowMana, {"color"}, baseKey, dbx)
Grid2:RegisterStatus(LowMana, {"color"}, baseKey, dbx)
return LowMana
return LowMana
end
end
Grid2:DbSetStatusDefaultValue( "lowmana", {type = "lowmana", threshold = 0.75, color1 = {r=0.5,g=0,b=1,a=1}})
Grid2:DbSetStatusDefaultValue( "lowmana", {type = "lowmana", threshold = 0.75, color1 = {r=0.5,g=0,b=1,a=1}})
-- Alternative power status
-- Alternative power status
PowerAlt.GetColor = Grid2.statusLibrary.GetColor
PowerAlt.GetColor = Grid2.statusLibrary.GetColor
PowerAlt.OnEnable = status_OnEnable
PowerAlt.OnEnable = status_OnEnable
PowerAlt.OnDisable= status_OnDisable
PowerAlt.OnDisable= status_OnDisable
function PowerAlt:UpdateUnitPower(unit, powerType)
function PowerAlt:UpdateUnitPower(unit, powerType)
if powerType=="ALTERNATE" then
if powerType=="ALTERNATE" then
self:UpdateIndicators(unit)
self:UpdateIndicators(unit)
end
end
end
end
function PowerAlt:IsActive(unit)
function PowerAlt:IsActive(unit)
return UnitPowerMax(unit,10)>0
return UnitPowerMax(unit,10)>0
end
end
function PowerAlt:GetPercent(unit)
function PowerAlt:GetPercent(unit)
return max(UnitPower(unit,10),0) / UnitPowerMax(unit,10)
return max(UnitPower(unit,10),0) / UnitPowerMax(unit,10)
end
end
function PowerAlt:GetText(unit)
function PowerAlt:GetText(unit)
local power= UnitPower(unit,10)
local power= UnitPower(unit,10)
if power>=1000 then
if power>=1000 then
return fmt("%.1fk", power / 1000)
return fmt("%.1fk", power / 1000)
else
else
return tostring( max(power,0) )
return tostring( max(power,0) )
end
end
end
end
Grid2.setupFunc["poweralt"] = function(baseKey, dbx)
Grid2.setupFunc["poweralt"] = function(baseKey, dbx)
Grid2:RegisterStatus(PowerAlt, {"percent", "text", "color"}, baseKey, dbx)
Grid2:RegisterStatus(PowerAlt, {"percent", "text", "color"}, baseKey, dbx)
return PowerAlt
return PowerAlt
end
end
Grid2:DbSetStatusDefaultValue( "poweralt", {type = "poweralt", color1= {r=1,g=0,b=0.5,a=1}} )
Grid2:DbSetStatusDefaultValue( "poweralt", {type = "poweralt", color1= {r=1,g=0,b=0.5,a=1}} )
-- Power status
-- Power status
local powerColors= {}
local powerColors= {}
Power.OnEnable = status_OnEnable
Power.OnEnable = status_OnEnable
Power.OnDisable = status_OnDisable
Power.OnDisable = status_OnDisable
function Power:UpdateUnitPower(unit, powerType)
function Power:UpdateUnitPower(unit, powerType)
if UnitIsPlayer(unit) and powerColors[ powerType ] then
if UnitIsPlayer(unit) and powerColors[ powerType ] then
self:UpdateIndicators(unit)
self:UpdateIndicators(unit)
end
end
end
end
function Power:IsActive(unit)
function Power:IsActive(unit)
return UnitIsPlayer(unit)
return UnitIsPlayer(unit)
end
end
function Power:GetPercent(unit)
function Power:GetPercent(unit)
return UnitPower(unit) / UnitPowerMax(unit)
return UnitPower(unit) / UnitPowerMax(unit)
end
end
function Power:GetText(unit)
function Power:GetText(unit)
local power = UnitPower(unit)
local power = UnitPower(unit)
if power>=1000 then
if power>=1000 then
return fmt("%.1fk", power / 1000)
return fmt("%.1fk", power / 1000)
else
else
return tostring(power)
return tostring(power)
end
end
end
end
function Power:GetColor(unit)
function Power:GetColor(unit)
local _,type= UnitPowerType(unit)
local _,type= UnitPowerType(unit)
local c= powerColors[type] or powerColors["MANA"]
local c= powerColors[type] or powerColors["MANA"]
return c.r, c.g, c.b, c.a
return c.r, c.g, c.b, c.a
end
end
function Power:UpdateDB()
function Power:UpdateDB()
powerColors["MANA"] = self.dbx.color1
powerColors["MANA"] = self.dbx.color1
powerColors["RAGE"] = self.dbx.color2
powerColors["RAGE"] = self.dbx.color2
powerColors["FOCUS"] = self.dbx.color3
powerColors["FOCUS"] = self.dbx.color3
powerColors["ENERGY"] = self.dbx.color4
powerColors["ENERGY"] = self.dbx.color4
powerColors["RUNIC_POWER"] = self.dbx.color5
powerColors["RUNIC_POWER"] = self.dbx.color5
복사
복사됨
복사
복사됨
powerColors["INSANITY"] = self.dbx.color6
powerColors["MAELSTROM"] = self.dbx.color7
powerColors["LUNAR_POWER"] = self.dbx.color8
powerColors["FURY"] = self.dbx.color9
powerColors["PAIN"] = self.dbx.color10
end
end
Grid2.setupFunc["power"] = function(baseKey, dbx)
Grid2.setupFunc["power"] = function(baseKey, dbx)
Grid2:RegisterStatus(Power, {"percent", "text", "color"}, baseKey, dbx)
Grid2:RegisterStatus(Power, {"percent", "text", "color"}, baseKey, dbx)
Power:UpdateDB()
Power:UpdateDB()
return Power
return Power
end
end
복사
복사됨
복사
복사됨
Grid2:DbSetStatusDefaultValue( "power", {type = "power", colorCount =
5
,
Grid2:DbSetStatusDefaultValue( "power", {type = "power", colorCount =
10
,
color1 = {r=0
,
g=0.
5,
b=1
,
a=1},
-- mana
color1 = {r=0
.00,
g=0.
00,
b=1
.00,
a=1},
-- mana
color2 = {r=1
,
g=0
,
b=0
,
a=1},
-- rage
color2 = {r=1
.00,
g=0
.00,
b=0
.00,
a=1},
-- rage
color3 = {r=1
,
g=0.5
,
b=0
,
a=1},
-- focus
color3 = {r=1
.00,
g=0.5
0 ,
b=0
.25,
a=1},
-- focus
color4 = {r=1
,
g=1
,
b=0
,
a=1},
-- energy
color4 = {r=1
.00,
g=1
.00 ,
b=0
.00,
a=1},
-- energy
color5 = {r=0
,
g=0.8
,b=0.8,
a=1},
-- runic power
color5 = {r=0
.00,
g=0.8
2, b=1.00,
a=1},
-- runic power
color6 = {r=0.40, g=0.00, b=0.80, a=1}, -- insanity
color7 = {r=0.00, g=0.50, b=1.00, a=1}, -- maelstrom
color8 = {r=0.30, g=0.52, b=0.90, a=1}, -- astral power
color9 = {r=0.788, g=0.259, b=0.992, a=1}, -- fury
color10 = {r=1.00, g=0.61, b=0.00, a=1} -- pain
})
})
저장된 비교 결과
원본
파일 열기
-- mana, lowmana, power, poweralt local Mana = Grid2.statusPrototype:new("mana",false) local LowMana = Grid2.statusPrototype:new("lowmana",false) local Power = Grid2.statusPrototype:new("power",false) local PowerAlt = Grid2.statusPrototype:new("poweralt",false) local max = math.max local fmt = string.format local next = next local tostring = tostring local UnitMana = UnitMana local UnitManaMax = UnitManaMax local UnitPowerType = UnitPowerType local UnitPower = UnitPower local UnitPowerMax = UnitPowerMax local UnitIsPlayer = UnitIsPlayer local UnitGroupRolesAssigned = UnitGroupRolesAssigned local statuses = {} -- Enabled statuses -- Methods shared by all statuses local status_OnEnable, status_OnDisable do local frame local function Frame_OnEvent(self, event, unit, powerType) for status in next,statuses do status:UpdateUnitPower(unit, powerType) end end function status_OnEnable(status) if not next(statuses) then if not frame then frame = CreateFrame("Frame", nil, Grid2LayoutFrame) end frame:SetScript("OnEvent", Frame_OnEvent) frame:RegisterEvent("UNIT_POWER") frame:RegisterEvent("UNIT_MAXPOWER") frame:RegisterEvent("UNIT_DISPLAYPOWER") end statuses[status] = true end function status_OnDisable(status) statuses[status] = nil if (not next(statuses)) and frame then frame:SetScript("OnEvent", nil) frame:UnregisterEvent("UNIT_POWER") frame:UnregisterEvent("UNIT_MAXPOWER") frame:UnregisterEvent("UNIT_DISPLAYPOWER") end end end -- Mana status Mana.GetColor = Grid2.statusLibrary.GetColor Mana.OnEnable = status_OnEnable Mana.OnDisable= status_OnDisable function Mana:UpdateUnitPowerStandard(unit, powerType) if powerType=="MANA" then self:UpdateIndicators(unit) end end function Mana:UpdateUnitPowerHealer(unit, powerType) if powerType=="MANA" and (unit=="player" or UnitGroupRolesAssigned(unit) == "HEALER") then self:UpdateIndicators(unit) end end function Mana:IsActiveStandard(unit) return UnitPowerType(unit) == 0 end function Mana:IsActiveHealer(unit) return UnitPowerType(unit) == 0 and (unit=="player" or UnitGroupRolesAssigned(unit) == "HEALER") end function Mana:GetPercent(unit) return UnitMana(unit) / UnitManaMax(unit) end function Mana:GetText(unit) return fmt("%.1fk", UnitMana(unit) / 1000) end function Mana:UpdateDB() Mana.IsActive = self.dbx.showOnlyHealers and Mana.IsActiveHealer or Mana.IsActiveStandard Mana.UpdateUnitPower = self.dbx.showOnlyHealers and Mana.UpdateUnitPowerHealer or Mana.UpdateUnitPowerStandard end Grid2.setupFunc["mana"] = function(baseKey, dbx) Grid2:RegisterStatus(Mana, {"percent", "text", "color"}, baseKey, dbx) Mana:UpdateDB() return Mana end Grid2:DbSetStatusDefaultValue( "mana", {type = "mana", color1= {r=0,g=0,b=1,a=1}} ) -- Low Mana status LowMana.GetColor = Grid2.statusLibrary.GetColor LowMana.OnEnable = status_OnEnable LowMana.OnDisable = status_OnDisable function LowMana:UpdateUnitPower(unit, powerType) if powerType=="MANA" then self:UpdateIndicators(unit) end end function LowMana:IsActive(unit) return (UnitPowerType(unit) == 0) and (Mana:GetPercent(unit) < self.dbx.threshold) end Grid2.setupFunc["lowmana"] = function(baseKey, dbx) Grid2:RegisterStatus(LowMana, {"color"}, baseKey, dbx) return LowMana end Grid2:DbSetStatusDefaultValue( "lowmana", {type = "lowmana", threshold = 0.75, color1 = {r=0.5,g=0,b=1,a=1}}) -- Alternative power status PowerAlt.GetColor = Grid2.statusLibrary.GetColor PowerAlt.OnEnable = status_OnEnable PowerAlt.OnDisable= status_OnDisable function PowerAlt:UpdateUnitPower(unit, powerType) if powerType=="ALTERNATE" then self:UpdateIndicators(unit) end end function PowerAlt:IsActive(unit) return UnitPowerMax(unit,10)>0 end function PowerAlt:GetPercent(unit) return max(UnitPower(unit,10),0) / UnitPowerMax(unit,10) end function PowerAlt:GetText(unit) local power= UnitPower(unit,10) if power>=1000 then return fmt("%.1fk", power / 1000) else return tostring( max(power,0) ) end end Grid2.setupFunc["poweralt"] = function(baseKey, dbx) Grid2:RegisterStatus(PowerAlt, {"percent", "text", "color"}, baseKey, dbx) return PowerAlt end Grid2:DbSetStatusDefaultValue( "poweralt", {type = "poweralt", color1= {r=1,g=0,b=0.5,a=1}} ) -- Power status local powerColors= {} Power.OnEnable = status_OnEnable Power.OnDisable = status_OnDisable function Power:UpdateUnitPower(unit, powerType) if UnitIsPlayer(unit) and powerColors[ powerType ] then self:UpdateIndicators(unit) end end function Power:IsActive(unit) return UnitIsPlayer(unit) end function Power:GetPercent(unit) return UnitPower(unit) / UnitPowerMax(unit) end function Power:GetText(unit) local power = UnitPower(unit) if power>=1000 then return fmt("%.1fk", power / 1000) else return tostring(power) end end function Power:GetColor(unit) local _,type= UnitPowerType(unit) local c= powerColors[type] or powerColors["MANA"] return c.r, c.g, c.b, c.a end function Power:UpdateDB() powerColors["MANA"] = self.dbx.color1 powerColors["RAGE"] = self.dbx.color2 powerColors["FOCUS"] = self.dbx.color3 powerColors["ENERGY"] = self.dbx.color4 powerColors["RUNIC_POWER"] = self.dbx.color5 end Grid2.setupFunc["power"] = function(baseKey, dbx) Grid2:RegisterStatus(Power, {"percent", "text", "color"}, baseKey, dbx) Power:UpdateDB() return Power end Grid2:DbSetStatusDefaultValue( "power", {type = "power", colorCount = 5, color1 = {r=0,g=0.5,b=1 ,a=1}, -- mana color2 = {r=1,g=0 ,b=0 ,a=1}, -- rage color3 = {r=1,g=0.5,b=0 ,a=1}, -- focus color4 = {r=1,g=1 ,b=0 ,a=1}, -- energy color5 = {r=0,g=0.8,b=0.8,a=1}, -- runic power })
수정본
파일 열기
-- mana, lowmana, power, poweralt local Mana = Grid2.statusPrototype:new("mana",false) local LowMana = Grid2.statusPrototype:new("lowmana",false) local Power = Grid2.statusPrototype:new("power",false) local PowerAlt = Grid2.statusPrototype:new("poweralt",false) local max = math.max local fmt = string.format local next = next local tostring = tostring local UnitMana = UnitMana local UnitManaMax = UnitManaMax local UnitPowerType = UnitPowerType local UnitPower = UnitPower local UnitPowerMax = UnitPowerMax local UnitIsPlayer = UnitIsPlayer local UnitGroupRolesAssigned = UnitGroupRolesAssigned local statuses = {} -- Enabled statuses -- Methods shared by all statuses local status_OnEnable, status_OnDisable do local frame local function Frame_OnEvent(self, event, unit, powerType) for status in next,statuses do status:UpdateUnitPower(unit, powerType) end end function status_OnEnable(status) if not next(statuses) then if not frame then frame = CreateFrame("Frame", nil, Grid2LayoutFrame) end frame:SetScript("OnEvent", Frame_OnEvent) frame:RegisterEvent("UNIT_POWER") frame:RegisterEvent("UNIT_MAXPOWER") frame:RegisterEvent("UNIT_DISPLAYPOWER") end statuses[status] = true end function status_OnDisable(status) statuses[status] = nil if (not next(statuses)) and frame then frame:SetScript("OnEvent", nil) frame:UnregisterEvent("UNIT_POWER") frame:UnregisterEvent("UNIT_MAXPOWER") frame:UnregisterEvent("UNIT_DISPLAYPOWER") end end end -- Mana status Mana.GetColor = Grid2.statusLibrary.GetColor Mana.OnEnable = status_OnEnable Mana.OnDisable= status_OnDisable function Mana:UpdateUnitPowerStandard(unit, powerType) if powerType=="MANA" then self:UpdateIndicators(unit) end end function Mana:UpdateUnitPowerHealer(unit, powerType) if powerType=="MANA" and (unit=="player" or UnitGroupRolesAssigned(unit) == "HEALER") then self:UpdateIndicators(unit) end end function Mana:IsActiveStandard(unit) return UnitPowerType(unit) == 0 end function Mana:IsActiveHealer(unit) return UnitPowerType(unit) == 0 and (unit=="player" or UnitGroupRolesAssigned(unit) == "HEALER") end function Mana:GetPercent(unit) return UnitMana(unit) / UnitManaMax(unit) end function Mana:GetText(unit) return fmt("%.1fk", UnitMana(unit) / 1000) end function Mana:UpdateDB() Mana.IsActive = self.dbx.showOnlyHealers and Mana.IsActiveHealer or Mana.IsActiveStandard Mana.UpdateUnitPower = self.dbx.showOnlyHealers and Mana.UpdateUnitPowerHealer or Mana.UpdateUnitPowerStandard end Grid2.setupFunc["mana"] = function(baseKey, dbx) Grid2:RegisterStatus(Mana, {"percent", "text", "color"}, baseKey, dbx) Mana:UpdateDB() return Mana end Grid2:DbSetStatusDefaultValue( "mana", {type = "mana", color1= {r=0,g=0,b=1,a=1}} ) -- Low Mana status LowMana.GetColor = Grid2.statusLibrary.GetColor LowMana.OnEnable = status_OnEnable LowMana.OnDisable = status_OnDisable function LowMana:UpdateUnitPower(unit, powerType) if powerType=="MANA" then self:UpdateIndicators(unit) end end function LowMana:IsActive(unit) return (UnitPowerType(unit) == 0) and (Mana:GetPercent(unit) < self.dbx.threshold) end Grid2.setupFunc["lowmana"] = function(baseKey, dbx) Grid2:RegisterStatus(LowMana, {"color"}, baseKey, dbx) return LowMana end Grid2:DbSetStatusDefaultValue( "lowmana", {type = "lowmana", threshold = 0.75, color1 = {r=0.5,g=0,b=1,a=1}}) -- Alternative power status PowerAlt.GetColor = Grid2.statusLibrary.GetColor PowerAlt.OnEnable = status_OnEnable PowerAlt.OnDisable= status_OnDisable function PowerAlt:UpdateUnitPower(unit, powerType) if powerType=="ALTERNATE" then self:UpdateIndicators(unit) end end function PowerAlt:IsActive(unit) return UnitPowerMax(unit,10)>0 end function PowerAlt:GetPercent(unit) return max(UnitPower(unit,10),0) / UnitPowerMax(unit,10) end function PowerAlt:GetText(unit) local power= UnitPower(unit,10) if power>=1000 then return fmt("%.1fk", power / 1000) else return tostring( max(power,0) ) end end Grid2.setupFunc["poweralt"] = function(baseKey, dbx) Grid2:RegisterStatus(PowerAlt, {"percent", "text", "color"}, baseKey, dbx) return PowerAlt end Grid2:DbSetStatusDefaultValue( "poweralt", {type = "poweralt", color1= {r=1,g=0,b=0.5,a=1}} ) -- Power status local powerColors= {} Power.OnEnable = status_OnEnable Power.OnDisable = status_OnDisable function Power:UpdateUnitPower(unit, powerType) if UnitIsPlayer(unit) and powerColors[ powerType ] then self:UpdateIndicators(unit) end end function Power:IsActive(unit) return UnitIsPlayer(unit) end function Power:GetPercent(unit) return UnitPower(unit) / UnitPowerMax(unit) end function Power:GetText(unit) local power = UnitPower(unit) if power>=1000 then return fmt("%.1fk", power / 1000) else return tostring(power) end end function Power:GetColor(unit) local _,type= UnitPowerType(unit) local c= powerColors[type] or powerColors["MANA"] return c.r, c.g, c.b, c.a end function Power:UpdateDB() powerColors["MANA"] = self.dbx.color1 powerColors["RAGE"] = self.dbx.color2 powerColors["FOCUS"] = self.dbx.color3 powerColors["ENERGY"] = self.dbx.color4 powerColors["RUNIC_POWER"] = self.dbx.color5 powerColors["INSANITY"] = self.dbx.color6 powerColors["MAELSTROM"] = self.dbx.color7 powerColors["LUNAR_POWER"] = self.dbx.color8 powerColors["FURY"] = self.dbx.color9 powerColors["PAIN"] = self.dbx.color10 end Grid2.setupFunc["power"] = function(baseKey, dbx) Grid2:RegisterStatus(Power, {"percent", "text", "color"}, baseKey, dbx) Power:UpdateDB() return Power end Grid2:DbSetStatusDefaultValue( "power", {type = "power", colorCount = 10, color1 = {r=0.00, g=0.00, b=1.00, a=1}, -- mana color2 = {r=1.00, g=0.00, b=0.00, a=1}, -- rage color3 = {r=1.00, g=0.50 , b=0.25, a=1}, -- focus color4 = {r=1.00, g=1.00 , b=0.00, a=1}, -- energy color5 = {r=0.00, g=0.82, b=1.00, a=1}, -- runic power color6 = {r=0.40, g=0.00, b=0.80, a=1}, -- insanity color7 = {r=0.00, g=0.50, b=1.00, a=1}, -- maelstrom color8 = {r=0.30, g=0.52, b=0.90, a=1}, -- astral power color9 = {r=0.788, g=0.259, b=0.992, a=1}, -- fury color10 = {r=1.00, g=0.61, b=0.00, a=1} -- pain })
비교하기