Mercurial > wow > hansgar_and_franzok_assist
comparison Hansgar_And_Franzok_Assist.lua @ 9:070347df4822
- Added stop casting alert for Disrupting Roar.
- Added slash command /hansgar resetpos.
- Unlocking the frames now make all they be shown in the screen.
| author | Tercio |
|---|---|
| date | Sun, 22 Mar 2015 15:59:46 -0300 |
| parents | 3a6b062ecaac |
| children | f1e32be6773e |
comparison
equal
deleted
inserted
replaced
| 8:3a6b062ecaac | 9:070347df4822 |
|---|---|
| 7 local abs = abs | 7 local abs = abs |
| 8 local GetPlayerFacing = GetPlayerFacing | 8 local GetPlayerFacing = GetPlayerFacing |
| 9 | 9 |
| 10 local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent) | 10 local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent) |
| 11 f:SetFrameStrata ("DIALOG") | 11 f:SetFrameStrata ("DIALOG") |
| 12 f.version = "v0.9" | 12 f.version = "v0.10" |
| 13 | 13 |
| 14 local tframe = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_PTrack", UIParent) | 14 local tframe = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_PTrack", UIParent) |
| 15 | 15 |
| 16 f:SetSize (155, 156) | 16 f:SetSize (155, 156) |
| 17 f:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}, | 17 f:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}, |
| 40 | 40 |
| 41 --player_bar:SetPoint ("topleft", f, "bottomleft", 0, -3) | 41 --player_bar:SetPoint ("topleft", f, "bottomleft", 0, -3) |
| 42 --player_bar:SetPoint ("topright", f, "bottomright", 0, -3) | 42 --player_bar:SetPoint ("topright", f, "bottomright", 0, -3) |
| 43 | 43 |
| 44 player_bar:SetPoint ("center", UIParent, "center", 0, 300) | 44 player_bar:SetPoint ("center", UIParent, "center", 0, 300) |
| 45 player_bar:SetSize (280, 22) | 45 player_bar:SetSize (280, 16) |
| 46 | 46 |
| 47 player_bar:SetMovable (true) | 47 player_bar:SetMovable (true) |
| 48 player_bar:EnableMouse (true) | 48 player_bar:EnableMouse (true) |
| 49 player_bar:SetResizable (true) | 49 player_bar:SetResizable (true) |
| 50 player_bar:SetStatusBarColor (0, 0, 0, 0) | 50 player_bar:SetStatusBarColor (0, 0, 0, 0) |
| 118 --player_pos_frame:SetPoint ("topright", player_bar, "bottomright", 0, -3) | 118 --player_pos_frame:SetPoint ("topright", player_bar, "bottomright", 0, -3) |
| 119 | 119 |
| 120 player_pos_frame:SetPoint ("center", UIParent, "center", 0, -75) | 120 player_pos_frame:SetPoint ("center", UIParent, "center", 0, -75) |
| 121 | 121 |
| 122 player_pos_frame:SetSize (155, 6) | 122 player_pos_frame:SetSize (155, 6) |
| 123 player_pos_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16}) | 123 player_pos_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}}) |
| 124 player_pos_frame:SetBackdropColor (0, 0, 0, 0.4) | 124 player_pos_frame:SetBackdropColor (0, 0, 0, 1) |
| 125 player_pos_frame:SetMovable (true) | 125 player_pos_frame:SetMovable (true) |
| 126 player_pos_frame:EnableMouse (true) | 126 player_pos_frame:EnableMouse (true) |
| 127 player_pos_frame:SetScript ("OnMouseDown", function (self) | 127 player_pos_frame:SetScript ("OnMouseDown", function (self) |
| 128 if (not self.isMoving) then | 128 if (not self.isMoving) then |
| 129 self:StartMoving() | 129 self:StartMoving() |
| 276 db.SHOW_MAIN_FRAME = true | 276 db.SHOW_MAIN_FRAME = true |
| 277 end | 277 end |
| 278 if (db.PLAY_SOUND == nil) then | 278 if (db.PLAY_SOUND == nil) then |
| 279 db.PLAY_SOUND = false | 279 db.PLAY_SOUND = false |
| 280 end | 280 end |
| 281 if (db.STOP_CAST == nil) then | |
| 282 db.STOP_CAST = true | |
| 283 end | |
| 281 -- | 284 -- |
| 282 | 285 |
| 283 f:SetLockState (true) | 286 f:SetLockState (true) |
| 284 | 287 |
| 285 elseif (event == "ENCOUNTER_START" or event == "ENCOUNTER_END") then | 288 elseif (event == "ENCOUNTER_START" or event == "ENCOUNTER_END") then |
| 286 | 289 |
| 287 local encounterID, encounterName, difficultyID, raidSize = select (1, ...) | 290 local encounterID, encounterName, difficultyID, raidSize = select (1, ...) |
| 288 | 291 |
| 289 if (encounterID == 1693) then | 292 if (encounterID == 1693) then |
| 293 if (f.unlocked_frame) then | |
| 294 f.unlocked_frame = false | |
| 295 end | |
| 296 | |
| 290 if (event == "ENCOUNTER_START") then | 297 if (event == "ENCOUNTER_START") then |
| 291 f.on_encounter = true | 298 f.on_encounter = true |
| 299 f:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") | |
| 300 | |
| 292 elseif (event == "ENCOUNTER_END") then | 301 elseif (event == "ENCOUNTER_END") then |
| 293 f.on_encounter = false | 302 f.on_encounter = false |
| 303 f:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") | |
| 294 end | 304 end |
| 295 end | 305 end |
| 296 | 306 |
| 297 if (encounterID == 1693 and db.SHOW_DANCE) then | 307 if (encounterID == 1693 and db.SHOW_DANCE) then |
| 298 if (event == "ENCOUNTER_START") then | 308 if (event == "ENCOUNTER_START") then |
| 304 end | 314 end |
| 305 | 315 |
| 306 if (encounterID == 1693 and difficultyID == 16) then | 316 if (encounterID == 1693 and difficultyID == 16) then |
| 307 | 317 |
| 308 if (event == "ENCOUNTER_START") then | 318 if (event == "ENCOUNTER_START") then |
| 309 | |
| 310 print ("|cFFFFAA00Hansgar and Franzok Assist|r: addon enabled, good look!") | 319 print ("|cFFFFAA00Hansgar and Franzok Assist|r: addon enabled, good look!") |
| 311 | 320 |
| 312 if (f.StampersPhase) then | 321 if (f.StampersPhase) then |
| 313 f:StopTracking() | 322 f:StopTracking() |
| 314 end | 323 end |
| 315 f:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") | |
| 316 | 324 |
| 317 elseif (event == "ENCOUNTER_END") then | 325 elseif (event == "ENCOUNTER_END") then |
| 318 f:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") | |
| 319 | |
| 320 if (f.StampersPhase) then | 326 if (f.StampersPhase) then |
| 321 f:StopTracking() | 327 f:StopTracking() |
| 322 end | 328 end |
| 323 | 329 |
| 324 f:EndTrackPlayerPosition() | 330 f:EndTrackPlayerPosition() |
| 343 print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...") | 349 print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...") |
| 344 else | 350 else |
| 345 print ("|cFFFFAA00Hansgar and Franzok Assist|r you aren't in a raid group.") | 351 print ("|cFFFFAA00Hansgar and Franzok Assist|r you aren't in a raid group.") |
| 346 end | 352 end |
| 347 | 353 |
| 354 elseif (command == "stopcast") then | |
| 355 db.STOP_CAST = not db.STOP_CAST | |
| 356 | |
| 357 if (db.STOP_CAST) then | |
| 358 print ("|cFFFFAA00Hansgar and Franzok Assist|r stop cast alert enabled.") | |
| 359 Hansgar_And_Franzok_AssistStopCasting:Show(); Hansgar_And_Franzok_Assist:ScheduleTimer ("HideStopSpellAlert", 1) | |
| 360 else | |
| 361 print ("|cFFFFAA00Hansgar and Franzok Assist|r stop cast alert disabled.") | |
| 362 end | |
| 363 | |
| 364 elseif (command == "resetpos") then | |
| 365 f:ClearAllPoints() | |
| 366 f:SetPoint ("center", UIParent, "center") | |
| 367 | |
| 368 player_bar:ClearAllPoints() | |
| 369 player_bar:SetPoint ("center", UIParent, "center") | |
| 370 | |
| 371 player_pos_frame:ClearAllPoints() | |
| 372 player_pos_frame:SetPoint ("center", UIParent, "center") | |
| 373 | |
| 374 if (f.StampersPhase) then | |
| 375 f:EndTrackPlayerPosition() | |
| 376 f:StopTracking() | |
| 377 end | |
| 378 | |
| 379 db.FRAME_LOCK = true | |
| 380 f:SetLockState() | |
| 381 | |
| 382 f.unlocked_frame = true | |
| 383 | |
| 384 f:StartTracking() | |
| 385 f:StartTrackPlayerPosition() | |
| 386 | |
| 387 print ("|cFFFFAA00Hansgar and Franzok Assist|r: position reseted.") | |
| 388 print ("|cFFFFAA00Hansgar and Franzok Assist|r: move between the tracks to show the other frames.") | |
| 389 print ("|cFFFFAA00Hansgar and Franzok Assist|r: type '/hansgar lock' to lock the frames.") | |
| 390 | |
| 348 elseif (command == "delay") then | 391 elseif (command == "delay") then |
| 349 local t = tonumber (rest) | 392 local t = tonumber (rest) |
| 350 if (t) then | 393 if (t) then |
| 351 db.STAMPERS_DELAY = t | 394 db.STAMPERS_DELAY = t |
| 352 print ("|cFFFFAA00Hansgar and Franzok Assist|r delay set to: ", t) | 395 print ("|cFFFFAA00Hansgar and Franzok Assist|r delay set to: ", t) |
| 371 | 414 |
| 372 elseif (command == "unlock") then | 415 elseif (command == "unlock") then |
| 373 db.FRAME_LOCK = true | 416 db.FRAME_LOCK = true |
| 374 f:SetLockState() | 417 f:SetLockState() |
| 375 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") | 418 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") |
| 419 | |
| 420 f.unlocked_frame = true | |
| 421 player_pos_frame:Show() | |
| 422 player_bar:Show() | |
| 376 | 423 |
| 377 elseif (command == "lock") then | 424 elseif (command == "lock") then |
| 378 f:SetLockState() | 425 f:SetLockState() |
| 379 | 426 |
| 380 if (db.FRAME_LOCK) then | 427 if (db.FRAME_LOCK) then |
| 381 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.") | 428 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.") |
| 429 f.unlocked_frame = false | |
| 382 else | 430 else |
| 383 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") | 431 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") |
| 432 | |
| 433 f.unlocked_frame = true | |
| 434 player_pos_frame:Show() | |
| 435 player_bar:Show() | |
| 436 | |
| 384 end | 437 end |
| 385 | 438 |
| 386 elseif (command == "facing") then | 439 elseif (command == "facing") then |
| 387 if (rest == "1") then | 440 if (rest == "1") then |
| 388 db.FACING_SIDE = 1 | 441 db.FACING_SIDE = 1 |
| 427 db.CD_NUMBER = not db.CD_NUMBER | 480 db.CD_NUMBER = not db.CD_NUMBER |
| 428 f:RefreshCooldownSettings() | 481 f:RefreshCooldownSettings() |
| 429 | 482 |
| 430 else | 483 else |
| 431 print ("|cFFFFAA00Hansgar and Franzok Assist|r |cFF00FF00" .. f.version .. "|r Commands:") | 484 print ("|cFFFFAA00Hansgar and Franzok Assist|r |cFF00FF00" .. f.version .. "|r Commands:") |
| 485 print ("|cFFFFFF00/hansgar resetpos|r: reset the position of all frames.") | |
| 432 print ("|cFFFFFF00/hansgar lock|r: toggle lock and unlock on the frame.") | 486 print ("|cFFFFFF00/hansgar lock|r: toggle lock and unlock on the frame.") |
| 433 print ("|cFFFFFF00/hansgar test show hide|r: active the addon on test mode or hide it.") | 487 print ("|cFFFFFF00/hansgar test show hide|r: active the addon on test mode or hide it.") |
| 434 print ("|cFFFFFF00/hansgar delay <time>|r: time in seconds until the percentage goes from 0 to 100.") | 488 print ("|cFFFFFF00/hansgar delay <time>|r: time in seconds until the percentage goes from 0 to 100.") |
| 435 print ("|cFFFFFF00/hansgar dance|r: toggle dance bar (used to dodge regular stampers and searing plates).") | 489 print ("|cFFFFFF00/hansgar dance|r: toggle dance bar (used to dodge regular stampers and searing plates).") |
| 436 print ("|cFFFFFF00/hansgar autofacing|r: toggle if the dance bar auto switch left and right when looking to north or south.") | 490 print ("|cFFFFFF00/hansgar autofacing|r: toggle if the dance bar auto switch left and right when looking to north or south.") |
| 437 print ("|cFFFFFF00/hansgar facing|r: |cFF00FF001|r = south |cFF00FF002|r = north, use to set the dance bar when auto facing is disabled.") | 491 print ("|cFFFFFF00/hansgar facing|r: |cFF00FF001|r = south |cFF00FF002|r = north, use to set the dance bar when auto facing is disabled.") |
| 438 print ("|cFFFFFF00/hansgar users|r: show who is using the addon in the raid.") | 492 print ("|cFFFFFF00/hansgar users|r: show who is using the addon in the raid.") |
| 439 print ("|cFFFFFF00/hansgar cooldown|r: show the countdown text for each stamper go back up to the ceiling.") | 493 print ("|cFFFFFF00/hansgar cooldown|r: show the countdown text for each stamper go back up to the ceiling.") |
| 494 print ("|cFFFFFF00/hansgar stopcast|r: show the alert to stop casting for Disrupting Roar.") | |
| 440 end | 495 end |
| 441 end | 496 end |
| 442 | 497 |
| 443 -- | 498 -- |
| 444 --f:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") | 499 |
| 445 | 500 local stop_casting_frame = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCasting", UIParent, "ActionBarButtonSpellActivationAlert") |
| 446 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, ...) | 501 stop_casting_frame:SetSize (200, 30) |
| 502 stop_casting_frame:SetPoint ("center", UIParent, "center", 0, 75) | |
| 503 stop_casting_frame:SetFrameStrata ("FULLSCREEN") | |
| 504 stop_casting_frame:Hide() | |
| 505 stop_casting_frame:SetScript ("OnShow", function (self) | |
| 506 self.animOut:Stop() | |
| 507 self.animIn:Play() | |
| 508 end) | |
| 509 stop_casting_frame:SetScript ("OnHide", function (self) | |
| 510 self.animIn:Stop() | |
| 511 self.animOut:Play() | |
| 512 end) | |
| 513 | |
| 514 local text = stop_casting_frame:CreateFontString (nil, "overlay", "GameFontNormal") | |
| 515 text:SetText ("STOP CASTING!") | |
| 516 text:SetPoint ("center", stop_casting_frame, "center") | |
| 517 | |
| 518 stop_casting_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16}) | |
| 519 stop_casting_frame:SetBackdropColor (0, 0, 0, 0) | |
| 520 | |
| 521 function f:HideStopSpellAlert() | |
| 522 stop_casting_frame.animIn:Stop() | |
| 523 stop_casting_frame.animOut:Play() | |
| 524 f:ScheduleTimer ("HideStopSpellAlert2", 0.9) | |
| 525 end | |
| 526 function f:HideStopSpellAlert2() | |
| 527 stop_casting_frame:Hide() | |
| 528 end | |
| 529 | |
| 530 --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 | |
| 531 | |
| 532 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) | |
| 447 | 533 |
| 448 if (token == "SPELL_AURA_APPLIED" and spellid == 162124 and not f.StampersPhase) then | 534 if (token == "SPELL_AURA_APPLIED" and spellid == 162124 and not f.StampersPhase) then |
| 449 f:StartTracking() | 535 f:StartTracking() |
| 450 f:EndTrackPlayerPosition() | 536 f:EndTrackPlayerPosition() |
| 451 | 537 |
| 453 f:StopTracking() | 539 f:StopTracking() |
| 454 if (db.SHOW_DANCE) then | 540 if (db.SHOW_DANCE) then |
| 455 f:StartTrackPlayerPosition() | 541 f:StartTrackPlayerPosition() |
| 456 end | 542 end |
| 457 | 543 |
| 458 end | 544 elseif (token == "SPELL_CAST_START" and spellid == 160838 and db.STOP_CAST) then --Disrupting Roar |
| 545 stop_casting_frame:Show() | |
| 546 f:ScheduleTimer ("HideStopSpellAlert", 0.9) | |
| 547 end | |
| 548 | |
| 549 if (token == "SPELL_INTERRUPT" and spellid == 160838 and db.STOP_CAST) then | |
| 550 local link = GetSpellLink (buff_type) | |
| 551 print ("Stop Cast Fail:", target_name, link) | |
| 552 end | |
| 553 | |
| 554 --if (spellid == 160838) then | |
| 555 -- print ("event:", token, 160838, db.STOP_CAST) | |
| 556 --end | |
| 459 | 557 |
| 460 end) | 558 end) |
| 559 | |
| 560 --Hansgar_And_Franzok_AssistStopCasting:Show(); Hansgar_And_Franzok_Assist:ScheduleTimer ("HideStopSpellAlert", 1) | |
| 561 --Hansgar_And_Franzok_Assist:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") | |
| 461 | 562 |
| 462 local frame_tracker = CreateFrame ("frame", "Hansgar_And_Franzok_AssistTracker", UIParent) | 563 local frame_tracker = CreateFrame ("frame", "Hansgar_And_Franzok_AssistTracker", UIParent) |
| 463 local on_update_tracker = function (self, elapsed) | 564 local on_update_tracker = function (self, elapsed) |
| 464 | 565 |
| 465 local raid_size = GetNumGroupMembers() | 566 local raid_size = GetNumGroupMembers() |
| 496 local block_frame = f.all_blocks [player_block] | 597 local block_frame = f.all_blocks [player_block] |
| 497 f.player_loc_box:SetPoint ("center", block_frame, "center") | 598 f.player_loc_box:SetPoint ("center", block_frame, "center") |
| 498 f.player_loc_box:Show() | 599 f.player_loc_box:Show() |
| 499 | 600 |
| 500 else | 601 else |
| 501 f.player_loc_box:Hide() | 602 if (f.unlocked_frame) then |
| 502 f.player_bar:Hide() | 603 f.player_loc_box:Show() |
| 604 f.player_bar:Show() | |
| 605 f.player_bar:SetValue (100) | |
| 606 else | |
| 607 f.player_loc_box:Hide() | |
| 608 f.player_bar:Hide() | |
| 609 end | |
| 503 end | 610 end |
| 504 end | 611 end |
| 505 | 612 |
| 506 function f:StartTracking() | 613 function f:StartTracking() |
| 507 | 614 |
| 775 local green_alpha_disabled = 0.05 | 882 local green_alpha_disabled = 0.05 |
| 776 local green_alpha_enabled = 0.9 | 883 local green_alpha_enabled = 0.9 |
| 777 | 884 |
| 778 -- true north -> south | 885 -- true north -> south |
| 779 -- false south -> north | 886 -- false south -> north |
| 780 function f:ChangePlayerTrackerFace() | |
| 781 | |
| 782 end | |
| 783 | |
| 784 local track_function = function (self, elapsed) | 887 local track_function = function (self, elapsed) |
| 785 | 888 |
| 786 local x, _ = GetPlayerMapPosition ("player") | 889 local x, _ = GetPlayerMapPosition ("player") |
| 787 local block | 890 local block |
| 788 | 891 |
| 852 --x = x - block.block.x2 | 955 --x = x - block.block.x2 |
| 853 --local at = abs ((x / (block.block.x1 - block.block.x2) * 100) - 100) | 956 --local at = abs ((x / (block.block.x1 - block.block.x2) * 100) - 100) |
| 854 --div:SetPoint ("left", player_pos_frame, "left", self.width_pixel * at, 0) | 957 --div:SetPoint ("left", player_pos_frame, "left", self.width_pixel * at, 0) |
| 855 | 958 |
| 856 else | 959 else |
| 857 player_pos_frame:Hide() | 960 if (f.unlocked_frame) then |
| 961 player_pos_frame:Show() | |
| 962 else | |
| 963 player_pos_frame:Hide() | |
| 964 end | |
| 858 end | 965 end |
| 859 end | 966 end |
| 860 | 967 |
| 861 function f:StartTrackPlayerPosition() | 968 function f:StartTrackPlayerPosition() |
| 862 player_pos_frame:Show() | 969 player_pos_frame:Show() |
