comparison Hansgar_And_Franzok_Assist.lua @ 10:f1e32be6773e

- fixed stop casting alert.
author Tercio
date Mon, 06 Apr 2015 19:41:32 -0300
parents 070347df4822
children 2f09fe4be15c
comparison
equal deleted inserted replaced
9:070347df4822 10:f1e32be6773e
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.10" 12 f.version = "v0.11"
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},
349 print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...") 349 print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...")
350 else 350 else
351 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.")
352 end 352 end
353 353
354 elseif (command == "st") then
355 f.stop_casting_frame:Show()
356 f.stop_casting_frame.alert.animOut:Stop()
357 f.stop_casting_frame.alert.animIn:Play()
358 f:ScheduleTimer ("HideStopSpellAlert", 1.2)
359
354 elseif (command == "stopcast") then 360 elseif (command == "stopcast") then
355 db.STOP_CAST = not db.STOP_CAST 361 db.STOP_CAST = not db.STOP_CAST
356 362
357 if (db.STOP_CAST) then 363 if (db.STOP_CAST) then
358 print ("|cFFFFAA00Hansgar and Franzok Assist|r stop cast alert enabled.") 364 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 365 else
361 print ("|cFFFFAA00Hansgar and Franzok Assist|r stop cast alert disabled.") 366 print ("|cFFFFAA00Hansgar and Franzok Assist|r stop cast alert disabled.")
362 end 367 end
363 368
364 elseif (command == "resetpos") then 369 elseif (command == "resetpos") then
418 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") 423 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.")
419 424
420 f.unlocked_frame = true 425 f.unlocked_frame = true
421 player_pos_frame:Show() 426 player_pos_frame:Show()
422 player_bar:Show() 427 player_bar:Show()
428 f.stop_casting_frame:Show()
423 429
424 elseif (command == "lock") then 430 elseif (command == "lock") then
425 f:SetLockState() 431 f:SetLockState()
426 432
427 if (db.FRAME_LOCK) then 433 if (db.FRAME_LOCK) then
428 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.") 434 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.")
429 f.unlocked_frame = false 435 f.unlocked_frame = false
436 f.stop_casting_frame:Hide()
430 else 437 else
431 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") 438 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.")
432 439
433 f.unlocked_frame = true 440 f.unlocked_frame = true
434 player_pos_frame:Show() 441 player_pos_frame:Show()
435 player_bar:Show() 442 player_bar:Show()
443 f.stop_casting_frame:Show()
436 444
437 end 445 end
438 446
439 elseif (command == "facing") then 447 elseif (command == "facing") then
440 if (rest == "1") then 448 if (rest == "1") then
495 end 503 end
496 end 504 end
497 505
498 -- 506 --
499 507
500 local stop_casting_frame = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCasting", UIParent, "ActionBarButtonSpellActivationAlert") 508 local stop_casting_frame = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCasting", UIParent)
501 stop_casting_frame:SetSize (200, 30) 509 stop_casting_frame:SetSize (200, 30)
502 stop_casting_frame:SetPoint ("center", UIParent, "center", 0, 75) 510 stop_casting_frame:SetPoint ("center", UIParent, "center", 0, 75)
503 stop_casting_frame:SetFrameStrata ("FULLSCREEN") 511 stop_casting_frame:SetFrameStrata ("FULLSCREEN")
512 f.stop_casting_frame = stop_casting_frame
504 stop_casting_frame:Hide() 513 stop_casting_frame:Hide()
505 stop_casting_frame:SetScript ("OnShow", function (self) 514
506 self.animOut:Stop() 515 stop_casting_frame:SetMovable (false)
507 self.animIn:Play() 516 stop_casting_frame:EnableMouse (false)
517
518 stop_casting_frame:SetScript ("OnMouseDown", function (self)
519 if (not self.isMoving) then
520 self:StartMoving()
521 self.isMoving = true
522 end
508 end) 523 end)
509 stop_casting_frame:SetScript ("OnHide", function (self) 524 stop_casting_frame:SetScript ("OnMouseUp", function (self)
510 self.animIn:Stop() 525 if (self.isMoving) then
511 self.animOut:Play() 526 self:StopMovingOrSizing()
527 self.isMoving = false
528 end
512 end) 529 end)
530
531 local alert = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCastingAlert", stop_casting_frame, "ActionBarButtonSpellActivationAlert")
532 alert:SetPoint ("topleft", stop_casting_frame, "topleft", -10, 2)
533 alert:SetPoint ("bottomright", stop_casting_frame, "bottomright", 10, -2)
534 stop_casting_frame.alert = alert
513 535
514 local text = stop_casting_frame:CreateFontString (nil, "overlay", "GameFontNormal") 536 local text = stop_casting_frame:CreateFontString (nil, "overlay", "GameFontNormal")
515 text:SetText ("STOP CASTING!") 537 text:SetText ("STOP CASTING!")
516 text:SetPoint ("center", stop_casting_frame, "center") 538 text:SetPoint ("center", stop_casting_frame, "center")
517 539
518 stop_casting_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16}) 540 stop_casting_frame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
519 stop_casting_frame:SetBackdropColor (0, 0, 0, 0) 541 stop_casting_frame:SetBackdropColor (0, 0, 0, 0.3)
520 542
543 function f:HideStopSpellAlert2()
544 stop_casting_frame.alert.animOut:Stop()
545 stop_casting_frame:Hide()
546 end
521 function f:HideStopSpellAlert() 547 function f:HideStopSpellAlert()
522 stop_casting_frame.animIn:Stop() 548 stop_casting_frame.alert.animIn:Stop()
523 stop_casting_frame.animOut:Play() 549 stop_casting_frame.alert.animOut:Play()
524 f:ScheduleTimer ("HideStopSpellAlert2", 0.9) 550 f:ScheduleTimer ("HideStopSpellAlert2", 0.3)
525 end
526 function f:HideStopSpellAlert2()
527 stop_casting_frame:Hide()
528 end 551 end
529 552
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 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
531 554
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) 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)
540 if (db.SHOW_DANCE) then 563 if (db.SHOW_DANCE) then
541 f:StartTrackPlayerPosition() 564 f:StartTrackPlayerPosition()
542 end 565 end
543 566
544 elseif (token == "SPELL_CAST_START" and spellid == 160838 and db.STOP_CAST) then --Disrupting Roar 567 elseif (token == "SPELL_CAST_START" and spellid == 160838 and db.STOP_CAST) then --Disrupting Roar
545 stop_casting_frame:Show() 568 f.stop_casting_frame:Show()
546 f:ScheduleTimer ("HideStopSpellAlert", 0.9) 569 f.stop_casting_frame.alert.animOut:Stop()
570 f.stop_casting_frame.alert.animIn:Play()
571 f:ScheduleTimer ("HideStopSpellAlert", 1.2)
572
547 end 573 end
548 574
549 if (token == "SPELL_INTERRUPT" and spellid == 160838 and db.STOP_CAST) then 575 if (token == "SPELL_INTERRUPT" and spellid == 160838 and db.STOP_CAST) then
550 local link = GetSpellLink (buff_type) 576 local link = GetSpellLink (buff_type)
551 print ("Stop Cast Fail:", target_name, link) 577 print ("Stop Cast Fail:", target_name, link)
554 --if (spellid == 160838) then 580 --if (spellid == 160838) then
555 -- print ("event:", token, 160838, db.STOP_CAST) 581 -- print ("event:", token, 160838, db.STOP_CAST)
556 --end 582 --end
557 583
558 end) 584 end)
585 -- /run Hansgar_And_Franzok_AssistStopCastingAlert.animIn:Play()
559 586
560 --Hansgar_And_Franzok_AssistStopCasting:Show(); Hansgar_And_Franzok_Assist:ScheduleTimer ("HideStopSpellAlert", 1) 587 --Hansgar_And_Franzok_AssistStopCasting:Show(); Hansgar_And_Franzok_Assist:ScheduleTimer ("HideStopSpellAlert", 1)
561 --Hansgar_And_Franzok_Assist:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") 588 --Hansgar_And_Franzok_Assist:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
562 589
563 local frame_tracker = CreateFrame ("frame", "Hansgar_And_Franzok_AssistTracker", UIParent) 590 local frame_tracker = CreateFrame ("frame", "Hansgar_And_Franzok_AssistTracker", UIParent)
740 if (db.FRAME_LOCK) then 767 if (db.FRAME_LOCK) then
741 --locked 768 --locked
742 f:EnableMouse (false) 769 f:EnableMouse (false)
743 player_bar:EnableMouse (false) 770 player_bar:EnableMouse (false)
744 player_pos_frame:EnableMouse (false) 771 player_pos_frame:EnableMouse (false)
772 stop_casting_frame:SetMovable (false)
773 stop_casting_frame:EnableMouse (false)
745 774
746 for _, block in ipairs (f.all_blocks) do 775 for _, block in ipairs (f.all_blocks) do
747 block:EnableMouse (false) 776 block:EnableMouse (false)
748 end 777 end
749 778
750 if (f.StampersPhase and not just_refresh) then 779 if (f.StampersPhase and not just_refresh) then
751 f:EndTrackPlayerPosition() 780 f:EndTrackPlayerPosition()
752 f:StopTracking() 781 f:StopTracking()
753 end 782 end
783
754 else 784 else
755 --unlocked 785 --unlocked
756 f:EnableMouse (true) 786 f:EnableMouse (true)
757 player_bar:EnableMouse (true) 787 player_bar:EnableMouse (true)
758 player_pos_frame:EnableMouse (true) 788 player_pos_frame:EnableMouse (true)
789 stop_casting_frame:SetMovable (true)
790 stop_casting_frame:EnableMouse (true)
759 791
760 for _, block in ipairs (f.all_blocks) do 792 for _, block in ipairs (f.all_blocks) do
761 block:EnableMouse (true) 793 block:EnableMouse (true)
762 end 794 end
763 795
764 if (not f.StampersPhase and not just_refresh) then 796 if (not f.StampersPhase and not just_refresh) then
765 f:StartTracking() 797 f:StartTracking()
766 f:StartTrackPlayerPosition() 798 f:StartTrackPlayerPosition()
767 end 799 end
800
768 end 801 end
769 802
770 if (not db.FRAME_LOCK) then 803 if (not db.FRAME_LOCK) then
771 player_bar.grip:Show() 804 player_bar.grip:Show()
772 else 805 else