Skip to content

Commit

Permalink
Make logic more logical
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSheps committed Oct 18, 2018
1 parent 5df103d commit 5a2a346
Show file tree
Hide file tree
Showing 7 changed files with 321 additions and 52 deletions.
23 changes: 16 additions & 7 deletions BeStride.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ function BeStride:NewMount(...)
table.foreach(args,function (k,v) print("Arg: " .. k) end)
end

function BeStride:UpdateBindings()
BeStride:SetKeyBindings(self.buttons["regular"])
BeStride:SetKeyBindings(self.buttons["ground"])
BeStride:SetKeyBindings(self.buttons["passenger"])
BeStride:SetKeyBindings(self.buttons["repair"])

SaveBindings(GetCurrentBindingSet())
end

function BeStride:UpdateOverrideBindings()
BeStride:SetKeyBindingsOverrides(self.buttons["regular"])
BeStride:SetKeyBindingsOverrides(self.buttons["ground"])
Expand All @@ -174,7 +183,7 @@ end
function BeStride:Upgrade()
local db = LibStub("AceDB-3.0"):New("BestrideDB")

if self.db.profile.settings.bindingsMigrated == false then
--if self.db.profile.settings.bindingsMigrated == false then
table.foreach({BeStride_ABRegularMount,BeStride_ABGroundMount,BeStride_ABPassengerMount,BeStride_ABRepairMount},function (key,button)
BeStride_Debug:Debug("Start Set Bindings: " .. button:GetName())
local primaryKey,secondaryKey = GetBindingKey(button:GetName())
Expand All @@ -187,8 +196,8 @@ function BeStride:Upgrade()
end
BeStride_Debug:Debug("End Set Bindings")
end)
end
self.db.profile.settings.bindingsMigrated = true
--end
--self.db.profile.settings.bindingsMigrated = true

if db.profile.settings and self.db.profile.settings.migrated == false then
print("Old Settings Exist, Upgrading")
Expand Down Expand Up @@ -256,20 +265,20 @@ function BeStride:Upgrade()
end

function BeStride:SetKeyBindings(button)
--BeStride_Debug:Debug("Start Set Bindings: " .. button:GetName())
BeStride_Debug:Debug("Start Set Bindings: " .. button:GetName())

local primaryKey,secondaryKey = GetBindingKey(button:GetName())
local primaryKey,secondaryKey = GetBindingKey("CLICK " .. button:GetName() .. ":LeftButton")

if primaryKey then
--print("1st Key: " .. primaryKey .. " Set!")
print("1st Key: " .. primaryKey .. " Set!")
SetBindingClick(primaryKey,button:GetName())
end

if secondaryKey then
print("2nd Key: " .. secondaryKey .. " Set!")
SetBindingClick(secondaryKey,button:GetName())
end
--BeStride_Debug:Debug("End Set Bindings")
BeStride_Debug:Debug("End Set Bindings")
end

function BeStride:SetKeyBindingsOverrides(button)
Expand Down
2 changes: 1 addition & 1 deletion BeStride_ActionButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function BeStride_ActionButtonRegularMount:PreClick()
-- return
--end

local mount = BeStride_Logic:MountButton()
local mount = BeStride_Logic:Regular()
self:SetAttribute("macrotext",mount)
end

Expand Down
5 changes: 3 additions & 2 deletions BeStride_Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ BeStride_Constants = {
{
{name="classes.druid.flightform",element="CheckBox",label=BeStride_Locale.Settings.Classes.Druid.FlightForm,class="druid",dbvalue="flightform", dependants = {"classes.druid.traveltotravel","classes.druid.flightformpriority","classes.druid.mountedtoflightform"}},
{name="classes.druid.traveltotravel",element="CheckBox",label=BeStride_Locale.Settings.Classes.Druid.TravelToTravel,class="druid",dbvalue="traveltotravel", depends = {"classes.druid.flightform"}},
{name="classes.druid.traveltotravel",element="CheckBox",label=BeStride_Locale.Settings.Classes.Druid.FlightFormPriority,class="druid",dbvalue="flightformpriority", depends = {"classes.druid.flightform"}},
{name="classes.druid.traveltotravel",element="CheckBox",label=BeStride_Locale.Settings.Classes.Druid.MountedToFlightForm,class="druid",dbvalue="mountedtoflightform", depends = {"classes.druid.flightform"}},
{name="classes.druid.flightformpriority",element="CheckBox",label=BeStride_Locale.Settings.Classes.Druid.FlightFormPriority,class="druid",dbvalue="flightformpriority", depends = {"classes.druid.flightform"}},
{name="classes.druid.mountedtoflightform",element="CheckBox",label=BeStride_Locale.Settings.Classes.Druid.MountedToFlightForm,class="druid",dbvalue="mountedtoflightform", depends = {"classes.druid.flightform"}},
},
{
{name="classes.mage.slowfall",element="CheckBox",label=BeStride_Locale.Settings.Classes.Mage.SlowFall,class="mage",dbvalue="slowfall"},
{name="classes.mage.blink",element="CheckBox",label=BeStride_Locale.Settings.Classes.Mage.Blink,class="mage",dbvalue="blink"},
{name="classes.mage.blinkpriority",element="CheckBox",label=BeStride_Locale.Settings.Classes.Mage.BlinkPriority,class="mage",dbvalue="blinkpriority"},
},
{
{name="classes.monk.roll",element="CheckBox",label=BeStride_Locale.Settings.Classes.Monk.Roll,class="monk",dbvalue="roll"},
Expand Down
6 changes: 6 additions & 0 deletions BeStride_Debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ function BeStride_Debug:Critical(message)
end
end

function BeStride_Debug:Error(message)
if debugLevel >= 3 then
ChatFrame1:AddMessage("[Error]" .. message,1.0,0,0);
end
end


function BeStride_Debug:Informational(message)
if debugLevel >= 4 then
Expand Down
Loading

0 comments on commit 5a2a346

Please sign in to comment.