Compare with Previous | Blame | View Log
local E, C = unpack(select(2, ...)) if C["info"].durability == 0 or C["info"].enable == false then return end --ç¶ææ¥å local MyData = {}; function StatReport_GetSpellText() local text = ""; text = text..MyData.SSP.."æ³ä¼¤"; text = text..", "; text = text..MyData.SHIT.."å½ä¸"; text = text..", "; text = text..format("%.1f%%", MyData.SCRIT).."çå»"; text = text..", "; text = text..MyData.SHASTE.."æ¥é"; text = text..", "; text = text..MyData.MP.."æ³å"; return text; end function StatReport_GetHealText() local text = ""; text = text..MyData.SHP.."æ²»ç"; text = text..", "; text = text..format("%.1f%%", MyData.SCRIT).."çå»"; text = text..", "; text = text..MyData.SHASTE.."æ¥é"; text = text..", "; text = text..MyData.MP.."æ³å"; text = text..", "; text = text..MyData.SMR.."/".."5ç§æ³ååå¤"; return text; end function StatReport_GetSpellAndHealText() local text = ""; text = text..MyData.SSP.."æ³ä¼¤"; text = text..", "; text = text..MyData.SHP.."æ²»ç"; text = text..", "; text = text..MyData.SHIT.."å½ä¸"; text = text..", "; text = text..format("%.1f%%", MyData.SCRIT).."çå»"; text = text..", "; text = text..MyData.SHASTE.."æ¥é"; text = text..", "; text = text..MyData.MP.."æ³å"; text = text..", "; text = text..MyData.SMR.."/".."5ç§æ³ååå¤"; return text; end function StatReport_GetMeleeText() local text = ""; text = text..MyData.MAP.."强度"; text = text..", "; text = text..MyData.MHIT.."å½ä¸"; text = text..", "; text = text..format("%.1f%%", MyData.MCRIT).."çå»"; text = text..", "; text = text..MyData.MEXPER.."ç²¾å"; return text; end function StatReport_GetRangedText() local text = ""; text = text..MyData.RAP.."强度"; text = text..", "; text = text..MyData.RHIT.."å½ä¸"; text = text..", "; text = text..format("%.1f%%", MyData.RCRIT).."çå»"; return text; end function StatReport_GetTankText() local text = ""; text = text..MyData.HP.."çå½"; text = text..", "; text = text..MyData.DEF.."é²å¾¡"; text = text..", "; text = text..format("%.1f%%", MyData.DODGE).."躲éª"; text = text..", "; text = text..format("%.1f%%", MyData.PARRY).."ææ¶"; text = text..", "; text = text..format("%.1f%%", MyData.BLOCK).."æ ¼æ¡"; text = text..", "; text = text..MyData.ARMOR.."æ¤ç²"; return text; end function StatReport_TalentData() local name1,_,pointsSpent1 = GetTalentTabInfo(1); local name2,_,pointsSpent2 = GetTalentTabInfo(2); local name3,_,pointsSpent3 = GetTalentTabInfo(3); local nameKey = "æ "; local TalentStat = ""; if not(pointsSpent1 == 0 and pointsSpent2 == 0 and pointsSpent3 == 0) then local tmpname, temppointsSpent; tmpname = ((pointsSpent1 > pointsSpent2) and name1) or name2; temppointsSpent = ((pointsSpent1 > pointsSpent2) and pointsSpent1) or pointsSpent2; tmpname = ((temppointsSpent > pointsSpent3) and tmpname) or name3; nameKey = tmpname; end if nameKey ~= "æ " then TalentStat = ("(%s/%s/%s)"):format(pointsSpent1, pointsSpent2, pointsSpent3); end return nameKey, TalentStat; end function StatReport_UnitAttackPower() local base, posBuff, negBuff = UnitAttackPower("player"); return floor(base + posBuff + negBuff); end function StatReport_UnitRangedAttackPower() local base, posBuff, negBuff = UnitRangedAttackPower("player"); return floor(base + posBuff + negBuff); end function StatReport_GetSpellBonusDamage() local SSP = GetSpellBonusDamage(2); for i=3, 7 do SSP = max(SSP, GetSpellBonusDamage(i)); end return floor(SSP); end function StatReport_GetSpellCritChance() local SCRIT = GetSpellCritChance(2); for i=3, 7 do SCRIT = max(SCRIT, GetSpellCritChance(i)); end return SCRIT; end function StatReport_UnitDefense() local baseDEF, posDEF = UnitDefense("player"); return floor(baseDEF + posDEF); end function StatReport_UnitItem_ilvl_AVG(unit) local _, uc = UnitClass(unit); local ul = UnitLevel(unit); --åè´¨æç®ç³»æ° local qualitypara = { [0] = 0.0, --0ï¼ç°è² [1] = 0.1, --1ï¼ç½è² [2] = 0.6, --2ï¼ç»¿è² [3] = 0.8, --3ï¼èè² [4] = 1.0, --4ï¼ç´«è² [5] = 1.05, --5ï¼æ©è² [6] = 1.15, --6ï¼çº¢è² [7] = 1.0, --7ï¼éè² }; --è£ å¤çº§å«å æç³»æ°é»è®¤å¼ï¼æ³ç³» local slotpara = { [1] = 3.5, --1ï¼å¤´ [2] = 2, --2ï¼é¢ [3] = 2.5, --3ï¼è© [4] = 0, --4ï¼è¡¬è¡£ [5] = 3.7, --5ï¼è¸ [6] = 2.3, --6ï¼è °å¸¦ [7] = 3.5, --7ï¼è ¿ [8] = 2.4, --8ï¼è [9] = 1.6, --9ï¼æè [10] = 2.5, --10ï¼æå¥ [11] = 2.1, --11ï¼ææ1 [12] = 2.1, --12ï¼ææ2 [13] = 2, --13ï¼é¥°å1 [14] = 2, --14ï¼é¥°å2 [15] = 1.8, --15ï¼è [16] = 6, --16ï¼ä¸»æ [17] = 2, --17ï¼å¯æ [18] = 1, --18ï¼è¿ç¨æ¦å¨ [19] = 0, --19ï¼æè¢ }; if uc == "HUNTER" then slotpara[16] = 3; slotpara[17] = 1; slotpara[18] = 5; elseif uc == "WARRIOR" then if MyData.TKEY == GetTalentTabInfo(3) then slotpara[16] = 3.5; slotpara[17] = 4.5; slotpara[18] = 1; else slotpara[16] = 5; slotpara[17] = 3; slotpara[18] = 1; end elseif uc == "ROGUE" or uc == "DEATHKNIGHT" then slotpara[16] = 5; slotpara[17] = 3; slotpara[18] = 1; elseif uc == "SHAMAN" then if MyData.TKEY == GetTalentTabInfo(2) then slotpara[16] = 5; slotpara[17] = 3; slotpara[18] = 1; end elseif uc == "PALADIN" then if MyData.TKEY == GetTalentTabInfo(2) then slotpara[16] = 3.5; slotpara[17] = 4.5; slotpara[18] = 1; end end local quality, iLevel; local itemcount = 0; local levelcount = 0; local paracount = 0; for i=1, 18 ,1 do if i~=4 then local link = GetInventoryItemLink(unit, i); if (link) then _, _, quality, iLevel = GetItemInfo(link); if(quality >=1 and quality <=7) then if (quality == 7) and (iLevel < ul*2) then iLevel = (ul*ul*ul)/2400; end itemcount = itemcount + 1; levelcount = levelcount + iLevel*qualitypara[quality]*slotpara[i]; paracount = paracount + slotpara[i]; end end end end return floor((levelcount/paracount) + 0.5); end function StatReport_UpdateMyData() MyData.Name = UnitName("player"); --å称 MyData.LV = UnitLevel("player"); --ç级 MyData.CLASS, MyData.CLASS_EN = UnitClass("player"); --èä¸ MyData.HP = UnitHealthMax("player"); --çå½å¼ MyData.MP = UnitManaMax("player"); --æ³åå¼ MyData.TKEY, MyData.TDATA = StatReport_TalentData(); --å¤©èµ MyData.ILVL = StatReport_UnitItem_ilvl_AVG("player"); --综åè£ å¤ç级 --åºç¡å±æ§ MyData.STR = UnitStat("player", 1); --åé MyData.AGI = UnitStat("player", 2); --ææ· MyData.STA = UnitStat("player", 3); --èå MyData.INT = UnitStat("player", 4); --æºå MyData.SPI = UnitStat("player", 5); --ç²¾ç¥ --è¿æ MyData.MAP = StatReport_UnitAttackPower(); --强度 MyData.MHIT = GetCombatRating(6); --å½ä¸ç级 MyData.MCRIT = GetCritChance(); --çå»ç% MyData.MEXPER = GetExpertise(); --ç²¾å --è¿ç¨ MyData.RAP = StatReport_UnitRangedAttackPower(); --强度 MyData.RHIT = GetCombatRating(7); --å½ä¸ç级 MyData.RCRIT = GetRangedCritChance(); --çå»ç% --æ³æ¯ MyData.SSP = StatReport_GetSpellBonusDamage(); --伤害å æ MyData.SHP = GetSpellBonusHealing(); --æ²»çå æ MyData.SHIT = GetCombatRating(8); --å½ä¸ç级 MyData.SCRIT = StatReport_GetSpellCritChance(); --çå»ç MyData.SHASTE = GetCombatRating(20); --æ¥éç级 MyData.SMR = floor(GetManaRegen()*5); --æ³ååå¤ï¼æ¯5ç§ï¼ --é²å¾¡ _,_,MyData.ARMOR = UnitArmor("player"); --æ¤ç² MyData.DEF = StatReport_UnitDefense(); --é²å¾¡ MyData.DODGE = GetDodgeChance(); --躲éª% MyData.PARRY = GetParryChance(); --ææ¶% MyData.BLOCK = GetBlockChance(); --æ ¼æ¡% MyData.CRDEF = GetCombatRating(15); --é§æ§ end local durability = CreateFrame ("StatusBar",nil,UIParent) durability:SetWidth(70) durability:SetHeight(10) durability:SetStatusBarTexture(E.normTex) durability:SetStatusBarColor(.7,.7,.9,.8) durability:SetMinMaxValues(0,100) durability:SetValue(0) durability:EnableMouse(true) local name = durability:CreateFontString (nil,"OVERLAY") name:SetFont(E.fontn,12,"OUTLINE") name:SetJustifyH("RIGHT") name:SetShadowOffset(2,-2) name:SetPoint("BOTTOMRIGHT",1.3,-4) local Slots = { [1] = {1, "头", 1000}, [2] = {3, "è©", 1000}, [3] = {5, "è¸", 1000}, [4] = {6, "è °", 1000}, [5] = {9, "è ", 1000}, [6] = {10, "æ", 1000}, [7] = {7, "è ¿", 1000}, [8] = {8, "è", 1000}, [9] = {16, "主æ", 1000}, [10] = {17, "å¯æ", 1000}, [11] = {18, "è¿ç¨æ¦å¨", 1000} } local Total = 0 local current, max local function OnEvent(self) local r,g,b for i = 1, 11 do if GetInventoryItemLink("player", Slots[i][1]) ~= nil then current, max = GetInventoryItemDurability(Slots[i][1]) if current then Slots[i][3] = current/max Total = Total + 1 end end end table.sort(Slots, function(a, b) return a[3] < b[3] end) if Total > 0 then local dura = floor(Slots[1][3]*100) durability:SetValue(dura) name:SetText(floor(Slots[1][3]*100).."%|cffffffff".."D".."|r") else name:SetText("100%|cffffffff".."D".."|r") end self:SetScript("OnEnter", function() GameTooltip:SetOwner(this, "ANCHOR_CURSOR"); GameTooltip:ClearAllPoints() GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT", -4, -6) GameTooltip:ClearLines() GameTooltip:AddDoubleLine("èä¹ åº¦",floor(Slots[1][3]*100).." %",1,1,1,r,g,b) GameTooltip:AddDoubleLine(" ") for i = 1, 11 do if Slots[i][3] ~= 1000 then green = Slots[i][3]*2 red = 1 - green GameTooltip:AddDoubleLine(Slots[i][2], floor(Slots[i][3]*100).."%",1 ,1 , 1, red + 1, green, 0) end end GameTooltip:AddDoubleLine(" ") GameTooltip:AddDoubleLine("--==å³å»åéè§è²æ°æ®å°è天æ¡==--","",0.92, 0.94, 0.15,1,1,1) GameTooltip:Show() end) self:SetScript("OnLeave", function() GameTooltip:Hide() end) Total = 0 end durability:RegisterEvent("UPDATE_INVENTORY_DURABILITY") durability:RegisterEvent("MERCHANT_SHOW") durability:RegisterEvent("PLAYER_ENTERING_WORLD") durability:SetScript("OnEvent", OnEvent) durability:SetScript("OnMouseDown", function(self,arg1) if arg1=='LeftButton' then ToggleCharacter("PaperDollFrame") else --åéç¶ææ¥å local msg = "" StatReport_UpdateMyData() msg = msg..MyData.CLASS; msg = msg..", "; msg = msg..MyData.TKEY.."天èµ"..MyData.TDATA; msg = msg..", "; msg = msg.."è£ å¤ç级"..MyData.ILVL; msg = msg..", "; if MyData.CLASS_EN == "MAGE" or MyData.CLASS_EN == "WARLOCK" then msg = msg..StatReport_GetSpellText(); end if MyData.CLASS_EN == "ROGUE" then msg = msg..StatReport_GetMeleeText(); end if MyData.CLASS_EN == "HUNTER" then msg = msg..StatReport_GetRangedText(); end if MyData.CLASS_EN == "DRUID" then if MyData.TKEY == GetTalentTabInfo(1) then msg = msg..StatReport_GetSpellText(); elseif MyData.TKEY == GetTalentTabInfo(2) then if MyData.DODGE > 30 then msg = msg..StatReport_GetTankText(); else msg = msg..StatReport_GetMeleeText(); end elseif MyData.TKEY == GetTalentTabInfo(3) then msg = msg..StatReport_GetHealText(); else msg = msg..StatReport_GetMeleeText(); end end if MyData.CLASS_EN == "SHAMAN" then if MyData.TKEY == GetTalentTabInfo(1) then msg = msg..StatReport_GetSpellText(); elseif MyData.TKEY == GetTalentTabInfo(2) then msg = msg..StatReport_GetMeleeText(); elseif MyData.TKEY == GetTalentTabInfo(3) then msg = msg..StatReport_GetHealText(); else msg = msg..StatReport_GetMeleeText(); end end if MyData.CLASS_EN == "PALADIN" then if MyData.TKEY == GetTalentTabInfo(1) then msg = msg..StatReport_GetHealText(); elseif MyData.TKEY == GetTalentTabInfo(2) then msg = msg..StatReport_GetTankText(); elseif MyData.TKEY == GetTalentTabInfo(3) then msg = msg..StatReport_GetMeleeText(); else msg = msg..StatReport_GetMeleeText(); end end if MyData.CLASS_EN == "PRIEST" then if MyData.TKEY == GetTalentTabInfo(1) then msg = msg..StatReport_GetSpellAndHealText(); elseif MyData.TKEY == GetTalentTabInfo(2) then msg = msg..StatReport_GetHealText(); elseif MyData.TKEY == GetTalentTabInfo(3) then msg = msg..StatReport_GetSpellText(); else msg = msg..StatReport_GetSpellText(); end end if MyData.CLASS_EN == "WARRIOR" then if MyData.TKEY == GetTalentTabInfo(1) then msg = msg..StatReport_GetMeleeText(); elseif MyData.TKEY == GetTalentTabInfo(2) then msg = msg..StatReport_GetMeleeText(); elseif MyData.TKEY == GetTalentTabInfo(3) then msg = msg..StatReport_GetTankText(); else msg = msg..StatReport_GetMeleeText(); end end if MyData.CLASS_EN == "DEATHKNIGHT" then if (MyData.DODGE + MyData.PARRY) > 35 then msg = msg..StatReport_GetTankText(); else msg = msg..StatReport_GetMeleeText(); end end if MyData.CRDEF > (200*(MyData.LV/70)) then msg = msg..", "; msg = msg..MyData.CRDEF.."é§æ§"; end if IsAddOnLoaded("GearScoreLite") then msg = msg..", "; msg = msg.."GS:"..GearScore_GetScore(UnitName("player"), "player"); end if ChatFrame1EditBox:IsShown() then ChatFrame1EditBox:Insert(msg); else local ExistMSG = ChatFrame1EditBox:GetText() or ""; ChatFrame1EditBox:SetText(ExistMSG..msg); ChatEdit_SendText(ChatFrame1EditBox); ChatFrame1EditBox:Hide(); end end end) E.EuiInfo(C["info"].durability,durability)