-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fd2b797
Showing
11 changed files
with
433 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vscode | ||
examples | ||
sandbox.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# World of Warcraft (client version 1.12) Tweaks and Fixes | ||
|
||
Readme incomplete, but I'll get to it eventually. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## Interface: 11200 | ||
## Title: TurtleTweaks | ||
## Author: Mitja Felicijan ([email protected]) | ||
## Notes: A bunch of tweaks for Turtle WoW. | ||
## Version: 1.0 | ||
|
||
## SavedVariablesPerCharacter: LootAtMouse | ||
## SavedVariablesPerCharacter: BagSlots | ||
## SavedVariablesPerCharacter: RestedBar | ||
## SavedVariablesPerCharacter: ReloadUI | ||
|
||
# UI stuff | ||
settings.lua | ||
|
||
# Commands | ||
reload.lua | ||
align.lua | ||
|
||
# Tweaks | ||
rested.lua | ||
loot.lua | ||
worldmap.lua | ||
bagslots.lua | ||
|
||
# Experimental | ||
experimental.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
-- Adds /align command to toggle a grid overlay. | ||
-- Author: Amadeo ([email protected]) | ||
|
||
local grid | ||
local boxSize = 32 | ||
|
||
function Grid_Show() | ||
if not grid then | ||
Grid_Create() | ||
elseif grid.boxSize ~= boxSize then | ||
grid:Hide() | ||
Grid_Create() | ||
else | ||
grid:Show() | ||
end | ||
end | ||
|
||
function Grid_Hide() | ||
if grid then | ||
grid:Hide() | ||
end | ||
end | ||
|
||
local isAligning = false | ||
SLASH_TOGGLEGRID1 = "/align" | ||
SlashCmdList["TOGGLEGRID"] = function(arg) | ||
if isAligning then | ||
Grid_Hide() | ||
isAligning = false | ||
else | ||
boxSize = (math.ceil((tonumber(arg) or boxSize) / 32) * 32) | ||
if boxSize > 128 then boxSize = 128 end | ||
Grid_Show() | ||
isAligning = true | ||
end | ||
end | ||
|
||
function Grid_Create() | ||
grid = CreateFrame('Frame', nil, UIParent) | ||
grid.boxSize = boxSize | ||
grid:SetAllPoints(UIParent) | ||
|
||
local size = 2 | ||
local width = GetScreenWidth() | ||
local ratio = width / GetScreenHeight() | ||
local height = GetScreenHeight() * ratio | ||
|
||
local wStep = width / boxSize | ||
local hStep = height / boxSize | ||
|
||
for i = 0, boxSize do | ||
local tx = grid:CreateTexture(nil, 'BACKGROUND') | ||
if i == boxSize / 2 then | ||
tx:SetTexture(1, 0, 0, 0.5) | ||
else | ||
tx:SetTexture(0, 0, 0, 0.5) | ||
end | ||
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", i * wStep - (size / 2), 0) | ||
tx:SetPoint('BOTTOMRIGHT', grid, 'BOTTOMLEFT', i * wStep + (size / 2), 0) | ||
end | ||
height = GetScreenHeight() | ||
|
||
do | ||
local tx = grid:CreateTexture(nil, 'BACKGROUND') | ||
tx:SetTexture(1, 0, 0, 0.5) | ||
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height / 2) + (size / 2)) | ||
tx:SetPoint('BOTTOMRIGHT', grid, 'TOPRIGHT', 0, -(height / 2 + size / 2)) | ||
end | ||
|
||
for i = 1, math.floor((height / 2) / hStep) do | ||
local tx = grid:CreateTexture(nil, 'BACKGROUND') | ||
tx:SetTexture(0, 0, 0, 0.5) | ||
|
||
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height / 2 + i * hStep) + (size / 2)) | ||
tx:SetPoint('BOTTOMRIGHT', grid, 'TOPRIGHT', 0, -(height / 2 + i * hStep + size / 2)) | ||
|
||
tx = grid:CreateTexture(nil, 'BACKGROUND') | ||
tx:SetTexture(0, 0, 0, 0.5) | ||
|
||
tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height / 2 - i * hStep) + (size / 2)) | ||
tx:SetPoint('BOTTOMRIGHT', grid, 'TOPRIGHT', 0, -(height / 2 - i * hStep + size / 2)) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
-- Adds a number of free bag slots to the backpack button. | ||
-- Author: Mitja Felicijan ([email protected]) | ||
-- Inspired by https://github.com/anzz1/FreeBagSlots | ||
|
||
local frame = CreateFrame("FRAME") | ||
|
||
frame:RegisterEvent("ADDON_LOADED") | ||
frame:RegisterEvent('PLAYER_LOGIN') | ||
frame:RegisterEvent('BAG_UPDATE') | ||
|
||
frame:SetScript("OnEvent", function() | ||
-- Fallback to default behavior if the user has disabled this feature. | ||
if event == "ADDON_LOADED" then | ||
if BagSlots == nil then | ||
BagSlots = {} | ||
BagSlots["enabled"] = true | ||
BagSlots["config"] = {} | ||
end | ||
end | ||
|
||
-- Updates the number of free bag slots. | ||
if BagSlots and BagSlots["enabled"] then | ||
if event == "PLAYER_LOGIN" or event == "BAG_UPDATE" then | ||
local backpackButton = MainMenuBarBackpackButton | ||
|
||
if not backpackButton then return end | ||
if not backpackButton then return end | ||
if not backpackButton.text then | ||
backpackButton.text = backpackButton:CreateFontString(nil, 'OVERLAY', 'NumberFontNormal') | ||
backpackButton.text:SetTextColor(1, 1, 1) | ||
backpackButton.text:SetPoint('BOTTOMRIGHT', backpackButton, 'BOTTOMRIGHT', -5, 2) | ||
backpackButton.text:SetDrawLayer('OVERLAY', 2) | ||
end | ||
|
||
local totalFree = 0 | ||
local freeSlots = 0 | ||
|
||
for i = 0, NUM_BAG_SLOTS do | ||
freeSlots = 0 | ||
for slot = 1, GetContainerNumSlots(i) do | ||
local texture = GetContainerItemInfo(i, slot) | ||
if not (texture) then | ||
freeSlots = freeSlots + 1 | ||
end | ||
end | ||
totalFree = totalFree + freeSlots | ||
end | ||
|
||
backpackButton.freeSlots = totalFree | ||
backpackButton.text:SetText(string.format('(%s)', totalFree)) | ||
end | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-- Nothing to see here, move along! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- Opens the loot window at the current cursor position. | ||
-- Author: Mitja Felicijan ([email protected]) | ||
|
||
local frame = CreateFrame("FRAME") | ||
|
||
frame:RegisterEvent("ADDON_LOADED") | ||
frame:RegisterEvent("LOOT_OPENED") | ||
|
||
frame:SetScript("OnEvent", function() | ||
-- Fallback to default behavior if the user has disabled this feature. | ||
if event == "ADDON_LOADED" then | ||
if LootAtMouse == nil then | ||
LootAtMouse = {} | ||
LootAtMouse["enabled"] = true | ||
LootAtMouse["config"] = {} | ||
end | ||
end | ||
|
||
-- Open the loot window at the current cursor position. | ||
if LootAtMouse and LootAtMouse["enabled"] then | ||
if event == "LOOT_OPENED" then | ||
local x, y = GetCursorPosition() | ||
local scale = UIParent:GetScale() | ||
local lootFrame = LootFrame | ||
|
||
lootFrame:ClearAllPoints() | ||
lootFrame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x / scale, y / scale) | ||
end | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- Adds /reloadui, /reload, and /rl commands to reload the UI. | ||
-- Author: Mitja Felicijan ([email protected]) | ||
|
||
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 ReloadUI == nil then | ||
ReloadUI = {} | ||
ReloadUI["enabled"] = true | ||
ReloadUI["config"] = {} | ||
end | ||
|
||
-- Registers the slash commands. | ||
if ReloadUI["enabled"] then | ||
SLASH_TweeksReloadUI1 = "/reloadui" | ||
SLASH_TweeksReloadUI2 = "/reload" | ||
SLASH_TweeksReloadUI3 = "/rl" | ||
|
||
SlashCmdList["TweeksReloadUI"] = function(msg, editbox) | ||
ConsoleExec("reloadui") | ||
end | ||
end | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
-- Adds rested bar to player frame. | ||
-- Author: Mitja Felicijan ([email protected]) | ||
-- Inspired by https://github.com/Steelbash/RestBar | ||
|
||
local frame = CreateFrame("FRAME") | ||
|
||
local lastRestValue = 0 | ||
local currentRestValue = 0 | ||
local statusBar = nil | ||
|
||
frame:RegisterEvent("ADDON_LOADED") | ||
frame:RegisterEvent("UPDATE_EXHAUSTION") | ||
frame:RegisterEvent("PLAYER_UPDATE_RESTING") | ||
frame:RegisterEvent("PLAYER_ENTERING_WORLD") | ||
|
||
-- Calculates the percentage of rested XP. | ||
frame.getRestedPercentage = function() | ||
local unit = "player" | ||
local max = UnitXPMax(unit) or 0 | ||
local exhaustion = GetXPExhaustion() or 0 | ||
local maxValue = max * 1.5 | ||
|
||
return math.floor(exhaustion / maxValue * 100) | ||
end | ||
|
||
frame:SetScript("OnEvent", function() | ||
-- Fallback to default behavior if the user has disabled this feature. | ||
if event == "ADDON_LOADED" then | ||
if RestedBar == nil then | ||
RestedBar = {} | ||
RestedBar["enabled"] = true | ||
RestedBar["config"] = {} | ||
RestedBar["config"]["position"] = "top" | ||
end | ||
end | ||
|
||
if RestedBar and RestedBar["enabled"] then | ||
-- Creates a frame for the rested bar. | ||
if event == "PLAYER_ENTERING_WORLD" then | ||
currentRestValue = frame.getRestedPercentage() | ||
|
||
statusBar = CreateFrame("StatusBar", nil, PlayerFrame, "TextStatusBar") | ||
statusBar:SetWidth(100) | ||
statusBar:SetHeight(12) | ||
statusBar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar") | ||
statusBar:SetStatusBarColor(255, 0, 255) | ||
|
||
statusBar.bg = statusBar:CreateTexture(nil, "BACKGROUND") | ||
statusBar.bg:SetAllPoints(statusBar) | ||
statusBar.bg:SetTexture(TEXTURE) | ||
statusBar.bg:SetVertexColor(0, 0, 0, 0.5) | ||
|
||
statusBar.bd = statusBar:CreateTexture(nil, "OVERLAY") | ||
statusBar.bd:SetWidth(120) | ||
statusBar.bd:SetHeight(18) | ||
statusBar.bd:SetTexture("Interface\\CharacterFrame\\UI-CharacterFrame-GroupIndicator") | ||
|
||
statusBar.text = statusBar:CreateFontString(nil, "OVERLAY") | ||
statusBar.text:SetPoint("CENTER", 0, 0) | ||
statusBar.text:SetFont(STANDARD_TEXT_FONT, 8, "OUTLINE") | ||
|
||
statusBar.tick = statusBar:CreateFontString(nil, "OVERLAY") | ||
statusBar.tick:SetPoint("LEFT", 110, 0) | ||
statusBar.tick:SetFont(STANDARD_TEXT_FONT, 12, "OUTLINE") | ||
statusBar.tick:SetTextColor(205, 0, 205, 1) | ||
|
||
statusBar:ClearAllPoints() | ||
|
||
if RestedBar["config"]["position"] == "top" then | ||
statusBar:SetPoint("TOPLEFT", 114, -10) | ||
statusBar.bd:SetPoint("TOPLEFT", -10, 4) | ||
statusBar.bd:SetTexCoord(0.0234375, 0.6875, 0.0, 1.0) | ||
end | ||
|
||
if RestedBar["config"]["position"] == "bottom" then | ||
statusBar:SetPoint("BOTTOMLEFT", 114, 23) | ||
statusBar.bd:SetPoint("TOPLEFT", -12, 0) | ||
statusBar.bd:SetTexCoord(0.0234375, 0.6875, 1.0, 0.0) | ||
end | ||
end | ||
|
||
-- Updates the rested bar when the player gains or loses rested state. | ||
if event == "UPDATE_EXHAUSTION" or event == "PLAYER_UPDATE_RESTING" then | ||
currentRestValue = frame.getRestedPercentage() | ||
end | ||
end | ||
end) | ||
|
||
-- Updates the UI rested bar. | ||
frame:SetScript("OnUpdate", function() | ||
if RestedBar and RestedBar["enabled"] then | ||
if lastRestValue ~= currentRestValue then | ||
lastRestValue = currentRestValue | ||
statusBar.text:SetText(lastRestValue .. "%") | ||
end | ||
end | ||
end) |
Oops, something went wrong.