Mercurial > wow > hansgar_and_franzok_assist
comparison Hansgar_And_Franzok_Assist.lua @ 13:f635adb94909
- Added west and east sides for dance bar.
- Main panel won't close with escape button.
| author | Tercio |
|---|---|
| date | Tue, 28 Apr 2015 11:21:50 -0300 |
| parents | 6dd01dcec75e |
| children | c4e00fefea9c |
comparison
equal
deleted
inserted
replaced
| 12:6dd01dcec75e | 13:f635adb94909 |
|---|---|
| 15 local GetPlayerFacing = GetPlayerFacing | 15 local GetPlayerFacing = GetPlayerFacing |
| 16 local db | 16 local db |
| 17 local _ | 17 local _ |
| 18 | 18 |
| 19 --local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent) | 19 --local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent) |
| 20 local f = DF:Create1PxPanel (_, 155, 166, "Hans & Franz", "Hansgar_And_Franzok_Assist", nil, "top") -- | 20 local f = DF:Create1PxPanel (_, 155, 166, "Hans & Franz", "Hansgar_And_Franzok_Assist", nil, "top", true) |
| 21 f:SetFrameStrata ("DIALOG") | 21 f:SetFrameStrata ("DIALOG") |
| 22 f.version = "v0.12" | 22 f.version = "v0.13" |
| 23 | 23 |
| 24 f.Close:SetScript ("OnClick", function (self) | 24 f.Close:SetScript ("OnClick", function (self) |
| 25 if (f.StampersPhase) then | 25 if (f.StampersPhase) then |
| 26 return f:StopTracking() | 26 return f:StopTracking() |
| 27 end | 27 end |
| 146 player_bar:SetStatusBarTexture (player_bar.texture) | 146 player_bar:SetStatusBarTexture (player_bar.texture) |
| 147 | 147 |
| 148 -- | 148 -- |
| 149 | 149 |
| 150 local player_pos_frame = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_BarDance", UIParent) | 150 local player_pos_frame = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_BarDance", UIParent) |
| 151 --player_pos_frame:SetPoint ("topleft", player_bar, "bottomleft", 0, -3) | 151 local player_pos_frame2 = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_BarDance2", UIParent) |
| 152 --player_pos_frame:SetPoint ("topright", player_bar, "bottomright", 0, -3) | |
| 153 | 152 |
| 154 player_pos_frame:SetPoint ("center", UIParent, "center", 0, -75) | 153 player_pos_frame:SetPoint ("center", UIParent, "center", 0, -75) |
| 155 | 154 player_pos_frame2:SetPoint ("bottomleft", player_pos_frame, "bottomleft") |
| 155 | |
| 156 player_pos_frame2:SetSize (6, 155) | |
| 156 player_pos_frame:SetSize (155, 6) | 157 player_pos_frame:SetSize (155, 6) |
| 157 player_pos_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}}) | 158 |
| 159 local player_pos_frame_backdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}} | |
| 160 player_pos_frame:SetBackdrop (player_pos_frame_backdrop) | |
| 161 player_pos_frame2:SetBackdrop (player_pos_frame_backdrop) | |
| 158 player_pos_frame:SetBackdropColor (0, 0, 0, 1) | 162 player_pos_frame:SetBackdropColor (0, 0, 0, 1) |
| 163 player_pos_frame2:SetBackdropColor (0, 0, 0, 1) | |
| 164 player_pos_frame2:Hide() | |
| 159 player_pos_frame:SetMovable (true) | 165 player_pos_frame:SetMovable (true) |
| 160 player_pos_frame:EnableMouse (true) | 166 player_pos_frame:EnableMouse (true) |
| 161 player_pos_frame:SetScript ("OnMouseDown", function (self) | 167 player_pos_frame:SetScript ("OnMouseDown", function (self) |
| 162 if (not self.isMoving) then | 168 if (not self.isMoving) then |
| 163 self:StartMoving() | 169 self:StartMoving() |
| 176 --red | 182 --red |
| 177 local t1 = player_pos_frame:CreateTexture (nil, "artwork") | 183 local t1 = player_pos_frame:CreateTexture (nil, "artwork") |
| 178 t1:SetPoint ("left", player_pos_frame, "left") | 184 t1:SetPoint ("left", player_pos_frame, "left") |
| 179 t1:SetSize (player_pos_frame:GetWidth()*0.30, 6) | 185 t1:SetSize (player_pos_frame:GetWidth()*0.30, 6) |
| 180 t1:SetTexture (1, 1, 1) | 186 t1:SetTexture (1, 1, 1) |
| 181 --t1:SetTexCoord (260/512, 430/512, 29/256, 82/256) | |
| 182 t1:SetVertexColor (1, 0.2, 0.2, 0.4) | 187 t1:SetVertexColor (1, 0.2, 0.2, 0.4) |
| 183 | |
| 184 --green | 188 --green |
| 185 local t2 = player_pos_frame:CreateTexture (nil, "artwork") | 189 local t2 = player_pos_frame:CreateTexture (nil, "artwork") |
| 186 t2:SetPoint ("left", t1, "right") | 190 t2:SetPoint ("left", t1, "right") |
| 187 t2:SetSize (player_pos_frame:GetWidth()*0.15, 6) | 191 t2:SetSize (player_pos_frame:GetWidth()*0.15, 6) |
| 188 t2:SetTexture (0.2, 1, 0.2, 0.4) | 192 t2:SetTexture (0.2, 1, 0.2, 0.4) |
| 189 | |
| 190 --red | 193 --red |
| 191 local middle = player_pos_frame:CreateTexture (nil, "artwork") | 194 local middle = player_pos_frame:CreateTexture (nil, "artwork") |
| 192 middle:SetPoint ("left", t2, "right") | 195 middle:SetPoint ("left", t2, "right") |
| 193 middle:SetSize (player_pos_frame:GetWidth()*0.10, 6) | 196 middle:SetSize (player_pos_frame:GetWidth()*0.10, 6) |
| 194 middle:SetTexture (1, 1, 1) | 197 middle:SetTexture (1, 1, 1) |
| 195 --middle:SetTexCoord (260/512, 430/512, 29/256, 82/256) | |
| 196 middle:SetVertexColor (1, 0.2, 0.2, 0.4) | 198 middle:SetVertexColor (1, 0.2, 0.2, 0.4) |
| 197 | |
| 198 --green | 199 --green |
| 199 local t3 = player_pos_frame:CreateTexture (nil, "artwork") | 200 local t3 = player_pos_frame:CreateTexture (nil, "artwork") |
| 200 t3:SetPoint ("left", middle, "right") | 201 t3:SetPoint ("left", middle, "right") |
| 201 t3:SetSize (player_pos_frame:GetWidth()*0.15, 6) | 202 t3:SetSize (player_pos_frame:GetWidth()*0.15, 6) |
| 202 t3:SetTexture (0.2, 1, 0.2, 0.4) | 203 t3:SetTexture (0.2, 1, 0.2, 0.4) |
| 203 | |
| 204 --red | 204 --red |
| 205 local t4 = player_pos_frame:CreateTexture (nil, "artwork") | 205 local t4 = player_pos_frame:CreateTexture (nil, "artwork") |
| 206 t4:SetPoint ("left", t3, "right") | 206 t4:SetPoint ("left", t3, "right") |
| 207 t4:SetSize (player_pos_frame:GetWidth()*0.30, 6) | 207 t4:SetSize (player_pos_frame:GetWidth()*0.30, 6) |
| 208 t4:SetTexture (1, 1, 1) | 208 t4:SetTexture (1, 1, 1) |
| 209 --t4:SetTexCoord (260/512, 430/512, 29/256, 82/256) | |
| 210 t4:SetVertexColor (1, 0.2, 0.2, 0.4) | 209 t4:SetVertexColor (1, 0.2, 0.2, 0.4) |
| 210 | |
| 211 --red | |
| 212 local t1_2 = player_pos_frame:CreateTexture (nil, "artwork") | |
| 213 t1_2:SetPoint ("bottomleft", player_pos_frame, "bottomleft") | |
| 214 t1_2:SetSize (6, player_pos_frame:GetWidth()*0.30) | |
| 215 t1_2:SetTexture (1, 1, 1) | |
| 216 t1_2:SetVertexColor (1, 0.2, 0.2, 0.4) | |
| 217 --green | |
| 218 local t2_2 = player_pos_frame:CreateTexture (nil, "artwork") | |
| 219 t2_2:SetPoint ("bottom", t1_2, "top") | |
| 220 t2_2:SetSize (6, player_pos_frame:GetWidth()*0.15) | |
| 221 t2_2:SetTexture (0.2, 1, 0.2, 0.4) | |
| 222 --red | |
| 223 local middle_2 = player_pos_frame:CreateTexture (nil, "artwork") | |
| 224 middle_2:SetPoint ("bottom", t2_2, "top") | |
| 225 middle_2:SetSize (6, player_pos_frame:GetWidth()*0.10) | |
| 226 middle_2:SetTexture (1, 1, 1) | |
| 227 middle_2:SetVertexColor (1, 0.2, 0.2, 0.4) | |
| 228 --green | |
| 229 local t3_2 = player_pos_frame:CreateTexture (nil, "artwork") | |
| 230 t3_2:SetPoint ("bottom", middle_2, "top") | |
| 231 t3_2:SetSize (6, player_pos_frame:GetWidth()*0.15) | |
| 232 t3_2:SetTexture (0.2, 1, 0.2, 0.4) | |
| 233 --red | |
| 234 local t4_2 = player_pos_frame:CreateTexture (nil, "artwork") | |
| 235 t4_2:SetPoint ("bottom", t3_2, "top") | |
| 236 t4_2:SetSize (6, player_pos_frame:GetWidth()*0.30) | |
| 237 t4_2:SetTexture (1, 1, 1) | |
| 238 t4_2:SetVertexColor (1, 0.2, 0.2, 0.4) | |
| 239 | |
| 240 t1_2:Hide() | |
| 241 t2_2:Hide() | |
| 242 t3_2:Hide() | |
| 243 t4_2:Hide() | |
| 244 middle_2:Hide() | |
| 211 | 245 |
| 212 local div = player_pos_frame:CreateTexture (nil, "overlay") | 246 local div = player_pos_frame:CreateTexture (nil, "overlay") |
| 213 div:SetPoint ("left", player_pos_frame, "left", 0, 0) | 247 div:SetPoint ("left", player_pos_frame, "left", 0, 0) |
| 214 div:SetTexture (1, 1, 1, 1) | 248 div:SetTexture (1, 1, 1, 1) |
| 215 div:SetSize (1, 16) | 249 div:SetSize (1, 16) |
| 1134 local red_alpha_enabled = 0.5 | 1168 local red_alpha_enabled = 0.5 |
| 1135 | 1169 |
| 1136 local green_alpha_disabled = 0.05 | 1170 local green_alpha_disabled = 0.05 |
| 1137 local green_alpha_enabled = 0.9 | 1171 local green_alpha_enabled = 0.9 |
| 1138 | 1172 |
| 1139 -- true north -> south | 1173 function f:ChangeDanceBar (facing) |
| 1140 -- false south -> north | 1174 |
| 1175 if (facing == 1 or facing == 2) then --> north or south | |
| 1176 t1_2:Hide() | |
| 1177 t2_2:Hide() | |
| 1178 t3_2:Hide() | |
| 1179 t4_2:Hide() | |
| 1180 middle_2:Hide() | |
| 1181 t1:Show() | |
| 1182 t2:Show() | |
| 1183 t3:Show() | |
| 1184 t4:Show() | |
| 1185 middle:Show() | |
| 1186 | |
| 1187 player_pos_frame2:Hide() | |
| 1188 player_pos_frame:SetBackdropColor (0, 0, 0, 1) | |
| 1189 | |
| 1190 elseif (facing == 3 or facing == 4) then --> west or east | |
| 1191 t1_2:Show() | |
| 1192 t2_2:Show() | |
| 1193 t3_2:Show() | |
| 1194 t4_2:Show() | |
| 1195 middle_2:Show() | |
| 1196 t1:Hide() | |
| 1197 t2:Hide() | |
| 1198 t3:Hide() | |
| 1199 t4:Hide() | |
| 1200 middle:Hide() | |
| 1201 | |
| 1202 player_pos_frame:SetBackdropColor (0, 0, 0, 0) | |
| 1203 player_pos_frame2:Show() | |
| 1204 | |
| 1205 end | |
| 1206 | |
| 1207 end | |
| 1208 | |
| 1141 local track_function = function (self, elapsed) | 1209 local track_function = function (self, elapsed) |
| 1142 | 1210 |
| 1143 local x, _ = GetPlayerMapPosition ("player") | 1211 local x, _ = GetPlayerMapPosition ("player") |
| 1144 local block | 1212 local block |
| 1145 | 1213 |
| 1146 if (db.AUTO_FACING and x) then | 1214 if (db.AUTO_FACING and x) then |
| 1147 local facing = GetPlayerFacing() | 1215 local facing = GetPlayerFacing() |
| 1148 | 1216 |
| 1149 if (self.facing and (facing > 5.3 or facing < 1.053)) then --north -> south -- ~30º tolerance | 1217 -- get 4 directions in radians |
| 1150 self.facing = false | 1218 local current = self.facing |
| 1151 --print ("changing face to south") | 1219 if (facing < 0.7 or facing > 5.6) then --north |
| 1152 elseif (not self.facing and (facing > 2.3 and facing < 4.3)) then --south -> north -- ~30º tolerance | 1220 --print ("north") |
| 1153 self.facing = true | 1221 self.facing = 1 |
| 1154 --print ("changing face to north") | 1222 elseif (facing >= 0.7 and facing < 2.45) then --west |
| 1155 end | 1223 --print ("west") |
| 1224 self.facing = 3 | |
| 1225 elseif (facing > 2.45 and facing < 3.85) then --south | |
| 1226 --print ("south") | |
| 1227 self.facing = 2 | |
| 1228 elseif (facing >= 3.85 and facing <= 5.6) then --east | |
| 1229 --print ("east") | |
| 1230 self.facing = 4 | |
| 1231 end | |
| 1232 | |
| 1233 if (current ~= self.facing) then | |
| 1234 f:ChangeDanceBar (self.facing) | |
| 1235 end | |
| 1236 | |
| 1156 end | 1237 end |
| 1157 | 1238 |
| 1158 if (x) then | 1239 if (x) then |
| 1159 for i = 1, #safe_track do | 1240 for i = 1, #safe_track do |
| 1160 local loc = safe_track [i] | 1241 local loc = safe_track [i] |
| 1168 if (block and safe_track [block]) then | 1249 if (block and safe_track [block]) then |
| 1169 | 1250 |
| 1170 player_pos_frame:Show() | 1251 player_pos_frame:Show() |
| 1171 block = safe_track [block] | 1252 block = safe_track [block] |
| 1172 | 1253 |
| 1254 if (self.facing == 3 or self.facing == 4) then --> west | |
| 1255 player_pos_frame2:Show() | |
| 1256 end | |
| 1257 | |
| 1173 if (x >= block.left.x2 and x <= block.left.x1) then | 1258 if (x >= block.left.x2 and x <= block.left.x1) then |
| 1174 if (self.facing) then | 1259 if (self.facing == 2) then --> south |
| 1175 t2:SetTexture (0.1, 1, 0.1, green_alpha_enabled) | 1260 t2:SetTexture (0.1, 1, 0.1, green_alpha_enabled) |
| 1176 t3:SetTexture (0.2, 1, 0.2, green_alpha_disabled) | 1261 t3:SetTexture (0.2, 1, 0.2, green_alpha_disabled) |
| 1177 else | 1262 elseif (self.facing == 1) then --> north |
| 1178 t3:SetTexture (0.2, 232/255, 1, green_alpha_enabled) | 1263 t3:SetTexture (0.2, 232/255, 1, green_alpha_enabled) |
| 1179 t2:SetTexture (0.2, 232/255, 1, green_alpha_disabled) | 1264 t2:SetTexture (0.2, 232/255, 1, green_alpha_disabled) |
| 1265 elseif (self.facing == 3) then --> west | |
| 1266 t2_2:SetTexture (0.1, 1, 0.1, green_alpha_enabled) | |
| 1267 t3_2:SetTexture (0.2, 1, 0.2, green_alpha_disabled) | |
| 1268 elseif (self.facing == 4) then --> east | |
| 1269 t3_2:SetTexture (0.2, 232/255, 1, green_alpha_enabled) | |
| 1270 t2_2:SetTexture (0.2, 232/255, 1, green_alpha_disabled) | |
| 1180 end | 1271 end |
| 1181 | 1272 |
| 1182 t1:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | 1273 t1:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red |
| 1183 t4:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | 1274 t4:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red |
| 1184 middle:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | 1275 middle:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red |
| 1276 t1_2:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | |
| 1277 t4_2:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | |
| 1278 middle_2:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | |
| 1185 | 1279 |
| 1186 elseif (x <= block.right.x2 and x >= block.right.x1) then | 1280 elseif (x <= block.right.x2 and x >= block.right.x1) then |
| 1187 if (self.facing) then | 1281 if (self.facing == 2) then --> south |
| 1188 t3:SetTexture (0.1, 1, 0.1, green_alpha_enabled) | 1282 t3:SetTexture (0.1, 1, 0.1, green_alpha_enabled) |
| 1189 t2:SetTexture (0.2, 1, 0.2, green_alpha_disabled) | 1283 t2:SetTexture (0.2, 1, 0.2, green_alpha_disabled) |
| 1190 else | 1284 elseif (self.facing == 1) then --> north |
| 1191 t2:SetTexture (0.2, 232/255, 1, green_alpha_enabled) | 1285 t2:SetTexture (0.2, 232/255, 1, green_alpha_enabled) |
| 1192 t3:SetTexture (0.2, 232/255, 1, green_alpha_disabled) | 1286 t3:SetTexture (0.2, 232/255, 1, green_alpha_disabled) |
| 1287 elseif (self.facing == 3) then --> west | |
| 1288 t3_2:SetTexture (0.1, 1, 0.1, green_alpha_enabled) | |
| 1289 t2_2:SetTexture (0.2, 1, 0.2, green_alpha_disabled) | |
| 1290 elseif (self.facing == 4) then --> east | |
| 1291 t2_2:SetTexture (0.2, 232/255, 1, green_alpha_enabled) | |
| 1292 t3_2:SetTexture (0.2, 232/255, 1, green_alpha_disabled) | |
| 1193 end | 1293 end |
| 1194 | 1294 |
| 1195 t1:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | 1295 t1:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red |
| 1196 t4:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | 1296 t4:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red |
| 1197 middle:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | 1297 middle:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red |
| 1298 t1_2:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | |
| 1299 t4_2:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | |
| 1300 middle_2:SetVertexColor (1, 0.2, 0.2, red_alpha_disabled) --red | |
| 1198 | 1301 |
| 1199 else | 1302 else |
| 1200 t1:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red | 1303 t1:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red |
| 1201 t4:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red | 1304 t4:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red |
| 1202 middle:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red | 1305 middle:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red |
| 1306 t1_2:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red | |
| 1307 t4_2:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red | |
| 1308 middle_2:SetVertexColor (1, 0.2, 0.2, red_alpha_enabled) --red | |
| 1203 | 1309 |
| 1204 t2:SetTexture (0.2, 1, 0.2, green_alpha_disabled) | 1310 t2:SetTexture (0.2, 1, 0.2, green_alpha_disabled) |
| 1205 t3:SetTexture (0.2, 1, 0.2, green_alpha_disabled) | 1311 t3:SetTexture (0.2, 1, 0.2, green_alpha_disabled) |
| 1312 t2_2:SetTexture (0.2, 1, 0.2, green_alpha_disabled) | |
| 1313 t3_2:SetTexture (0.2, 1, 0.2, green_alpha_disabled) | |
| 1206 | 1314 |
| 1207 end | 1315 end |
| 1208 | 1316 |
| 1209 --x = x - block.block.x2 | 1317 --x = x - block.block.x2 |
| 1210 --local at = abs ((x / (block.block.x1 - block.block.x2) * 100) - 100) | 1318 --local at = abs ((x / (block.block.x1 - block.block.x2) * 100) - 100) |
| 1213 else | 1321 else |
| 1214 if (f.unlocked_frame) then | 1322 if (f.unlocked_frame) then |
| 1215 player_pos_frame:Show() | 1323 player_pos_frame:Show() |
| 1216 else | 1324 else |
| 1217 player_pos_frame:Hide() | 1325 player_pos_frame:Hide() |
| 1326 player_pos_frame2:Hide() | |
| 1218 end | 1327 end |
| 1219 end | 1328 end |
| 1220 end | 1329 end |
| 1221 | 1330 |
| 1222 function f:StartTrackPlayerPosition() | 1331 function f:StartTrackPlayerPosition() |
| 1226 tframe.facing = db.FACING_SIDE == 1 | 1335 tframe.facing = db.FACING_SIDE == 1 |
| 1227 tframe:SetScript ("OnUpdate", track_function) | 1336 tframe:SetScript ("OnUpdate", track_function) |
| 1228 end | 1337 end |
| 1229 function f:EndTrackPlayerPosition() | 1338 function f:EndTrackPlayerPosition() |
| 1230 player_pos_frame:Hide() | 1339 player_pos_frame:Hide() |
| 1340 player_pos_frame2:Hide() | |
| 1231 tframe:SetScript ("OnUpdate", nil) | 1341 tframe:SetScript ("OnUpdate", nil) |
| 1232 end | 1342 end |
| 1233 | 1343 |
| 1234 local locs = { | 1344 local locs = { |
| 1235 --block 1: | 1345 --block 1: |
