Skip to content

Commit

Permalink
refactor: 优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
DengSir committed Sep 5, 2024
1 parent 625355e commit 383ebbb
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 39 deletions.
2 changes: 2 additions & 0 deletions Addon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ local ShowUIPanel = LibStub('LibShowUIPanel-1.0').ShowUIPanel
---@field GlyphFrame UI.GlyphFrame
---@field PaperDoll UI.PaperDoll
---@field InspectTalent UI.InspectTalent
---@field ModelFrame UI.ModelFrame
---@field SlotItem UI.SlotItem
ns.UI = {}
ns.L = LibStub('AceLocale-3.0'):GetLocale('tdInspect')

Expand Down
28 changes: 19 additions & 9 deletions Api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,6 @@ end
local cache = {}
function ns.GetItemGems(link, out)
return FillGem(out or wipe(cache), link:match('item:%d+:?[-%d]*:?(%d*):?(%d*):?(%d*):?(%d*)'))
-- out = out or wipe(cache)
-- for i = 1, 4 do
-- local _, gemLink = GetItemGem(link, i)
-- local gemId = gemLink and ns.ItemLinkToId(gemLink)
-- if gemId then
-- tinsert(out, gemId)
-- end
-- end
-- return out
end

function ns.GetGlyphIdBySpellId(spellId)
Expand Down Expand Up @@ -173,3 +164,22 @@ function ns.GetItemEnchantInfo(link)
end
end
end

local GLYPH_SLOTS = {
[1] = { id = 21, level = 15 },
[2] = { id = 22, level = 15 },
[3] = { id = 23, level = 50 },
[4] = { id = 24, level = 30 },
[5] = { id = 25, level = 70 },
[6] = { id = 26, level = 80 },
}

function ns.GetGlyphSlotRequireLevel(slot)
local d = GLYPH_SLOTS[slot]
return d and d.level
end

function ns.GetGlyphSlotId(slot)
local d = GLYPH_SLOTS[slot]
return d and d.id
end
26 changes: 0 additions & 26 deletions Data/Glyph.lua

This file was deleted.

1 change: 0 additions & 1 deletion Load.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<Script file="Addon.lua" />

<Script file="Data\DataLoader.lua" />
<Script file="Data\Glyph.lua" build=">3" />

<Script file="Data\Vanilla\Talents.lua" build="Vanilla" />
<Script file="Data\Vanilla\ItemSet.lua" build="Vanilla" />
Expand Down
3 changes: 2 additions & 1 deletion Scripts/ItemEnchantGen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class App {
}
}

const code = `select(2,...).ItemEnchantMake()
const code = `---@diagnostic disable: undefined-global
select(2,...).ItemEnchantMake()
local n=nil
${codes.join('\n')}`;

Expand Down
2 changes: 2 additions & 0 deletions Tooltip/FixRune.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
-- @Author : Dencer ([email protected])
-- @Link : https://dengsir.github.io
-- @Date : 3/19/2024, 11:55:34 AM
--
---@class ns
local ns = select(2, ...)

local function ToPattern(p)
Expand Down
2 changes: 1 addition & 1 deletion UI/GearFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function GearFrame:UpdateSize()
self[key]:SetWidth(v)
end
end
self:SetWidth(width - SPACING_V + PADDING * 2)
self:SetWidth(max(width - SPACING_V + PADDING * 2, 165 + self.Name:GetStringWidth()))
end

function GearFrame:StartLayout()
Expand Down
2 changes: 1 addition & 1 deletion UI/Template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
</Frames>
<Layers>
<Layer level="ARTWORK">
<FontString parentKey="Name" inherits="GameFontNormalLargeOutline" justifyH="LEFT">
<FontString parentKey="Name" inherits="GameFontNormalOutline" justifyH="LEFT">
<Anchors>
<Anchor point="TOPLEFT" x="66" y="-18"/>
</Anchors>
Expand Down

0 comments on commit 383ebbb

Please sign in to comment.