切換
舊版
前往
大廳
主題

[WOW]簡易顯示跑速及屬性及吸收量

死鬥 | 2016-07-30 20:12:31 | 巴幣 0 | 人氣 961


加入致命加速精通臨機顯示
加入力敏智顯示
加入吸收量顯示
加入彩色顯示
滑鼠右鍵可拖動




local addonName,addonTable = ...

---------確認是否有載入Lib_ZYF, 若無則返回
if (Lib_ZYF == nil ) then
print("No Lib_ZYF loaded")
return
end
---------
--local AppendFrame = PlayerFrame
local AppendFrame = WorldFrame
local x_offset = 0
local y_offset = 0
local frame_width = 150
local frame_height = 150
local TextHeight = 20    --文字大小
Lib_ZYF:SetEvent("ADDON_LOADED",function ()

if not(SpeedFrame) then
SpeedFrame = CreateFrame("Frame",nil,UIParent)
SpeedFrame:SetWidth(frame_width)
SpeedFrame:SetHeight(frame_height)
end
if FramePos then
SpeedFrame:SetPoint(FramePos[3],FramePos[4],FramePos[5])
else
SpeedFrame:SetPoint("CENTER",0,0)
end

SpeedFrame:EnableMouse(true)
SpeedFrame:SetMovable(true)
SpeedFrame:RegisterForDrag("RightButton")
SpeedFrame:SetScript("OnDragStart", function(self) self:StartMoving() end)
SpeedFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)


local t
if not(SpeedFrame.text) then
local f = SpeedFrame
f.text = f:CreateFontString(nil,"ARTWORK")
local t = f.text
t:SetPoint("CENTER",0,0)
t:SetFont("Fonts\\bHEI00M.TTF",TextHeight,"OUTLINE")
t:SetJustifyH("LEFT")
t:SetJustifyV("TOP")
t:SetText("")
end

end) --End Of SetEvent("AddON_LOADED")


local p = "player"
local YardOfNormalSpeed = 7
local desc = {"陸地","飛行","游泳","致命","加速","精通","臨機","吸收"}
local statMain = 0

local colorSpeedDesc = "|cffeeeeee"
local colorSpeedValue = "|cffeeeeee"
local strFormatSpeed = colorSpeedDesc.."%s"..colorSpeedValue.."%d%%\n"

local colorStatDesc  = "|cffC785C8"
local colorStatValue  = "|cffC785C8"
local strFormatStat = colorStatDesc.."%s"..colorStatValue.."%d\n"

local colorHasteDesc  = "|cff00ff00"
local colorHasteValue = "|cff00ff00"
local strFormatHaste = colorHasteDesc.."%s"..colorHasteValue.."%.1f%%\n"

local colorMasteryDesc = "|cfff47378"
local colorMasteryValue = "|cfff47378"
local strFormatMastery = colorMasteryDesc.."%s"..colorMasteryValue.."%.1f%%\n"

local colorVersDesc = "|cffffff00"
local colorVersValue = "|cffffff00"
local strFormatVers = colorVersDesc.."%s"..colorVersValue.."%.1f%%".."(%.1f%%)\n"

local colorCritDesc = "|cffff7f27"
local colorCritValue = "|cffff7f27"
local strFormatCrit = colorCritDesc.."%s"..colorCritValue.."%.1f%%\n"

local colorAbsorbDesc = "|cff60c5f1"
local colorAbsorbValue = "|cff60c5f1"
local strFormatAbsorb = colorAbsorbDesc.."%s"..colorAbsorbValue.."%d\n"

Lib_ZYF:SetOnUpdate(0.2,function()
local tmp = ""

local speed = {GetUnitSpeed(p)}
local i = 1
if IsFlying() then
i = 2
elseif IsSwimming() then
i = 3
else
i = 1
end
tmp = tmp..format(strFormatSpeed,desc[i],ceil(speed[i+1]/YardOfNormalSpeed*100))
local statStrength  = (UnitStat(p, 1))
local statAgility   = (UnitStat(p, 2))
local statStamina  = (UnitStat(p, 3))
local statIntellect = (UnitStat(p, 4))
statMain = math.max(statStrength,statAgility,statIntellect)
if statStrength  >= statMain then tmp = tmp..format(strFormatStat,"力量",statStrength)  end
if statAgility   >= statMain then tmp = tmp..format(strFormatStat,"敏捷",statAgility)  end
if statIntellect >= statMain then tmp = tmp..format(strFormatStat,"智力",statIntellect) end
--if statStamina   > statDisplayValue then tmp = tmp.."耐"..statStamina   end
--吸收量
local totalAbsorbs = UnitGetTotalAbsorbs(p)
if totalAbsorbs >= 0 then
tmp = tmp..format(strFormatAbsorb,desc[8],totalAbsorbs)
end
--加速(Haste)
tmp = tmp..format(strFormatHaste,desc[5],GetHaste())
--精通(Mastery)
tmp = tmp..format(strFormatMastery,desc[6],GetMasteryEffect())
--臨機(Versatility)
local tmpVersatility = GetCombatRatingBonus(29)+GetVersatilityBonus(29)
tmp = tmp..format(strFormatVers,desc[7],tmpVersatility,tmpVersatility/2)
--致命(Crit)
local tmpCrit = (statIntellect >= statMain) and GetSpellCritChance() or GetCritChance()
tmp = tmp..format(strFormatCrit,desc[4],tmpCrit)
SpeedFrame.text:SetText(tmp)
FramePos = {SpeedFrame:GetPoint()}
end)



創作回應

更多創作