-
Notifications
You must be signed in to change notification settings - Fork 0
/
TWInspectExporter.lua
executable file
·148 lines (130 loc) · 3.53 KB
/
TWInspectExporter.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
TWInspectExporter = {}
local frame = CreateFrame("Frame")
TWInspectExporter.Frame = frame
frame:Hide()
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent",
function(self, event, ...)
local unit = ...;
if ( event == "PLAYER_ENTERING_WORLD") then
printToChat("WORLD ENTERD")
OnLoad();
return;
end
end)
local statList = {};
local PAPERDOLL_FRAME_EVENTS = {
"PLAYER_EQUIPMENT_CHANGED",
"MERCHANT_UPDATE",
"PLAYERBANKSLOTS_CHANGED",
"ITEM_LOCK_CHANGED",
"CURSOR_UPDATE",
"UPDATE_INVENTORY_ALERTS",
"AZERITE_ITEM_POWER_LEVEL_CHANGED",
"AZERITE_EMPOWERED_ITEM_SELECTION_UPDATED",
};
function OnLoad()
LoadStats(frame, "player")
end
function LoadStats(statFrame, unit)
SetHealth(statFrame, unit)
SetMana(statFrame, unit)
SetIntelligent(statFrame, unit)
SetStamina(statFrame, unit)
SetCrit(statFrame, unit)
SetHaste(statFrame, unit)
SetMastery(statFrame, unit)
SetVersatility(statFrame, unit)
end
-- GESUNDHEIT
function SetHealth(statFrame, unit)
if (not unit) then
unit = "player";
end
local health = UnitHealthMax(unit);
printToChat(string.format('GESUNDHEIT: %i', health));
end
-- MANA
function SetMana(statFrame, unit)
if (not unit) then
unit = "player";
end
local power = UnitPowerMax(unit) or 0;
printToChat(string.format('MANA: %i', power));
end
-- INTELLIGENZ
function SetIntelligent(statFrame, unit)
if (not unit) then
unit = "player";
end
local primaryStat = select(6, GetSpecializationInfo(GetSpecialization(), nil, nil, nil, UnitSex("player")));
local mainstat = UnitStat(unit,primaryStat);
printToChat(string.format('MAINSTAT: %i', mainstat));
end
-- AUSDAUER
function SetStamina(statFrame, unit)
if (not unit) then
unit = "player";
end
local stamina = UnitStat(unit,3);
printToChat(string.format('AUSDAUER: %i', stamina));
end
-- KRITISCHE TREFFERCHANCE
function SetCrit(statFrame, unit)
if (not unit) then
unit = "player";
end
local rating;
local spellCrit, rangedCrit, meleeCrit;
local critChance;
-- Start at 2 to skip physical damage
local holySchool = 2;
local minCrit = GetSpellCritChance(holySchool);
for i=(holySchool+1), MAX_SPELL_SCHOOLS do
spellCrit = GetSpellCritChance(i);
minCrit = min(minCrit, spellCrit);
end
spellCrit = minCrit
rangedCrit = GetRangedCritChance();
meleeCrit = GetCritChance();
if (spellCrit >= rangedCrit and spellCrit >= meleeCrit) then
critChance = spellCrit;
rating = CR_CRIT_SPELL;
elseif (rangedCrit >= meleeCrit) then
critChance = rangedCrit;
rating = CR_CRIT_RANGED;
else
critChance = meleeCrit;
rating = CR_CRIT_MELEE;
end
printToChat(string.format('KRITISCHE TREFFERCHANCE: %i', GetCombatRating(rating)));
end
-- TEMPO
function SetHaste(statFrame, unit)
if (not unit) then
unit = "player";
end
local haste = GetCombatRating(CR_HASTE_MELEE);
printToChat(string.format('TEMPO: %i', haste));
end
-- MEISTERSCHAFT
function SetMastery(statFrame, unit)
if (not unit) then
unit = "player";
end
local mastery = GetCombatRating(CR_MASTERY);
printToChat(string.format('MEISTERSCHAFT: %i', mastery));
end
-- VIELSEITIGKEIT
function SetVersatility(statFrame, unit)
if (not unit) then
unit = "player";
end
local versatility = GetCombatRating(CR_VERSATILITY_DAMAGE_DONE);
printToChat(string.format('VIELSEITIGKEIT: %i', versatility));
end
-- ############################################################################
-- Utillity
function printToChat(msg)
DEFAULT_CHAT_FRAME:AddMessage(GREEN_FONT_COLOR_CODE.."Debug: |r"..tostring(msg))
end