Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
- fixed case when BonusActionBarFrame was showing after reload and change stance.
- added position settings for bars, bags.
- added scale settings for bars, vehicle, bags & micromenu.
- removed additional bonusbar for druid in prowl.
- added state for showing micromenu and bags in vehicles.
  • Loading branch information
s0h2x committed Sep 30, 2022
1 parent e98d4dd commit 3fbf629
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 34 deletions.
32 changes: 22 additions & 10 deletions config.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
local addon = select(2,...);
addon._dir = [[Interface\AddOns\pretty_actionbar\assets\]];
addon.config = {
-- @desc: mainbar settings
-- @param: number of scale
mainbars = {
scale_actionbar = 0.9, --; mainbar scale.
scale_rightbar = 0.9, --; multibar right scale (under minimap).
scale_leftbar = 0.9, --; multibar left scale (under minimap).
scale_vehicle = 1, --; vehicle artbar scale.
},

micromenu = {
-- @desc: micromenu & bags bar
-- @param: number, boolean
scale_menu = 1.4, --; scale for micromenu.
scale_bags = 0.9, --; scale for bags bar.
x_position = 0, --; x offset (negative moves menu to left side).
y_position = -48, --; y offset.
hide_on_vehicle = false, --; hide micromenu and bags if you sit on vehicle.
},

xprepbar = {
-- @desc: offset by y-axis for XP and reputation bar, this pushes mainbar to up
-- @param: offset number
Expand All @@ -26,8 +45,8 @@ addon.config = {
petbar_grid = false, --; display empty slots on pet bar.
count = {
show = true,
position = {'BOTTOMRIGHT', 0, -2 }, --; x, y position.
font = {addon._dir..'expressway.ttf', 14, ''}, --; count font, size, flag.
position = {'BOTTOMRIGHT', 2, -1 }, --; x, y position.
font = {addon._dir..'expressway.ttf', 14, 'OUTLINE'}, --; count font, size, flag.
},
hotkey = {
show = true,
Expand Down Expand Up @@ -71,18 +90,11 @@ addon.config = {
},
vehicle = {
-- @param: artstyle: [true - like blizzard original bar arts], [false - like other bars]
artstyle = false, --; vehicle bar style.
artstyle = true, --; vehicle bar style.
position = {'BOTTOMLEFT', -52, 0}, --; vehicle leave button position.
},
},

micromenu = {
-- @desc: micromenu & bags bar
-- @param: number of position offset
x_position = 0, --; x offset (negative moves menu to left side).
y_position = -48, --; y offset.
},

assets = {
-- @desc: media folder
-- @param: path
Expand Down
6 changes: 5 additions & 1 deletion modules/mainbars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ local pUiMainBarArt = CreateFrame(
'pUiMainBarArt',
pUiMainBar
);
pUiMainBar:SetScale(config.mainbars.scale_actionbar)
pUiMainBarArt:SetFrameStrata('DIALOG');
pUiMainBarArt:SetFrameLevel(pUiMainBar:GetFrameLevel() + 4);
pUiMainBarArt:SetAllPoints(pUiMainBar);
Expand Down Expand Up @@ -119,8 +120,11 @@ function MainMenuBarMixin:actionbar_setup()
MultiBarBottomRight:EnableMouse(false) -- top middle
MultiBarBottomRight:SetClearPoint('BOTTOMLEFT', MultiBarBottomLeftButton1, 'TOPLEFT', 0, 8)
MultiBarRight:SetClearPoint('TOPRIGHT', UIParent, 'RIGHT', -6, (Minimap:GetHeight() * 1.3))
MultiBarRight:SetScale(config.mainbars.scale_rightbar)
MultiBarLeft:SetScale(config.mainbars.scale_leftbar)

-- MultiBarLeft:SetParent(UIParent)
-- MultiBarLeft:SetClearPoint('TOPRIGHT', MultiBarRightButton1, 'TOPLEFT', -6, 0)
MultiBarLeft:SetClearPoint('TOPRIGHT', MultiBarRight, 'TOPLEFT', -7, 0)
end

event:RegisterEvents(function()
Expand Down
35 changes: 26 additions & 9 deletions modules/micromenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local PERFORMANCEBAR_MEDIUM_LATENCY = 600;

local MainMenuMicroButtonMixin = {};
local MainMenuBarBackpackButton = _G.MainMenuBarBackpackButton;
local HelpMicroButton = _G.HelpMicroButton;
local KeyRingButton = _G.KeyRingButton;

local bagslots = {
Expand All @@ -33,8 +34,14 @@ local MICRO_BUTTONS = {
_G.MainMenuMicroButton,
_G.HelpMicroButton,
};

KeyRingButton:SetParent(_G.CharacterBag3Slot)
local pUiBagsBar = CreateFrame(
'Frame',
'pUiBagsBar',
UIParent
);
pUiBagsBar:SetScale(config.micromenu.scale_bags);
MainMenuBarBackpackButton:SetParent(pUiBagsBar);
KeyRingButton:SetParent(_G.CharacterBag3Slot);
function MainMenuMicroButtonMixin:bagbuttons_setup()
MainMenuBarBackpackButton:SetSize(50, 50)
MainMenuBarBackpackButton:SetNormalTexture(nil)
Expand All @@ -44,7 +51,7 @@ function MainMenuMicroButtonMixin:bagbuttons_setup()
MainMenuBarBackpackButton:GetHighlightTexture():set_atlas('bag-main-highlight-2x')
MainMenuBarBackpackButton:GetCheckedTexture():set_atlas('bag-main-highlight-2x')
MainMenuBarBackpackButtonIconTexture:set_atlas('bag-main-2x')
MainMenuBarBackpackButton:SetClearPoint('BOTTOMRIGHT', _G.HelpMicroButton, 'BOTTOMRIGHT', 6, 30)
MainMenuBarBackpackButton:SetClearPoint('BOTTOMRIGHT', HelpMicroButton, 'BOTTOMRIGHT', 0, 30)
MainMenuBarBackpackButton.SetPoint = addon._noop

MainMenuBarBackpackButtonCount:SetClearPoint('CENTER', MainMenuBarBackpackButton, 'BOTTOM', 0, 14)
Expand Down Expand Up @@ -129,10 +136,13 @@ end,
);

do
for _,bags in pairs(bagslots) do
bags:SetParent(pUiBagsBar);
end
if config.style.bags == 'new' then
MainMenuMicroButtonMixin:bagbuttons_setup();
elseif config.style.bags == 'old' then
MainMenuBarBackpackButton:SetClearPoint('BOTTOMRIGHT', _G.HelpMicroButton, 'BOTTOMRIGHT', 0, 34)
MainMenuBarBackpackButton:SetClearPoint('BOTTOMRIGHT', HelpMicroButton, 'BOTTOMRIGHT', 0, 34)
MainMenuBarBackpackButtonIconTexture:SetTexture(addon._dir..'INV_Misc_Bag_08')
CharacterBag0Slot:SetClearPoint('RIGHT', MainMenuBarBackpackButton, 'LEFT', -20, 0)
else
Expand Down Expand Up @@ -259,7 +269,7 @@ end
function MainMenuMicroButtonMixin:CreateBar()
local latencybar = CreateFrame('Statusbar', nil, UIParent)
latencybar:SetParent(HelpMicroButton)
latencybar:SetSize(19, 39)
latencybar:SetSize(14, 39)
latencybar:SetPoint('BOTTOM', HelpMicroButton, 'BOTTOM', 0, -4)
latencybar:SetStatusBarTexture(addon._dir..'ui-mainmenubar-performancebar')
latencybar:SetStatusBarColor(1, 1, 0)
Expand All @@ -272,9 +282,9 @@ MainMenuMicroButtonMixin:CreateBar();
local function setupMicroButtons(xOffset)
local buttonxOffset = 0
local menu = CreateFrame('Frame', 'pUiMicroMenu', UIParent)
menu:SetScale(config.micromenu.scale_menu)
menu:SetSize(10, 10)
menu:SetPoint('BOTTOMLEFT', UIParent, 'BOTTOMRIGHT', xOffset, config.micromenu.y_position)
menu:SetScale(1.4)
for _,button in pairs(MICRO_BUTTONS) do
local buttonName = button:GetName():gsub('MicroButton', '')
local name = strlower(buttonName);
Expand All @@ -285,10 +295,10 @@ local function setupMicroButtons(xOffset)
PVPMicroButton:SetDisabledTexture'' -- doesn't exist by default
PVPMicroButton:GetDisabledTexture():set_atlas('ui-hud-micromenu-pvp-disabled-2x')

button:SetParent(pUiMainBar)
button:SetScale(1.4)
button:SetParent(pUiMicroMenu)
-- button:SetScale(1.4)
button:SetSize(14, 19)
button:SetClearPoint('BOTTOMLEFT', menu, 'BOTTOMRIGHT', buttonxOffset, 55)
button:SetClearPoint('BOTTOMLEFT', pUiMicroMenu, 'BOTTOMRIGHT', buttonxOffset, 55)
button.SetPoint = addon._noop
button:SetHitRectInsets(0,0,0,0)

Expand All @@ -311,5 +321,12 @@ addon.package:RegisterEvents(function()
xOffset = -166
end
setupMicroButtons(xOffset + config.micromenu.x_position);
if config.micromenu.hide_on_vehicle then
RegisterStateDriver(pUiMicroMenu, 'visibility', '[vehicleui] hide;show')
RegisterStateDriver(pUiBagsBar, 'visibility', '[vehicleui] hide;show')
else
UnregisterStateDriver(pUiMicroMenu, 'visibility')
UnregisterStateDriver(pUiBagsBar, 'visibility')
end
end, 'PLAYER_LOGIN'
);
2 changes: 2 additions & 0 deletions modules/noop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ do
PetActionBarFrame:EnableMouse(false)
ShapeshiftBarFrame:EnableMouse(false)
PossessBarFrame:EnableMouse(false)
BonusActionBarFrame:EnableMouse(false)
BonusActionBarFrame:SetScale(0.001)

local elements_texture = {
MainMenuXPBarTexture0,
Expand Down
15 changes: 2 additions & 13 deletions modules/vehicle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@ local config = addon.config;
local class = addon._class;
local unpack = unpack;
local ipairs = ipairs;
local UnitOnTaxi = UnitOnTaxi;
local UnitPlayerControlled = UnitPlayerControlled;
local UnitControllingVehicle = UnitControllingVehicle;
local CanExitVehicle = CanExitVehicle;
local RegisterStateDriver = RegisterStateDriver;
local GetSpellInfo = GetSpellInfo;
local CancelUnitBuff = CancelUnitBuff;
local UnitVehicleSkin = UnitVehicleSkin;
local UnitHasVehicleUI = UnitHasVehicleUI;
local UIParent = UIParent;
local _G = getfenv(0);

Expand Down Expand Up @@ -39,10 +32,9 @@ local vehicleExit = CreateFrame(
pUiMainBar,
'SecureHandlerClickTemplate,SecureHandlerStateTemplate'
);

vehicleBarBackground:SetScale(config.mainbars.scale_vehicle)
vehiclebar:ClearAllPoints();
vehiclebar:SetAllPoints(mixin2template);
-- hooksecurefunc('MainMenuBar_UpdateArt', function() return end)

local function vehiclebar_power_setup()
VehicleMenuBarLeaveButton:SetParent(vehiclebar)
Expand Down Expand Up @@ -176,7 +168,6 @@ local function vehiclebutton_position()
button:SetParent(pUiVehicleBar)
button:SetSize(52, 52)
if index == 1 then
-- if not IsVehicleAimAngleAdjustable() then
button:SetPoint('BOTTOMLEFT', pUiVehicleBar, 'BOTTOMRIGHT', -594, 21)
else
local previous = _G['VehicleMenuBarActionButton'..index-1]
Expand Down Expand Up @@ -269,7 +260,7 @@ local function OnEvent(self,event,...)
end

local stance = {
['DRUID'] = '[bonusbar:1,nostealth] 7; [bonusbar:1,stealth] 8; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10;',
['DRUID'] = '[bonusbar:1,nostealth] 7; [bonusbar:1,stealth] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10;',
['WARRIOR'] = '[bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9;',
['PRIEST'] = '[bonusbar:1] 7;',
['ROGUE'] = '[bonusbar:1] 7; [form:3] 7;',
Expand Down Expand Up @@ -300,7 +291,6 @@ pUiMainBar:SetAttribute('_onstate-page', [[
button:SetAttribute('actionpage', tonumber(newstate))
end
]]);

RegisterStateDriver(pUiMainBar, 'page', getbarpage());

local function vehiclebar_initialize()
Expand Down Expand Up @@ -335,6 +325,5 @@ local function vehiclebar_initialize()
]]);
RegisterStateDriver(pUiMainBar, 'vehicle', '[bonusbar:5] 1; 0');
end
-- RegisterStateDriver(vehicleExit, 'visibility', '[vehicleui][target=vehicle,noexists] hide;show')
end
vehiclebar_initialize();
2 changes: 1 addition & 1 deletion pretty_actionbar.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Title: |cff00ffff*|r |cfffff0f5pretty_actionbar|r
## Notes: |cffcaf7faActionbar addon from pretty stuff|r
## Notes-ruRU: |cffcaf7faПанель действий из прекрасного стаффа|r
## Version: 1.0
## Version: 1.0.2
## Author: s0high
## SavedVariables: collapse_state

Expand Down

0 comments on commit 3fbf629

Please sign in to comment.