From da3c3d8e19ee67f7f1fdab7dcee97f3b9922c8af Mon Sep 17 00:00:00 2001 From: Athene Date: Fri, 22 Jan 2016 18:09:51 +0100 Subject: [PATCH] Added stance requirement for every triggers --- .../MikScrollingBattleText.lua | 16 +++++++++ .../MikScrollingBattleText.toc | 2 +- MikScrollingBattleText/localization.lua | 20 +++++++++-- MikScrollingBattleTextOptions/MSBTOptions.lua | 36 +++++++++++++++++-- MikScrollingBattleTextOptions/MSBTOptions.xml | 15 ++++++-- .../MikScrollingBattleTextOptions.toc | 2 +- .../localization_options.lua | 15 ++++---- 7 files changed, 90 insertions(+), 16 deletions(-) diff --git a/MikScrollingBattleText/MikScrollingBattleText.lua b/MikScrollingBattleText/MikScrollingBattleText.lua index 63742a7..6b2c4cb 100644 --- a/MikScrollingBattleText/MikScrollingBattleText.lua +++ b/MikScrollingBattleText/MikScrollingBattleText.lua @@ -107,6 +107,12 @@ ICON_CACHE["pierre de soins"] = "Interface\\Icons\\inv_stone_04" ICON_CACHE["capturer un esprit"] = "Interface\\Icons\\Spell_Shadow_Haunting" ICON_CACHE["récupération du mana"] = "Interface\\Icons\\inv_misc_gem_ruby_01" ICON_CACHE["maître des éléments"] = "Interface\\Icons\\spell_fire_masterofelements" +ICON_CACHE["tribu zandalar"] = "Interface\\Icons\\inv_misc_coin_08" +ICON_CACHE["crachat venimeux"] = "Interface\\Icons\\spell_nature_corrosivebreath" +ICON_CACHE["morsure fatale"] = "Interface\\Icons\\ability_backstab" +ICON_CACHE["explosion sonore"] = "Interface\\Icons\\spell_shadow_teleport" +ICON_CACHE["flammes"] = "Interface\\Icons\\spell_fire_fire" +ICON_CACHE["effet inferno"] = "Interface\\Icons\\spell_fire_incinerate" -- Cache des spells dont l'icone n'a pas été trouvée @@ -652,6 +658,16 @@ function MikSBT.TriggerHandler(triggerEvent) -- Get a recycled table from the events recycler object. local animationEvent = eventsRecycler:AcquireTable(); + -- Check if the trigger require a stance + if (MikSBT.CurrentProfile.Triggers[triggerEvent.TriggerKey].TriggerSettings.Stance) then + local _,_,isActive = GetShapeshiftFormInfo(MikSBT.CurrentProfile.Triggers[triggerEvent.TriggerKey].TriggerSettings.Stance) + if not isActive then + -- Reclaim the animation event table to the table recycler. + eventsRecycler:ReclaimTable(animationEvent); + return + end + end + -- Check if there is profile data for the trigger. if (MikSBT.CurrentProfile.Triggers[triggerEvent.TriggerKey].EventSettings) then -- Set the scroll area, event settings, and output text. diff --git a/MikScrollingBattleText/MikScrollingBattleText.toc b/MikScrollingBattleText/MikScrollingBattleText.toc index 3d1c09e..854764a 100644 --- a/MikScrollingBattleText/MikScrollingBattleText.toc +++ b/MikScrollingBattleText/MikScrollingBattleText.toc @@ -1,5 +1,5 @@ ## Interface: 11200 -## Version: 4.42 +## Version: 4.43 ## Title: Mik's Scrolling Battle Text ## Notes: Scrolls battle information around the character model. ## OptionalDeps: SW_FixLogStrings diff --git a/MikScrollingBattleText/localization.lua b/MikScrollingBattleText/localization.lua index 4ce981e..ee4a9bd 100644 --- a/MikScrollingBattleText/localization.lua +++ b/MikScrollingBattleText/localization.lua @@ -12,8 +12,8 @@ MikSBT = {}; ------------------------------------------------------------------------------- MikSBT.MOD_NAME = "MikScrollingBattleText" -MikSBT.VERSION_NUMBER = 4.42; -MikSBT.VERSION_STRING = "v4.42"; +MikSBT.VERSION_NUMBER = 4.43; +MikSBT.VERSION_STRING = "v4.43 beta"; MikSBT.WINDOW_TITLE = "Mik's Scrolling Battle Text " .. MikSBT.VERSION_STRING .. " - \124cffF58CBA\124hAthene Edit\124h\124r"; MikSBT.COMMAND = "/msbt"; @@ -155,6 +155,22 @@ MikSBT.AVAILABLE_TRIGGER_TYPES = { }; +------------------------------ +-- Stances info +------------------------------ + +-- Holds the available stances. +MikSBT.AVAILABLE_STANCES = { + [1] = {Name="|cffC79C6EBattle Stance|r/|cffFF7D0ABear Form|r/|cffFFF569Stealth|r/|cffF58CBADevotion Aura"}, + [2] = {Name="|cffC79C6EDefensive Stance|r/|cffFF7D0AAquatic Form|r/|cffF58CBARetribution Aura"}, + [3] = {Name="|cffC79C6EBeserker Stance|r/|cffFF7D0ACat Form|r/|cffF58CBAConcentration Aura"}, + [4] = {Name="|cffFF7D0ATravel Form|r/|cffF58CBAShadow Resistance Aura"}, + [5] = {Name="|cffFF7D0AMoonkin Form|r/|cffF58CBAFrost Resistance Aura"}, + [6] = {Name="|cffF58CBAFire Resistance Aura"}, + [7] = {Name="Any"}, +}; + + ------------------------------ -- Defaults ------------------------------ diff --git a/MikScrollingBattleTextOptions/MSBTOptions.lua b/MikScrollingBattleTextOptions/MSBTOptions.lua index 34e268f..7fc56e2 100644 --- a/MikScrollingBattleTextOptions/MSBTOptions.lua +++ b/MikScrollingBattleTextOptions/MSBTOptions.lua @@ -372,6 +372,11 @@ function MikSBTOpt.InitDropdowns() key = "TriggerTypeDropdown"; MikSBTOpt.SetupDropdown(TRIGGER_CONFIGURATION_FRAME_NAME .. key, MikSBTOpt.DROPDOWNS[key].Label, MikSBTOpt.DROPDOWNS[key].Tooltip, MikSBTOpt.TriggerTypeDropdownOnClick, MikSBT.AVAILABLE_TRIGGER_TYPES, nil); UIDropDownMenu_SetWidth(150, getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. key)); + + -- Initialize the stances dropdown. + key = "StanceDropdown"; + MikSBTOpt.SetupDropdown(TRIGGER_CONFIGURATION_FRAME_NAME .. key, MikSBTOpt.DROPDOWNS[key].Label, MikSBTOpt.DROPDOWNS[key].Tooltip, MikSBTOpt.StanceDropdownOnClick, MikSBT.AVAILABLE_STANCES, nil); + UIDropDownMenu_SetWidth(240, getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. key)); end @@ -553,6 +558,15 @@ function MikSBTOpt.TriggerTypeDropdownOnClick(frameName) end +-- ********************************************************************************** +-- Called when the stance dropdown menu is clicked. +-- ********************************************************************************** +function MikSBTOpt.StanceDropdownOnClick(frameName) + -- Set the selected dropdown option to the appropriate value. + UIDropDownMenu_SetSelectedValue(getglobal(frameName), this.value); +end + + -- ********************************************************************************** -- This function refreshes the options for the profiles dropdown. -- ********************************************************************************** @@ -3344,7 +3358,7 @@ function MikSBTOpt.SetupVariableTriggerControls(triggerKey, showSearch) -- Check if the search pattern controls should be shown. if (showSearch) then -- Resize the trigger frame. - triggerFrame:SetHeight(420); + triggerFrame:SetHeight(450); -- Hide the threshold slider. getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "ThresholdSlider"):Hide(); @@ -3356,6 +3370,7 @@ function MikSBTOpt.SetupVariableTriggerControls(triggerKey, showSearch) getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "TriggerEvent3Checkbox"):Show(); getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "TriggerEvent4Checkbox"):Show(); + getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "StanceDropdown"):Show(); getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "SearchPattern1Editbox"):Show(); getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "SearchPattern2Editbox"):Show(); @@ -3376,7 +3391,12 @@ function MikSBTOpt.SetupVariableTriggerControls(triggerKey, showSearch) -- Populate the appropriate trigger events. MikSBTOpt.PopulateAvailableTriggerEvents(); - + + local stance = triggerData.TriggerSettings.Stance + if not stance then stance = 7 end + -- Populate the stance dropdown. + MikSBTOpt.PopulateDropdown(TRIGGER_CONFIGURATION_FRAME_NAME .. "StanceDropdown", stance); + -- Holds the search patterns. local searchPattern1 = ""; local searchPattern2 = ""; @@ -3404,6 +3424,7 @@ function MikSBTOpt.SetupVariableTriggerControls(triggerKey, showSearch) getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "TriggerEvent2Checkbox"):Hide(); getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "TriggerEvent3Checkbox"):Hide(); getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "TriggerEvent4Checkbox"):Hide(); + getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "StanceDropdown"):Hide(); getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "SearchPattern1Editbox"):Hide(); getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "SearchPattern2Editbox"):Hide(); @@ -3505,6 +3526,17 @@ function MikSBTOpt.SaveTriggerConfig() -- Save the selected trigger events. triggerData.TriggerSettings.TriggerEvents = trigEvents; + -- Save the required stance. + if UIDropDownMenu_GetSelectedValue(getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "StanceDropdown")) ~= 7 then + triggerData.TriggerSettings.Stance = UIDropDownMenu_GetSelectedValue(getglobal(TRIGGER_CONFIGURATION_FRAME_NAME .. "StanceDropdown")); + if not GetShapeshiftFormInfo(triggerData.TriggerSettings.Stance) then + MikSBT.Print("No stance found for the selected requirement on this character, this trigger might never occur :o", 1, 1, 0); + MikSBT.Print("Also it's dangerous to go alone! take this. o-[====>", 1, 1, 0); --remind me that this is a beta release + end + else + triggerData.TriggerSettings.Stance = nil + end + -- Create a table to hold the search patterns. local searchPatterns = {}; diff --git a/MikScrollingBattleTextOptions/MSBTOptions.xml b/MikScrollingBattleTextOptions/MSBTOptions.xml index 1fe1389..2229f9e 100644 --- a/MikScrollingBattleTextOptions/MSBTOptions.xml +++ b/MikScrollingBattleTextOptions/MSBTOptions.xml @@ -2149,7 +2149,16 @@ - + + + + + + + + + + @@ -2157,9 +2166,9 @@ - + - + diff --git a/MikScrollingBattleTextOptions/MikScrollingBattleTextOptions.toc b/MikScrollingBattleTextOptions/MikScrollingBattleTextOptions.toc index 4d33b96..bf36e32 100644 --- a/MikScrollingBattleTextOptions/MikScrollingBattleTextOptions.toc +++ b/MikScrollingBattleTextOptions/MikScrollingBattleTextOptions.toc @@ -1,5 +1,5 @@ ## Interface: 11200 -## Version: 4.42 +## Version: 4.43 ## Title: Mik's Scrolling Battle Text Options ## Notes: Load on demand options for Mik's Scrolling Battle Text ## Dependencies: MikScrollingBattleText diff --git a/MikScrollingBattleTextOptions/localization_options.lua b/MikScrollingBattleTextOptions/localization_options.lua index 2b7f5e3..06bc7d7 100644 --- a/MikScrollingBattleTextOptions/localization_options.lua +++ b/MikScrollingBattleTextOptions/localization_options.lua @@ -72,15 +72,16 @@ MikSBTOpt.TABS = { MikSBTOpt.DROPDOWNS = { ["Tab1FrameProfileDropdown"] = { Label="Profile", Tooltip="Selects the current profile."}, - ["ScrollAreaDropdown"] = { Label="Scroll Area", Tooltip="Selects the scroll area to configure."}, - ["TextAlignDropdown"] = { Label="Text Align", Tooltip="The alignment of the text for the scroll area."}, - ["AnimationStyleDropdown"] = { Label="Animation Style", Tooltip="The animation style for the scroll area."}, + ["ScrollAreaDropdown"] = { Label="Scroll Area", Tooltip="Selects the scroll area to configure."}, + ["TextAlignDropdown"] = { Label="Text Align", Tooltip="The alignment of the text for the scroll area."}, + ["AnimationStyleDropdown"] = { Label="Animation Style", Tooltip="The animation style for the scroll area."}, ["ScrollDirectionDropdown"] = { Label="Scroll Direction", Tooltip="The scroll direction for the scroll area."}, - ["FontDropdown"] = { Label="Normal Font"}, - ["FontOutlineDropdown"] = { Label="Normal Font Outline"}, - ["FontCritDropdown"] = { Label="Crit Font"}, + ["FontDropdown"] = { Label="Normal Font"}, + ["FontOutlineDropdown"] = { Label="Normal Font Outline"}, + ["FontCritDropdown"] = { Label="Crit Font"}, ["FontOutlineCritDropdown"] = { Label="Crit Font Outline"}, - ["TriggerTypeDropdown"] = { Label="Trigger Type", Tooltip="Select the type of trigger."}, + ["TriggerTypeDropdown"] = { Label="Trigger Type", Tooltip="Select the type of trigger."}, + ["StanceDropdown"] = { Label="Required Stance", Tooltip="Select the stance required to enable this trigger."}, }; MikSBTOpt.CHECKBOXES = {