|
Tercio@0
|
1 local floor = floor
|
|
Tercio@0
|
2 local min = min
|
|
Tercio@0
|
3 local UnitExists = UnitExists
|
|
Tercio@0
|
4 local GetPlayerMapPosition = GetPlayerMapPosition
|
|
Tercio@0
|
5 local UnitHealth = UnitHealth
|
|
Tercio@4
|
6 local GetNumGroupMembers = GetNumGroupMembers
|
|
Tercio@4
|
7 local abs = abs
|
|
Tercio@6
|
8 local GetPlayerFacing = GetPlayerFacing
|
|
Tercio@0
|
9
|
|
Tercio@0
|
10 local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent)
|
|
Tercio@0
|
11 f:SetFrameStrata ("DIALOG")
|
|
Tercio@10
|
12 f.version = "v0.11"
|
|
Tercio@0
|
13
|
|
Tercio@4
|
14 local tframe = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_PTrack", UIParent)
|
|
Tercio@4
|
15
|
|
Tercio@0
|
16 f:SetSize (155, 156)
|
|
Tercio@0
|
17 f:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1},
|
|
Tercio@0
|
18 edgeFile = "Interface\\AddOns\\Hansgar_And_Franzok_Assist\\border_2", edgeSize = 8})
|
|
Tercio@7
|
19 f:SetPoint ("center", UIParent, "center", 300, 200)
|
|
Tercio@0
|
20 f:SetBackdropColor (0, 0, 0, 0)
|
|
Tercio@0
|
21 f:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@0
|
22 f:SetMovable (true)
|
|
Tercio@0
|
23 f:EnableMouse (true)
|
|
Tercio@5
|
24 f.all_blocks = {}
|
|
Tercio@0
|
25 f:Hide()
|
|
Tercio@0
|
26
|
|
Tercio@0
|
27 local title = f:CreateFontString (nil, "overlay", "GameFontNormal")
|
|
Tercio@0
|
28 title:SetText ("Hansgar & Franzok Assist")
|
|
Tercio@0
|
29 title:SetPoint ("center", f, "center")
|
|
Tercio@0
|
30 title:SetPoint ("bottom", f, "top", 0, 2)
|
|
Tercio@0
|
31
|
|
Tercio@0
|
32 --
|
|
Tercio@0
|
33 local frame_event = CreateFrame ("frame", "Hansgar_And_Franzok_AssistEvents", f)
|
|
Tercio@0
|
34 frame_event:RegisterEvent ("ENCOUNTER_START")
|
|
Tercio@0
|
35 frame_event:RegisterEvent ("ENCOUNTER_END")
|
|
Tercio@0
|
36 frame_event:RegisterEvent ("ADDON_LOADED")
|
|
Tercio@0
|
37
|
|
Tercio@0
|
38 --
|
|
Tercio@7
|
39 local player_bar = CreateFrame ("statusbar", "Hansgar_And_Franzok_PlayerAssistBar", UIParent)
|
|
Tercio@7
|
40
|
|
Tercio@7
|
41 --player_bar:SetPoint ("topleft", f, "bottomleft", 0, -3)
|
|
Tercio@7
|
42 --player_bar:SetPoint ("topright", f, "bottomright", 0, -3)
|
|
Tercio@7
|
43
|
|
Tercio@7
|
44 player_bar:SetPoint ("center", UIParent, "center", 0, 300)
|
|
Tercio@9
|
45 player_bar:SetSize (280, 16)
|
|
Tercio@7
|
46
|
|
Tercio@7
|
47 player_bar:SetMovable (true)
|
|
Tercio@7
|
48 player_bar:EnableMouse (true)
|
|
Tercio@7
|
49 player_bar:SetResizable (true)
|
|
Tercio@0
|
50 player_bar:SetStatusBarColor (0, 0, 0, 0)
|
|
Tercio@0
|
51 player_bar:SetMinMaxValues (0, 100)
|
|
Tercio@0
|
52 player_bar:SetValue (0)
|
|
Tercio@7
|
53 player_bar:SetMinResize (50, 15)
|
|
Tercio@7
|
54 player_bar:SetMaxResize (500, 40)
|
|
Tercio@7
|
55 player_bar:Hide()
|
|
Tercio@7
|
56
|
|
Tercio@7
|
57 local player_bar_backgroud = player_bar:CreateTexture (nil, "background")
|
|
Tercio@7
|
58 player_bar_backgroud:SetTexture (0, 0, 0, 0.2)
|
|
Tercio@7
|
59 player_bar_backgroud:SetAllPoints()
|
|
Tercio@7
|
60
|
|
Tercio@7
|
61 local icon = player_bar:CreateTexture (nil, "overlay")
|
|
Tercio@7
|
62 icon:SetTexture ([[Interface\HELPFRAME\ReportLagIcon-Movement]])
|
|
Tercio@7
|
63 icon:SetPoint ("left", player_bar, "left")
|
|
Tercio@7
|
64 icon:SetDesaturated (true)
|
|
Tercio@7
|
65 player_bar.icon = icon
|
|
Tercio@7
|
66
|
|
Tercio@7
|
67 local text = player_bar:CreateFontString (nil, "overlay", "GameFontNormal")
|
|
Tercio@7
|
68 text:SetPoint ("right", player_bar, "right", -2, 0)
|
|
Tercio@7
|
69 player_bar.text = text
|
|
Tercio@7
|
70
|
|
Tercio@7
|
71 player_bar:SetScript ("OnMouseDown", function (self)
|
|
Tercio@7
|
72 if (not self.isMoving) then
|
|
Tercio@7
|
73 self:StartMoving()
|
|
Tercio@7
|
74 self.isMoving = true
|
|
Tercio@7
|
75 end
|
|
Tercio@7
|
76 end)
|
|
Tercio@7
|
77 player_bar:SetScript ("OnMouseUp", function (self)
|
|
Tercio@7
|
78 if (self.isMoving) then
|
|
Tercio@7
|
79 self:StopMovingOrSizing()
|
|
Tercio@7
|
80 self.isMoving = false
|
|
Tercio@7
|
81 end
|
|
Tercio@7
|
82 end)
|
|
Tercio@7
|
83 player_bar:SetScript ("OnSizeChanged", function (self)
|
|
Tercio@7
|
84 self.icon:SetSize (self:GetHeight(), self:GetHeight())
|
|
Tercio@7
|
85
|
|
Tercio@7
|
86 end)
|
|
Tercio@7
|
87 local grip = CreateFrame ("button", "Hansgar_And_Franzok_AssistPlayerBarButton", player_bar)
|
|
Tercio@7
|
88 grip:SetPoint ("bottomright", player_bar, "bottomright")
|
|
Tercio@7
|
89 grip:SetSize (16, 16)
|
|
Tercio@7
|
90 grip:SetScript ("OnMouseDown", function (self, button)
|
|
Tercio@7
|
91 if (not player_bar.isMoving and button == "LeftButton") then
|
|
Tercio@7
|
92 player_bar:StartSizing ("bottomright")
|
|
Tercio@7
|
93 player_bar.isMoving = true
|
|
Tercio@7
|
94 end
|
|
Tercio@7
|
95 end)
|
|
Tercio@7
|
96 grip:SetScript ("OnMouseUp", function (self, button)
|
|
Tercio@7
|
97 if (player_bar.isMoving and button == "LeftButton") then
|
|
Tercio@7
|
98 player_bar:StopMovingOrSizing()
|
|
Tercio@7
|
99 player_bar.isMoving = false
|
|
Tercio@7
|
100 end
|
|
Tercio@7
|
101 end)
|
|
Tercio@7
|
102 grip:SetNormalTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Up]])
|
|
Tercio@7
|
103 grip:SetHighlightTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Highlight]])
|
|
Tercio@7
|
104 grip:SetPushedTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]])
|
|
Tercio@7
|
105
|
|
Tercio@7
|
106 player_bar.grip = grip
|
|
Tercio@0
|
107 f.player_bar = player_bar
|
|
Tercio@0
|
108
|
|
Tercio@7
|
109
|
|
Tercio@0
|
110 player_bar.texture = player_bar:CreateTexture (nil, "overlay")
|
|
Tercio@0
|
111 player_bar.texture:SetTexture ("Interface\\AddOns\\Hansgar_And_Franzok_Assist\\bar_skyline")
|
|
Tercio@0
|
112 player_bar:SetStatusBarTexture (player_bar.texture)
|
|
Tercio@0
|
113
|
|
Tercio@0
|
114 --
|
|
Tercio@0
|
115
|
|
Tercio@7
|
116 local player_pos_frame = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_BarDance", UIParent)
|
|
Tercio@7
|
117 --player_pos_frame:SetPoint ("topleft", player_bar, "bottomleft", 0, -3)
|
|
Tercio@7
|
118 --player_pos_frame:SetPoint ("topright", player_bar, "bottomright", 0, -3)
|
|
Tercio@7
|
119
|
|
Tercio@7
|
120 player_pos_frame:SetPoint ("center", UIParent, "center", 0, -75)
|
|
Tercio@7
|
121
|
|
Tercio@7
|
122 player_pos_frame:SetSize (155, 6)
|
|
Tercio@9
|
123 player_pos_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}})
|
|
Tercio@9
|
124 player_pos_frame:SetBackdropColor (0, 0, 0, 1)
|
|
Tercio@7
|
125 player_pos_frame:SetMovable (true)
|
|
Tercio@7
|
126 player_pos_frame:EnableMouse (true)
|
|
Tercio@7
|
127 player_pos_frame:SetScript ("OnMouseDown", function (self)
|
|
Tercio@7
|
128 if (not self.isMoving) then
|
|
Tercio@7
|
129 self:StartMoving()
|
|
Tercio@7
|
130 self.isMoving = true
|
|
Tercio@7
|
131 end
|
|
Tercio@7
|
132 end)
|
|
Tercio@7
|
133 player_pos_frame:SetScript ("OnMouseUp", function (self)
|
|
Tercio@7
|
134 if (self.isMoving) then
|
|
Tercio@7
|
135 self:StopMovingOrSizing()
|
|
Tercio@7
|
136 self.isMoving = false
|
|
Tercio@7
|
137 end
|
|
Tercio@7
|
138 end)
|
|
Tercio@4
|
139 player_pos_frame:Hide()
|
|
Tercio@4
|
140
|
|
Tercio@4
|
141 --red
|
|
Tercio@4
|
142 local t1 = player_pos_frame:CreateTexture (nil, "artwork")
|
|
Tercio@4
|
143 t1:SetPoint ("left", player_pos_frame, "left")
|
|
Tercio@7
|
144 t1:SetSize (player_pos_frame:GetWidth()*0.30, 6)
|
|
Tercio@4
|
145 t1:SetTexture (1, 1, 1)
|
|
Tercio@4
|
146 --t1:SetTexCoord (260/512, 430/512, 29/256, 82/256)
|
|
Tercio@4
|
147 t1:SetVertexColor (1, 0.2, 0.2, 0.4)
|
|
Tercio@4
|
148
|
|
Tercio@4
|
149 --green
|
|
Tercio@4
|
150 local t2 = player_pos_frame:CreateTexture (nil, "artwork")
|
|
Tercio@4
|
151 t2:SetPoint ("left", t1, "right")
|
|
Tercio@7
|
152 t2:SetSize (player_pos_frame:GetWidth()*0.15, 6)
|
|
Tercio@4
|
153 t2:SetTexture (0.2, 1, 0.2, 0.4)
|
|
Tercio@4
|
154
|
|
Tercio@4
|
155 --red
|
|
Tercio@4
|
156 local middle = player_pos_frame:CreateTexture (nil, "artwork")
|
|
Tercio@4
|
157 middle:SetPoint ("left", t2, "right")
|
|
Tercio@7
|
158 middle:SetSize (player_pos_frame:GetWidth()*0.10, 6)
|
|
Tercio@4
|
159 middle:SetTexture (1, 1, 1)
|
|
Tercio@4
|
160 --middle:SetTexCoord (260/512, 430/512, 29/256, 82/256)
|
|
Tercio@4
|
161 middle:SetVertexColor (1, 0.2, 0.2, 0.4)
|
|
Tercio@4
|
162
|
|
Tercio@4
|
163 --green
|
|
Tercio@4
|
164 local t3 = player_pos_frame:CreateTexture (nil, "artwork")
|
|
Tercio@4
|
165 t3:SetPoint ("left", middle, "right")
|
|
Tercio@7
|
166 t3:SetSize (player_pos_frame:GetWidth()*0.15, 6)
|
|
Tercio@4
|
167 t3:SetTexture (0.2, 1, 0.2, 0.4)
|
|
Tercio@4
|
168
|
|
Tercio@4
|
169 --red
|
|
Tercio@4
|
170 local t4 = player_pos_frame:CreateTexture (nil, "artwork")
|
|
Tercio@4
|
171 t4:SetPoint ("left", t3, "right")
|
|
Tercio@7
|
172 t4:SetSize (player_pos_frame:GetWidth()*0.30, 6)
|
|
Tercio@4
|
173 t4:SetTexture (1, 1, 1)
|
|
Tercio@4
|
174 --t4:SetTexCoord (260/512, 430/512, 29/256, 82/256)
|
|
Tercio@4
|
175 t4:SetVertexColor (1, 0.2, 0.2, 0.4)
|
|
Tercio@4
|
176
|
|
Tercio@4
|
177 local div = player_pos_frame:CreateTexture (nil, "overlay")
|
|
Tercio@4
|
178 div:SetPoint ("left", player_pos_frame, "left", 0, 0)
|
|
Tercio@4
|
179 div:SetTexture (1, 1, 1, 1)
|
|
Tercio@4
|
180 div:SetSize (1, 16)
|
|
Tercio@4
|
181 div:Hide()
|
|
Tercio@4
|
182 --
|
|
Tercio@4
|
183
|
|
Tercio@4
|
184 local AceTimer = LibStub:GetLibrary ("AceTimer-3.0")
|
|
Tercio@4
|
185 AceTimer:Embed (f)
|
|
Tercio@4
|
186 local AceComm = LibStub:GetLibrary ("AceComm-3.0")
|
|
Tercio@4
|
187 AceComm:Embed (f)
|
|
Tercio@4
|
188
|
|
Tercio@5
|
189 function f:CommReceived (_, data, _, source)
|
|
Tercio@5
|
190 if (data == "US") then
|
|
Tercio@5
|
191 f:SendCommMessage ("HAFR", UnitName ("player") .. " " .. f.version, "RAID")
|
|
Tercio@6
|
192 elseif (f.users) then
|
|
Tercio@5
|
193 f.users [data] = true
|
|
Tercio@5
|
194 end
|
|
Tercio@5
|
195 end
|
|
Tercio@5
|
196 function f:ShowUsers()
|
|
Tercio@5
|
197
|
|
Tercio@5
|
198 local users_frame = Hansgar_And_Franzok_Assist_UsersPanel
|
|
Tercio@5
|
199 if (not users_frame) then
|
|
Tercio@5
|
200 users_frame = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_UsersPanel", UIParent)
|
|
Tercio@5
|
201 users_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1},
|
|
Tercio@5
|
202 edgeFile = "Interface\\AddOns\\Hansgar_And_Franzok_Assist\\border_2", edgeSize = 8})
|
|
Tercio@5
|
203 users_frame:SetBackdropColor (0, 0, 0, 1)
|
|
Tercio@5
|
204 tinsert (UISpecialFrames, "Hansgar_And_Franzok_Assist_UsersPanel")
|
|
Tercio@5
|
205 users_frame:SetSize (200, 500)
|
|
Tercio@5
|
206 users_frame:SetPoint ("right", f, "left", -15, 0)
|
|
Tercio@5
|
207 users_frame.text = users_frame:CreateFontString (nil, "overlay", "GameFontHighlight")
|
|
Tercio@5
|
208 users_frame.text:SetPoint ("topleft", users_frame, "topleft", 10, -10)
|
|
Tercio@5
|
209 users_frame.text:SetJustifyH ("left")
|
|
Tercio@5
|
210
|
|
Tercio@5
|
211 users_frame.title = users_frame:CreateFontString (nil, "overlay", "GameFontNormal")
|
|
Tercio@5
|
212 users_frame.title:SetText ("Hansgar & Franzok Assist: Users")
|
|
Tercio@5
|
213 users_frame.title:SetPoint ("center", users_frame, "center")
|
|
Tercio@5
|
214 users_frame.title:SetPoint ("bottom", users_frame, "top", 0, 2)
|
|
Tercio@5
|
215
|
|
Tercio@5
|
216 end
|
|
Tercio@5
|
217
|
|
Tercio@5
|
218 local s = ""
|
|
Tercio@5
|
219
|
|
Tercio@5
|
220 for key, value in pairs (f.users) do
|
|
Tercio@5
|
221 s = s .. "|cFF33FF33" .. key .. "\n"
|
|
Tercio@5
|
222 end
|
|
Tercio@5
|
223
|
|
Tercio@5
|
224 s = s .. "|r\n\n\n|cFFFFFFFFOut of Date or Not installed:|r\n\n"
|
|
Tercio@5
|
225
|
|
Tercio@5
|
226 for i = 1, GetNumGroupMembers() do
|
|
Tercio@5
|
227 local name = UnitName ("raid" .. i)
|
|
Tercio@5
|
228 if (not s:find (name)) then
|
|
Tercio@5
|
229 s = s .. "|cFFFF3333" .. name .. "|r\n"
|
|
Tercio@5
|
230 end
|
|
Tercio@5
|
231 end
|
|
Tercio@5
|
232
|
|
Tercio@5
|
233 users_frame.text:SetText (s)
|
|
Tercio@5
|
234
|
|
Tercio@5
|
235 users_frame:Show()
|
|
Tercio@6
|
236
|
|
Tercio@6
|
237 f.users = nil
|
|
Tercio@6
|
238 f.users_schedule = nil
|
|
Tercio@5
|
239
|
|
Tercio@5
|
240 end
|
|
Tercio@5
|
241 f:RegisterComm ("HAFR", "CommReceived")
|
|
Tercio@5
|
242
|
|
Tercio@0
|
243 local db
|
|
Tercio@0
|
244
|
|
Tercio@4
|
245 f.block_tracker = {}
|
|
Tercio@4
|
246
|
|
Tercio@0
|
247 frame_event:SetFrameStrata ("FULLSCREEN")
|
|
Tercio@0
|
248
|
|
Tercio@0
|
249 frame_event:SetScript ("OnEvent", function (self, event, ...)
|
|
Tercio@0
|
250
|
|
Tercio@0
|
251 if (event == "ADDON_LOADED" and select (1, ...) == "Hansgar_And_Franzok_Assist") then
|
|
Tercio@0
|
252
|
|
Tercio@0
|
253 db = Hansgar_And_Franzok_DB
|
|
Tercio@0
|
254 if (not db) then
|
|
Tercio@0
|
255 db = {}
|
|
Tercio@0
|
256 Hansgar_And_Franzok_DB = db
|
|
Tercio@0
|
257 end
|
|
Tercio@4
|
258 --
|
|
Tercio@0
|
259 db.STAMPERS_DELAY = db.STAMPERS_DELAY or 5
|
|
Tercio@4
|
260 if (db.CD_NUMBER == nil) then
|
|
Tercio@4
|
261 db.CD_NUMBER = false
|
|
Tercio@4
|
262 end
|
|
Tercio@4
|
263 if (db.SHOW_DANCE == nil) then
|
|
Tercio@4
|
264 db.SHOW_DANCE = true
|
|
Tercio@4
|
265 end
|
|
Tercio@5
|
266 if (db.FRAME_LOCK == nil) then
|
|
Tercio@5
|
267 db.FRAME_LOCK = false
|
|
Tercio@5
|
268 end
|
|
Tercio@6
|
269 if (db.AUTO_FACING == nil) then
|
|
Tercio@6
|
270 db.AUTO_FACING = true
|
|
Tercio@6
|
271 end
|
|
Tercio@6
|
272 if (db.FACING_SIDE == nil) then
|
|
Tercio@6
|
273 db.FACING_SIDE = 1
|
|
Tercio@6
|
274 end
|
|
Tercio@7
|
275 if (db.SHOW_MAIN_FRAME == nil) then
|
|
Tercio@7
|
276 db.SHOW_MAIN_FRAME = true
|
|
Tercio@7
|
277 end
|
|
Tercio@7
|
278 if (db.PLAY_SOUND == nil) then
|
|
Tercio@7
|
279 db.PLAY_SOUND = false
|
|
Tercio@7
|
280 end
|
|
Tercio@9
|
281 if (db.STOP_CAST == nil) then
|
|
Tercio@9
|
282 db.STOP_CAST = true
|
|
Tercio@9
|
283 end
|
|
Tercio@4
|
284 --
|
|
Tercio@7
|
285
|
|
Tercio@7
|
286 f:SetLockState (true)
|
|
Tercio@7
|
287
|
|
Tercio@0
|
288 elseif (event == "ENCOUNTER_START" or event == "ENCOUNTER_END") then
|
|
Tercio@0
|
289
|
|
Tercio@0
|
290 local encounterID, encounterName, difficultyID, raidSize = select (1, ...)
|
|
Tercio@4
|
291
|
|
Tercio@4
|
292 if (encounterID == 1693) then
|
|
Tercio@9
|
293 if (f.unlocked_frame) then
|
|
Tercio@9
|
294 f.unlocked_frame = false
|
|
Tercio@9
|
295 end
|
|
Tercio@9
|
296
|
|
Tercio@4
|
297 if (event == "ENCOUNTER_START") then
|
|
Tercio@4
|
298 f.on_encounter = true
|
|
Tercio@9
|
299 f:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
|
|
Tercio@9
|
300
|
|
Tercio@4
|
301 elseif (event == "ENCOUNTER_END") then
|
|
Tercio@4
|
302 f.on_encounter = false
|
|
Tercio@9
|
303 f:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
|
|
Tercio@4
|
304 end
|
|
Tercio@4
|
305 end
|
|
Tercio@4
|
306
|
|
Tercio@4
|
307 if (encounterID == 1693 and db.SHOW_DANCE) then
|
|
Tercio@4
|
308 if (event == "ENCOUNTER_START") then
|
|
Tercio@4
|
309 SetMapToCurrentZone()
|
|
Tercio@4
|
310 f:StartTrackPlayerPosition()
|
|
Tercio@4
|
311 elseif (event == "ENCOUNTER_END") then
|
|
Tercio@4
|
312 f:EndTrackPlayerPosition()
|
|
Tercio@4
|
313 end
|
|
Tercio@4
|
314 end
|
|
Tercio@4
|
315
|
|
Tercio@0
|
316 if (encounterID == 1693 and difficultyID == 16) then
|
|
Tercio@0
|
317
|
|
Tercio@0
|
318 if (event == "ENCOUNTER_START") then
|
|
Tercio@0
|
319 print ("|cFFFFAA00Hansgar and Franzok Assist|r: addon enabled, good look!")
|
|
Tercio@0
|
320
|
|
Tercio@0
|
321 if (f.StampersPhase) then
|
|
Tercio@0
|
322 f:StopTracking()
|
|
Tercio@0
|
323 end
|
|
Tercio@0
|
324
|
|
Tercio@0
|
325 elseif (event == "ENCOUNTER_END") then
|
|
Tercio@0
|
326 if (f.StampersPhase) then
|
|
Tercio@0
|
327 f:StopTracking()
|
|
Tercio@0
|
328 end
|
|
Tercio@4
|
329
|
|
Tercio@4
|
330 f:EndTrackPlayerPosition()
|
|
Tercio@0
|
331 end
|
|
Tercio@0
|
332 end
|
|
Tercio@0
|
333 end
|
|
Tercio@0
|
334
|
|
Tercio@0
|
335 end)
|
|
Tercio@0
|
336
|
|
Tercio@6
|
337 SLASH_Hansgar_And_Franzok_Assist1, SLASH_Hansgar_And_Franzok_Assist2 = "/hansgar", "/franzok"
|
|
Tercio@6
|
338 function SlashCmdList.Hansgar_And_Franzok_Assist (msg, editbox)
|
|
Tercio@6
|
339
|
|
Tercio@6
|
340 local command, rest = msg:match ("^(%S*)%s*(.-)$")
|
|
Tercio@6
|
341
|
|
Tercio@6
|
342 if (command == "users") then
|
|
Tercio@6
|
343 if (f.users_schedule) then
|
|
Tercio@6
|
344 print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...")
|
|
Tercio@6
|
345 elseif (IsInRaid()) then
|
|
Tercio@6
|
346 f.users = {}
|
|
Tercio@6
|
347 f:SendCommMessage ("HAFR", "US", "RAID")
|
|
Tercio@6
|
348 f.users_schedule = f:ScheduleTimer ("ShowUsers", 5)
|
|
Tercio@6
|
349 print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...")
|
|
Tercio@6
|
350 else
|
|
Tercio@6
|
351 print ("|cFFFFAA00Hansgar and Franzok Assist|r you aren't in a raid group.")
|
|
Tercio@6
|
352 end
|
|
Tercio@6
|
353
|
|
Tercio@10
|
354 elseif (command == "st") then
|
|
Tercio@10
|
355 f.stop_casting_frame:Show()
|
|
Tercio@10
|
356 f.stop_casting_frame.alert.animOut:Stop()
|
|
Tercio@10
|
357 f.stop_casting_frame.alert.animIn:Play()
|
|
Tercio@10
|
358 f:ScheduleTimer ("HideStopSpellAlert", 1.2)
|
|
Tercio@10
|
359
|
|
Tercio@9
|
360 elseif (command == "stopcast") then
|
|
Tercio@9
|
361 db.STOP_CAST = not db.STOP_CAST
|
|
Tercio@9
|
362
|
|
Tercio@9
|
363 if (db.STOP_CAST) then
|
|
Tercio@9
|
364 print ("|cFFFFAA00Hansgar and Franzok Assist|r stop cast alert enabled.")
|
|
Tercio@9
|
365 else
|
|
Tercio@9
|
366 print ("|cFFFFAA00Hansgar and Franzok Assist|r stop cast alert disabled.")
|
|
Tercio@9
|
367 end
|
|
Tercio@9
|
368
|
|
Tercio@9
|
369 elseif (command == "resetpos") then
|
|
Tercio@9
|
370 f:ClearAllPoints()
|
|
Tercio@9
|
371 f:SetPoint ("center", UIParent, "center")
|
|
Tercio@9
|
372
|
|
Tercio@9
|
373 player_bar:ClearAllPoints()
|
|
Tercio@9
|
374 player_bar:SetPoint ("center", UIParent, "center")
|
|
Tercio@9
|
375
|
|
Tercio@9
|
376 player_pos_frame:ClearAllPoints()
|
|
Tercio@9
|
377 player_pos_frame:SetPoint ("center", UIParent, "center")
|
|
Tercio@9
|
378
|
|
Tercio@9
|
379 if (f.StampersPhase) then
|
|
Tercio@9
|
380 f:EndTrackPlayerPosition()
|
|
Tercio@9
|
381 f:StopTracking()
|
|
Tercio@9
|
382 end
|
|
Tercio@9
|
383
|
|
Tercio@9
|
384 db.FRAME_LOCK = true
|
|
Tercio@9
|
385 f:SetLockState()
|
|
Tercio@9
|
386
|
|
Tercio@9
|
387 f.unlocked_frame = true
|
|
Tercio@9
|
388
|
|
Tercio@9
|
389 f:StartTracking()
|
|
Tercio@9
|
390 f:StartTrackPlayerPosition()
|
|
Tercio@9
|
391
|
|
Tercio@9
|
392 print ("|cFFFFAA00Hansgar and Franzok Assist|r: position reseted.")
|
|
Tercio@9
|
393 print ("|cFFFFAA00Hansgar and Franzok Assist|r: move between the tracks to show the other frames.")
|
|
Tercio@9
|
394 print ("|cFFFFAA00Hansgar and Franzok Assist|r: type '/hansgar lock' to lock the frames.")
|
|
Tercio@9
|
395
|
|
Tercio@6
|
396 elseif (command == "delay") then
|
|
Tercio@6
|
397 local t = tonumber (rest)
|
|
Tercio@6
|
398 if (t) then
|
|
Tercio@6
|
399 db.STAMPERS_DELAY = t
|
|
Tercio@6
|
400 print ("|cFFFFAA00Hansgar and Franzok Assist|r delay set to: ", t)
|
|
Tercio@6
|
401 else
|
|
Tercio@6
|
402 print ("|cFFFFAA00Hansgar and Franzok Assist|r invalid time.", t)
|
|
Tercio@6
|
403 end
|
|
Tercio@6
|
404
|
|
Tercio@6
|
405 elseif (command == "test" or command == "show") then
|
|
Tercio@6
|
406 if (f.StampersPhase) then
|
|
Tercio@6
|
407 f:EndTrackPlayerPosition()
|
|
Tercio@6
|
408 return f:StopTracking()
|
|
Tercio@6
|
409 end
|
|
Tercio@6
|
410
|
|
Tercio@6
|
411 f:StartTracking()
|
|
Tercio@6
|
412 f:StartTrackPlayerPosition()
|
|
Tercio@6
|
413
|
|
Tercio@6
|
414 elseif (command == "hide") then
|
|
Tercio@6
|
415 if (f.StampersPhase) then
|
|
Tercio@6
|
416 return f:StopTracking()
|
|
Tercio@6
|
417 end
|
|
Tercio@6
|
418 f:EndTrackPlayerPosition()
|
|
Tercio@6
|
419
|
|
Tercio@7
|
420 elseif (command == "unlock") then
|
|
Tercio@7
|
421 db.FRAME_LOCK = true
|
|
Tercio@7
|
422 f:SetLockState()
|
|
Tercio@7
|
423 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.")
|
|
Tercio@9
|
424
|
|
Tercio@9
|
425 f.unlocked_frame = true
|
|
Tercio@9
|
426 player_pos_frame:Show()
|
|
Tercio@9
|
427 player_bar:Show()
|
|
Tercio@10
|
428 f.stop_casting_frame:Show()
|
|
Tercio@7
|
429
|
|
Tercio@6
|
430 elseif (command == "lock") then
|
|
Tercio@6
|
431 f:SetLockState()
|
|
Tercio@6
|
432
|
|
Tercio@6
|
433 if (db.FRAME_LOCK) then
|
|
Tercio@6
|
434 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.")
|
|
Tercio@9
|
435 f.unlocked_frame = false
|
|
Tercio@10
|
436 f.stop_casting_frame:Hide()
|
|
Tercio@6
|
437 else
|
|
Tercio@6
|
438 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.")
|
|
Tercio@9
|
439
|
|
Tercio@9
|
440 f.unlocked_frame = true
|
|
Tercio@9
|
441 player_pos_frame:Show()
|
|
Tercio@9
|
442 player_bar:Show()
|
|
Tercio@10
|
443 f.stop_casting_frame:Show()
|
|
Tercio@9
|
444
|
|
Tercio@6
|
445 end
|
|
Tercio@6
|
446
|
|
Tercio@6
|
447 elseif (command == "facing") then
|
|
Tercio@6
|
448 if (rest == "1") then
|
|
Tercio@6
|
449 db.FACING_SIDE = 1
|
|
Tercio@6
|
450 tframe.facing = true
|
|
Tercio@6
|
451 print ("|cFFFFAA00Hansgar and Franzok Assist|r facing set to south.")
|
|
Tercio@6
|
452
|
|
Tercio@6
|
453 elseif (rest == "2") then
|
|
Tercio@6
|
454 db.FACING_SIDE = 2
|
|
Tercio@6
|
455 tframe.facing = false
|
|
Tercio@6
|
456 print ("|cFFFFAA00Hansgar and Franzok Assist|r facing set to north.")
|
|
Tercio@6
|
457
|
|
Tercio@6
|
458 elseif (rest == "auto") then
|
|
Tercio@6
|
459 db.AUTO_FACING = true
|
|
Tercio@6
|
460 print ("|cFFFFAA00Hansgar and Franzok Assist|r auto facing enabled.")
|
|
Tercio@6
|
461
|
|
Tercio@6
|
462 else
|
|
Tercio@6
|
463 print ("|cFFFFFF00/hansgar facing|r: |cFF00FF001|r = south |cFF00FF002|r = north, use to set the dance bar when auto facing is disabled.")
|
|
Tercio@6
|
464 end
|
|
Tercio@6
|
465
|
|
Tercio@6
|
466 elseif (command == "autofacing") then
|
|
Tercio@6
|
467 db.AUTO_FACING = not db.AUTO_FACING
|
|
Tercio@6
|
468 if (db.AUTO_FACING) then
|
|
Tercio@6
|
469 print ("|cFFFFAA00Hansgar and Franzok Assist|r auto facing enabled.")
|
|
Tercio@6
|
470 else
|
|
Tercio@6
|
471 print ("|cFFFFAA00Hansgar and Franzok Assist|r auto facing disabled.")
|
|
Tercio@6
|
472 tframe.facing = db.FACING_SIDE == 1
|
|
Tercio@6
|
473 end
|
|
Tercio@6
|
474
|
|
Tercio@6
|
475 elseif (command == "dance") then
|
|
Tercio@6
|
476 db.SHOW_DANCE = not db.SHOW_DANCE
|
|
Tercio@6
|
477 if (db.SHOW_DANCE) then
|
|
Tercio@6
|
478 if (f.on_encounter) then
|
|
Tercio@6
|
479 f:StartTrackPlayerPosition()
|
|
Tercio@6
|
480 end
|
|
Tercio@6
|
481 print ("|cFFFFAA00Hansgar and Franzok Assist|r dance bars enabled.")
|
|
Tercio@6
|
482 else
|
|
Tercio@6
|
483 f:EndTrackPlayerPosition()
|
|
Tercio@6
|
484 print ("|cFFFFAA00Hansgar and Franzok Assist|r dance bars disabled.")
|
|
Tercio@6
|
485 end
|
|
Tercio@6
|
486
|
|
Tercio@6
|
487 elseif (command == "cooldown") then
|
|
Tercio@6
|
488 db.CD_NUMBER = not db.CD_NUMBER
|
|
Tercio@6
|
489 f:RefreshCooldownSettings()
|
|
Tercio@6
|
490
|
|
Tercio@6
|
491 else
|
|
Tercio@6
|
492 print ("|cFFFFAA00Hansgar and Franzok Assist|r |cFF00FF00" .. f.version .. "|r Commands:")
|
|
Tercio@9
|
493 print ("|cFFFFFF00/hansgar resetpos|r: reset the position of all frames.")
|
|
Tercio@6
|
494 print ("|cFFFFFF00/hansgar lock|r: toggle lock and unlock on the frame.")
|
|
Tercio@6
|
495 print ("|cFFFFFF00/hansgar test show hide|r: active the addon on test mode or hide it.")
|
|
Tercio@6
|
496 print ("|cFFFFFF00/hansgar delay <time>|r: time in seconds until the percentage goes from 0 to 100.")
|
|
Tercio@6
|
497 print ("|cFFFFFF00/hansgar dance|r: toggle dance bar (used to dodge regular stampers and searing plates).")
|
|
Tercio@6
|
498 print ("|cFFFFFF00/hansgar autofacing|r: toggle if the dance bar auto switch left and right when looking to north or south.")
|
|
Tercio@6
|
499 print ("|cFFFFFF00/hansgar facing|r: |cFF00FF001|r = south |cFF00FF002|r = north, use to set the dance bar when auto facing is disabled.")
|
|
Tercio@6
|
500 print ("|cFFFFFF00/hansgar users|r: show who is using the addon in the raid.")
|
|
Tercio@6
|
501 print ("|cFFFFFF00/hansgar cooldown|r: show the countdown text for each stamper go back up to the ceiling.")
|
|
Tercio@9
|
502 print ("|cFFFFFF00/hansgar stopcast|r: show the alert to stop casting for Disrupting Roar.")
|
|
Tercio@6
|
503 end
|
|
Tercio@6
|
504 end
|
|
Tercio@6
|
505
|
|
Tercio@0
|
506 --
|
|
Tercio@0
|
507
|
|
Tercio@10
|
508 local stop_casting_frame = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCasting", UIParent)
|
|
Tercio@9
|
509 stop_casting_frame:SetSize (200, 30)
|
|
Tercio@9
|
510 stop_casting_frame:SetPoint ("center", UIParent, "center", 0, 75)
|
|
Tercio@9
|
511 stop_casting_frame:SetFrameStrata ("FULLSCREEN")
|
|
Tercio@10
|
512 f.stop_casting_frame = stop_casting_frame
|
|
Tercio@9
|
513 stop_casting_frame:Hide()
|
|
Tercio@10
|
514
|
|
Tercio@10
|
515 stop_casting_frame:SetMovable (false)
|
|
Tercio@10
|
516 stop_casting_frame:EnableMouse (false)
|
|
Tercio@10
|
517
|
|
Tercio@10
|
518 stop_casting_frame:SetScript ("OnMouseDown", function (self)
|
|
Tercio@10
|
519 if (not self.isMoving) then
|
|
Tercio@10
|
520 self:StartMoving()
|
|
Tercio@10
|
521 self.isMoving = true
|
|
Tercio@10
|
522 end
|
|
Tercio@9
|
523 end)
|
|
Tercio@10
|
524 stop_casting_frame:SetScript ("OnMouseUp", function (self)
|
|
Tercio@10
|
525 if (self.isMoving) then
|
|
Tercio@10
|
526 self:StopMovingOrSizing()
|
|
Tercio@10
|
527 self.isMoving = false
|
|
Tercio@10
|
528 end
|
|
Tercio@9
|
529 end)
|
|
Tercio@9
|
530
|
|
Tercio@10
|
531 local alert = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCastingAlert", stop_casting_frame, "ActionBarButtonSpellActivationAlert")
|
|
Tercio@10
|
532 alert:SetPoint ("topleft", stop_casting_frame, "topleft", -10, 2)
|
|
Tercio@10
|
533 alert:SetPoint ("bottomright", stop_casting_frame, "bottomright", 10, -2)
|
|
Tercio@10
|
534 stop_casting_frame.alert = alert
|
|
Tercio@10
|
535
|
|
Tercio@9
|
536 local text = stop_casting_frame:CreateFontString (nil, "overlay", "GameFontNormal")
|
|
Tercio@9
|
537 text:SetText ("STOP CASTING!")
|
|
Tercio@9
|
538 text:SetPoint ("center", stop_casting_frame, "center")
|
|
Tercio@9
|
539
|
|
Tercio@9
|
540 stop_casting_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
|
|
Tercio@10
|
541 stop_casting_frame:SetBackdropColor (0, 0, 0, 0.3)
|
|
Tercio@9
|
542
|
|
Tercio@10
|
543 function f:HideStopSpellAlert2()
|
|
Tercio@10
|
544 stop_casting_frame.alert.animOut:Stop()
|
|
Tercio@10
|
545 stop_casting_frame:Hide()
|
|
Tercio@10
|
546 end
|
|
Tercio@9
|
547 function f:HideStopSpellAlert()
|
|
Tercio@10
|
548 stop_casting_frame.alert.animIn:Stop()
|
|
Tercio@10
|
549 stop_casting_frame.alert.animOut:Play()
|
|
Tercio@10
|
550 f:ScheduleTimer ("HideStopSpellAlert2", 0.3)
|
|
Tercio@9
|
551 end
|
|
Tercio@9
|
552
|
|
Tercio@9
|
553 --3/22 13:44:48.995 SPELL_INTERRUPT,Vehicle-0-3132-1205-24243-76974-00000EF077,"Franzok",0x10a48,0x0,Player-00-063,"Grubdruid",0x514,0x0,160838,"Disrupting Roar",0x1,5185,"Healing Touch",8
|
|
Tercio@9
|
554
|
|
Tercio@9
|
555 f:SetScript ("OnEvent", function (self, event, time, token, _, who_serial, who_name, who_flags, _, target_serial, target_name, target_flags, _, spellid, spellname, spellschool, buff_type, buff_name)
|
|
Tercio@0
|
556
|
|
Tercio@2
|
557 if (token == "SPELL_AURA_APPLIED" and spellid == 162124 and not f.StampersPhase) then
|
|
Tercio@0
|
558 f:StartTracking()
|
|
Tercio@5
|
559 f:EndTrackPlayerPosition()
|
|
Tercio@0
|
560
|
|
Tercio@2
|
561 elseif (token == "SPELL_AURA_REMOVED" and spellid == 162124 and f.StampersPhase) then
|
|
Tercio@0
|
562 f:StopTracking()
|
|
Tercio@5
|
563 if (db.SHOW_DANCE) then
|
|
Tercio@5
|
564 f:StartTrackPlayerPosition()
|
|
Tercio@5
|
565 end
|
|
Tercio@0
|
566
|
|
Tercio@9
|
567 elseif (token == "SPELL_CAST_START" and spellid == 160838 and db.STOP_CAST) then --Disrupting Roar
|
|
Tercio@10
|
568 f.stop_casting_frame:Show()
|
|
Tercio@10
|
569 f.stop_casting_frame.alert.animOut:Stop()
|
|
Tercio@10
|
570 f.stop_casting_frame.alert.animIn:Play()
|
|
Tercio@10
|
571 f:ScheduleTimer ("HideStopSpellAlert", 1.2)
|
|
Tercio@10
|
572
|
|
Tercio@0
|
573 end
|
|
Tercio@9
|
574
|
|
Tercio@9
|
575 if (token == "SPELL_INTERRUPT" and spellid == 160838 and db.STOP_CAST) then
|
|
Tercio@9
|
576 local link = GetSpellLink (buff_type)
|
|
Tercio@9
|
577 print ("Stop Cast Fail:", target_name, link)
|
|
Tercio@9
|
578 end
|
|
Tercio@9
|
579
|
|
Tercio@9
|
580 --if (spellid == 160838) then
|
|
Tercio@9
|
581 -- print ("event:", token, 160838, db.STOP_CAST)
|
|
Tercio@9
|
582 --end
|
|
Tercio@0
|
583
|
|
Tercio@0
|
584 end)
|
|
Tercio@10
|
585 -- /run Hansgar_And_Franzok_AssistStopCastingAlert.animIn:Play()
|
|
Tercio@0
|
586
|
|
Tercio@9
|
587 --Hansgar_And_Franzok_AssistStopCasting:Show(); Hansgar_And_Franzok_Assist:ScheduleTimer ("HideStopSpellAlert", 1)
|
|
Tercio@9
|
588 --Hansgar_And_Franzok_Assist:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
|
|
Tercio@9
|
589
|
|
Tercio@0
|
590 local frame_tracker = CreateFrame ("frame", "Hansgar_And_Franzok_AssistTracker", UIParent)
|
|
Tercio@0
|
591 local on_update_tracker = function (self, elapsed)
|
|
Tercio@0
|
592
|
|
Tercio@4
|
593 local raid_size = GetNumGroupMembers()
|
|
Tercio@4
|
594
|
|
Tercio@4
|
595 for i = 1, raid_size do
|
|
Tercio@0
|
596 local x, y = GetPlayerMapPosition ("raid"..i)
|
|
Tercio@0
|
597 if (UnitExists ("raid"..i) and UnitHealth ("raid"..i) > 1 and x and y) then
|
|
Tercio@0
|
598 local block = f:WhichBlock (x, y)
|
|
Tercio@0
|
599 if (block) then
|
|
Tercio@0
|
600 if (not f.block_tracker [block]) then --> was a clear block
|
|
Tercio@0
|
601 f.block_tracker [block] = GetTime()
|
|
Tercio@0
|
602 f:Paint (f.all_blocks [block])
|
|
Tercio@0
|
603 end
|
|
Tercio@0
|
604 end
|
|
Tercio@0
|
605 end
|
|
Tercio@0
|
606 end
|
|
Tercio@0
|
607
|
|
Tercio@0
|
608 local px, py = GetPlayerMapPosition ("player")
|
|
Tercio@0
|
609 local player_block = f:WhichBlock (px, py)
|
|
Tercio@6
|
610 if (player_block and f.block_tracker [player_block] and raid_size > 0) then
|
|
Tercio@0
|
611
|
|
Tercio@0
|
612 local time_limit_at = f.block_tracker [player_block] + db.STAMPERS_DELAY
|
|
Tercio@0
|
613 local time_now = GetTime()
|
|
Tercio@0
|
614
|
|
Tercio@7
|
615 local timeleft = time_limit_at - time_now
|
|
Tercio@7
|
616 f.player_bar:SetValue ((timeleft) / db.STAMPERS_DELAY * 100)
|
|
Tercio@7
|
617 if (timeleft > 0) then
|
|
Tercio@7
|
618 f.player_bar.text:SetText (format ("%.1f", timeleft))
|
|
Tercio@7
|
619 else
|
|
Tercio@7
|
620 f.player_bar.text:SetText ("Move!")
|
|
Tercio@7
|
621 end
|
|
Tercio@0
|
622 f.player_bar:Show()
|
|
Tercio@7
|
623
|
|
Tercio@0
|
624 local block_frame = f.all_blocks [player_block]
|
|
Tercio@0
|
625 f.player_loc_box:SetPoint ("center", block_frame, "center")
|
|
Tercio@0
|
626 f.player_loc_box:Show()
|
|
Tercio@7
|
627
|
|
Tercio@0
|
628 else
|
|
Tercio@9
|
629 if (f.unlocked_frame) then
|
|
Tercio@9
|
630 f.player_loc_box:Show()
|
|
Tercio@9
|
631 f.player_bar:Show()
|
|
Tercio@9
|
632 f.player_bar:SetValue (100)
|
|
Tercio@9
|
633 else
|
|
Tercio@9
|
634 f.player_loc_box:Hide()
|
|
Tercio@9
|
635 f.player_bar:Hide()
|
|
Tercio@9
|
636 end
|
|
Tercio@0
|
637 end
|
|
Tercio@0
|
638 end
|
|
Tercio@0
|
639
|
|
Tercio@0
|
640 function f:StartTracking()
|
|
Tercio@0
|
641
|
|
Tercio@0
|
642 print ("|cFFFFAA00Hansgar and Franzok Assist|r: Smart Stampers phase started.")
|
|
Tercio@0
|
643
|
|
Tercio@0
|
644 f.StampersPhase = true
|
|
Tercio@0
|
645
|
|
Tercio@0
|
646 if (not f.frames_built) then
|
|
Tercio@0
|
647 f:CreateWindow()
|
|
Tercio@0
|
648 end
|
|
Tercio@7
|
649
|
|
Tercio@0
|
650 f:ResetBlocks()
|
|
Tercio@0
|
651 f.player_loc_box:Hide()
|
|
Tercio@0
|
652
|
|
Tercio@0
|
653 f.block_tracker = f.block_tracker or {}
|
|
Tercio@0
|
654 table.wipe (f.block_tracker)
|
|
Tercio@7
|
655
|
|
Tercio@0
|
656 SetMapToCurrentZone()
|
|
Tercio@7
|
657
|
|
Tercio@0
|
658 frame_tracker:SetScript ("OnUpdate", on_update_tracker)
|
|
Tercio@0
|
659 f:Show()
|
|
Tercio@7
|
660 f.player_bar:Show()
|
|
Tercio@7
|
661
|
|
Tercio@0
|
662 end
|
|
Tercio@0
|
663
|
|
Tercio@0
|
664 function f:StopTracking()
|
|
Tercio@0
|
665 print ("|cFFFFAA00Hansgar and Franzok Assist|r: Smart Stampers phase ended.")
|
|
Tercio@0
|
666
|
|
Tercio@0
|
667 f.StampersPhase = false
|
|
Tercio@0
|
668 frame_tracker:SetScript ("OnUpdate", nil)
|
|
Tercio@0
|
669 table.wipe (f.block_tracker)
|
|
Tercio@0
|
670 f.player_loc_box:Hide()
|
|
Tercio@0
|
671 f:Hide()
|
|
Tercio@7
|
672 f.player_bar:SetValue (0)
|
|
Tercio@7
|
673 f.player_bar:Hide()
|
|
Tercio@0
|
674 end
|
|
Tercio@0
|
675
|
|
Tercio@0
|
676 local on_mouse_down = function (self)
|
|
Tercio@5
|
677 if (not self.isMoving and not db.FRAME_LOCK) then
|
|
Tercio@0
|
678 self.isMoving = true
|
|
Tercio@0
|
679 f:StartMoving()
|
|
Tercio@0
|
680 end
|
|
Tercio@0
|
681 end
|
|
Tercio@0
|
682 local on_mouse_up = function (self)
|
|
Tercio@0
|
683 if (self.isMoving) then
|
|
Tercio@0
|
684 self.isMoving = nil
|
|
Tercio@0
|
685 f:StopMovingOrSizing()
|
|
Tercio@0
|
686 end
|
|
Tercio@0
|
687 end
|
|
Tercio@0
|
688
|
|
Tercio@0
|
689 local painting = function (self, elapsed)
|
|
Tercio@0
|
690 self.step = self.step + elapsed
|
|
Tercio@0
|
691 self.total_time = self.total_time + elapsed
|
|
Tercio@0
|
692
|
|
Tercio@0
|
693 if (self.step > 0.2) then
|
|
Tercio@0
|
694 self.step = 0
|
|
Tercio@0
|
695 local percent = self.total_time / db.STAMPERS_DELAY * 100
|
|
Tercio@0
|
696
|
|
Tercio@0
|
697 percent = min (percent, 100)
|
|
Tercio@0
|
698
|
|
Tercio@0
|
699 local r, g, b = f:percent_color (percent, true)
|
|
Tercio@0
|
700 self:SetBackdropColor (r, g, b, 0.5)
|
|
Tercio@0
|
701
|
|
Tercio@0
|
702 self.number:SetText (floor (percent) .. "%")
|
|
Tercio@0
|
703 self.number:SetTextColor (1, 1, 1, 1)
|
|
Tercio@0
|
704
|
|
Tercio@0
|
705 if (percent == 100) then
|
|
Tercio@0
|
706 self:SetScript ("OnUpdate", nil)
|
|
Tercio@0
|
707 self.stamper_icon:Show()
|
|
Tercio@0
|
708 self.number:Hide()
|
|
Tercio@5
|
709 self.cooldown:Show()
|
|
Tercio@4
|
710 self.cooldown:SetCooldown (GetTime(), 37 - db.STAMPERS_DELAY, 0, 0)
|
|
Tercio@0
|
711 end
|
|
Tercio@0
|
712 end
|
|
Tercio@0
|
713 end
|
|
Tercio@4
|
714
|
|
Tercio@4
|
715 function f:UnPaint (block)
|
|
Tercio@4
|
716 f:ResetBlock (block)
|
|
Tercio@4
|
717 end
|
|
Tercio@0
|
718 function f:Paint (block)
|
|
Tercio@0
|
719 block.step = 0
|
|
Tercio@0
|
720 block.total_time = 0
|
|
Tercio@0
|
721 block:SetScript ("OnUpdate", painting)
|
|
Tercio@4
|
722 local unpaint = f:ScheduleTimer ("UnPaint", 37, block)
|
|
Tercio@4
|
723 block.unpaint_process = unpaint
|
|
Tercio@4
|
724 end
|
|
Tercio@4
|
725
|
|
Tercio@4
|
726 function f:ResetBlock (block)
|
|
Tercio@4
|
727 block:SetScript ("OnUpdate", nil)
|
|
Tercio@4
|
728 block:SetBackdropColor (.8, .8, .8, 0.5)
|
|
Tercio@4
|
729 block.number:SetText (block.id)
|
|
Tercio@4
|
730 block.number:SetTextColor (1, 1, 1, 0.5)
|
|
Tercio@4
|
731 block.number:Show()
|
|
Tercio@4
|
732 block.stamper_icon:Hide()
|
|
Tercio@4
|
733 block.cooldown:SetCooldown (0, 0, 0, 0)
|
|
Tercio@5
|
734 block.cooldown:Hide()
|
|
Tercio@4
|
735
|
|
Tercio@4
|
736 f.block_tracker [block.id] = nil
|
|
Tercio@4
|
737 if (block.unpaint_process) then
|
|
Tercio@4
|
738 f:CancelTimer (block.unpaint_process)
|
|
Tercio@4
|
739 block.unpaint_process = nil
|
|
Tercio@4
|
740 end
|
|
Tercio@0
|
741 end
|
|
Tercio@0
|
742
|
|
Tercio@0
|
743 function f:ResetBlocks()
|
|
Tercio@0
|
744 for _, block in ipairs (f.all_blocks) do
|
|
Tercio@4
|
745 f:ResetBlock (block)
|
|
Tercio@4
|
746 end
|
|
Tercio@4
|
747 end
|
|
Tercio@4
|
748
|
|
Tercio@4
|
749 function f:RefreshCooldownSettings()
|
|
Tercio@4
|
750 for _, block in ipairs (f.all_blocks) do
|
|
Tercio@4
|
751 if (not db.CD_NUMBER) then
|
|
Tercio@4
|
752 block.cooldown:SetHideCountdownNumbers (true)
|
|
Tercio@4
|
753 block.cooldown:SetDrawEdge (false)
|
|
Tercio@4
|
754 else
|
|
Tercio@4
|
755 block.cooldown:SetHideCountdownNumbers (false)
|
|
Tercio@4
|
756 block.cooldown:SetDrawEdge (true)
|
|
Tercio@4
|
757 end
|
|
Tercio@0
|
758 end
|
|
Tercio@0
|
759 end
|
|
Tercio@0
|
760
|
|
Tercio@7
|
761 function f:SetLockState (just_refresh)
|
|
Tercio@7
|
762
|
|
Tercio@7
|
763 if (not just_refresh) then
|
|
Tercio@7
|
764 db.FRAME_LOCK = not db.FRAME_LOCK
|
|
Tercio@7
|
765 end
|
|
Tercio@7
|
766
|
|
Tercio@5
|
767 if (db.FRAME_LOCK) then
|
|
Tercio@5
|
768 --locked
|
|
Tercio@5
|
769 f:EnableMouse (false)
|
|
Tercio@7
|
770 player_bar:EnableMouse (false)
|
|
Tercio@7
|
771 player_pos_frame:EnableMouse (false)
|
|
Tercio@10
|
772 stop_casting_frame:SetMovable (false)
|
|
Tercio@10
|
773 stop_casting_frame:EnableMouse (false)
|
|
Tercio@7
|
774
|
|
Tercio@5
|
775 for _, block in ipairs (f.all_blocks) do
|
|
Tercio@5
|
776 block:EnableMouse (false)
|
|
Tercio@5
|
777 end
|
|
Tercio@7
|
778
|
|
Tercio@7
|
779 if (f.StampersPhase and not just_refresh) then
|
|
Tercio@7
|
780 f:EndTrackPlayerPosition()
|
|
Tercio@7
|
781 f:StopTracking()
|
|
Tercio@7
|
782 end
|
|
Tercio@10
|
783
|
|
Tercio@5
|
784 else
|
|
Tercio@5
|
785 --unlocked
|
|
Tercio@5
|
786 f:EnableMouse (true)
|
|
Tercio@7
|
787 player_bar:EnableMouse (true)
|
|
Tercio@7
|
788 player_pos_frame:EnableMouse (true)
|
|
Tercio@10
|
789 stop_casting_frame:SetMovable (true)
|
|
Tercio@10
|
790 stop_casting_frame:EnableMouse (true)
|
|
Tercio@7
|
791
|
|
Tercio@5
|
792 for _, block in ipairs (f.all_blocks) do
|
|
Tercio@5
|
793 block:EnableMouse (true)
|
|
Tercio@5
|
794 end
|
|
Tercio@7
|
795
|
|
Tercio@7
|
796 if (not f.StampersPhase and not just_refresh) then
|
|
Tercio@7
|
797 f:StartTracking()
|
|
Tercio@7
|
798 f:StartTrackPlayerPosition()
|
|
Tercio@7
|
799 end
|
|
Tercio@10
|
800
|
|
Tercio@7
|
801 end
|
|
Tercio@7
|
802
|
|
Tercio@7
|
803 if (not db.FRAME_LOCK) then
|
|
Tercio@7
|
804 player_bar.grip:Show()
|
|
Tercio@7
|
805 else
|
|
Tercio@7
|
806 player_bar.grip:Hide()
|
|
Tercio@5
|
807 end
|
|
Tercio@5
|
808 end
|
|
Tercio@5
|
809
|
|
Tercio@0
|
810 function f:CreateWindow()
|
|
Tercio@0
|
811 local x = 0
|
|
Tercio@0
|
812 local y = 0
|
|
Tercio@0
|
813
|
|
Tercio@0
|
814 f.player_loc_box = frame_event:CreateTexture (nil, "overlay")
|
|
Tercio@0
|
815 f.player_loc_box:SetSize (32, 40)
|
|
Tercio@0
|
816 f.player_loc_box:SetTexture ([[Interface\ContainerFrame\UI-Icon-QuestBorder]])
|
|
Tercio@0
|
817 f.player_loc_box:Hide()
|
|
Tercio@0
|
818
|
|
Tercio@0
|
819 f.all_blocks = {}
|
|
Tercio@0
|
820
|
|
Tercio@0
|
821 for i = 1, 20 do
|
|
Tercio@0
|
822
|
|
Tercio@0
|
823 local block = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_Block" .. i, f)
|
|
Tercio@0
|
824 block:SetSize (30, 38)
|
|
Tercio@0
|
825 block:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0},
|
|
Tercio@0
|
826 })
|
|
Tercio@0
|
827 block:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@0
|
828 block:SetBackdropColor (.8, .8, .8, 0.5)
|
|
Tercio@0
|
829 block:SetPoint ("TopLeft", f, "TopLeft", x, y)
|
|
Tercio@0
|
830
|
|
Tercio@0
|
831 block:SetScript ("OnMouseDown", on_mouse_down)
|
|
Tercio@0
|
832 block:SetScript ("OnMouseUp", on_mouse_up)
|
|
Tercio@0
|
833
|
|
Tercio@4
|
834 local cooldown = CreateFrame ("cooldown", "Hansgar_And_Franzok_Assist_BlockCooldown" .. i, block, "CooldownFrameTemplate")
|
|
Tercio@4
|
835 cooldown:SetAllPoints()
|
|
Tercio@4
|
836 cooldown:SetFrameLevel (block:GetFrameLevel()+2)
|
|
Tercio@4
|
837
|
|
Tercio@4
|
838 if (not db.CD_NUMBER) then
|
|
Tercio@4
|
839 cooldown:SetHideCountdownNumbers (true)
|
|
Tercio@4
|
840 cooldown:SetDrawEdge (false)
|
|
Tercio@4
|
841 end
|
|
Tercio@4
|
842
|
|
Tercio@4
|
843 block.cooldown = cooldown
|
|
Tercio@4
|
844
|
|
Tercio@0
|
845 block.id = i
|
|
Tercio@0
|
846
|
|
Tercio@0
|
847 local number = block:CreateFontString (nil, "artwork", "GameFontHighlight")
|
|
Tercio@0
|
848 number:SetPoint ("center", block, "center")
|
|
Tercio@0
|
849 number:SetText (i)
|
|
Tercio@0
|
850 number:SetTextColor (1, 1, 1, 0.5)
|
|
Tercio@0
|
851 block.number = number
|
|
Tercio@0
|
852
|
|
Tercio@0
|
853 local stamper_icon = block:CreateTexture (nil, "overlay")
|
|
Tercio@0
|
854 stamper_icon:SetTexture ([[Interface\ICONS\Warrior_talent_icon_LambsToTheSlaughter]])
|
|
Tercio@0
|
855 stamper_icon:SetTexCoord (4/64, 60/64, 4/64, 60/64)
|
|
Tercio@0
|
856 stamper_icon:SetSize (24, 24)
|
|
Tercio@0
|
857 stamper_icon:SetPoint ("center", block, "center")
|
|
Tercio@0
|
858 stamper_icon:Hide()
|
|
Tercio@0
|
859 block.stamper_icon = stamper_icon
|
|
Tercio@0
|
860
|
|
Tercio@0
|
861 x = x + 31
|
|
Tercio@0
|
862 if (x >= 155) then
|
|
Tercio@0
|
863 x = 0
|
|
Tercio@0
|
864 y = y - 40
|
|
Tercio@0
|
865 end
|
|
Tercio@0
|
866
|
|
Tercio@0
|
867 tinsert (f.all_blocks, block)
|
|
Tercio@0
|
868
|
|
Tercio@0
|
869 end
|
|
Tercio@0
|
870
|
|
Tercio@7
|
871 f:SetLockState (true)
|
|
Tercio@5
|
872
|
|
Tercio@0
|
873 f.frames_built = true
|
|
Tercio@0
|
874
|
|
Tercio@0
|
875 end
|
|
Tercio@0
|
876
|
|
Tercio@4
|
877 local safe_track = {
|
|
Tercio@4
|
878 --space 1
|
|
Tercio@4
|
879 {
|
|
Tercio@4
|
880 block = {x1 = 0.50154542922974, x2 = 0.49563668874741},
|
|
Tercio@8
|
881 left = {x1 = 0.49963343143463, x2 = 0.49963343143463 - 0.000624573974608},
|
|
Tercio@8
|
882 right = {x1 = 0.49710285663605, x2 = 0.49710285663605 + 0.000992229919432},
|
|
Tercio@4
|
883 -- {x1 = 0.49963343143463, y1 = 0.73492467403412} -- {x1 = 0.49710285663605, y1 = 0.74445152282715}
|
|
Tercio@4
|
884 },
|
|
Tercio@4
|
885 --space 2
|
|
Tercio@4
|
886 {
|
|
Tercio@4
|
887 block = {x1 = 0.4858917593956, x2 = 0.48044270277023},
|
|
Tercio@4
|
888 left = {x1 = 0.48433673381805, x2 = 0.48433673381805 - 0.00091059207916},
|
|
Tercio@4
|
889 right = {x1 = 0.48206025362015, x2 = 0.48206025362015 + 0.00075059207916},
|
|
Tercio@4
|
890 -- {x1 = 0.48433673381805, y1 = 0.74292266368866} -- {x1 = 0.48206025362015, y1 = 0.78930181264877}
|
|
Tercio@4
|
891 },
|
|
Tercio@4
|
892 --space 3
|
|
Tercio@4
|
893 {
|
|
Tercio@4
|
894 block = {x1 = 0.47047740221024, x2 = 0.4648859500885},
|
|
Tercio@8
|
895 left = {x1 = 0.46893924474716, x2 = 0.46893924474716 - 0.000902948493956},
|
|
Tercio@8
|
896 right = {x1 = 0.46635687351227, x2 = 0.46635687351227 + 0.000970948493956},
|
|
Tercio@4
|
897 --{x1 = 0.46893924474716, y1 = 0.7981019616127} -- {x1 = 0.46635687351227, y1 = 0.73558133840561}
|
|
Tercio@4
|
898 },
|
|
Tercio@4
|
899 --space 4
|
|
Tercio@4
|
900 {
|
|
Tercio@4
|
901 block = {x1 = 0.45503282546997, x2 = 0.44976264238358},
|
|
Tercio@8
|
902 left = {x1 = 0.4533554315567, x2 = 0.4533554315567 - 0.000714573974608},
|
|
Tercio@4
|
903 right = {x1 = 0.45124399662018, x2 = 0.45124399662018 + 0.000770009999999},
|
|
Tercio@4
|
904 --{x1 = 0.4533554315567, y1 = 0.74078941345215} -- {x1 = 0.45124399662018, y1 = 0.74088287353516}
|
|
Tercio@4
|
905 }
|
|
Tercio@4
|
906 }
|
|
Tercio@4
|
907 Hansgar_safe_track = safe_track
|
|
Tercio@4
|
908
|
|
Tercio@4
|
909 -- /hansgar test
|
|
Tercio@8
|
910 -- /run Hansgar_safe_track [4].left.x2 = 0.4533554315567 - 0.000714573974608
|
|
Tercio@4
|
911
|
|
Tercio@7
|
912 local red_alpha_disabled = 0.2
|
|
Tercio@4
|
913 local red_alpha_enabled = 0.5
|
|
Tercio@4
|
914
|
|
Tercio@4
|
915 local green_alpha_disabled = 0.05
|
|
Tercio@4
|
916 local green_alpha_enabled = 0.9
|
|
Tercio@4
|
917
|
|
Tercio@6
|
918 -- true north -> south
|
|
Tercio@6
|
919 -- false south -> north
|
|
Tercio@4
|
920 local track_function = function (self, elapsed)
|
|
Tercio@6
|
921
|
|
Tercio@4
|
922 local x, _ = GetPlayerMapPosition ("player")
|
|
Tercio@4
|
923 local block
|
|
Tercio@4
|
924
|
|
Tercio@6
|
925 if (db.AUTO_FACING and x) then
|
|
Tercio@6
|
926 local facing = GetPlayerFacing()
|
|
Tercio@6
|
927
|
|
Tercio@6
|
928 if (self.facing and (facing > 5.3 or facing < 1.053)) then --north -> south -- ~30º tolerance
|
|
Tercio@6
|
929 self.facing = false
|
|
Tercio@6
|
930 --print ("changing face to south")
|
|
Tercio@6
|
931 elseif (not self.facing and (facing > 2.3 and facing < 4.3)) then --south -> north -- ~30º tolerance
|
|
Tercio@6
|
932 self.facing = true
|
|
Tercio@6
|
933 --print ("changing face to north")
|
|
Tercio@6
|
934 end
|
|
Tercio@6
|
935 end
|
|
Tercio@6
|
936
|
|
Tercio@6
|
937 if (x) then
|
|
Tercio@6
|
938 for i = 1, #safe_track do
|
|
Tercio@6
|
939 local loc = safe_track [i]
|
|
Tercio@6
|
940 if (x >= loc.block.x2 and x <= loc.block.x1) then
|
|
Tercio@6
|
941 block = i
|
|
Tercio@6
|
942 break
|
|
Tercio@6
|
943 end
|
|
Tercio@4
|
944 end
|
|
Tercio@4
|
945 end
|
|
Tercio@4
|
946
|
|
Tercio@6
|
947 if (block and safe_track [block]) then
|
|
Tercio@4
|
948
|
|
Tercio@4
|
949 player_pos_frame:Show()
|
|
Tercio@4
|
950 block = safe_track [block]
|
|
Tercio@4
|
951
|
|
Tercio@4
|
952 if (x >= block.left.x2 and x <= block.left.x1) then
|
|
Tercio@6
|
953 if (self.facing) then
|
|
Tercio@6
|
954 t2:SetTexture (0.1, 1, 0.1, green_alpha_enabled)
|
|
Tercio@6
|
955 t3:SetTexture (0.2, 1, 0.2, green_alpha_disabled)
|
|
Tercio@6
|
956 else
|
|
Tercio@6
|
957 t3:SetTexture (0.2, 232/255, 1, green_alpha_enabled)
|
|
Tercio@6
|
958 t2:SetTexture (0.2, 232/255, 1, green_alpha_disabled)
|
|
Tercio@6
|
959 end
|
|
Tercio@4
|
960
|
|
Tercio@4
|
961 t1:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red
|
|
Tercio@4
|
962 t4:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red
|
|
Tercio@4
|
963 middle:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red
|
|
Tercio@4
|
964
|
|
Tercio@4
|
965 elseif (x <= block.right.x2 and x >= block.right.x1) then
|
|
Tercio@6
|
966 if (self.facing) then
|
|
Tercio@6
|
967 t3:SetTexture (0.1, 1, 0.1, green_alpha_enabled)
|
|
Tercio@6
|
968 t2:SetTexture (0.2, 1, 0.2, green_alpha_disabled)
|
|
Tercio@6
|
969 else
|
|
Tercio@6
|
970 t2:SetTexture (0.2, 232/255, 1, green_alpha_enabled)
|
|
Tercio@6
|
971 t3:SetTexture (0.2, 232/255, 1, green_alpha_disabled)
|
|
Tercio@6
|
972 end
|
|
Tercio@4
|
973
|
|
Tercio@4
|
974 t1:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red
|
|
Tercio@4
|
975 t4:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red
|
|
Tercio@4
|
976 middle:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red
|
|
Tercio@4
|
977
|
|
Tercio@4
|
978 else
|
|
Tercio@4
|
979 t1:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red
|
|
Tercio@4
|
980 t4:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red
|
|
Tercio@4
|
981 middle:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red
|
|
Tercio@4
|
982
|
|
Tercio@4
|
983 t2:SetTexture (0.2, 1, 0.2, green_alpha_disabled)
|
|
Tercio@4
|
984 t3:SetTexture (0.2, 1, 0.2, green_alpha_disabled)
|
|
Tercio@4
|
985
|
|
Tercio@4
|
986 end
|
|
Tercio@4
|
987
|
|
Tercio@4
|
988 --x = x - block.block.x2
|
|
Tercio@4
|
989 --local at = abs ((x / (block.block.x1 - block.block.x2) * 100) - 100)
|
|
Tercio@4
|
990 --div:SetPoint ("left", player_pos_frame, "left", self.width_pixel * at, 0)
|
|
Tercio@4
|
991
|
|
Tercio@4
|
992 else
|
|
Tercio@9
|
993 if (f.unlocked_frame) then
|
|
Tercio@9
|
994 player_pos_frame:Show()
|
|
Tercio@9
|
995 else
|
|
Tercio@9
|
996 player_pos_frame:Hide()
|
|
Tercio@9
|
997 end
|
|
Tercio@4
|
998 end
|
|
Tercio@4
|
999 end
|
|
Tercio@4
|
1000
|
|
Tercio@4
|
1001 function f:StartTrackPlayerPosition()
|
|
Tercio@4
|
1002 player_pos_frame:Show()
|
|
Tercio@4
|
1003 tframe.width = player_pos_frame:GetWidth()
|
|
Tercio@4
|
1004 tframe.width_pixel = tframe.width / 100
|
|
Tercio@6
|
1005 tframe.facing = db.FACING_SIDE == 1
|
|
Tercio@4
|
1006 tframe:SetScript ("OnUpdate", track_function)
|
|
Tercio@4
|
1007 end
|
|
Tercio@4
|
1008 function f:EndTrackPlayerPosition()
|
|
Tercio@4
|
1009 player_pos_frame:Hide()
|
|
Tercio@4
|
1010 tframe:SetScript ("OnUpdate", nil)
|
|
Tercio@4
|
1011 end
|
|
Tercio@4
|
1012
|
|
Tercio@0
|
1013 local locs = {
|
|
Tercio@0
|
1014 --block 1:
|
|
Tercio@1
|
1015 {x1 = 0.51103663444519, y1 = 0.79726493358612, x2 = 0.50061076879501, y2 = 0.8241291642189},
|
|
Tercio@0
|
1016 --block 2:
|
|
Tercio@1
|
1017 {x1 = 0.49670505523682, y1 = 0.79692482948303, x2 = 0.48469054698944, y2 = 0.82489335536957},
|
|
Tercio@0
|
1018 --block 3:
|
|
Tercio@1
|
1019 {x1 = 0.48130965232849, y1 = 0.79742962121964, x2 = 0.46962946653366, y2 = 0.82453238964081},
|
|
Tercio@0
|
1020 --block 4:
|
|
Tercio@1
|
1021 {x1 = 0.46575212478638, y1 = 0.79766929149628, x2 = 0.45400339365005, y2 = 0.82176661491394},
|
|
Tercio@0
|
1022 --block 5:
|
|
Tercio@1
|
1023 {x1 = 0.45073217153549, y1 = 0.79751670360565, x2 = 0.43945103883743, y2 = 0.82504689693451},
|
|
Tercio@0
|
1024
|
|
Tercio@0
|
1025 --block 6
|
|
Tercio@1
|
1026 {x1 = 0.51104211807251, y1 = 0.76532691717148, x2 = 0.50021582841873, y2 = 0.79546189308167},
|
|
Tercio@1
|
1027 --block 7
|
|
Tercio@1
|
1028 {x1 = 0.4964514374733, y1 = 0.76603573560715, x2 = 0.48449218273163, y2 = 0.79527854919434},
|
|
Tercio@1
|
1029 --block 8
|
|
Tercio@1
|
1030 {x1 = 0.48101079463959, y1 = 0.76503103971481, x2 = 0.46944016218185, y2 = 0.79543298482895},
|
|
Tercio@1
|
1031 --block 9
|
|
Tercio@1
|
1032 {x1 = 0.46541726589203, y1 = 0.7654857635498, x2 = 0.45369201898575, y2 = 0.79529416561127},
|
|
Tercio@1
|
1033 --block 10
|
|
Tercio@1
|
1034 {x1 = 0.45051556825638, y1 = 0.76583826541901, x2 = 0.43931984901428, y2 = 0.79570162296295},
|
|
Tercio@1
|
1035
|
|
Tercio@1
|
1036
|
|
Tercio@1
|
1037 --block 11
|
|
Tercio@0
|
1038 {x1 = 0.51104187965393, y1 = 0.73422884941101, x2 = 0.49990028142929, y2 = 0.76343530416489},
|
|
Tercio@1
|
1039 --block 12
|
|
Tercio@0
|
1040 {x1 = 0.49673527479172, y1 = 0.73338270187378, x2 = 0.48483556509018, y2 = 0.76356953382492},
|
|
Tercio@1
|
1041 --block 13
|
|
Tercio@0
|
1042 {x1 = 0.48133307695389, y1 = 0.73373115062714, x2 = 0.46920585632324, y2 = 0.76366758346558},
|
|
Tercio@1
|
1043 --block 14
|
|
Tercio@0
|
1044 {x1 = 0.46568286418915, y1 = 0.73440700769424, x2 = 0.45381307601929, y2 = 0.76358675956726},
|
|
Tercio@1
|
1045 --block 15
|
|
Tercio@0
|
1046 {x1 = 0.45046973228455, y1 = 0.73361301422119, x2 = 0.43929302692413, y2 = 0.76388084888458},
|
|
Tercio@0
|
1047
|
|
Tercio@0
|
1048 --block 16
|
|
Tercio@1
|
1049 {x1 = 0.51104891300201, y1 = 0.70877063274384, x2 = 0.50024521350861, y2 = 0.73220580816269},
|
|
Tercio@0
|
1050 --block 17
|
|
Tercio@1
|
1051 {x1 = 0.49676024913788, y1 = 0.70914703607559, x2 = 0.48485481739044, y2 = 0.73210543394089},
|
|
Tercio@0
|
1052 --block 18
|
|
Tercio@1
|
1053 {x1 = 0.48142266273499, y1 = 0.70876735448837, x2 = 0.46925610303879, y2 = 0.73205661773682},
|
|
Tercio@0
|
1054 --block 19
|
|
Tercio@1
|
1055 {x1 = 0.46603119373322, y1 = 0.70929777622223, x2 = 0.45397216081619, y2 = 0.73167610168457},
|
|
Tercio@0
|
1056 --block 20
|
|
Tercio@1
|
1057 {x1 = 0.45079308748245, y1 = 0.70926278829575, x2 = 0.43927478790283, y2 = 0.73225915431976},
|
|
Tercio@0
|
1058 }
|
|
Tercio@0
|
1059
|
|
Tercio@0
|
1060 function f:WhichBlock (x, y)
|
|
Tercio@0
|
1061 for i = 1, #locs do
|
|
Tercio@0
|
1062 local loc = locs [i]
|
|
Tercio@0
|
1063 if (x >= loc.x2 and x <= loc.x1 and y >= loc.y1 and y <= loc.y2) then
|
|
Tercio@0
|
1064 return i
|
|
Tercio@0
|
1065 end
|
|
Tercio@0
|
1066 end
|
|
Tercio@0
|
1067 end
|
|
Tercio@0
|
1068
|
|
Tercio@0
|
1069 function f:percent_color (value, inverted)
|
|
Tercio@0
|
1070 local r, g
|
|
Tercio@0
|
1071 if (value < 50) then
|
|
Tercio@0
|
1072 r = 255
|
|
Tercio@0
|
1073 else
|
|
Tercio@0
|
1074 r = floor ( 255 - (value * 2 - 100) * 255 / 100)
|
|
Tercio@0
|
1075 end
|
|
Tercio@0
|
1076
|
|
Tercio@0
|
1077 if (value > 50) then
|
|
Tercio@0
|
1078 g = 255
|
|
Tercio@0
|
1079 else
|
|
Tercio@0
|
1080 g = floor ( (value * 2) * 255 / 100)
|
|
Tercio@0
|
1081 end
|
|
Tercio@0
|
1082
|
|
Tercio@0
|
1083 if (inverted) then
|
|
Tercio@0
|
1084 return g/255, r/255, 0
|
|
Tercio@0
|
1085 else
|
|
Tercio@0
|
1086 return r/255, g/255, 0
|
|
Tercio@0
|
1087 end
|
|
Tercio@0
|
1088 end
|