-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathStatReport.lua
192 lines (174 loc) · 6.02 KB
/
StatReport.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
--[[
StatReport.lua
属性通报
适配Bfa正式版本,汇报神器项链。修正汇报护甲为0
插件更新地址 http://nga.178.com/read.php?tid=9633520
--]]
local SimpleChat = LibStub("AceAddon-3.0"):GetAddon("SimpleChat")
local SimpleChat_Config
local slotNames = {
"HeadSlot",
"NeckSlot",
"ShoulderSlot",
"BackSlot",
"ChestSlot",
"ShirtSlot",
"TabardSlot",
"WristSlot",
"HandsSlot",
"WaistSlot",
"LegsSlot",
"FeetSlot",
"Finger0Slot",
"Finger1Slot",
"Trinket0Slot",
"Trinket1Slot",
"MainHandSlot",
"SecondaryHandSlot",
"AmmoSlot"
}
-- 本地化专精
local function Talent()
local Spec = GetSpecialization()
local SpecName = Spec and select(2, GetSpecializationInfo(Spec)) or "无"
return SpecName
end
-- 格式化血量
local function HealText()
local HP = UnitHealthMax("player")
if HP > 1e4 then
return format("%.2f万", HP / 1e4)
else
return HP
end
end
-- 神器等级
local function ArtifactLevel()
local currentLevel = " "
local azeriteItemLocation = C_AzeriteItem.FindActiveAzeriteItem()
if azeriteItemLocation then
currentLevel = C_AzeriteItem.GetPowerLevel(azeriteItemLocation)
end
return currentLevel
end
-- 特质装等级
local function AzeriteItemLevel(slotNum)
local currentLevel = "0"
local slotId = GetInventorySlotInfo(slotNames[slotNum])
local itemLink = GetInventoryItemLink("player", slotId)
if itemLink then
local itemLoc
if ItemLocation then
itemLoc = ItemLocation:CreateFromEquipmentSlot(slotId)
end
if C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItem(itemLoc) then
return select(4, GetItemInfo(itemLink))
end
end
return currentLevel
end
local function GetItemLevel(slotNum)
local slotId = GetInventorySlotInfo(slotNames[slotNum])
local itemLink = GetInventoryItemLink("player", slotId)
if itemLink then
local _ ,_ ,_ , ilvl ,_ ,_, iSubType = GetItemInfo(itemLink)
return iSubType .. "-" .. ilvl
end
return "0"
end
-- 基础属性
local function BaseInfo()
local BaseStat = ""
BaseStat = BaseStat .. ("[%s] "):format(UnitClass("player"))
BaseStat = BaseStat .. ("[%s] "):format(Talent())
BaseStat = BaseStat .. ("最高装等:%.1f 当前:%.1f "):format(GetAverageItemLevel())
local mainHand = GetItemLevel(17)
if mainHand ~= "0" then
BaseStat = BaseStat .. ("主手:%s "):format(mainHand)
end
local offHand = GetItemLevel(18)
if offHand ~= "0" then
BaseStat = BaseStat .. ("副手:%s "):format(offHand)
end
BaseStat = BaseStat .. ("血量:%s "):format(HealText())
-- BaseStat = BaseStat .. ("神器:%s "):format(ArtifactLevel())-- 项链等级
-- BaseStat = BaseStat .. ("头部:%s "):format(AzeriteItemLevel(1))-- 头部特质装等级
-- BaseStat = BaseStat .. ("肩部:%s "):format(AzeriteItemLevel(3))-- 肩部特质装等级
-- BaseStat = BaseStat .. ("胸部:%s "):format(AzeriteItemLevel(5))-- 胸部特质装等级
return BaseStat
end
-- 输出属性(9 = 暴击 12 = 溅射 17 = 吸血 18 = 急速 21 = 闪避 26 = 精通 29 = 装备+自身全能 31 = 装备全能)
-- by图图
local function DpsInfo()
local DpsStat = {"", "", ""}
local specAttr = {
--纯力敏智属性职业
WARRIOR = {1, 1, 1},
DEATHKNIGHT = {1, 1, 1},
ROGUE = {2, 2, 2},
HUNTER = {2, 2, 2},
DEMONHUNTER = {2, 2},
MAGE = {3, 3, 3},
WARLOCK = {3, 3, 3},
PRIEST = {3, 3, 3},
--混合力敏智属性职业
SHAMAN = {3, 2, 3},
MONK = {2, 3, 2},
DRUID = {3, 2, 2, 3},
PALADIN = {3, 1, 1}
}
local specId = GetSpecialization()
-- print("specId = "..specId)
local classCN, classEnName = UnitClass("player")
local classSpecArr = specAttr[classEnName]
DpsStat[1] = ("力量:%s "):format(UnitStat("player", 1))
DpsStat[2] = ("敏捷:%s "):format(UnitStat("player", 2))
DpsStat[3] = ("智力:%s "):format(UnitStat("player", 4))
return DpsStat[classSpecArr[specId]]
end
-- 坦克属性
local function TankInfo()
local TankStat = ""
TankStat = TankStat .. ("耐力:%s "):format(UnitStat("player", 3))
TankStat = TankStat .. ("护甲:%s "):format(select(3, UnitArmor("player")))
TankStat = TankStat .. ("躲闪:%.0f%% "):format(GetDodgeChance())
TankStat = TankStat .. ("招架:%.0f%% "):format(GetParryChance())
TankStat = TankStat .. ("格挡:%.0f%% "):format(GetBlockChance())
return TankStat
end
-- 治疗属性
local function HealInfo()
local HealStat = ""
-- HealStat = HealStat..("精神:%s "):format(UnitStat("player", 5))
-- HealStat = HealStat .. ("法力回复:%d "):format(GetManaRegen() * 5)
return HealStat
end
-- 增强属性
local function MoreInfo()
local MoreStat = ""
MoreStat = MoreStat .. ("爆击:%.0f%% "):format(GetCritChance())
MoreStat = MoreStat .. ("急速:%.0f%% "):format(GetMeleeHaste())
MoreStat = MoreStat .. ("精通:%.0f%% "):format(GetMasteryEffect())
MoreStat = MoreStat .. ("全能:%.0f%% "):format(
GetCombatRatingBonus(CR_VERSATILITY_DAMAGE_DONE) + GetVersatilityBonus(CR_VERSATILITY_DAMAGE_DONE)
)
-- MoreStat = MoreStat .. ("吸血:%.0f%% "):format(GetCombatRating(17) / 230)
-- MoreStat = MoreStat .. ("闪避:%.0f%% "):format(GetCombatRating(21) / 110)
return MoreStat
end
-- 属性收集
function SimpleChat:StatReport()
if UnitLevel("player") < 10 then
return BaseInfo()
end
local StatInfo = ""
local Role = GetSpecializationRole(GetSpecialization())
if Role == "HEALER" then
StatInfo = StatInfo .. BaseInfo() .. DpsInfo() .. HealInfo() .. MoreInfo()
elseif Role == "TANK" then
StatInfo = StatInfo .. BaseInfo() .. DpsInfo() .. TankInfo() .. MoreInfo()
else
StatInfo = StatInfo .. BaseInfo() .. DpsInfo() .. MoreInfo()
end
return StatInfo
end