I've been experiencing some partial UI failure with an addon I've been working on, but I was able to reproduce the issue in a much smaller example. Using the example's functionality:
- Open your inventory.
- Type "/downitem " in chat and link a worn item in chat. Press enter.
- The downgraded (usually) result will appear in your chat. Now open the Champion interface.
- Start redistribution, end redistribution, try to start redistribution again (this will fail).
- Your UI should now be half useless. To fix it, type "/reloadui" in chat.
Test.txt
Code:
;Test
## Title: Test
## APIVersion: 100017
## Author: Test
## Description: Test
## Version: 1.0
Test.lua
Test.lua
Code:
local Test = {
mame = "Test",
author = "Test",
version = "1.0"
}
--splits string into array
local function split_str(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
local i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end
--Tries to change an item's quality
local function GradeItem(text,inc)
--break the string
local item_data = split_str(text,":")
local out = ""
--increment the quality
item_data[4] = tonumber(item_data[4])+inc
if item_data[4] < 0 then
item_data[4] = 0
end
--reassemble
local id = 1
for id = 1, #item_data, 1 do
out = out .. ":" .. item_data[id]
end
--output to chat
CHAT_SYSTEM:AddMessage(out:sub(2))
end
--Grade handlers
local function UpgradeItem(text)
return GradeItem(text,1)
end
local function DowngradeItem(text)
return GradeItem(text,-1)
end
--Tries to upgrade an item's quality
SLASH_COMMANDS["/upitem"] = UpgradeItem
--Tries to downgrade an item's quality
SLASH_COMMANDS["/downitem"] = DowngradeItem
I know that it is a very lazy way of trying to change an item's quality and won't always work as planned (due to how convoluted quality can be), but it was a test piece. I'm hoping if someone can figure out what is triggering the UI failure, I can fix my real addon's problem.