Skip to content

Commit

Permalink
Merge pull request #234 from TylerR909/feat/opie-integration
Browse files Browse the repository at this point in the history
OPie Integration
  • Loading branch information
DanSheps committed Feb 14, 2023
2 parents 99aef0c + 62750f3 commit e925d05
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ BeStride is a mount manager that has the following functionality
* Randomly select mount, based on a customizable list
* Intelligently select between ground, flying, swimming, repair or passenger
* Intelligently select class specific spells & mounts depending on the situation (druid cat form in combat, priest levitate, paladin divine steed, warlock underwater breating, etc)
* [OPie](https://www.townlong-yak.com/addons/opie) Integration

History
=================
Expand Down
1 change: 1 addition & 0 deletions Versions/BeStride_Mainline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@
<Script file="Mainline\logic.lua"/>
<Script file="Common\upgrade.lua"/>
<Script file="Common\bestride.lua"/>
<Script file="Common\opie.lua"/>
</Ui>
1 change: 1 addition & 0 deletions Versions/BeStride_Wrath.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<Script file="Wrath\MountTable.lua"/>
<Script file="Common\upgrade.lua"/>
<Script file="Common\bestride.lua"/>
<Script file="Common\opie.lua"/>
</Ui>
57 changes: 57 additions & 0 deletions Versions/Common/opie.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
local name, addon = ...
local f = CreateFrame("Frame");
local L = LibStub("AceLocale-3.0"):GetLocale("BeStride")

-- Basedd off of Opie Rings\Default.lua file
local function addBeStrideRingToOpie()
local ringname = L["Bindings.Header"]
if not (OPie and OPie.CustomRings) then return end
local _, major = OPie.GetVersion()
if not (major and major == 4) then return end

local opieMountRing = {
{ "macrotext", "/click BeStride_ABRegularMount", icon = "Interface/Icons/inv_misc_summerfest_brazierorange",
fastClick = true },
}

-- Passenger
if next(BeStride:DBGet("mounts.passenger")) then tinsert(opieMountRing,
{ "macrotext", "/click BeStride_ABPassengerMount",
icon = BeStride:IsMainline() and "Interface/Icons/inv_misc_stonedragonorange" or
"Interface/Icons/ability_mount_mammoth_black" })
end

-- Ground Mount
tinsert(opieMountRing,
{ "macrotext", "/click BeStride_ABGroundMount",
icon = BeStride:IsMainline() and "Interface/Icons/misc_arrowdown" or
"Interface/Icons/ability_mount_dreadsteed" })

-- Repair
if next(BeStride:DBGet("mounts.repair")) then tinsert(opieMountRing,
{ "macrotext", "/click BeStride_ABRepairMount", icon = "Interface/Icons/trade_blacksmithing" })
end

opieMountRing["name"] = ringname
opieMountRing["hotkey"] = "SHIFT-SPACE"
opieMountRing["u"] = "OPCBR"

OPie.CustomRings:AddDefaultRing(ringname, opieMountRing)
end

local function awaitAddonThen(addonName, andThen)
if (IsAddOnLoaded(addonName)) then
andThen()
else
f:RegisterEvent("ADDON_LOADED");
f:SetScript("OnEvent", function(self, event, arg1)
if (event ~= "ADDON_LOADED") then return end
if (arg1 ~= addonName) then return end
andThen()
f:UnregisterEvent("ADDON_LOADED")
end
)
end
end

awaitAddonThen("OPie", addBeStrideRingToOpie)

0 comments on commit e925d05

Please sign in to comment.