Mercurial > wow > hansgar_and_franzok_assist
comparison Hansgar_And_Franzok_Assist.lua @ 11:2f09fe4be15c
Added an Options Panel.
| author | Tercio |
|---|---|
| date | Mon, 20 Apr 2015 16:34:18 -0300 |
| parents | f1e32be6773e |
| children | 6dd01dcec75e |
comparison
equal
deleted
inserted
replaced
| 10:f1e32be6773e | 11:2f09fe4be15c |
|---|---|
| 1 | |
| 2 local DF = _G ["DetailsFramework"] | |
| 3 if (not DF) then | |
| 4 print ("|cFFFFAA00Please restart your client to finish update some AddOns.|c") | |
| 5 return | |
| 6 end | |
| 7 | |
| 1 local floor = floor | 8 local floor = floor |
| 2 local min = min | 9 local min = min |
| 3 local UnitExists = UnitExists | 10 local UnitExists = UnitExists |
| 4 local GetPlayerMapPosition = GetPlayerMapPosition | 11 local GetPlayerMapPosition = GetPlayerMapPosition |
| 5 local UnitHealth = UnitHealth | 12 local UnitHealth = UnitHealth |
| 6 local GetNumGroupMembers = GetNumGroupMembers | 13 local GetNumGroupMembers = GetNumGroupMembers |
| 7 local abs = abs | 14 local abs = abs |
| 8 local GetPlayerFacing = GetPlayerFacing | 15 local GetPlayerFacing = GetPlayerFacing |
| 9 | 16 local db |
| 10 local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent) | 17 local _ |
| 18 | |
| 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") -- | |
| 11 f:SetFrameStrata ("DIALOG") | 21 f:SetFrameStrata ("DIALOG") |
| 12 f.version = "v0.11" | 22 f.version = "v0.12" |
| 23 | |
| 24 f.Close:SetScript ("OnClick", function (self) | |
| 25 if (f.StampersPhase) then | |
| 26 return f:StopTracking() | |
| 27 end | |
| 28 f:EndTrackPlayerPosition() | |
| 29 end) | |
| 30 | |
| 31 f.Lock:SetScript ("OnClick", function (self) | |
| 32 if (db.FRAME_LOCK) then | |
| 33 f:SetLockState() | |
| 34 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") | |
| 35 | |
| 36 f.unlocked_frame = true | |
| 37 f.player_pos_frame:Show() | |
| 38 f.player_bar:Show() | |
| 39 f.stop_casting_frame:Show() | |
| 40 else | |
| 41 f:SetLockState() | |
| 42 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.") | |
| 43 f.unlocked_frame = false | |
| 44 f.stop_casting_frame:Hide() | |
| 45 end | |
| 46 end) | |
| 13 | 47 |
| 14 local tframe = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_PTrack", UIParent) | 48 local tframe = CreateFrame ("frame", "Hansgar_And_Franzok_Assist_PTrack", UIParent) |
| 15 | 49 |
| 16 f:SetSize (155, 156) | 50 f:SetSize (155, 159) |
| 17 f:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}, | 51 f:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = {left = -1, right = -1, top = -1, bottom = -1}, |
| 18 edgeFile = "Interface\\AddOns\\Hansgar_And_Franzok_Assist\\border_2", edgeSize = 8}) | 52 edgeFile = "Interface\\AddOns\\Hansgar_And_Franzok_Assist\\border_2", edgeSize = 8}) |
| 19 f:SetPoint ("center", UIParent, "center", 300, 200) | 53 f:SetPoint ("center", UIParent, "center", 300, 200) |
| 20 f:SetBackdropColor (0, 0, 0, 0) | 54 f:SetBackdropColor (0, 0, 0, 0) |
| 21 f:SetBackdropBorderColor (0, 0, 0, 1) | 55 f:SetBackdropBorderColor (0, 0, 0, 1) |
| 22 f:SetMovable (true) | 56 f:SetMovable (true) |
| 23 f:EnableMouse (true) | 57 f:EnableMouse (true) |
| 24 f.all_blocks = {} | 58 f.all_blocks = {} |
| 25 f:Hide() | 59 f:Hide() |
| 26 | 60 |
| 27 local title = f:CreateFontString (nil, "overlay", "GameFontNormal") | 61 --local title = f:CreateFontString (nil, "overlay", "GameFontNormal") |
| 28 title:SetText ("Hansgar & Franzok Assist") | 62 --title:SetText ("Hansgar & Franzok Assist") |
| 29 title:SetPoint ("center", f, "center") | 63 --title:SetPoint ("center", f, "center") |
| 30 title:SetPoint ("bottom", f, "top", 0, 2) | 64 --title:SetPoint ("bottom", f, "top", 0, 2) |
| 31 | 65 |
| 32 -- | 66 -- |
| 33 local frame_event = CreateFrame ("frame", "Hansgar_And_Franzok_AssistEvents", f) | 67 local frame_event = CreateFrame ("frame", "Hansgar_And_Franzok_AssistEvents", f) |
| 34 frame_event:RegisterEvent ("ENCOUNTER_START") | 68 frame_event:RegisterEvent ("ENCOUNTER_START") |
| 35 frame_event:RegisterEvent ("ENCOUNTER_END") | 69 frame_event:RegisterEvent ("ENCOUNTER_END") |
| 135 self:StopMovingOrSizing() | 169 self:StopMovingOrSizing() |
| 136 self.isMoving = false | 170 self.isMoving = false |
| 137 end | 171 end |
| 138 end) | 172 end) |
| 139 player_pos_frame:Hide() | 173 player_pos_frame:Hide() |
| 174 f.player_pos_frame = player_pos_frame | |
| 140 | 175 |
| 141 --red | 176 --red |
| 142 local t1 = player_pos_frame:CreateTexture (nil, "artwork") | 177 local t1 = player_pos_frame:CreateTexture (nil, "artwork") |
| 143 t1:SetPoint ("left", player_pos_frame, "left") | 178 t1:SetPoint ("left", player_pos_frame, "left") |
| 144 t1:SetSize (player_pos_frame:GetWidth()*0.30, 6) | 179 t1:SetSize (player_pos_frame:GetWidth()*0.30, 6) |
| 238 f.users_schedule = nil | 273 f.users_schedule = nil |
| 239 | 274 |
| 240 end | 275 end |
| 241 f:RegisterComm ("HAFR", "CommReceived") | 276 f:RegisterComm ("HAFR", "CommReceived") |
| 242 | 277 |
| 243 local db | |
| 244 | |
| 245 f.block_tracker = {} | 278 f.block_tracker = {} |
| 246 | 279 |
| 247 frame_event:SetFrameStrata ("FULLSCREEN") | 280 frame_event:SetFrameStrata ("FULLSCREEN") |
| 248 | 281 |
| 249 frame_event:SetScript ("OnEvent", function (self, event, ...) | 282 frame_event:SetScript ("OnEvent", function (self, event, ...) |
| 487 elseif (command == "cooldown") then | 520 elseif (command == "cooldown") then |
| 488 db.CD_NUMBER = not db.CD_NUMBER | 521 db.CD_NUMBER = not db.CD_NUMBER |
| 489 f:RefreshCooldownSettings() | 522 f:RefreshCooldownSettings() |
| 490 | 523 |
| 491 else | 524 else |
| 525 | |
| 526 if (f.StampersPhase) then | |
| 527 f:EndTrackPlayerPosition() | |
| 528 return f:StopTracking() | |
| 529 end | |
| 530 | |
| 531 f:StartTracking() | |
| 532 f:StartTrackPlayerPosition() | |
| 533 | |
| 492 print ("|cFFFFAA00Hansgar and Franzok Assist|r |cFF00FF00" .. f.version .. "|r Commands:") | 534 print ("|cFFFFAA00Hansgar and Franzok Assist|r |cFF00FF00" .. f.version .. "|r Commands:") |
| 493 print ("|cFFFFFF00/hansgar resetpos|r: reset the position of all frames.") | 535 print ("|cFFFFFF00/hansgar resetpos|r: reset the position of all frames.") |
| 494 print ("|cFFFFFF00/hansgar lock|r: toggle lock and unlock on the frame.") | 536 print ("|cFFFFFF00/hansgar lock|r: toggle lock and unlock on the frame.") |
| 495 print ("|cFFFFFF00/hansgar test show hide|r: active the addon on test mode or hide it.") | 537 print ("|cFFFFFF00/hansgar test show hide|r: active the addon on test mode or hide it.") |
| 496 print ("|cFFFFFF00/hansgar delay <time>|r: time in seconds until the percentage goes from 0 to 100.") | 538 print ("|cFFFFFF00/hansgar delay <time>|r: time in seconds until the percentage goes from 0 to 100.") |
| 501 print ("|cFFFFFF00/hansgar cooldown|r: show the countdown text for each stamper go back up to the ceiling.") | 543 print ("|cFFFFFF00/hansgar cooldown|r: show the countdown text for each stamper go back up to the ceiling.") |
| 502 print ("|cFFFFFF00/hansgar stopcast|r: show the alert to stop casting for Disrupting Roar.") | 544 print ("|cFFFFFF00/hansgar stopcast|r: show the alert to stop casting for Disrupting Roar.") |
| 503 end | 545 end |
| 504 end | 546 end |
| 505 | 547 |
| 548 -- | |
| 549 | |
| 550 local options_panel = { | |
| 551 { | |
| 552 type = "range", | |
| 553 get = function() return db.STAMPERS_DELAY end, | |
| 554 set = function (self, fixedparam, value) db.STAMPERS_DELAY = value end, | |
| 555 min = 4, | |
| 556 max = 8, | |
| 557 step = 1, | |
| 558 desc = "Time in seconds to move out from a heating up stamper.", | |
| 559 name = "Stampers Delay", | |
| 560 }, | |
| 561 { | |
| 562 type = "toggle", | |
| 563 get = function() return db.FRAME_LOCK end, | |
| 564 set = function (self, fixedparam, value) | |
| 565 db.FRAME_LOCK = not value; | |
| 566 if (db.FRAME_LOCK) then | |
| 567 f:SetLockState() | |
| 568 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame unlocked.") | |
| 569 | |
| 570 f.unlocked_frame = true | |
| 571 f.player_pos_frame:Show() | |
| 572 f.player_bar:Show() | |
| 573 f.stop_casting_frame:Show() | |
| 574 else | |
| 575 f:SetLockState() | |
| 576 print ("|cFFFFAA00Hansgar and Franzok Assist|r frame locked.") | |
| 577 f.unlocked_frame = false | |
| 578 f.stop_casting_frame:Hide() | |
| 579 end | |
| 580 end, | |
| 581 desc = "Lock or unlock the frames.", | |
| 582 name = "Frame Locked" | |
| 583 }, | |
| 584 { | |
| 585 type = "toggle", | |
| 586 get = function() return db.SHOW_DANCE end, | |
| 587 set = function (self, fixedparam, value) | |
| 588 db.SHOW_DANCE = not db.SHOW_DANCE | |
| 589 if (db.SHOW_DANCE) then | |
| 590 if (f.on_encounter) then | |
| 591 f:StartTrackPlayerPosition() | |
| 592 end | |
| 593 else | |
| 594 f:EndTrackPlayerPosition() | |
| 595 end | |
| 596 end, | |
| 597 desc = "Enable or disable the dance bar.", | |
| 598 name = "Dance Bar" | |
| 599 }, | |
| 600 { | |
| 601 type = "toggle", | |
| 602 get = function() return db.CD_NUMBER end, | |
| 603 set = function (self, fixedparam, value) | |
| 604 db.CD_NUMBER = not db.CD_NUMBER | |
| 605 f:RefreshCooldownSettings() | |
| 606 end, | |
| 607 desc = "When enabled, shows the number countdown on each block.", | |
| 608 name = "Show Cooldown Number" | |
| 609 }, | |
| 610 { | |
| 611 type = "toggle", | |
| 612 get = function() return db.STOP_CAST end, | |
| 613 set = function (self, fixedparam, value) | |
| 614 db.STOP_CAST = not db.STOP_CAST | |
| 615 end, | |
| 616 desc = "When enabled, shows an alert for Disrupting Roar.", | |
| 617 name = "Stop Cast Alert" | |
| 618 }, | |
| 619 { | |
| 620 type = "execute", | |
| 621 func = function() | |
| 622 if (f.StampersPhase) then | |
| 623 f:EndTrackPlayerPosition() | |
| 624 return f:StopTracking() | |
| 625 end | |
| 626 f:StartTracking() | |
| 627 f:StartTrackPlayerPosition() | |
| 628 end, | |
| 629 desc = "Test the addon, run over the tracks in the room.", | |
| 630 name = "Start Test Mode" | |
| 631 }, | |
| 632 { | |
| 633 type = "execute", | |
| 634 func = function() | |
| 635 f:ClearAllPoints() | |
| 636 f:SetPoint ("center", UIParent, "center") | |
| 637 | |
| 638 player_bar:ClearAllPoints() | |
| 639 player_bar:SetPoint ("center", UIParent, "center") | |
| 640 | |
| 641 player_pos_frame:ClearAllPoints() | |
| 642 player_pos_frame:SetPoint ("center", UIParent, "center") | |
| 643 | |
| 644 if (f.StampersPhase) then | |
| 645 f:EndTrackPlayerPosition() | |
| 646 f:StopTracking() | |
| 647 end | |
| 648 | |
| 649 db.FRAME_LOCK = true | |
| 650 f:SetLockState() | |
| 651 | |
| 652 f.unlocked_frame = true | |
| 653 | |
| 654 f:StartTracking() | |
| 655 f:StartTrackPlayerPosition() | |
| 656 | |
| 657 print ("|cFFFFAA00Hansgar and Franzok Assist|r: position reseted and frames are unlocked.") | |
| 658 print ("|cFFFFAA00Hansgar and Franzok Assist|r: move between the tracks to show the other frames.") | |
| 659 end, | |
| 660 desc = "Reset the position of all frames and start the test mode.", | |
| 661 name = "Reset Position" | |
| 662 }, | |
| 663 { | |
| 664 type = "execute", | |
| 665 func = function() | |
| 666 if (f.users_schedule) then | |
| 667 print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...") | |
| 668 elseif (IsInRaid()) then | |
| 669 f.users = {} | |
| 670 f:SendCommMessage ("HAFR", "US", "RAID") | |
| 671 f.users_schedule = f:ScheduleTimer ("ShowUsers", 5) | |
| 672 print ("|cFFFFAA00Hansgar and Franzok Assist|r please wait 5 seconds...") | |
| 673 else | |
| 674 print ("|cFFFFAA00Hansgar and Franzok Assist|r you aren't in a raid group.") | |
| 675 end | |
| 676 end, | |
| 677 desc = "Show raid members which are also using this addon.", | |
| 678 name = "Version Check" | |
| 679 }, | |
| 680 { | |
| 681 type = "execute", | |
| 682 func = function() | |
| 683 f.feedback_func() | |
| 684 end, | |
| 685 desc = "Send a feedback for us on our Curse page or MMO-Champion forum Thread.", | |
| 686 name = "Send Feedback" | |
| 687 }, | |
| 688 } | |
| 689 | |
| 690 local build_options_panel = function() | |
| 691 local options_frame = DF:CreateOptionsFrame ("HansgarFranzokAssistOptions", "Hans & Franz Assist", 1) | |
| 692 options_frame:SetHeight (180) | |
| 693 DF:BuildMenu (options_frame, options_panel, 15, -60, 180) | |
| 694 options_frame:SetBackdropColor (0, 0, 0, .9) | |
| 695 end | |
| 696 | |
| 697 f.OpenOptionsPanel = function() | |
| 698 if (not HansgarFranzokAssistOptions) then | |
| 699 build_options_panel() | |
| 700 end | |
| 701 HansgarFranzokAssistOptions:Show() | |
| 702 end | |
| 703 | |
| 704 -- /run Hansgar_And_Franzok_Assist.OpenOptionsPanel() | |
| 705 local options = DF:CreateOptionsButton (f, f.OpenOptionsPanel, "Hansgar_And_Franzok_Assist_OPButton") | |
| 706 options:SetPoint ("right", f.Lock, "left", 1, 0) | |
| 707 f.Options = options | |
| 708 | |
| 709 -- | |
| 710 local feedback_func = function() | |
| 711 local feedback1 = {icon = [[Interface\AddOns\Hansgar_And_Franzok_Assist\libs\DF\feedback_sites]], coords = DF.www_icons.mmoc, desc = "Post on our thread on MMO-Champion Forum.", link = [[http://www.mmo-champion.com/threads/1725970-Hans-gar-and-Franzok-Assist-(addon)]]} | |
| 712 local feedback2 = {icon = [[Interface\AddOns\Hansgar_And_Franzok_Assist\libs\DF\feedback_sites]], coords = DF.www_icons.curse, desc = "Leave a comment on our page at Curse.com.", link = [[http://www.curse.com/addons/wow/hansgar_and_franzok_assist]]} | |
| 713 | |
| 714 local same1 = {name = "Details! Damage Meter", desc = "A Damage Meter with a lot of tools for raiders and leaders.", link = [[http://www.curse.com/addons/wow/details]], icon = [[Interface\AddOns\Hansgar_And_Franzok_Assist\libs\DF\all_addons]], coords = {0, 128/512, 0, 64/512}} | |
| 715 local same2 = {name = "Gold Token Price", desc = "Adds the slash command '/gold'. This command tells you the current price of WoW Token.", link = [[http://www.curse.com/addons/wow/gold-token-price]], icon = [[Interface\AddOns\Hansgar_And_Franzok_Assist\libs\DF\all_addons]], coords = {128/512, 256/512, 0, 64/512}} | |
| 716 local same3 = {name = "Salvage Yard Seller", desc = "Sells stuff gathered from salvage crates respecting item level limit.", link = [[http://www.curse.com/addons/wow/salvage-yard-seller]], icon = [[Interface\AddOns\Hansgar_And_Franzok_Assist\libs\DF\all_addons]], coords = {384/512, 512/512, 64/512, 128/512}} | |
| 717 local same4 = {name = "AddOns CPU Usage", desc = "Measure the CPU usage by addons. Important to get rid of FPS drops during boss encounters.", link = [[http://www.curse.com/addons/wow/addons-cpu-usage]], icon = [[Interface\AddOns\Hansgar_And_Franzok_Assist\libs\DF\all_addons]], coords = {384/512, 512/512, 0, 64/512}} | |
| 718 local same5 = {name = "Keep World Map Zoom", desc = "Because it's a pain having to re-zoom the world map after close and reopening in a short period of time.", link = [[http://www.curse.com/addons/wow/world-map-zoom]], icon = [[Interface\AddOns\Hansgar_And_Franzok_Assist\libs\DF\all_addons]], coords = {0/512, 128/512, 64/512, 128/512}} | |
| 719 local same6 = {name = "PvPScan", desc = "Show a unit frame with enemy players near you.", link = [[http://www.wowace.com/addons/pvpscan/]], icon = [[Interface\AddOns\Hansgar_And_Franzok_Assist\libs\DF\all_addons]], coords = {128/512, 256/512, 64/512, 128/512}} | |
| 720 local same7 = {name = "HotCorners", desc = "Show a hotcorner when poiting the mouse on the absolute top left of your screen (similar of those on Windows 8).", link = [[http://www.curse.com/addons/wow/hotcorners]], icon = [[Interface\AddOns\Hansgar_And_Franzok_Assist\libs\DF\all_addons]], coords = {256/512, 384/512, 64/512, 128/512}} | |
| 721 | |
| 722 DF:ShowFeedbackPanel ("Hans & Franz Assist", f.version, {feedback2, feedback1}, {same1, same2, same3, same4, same5, same6, same7}) | |
| 723 end | |
| 724 f.feedback_func = feedback_func | |
| 725 local feedback_button = DF:CreateFeedbackButton (f, feedback_func, "Hansgar_And_Franzok_AssistFBButton") | |
| 726 feedback_button:SetPoint ("right", f.Options, "left", 0, -1) | |
| 506 -- | 727 -- |
| 507 | 728 |
| 508 local stop_casting_frame = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCasting", UIParent) | 729 local stop_casting_frame = CreateFrame ("frame", "Hansgar_And_Franzok_AssistStopCasting", UIParent) |
| 509 stop_casting_frame:SetSize (200, 30) | 730 stop_casting_frame:SetSize (200, 30) |
| 510 stop_casting_frame:SetPoint ("center", UIParent, "center", 0, 75) | 731 stop_casting_frame:SetPoint ("center", UIParent, "center", 0, 75) |
