Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if lib.getClass('player') ~= "MONK" then return end
- local chi = SPELL_POWER_LIGHT_FORCE
- local coloron = {.9, .9, .9, 1}
- local coloroff = {.2, .2, .2, 1}
- local chinum
- local chipoints = {}
- local chibar = CreateFrame("Frame", "ColdChiBar" , ColdPlayer)
- chibar:SetSize(95, 12)
- chibar:SetPoint("BOTTOMRIGHT", ColdPlayer.Health, "BOTTOMRIGHT", 6.5, 1)
- chibar:SetFrameLevel(6)
- local function ChiUpdate()
- local chi = UnitPower("player", SPELL_POWER_LIGHT_FORCE)
- local chimax = UnitPowerMax("player", SPELL_POWER_LIGHT_FORCE)
- if chinum ~= chimax then
- if chimax == 4 then
- chipoints[5]:Hide()
- for i = 4, 1, -1 do
- if i == 4 then
- chipoints[i]:SetPoint("RIGHT", chibar)
- else
- chipoints[i]:SetPoint("RIGHT", chipoints[i+1], "LEFT", 0, 0)
- end
- end
- else
- chipoints[5]:Show()
- for i = 5, 1, -1 do
- if i == 5 then
- chipoints[i]:SetPoint("RIGHT", chibar)
- else
- chipoints[i]:SetPoint("RIGHT", chipoints[i+1], "LEFT", 0, 0)
- end
- end
- end
- chinum = chimax
- end
- for i = 1, chimax do
- if i <= chi then
- chipoints[i]:SetTextColor(unpack(coloron))
- else
- chipoints[i]:SetTextColor(unpack(coloroff))
- end
- end
- end
- local function CreateChi()
- chibar:RegisterEvent("UNIT_POWER")
- chibar:RegisterEvent("UNIT_DISPLAYPOWER")
- chibar:SetScript("OnEvent", ChiUpdate)
- for i = 5, 1, -1 do
- chipoints[i] = lib.SetFontString(chibar, cfg.font, cfg.fontsize, "OUTLINE, MONOCHROME")
- chipoints[i]:SetText(i.."*")
- if i == 1 then
- chipoints[i]:SetSize(18,12)
- else
- chipoints[i]:SetSize(20,12)
- end
- if i == 5 then
- chipoints[i]:SetPoint("RIGHT", chibar)
- chipoints[i]:SetTextColor(1, 0, 0)
- else
- chipoints[i]:SetPoint("RIGHT", chipoints[i+1], "LEFT", 0, 0)
- end
- chipoints[i]:SetTextColor(unpack(coloroff))
- end
- chinum = 5
- ChiUpdate()
- end
- chibar:RegisterEvent("PLAYER_ENTERING_WORLD")
- chibar:SetScript("OnEvent", CreateChi)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement