Skip to content

Commit

Permalink
TWW Updates #10
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkthnx committed Aug 17, 2024
1 parent de84314 commit 5eb7f6a
Show file tree
Hide file tree
Showing 6 changed files with 397 additions and 410 deletions.
38 changes: 17 additions & 21 deletions KkthnxUI/Init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ K.EasyMenu = CreateFrame("Frame", "KKUI_EasyMenu", UIParent, "UIDropDownMenuTemp
K.WowPatch, K.WowBuild, K.WowRelease, K.TocVersion = GetBuildInfo()
K.WowBuild = tonumber(K.WowBuild)

-- Compatibility Layer for Firestorm Dragonflight Release
-- Determine if the game is running on the Firestorm server with the specific patch version 10.1.7.
K.IsFirestorm = K.TocVersion == 100107 -- Check for 10.1.7

-- Color Info
K.GreyColor = "|CFFC0C0C0"
K.InfoColor = "|CFF669DFF"
Expand Down Expand Up @@ -340,22 +336,22 @@ for i = 1, GetNumAddOns() do
K.AddOnVersion[string_lower(Name)] = C_AddOns_GetAddOnMetadata(Name, "Version")
end

local function EasyMenu_Initialize( frame, level, menuList )
for index = 1, #menuList do
local value = menuList[index]
if (value.text) then
value.index = index
UIDropDownMenu_AddButton( value, level )
end
end
end
function EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay )
if ( displayMode == "MENU" ) then
menuFrame.displayMode = displayMode
end
UIDropDownMenu_Initialize(menuFrame, EasyMenu_Initialize, displayMode, nil, menuList)
ToggleDropDownMenu(1, nil, menuFrame, anchor, x, y, menuList, nil, autoHideDelay)
end
local function EasyMenu_Initialize(frame, level, menuList)
for index = 1, #menuList do
local value = menuList[index]
if value.text then
value.index = index
UIDropDownMenu_AddButton(value, level)
end
end
end

function EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay)
if displayMode == "MENU" then
menuFrame.displayMode = displayMode
end
UIDropDownMenu_Initialize(menuFrame, EasyMenu_Initialize, displayMode, nil, menuList)
ToggleDropDownMenu(1, nil, menuFrame, anchor, x, y, menuList, nil, autoHideDelay)
end

_G.KkthnxUI = Engine
18 changes: 8 additions & 10 deletions KkthnxUI/Libraries/cargBags/mixins-add/plugins/tagDisplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,17 @@ tagEvents["money"] = { "PLAYER_MONEY" }

tagPool["accountmoney"] = function()
local money = C_Bank.FetchDepositedMoney(Enum.BankType.Account) or 0
local str = ""
local coppername = "|cffeda55fc|r"
local goldname = "|cffffd700g|r"
local silvername = "|cffc7c7cfs|r"
local gold, silver, copper = floor(money / 1e4), floor(money / 100) % 100, money % 100

if gold > 0 then
str = str .. BreakUpLargeNumbers(gold) .. createAtlasCoin("gold") .. " "
end
if silver > 0 then
str = str .. silver .. createAtlasCoin("silver") .. " "
end
if copper >= 0 then
str = str .. copper .. createAtlasCoin("copper") .. " "
return format("%s%s %02d%s %02d%s", BreakUpLargeNumbers(gold), goldname, silver, silvername, copper, coppername)
elseif silver > 0 then
return format("%d%s %02d%s", silver, silvername, copper, coppername)
else
return format("%d%s", copper, coppername)
end

return str
end
tagEvents["accountmoney"] = { "PLAYER_MONEY", "ACCOUNT_MONEY" }
2 changes: 1 addition & 1 deletion KkthnxUI/Modules/DataText/Elements/Durability.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function Module:CreateDurabilityDataText()
end

DurabilityDataText = CreateFrame("Button", nil, UIParent, "PanelTabButtonTemplate")
DurabilityDataText:SetPoint("TOP", PaperDollFrame, "BOTTOM", 214, 3)
DurabilityDataText:SetPoint("TOP", PaperDollFrame, "BOTTOM", 166, 3)
DurabilityDataText:SetFrameLevel(PaperDollFrame:GetFrameLevel() + 2)
DurabilityDataText:SetParent(PaperDollFrame)
DurabilityDataText:Disable()
Expand Down
41 changes: 36 additions & 5 deletions KkthnxUI/Modules/Inventory/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local string_match = string.match
local table_wipe = table.wipe
local unpack = unpack

local ACCOUNT_BANK_TYPE = Enum.BankType.Account or 2
local C_AzeriteEmpoweredItem_IsAzeriteEmpoweredItemByID = C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItemByID
local C_Container_GetContainerItemInfo = C_Container.GetContainerItemInfo
local C_NewItems_IsNewItem = C_NewItems.IsNewItem
Expand All @@ -34,7 +35,6 @@ local SOUNDKIT = SOUNDKIT
local SortBags = C_Container.SortBags
local SortBankBags = C_Container.SortBankBags
local SortReagentBankBags = C_Container.SortReagentBankBags
local SortAccountBankBags = C_Container.SortAccountBankBags
local SplitContainerItem = C_Container.SplitContainerItem

local deleteEnable
Expand Down Expand Up @@ -394,6 +394,39 @@ function Module:CreateAccountBankButton(f)
return accountBankButton
end

function Module:CreateAccountMoney()
local frame = CreateFrame("Button", nil, self)
frame:SetSize(50, 22)

local tag = self:SpawnPlugin("TagDisplay", "[accountmoney]", self)
tag:SetFontObject(K.UIFontOutline)
tag:SetPoint("RIGHT", frame, -2, 0)
frame.tag = tag

frame:RegisterForClicks("LeftButtonUp", "RightButtonUp")
frame:SetScript("OnClick", function(_, btn)
if btn == "RightButton" then
StaticPopup_Hide("BANK_MONEY_DEPOSIT")
if StaticPopup_Visible("BANK_MONEY_WITHDRAW") then
StaticPopup_Hide("BANK_MONEY_WITHDRAW")
else
StaticPopup_Show("BANK_MONEY_WITHDRAW", nil, nil, { bankType = ACCOUNT_BANK_TYPE })
end
else
StaticPopup_Hide("BANK_MONEY_WITHDRAW")
if StaticPopup_Visible("BANK_MONEY_DEPOSIT") then
StaticPopup_Hide("BANK_MONEY_DEPOSIT")
else
StaticPopup_Show("BANK_MONEY_DEPOSIT", nil, nil, { bankType = ACCOUNT_BANK_TYPE })
end
end
end)
frame.title = K.LeftButton .. BANK_DEPOSIT_MONEY_BUTTON_LABEL .. "|n" .. K.RightButton .. BANK_WITHDRAW_MONEY_BUTTON_LABEL
K.AddTooltip(frame, "ANCHOR_TOP")

return frame
end

function Module:CreateBankButton(f)
local BankButton = CreateFrame("Button", nil, self)
BankButton:SetSize(18, 18)
Expand Down Expand Up @@ -448,7 +481,6 @@ function Module:CreateDepositButton()

DepositButton:RegisterForClicks("AnyUp")
DepositButton:SetScript("OnClick", function(_, btn)
print(btn)
if btn == "RightButton" then
KkthnxUIDB.Variables[K.Realm][K.Name].AutoDeposit = not KkthnxUIDB.Variables[K.Realm][K.Name].AutoDeposit
updateDepositButtonStatus(DepositButton)
Expand All @@ -466,10 +498,8 @@ end

local function updateAccountBankDeposit(bu)
if GetCVarBool("bankAutoDepositReagents") then
print(GetCVarBool("bankAutoDepositReagents"))
bu.KKUI_Border:SetVertexColor(1, 0.8, 0)
else
print(GetCVarBool("bankAutoDepositReagents"))
K.SetBorderColor(bu.KKUI_Border)
end
end
Expand All @@ -492,7 +522,7 @@ function Module:CreateAccountBankDeposit()
SetCVar("bankAutoDepositReagents", isOn and 0 or 1)
updateAccountBankDeposit(AccountBankDepositButton)
else
C_Bank.AutoDepositItemsIntoBank(Enum.BankType.Account)
C_Bank.AutoDepositItemsIntoBank(ACCOUNT_BANK_TYPE)
end
end)
AccountBankDepositButton.title = ACCOUNT_BANK_DEPOSIT_BUTTON_LABEL
Expand Down Expand Up @@ -1616,6 +1646,7 @@ function Module:OnEnable()
buttons[4] = Module.CreateAccountBankDeposit(self)
buttons[5] = Module.CreateBankButton(self, f)
buttons[6] = Module.CreateReagentButton(self, f)
buttons[7] = Module.CreateAccountMoney(self)
end

for i = 1, #buttons do
Expand Down
Loading

0 comments on commit 5eb7f6a

Please sign in to comment.