Added an option to use the default blizzard vehicle frame for vehicles (the art and all the fun)

This commit is contained in:
Hendrik Leppkes
2009-02-25 23:38:14 +01:00
parent 7b28cae101
commit 6adef77860
4 changed files with 90 additions and 16 deletions
+42 -4
View File
@@ -16,6 +16,7 @@ local defaults = {
focuscastmodifier = true,
selfcastrightclick = false,
snapping = true,
blizzardVehicle = false,
minimapIcon = {},
}
}
@@ -34,6 +35,7 @@ function Bartender4:OnInitialize()
self:RegisterEvent("PLAYER_REGEN_DISABLED", "CombatLockdown")
self:HideBlizzard()
self:UpdateBlizzardVehicle()
if LDB then
createLDBLauncher()
@@ -99,10 +101,10 @@ function Bartender4:HideBlizzard()
--MainMenuBarArtFrame:UnregisterEvent("KNOWN_CURRENCY_TYPES_UPDATE")
--MainMenuBarArtFrame:UnregisterEvent("CURRENCY_DISPLAY_UPDATE")
MainMenuBarArtFrame:UnregisterEvent("ADDON_LOADED")
MainMenuBarArtFrame:UnregisterEvent("UNIT_ENTERING_VEHICLE")
MainMenuBarArtFrame:UnregisterEvent("UNIT_ENTERED_VEHICLE")
MainMenuBarArtFrame:UnregisterEvent("UNIT_EXITING_VEHICLE")
MainMenuBarArtFrame:UnregisterEvent("UNIT_EXITED_VEHICLE")
--MainMenuBarArtFrame:UnregisterEvent("UNIT_ENTERING_VEHICLE")
--MainMenuBarArtFrame:UnregisterEvent("UNIT_ENTERED_VEHICLE")
--MainMenuBarArtFrame:UnregisterEvent("UNIT_EXITING_VEHICLE")
--MainMenuBarArtFrame:UnregisterEvent("UNIT_EXITED_VEHICLE")
MainMenuBarArtFrame:Hide()
--MainMenuExpBar:UnregisterAllEvents()
@@ -146,11 +148,47 @@ function Bartender4:UpdateModuleConfigs()
LDBIcon:Refresh("Bartender4", Bartender4.db.profile.minimapIcon)
end
self:UpdateBlizzardVehicle()
if unlock then
self:Unlock()
end
end
function Bartender4:UpdateBlizzardVehicle()
if self.db.profile.blizzardVehicle then
MainMenuBarArtFrame:RegisterEvent("UNIT_ENTERING_VEHICLE")
MainMenuBarArtFrame:RegisterEvent("UNIT_ENTERED_VEHICLE")
MainMenuBarArtFrame:RegisterEvent("UNIT_EXITING_VEHICLE")
MainMenuBarArtFrame:RegisterEvent("UNIT_EXITED_VEHICLE")
local vehicleModule = Bartender4:GetModule("Vehicle", true)
vehicleModule:Disable()
vehicleModule.blizzardVehicle = true
if not self.hookedVehicle then
self.hookedVehicle = true
hooksecurefunc("MainMenuBar_ToPlayerArt", function()
MainMenuBar:Hide()
ShapeshiftBarFrame:Hide()
PossessBarFrame:Hide()
local module = Bartender4:GetModule("MicroMenu")
module:RestoreButtons()
end)
end
else
MainMenuBarArtFrame:RegisterEvent("UNIT_ENTERING_VEHICLE")
MainMenuBarArtFrame:RegisterEvent("UNIT_ENTERED_VEHICLE")
MainMenuBarArtFrame:RegisterEvent("UNIT_EXITING_VEHICLE")
MainMenuBarArtFrame:RegisterEvent("UNIT_EXITED_VEHICLE")
local vehicleModule = Bartender4:GetModule("Vehicle")
vehicleModule.blizzardVehicle = nil
if vehicleModule.db.profile.enabled then
vehicleModule:Enable()
end
end
end
function Bartender4:CombatLockdown()
self:Lock()
LibStub("AceConfigDialog-3.0"):Close("Bartender4")
+9
View File
@@ -66,6 +66,15 @@ function MicroMenuMod:ApplyConfig()
self.bar:ApplyConfig(self.db.profile)
end
function MicroMenuMod:RestoreButtons()
if not self:IsEnabled() then return end
for k,v in pairs(self.bar.buttons) do
v:SetParent(self.bar)
v:Show()
end
self.bar:UpdateButtonLayout()
end
MicroMenuBar.button_width = 28
MicroMenuBar.button_height = 58
MicroMenuBar.vpad_offset = -21
+23 -11
View File
@@ -72,9 +72,21 @@ local function getOptions()
name = function(info) if info.uiType == "dialog" then return "" else return L["Bar Options"] end end,
guiInline = true,
args = {
selfcastmodifier = {
blizzardVehicle = {
order = 1,
type = "toggle",
name = L["Use Blizzard Vehicle UI"],
desc = L["Enable the use of the Blizzard Vehicle UI, hiding any Bartender4 bars in the meantime."],
width = "full",
get = getFunc,
set = function(info, value)
Bartender4.db.profile.blizzardVehicle = value
Bartender4:UpdateBlizzardVehicle()
end,
},
selfcastmodifier = {
order = 10,
type = "toggle",
name = L["Self-Cast by modifier"],
desc = L["Toggle the use of the modifier-based self-cast functionality."],
get = getFunc,
@@ -84,7 +96,7 @@ local function getOptions()
end,
},
setselfcastmod = {
order = 2,
order = 20,
type = "select",
name = L["Self-Cast Modifier"],
desc = L["Select the Self-Cast Modifier"],
@@ -93,12 +105,12 @@ local function getOptions()
values = { NONE = L["None"], ALT = L["ALT"], SHIFT = L["SHIFT"], CTRL = L["CTRL"] },
},
selfcast_nl = {
order = 3,
order = 30,
type = "description",
name = "",
},
focuscastmodifier = {
order = 5,
order = 50,
type = "toggle",
name = L["Focus-Cast by modifier"],
desc = L["Toggle the use of the modifier-based focus-cast functionality."],
@@ -109,7 +121,7 @@ local function getOptions()
end,
},
setfocuscastmod = {
order = 6,
order = 60,
type = "select",
name = L["Focus-Cast Modifier"],
desc = L["Select the Focus-Cast Modifier"],
@@ -118,12 +130,12 @@ local function getOptions()
values = { NONE = L["None"], ALT = L["ALT"], SHIFT = L["SHIFT"], CTRL = L["CTRL"] },
},
focuscast_nl = {
order = 7,
order = 70,
type = "description",
name = "",
},
selfcastrightclick = {
order = 8,
order = 80,
type = "toggle",
name = L["Right-click Self-Cast"],
desc = L["Toggle the use of the right-click self-cast functionality."],
@@ -134,12 +146,12 @@ local function getOptions()
end,
},
rightclickselfcast_nl = {
order = 9,
order = 90,
type = "description",
name = "",
},
range = {
order = 10,
order = 100,
name = L["Out of Range Indicator"],
desc = L["Configure how the Out of Range Indicator should display on the buttons."],
type = "select",
@@ -154,7 +166,7 @@ local function getOptions()
values = { none = L["No Display"], button = L["Full Button Mode"], hotkey = L["Hotkey Mode"] },
},
colors = {
order = 13,
order = 130,
type = "group",
guiInline = true,
name = L["Colors"],
@@ -183,7 +195,7 @@ local function getOptions()
},
},
tooltip = {
order = 20,
order = 200,
name = L["Button Tooltip"],
type = "select",
desc = L["Configure the Button Tooltip."],
+16 -1
View File
@@ -20,10 +20,15 @@ local defaults = { profile = Bartender4:Merge({
function VehicleBarMod:OnInitialize()
self.db = Bartender4.db:RegisterNamespace("Vehicle", defaults)
self:SetEnabledState(self.db.profile.enabled)
if self.blizzardVehicle then
self:SetEnabledState(false)
else
self:SetEnabledState(self.db.profile.enabled)
end
end
function VehicleBarMod:OnEnable()
if self.blizzardVehicle then return end
if not self.bar then
self.bar = setmetatable(Bartender4.ButtonBar:Create("Vehicle", self.db.profile, L["Vehicle Bar"], true), {__index = VehicleBar})
local buttons = {VehicleMenuBarLeaveButton, VehicleMenuBarPitchUpButton, VehicleMenuBarPitchDownButton}
@@ -61,6 +66,16 @@ function VehicleBarMod:OnEnable()
self:ApplyConfig()
end
function VehicleBarMod:OnDisable()
Bartender4.modulePrototype.OnDisable(self)
VehicleMenuBarPitchUpButton:SetParent(VehicleMenuBar)
VehicleMenuBarPitchUpButton:ClearAllPoints()
VehicleMenuBarPitchDownButton:SetParent(VehicleMenuBar)
VehicleMenuBarPitchDownButton:ClearAllPoints()
VehicleMenuBarLeaveButton:SetParent(VehicleMenuBar)
VehicleMenuBarLeaveButton:ClearAllPoints()
end
function VehicleBarMod:ApplyConfig()
self.bar:ApplyConfig(self.db.profile)
end