This repository has been archived by the owner on Feb 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser.lua
179 lines (154 loc) · 4.44 KB
/
parser.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
--[[===================
=== Parser ===
===================]]--
-- Parses the data
local addon, ns = ...
ns.parser = CreateFrame("Frame", "Parser", UIParent)
ns.parser:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
local function checkIfWatchedUnit(guid)
local unitType
if guid and guid ~= "" then
unitType = bit.band(tonumber("0x"..strsub(guid, 3,5)), 0x00f)
end
if unitType == 8 then
if not ns.guidDB.players[guid] then
return false
end
elseif unitType == 4 or unitType == 3 then
if not ns.guidDB.pets[guid] then
return false
end
else
return false
end
end
local function checkForPvPZone()
if select(2,IsInInstance()) == "pvp" or select(2,IsInInstance()) == "arena" then
return false
end
end
local function checkIfSolo()
if ns.solo_hide == true then
if not UnitInParty("player") or not UnitInRaid("player") then
return false
end
end
end
function ns.parser.COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17)
--==Exeptions==--
-- Only parse for watched units and pets
-- Do not parse in PvP-Zones
-- Optional: Disable parsing when no pet, or group/raidmembers are existant
if checkIfWatchedUnit(arg4) == false or checkForPvPZone() == false or checkIfSolo() == false then return end
if string.find(arg2, "_MISSED") then
if ns.activatedModules["Absorb"] == true then
if(string.find(arg2, "SWING")) then
ns.absorbFrame:Update(arg4, arg5, arg12, arg14)
end
if(string.find(arg2, "RANGE")) then
ns.absorbFrame:Update(arg4, arg5, arg15, arg17)
end
if(string.find(arg2, "SPELL")) then
ns.absorbFrame:Update(arg4, arg5, arg15, arg17)
end
if ns.wham.UpdateLayout then
ns.wham:UpdateLayout()
end
end
end
if string.find(arg2, "_HEAL") then
if ns.activatedModules["Heal"] == true then
ns.healFrame:Update(arg4, arg5, arg15, arg16)
if ns.wham.UpdateLayout then
ns.wham:UpdateLayout()
end
end
end
if string.find(arg2, "_DAMAGE") then
if(string.find(arg2, "SWING")) then
if arg13 == -1 then
arg13 = 0
end
if ns.activatedModules["Current Fight Data"] == true then
ns.curFrame:Update(arg4, arg5, arg12, arg13)
end
if ns.activatedModules["Damage"] == true then
ns.dmgFrame:Update(arg4, arg5, arg12, arg13)
end
if ns.activatedModules["Damage Taken"] == true then
ns.dmgTakenFrame:Update(arg4, arg5, arg9, arg12)
end
end
if(string.find(arg2, "RANGE")) then
if arg16 == -1 then
arg16 = 0
end
if ns.activatedModules["Current Fight Data"] == true then
ns.curFrame:Update(arg4, arg5, arg15, arg16)
end
if ns.activatedModules["Damage"] == true then
ns.dmgFrame:Update(arg4, arg5, arg15, arg16)
end
if ns.activatedModules["Damage Taken"] == true then
ns.dmgTakenFrame:Update(arg4, arg5, arg9, arg15)
end
end
if(string.find(arg2, "SPELL")) then
if arg16 == -1 then
arg16 = 0
end
if ns.activatedModules["Current Fight Data"] == true then
ns.curFrame:Update(arg4, arg5, arg15, arg16)
end
if ns.activatedModules["Damage"] == true then
ns.dmgFrame:Update(arg4, arg5, arg15, arg16)
end
if ns.activatedModules["Damage Taken"] == true then
ns.dmgTakenFrame:Update(arg4, arg5, arg9, arg15)
end
end
if(string.find(arg2, "ENVIRONMENTAL")) then
if ns.activatedModules["Damage Taken"] == true then
ns.dmgTakenFrame:Update(arg4, arg5, arg9, arg13)
end
end
if ns.wham.UpdateLayout then
if ns.activeMode == "Damage" or ns.activeMode == "Damage Taken" then
ns.wham:UpdateLayout()
end
end
end
if string.find(arg2, "UNIT_DIED") then
if ns.activatedModules["Deaths"] == true then
ns.deathFrame:Update(arg4, arg5)
if ns.wham.UpdateLayout then
ns.wham:UpdateLayout()
end
end
end
if string.find(arg2, "_DISPEL") then
if ns.activatedModules["Dispels"] == true then
--ns.spellname = arg13
ns.dispelFrame:Update(arg4, arg5)
if ns.wham.UpdateLayout then
ns.wham:UpdateLayout()
end
end
end
if string.find(arg2, "_INTERRUPT") then
if ns.activatedModules["Interrputs"] == true then
--ns.spellname = arg13
ns.interruptFrame:Update(arg4, arg5)
if ns.wham.UpdateLayout then
ns.wham:UpdateLayout()
end
end
end
end
ns.parser:SetScript("OnEvent", function(self, event, ...)
if(self[event]) then
self[event](self, event, ...)
else
print("Wham debug (Parsers): "..event)
end
end)