Skip to content

Commit

Permalink
1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
Azilroka committed Aug 20, 2024
1 parent f62097d commit 4b9f8a7
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 111 deletions.
20 changes: 0 additions & 20 deletions ElvUI_TinkerToolbox/ElvUI_TinkerToolbox-Cata.toc
Original file line number Diff line number Diff line change
@@ -1,20 +0,0 @@
## Interface: 40400
## Title: |cff1784d1ElvUI|r |cfd9b9b9bCata|r |cffffffffTinker Toolbox|r
## Version: 1.23
## Author: Azilroka, Blazeflack, Nihilistzsche
## RequiredDeps: ElvUI
## OptionalDeps: Scrap
## X-Curse-Project-ID: 473233
## X-Wago-ID: Xb6X8o6p

Libraries\FAIAP\FAIAP.lua
Locale\enUS.lua

Shared.lua

Modules\Tags.lua
Modules\DataTexts.lua
Modules\StyleFilters.lua
Modules\BagFilters.lua
Modules\Scrap.lua
Modules\Distributor.lua
20 changes: 0 additions & 20 deletions ElvUI_TinkerToolbox/ElvUI_TinkerToolbox-Classic.toc
Original file line number Diff line number Diff line change
@@ -1,20 +0,0 @@
## Interface: 11401
## Title: |cff1784d1ElvUI|r |cffffffffTinker Toolbox|r
## Version: 1.23
## Author: Azilroka, Blazeflack, Nihilistzsche
## RequiredDeps: ElvUI
## OptionalDeps: Scrap
## X-Curse-Project-ID: 473233
## X-Wago-ID: Xb6X8o6p

Libraries\FAIAP\FAIAP.lua
Locale\enUS.lua

Shared.lua

Modules\Tags.lua
Modules\DataTexts.lua
Modules\StyleFilters.lua
Modules\BagFilters.lua
Modules\Scrap.lua
Modules\Distributor.lua
2 changes: 1 addition & 1 deletion ElvUI_TinkerToolbox/ElvUI_TinkerToolbox.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100005
## Interface: 110002, 40400, 11503
## Title: |cff1784d1ElvUI|r |cffffffffTinker Toolbox|r
## Version: 1.23
## Author: Azilroka, Blazeflack, Nihilistzsche
Expand Down
56 changes: 6 additions & 50 deletions ElvUI_TinkerToolbox/Libraries/FAIAP/FAIAP.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@
-- Read through this code for further usage help.
-- (The documentation IS the code)

local E = ElvUI[1]
local lib = {}
lib.revision = 1

E.Libs.luaSyntax = lib
local MAJOR, MINOR = "LibFAIAP", 17
local lib = LibStub:NewLibrary(MAJOR, MINOR)
if not lib then return end

local defaultTabWidth = 2

Expand Down Expand Up @@ -951,7 +949,8 @@ function lib.padWithLinebreaks(code)
return code .. "\n\n", true
end

local defaultColorTable
local defaultColorTable = {}
lib.defaultColorTable = defaultColorTable

-- Data tables
-- No weak table magic, since editboxes can never be removed in WoW
Expand All @@ -970,7 +969,7 @@ end
function lib.colorCodeEditbox(editbox)
dirty[editbox] = nil

local colorTable = editbox.faiap_colorTable or defaultColorTable
local colorTable = editbox.faiap_colorTable or lib.defaultColorTable

local orgCode = editboxGetText(editbox)
local prevCode = editboxStringCache[editbox]
Expand Down Expand Up @@ -1199,46 +1198,3 @@ function lib.disable(editbox)
editboxStringCache[editbox] = nil
editboxNumLinesCache[editbox] = nil
end

-- ElvUI modified default color table: based on Monokai
defaultColorTable = {}
lib.defaultColorTable = defaultColorTable
defaultColorTable[tokens.TOKEN_SPECIAL] = "|c00f92672"
defaultColorTable[tokens.TOKEN_KEYWORD] = "|c00f92672"
defaultColorTable[tokens.TOKEN_COMMENT_SHORT] = "|c0075715e"
defaultColorTable[tokens.TOKEN_COMMENT_LONG] = "|c0075715e"

local stringColor = "|c00e6db74"
defaultColorTable[tokens.TOKEN_STRING] = stringColor
defaultColorTable[".."] = stringColor

local tableColor = "|c00e6db74"
defaultColorTable["..."] = tableColor
defaultColorTable["("] = tableColor
defaultColorTable[")"] = tableColor
defaultColorTable["{"] = tableColor
defaultColorTable["}"] = tableColor
defaultColorTable["["] = tableColor
defaultColorTable["]"] = tableColor

local arithmeticColor = "|c00ae81ff"
defaultColorTable[tokens.TOKEN_NUMBER] = arithmeticColor
defaultColorTable["+"] = arithmeticColor
defaultColorTable["-"] = arithmeticColor
defaultColorTable["/"] = arithmeticColor
defaultColorTable["*"] = arithmeticColor

local logicColor1 = "|c00f92672"
defaultColorTable["=="] = logicColor1
defaultColorTable["<"] = logicColor1
defaultColorTable["<="] = logicColor1
defaultColorTable[">"] = logicColor1
defaultColorTable[">="] = logicColor1
defaultColorTable["~="] = logicColor1

local logicColor2 = "|c00f92672"
defaultColorTable["and"] = logicColor2
defaultColorTable["or"] = logicColor2
defaultColorTable["not"] = logicColor2

defaultColorTable[0] = "|r"
20 changes: 10 additions & 10 deletions ElvUI_TinkerToolbox/Modules/BagFilters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ local tinsert = tinsert

local CopyTable = CopyTable

local GetItemInfo = GetItemInfo
local GetItemStats = GetItemStats

local C_Item_DoesItemExist = C_Item and C_Item.DoesItemExist
local C_Item_GetCurrentItemLevel = C_Item and C_Item.GetCurrentItemLevel
local GetDetailedItemLevelInfo = GetDetailedItemLevelInfo
local GetItemInfo = C_Item.GetItemInfo
local GetItemStats = C_Item.GetItemStats
local DoesItemExist = C_Item.DoesItemExist
local GetCurrentItemLevel = C_Item.GetCurrentItemLevel
local GetDetailedItemLevelInfo = C_Item.GetDetailedItemLevelInfo

local CreateFrame = CreateFrame
local ToggleFrame = ToggleFrame
Expand Down Expand Up @@ -128,8 +127,8 @@ function CBF:CacheBagItems(bagID)
cache.unscaledItemLevel = GetDetailedItemLevelInfo(cache.hyperlink)
end

if _G.C_Item and C_Item_DoesItemExist(cache.itemLocation) then
cache.itemLevel = C_Item_GetCurrentItemLevel(cache.itemLocation)
if DoesItemExist(cache.itemLocation) then
cache.itemLevel = GetCurrentItemLevel(cache.itemLocation)

if EQSlots[cache.itemEquipLoc] then
cache.isEquipment = true
Expand All @@ -140,7 +139,7 @@ function CBF:CacheBagItems(bagID)
minSlot = EQSlots[cache.itemEquipLoc]
end
for slot = minSlot, (maxSlot or minSlot) do
cache.isItemUpgrade = CBF.InventorySlotsLocations[slot] and cache.itemLevel > (C_Item_DoesItemExist(CBF.InventorySlotsLocations[slot]) and C_Item_GetCurrentItemLevel(CBF.InventorySlotsLocations[slot]) or 0)
cache.isItemUpgrade = CBF.InventorySlotsLocations[slot] and cache.itemLevel > (DoesItemExist(CBF.InventorySlotsLocations[slot]) and GetCurrentItemLevel(CBF.InventorySlotsLocations[slot]) or 0)
if cache.isItemUpgrade then
break
end
Expand Down Expand Up @@ -187,8 +186,8 @@ function CBF:Tooltip_Show()
end

if self.ttText2 then
GameTooltip:AddLine(' ')
if self.ttText2desc then
GameTooltip:AddLine(' ')
GameTooltip:AddDoubleLine(self.ttText2, self.ttText2desc, .8, .8, .8, .8, .8, .8)
else
GameTooltip:AddLine(self.ttText2)
Expand Down Expand Up @@ -346,6 +345,7 @@ function CBF:CreateGroup(name)
end
end

option.args.func.luaSyntax = true
option.args.delete = ACH:Execute(L['Delete'], nil, 0, function(info) CBF:DeleteFilter(info[#info - 1]) CBF:DeleteGroup(info[#info - 1]) CBF:SelectGroup() end, nil, format('Delete - %s?', name), 'full')
option.args.export = ACH:Input(L['Export Data'], nil, -1, 10, 'full', function(info) return TT:ExportData(info[#info - 1], TT:JoinDBKey('CustomBagFilters', 'Filters')) end)

Expand Down
4 changes: 2 additions & 2 deletions ElvUI_TinkerToolbox/Modules/Distributor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ function CPD:GetOptions()
optionsPath.customprofiledistributor.args.exportTools.args.export = ACH:Group(' ', nil, -1)
optionsPath.customprofiledistributor.args.exportTools.args.export.inline = true
optionsPath.customprofiledistributor.args.exportTools.args.export.args.exec = ACH:Execute(L["Export"], nil, 1, function() CPD.config.exportedData = CPD:GetProfileExport(CPD.config.profileType) end, nil, nil, 'full', nil, nil, function() return CPD.config.profileType ~= 'global' and (CPD.config.profileFrom == '' or CPD.config.exportType == 'compare' and CPD.config.compareProfile == '') end)
optionsPath.customprofiledistributor.args.exportTools.args.export.args.exportedData = ACH:Input('', nil, 2, 40, 'full', function() return CPD.config.exportedData end, nil, nil, function() return CPD.config.exportedData == '' end)
optionsPath.customprofiledistributor.args.exportTools.args.export.args.exportedData = ACH:Input('', nil, 2, 20, 'full', function() return CPD.config.exportedData end, nil, nil, function() return CPD.config.exportedData == '' end)

optionsPath.customprofiledistributor.args.importTools = ACH:Group(L["Import Tools"], nil, 1)
optionsPath.customprofiledistributor.args.importTools.args.importedData = ACH:Input('', nil, 1, 40, 'full', function() return CPD.config.importedData end, function(_, value) importNeedsRefresh = true CPD.config.importedData = value CPD.config.importName = select(2, D:Decode(value)) end)
optionsPath.customprofiledistributor.args.importTools.args.importedData = ACH:Input('', nil, 1, 20, 'full', function() return CPD.config.importedData end, function(_, value) importNeedsRefresh = true CPD.config.importedData = value CPD.config.importName = select(2, D:Decode(value)) end)
optionsPath.customprofiledistributor.args.importTools.args.importedDesc = ACH:Description(function() return CPD.config.importName or '' end, 2, 'medium', nil, nil, nil, nil, nil, function() return not CPD.config.importedData end)
optionsPath.customprofiledistributor.args.importTools.args.customImport = ACH:MultiSelect('', nil, 4, CPD.GetCustomImport, nil, nil, function(_, key) return CPD.config.importCustom[key] end, function(_, key, value) CPD.config.importCustom[key] = value or nil end, nil, function() return not CPD.config.importedData end)

Expand Down
2 changes: 1 addition & 1 deletion ElvUI_TinkerToolbox/Modules/Scrap.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if not IsAddOnLoaded("Scrap") then return end
if not C_AddOns.IsAddOnLoaded("Scrap") then return end
local TT = unpack(ElvUI_TinkerToolbox)
local E, L, V, P, G = unpack(ElvUI)
local TTS = TT:NewModule('TinkerToolboxScrap')
Expand Down
63 changes: 56 additions & 7 deletions ElvUI_TinkerToolbox/Shared.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local _, Engine = ...
local E, L, V, P, G = unpack(ElvUI) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local E, L, V, P, G = unpack(ElvUI)
local TT = E:NewModule('TinkerToolbox', 'AceEvent-3.0', 'AceHook-3.0', 'AceTimer-3.0', 'AceSerializer-3.0')
local ACH = E.Libs.ACH

Expand Down Expand Up @@ -94,27 +94,76 @@ function TT:ExportData(name, dbKey)
return printableString
end

function TT:CallModuleFunction(module, func)
function TT:ProtectedCall(module, func)
local pass, err = pcall(func, module)
if not pass and TT.Debug then
print(err)
error(err)
end
end

function TT:GetOptions()
E.Libs.AceGUI.luaSyntax = E.Libs.luaSyntax

for _, module in TT:IterateModules() do
if module.GetOptions then
TT:CallModuleFunction(module, module.GetOptions)
TT:ProtectedCall(module, module.GetOptions)
end
end
end

function TT:SetupFAIAP()
local FAIAP = LibStub('LibFAIAP', true)
E.Libs.luaSyntax = FAIAP
E.Libs.AceGUI.luaSyntax = FAIAP

local monokai = {}
monokai[FAIAP.tokens.TOKEN_SPECIAL] = "|c00f92672"
monokai[FAIAP.tokens.TOKEN_KEYWORD] = "|c00f92672"
monokai[FAIAP.tokens.TOKEN_COMMENT_SHORT] = "|c0075715e"
monokai[FAIAP.tokens.TOKEN_COMMENT_LONG] = "|c0075715e"

local stringColor = "|c00e6db74"
monokai[FAIAP.tokens.TOKEN_STRING] = stringColor
monokai[".."] = stringColor

local tableColor = "|c00e6db74"
monokai["..."] = tableColor
monokai["("] = tableColor
monokai[")"] = tableColor
monokai["{"] = tableColor
monokai["}"] = tableColor
monokai["["] = tableColor
monokai["]"] = tableColor

local arithmeticColor = "|c00ae81ff"
monokai[FAIAP.tokens.TOKEN_NUMBER] = arithmeticColor
monokai["+"] = arithmeticColor
monokai["-"] = arithmeticColor
monokai["/"] = arithmeticColor
monokai["*"] = arithmeticColor

local logicColor1 = "|c00f92672"
monokai["=="] = logicColor1
monokai["<"] = logicColor1
monokai["<="] = logicColor1
monokai[">"] = logicColor1
monokai[">="] = logicColor1
monokai["~="] = logicColor1

local logicColor2 = "|c00f92672"
monokai["and"] = logicColor2
monokai["or"] = logicColor2
monokai["not"] = logicColor2

monokai[0] = "|r"

E.Libs.luaSyntax.defaultColorTable = monokai
end

function TT:Initialize()
TT:SetupFAIAP()

for _, module in TT:IterateModules() do
if module.Initialize then
TT:CallModuleFunction(module, module.Initialize)
TT:ProtectedCall(module, module.Initialize)
end
end

Expand Down

0 comments on commit 4b9f8a7

Please sign in to comment.