Skip to content

Commit

Permalink
Merge pull request #8 from mitjafelicijan/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
mitjafelicijan authored May 14, 2023
2 parents 2e33faf + 94c5590 commit d979d09
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 16 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ I haven't tested it with any other clients, but it may work with others.

## Screenshots

![Settings panel](https://github.com/mitjafelicijan/TurtleTweaks/assets/296714/45bcaab2-246c-4f49-9bcc-c5c6c761028b)
![Settings panel](https://github.com/mitjafelicijan/TurtleTweaks/assets/296714/910bfad2-9c78-4b35-bc48-e58f7cafa840)

## Features

Expand All @@ -50,6 +50,7 @@ I haven't tested it with any other clients, but it may work with others.
- Maximum Camera Distance slider to the options.
- Default nameplate scaling slider to the options that can fix large nameplates.
- Enables World Map to be opened in a window and scaled.
- Adds cooldown timers to the actionbar buttons.

## Development Information

Expand Down
16 changes: 9 additions & 7 deletions TurtleTweaks.toc
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@
## SavedVariablesPerCharacter: RestedBar
## SavedVariablesPerCharacter: Nameplates
## SavedVariablesPerCharacter: WorldmapWindow
## SavedVariablesPerCharacter: CooldownTimers

# Debugging
debug.lua

# Commands
commands.lua
tweaks\commands.lua

# Tweaks
rested-bar.lua
loot-at-mouse.lua
bag-slots.lua
camera-distance.lua
nameplates.lua
worldmap-window.lua
tweaks\rested-bar.lua
tweaks\loot-at-mouse.lua
tweaks\bag-slots.lua
tweaks\camera-distance.lua
tweaks\nameplates.lua
tweaks\worldmap-window.lua
tweaks\cooldown-timers.lua

# Sandbox stuff
sandbox.lua
Expand Down
6 changes: 3 additions & 3 deletions debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ frame:SetScript("OnEvent", function()
local reloadUiButton = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate")
reloadUiButton:SetWidth(110)
reloadUiButton:SetHeight(25)
reloadUiButton:SetPoint("BOTTOMRIGHT", -30, 30)
reloadUiButton:SetPoint("BOTTOMRIGHT", -60, 30)
reloadUiButton:SetText("Reload UI")
reloadUiButton:SetScript("OnClick", function(self, event, ...)
ConsoleExec("reloadui")
Expand All @@ -41,7 +41,7 @@ frame:SetScript("OnEvent", function()
local toggleNameplatesButton = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate")
toggleNameplatesButton:SetWidth(110)
toggleNameplatesButton:SetHeight(25)
toggleNameplatesButton:SetPoint("BOTTOMRIGHT", -30, 65)
toggleNameplatesButton:SetPoint("BOTTOMRIGHT", -60, 65)
toggleNameplatesButton:SetText("Toggle Plates")
toggleNameplatesButton:SetScript("OnClick", function(self, event, ...)
if Debug.config.autoDisplayNameplates then
Expand All @@ -60,7 +60,7 @@ frame:SetScript("OnEvent", function()
local settingsButton = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate")
settingsButton:SetWidth(110)
settingsButton:SetHeight(25)
settingsButton:SetPoint("BOTTOMRIGHT", -30, 100)
settingsButton:SetPoint("BOTTOMRIGHT", -60, 100)
settingsButton:SetText("Settings")
settingsButton:SetScript("OnClick", function(self, event, ...)
settings:Show()
Expand Down
15 changes: 10 additions & 5 deletions settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Contents: Adds settings panel and attaches a button to the main menu.

local maxWidth = 570
local maxHeight = 440
local maxHeight = 470
local alreadyLoaded = false

-- No local here since this is used in other files.
Expand All @@ -17,7 +17,7 @@ settings:SetScript("OnEvent", function()
settings:Hide()

-- Create a frame for our addon and position it in the center of the screen.
settings:SetPoint("CENTER", UIParent, "CENTER", 0, 100)
settings:SetPoint("CENTER", UIParent, "CENTER", 0, 50)
settings:SetWidth(maxWidth)
settings:SetHeight(maxHeight)

Expand Down Expand Up @@ -58,6 +58,7 @@ settings:SetScript("OnEvent", function()
RestedBarUI.cancel()
LootAtMouseUI.cancel()
CommandsUI.cancel()
CooldownTimersUI.cancel()
CameraDistanceUI.cancel()
NameplatesUI.cancel()
WorldmapWindowUI.cancel()
Expand All @@ -77,6 +78,7 @@ settings:SetScript("OnEvent", function()
RestedBarUI.save()
LootAtMouseUI.save()
CommandsUI.save()
CooldownTimersUI.save()
CameraDistanceUI.save()
NameplatesUI.save()
WorldmapWindowUI.save()
Expand All @@ -96,6 +98,7 @@ settings:SetScript("OnEvent", function()
RestedBarUI.reset()
LootAtMouseUI.reset()
CommandsUI.reset()
CooldownTimersUI.reset()
CameraDistanceUI.reset()
NameplatesUI.reset()
WorldmapWindowUI.reset()
Expand Down Expand Up @@ -131,9 +134,11 @@ settings:SetScript("OnEvent", function()
RestedBarUI.form(settings.container, -90)
LootAtMouseUI.form(settings.container, -130)
CommandsUI.form(settings.container, -170)
WorldmapWindowUI.form(settings.container, -255, 20)
NameplatesUI.form(settings.container, -255, 280)
CameraDistanceUI.form(settings.container, -330)
CooldownTimersUI.form(settings.container, -210)

WorldmapWindowUI.form(settings.container, -295, 20)
NameplatesUI.form(settings.container, -295, 280)
CameraDistanceUI.form(settings.container, -370)

SLASH_TurtleTweaks1 = "/vt"
SLASH_TurtleTweaks2 = "/TurtleTweaks"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
83 changes: 83 additions & 0 deletions tweaks/cooldown-timers.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
local frame = CreateFrame("Frame")

frame:RegisterEvent("ADDON_LOADED")

frame:SetScript("OnEvent", function()
-- Fallback to default behavior if the user has disabled this feature.
if event == "ADDON_LOADED" then
if CooldownTimers == nil then
CooldownTimers = {
enabled = false,
config = {}
}
end
end
end)

local function GetButton(i)
if i <= 12 then
return getglobal("ActionButton" .. i)
elseif i <= 24 then
return getglobal("MultiBarBottomRightButton" .. (i - 12))
elseif i <= 36 then
return getglobal("MultiBarBottomLeftButton" .. (i - 24))
elseif i <= 48 then
return getglobal("MultiBarRightButton" .. (i - 36))
else
return getglobal("MultiBarLeftButton" .. (i - 48))
end
end

frame:SetScript("OnUpdate", function(self, elapsed)
if CooldownTimers and CooldownTimers.enabled then
for i = 1, 120 do
local start, duration, enable = GetActionCooldown(i)
if start and duration and enable then
local cooldown = start + duration - GetTime()
local button = GetButton(i)
if button then
if not button.cooldownText then
local textFrame = CreateFrame("Frame", nil, button)
textFrame:SetAllPoints(button)
textFrame:SetFrameLevel(button:GetFrameLevel() + 5)
button.cooldownText = textFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
button.cooldownText:SetPoint("CENTER", textFrame, "CENTER", 0, 0)
button.cooldownText:SetFont(STANDARD_TEXT_FONT, 13, "OUTLINE")
end
if cooldown > 0 then
button.cooldownText:SetText(string.format("%.1f", cooldown))
else
button.cooldownText:SetText("")
end
end
end
end
end
end)

-- Holds all the UI elements for settings.
CooldownTimersUI = {
enabled = nil,
form = function(container, verticalOffset)
CooldownTimersUI.enabled = CreateFrame("CheckButton", nil, container, "UICheckButtonTemplate")
CooldownTimersUI.enabled:SetPoint("TOPLEFT", 20, verticalOffset)
CooldownTimersUI.enabled:SetChecked(CooldownTimers.enabled)

local titleLabel = CooldownTimersUI.enabled:CreateFontString(nil, "OVERLAY", "GameFontNormal")
titleLabel:SetPoint("LEFT", CooldownTimersUI.enabled, "RIGHT", 10, 7)
titleLabel:SetText("Cooldown Timers")

local descriptionLabel = CooldownTimersUI.enabled:CreateFontString("Status", "LOW", "GameFontHighlightSmall")
descriptionLabel:SetPoint("LEFT", CooldownTimersUI.enabled, "RIGHT", 10, -7)
descriptionLabel:SetText("Enables cooldown timer frames in actionbars.")
end,
save = function()
CooldownTimers.enabled = (CooldownTimersUI.enabled:GetChecked() and true or false)
end,
cancel = function()
CooldownTimersUI.enabled:SetChecked(CooldownTimers.enabled)
end,
reset = function()
CooldownTimers = nil
end
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions worldmap-window.lua → tweaks/worldmap-window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,19 @@ frame:SetScript("OnEvent", function()
UIPanelWindows.WorldMapFrame = { area = "CENTER" }
UIPanelWindows.WorldMapFrame.allowOtherPanels = true

-- Enables the world map to be moved.
-- FIXME: This is not working.
WorldMapFrame:SetMovable(true)
WorldMapFrame:RegisterForDrag("LeftButton")
WorldMapFrame:SetScript("OnDragStart", function() WorldMapFrame:StartMoving() end)
WorldMapFrame:SetScript("OnDragStop", function() WorldMapFrame:StopMovingOrSizing() end)

-- Hide the black background.
BlackoutWorld:Hide();

-- Triggered when the world map is opened.
WorldMapFrame:SetScript("onShow", function()
WorldMapFrame:EnableMouse(true)
WorldMapFrame:EnableKeyboard(false)
WorldMapFrame:EnableMouseWheel(true)
WorldMapFrame:SetScale(WorldmapWindow.config.scale)
Expand Down

0 comments on commit d979d09

Please sign in to comment.