Skip to content

Commit

Permalink
Added The Following...
Browse files Browse the repository at this point in the history
- Updated to version 2.3.2
- Translation
  - Sped up the Locale.lua
    - Function L is now a table
    - Fallback function added
    - Command.lua /kiwiii
      - Now uses Fallback
      - You can now use English for commands
      - You can now use translated commands
  - Fixed a missed translation string
- Item Compare updated
  - Now displays stat change calcs
    - Basic Stats show +x attack power
    - Basic Stats show crit chance
    - Resistances show % increase
    - etc
  - Translated in all languages
    - zhCN incomplete
    - Some abbreviations may be incorrect
    - Some words can be incorrect
    - Some sentence structure may be incorrect
- Command /kiwiii without args shows settings frame
  - Customize the plugin using this
  - Please respect the formatting
    - Failure to coop could break it
    - Only relevant to strings
- Added variable item_compare_extra
  - Controls basic stat changes calcs
  - For you to turn off Item Compare on specifically
  • Loading branch information
tilkinsc committed Nov 18, 2019
1 parent 5c198fd commit a8a4e50
Showing 1 changed file with 139 additions and 0 deletions.
139 changes: 139 additions & 0 deletions VarsUI.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@

local VarsUI = {}


local background
local scroll
local content
local elements
local font


local label_width = 140
local edit_width = 100

local padding_l = 10
local padding_v = -5

local height = 0


VarsUI.Init = function()
background = CreateFrame("Frame", nil, UIParent, "BasicFrameTemplate")
background.TitleText:SetText("Kiwi Item Info Vars")
background:SetSize(300, 300)
background:SetPoint("CENTER")
scroll = CreateFrame("ScrollFrame", nil, background, "UIPanelScrollFrameTemplate")
scroll:SetSize(273, 270)
scroll:SetPoint("TOPLEFT", 0, -25)
content = CreateFrame("Frame", nil, background, nil)
content:SetSize(300, 300)
content:SetPoint("TOPLEFT")
scroll:SetScrollChild(content)

font = CreateFont("KiwiVarsUIFont")
font:CopyFontObject(GameFontWhite)
font:SetJustifyH("LEFT")

elements = {}

scroll:SetScript("OnSizeChanged", function(frame, width, height)
content:SetWidth(width)
content:SetHeight(height)
end)

VarsUI.Background = background
VarsUI.Scroll = scroll
VarsUI.Content = content
end

VarsUI.AddComponent = function(type, text, show, action)
local fr

if(type == 1) then -- number
fr = CreateFrame("EditBox", nil, content)
fr:SetNumeric(true)
fr:SetAutoFocus(false)
fr:SetFontObject(font)
fr:SetSize(edit_width, 25)
fr:SetPoint("TOPLEFT", padding_l + label_width, height)
fr.Text = fr:CreateFontString()
fr.Text:SetParent(fr)
fr.Text:SetFontObject(font)
fr.Text:SetSize(label_width, 25)
fr.Text:SetPoint("LEFT", -label_width, 0)
fr.Text:SetText(text)

fr.OnShow = show
fr.OnHide = function(self) self:ClearFocus() end
fr:SetScript("OnEnterPressed", action)
fr:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
fr:SetScript("OnTabPressed", function(self) self:ClearFocus() end)

height = height - 25 - padding_v
table.insert(elements, fr)
elseif(type == 2) then -- string
fr = CreateFrame("EditBox", nil, content)
fr:SetAutoFocus(false)
fr:SetFontObject(font)
fr:SetSize(edit_width, 25)
fr:SetPoint("TOPLEFT", padding_l + label_width, height)
fr.Text = fr:CreateFontString()
fr.Text:SetParent(fr)
fr.Text:SetFontObject(font)
fr.Text:SetSize(label_width, 25)
fr.Text:SetPoint("LEFT", -label_width, 0)
fr.Text:SetText(text)

fr.OnShow = show
fr.OnHide = function(self) self:ClearFocus() end
fr:SetScript("OnEnterPressed", action)
fr:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
fr:SetScript("OnTabPressed", function(self) self:ClearFocus() end)

height = height - 25 - padding_v
table.insert(elements, fr)
elseif(type == 3) then -- boolean
fr = CreateFrame("CheckButton", nil, content, "ChatConfigCheckButtonTemplate")
fr:SetSize(25, 25)
fr:SetPoint("TOPLEFT", padding_l + label_width, height)
fr.Text:SetFontObject(font)
fr.Text:SetSize(label_width, 25)
fr.Text:SetPoint("LEFT", -label_width, 0)
fr.Text:SetText(text)

fr.OnShow = show
fr:SetScript("OnClick", action)

height = height - 25 - padding_v
table.insert(elements, fr)
end

return fr, #elements
end

VarsUI.Blank = function()
height = height - 15
end

VarsUI.Show = function()
for i, v in next, elements do
if(v.OnShow) then
v.OnShow(v)
end
end
background:SetParent(UIParent)
background:Show()
end

VarsUI.Hide = function()
for i, v in next, elements do
if(v.OnHide) then
v.OnHide(v)
end
end
background:Hide()
background:SetParent(nil)
end

KiwiItemInfo.VarsUI = VarsUI

0 comments on commit a8a4e50

Please sign in to comment.