reverted type in token create fixed some of my bad coding

This commit is contained in:
Anch
2022-08-06 00:44:48 +12:00
parent afd99842be
commit 2756114a11
5 changed files with 1042 additions and 1045 deletions
+2
View File
@@ -3,6 +3,8 @@ local AL = LibStub("AceLocale-3.0"):GetLocale("AtlasLoot");
AtlasLoot_Difficulty = {
-- table of difficulties and there itemID references
["Default"] = {};
["ClassicDungeon"] = {
{"Normal", 2,},
{"Bloodforged", 1,},
+11 -11
View File
@@ -54,6 +54,7 @@ AtlasLoot_DewdropExpansionMenu = AceLibrary("Dewdrop-2.0");
--Variable to cap debug spam
ATLASLOOT_DEBUGSHOWN = false;
ATLASLOOT_FILTER_ENABLE = false;
ATLASLOOT_CURRENTTYPE = "Default";
-- Colours stored for code readability
local GREY = "|cff999999";
@@ -395,7 +396,7 @@ function AtlasLoot_OnLoad()
AtlasLoot_Expac = xpaclist[GetAccountExpansionLevel()+1];
end
getExpac();
AtlasLoot:GenerateTokenTables()
--AtlasLoot:GenerateTokenTables();
end
@@ -440,24 +441,21 @@ function AtlasLoot:CreateToken(dataID)
if (AtlasLoot_TokenData[orgID] == nil) then
AtlasLoot_TokenData[orgID] = {
Name = itemName;
Type = "ClassicRaid";
Type = AtlasLoot_Data[dataID].Type;
Back = true;
NoSubt = true;
[1] = { Name = itemName };
};
end
AtlasLoot_TokenData[orgID][1] = {
Name = itemName;
};
--Fills table with items
for _, t in ipairs(AtlasLoot_Data[dataID]) do
for _, v in ipairs(t) do
if type(v) == "table" then
local itemID = v[2]; --AL_FindId(id[2], ItemindexID);
local itemID = v[2];
local item = Item:CreateFromID(itemID);
item:ContinueOnLoad(function(itemID)
if itemType == select(9, GetItemInfo(itemID)) or itemType2 == select(9, GetItemInfo(itemID)) then
table.insert(AtlasLoot_TokenData[orgID][1], {#AtlasLoot_TokenData[orgID][1] + 1, v[2], v[3], v[4], v[5]});
table.insert(AtlasLoot_TokenData[orgID][1], {#AtlasLoot_TokenData[orgID][1] + 1, v[2], v[3], v[4], t.Name});
end
end)
end
@@ -518,10 +516,12 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum)
dataSource = AtlasLootCharDB;
end
AtlasLoot_CurrentType = dataSource[dataID].Type or "";
ATLASLOOT_CURRENTTYPE = dataSource[dataID].Type or "";
AtlasLoot:ScrollFrameUpdate();
AtlasLoot_BossName:SetText(dataSource[dataID][tablenum].Name);
--For stopping the subtable from changing if its a token table
if dataSource[dataID].NoSubt == nil then
AtlasLootDefaultFrame_SubMenu:SetText(dataSource[dataID].Name);
@@ -764,7 +764,7 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum)
getglobal("AtlasLootItemsFrame_NEXT"):Hide();
getglobal("AtlasLootItemsFrame_PREV"):Hide();
if tablenum + 1 ~= AtlasLoot_GetNumOfRows(dataSource[dataID]) then
if tablenum + 1 ~= #dataSource[dataID] then
getglobal("AtlasLootItemsFrame_NEXT"):Show();
if dataID ~= "FilterList" then
getglobal("AtlasLootItemsFrame_NEXT").tablenum = tablenum + 1;
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -234,7 +234,7 @@ function AtlasLoot_AdvancedSearchShow()
AtlasLootDefaultFrame_AdvancedSearchPanel:SetPoint(pFrame[1], pFrame[2], pFrame[3], pFrame[4], pFrame[5]);
AtlasLootDefaultFrame_AdvancedSearchPanel:Show();
AtlasLoot_CurrentType = "Search";
ATLASLOOT_CURRENTTYPE = "Search";
AtlasLoot:ScrollFrameUpdate();
AtlasLoot:SubTableScrollFrameUpdate("", "", "", "");
end
@@ -305,30 +305,18 @@ local scrollFrame = CreateFrame("Frame", "Atlasloot_Difficulty_ScrollFrame", Atl
insets = { left = 4, right = 4, top = 4, bottom = 4 },
});
function AtlasLoot_GetNumOfRows(tablename)
local num = 1
if tablename then
for n in ipairs(tablename) do
num = num + 1
end
else
num = 0
end
return num
end
function AtlasLoot:ScrollFrameUpdate()
local maxValue = AtlasLoot_GetNumOfRows(AtlasLoot_Difficulty[AtlasLoot_CurrentType])
local maxValue = #AtlasLoot_Difficulty[ATLASLOOT_CURRENTTYPE];
FauxScrollFrame_Update(scrollFrame.scrollBar, maxValue, MAX_ROWS, ROW_HEIGHT);
local offset = FauxScrollFrame_GetOffset(scrollFrame.scrollBar);
for i = 1, MAX_ROWS do
local value = i + offset
scrollFrame.rows[i]:SetChecked(false);
scrollFrame.rows[i]:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD");
if value <= maxValue and AtlasLoot_Difficulty[AtlasLoot_CurrentType][value] then
if value <= maxValue and AtlasLoot_Difficulty[ATLASLOOT_CURRENTTYPE][value] then
local row = scrollFrame.rows[i]
row:SetText("|cffFFd200"..AtlasLoot_Difficulty[AtlasLoot_CurrentType][value][1]);
row.itemIndex = AtlasLoot_Difficulty[AtlasLoot_CurrentType][value][2];
row:SetText("|cffFFd200"..AtlasLoot_Difficulty[ATLASLOOT_CURRENTTYPE][value][1]);
row.itemIndex = AtlasLoot_Difficulty[ATLASLOOT_CURRENTTYPE][value][2];
if row.itemIndex == ItemindexID then
row:SetChecked(true);
end
@@ -392,7 +380,7 @@ local subtableFrame = CreateFrame("Frame", "Atlasloot_SubTableFrame", AtlasLootD
function AtlasLoot:SubTableScrollFrameUpdate(tablename, dataSource, pFrame, currenttablenum)
if dataSource ~= nil then
if(string.find(tablename, "SearchResult")) then tablename = "SearchResult"; end
local maxValue = AtlasLoot_GetNumOfRows(dataSource[tablename]);
local maxValue = #dataSource[tablename];
subtableFrame.tablename = tablename;
FauxScrollFrame_Update(subtableFrame.scrollBar, maxValue, MAX_ROWS2, ROW_HEIGHT);
local offset = FauxScrollFrame_GetOffset(subtableFrame.scrollBar);
@@ -402,14 +390,19 @@ function AtlasLoot:SubTableScrollFrameUpdate(tablename, dataSource, pFrame, curr
subtableFrame.rows[i]:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD");
if value <= maxValue and dataSource[tablename][value] then
local row = subtableFrame.rows[i]
row:SetText("|cffFFd200"..dataSource[tablename][value].Name);
row.tablenum = value;
row.dataSource = dataSource;
row.tablename = tablename;
row.tablenum = value;
row.pFrame = pFrame;
if dataSource == AtlasLoot_MapData then
row:SetText(string.sub(tostring(dataSource[tablename][value][1]),0,50));
else
row:SetText("|cffFFd200"..dataSource[tablename][value].Name);
if currenttablenum == value then
row:SetChecked(true);
end
end
row:Show();
else
subtableFrame.rows[i]:Hide()
@@ -423,11 +416,11 @@ local scrollSlider2 = CreateFrame("ScrollFrame","AtlasLootDefaultFrameSubTableSc
scrollSlider2:SetPoint("BOTTOMRIGHT", -30, 8)
scrollSlider2:SetScript("OnVerticalScroll", function(self, offset)
self.offset = math.floor(offset / ROW_HEIGHT + 0.5)
AtlasLoot:SubTableScrollFrameUpdate(subtableFrame.tablename);
AtlasLoot:SubTableScrollFrameUpdate();
end)
scrollSlider2:SetScript("OnShow", function()
AtlasLoot:SubTableScrollFrameUpdate(subtableFrame.tablename);
AtlasLoot:SubTableScrollFrameUpdate();
end)
subtableFrame.scrollBar = scrollSlider2
@@ -439,7 +432,6 @@ local rows2 = setmetatable({}, { __index = function(t, i)
row:SetCheckedTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD");
row:SetScript("OnClick", function()
pFrame = { "TOPLEFT", "AtlasLootDefaultFrame_LootBackground", "TOPLEFT", "2", "-2" };
AtlasLoot:SubTableScrollFrameUpdate(row.tablename, row.dataSource, pFrame, row.tablenum);
AtlasLoot_ShowItemsFrame(row.tablename, row.dataSource, row.dataSource[row.tablename][row.tablenum].Name, pFrame, row.tablenum);
end)
if i == 1 then