From 3355289d088160ddce317617e6d93ac13a1a1f8a Mon Sep 17 00:00:00 2001 From: Vapok Date: Mon, 25 May 2020 23:47:03 -0400 Subject: [PATCH] Removed the temporary save files and replaced with the final db schema changes. at this point, the addon should work as expected, but allow other characters to be in other guilds using the same addon with different lists. --- ConfigMenuTabs.lua | 6 +- Core.lua | 94 +++++++------- Modules/AdjustDKP.lua | 24 ++-- Modules/AutoAward.lua | 26 ++-- Modules/Award.lua | 92 +++++++------- Modules/BidInterface.lua | 32 ++--- Modules/Bidding.lua | 66 +++++----- Modules/ClassGraph.lua | 8 +- Modules/DKPHistory.lua | 92 +++++++------- Modules/LootHistory.lua | 88 ++++++------- Modules/LootPriceTab.lua | 16 +-- Modules/ManageEntries.lua | 104 +++++++-------- Modules/Modes/DKPModesMain.lua | 4 +- Modules/Options.lua | 38 +++--- Modules/RaidTimer.lua | 22 ++-- Modules/Repair.lua | 84 ++++++------- Modules/Standby.lua | 14 +-- Modules/Sync.lua | 38 +++--- Modules/Validate.lua | 86 ++++++------- Modules/ZeroSumBank.lua | 14 +-- Modules/comm.lua | 224 ++++++++++++++++----------------- Modules/exportDKP.lua | 104 +++++++-------- MonolithDKP.lua | 8 +- MonolithDKP.toc | 2 +- TableFunctions.lua | 94 +++++++------- init.lua | 54 ++++---- 26 files changed, 716 insertions(+), 718 deletions(-) diff --git a/ConfigMenuTabs.lua b/ConfigMenuTabs.lua index 77426384..47d5c08a 100644 --- a/ConfigMenuTabs.lua +++ b/ConfigMenuTabs.lua @@ -284,10 +284,10 @@ function MonDKP:ConfigMenuTabs() MonDKP.ConfigTab5.looter = looter local lootFrame = {} MonDKP.ConfigTab5.lootFrame = lootFrame - for i=1, #MonDKP:GetTable(MonDKP_Player_Loot, true) do + for i=1, #MonDKP:GetTable(MonDKP_Loot, true) do MonDKP.ConfigTab5.lootFrame[i] = CreateFrame("Frame", "MonDKPLootHistoryFrame"..i, MonDKP.ConfigTab5); end - if #MonDKP:GetTable(MonDKP_Player_Loot, true) > 0 then + if #MonDKP:GetTable(MonDKP_Loot, true) > 0 then MonDKP:LootHistory_Update(L["NOFILTER"]) CreateSortBox(); end @@ -306,7 +306,7 @@ function MonDKP:ConfigMenuTabs() MonDKP.ConfigTab6.inst:SetFontObject("MonDKPSmallRight"); MonDKP.ConfigTab6.inst:SetTextColor(0.3, 0.3, 0.3, 0.7) MonDKP.ConfigTab6.inst:SetPoint("TOPRIGHT", MonDKP.ConfigTab6, "TOPRIGHT", -40, -43); - if #MonDKP:GetTable(MonDKP_Player_DKPHistory, true) > 0 then + if #MonDKP:GetTable(MonDKP_DKPHistory, true) > 0 then MonDKP:DKPHistory_Update() end DKPHistoryFilterBox_Create() diff --git a/Core.lua b/Core.lua index 1ed8adcb..0a52608b 100644 --- a/Core.lua +++ b/Core.lua @@ -51,7 +51,7 @@ local defaults = { } core.PriceSortButtons = {} -core.WorkingTable = {}; -- table of all entries from MonDKP:GetTable(MonDKP_Player_DKPTable, true) that are currently visible in the window. From MonDKP:GetTable(MonDKP_Player_DKPTable, true) +core.WorkingTable = {}; -- table of all entries from MonDKP:GetTable(MonDKP_DKPTable, true) that are currently visible in the window. From MonDKP:GetTable(MonDKP_DKPTable, true) core.EncounterList = { -- Event IDs must be in the exact same order as core.BossList declared in localization files MC = { 663, 664, 665, @@ -206,10 +206,10 @@ function MonDKP:CheckOfficer() -- checks if user is an officer IF core.IsOf return; end if IsInGuild() then - if #MonDKP:GetTable(MonDKP_Player_Whitelist) > 0 then + if #MonDKP:GetTable(MonDKP_Whitelist) > 0 then core.IsOfficer = false; - for i=1, #MonDKP:GetTable(MonDKP_Player_Whitelist) do - if MonDKP:GetTable(MonDKP_Player_Whitelist)[i] == UnitName("player") then + for i=1, #MonDKP:GetTable(MonDKP_Whitelist) do + if MonDKP:GetTable(MonDKP_Whitelist)[i] == UnitName("player") then core.IsOfficer = true; end end @@ -266,10 +266,10 @@ function MonDKP:GetThemeColor() end function MonDKP:GetPlayerDKP(player) - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), player) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), player) if search then - return MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp + return MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp else return false; end @@ -278,33 +278,33 @@ end function MonDKP:PurgeLootHistory() -- cleans old loot history beyond history limit to reduce native system load local limit = core.DB.defaults.HistoryLimit - if #MonDKP:GetTable(MonDKP_Player_Loot, true) > limit then - while #MonDKP:GetTable(MonDKP_Player_Loot, true) > limit do + if #MonDKP:GetTable(MonDKP_Loot, true) > limit then + while #MonDKP:GetTable(MonDKP_Loot, true) > limit do MonDKP:SortLootTable() - local path = MonDKP:GetTable(MonDKP_Player_Loot, true)[#MonDKP:GetTable(MonDKP_Player_Loot, true)] + local path = MonDKP:GetTable(MonDKP_Loot, true)[#MonDKP:GetTable(MonDKP_Loot, true)] - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[path.player] then - MonDKP:GetTable(MonDKP_Player_Archive, true)[path.player] = { dkp=path.cost, lifetime_spent=path.cost, lifetime_gained=0 } + if not MonDKP:GetTable(MonDKP_Archive, true)[path.player] then + MonDKP:GetTable(MonDKP_Archive, true)[path.player] = { dkp=path.cost, lifetime_spent=path.cost, lifetime_gained=0 } else - MonDKP:GetTable(MonDKP_Player_Archive, true)[path.player].dkp = MonDKP:GetTable(MonDKP_Player_Archive, true)[path.player].dkp + path.cost - MonDKP:GetTable(MonDKP_Player_Archive, true)[path.player].lifetime_spent = MonDKP:GetTable(MonDKP_Player_Archive, true)[path.player].lifetime_spent + path.cost + MonDKP:GetTable(MonDKP_Archive, true)[path.player].dkp = MonDKP:GetTable(MonDKP_Archive, true)[path.player].dkp + path.cost + MonDKP:GetTable(MonDKP_Archive, true)[path.player].lifetime_spent = MonDKP:GetTable(MonDKP_Archive, true)[path.player].lifetime_spent + path.cost end - if not MonDKP:GetTable(MonDKP_Player_Archive, true).LootMeta or MonDKP:GetTable(MonDKP_Player_Archive, true).LootMeta < path.date then - MonDKP:GetTable(MonDKP_Player_Archive, true).LootMeta = path.date + if not MonDKP:GetTable(MonDKP_Archive, true).LootMeta or MonDKP:GetTable(MonDKP_Archive, true).LootMeta < path.date then + MonDKP:GetTable(MonDKP_Archive, true).LootMeta = path.date end - tremove(MonDKP:GetTable(MonDKP_Player_Loot, true), #MonDKP:GetTable(MonDKP_Player_Loot, true)) + tremove(MonDKP:GetTable(MonDKP_Loot, true), #MonDKP:GetTable(MonDKP_Loot, true)) end end end -function MonDKP:PurgeDKPHistory() -- purges old entries and stores relevant data in each users MonDKP:GetTable(MonDKP_Player_Archive, true) entry (dkp, lifetime spent, and lifetime gained) +function MonDKP:PurgeDKPHistory() -- purges old entries and stores relevant data in each users MonDKP:GetTable(MonDKP_Archive, true) entry (dkp, lifetime spent, and lifetime gained) local limit = core.DB.defaults.DKPHistoryLimit - if #MonDKP:GetTable(MonDKP_Player_DKPHistory, true) > limit then - while #MonDKP:GetTable(MonDKP_Player_DKPHistory, true) > limit do + if #MonDKP:GetTable(MonDKP_DKPHistory, true) > limit then + while #MonDKP:GetTable(MonDKP_DKPHistory, true) > limit do MonDKP:SortDKPHistoryTable() - local path = MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[#MonDKP:GetTable(MonDKP_Player_DKPHistory, true)] + local path = MonDKP:GetTable(MonDKP_DKPHistory, true)[#MonDKP:GetTable(MonDKP_DKPHistory, true)] local players = {strsplit(",", strsub(path.players, 1, -2))} local dkp = {strsplit(",", path.dkp)} @@ -319,24 +319,24 @@ function MonDKP:PurgeDKPHistory() -- purges old entries and stores relevant end for i=1, #players do - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]] then + if not MonDKP:GetTable(MonDKP_Archive, true)[players[i]] then if ((dkp[i] > 0 and not path.deletes) or (dkp[i] < 0 and path.deletes)) and not strfind(path.dkp, "%-%d*%.?%d+%%") then - MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]] = { dkp=dkp[i], lifetime_spent=0, lifetime_gained=dkp[i] } + MonDKP:GetTable(MonDKP_Archive, true)[players[i]] = { dkp=dkp[i], lifetime_spent=0, lifetime_gained=dkp[i] } else - MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]] = { dkp=dkp[i], lifetime_spent=0, lifetime_gained=0 } + MonDKP:GetTable(MonDKP_Archive, true)[players[i]] = { dkp=dkp[i], lifetime_spent=0, lifetime_gained=0 } end else - MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]].dkp = MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]].dkp + dkp[i] + MonDKP:GetTable(MonDKP_Archive, true)[players[i]].dkp = MonDKP:GetTable(MonDKP_Archive, true)[players[i]].dkp + dkp[i] if ((dkp[i] > 0 and not path.deletes) or (dkp[i] < 0 and path.deletes)) and not strfind(path.dkp, "%-%d*%.?%d+%%") then --lifetime gained if dkp addition and not a delete entry, dkp decrease and IS a delete entry - MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]].lifetime_gained = MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]].lifetime_gained + path.dkp --or is NOT a decay + MonDKP:GetTable(MonDKP_Archive, true)[players[i]].lifetime_gained = MonDKP:GetTable(MonDKP_Archive, true)[players[i]].lifetime_gained + path.dkp --or is NOT a decay end end end - if not MonDKP:GetTable(MonDKP_Player_Archive, true).DKPMeta or MonDKP:GetTable(MonDKP_Player_Archive, true).DKPMeta < path.date then - MonDKP:GetTable(MonDKP_Player_Archive, true).DKPMeta = path.date + if not MonDKP:GetTable(MonDKP_Archive, true).DKPMeta or MonDKP:GetTable(MonDKP_Archive, true).DKPMeta < path.date then + MonDKP:GetTable(MonDKP_Archive, true).DKPMeta = path.date end - tremove(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), #MonDKP:GetTable(MonDKP_Player_DKPHistory, true)) + tremove(MonDKP:GetTable(MonDKP_DKPHistory, true), #MonDKP:GetTable(MonDKP_DKPHistory, true)) end end end @@ -488,7 +488,7 @@ function MonDKP:StartTimer(seconds, ...) end function MonDKP:StatusVerify_Update() - if (MonDKP.UIConfig and not MonDKP.UIConfig:IsShown()) or (#MonDKP:GetTable(MonDKP_Player_DKPHistory, true) == 0 and #MonDKP:GetTable(MonDKP_Player_Loot, true) == 0) then -- blocks update if dkp window is closed. Updated when window is opened anyway + if (MonDKP.UIConfig and not MonDKP.UIConfig:IsShown()) or (#MonDKP:GetTable(MonDKP_DKPHistory, true) == 0 and #MonDKP:GetTable(MonDKP_Loot, true) == 0) then -- blocks update if dkp window is closed. Updated when window is opened anyway return; end @@ -497,13 +497,13 @@ function MonDKP:StatusVerify_Update() local missing = {} - if MonDKP:GetTable(MonDKP_Player_Loot, true).seed and MonDKP:GetTable(MonDKP_Player_DKPHistory, true).seed and strfind(MonDKP:GetTable(MonDKP_Player_Loot, true).seed, "-") and strfind(MonDKP:GetTable(MonDKP_Player_DKPHistory, true).seed, "-") then - local search_dkp = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), MonDKP:GetTable(MonDKP_Player_DKPHistory, true).seed, "index") - local search_loot = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), MonDKP:GetTable(MonDKP_Player_Loot, true).seed, "index") + if MonDKP:GetTable(MonDKP_Loot, true).seed and MonDKP:GetTable(MonDKP_DKPHistory, true).seed and strfind(MonDKP:GetTable(MonDKP_Loot, true).seed, "-") and strfind(MonDKP:GetTable(MonDKP_DKPHistory, true).seed, "-") then + local search_dkp = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPHistory, true), MonDKP:GetTable(MonDKP_DKPHistory, true).seed, "index") + local search_loot = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), MonDKP:GetTable(MonDKP_Loot, true).seed, "index") if not search_dkp then core.OOD = true - local officer1, date1 = strsplit("-", MonDKP:GetTable(MonDKP_Player_DKPHistory, true).seed) + local officer1, date1 = strsplit("-", MonDKP:GetTable(MonDKP_DKPHistory, true).seed) if (date1 and tonumber(date1) < (time() - 1209600)) or not MonDKP:ValidateSender(officer1) then -- does not consider if claimed entry was made more than two weeks ago or name is not an officer core.OOD = false else @@ -514,7 +514,7 @@ function MonDKP:StatusVerify_Update() if not search_loot then core.OOD = true - local officer2, date2 = strsplit("-", MonDKP:GetTable(MonDKP_Player_Loot, true).seed) + local officer2, date2 = strsplit("-", MonDKP:GetTable(MonDKP_Loot, true).seed) if (date2 and tonumber(date2) < (time() - 1209600)) or not MonDKP:ValidateSender(officer2) then -- does not consider if claimed entry was made more than two weeks ago or name is not an officer core.OOD = false else @@ -546,7 +546,7 @@ function MonDKP:StatusVerify_Update() MonDKP.DKPTable.SeedVerify:SetScript("OnEnter", function(self) GameTooltip:SetOwner(self, "ANCHOR_RIGHT", 0, 0); GameTooltip:SetText(L["DKPSTATUS"], 0.25, 0.75, 0.90, 1, true); - if #MonDKP:GetTable(MonDKP_Player_Loot, true) == 0 and #MonDKP:GetTable(MonDKP_Player_DKPHistory, true) == 0 then + if #MonDKP:GetTable(MonDKP_Loot, true) == 0 and #MonDKP:GetTable(MonDKP_DKPHistory, true) == 0 then GameTooltip:AddLine(L["TABLESAREEMPTY"], 1.0, 1.0, 1.0, false); else GameTooltip:AddLine(L["ONETABLEOOD"].." |cffff0000"..L["OUTOFDATE"].."|r.", 1.0, 1.0, 1.0, false); @@ -556,10 +556,10 @@ function MonDKP:StatusVerify_Update() GameTooltip:AddLine(" ") GameTooltip:AddDoubleLine(L["PLAYER"], L["CREATED"],1,1,1,1,1,1) for k,v in pairs(missing) do - local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), k) + local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), k) if classSearch then - c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[classSearch[1][1]].class) + c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[classSearch[1][1]].class) else c = { hex="ffffff" } end @@ -593,11 +593,11 @@ function MonDKP:StatusVerify_Update() end ------------------------------------- --- Recursively searches tar (table) for val (string) as far as 4 nests deep (use field only if you wish to search a specific key IE: MonDKP:GetTable(MonDKP_Player_DKPTable, true), "Roeshambo", "player" would only search for Roeshambo in the player key) +-- Recursively searches tar (table) for val (string) as far as 4 nests deep (use field only if you wish to search a specific key IE: MonDKP:GetTable(MonDKP_DKPTable, true), "Roeshambo", "player" would only search for Roeshambo in the player key) -- returns an indexed array of the keys to get to searched value -- First key is the result (ie if it's found 8 times, it will return 8 tables containing results). --- Second key holds the path to the value searched. So to get to a player searched on DKPTable that returned 1 result, MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]][search[1][2]] would point at the "player" field --- if the result is 1 level deeper, it would be MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]][search[1][2]][search[1][3]]. MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[2][1]][search[2][2]][search[2][3]] would locate the second return, if there is one. +-- Second key holds the path to the value searched. So to get to a player searched on DKPTable that returned 1 result, MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]][search[1][2]] would point at the "player" field +-- if the result is 1 level deeper, it would be MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]][search[1][2]][search[1][3]]. MonDKP:GetTable(MonDKP_DKPTable, true)[search[2][1]][search[2][2]][search[2][3]] would locate the second return, if there is one. -- use to search for players in SavedVariables. Only two possible returns is the table or false. ------------------------------------- function MonDKP:Table_Search(tar, val, field) @@ -664,7 +664,7 @@ function MonDKP:Table_Search(tar, val, field) end function MonDKP:TableStrFind(tar, val, field) -- same function as above, but searches values that contain the searched string rather than exact string matches - local value = string.upper(tostring(val)); -- ex. MonDKP:TableStrFind(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), "Roeshambo") will return the path to any table element that contains "Roeshambo" + local value = string.upper(tostring(val)); -- ex. MonDKP:TableStrFind(MonDKP:GetTable(MonDKP_DKPHistory, true), "Roeshambo") will return the path to any table element that contains "Roeshambo" local location = {} for k,v in pairs(tar) do if(type(v) == "table") then @@ -727,18 +727,18 @@ function MonDKP:TableStrFind(tar, val, field) -- same function as a end function MonDKP:DKPTable_Set(tar, field, value, loot) -- updates field with value where tar is found (IE: MonDKP:DKPTable_Set("Roeshambo", "dkp", 10) adds 10 dkp to user Roeshambo). loot = true/false if it's to alter lifetime_spent - local result = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), tar); + local result = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), tar); for i=1, #result do - local current = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[result[i][1]][field]; + local current = MonDKP:GetTable(MonDKP_DKPTable, true)[result[i][1]][field]; if(field == "dkp") then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[result[i][1]][field] = MonDKP_round(tonumber(current + value), core.DB.modes.rounding) + MonDKP:GetTable(MonDKP_DKPTable, true)[result[i][1]][field] = MonDKP_round(tonumber(current + value), core.DB.modes.rounding) if value > 0 and loot == false then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[result[i][1]]["lifetime_gained"] = MonDKP_round(tonumber(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[result[i][1]]["lifetime_gained"] + value), core.DB.modes.rounding) + MonDKP:GetTable(MonDKP_DKPTable, true)[result[i][1]]["lifetime_gained"] = MonDKP_round(tonumber(MonDKP:GetTable(MonDKP_DKPTable, true)[result[i][1]]["lifetime_gained"] + value), core.DB.modes.rounding) elseif value < 0 and loot == true then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[result[i][1]]["lifetime_spent"] = MonDKP_round(tonumber(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[result[i][1]]["lifetime_spent"] + value), core.DB.modes.rounding) + MonDKP:GetTable(MonDKP_DKPTable, true)[result[i][1]]["lifetime_spent"] = MonDKP_round(tonumber(MonDKP:GetTable(MonDKP_DKPTable, true)[result[i][1]]["lifetime_spent"] + value), core.DB.modes.rounding) end else - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[result[i][1]][field] = value + MonDKP:GetTable(MonDKP_DKPTable, true)[result[i][1]][field] = value end end DKPTable_Update() diff --git a/Modules/AdjustDKP.lua b/Modules/AdjustDKP.lua index 824de901..68d618d1 100644 --- a/Modules/AdjustDKP.lua +++ b/Modules/AdjustDKP.lua @@ -21,10 +21,10 @@ function MonDKP:AdjustDKP(value) if (#core.SelectedData > 0 and adjustReason and adjustReason ~= L["OTHER"].." - "..L["ENTEROTHERREASONHERE"]) then if core.IsOfficer then local tempString = ""; -- stores list of changes - local dkpHistoryString = "" -- stores list for MonDKP:GetTable(MonDKP_Player_DKPHistory, true) + local dkpHistoryString = "" -- stores list for MonDKP:GetTable(MonDKP_DKPHistory, true) for i=1, #core.SelectedData do local current; - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), core.SelectedData[i]["player"]) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), core.SelectedData[i]["player"]) if search then if not IsInRaid() then if i < #core.SelectedData then @@ -34,16 +34,16 @@ function MonDKP:AdjustDKP(value) end end dkpHistoryString = dkpHistoryString..core.SelectedData[i]["player"].."," - current = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp = MonDKP_round(tonumber(current + value), core.DB.modes.rounding) + current = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp = MonDKP_round(tonumber(current + value), core.DB.modes.rounding) if value > 0 then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]]["lifetime_gained"] = MonDKP_round(tonumber(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]]["lifetime_gained"] + value), core.DB.modes.rounding) + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]]["lifetime_gained"] = MonDKP_round(tonumber(MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]]["lifetime_gained"] + value), core.DB.modes.rounding) end end end local newIndex = curOfficer.."-"..curTime - tinsert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), 1, {players=dkpHistoryString, dkp=value, reason=adjustReason, date=curTime, index=newIndex}) - MonDKP.Sync:SendData("MonDKPDKPDist", MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[1]) + tinsert(MonDKP:GetTable(MonDKP_DKPHistory, true), 1, {players=dkpHistoryString, dkp=value, reason=adjustReason, date=curTime, index=newIndex}) + MonDKP.Sync:SendData("MonDKPDKPDist", MonDKP:GetTable(MonDKP_DKPHistory, true)[1]) if MonDKP.ConfigTab6.history and MonDKP.ConfigTab6:IsShown() then MonDKP:DKPHistory_Update(true) @@ -85,7 +85,7 @@ local function DecayDKP(amount, deductionType, GetSelections) local curTime = time() local curOfficer = UnitName("player") - for key, value in ipairs(MonDKP:GetTable(MonDKP_Player_DKPTable, true)) do + for key, value in ipairs(MonDKP:GetTable(MonDKP_DKPTable, true)) do local dkp = tonumber(value["dkp"]) local player = value["player"] local amount = amount; @@ -124,8 +124,8 @@ local function DecayDKP(amount, deductionType, GetSelections) if tonumber(amount) < 0 then amount = amount * -1 end -- flips value to positive if officer accidently used a negative number local newIndex = curOfficer.."-"..curTime - tinsert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), 1, {players=playerString, dkp=dkpString, reason=L["WEEKLYDECAY"], date=curTime, index=newIndex}) - MonDKP.Sync:SendData("MonDKPDecay", MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[1]) + tinsert(MonDKP:GetTable(MonDKP_DKPHistory, true), 1, {players=playerString, dkp=dkpString, reason=L["WEEKLYDECAY"], date=curTime, index=newIndex}) + MonDKP.Sync:SendData("MonDKPDecay", MonDKP:GetTable(MonDKP_DKPHistory, true)[1]) if MonDKP.ConfigTab6.history then MonDKP:DKPHistory_Update(true) end @@ -447,10 +447,10 @@ function MonDKP:AdjustDKPTab_Create() local selected = L["AREYOUSURE"].." "..MonDKP_round(MonDKP.ConfigTab2.addDKP:GetNumber(), core.DB.modes.rounding).." "..L["DKPTOFOLLOWING"]..": \n\n"; for i=1, #core.SelectedData do - local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), core.SelectedData[i].player) + local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), core.SelectedData[i].player) if classSearch then - c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[classSearch[1][1]].class) + c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[classSearch[1][1]].class) else c = { hex="ffffff" } end diff --git a/Modules/AutoAward.lua b/Modules/AutoAward.lua index fc673f9a..06925cc7 100644 --- a/Modules/AutoAward.lua +++ b/Modules/AutoAward.lua @@ -13,7 +13,7 @@ function MonDKP:AutoAward(phase, amount, reason) -- phase identifies who to awar if phase == 1 or phase == 3 then for i=1, 40 do local tempName, _rank, _subgroup, _level, _class, _fileName, zone, online = GetRaidRosterInfo(i) - local search_DKP = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), tempName) + local search_DKP = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), tempName) local OnlineOnly = core.DB.modes.OnlineOnly local limitToZone = core.DB.modes.SameZoneOnly local isSameZone = zone == GetRealZoneText() @@ -25,7 +25,7 @@ function MonDKP:AutoAward(phase, amount, reason) -- phase identifies who to awar end end - if #MonDKP:GetTable(MonDKP_Player_Standby, true) > 0 and core.DB.DKPBonus.AutoIncStandby and (phase == 2 or phase == 3) then + if #MonDKP:GetTable(MonDKP_Standby, true) > 0 and core.DB.DKPBonus.AutoIncStandby and (phase == 2 or phase == 3) then local raidParty = ""; for i=1, 40 do local tempName = GetRaidRosterInfo(i) @@ -33,16 +33,16 @@ function MonDKP:AutoAward(phase, amount, reason) -- phase identifies who to awar raidParty = raidParty..tempName.."," end end - for i=1, #MonDKP:GetTable(MonDKP_Player_Standby, true) do - if strfind(raidParty, MonDKP:GetTable(MonDKP_Player_Standby, true)[i].player..",") ~= 1 and not strfind(raidParty, ","..MonDKP:GetTable(MonDKP_Player_Standby, true)[i].player..",") then - MonDKP:AwardPlayer(MonDKP:GetTable(MonDKP_Player_Standby, true)[i].player, amount) - tempList2 = tempList2..MonDKP:GetTable(MonDKP_Player_Standby, true)[i].player..","; + for i=1, #MonDKP:GetTable(MonDKP_Standby, true) do + if strfind(raidParty, MonDKP:GetTable(MonDKP_Standby, true)[i].player..",") ~= 1 and not strfind(raidParty, ","..MonDKP:GetTable(MonDKP_Standby, true)[i].player..",") then + MonDKP:AwardPlayer(MonDKP:GetTable(MonDKP_Standby, true)[i].player, amount) + tempList2 = tempList2..MonDKP:GetTable(MonDKP_Standby, true)[i].player..","; end end local i = 1 - while i <= #MonDKP:GetTable(MonDKP_Player_Standby, true) do - if MonDKP:GetTable(MonDKP_Player_Standby, true)[i] and (strfind(raidParty, MonDKP:GetTable(MonDKP_Player_Standby, true)[i].player..",") == 1 or strfind(raidParty, ","..MonDKP:GetTable(MonDKP_Player_Standby, true)[i].player..",")) then - table.remove(MonDKP:GetTable(MonDKP_Player_Standby, true), i) + while i <= #MonDKP:GetTable(MonDKP_Standby, true) do + if MonDKP:GetTable(MonDKP_Standby, true)[i] and (strfind(raidParty, MonDKP:GetTable(MonDKP_Standby, true)[i].player..",") == 1 or strfind(raidParty, ","..MonDKP:GetTable(MonDKP_Standby, true)[i].player..",")) then + table.remove(MonDKP:GetTable(MonDKP_Standby, true), i) else i=i+1 end @@ -52,15 +52,15 @@ function MonDKP:AutoAward(phase, amount, reason) -- phase identifies who to awar if tempList ~= "" or tempList2 ~= "" then if (phase == 1 or phase == 3) and tempList ~= "" then local newIndex = curOfficer.."-"..curTime - tinsert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), 1, {players=tempList, dkp=amount, reason=reason, date=curTime, index=newIndex}) + tinsert(MonDKP:GetTable(MonDKP_DKPHistory, true), 1, {players=tempList, dkp=amount, reason=reason, date=curTime, index=newIndex}) MonDKP.Sync:SendData("MonDKPBCastMsg", L["RAIDDKPADJUSTBY"].." "..amount.." "..L["FORREASON"]..": "..reason) - MonDKP.Sync:SendData("MonDKPDKPDist", MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[1]) + MonDKP.Sync:SendData("MonDKPDKPDist", MonDKP:GetTable(MonDKP_DKPHistory, true)[1]) end if (phase == 2 or phase == 3) and tempList2 ~= "" then local newIndex = curOfficer.."-"..curTime+1 - tinsert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), 1, {players=tempList2, dkp=amount, reason=reason.." (Standby)", date=curTime+1, index=newIndex}) + tinsert(MonDKP:GetTable(MonDKP_DKPHistory, true), 1, {players=tempList2, dkp=amount, reason=reason.." (Standby)", date=curTime+1, index=newIndex}) MonDKP.Sync:SendData("MonDKPBCastMsg", L["STANDBYADJUSTBY"].." "..amount.." "..L["FORREASON"]..": "..reason) - MonDKP.Sync:SendData("MonDKPDKPDist", MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[1]) + MonDKP.Sync:SendData("MonDKPDKPDist", MonDKP:GetTable(MonDKP_DKPHistory, true)[1]) end if MonDKP.ConfigTab6.history and MonDKP.ConfigTab6:IsShown() then diff --git a/Modules/Award.lua b/Modules/Award.lua index 5b31a204..836e220e 100644 --- a/Modules/Award.lua +++ b/Modules/Award.lua @@ -9,23 +9,23 @@ local function SetItemPrice(cost, loot) local mode = core.DB.modes.mode; if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_MinBids, true), itemName) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_MinBids, true), itemName) local newItem = {item=itemName, minbid=cost, link=itemLink, icon=itemIcon, disenchants=0} if not search then - tinsert(MonDKP:GetTable(MonDKP_Player_MinBids, true), newItem) + tinsert(MonDKP:GetTable(MonDKP_MinBids, true), newItem) elseif search then - if MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].minbid ~= itemName then - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].minbid = MonDKP_round(cost, core.DB.modes.rounding); - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].link = itemLink; - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].icon = itemIcon; + if MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].minbid ~= itemName then + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].minbid = MonDKP_round(cost, core.DB.modes.rounding); + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].link = itemLink; + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].icon = itemIcon; if cost == 0 then - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].disenchants = 0; + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].disenchants = 0; end - newItem = MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]]; + newItem = MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]]; end end - core.PriceTable = MonDKP:GetTable(MonDKP_Player_MinBids, true); + core.PriceTable = MonDKP:GetTable(MonDKP_MinBids, true); MonDKP:PriceTable_Update(0); MonDKP.Sync:SendData("MonDKPSetPrice", newItem); end @@ -48,17 +48,17 @@ local function AwardItem(player, cost, boss, zone, loot, reassign) MonDKP:StatusVerify_Update() if core.IsOfficer then if core.DB.modes.costvalue == "Percent" then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), winner); + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), winner); if core.DB.modes.mode == "Roll Based Bidding" then if search then - cost = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp * (cost / 100) + cost = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp * (cost / 100) cost = MonDKP_round(cost, core.DB.modes.rounding); else print(L["ERROR"]) end else - cost = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp * (cost / 100) + cost = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp * (cost / 100) cost = MonDKP_round(cost, core.DB.modes.rounding); end else @@ -70,11 +70,11 @@ local function AwardItem(player, cost, boss, zone, loot, reassign) end if reassign then - search_reassign = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), reassign, "index") + search_reassign = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), reassign, "index") if search_reassign then - local deleted = CopyTable(MonDKP:GetTable(MonDKP_Player_Loot, true)[search_reassign[1][1]]) - local reimburse = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), deleted.player, "player") + local deleted = CopyTable(MonDKP:GetTable(MonDKP_Loot, true)[search_reassign[1][1]]) + local reimburse = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), deleted.player, "player") local newIndex = curOfficer.."-"..curTime-2 deleted.cost = deleted.cost * -1 deleted.deletes = reassign @@ -84,11 +84,11 @@ local function AwardItem(player, cost, boss, zone, loot, reassign) bids = CopyTable(deleted.bids); deleted.bids = nil; end - MonDKP:GetTable(MonDKP_Player_Loot, true)[search_reassign[1][1]].deletedby = newIndex - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[reimburse[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[reimburse[1][1]].dkp + deleted.cost - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[reimburse[1][1]].lifetime_spent = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[reimburse[1][1]].lifetime_spent + deleted.cost - table.insert(MonDKP:GetTable(MonDKP_Player_Loot, true), 1, deleted) - MonDKP.Sync:SendData("MonDKPDelLoot", MonDKP:GetTable(MonDKP_Player_Loot, true)[1]) + MonDKP:GetTable(MonDKP_Loot, true)[search_reassign[1][1]].deletedby = newIndex + MonDKP:GetTable(MonDKP_DKPTable, true)[reimburse[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[reimburse[1][1]].dkp + deleted.cost + MonDKP:GetTable(MonDKP_DKPTable, true)[reimburse[1][1]].lifetime_spent = MonDKP:GetTable(MonDKP_DKPTable, true)[reimburse[1][1]].lifetime_spent + deleted.cost + table.insert(MonDKP:GetTable(MonDKP_Loot, true), 1, deleted) + MonDKP.Sync:SendData("MonDKPDelLoot", MonDKP:GetTable(MonDKP_Loot, true)[1]) end end @@ -107,40 +107,40 @@ local function AwardItem(player, cost, boss, zone, loot, reassign) end if Bids_Submitted[1] then if Bids_Submitted[1].bid then - tinsert(MonDKP:GetTable(MonDKP_Player_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, bids={ }}) + tinsert(MonDKP:GetTable(MonDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, bids={ }}) for k,v in pairs(BidsEntry) do - table.insert(MonDKP:GetTable(MonDKP_Player_Loot, true)[1].bids, {bidder=k, bid=v}); + table.insert(MonDKP:GetTable(MonDKP_Loot, true)[1].bids, {bidder=k, bid=v}); end elseif Bids_Submitted[1].dkp then - tinsert(MonDKP:GetTable(MonDKP_Player_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, dkp={ }}) + tinsert(MonDKP:GetTable(MonDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, dkp={ }}) for k,v in pairs(BidsEntry) do - table.insert(MonDKP:GetTable(MonDKP_Player_Loot, true)[1].dkp, {bidder=k, dkp=v}); + table.insert(MonDKP:GetTable(MonDKP_Loot, true)[1].dkp, {bidder=k, dkp=v}); end elseif Bids_Submitted[1].roll then - tinsert(MonDKP:GetTable(MonDKP_Player_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, rolls={ }}) + tinsert(MonDKP:GetTable(MonDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex, rolls={ }}) for k,v in pairs(BidsEntry) do - table.insert(MonDKP:GetTable(MonDKP_Player_Loot, true)[1].rolls, {bidder=k, roll=v}); + table.insert(MonDKP:GetTable(MonDKP_Loot, true)[1].rolls, {bidder=k, roll=v}); end end else - tinsert(MonDKP:GetTable(MonDKP_Player_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex}) + tinsert(MonDKP:GetTable(MonDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex}) end else local newIndex = curOfficer.."-"..curTime - tinsert(MonDKP:GetTable(MonDKP_Player_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex}) + tinsert(MonDKP:GetTable(MonDKP_Loot, true), 1, {player=winner, loot=loot, zone=curZone, date=curTime, boss=curBoss, cost=cost, index=newIndex}) if reassign then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), reassign, "index") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), reassign, "index") - if search and MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].player ~= winner then - MonDKP:GetTable(MonDKP_Player_Loot, true)[1].reassigned = true + if search and MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].player ~= winner then + MonDKP:GetTable(MonDKP_Loot, true)[1].reassigned = true end end if type(bids) == "table" then - MonDKP:GetTable(MonDKP_Player_Loot, true)[1].bids = bids + MonDKP:GetTable(MonDKP_Loot, true)[1].bids = bids end end MonDKP:BidsSubmitted_Clear() - MonDKP.Sync:SendData("MonDKPLootDist", MonDKP:GetTable(MonDKP_Player_Loot, true)[1]) + MonDKP.Sync:SendData("MonDKPLootDist", MonDKP:GetTable(MonDKP_Loot, true)[1]) MonDKP:DKPTable_Set(winner, "dkp", MonDKP_round(cost, core.DB.modes.rounding), true) MonDKP:LootHistory_Reset(); MonDKP:LootHistory_Update(L["NOFILTER"]) @@ -164,25 +164,25 @@ local function AwardItem(player, cost, boss, zone, loot, reassign) end if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_MinBids, true), itemName) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_MinBids, true), itemName) local val = MonDKP:GetMinBid(loot); if not search and core.BiddingWindow.cost:GetNumber() ~= tonumber(val) then - tinsert(MonDKP:GetTable(MonDKP_Player_MinBids, true), {item=itemName, minbid=core.BiddingWindow.cost:GetNumber(), link=itemLink, icon=itemIcon}) + tinsert(MonDKP:GetTable(MonDKP_MinBids, true), {item=itemName, minbid=core.BiddingWindow.cost:GetNumber(), link=itemLink, icon=itemIcon}) core.BiddingWindow.CustomMinBid:SetShown(true); core.BiddingWindow.CustomMinBid:SetChecked(true); elseif search and core.BiddingWindow.cost:GetNumber() ~= tonumber(val) and core.BiddingWindow.CustomMinBid:GetChecked() == true then - if MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].minbid ~= core.BiddingWindow.cost:GetText() then - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].minbid = MonDKP_round(core.BiddingWindow.cost:GetNumber(), core.DB.modes.rounding); - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].link = itemLink; - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].icon = itemIcon; + if MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].minbid ~= core.BiddingWindow.cost:GetText() then + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].minbid = MonDKP_round(core.BiddingWindow.cost:GetNumber(), core.DB.modes.rounding); + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].link = itemLink; + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].icon = itemIcon; core.BiddingWindow.CustomMinBid:SetShown(true); core.BiddingWindow.CustomMinBid:SetChecked(true); end end if search and core.BiddingWindow.CustomMinBid:GetChecked() == false then - table.remove(MonDKP:GetTable(MonDKP_Player_MinBids, true), search[1][1]) + table.remove(MonDKP:GetTable(MonDKP_MinBids, true), search[1][1]) core.BiddingWindow.CustomMinBid:SetShown(false); end end @@ -334,12 +334,12 @@ function MonDKP:AwardConfirm(player, cost, boss, zone, loot, reassign) end ]] if player then - search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), player) - class = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].class) + search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), player) + class = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].class) end - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPTable, true) do - table.insert(PlayerList, MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].player) + for i=1, #MonDKP:GetTable(MonDKP_DKPTable, true) do + table.insert(PlayerList, MonDKP:GetTable(MonDKP_DKPTable, true)[i].player) end table.sort(PlayerList, function(a, b) return a < b @@ -392,11 +392,11 @@ function MonDKP:AwardConfirm(player, cost, boss, zone, loot, reassign) filterName.func = self.SetValue for i=ranges[menuList], ranges[menuList]+19 do if PlayerList[i] then - local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), PlayerList[i]) + local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), PlayerList[i]) local c; if classSearch then - c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[classSearch[1][1]].class) + c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[classSearch[1][1]].class) else c = { hex="444444" } end diff --git a/Modules/BidInterface.lua b/Modules/BidInterface.lua index aa03c888..1e501db8 100644 --- a/Modules/BidInterface.lua +++ b/Modules/BidInterface.lua @@ -36,7 +36,7 @@ local function SortBidTable() end local function RollMinMax_Get() - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), UnitName("player")) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), UnitName("player")) local minRoll; local maxRoll; @@ -44,14 +44,14 @@ local function RollMinMax_Get() if core.DB.modes.rolls.min == 0 or core.DB.modes.rolls.min == 1 then minRoll = 1; else - minRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.min / 100); + minRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.min / 100); end - maxRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.max / 100) + core.DB.modes.rolls.AddToMax; + maxRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.max / 100) + core.DB.modes.rolls.AddToMax; elseif not core.DB.modes.rolls.UsePerc then minRoll = core.DB.modes.rolls.min; if core.DB.modes.rolls.max == 0 then - maxRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp + core.DB.modes.rolls.AddToMax; + maxRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp + core.DB.modes.rolls.AddToMax; else maxRoll = core.DB.modes.rolls.max + core.DB.modes.rolls.AddToMax; end @@ -155,16 +155,16 @@ function BidInterface_Update() for i=1, showRows do row = core.BidInterface.bidTable.Rows[i] index = offset + i - local dkp_total = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), Bids_Submitted[i].player) + local dkp_total = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), Bids_Submitted[i].player) local c if dkp_total then - c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[dkp_total[1][1]].class) + c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[dkp_total[1][1]].class) else local createProfile = MonDKP_Profile_Create(Bids_Submitted[i].player) if createProfile then - dkp_total = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), Bids_Submitted[i].player) - c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[dkp_total[1][1]].class) + dkp_total = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), Bids_Submitted[i].player) + c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[dkp_total[1][1]].class) else -- if unable to create profile, feeds grey color c = { r="aa", g="aa", b="aa"} end @@ -178,7 +178,7 @@ function BidInterface_Update() row.Strings[1]:SetTextColor(c.r, c.g, c.b, 1) if mode == "Minimum Bid Values" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then row.Strings[2]:SetText(Bids_Submitted[i].bid) - row.Strings[3]:SetText(MonDKP_round(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[dkp_total[1][1]].dkp, core.DB.modes.rounding)) + row.Strings[3]:SetText(MonDKP_round(MonDKP:GetTable(MonDKP_DKPTable, true)[dkp_total[1][1]].dkp, core.DB.modes.rounding)) elseif mode == "Roll Based Bidding" then local minRoll; local maxRoll; @@ -187,14 +187,14 @@ function BidInterface_Update() if core.DB.modes.rolls.min == 0 or core.DB.modes.rolls.min == 1 then minRoll = 1; else - minRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[dkp_total[1][1]].dkp * (core.DB.modes.rolls.min / 100); + minRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[dkp_total[1][1]].dkp * (core.DB.modes.rolls.min / 100); end - maxRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[dkp_total[1][1]].dkp * (core.DB.modes.rolls.max / 100) + core.DB.modes.rolls.AddToMax; + maxRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[dkp_total[1][1]].dkp * (core.DB.modes.rolls.max / 100) + core.DB.modes.rolls.AddToMax; elseif not core.DB.modes.rolls.UsePerc then minRoll = core.DB.modes.rolls.min; if core.DB.modes.rolls.max == 0 then - maxRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[dkp_total[1][1]].dkp + core.DB.modes.rolls.AddToMax; + maxRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[dkp_total[1][1]].dkp + core.DB.modes.rolls.AddToMax; else maxRoll = core.DB.modes.rolls.max + core.DB.modes.rolls.AddToMax; end @@ -632,9 +632,9 @@ function MonDKP:BidInterface_Create() end local dkp = 0 - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), UnitName("player"), "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), UnitName("player"), "player") if search then - dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp; + dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp; end if behavior == "Max DKP" or itemValue == 0 then @@ -670,9 +670,9 @@ function MonDKP:BidInterface_Create() end local dkp = 0 - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), UnitName("player"), "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), UnitName("player"), "player") if search then - dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp; + dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp; end if behavior == "Max DKP" or itemValue == 0 then diff --git a/Modules/Bidding.lua b/Modules/Bidding.lua index 30641f88..d33cddb1 100644 --- a/Modules/Bidding.lua +++ b/Modules/Bidding.lua @@ -39,7 +39,7 @@ local function Roll_OnEvent(self, event, arg1, ...) pattern = string.gsub(pattern, "%%d", "%(%%d+%)") for name, roll, low, high in string.gmatch(arg1, pattern) do - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), name) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), name) local minRoll; local maxRoll; @@ -47,14 +47,14 @@ local function Roll_OnEvent(self, event, arg1, ...) if core.DB.modes.rolls.min == 0 or core.DB.modes.rolls.min == 1 then minRoll = 1; else - minRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.min / 100); + minRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.min / 100); end - maxRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.max / 100) + core.DB.modes.rolls.AddToMax; + maxRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.max / 100) + core.DB.modes.rolls.AddToMax; elseif not core.DB.modes.rolls.UsePerc then minRoll = core.DB.modes.rolls.min; if core.DB.modes.rolls.max == 0 then - maxRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp + core.DB.modes.rolls.AddToMax; + maxRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp + core.DB.modes.rolls.AddToMax; else maxRoll = core.DB.modes.rolls.max + core.DB.modes.rolls.AddToMax; end @@ -68,8 +68,8 @@ local function Roll_OnEvent(self, event, arg1, ...) --math.floor(minRoll).."-"..math.floor(maxRoll) - if search and mode == "Roll Based Bidding" and core.BiddingWindow.cost:GetNumber() > MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp and not core.DB.modes.SubZeroBidding and core.DB.modes.costvalue ~= "Percent" then - SendChatMessage(L["ROLLNOTACCEPTED"].." "..MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp.." "..L["DKP"]..".", "WHISPER", nil, name) + if search and mode == "Roll Based Bidding" and core.BiddingWindow.cost:GetNumber() > MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp and not core.DB.modes.SubZeroBidding and core.DB.modes.costvalue ~= "Percent" then + SendChatMessage(L["ROLLNOTACCEPTED"].." "..MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp.." "..L["DKP"]..".", "WHISPER", nil, name) return; end @@ -243,15 +243,15 @@ function MonDKP_CHAT_MSG_WHISPER(text, ...) return MonDKP_CHAT_MSG_WHISPER("!bid "..cmd, name) elseif cmd and cmd:gsub("%s+", "") ~= "nil" and cmd:gsub("%s+", "") ~= "" then -- allows command if it has content (removes empty spaces) cmd = cmd:gsub("%s+", "") -- removes unintended spaces from string - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), cmd, "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), cmd, "player") if search then - response = "MonolithDKP: "..MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].player.." "..L["CURRENTLYHAS"].." "..MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp.." "..L["DKPAVAILABLE"].."." + response = "MonolithDKP: "..MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].player.." "..L["CURRENTLYHAS"].." "..MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp.." "..L["DKPAVAILABLE"].."." else response = "MonolithDKP: "..L["PLAYERNOTFOUND"] end else - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), name) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), name) local minimum; local maximum; local range = ""; @@ -262,16 +262,16 @@ function MonDKP_CHAT_MSG_WHISPER(text, ...) if core.DB.modes.rolls.min == 0 then minimum = 1; else - minimum = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.min / 100); + minimum = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.min / 100); end perc = " ("..core.DB.modes.rolls.min.."% - "..core.DB.modes.rolls.max.."%)"; - maximum = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.max / 100) + core.DB.modes.rolls.AddToMax; + maximum = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp * (core.DB.modes.rolls.max / 100) + core.DB.modes.rolls.AddToMax; elseif not core.DB.modes.rolls.UsePerc then minimum = core.DB.modes.rolls.min; if core.DB.modes.rolls.max == 0 then - maximum = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp + core.DB.modes.rolls.AddToMax; + maximum = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp + core.DB.modes.rolls.AddToMax; else maximum = core.DB.modes.rolls.max + core.DB.modes.rolls.AddToMax; end @@ -282,7 +282,7 @@ function MonDKP_CHAT_MSG_WHISPER(text, ...) end if search then - response = "MonolithDKP: "..L["YOUCURRENTLYHAVE"].." "..MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp.." "..L["DKP"].."."..range; + response = "MonolithDKP: "..L["YOUCURRENTLYHAVE"].." "..MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp.." "..L["DKP"].."."..range; else response = "MonolithDKP: "..L["PLAYERNOTFOUND"] end @@ -453,9 +453,9 @@ function MonDKP:ToggleBidWindow(loot, lootIcon, itemName) -- Max bid values if mode == "Minimum Bid Values" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then - local search_max = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_MaxBids, true), itemName) + local search_max = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_MaxBids, true), itemName) if search_max then - maxBid = MonDKP:GetTable(MonDKP_Player_MaxBids, true)[search_max[1][1]].maxbid + maxBid = MonDKP:GetTable(MonDKP_MaxBids, true)[search_max[1][1]].maxbid core.BiddingWindow.CustomMaxBid:Show(); core.BiddingWindow.CustomMaxBid:SetChecked(true) core.BiddingWindow.CustomMaxBid:SetScript("OnClick", function(self) @@ -471,10 +471,10 @@ function MonDKP:ToggleBidWindow(loot, lootIcon, itemName) end end -- search min bid value(item cost) - local search_min = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_MinBids, true), itemName) + local search_min = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_MinBids, true), itemName) if search_min then - minBid = MonDKP:GetTable(MonDKP_Player_MinBids, true)[search_min[1][1]].minbid + minBid = MonDKP:GetTable(MonDKP_MinBids, true)[search_min[1][1]].minbid if mode == "Minimum Bid Values" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then core.BiddingWindow.CustomMinBid:Show(); core.BiddingWindow.CustomMinBid:SetChecked(true) @@ -560,44 +560,44 @@ local function StartBidding() MonDKP:BidInterface_Toggle() end - local search_min = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_MinBids, true), core.BiddingWindow.itemName:GetText(), "item") + local search_min = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_MinBids, true), core.BiddingWindow.itemName:GetText(), "item") local val_min = MonDKP:GetMinBid(CurrItemForBid); - local search_max = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_MaxBids, true), core.BiddingWindow.itemName:GetText(), "item") + local search_max = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_MaxBids, true), core.BiddingWindow.itemName:GetText(), "item") local val_max = MonDKP:GetMaxBid(CurrItemForBid); -- Min if not search_min and core.BiddingWindow.minBid:GetNumber() ~= tonumber(val_min) then - tinsert(MonDKP:GetTable(MonDKP_Player_MinBids, true), {item=core.BiddingWindow.itemName:GetText(), minbid=core.BiddingWindow.minBid:GetNumber()}) + tinsert(MonDKP:GetTable(MonDKP_MinBids, true), {item=core.BiddingWindow.itemName:GetText(), minbid=core.BiddingWindow.minBid:GetNumber()}) core.BiddingWindow.CustomMinBid:SetShown(true); core.BiddingWindow.CustomMinBid:SetChecked(true); elseif search_min and core.BiddingWindow.minBid:GetNumber() ~= tonumber(val_min) and core.BiddingWindow.CustomMinBid:GetChecked() == true then - if MonDKP:GetTable(MonDKP_Player_MinBids, true)[search_min[1][1]].minbid ~= core.BiddingWindow.minBid:GetNumber() then - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search_min[1][1]].minbid = core.BiddingWindow.minBid:GetNumber(); + if MonDKP:GetTable(MonDKP_MinBids, true)[search_min[1][1]].minbid ~= core.BiddingWindow.minBid:GetNumber() then + MonDKP:GetTable(MonDKP_MinBids, true)[search_min[1][1]].minbid = core.BiddingWindow.minBid:GetNumber(); core.BiddingWindow.CustomMinBid:SetShown(true); core.BiddingWindow.CustomMinBid:SetChecked(true); end end if search_min and core.BiddingWindow.CustomMinBid:GetChecked() == false then - table.remove(MonDKP:GetTable(MonDKP_Player_MinBids, true), search_min[1][1]) + table.remove(MonDKP:GetTable(MonDKP_MinBids, true), search_min[1][1]) core.BiddingWindow.CustomMinBid:SetShown(false); end -- Max if not search_max and core.BiddingWindow.maxBid:GetNumber() ~= tonumber(val_max) then - tinsert(MonDKP:GetTable(MonDKP_Player_MaxBids, true), {item=core.BiddingWindow.itemName:GetText(), maxbid=core.BiddingWindow.maxBid:GetNumber()}) + tinsert(MonDKP:GetTable(MonDKP_MaxBids, true), {item=core.BiddingWindow.itemName:GetText(), maxbid=core.BiddingWindow.maxBid:GetNumber()}) core.BiddingWindow.CustomMaxBid:SetShown(true); core.BiddingWindow.CustomMaxBid:SetChecked(true); elseif search_max and core.BiddingWindow.maxBid:GetNumber() ~= tonumber(val_max) and core.BiddingWindow.CustomMaxBid:GetChecked() == true then - if MonDKP:GetTable(MonDKP_Player_MaxBids, true)[search_max[1][1]].maxbid ~= core.BiddingWindow.maxBid:GetNumber() then - MonDKP:GetTable(MonDKP_Player_MaxBids, true)[search_max[1][1]].maxbid = core.BiddingWindow.maxBid:GetNumber(); + if MonDKP:GetTable(MonDKP_MaxBids, true)[search_max[1][1]].maxbid ~= core.BiddingWindow.maxBid:GetNumber() then + MonDKP:GetTable(MonDKP_MaxBids, true)[search_max[1][1]].maxbid = core.BiddingWindow.maxBid:GetNumber(); core.BiddingWindow.CustomMaxBid:SetShown(true); core.BiddingWindow.CustomMaxBid:SetChecked(true); end end if search_max and core.BiddingWindow.CustomMaxBid:GetChecked() == false then - table.remove(MonDKP:GetTable(MonDKP_Player_MaxBids, true), search_max[1][1]) + table.remove(MonDKP:GetTable(MonDKP_MaxBids, true), search_max[1][1]) core.BiddingWindow.CustomMaxBid:SetShown(false); end else @@ -1166,8 +1166,8 @@ function BidScrollFrame_Update() for i=1, showRows do row = core.BiddingWindow.bidTable.Rows[i] index = offset + i - local dkp_total = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), Bids_Submitted[i].player) - local c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[dkp_total[1][1]].class) + local dkp_total = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), Bids_Submitted[i].player) + local c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[dkp_total[1][1]].class) rank = MonDKP:GetGuildRank(Bids_Submitted[i].player) if Bids_Submitted[index] then row:Show() @@ -1177,7 +1177,7 @@ function BidScrollFrame_Update() row.Strings[1].rowCounter:SetText(index) if mode == "Minimum Bid Values" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Minimum Bid") then row.Strings[2]:SetText(Bids_Submitted[i].bid) - row.Strings[3]:SetText(MonDKP_round(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[dkp_total[1][1]].dkp, core.DB.modes.rounding)) + row.Strings[3]:SetText(MonDKP_round(MonDKP:GetTable(MonDKP_DKPTable, true)[dkp_total[1][1]].dkp, core.DB.modes.rounding)) elseif mode == "Roll Based Bidding" then local minRoll; local maxRoll; @@ -1186,14 +1186,14 @@ function BidScrollFrame_Update() if core.DB.modes.rolls.min == 0 or core.DB.modes.rolls.min == 1 then minRoll = 1; else - minRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[dkp_total[1][1]].dkp * (core.DB.modes.rolls.min / 100); + minRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[dkp_total[1][1]].dkp * (core.DB.modes.rolls.min / 100); end - maxRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[dkp_total[1][1]].dkp * (core.DB.modes.rolls.max / 100) + core.DB.modes.rolls.AddToMax; + maxRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[dkp_total[1][1]].dkp * (core.DB.modes.rolls.max / 100) + core.DB.modes.rolls.AddToMax; elseif not core.DB.modes.rolls.UsePerc then minRoll = core.DB.modes.rolls.min; if core.DB.modes.rolls.max == 0 then - maxRoll = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[dkp_total[1][1]].dkp + core.DB.modes.rolls.AddToMax; + maxRoll = MonDKP:GetTable(MonDKP_DKPTable, true)[dkp_total[1][1]].dkp + core.DB.modes.rolls.AddToMax; else maxRoll = core.DB.modes.rolls.max + core.DB.modes.rolls.AddToMax; end diff --git a/Modules/ClassGraph.lua b/Modules/ClassGraph.lua index 29d42a11..14661535 100644 --- a/Modules/ClassGraph.lua +++ b/Modules/ClassGraph.lua @@ -20,10 +20,10 @@ function MonDKP:ClassGraph() local BarWidth = 25 for k, v in pairs(core.classes) do - local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), v) + local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), v) if classSearch and #classSearch > 0 then tinsert(classCount, #classSearch) - local classPerc = MonDKP_round(#classSearch / #MonDKP:GetTable(MonDKP_Player_DKPTable, true), 4); + local classPerc = MonDKP_round(#classSearch / #MonDKP:GetTable(MonDKP_DKPTable, true), 4); tinsert(perc, classPerc * 100) local adjustBar = BarMaxHeight * classPerc; tinsert(perc_height, adjustBar) @@ -122,10 +122,10 @@ function MonDKP:ClassGraph_Update() local BarWidth = 25 for k, v in pairs(core.classes) do - local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), v) + local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), v) if classSearch and #classSearch > 0 then tinsert(classCount, #classSearch) - local classPerc = MonDKP_round(#classSearch / #MonDKP:GetTable(MonDKP_Player_DKPTable, true), 4); + local classPerc = MonDKP_round(#classSearch / #MonDKP:GetTable(MonDKP_DKPTable, true), 4); tinsert(perc, classPerc * 100) local adjustBar = BarMaxHeight * classPerc; tinsert(perc_height, adjustBar) diff --git a/Modules/DKPHistory.lua b/Modules/DKPHistory.lua index 28081d68..a26734fb 100644 --- a/Modules/DKPHistory.lua +++ b/Modules/DKPHistory.lua @@ -26,17 +26,17 @@ local history = {}; local menuFrame = CreateFrame("Frame", "MonDKPDeleteDKPMenuFrame", UIParent, "UIDropDownMenuTemplate") function MonDKP:SortDKPHistoryTable() -- sorts the DKP History Table by date/time - table.sort(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), function(a, b) + table.sort(MonDKP:GetTable(MonDKP_DKPHistory, true), function(a, b) return a["date"] > b["date"] end) end local function GetSortOptions() local PlayerList = {} - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPTable, true) do - local playerSearch = MonDKP:Table_Search(PlayerList, MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].player) + for i=1, #MonDKP:GetTable(MonDKP_DKPTable, true) do + local playerSearch = MonDKP:Table_Search(PlayerList, MonDKP:GetTable(MonDKP_DKPTable, true)[i].player) if not playerSearch then - tinsert(PlayerList, MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].player) + tinsert(PlayerList, MonDKP:GetTable(MonDKP_DKPTable, true)[i].player) end end table.sort(PlayerList, function(a, b) @@ -107,11 +107,11 @@ function DKPHistoryFilterBox_Create() filterName.func = self.FilterSetValue for i=ranges[menuList], ranges[menuList]+19 do if PlayerList[i] then - local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), PlayerList[i]) + local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), PlayerList[i]) local c; if classSearch then - c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[classSearch[1][1]].class) + c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[classSearch[1][1]].class) else c = { hex="444444" } end @@ -153,7 +153,7 @@ function DKPHistoryFilterBox_Create() end local function MonDKPDeleteDKPEntry(index, timestamp, item) -- index = entry index (Roeshambo-1), item = # of the entry on DKP History tab; may be different than the key of DKPHistory if hidden fields exist - -- pop confirmation. If yes, cycles through MonDKP:GetTable(MonDKP_Player_DKPHistory, true).players and every name it finds, it refunds them (or strips them of) dkp. + -- pop confirmation. If yes, cycles through MonDKP:GetTable(MonDKP_DKPHistory, true).players and every name it finds, it refunds them (or strips them of) dkp. -- if deleted is the weekly decay, curdkp * (100 / (100 - decayvalue)) local reason_header = MonDKP.ConfigTab6.history[item].d:GetText(); if strfind(reason_header, L["OTHER"].."- ") then reason_header = reason_header:gsub(L["OTHER"].." -- ", "") end @@ -171,31 +171,31 @@ local function MonDKPDeleteDKPEntry(index, timestamp, item) -- index = entry in -- add new entry and add "delted_by" field to entry being "deleted". make new entry exact opposite of "deleted" entry -- new entry gets "deletes", old entry gets "deleted_by", deletes = deleted_by index. and vice versa - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), index, "index") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPHistory, true), index, "index") if search then - local players = {strsplit(",", strsub(MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].players, 1, -2))} -- cuts off last "," from string to avoid creating an empty value + local players = {strsplit(",", strsub(MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].players, 1, -2))} -- cuts off last "," from string to avoid creating an empty value local dkp, mod; local dkpString = ""; local curOfficer = UnitName("player") local curTime = time() local newIndex = curOfficer.."-"..curTime - if strfind(MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].dkp, "%-%d*%.?%d+%%") then -- determines if it's a mass decay - dkp = {strsplit(",", MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].dkp)} + if strfind(MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].dkp, "%-%d*%.?%d+%%") then -- determines if it's a mass decay + dkp = {strsplit(",", MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].dkp)} mod = "perc"; else - dkp = MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].dkp + dkp = MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].dkp mod = "whole" end for i=1, #players do if mod == "perc" then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), players[i]) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), players[i]) if search then local inverted = tonumber(dkp[i]) * -1 - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp + inverted + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp + inverted dkpString = dkpString..inverted..","; if i == #players then @@ -203,15 +203,15 @@ local function MonDKPDeleteDKPEntry(index, timestamp, item) -- index = entry in end end else - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), players[i]) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), players[i]) if search then local inverted = tonumber(dkp) * -1 - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp + inverted + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp + inverted if tonumber(dkp) > 0 then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].lifetime_gained = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].lifetime_gained + inverted + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].lifetime_gained = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].lifetime_gained + inverted end dkpString = inverted; @@ -219,9 +219,9 @@ local function MonDKPDeleteDKPEntry(index, timestamp, item) -- index = entry in end end - MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].deletedby = newIndex - table.insert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), 1, { players=MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].players, dkp=dkpString, date=curTime, reason="Delete Entry", index=newIndex, deletes=index }) - MonDKP.Sync:SendData("MonDKPDelSync", MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[1]) + MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].deletedby = newIndex + table.insert(MonDKP:GetTable(MonDKP_DKPHistory, true), 1, { players=MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].players, dkp=dkpString, date=curTime, reason="Delete Entry", index=newIndex, deletes=index }) + MonDKP.Sync:SendData("MonDKPDelSync", MonDKP:GetTable(MonDKP_DKPHistory, true)[1]) if MonDKP.ConfigTab6.history and MonDKP.ConfigTab6:IsShown() then MonDKP:DKPHistory_Update(true) @@ -241,7 +241,7 @@ end local function RightClickDKPMenu(self, index, timestamp, item) local header - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), index, "index") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPHistory, true), index, "index") if search then menu = { @@ -267,21 +267,21 @@ function MonDKP:DKPHistory_Update(reset) end if filter and filter ~= L["DELETEDENTRY"] then - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPHistory, true) do - if not MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].deletes and not MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].deletedby and MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].reason ~= "Migration Correction" and (strfind(MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].players, ","..filter..",") or strfind(MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].players, filter..",") == 1) then - table.insert(DKPHistory, MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i]) + for i=1, #MonDKP:GetTable(MonDKP_DKPHistory, true) do + if not MonDKP:GetTable(MonDKP_DKPHistory, true)[i].deletes and not MonDKP:GetTable(MonDKP_DKPHistory, true)[i].deletedby and MonDKP:GetTable(MonDKP_DKPHistory, true)[i].reason ~= "Migration Correction" and (strfind(MonDKP:GetTable(MonDKP_DKPHistory, true)[i].players, ","..filter..",") or strfind(MonDKP:GetTable(MonDKP_DKPHistory, true)[i].players, filter..",") == 1) then + table.insert(DKPHistory, MonDKP:GetTable(MonDKP_DKPHistory, true)[i]) end end elseif filter and filter == L["DELETEDENTRY"] then - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPHistory, true) do - if MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].deletes then - table.insert(DKPHistory, MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i]) + for i=1, #MonDKP:GetTable(MonDKP_DKPHistory, true) do + if MonDKP:GetTable(MonDKP_DKPHistory, true)[i].deletes then + table.insert(DKPHistory, MonDKP:GetTable(MonDKP_DKPHistory, true)[i]) end end elseif not filter then - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPHistory, true) do - if not MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].deletes and not MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].hidden and not MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].deletedby then - table.insert(DKPHistory, MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i]) + for i=1, #MonDKP:GetTable(MonDKP_DKPHistory, true) do + if not MonDKP:GetTable(MonDKP_DKPHistory, true)[i].deletes and not MonDKP:GetTable(MonDKP_DKPHistory, true)[i].hidden and not MonDKP:GetTable(MonDKP_DKPHistory, true)[i].deletedby then + table.insert(DKPHistory, MonDKP:GetTable(MonDKP_DKPHistory, true)[i]) end end end @@ -314,11 +314,11 @@ function MonDKP:DKPHistory_Update(reset) if not MonDKP.ConfigTab6.history[i] then if i==1 then - MonDKP.ConfigTab6.history[i] = CreateFrame("Frame", "MonDKP:GetTable(MonDKP_Player_DKPHistory, true)Tab", MonDKP.ConfigTab6); + MonDKP.ConfigTab6.history[i] = CreateFrame("Frame", "MonDKP:GetTable(MonDKP_DKPHistory, true)Tab", MonDKP.ConfigTab6); MonDKP.ConfigTab6.history[i]:SetPoint("TOPLEFT", MonDKP.ConfigTab6, "TOPLEFT", 0, -45) MonDKP.ConfigTab6.history[i]:SetWidth(400) else - MonDKP.ConfigTab6.history[i] = CreateFrame("Frame", "MonDKP:GetTable(MonDKP_Player_DKPHistory, true)Tab", MonDKP.ConfigTab6); + MonDKP.ConfigTab6.history[i] = CreateFrame("Frame", "MonDKP:GetTable(MonDKP_DKPHistory, true)Tab", MonDKP.ConfigTab6); MonDKP.ConfigTab6.history[i]:SetPoint("TOPLEFT", MonDKP.ConfigTab6.history[i-1], "BOTTOMLEFT", 0, 0) MonDKP.ConfigTab6.history[i]:SetWidth(400) end @@ -350,18 +350,18 @@ function MonDKP:DKPHistory_Update(reset) local delete_on_date, delete_day, delete_timeofday, delete_year, delete_month, delete_day, delOfficer; if filter == L["DELETEDENTRY"] then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), DKPHistory[i].deletes, "index") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPHistory, true), DKPHistory[i].deletes, "index") if search then - delOfficer,_ = strsplit("-", MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].deletedby) - players = MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].players; - if strfind(MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].reason, L["OTHER"].." - ") == 1 then - reason = MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].reason:gsub(L["OTHER"].." -- ", ""); + delOfficer,_ = strsplit("-", MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].deletedby) + players = MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].players; + if strfind(MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].reason, L["OTHER"].." - ") == 1 then + reason = MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].reason:gsub(L["OTHER"].." -- ", ""); else - reason = MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].reason + reason = MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].reason end - dkp = MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].dkp; - date = MonDKP:FormatTime(MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].date); + dkp = MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].dkp; + date = MonDKP:FormatTime(MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].date); delete_on_date = MonDKP:FormatTime(DKPHistory[i].date) delete_day = strsub(delete_on_date, 1, 8) delete_timeofday = strsub(delete_on_date, 10) @@ -389,10 +389,10 @@ function MonDKP:DKPHistory_Update(reset) end for k=1, #player_table do - classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), player_table[k]) + classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), player_table[k]) if classSearch then - c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[classSearch[1][1]].class) + c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[classSearch[1][1]].class) if k < #player_table then playerString = playerString.."|cff"..c.hex..player_table[k].."|r, " elseif k == #player_table then @@ -428,9 +428,9 @@ function MonDKP:DKPHistory_Update(reset) MonDKP.ConfigTab6.history[i].h:Hide() end - local officer_search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), curOfficer, "player") + local officer_search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), curOfficer, "player") if officer_search then - c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[officer_search[1][1]].class) + c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[officer_search[1][1]].class) else c = { hex="444444" } end @@ -468,9 +468,9 @@ function MonDKP:DKPHistory_Update(reset) MonDKP.ConfigTab6.history[i].b:SetPoint("BOTTOMRIGHT", MonDKP.ConfigTab6.history[i], "BOTTOMRIGHT", 0, 0) MonDKP.ConfigTab6.history[i].b:SetScript("OnEnter", function(self) local col - local s = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), delOfficer, "player") + local s = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), delOfficer, "player") if s then - col = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[s[1][1]].class) + col = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[s[1][1]].class) else col = { hex="444444"} end diff --git a/Modules/LootHistory.lua b/Modules/LootHistory.lua index fabd10aa..db97249c 100644 --- a/Modules/LootHistory.lua +++ b/Modules/LootHistory.lua @@ -12,7 +12,7 @@ local menuFrame = CreateFrame("Frame", "MonDKPDeleteLootMenuFrame", UIParent, "U function MonDKP:SortLootTable() -- sorts the Loot History Table by date - table.sort(MonDKP:GetTable(MonDKP_Player_Loot, true), function(a, b) + table.sort(MonDKP:GetTable(MonDKP_Loot, true), function(a, b) return a["date"] > b["date"] end) end @@ -33,10 +33,10 @@ end local function GetSortOptions() local PlayerList = {} - for i=1, #MonDKP:GetTable(MonDKP_Player_Loot, true) do - local playerSearch = MonDKP:Table_Search(PlayerList, MonDKP:GetTable(MonDKP_Player_Loot, true)[i].player) - if not playerSearch and not MonDKP:GetTable(MonDKP_Player_Loot, true)[i].de then - tinsert(PlayerList, MonDKP:GetTable(MonDKP_Player_Loot, true)[i].player) + for i=1, #MonDKP:GetTable(MonDKP_Loot, true) do + local playerSearch = MonDKP:Table_Search(PlayerList, MonDKP:GetTable(MonDKP_Loot, true)[i].player) + if not playerSearch and not MonDKP:GetTable(MonDKP_Loot, true)[i].de then + tinsert(PlayerList, MonDKP:GetTable(MonDKP_Loot, true)[i].player) end end SortPlayerTable(PlayerList) @@ -46,10 +46,10 @@ end local function GetItemHistoryList() _ItemList = {} -- we look at saved variable and find every unique item looted? - for i=1, #MonDKP:GetTable(MonDKP_Player_Loot, true) do - local itemSearch = MonDKP:Table_Search(_ItemList, MonDKP:GetTable(MonDKP_Player_Loot, true)[i].loot) + for i=1, #MonDKP:GetTable(MonDKP_Loot, true) do + local itemSearch = MonDKP:Table_Search(_ItemList, MonDKP:GetTable(MonDKP_Loot, true)[i].loot) if not itemSearch then - tinsert(_ItemList, MonDKP:GetTable(MonDKP_Player_Loot, true)[i].loot) + tinsert(_ItemList, MonDKP:GetTable(MonDKP_Loot, true)[i].loot) end end SortItemTable(_ItemList) @@ -57,8 +57,8 @@ local function GetItemHistoryList() end local function DeleteLootHistoryEntry(index) - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), index, "index"); - local search_player = MonDKP:Table_Search(MonDKP_DKPTable, MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].player); + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), index, "index"); + local search_player = MonDKP:Table_Search(MonDKP_DKPTable, MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].player); local curTime = time() local curOfficer = UnitName("player") local newIndex = curOfficer.."-"..curTime @@ -68,14 +68,14 @@ local function DeleteLootHistoryEntry(index) MonDKP:LootHistory_Reset() local tempTable = { - player = MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].player, - loot = MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].loot, - zone = MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].zone, + player = MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].player, + loot = MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].loot, + zone = MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].zone, date = time(), - boss = MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].boss, - cost = -MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].cost, + boss = MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].boss, + cost = -MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].cost, index = newIndex, - deletes = MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].index + deletes = MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].index } if search_player then @@ -83,9 +83,9 @@ local function DeleteLootHistoryEntry(index) MonDKP_DKPTable[search_player[1][1]].lifetime_spent = MonDKP_DKPTable[search_player[1][1]].lifetime_spent + tempTable.cost -- remove from lifetime_spent end - MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].deletedby = newIndex + MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].deletedby = newIndex - table.insert(MonDKP:GetTable(MonDKP_Player_Loot, true), 1, tempTable) + table.insert(MonDKP:GetTable(MonDKP_Loot, true), 1, tempTable) MonDKP.Sync:SendData("MonDKPDelLoot", tempTable) MonDKP:SortLootTable() DKPTable_Update() @@ -93,14 +93,14 @@ local function DeleteLootHistoryEntry(index) end local function MonDKPDeleteMenu(index) - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), index, "index") - local search2 = MonDKP:Table_Search(MonDKP_DKPTable, MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]]["player"]) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), index, "index") + local search2 = MonDKP:Table_Search(MonDKP_DKPTable, MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]]["player"]) local c, deleteString; if search2 then c = MonDKP:GetCColors(MonDKP_DKPTable[search2[1][1]].class) - deleteString = L["CONFIRMDELETEENTRY1"]..": |cff"..c.hex..MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]]["player"].."|r "..L["WON"].." "..MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]]["loot"].." "..L["FOR"].." "..-MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]]["cost"].." "..L["DKP"].."?\n\n("..L["THISWILLREFUND"].." |cff"..c.hex..MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].player.."|r "..-MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]]["cost"].." "..L["DKP"]..")"; + deleteString = L["CONFIRMDELETEENTRY1"]..": |cff"..c.hex..MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]]["player"].."|r "..L["WON"].." "..MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]]["loot"].." "..L["FOR"].." "..-MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]]["cost"].." "..L["DKP"].."?\n\n("..L["THISWILLREFUND"].." |cff"..c.hex..MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].player.."|r "..-MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]]["cost"].." "..L["DKP"]..")"; else - deleteString = L["CONFIRMDELETEENTRY1"]..": |cff444444"..MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]]["player"].."|r "..L["WON"].." "..MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]]["loot"].." "..L["FOR"].." "..-MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]]["cost"].." "..L["DKP"].."?\n\n("..L["THISWILLREFUND"].." |cff444444"..MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].player.."|r "..-onDKP_Loot[search[1][1]]["cost"].." "..L["DKP"]..")"; + deleteString = L["CONFIRMDELETEENTRY1"]..": |cff444444"..MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]]["player"].."|r "..L["WON"].." "..MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]]["loot"].." "..L["FOR"].." "..-MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]]["cost"].." "..L["DKP"].."?\n\n("..L["THISWILLREFUND"].." |cff444444"..MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].player.."|r "..-onDKP_Loot[search[1][1]]["cost"].." "..L["DKP"]..")"; end StaticPopupDialogs["DELETE_LOOT_ENTRY"] = { @@ -119,14 +119,14 @@ local function MonDKPDeleteMenu(index) end local function RightClickLootMenu(self, index) -- called by right click function on ~201 row:SetScript - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), index, "index") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), index, "index") menu = { - { text = MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]]["loot"].." "..L["FOR"].." "..MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]]["cost"].." "..L["DKP"], isTitle = true}, + { text = MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]]["loot"].." "..L["FOR"].." "..MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]]["cost"].." "..L["DKP"], isTitle = true}, { text = "Delete Entry", func = function() MonDKPDeleteMenu(index) end }, { text = L["REASSIGNSELECTED"], func = function() - local path = MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]] + local path = MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]] if #core.SelectedData == 1 then MonDKP:AwardConfirm(core.SelectedData[1].player, -path.cost, path.boss, path.zone, path.loot, index) @@ -371,7 +371,7 @@ function MonDKP:LootHistory_Reset() curBoss = nil; if MonDKP.DKPTable then - for i=1, #MonDKP:GetTable(MonDKP_Player_Loot, true)+1 do + for i=1, #MonDKP:GetTable(MonDKP_Loot, true)+1 do if MonDKP.ConfigTab5.looter[i] then MonDKP.ConfigTab5.looter[i]:SetText("") MonDKP.ConfigTab5.lootFrame[i]:Hide() @@ -401,27 +401,27 @@ function MonDKP:LootHistory_Update(filter) -- if "filter" is included in call if filter and filter ~= L["NOFILTER"] and filter ~= L["DELETEDENTRY"] then -- items or players - for i=1, #MonDKP:GetTable(MonDKP_Player_Loot, true) do + for i=1, #MonDKP:GetTable(MonDKP_Loot, true) do if curDropDownMenuFilterCategory == L["PLAYERS"] then - if not MonDKP:GetTable(MonDKP_Player_Loot, true)[i].deletes and not MonDKP:GetTable(MonDKP_Player_Loot, true)[i].deletedby and not MonDKP:GetTable(MonDKP_Player_Loot, true)[i].hidden and MonDKP:GetTable(MonDKP_Player_Loot, true)[i].player == filter then - table.insert(LootTable, MonDKP:GetTable(MonDKP_Player_Loot, true)[i]) + if not MonDKP:GetTable(MonDKP_Loot, true)[i].deletes and not MonDKP:GetTable(MonDKP_Loot, true)[i].deletedby and not MonDKP:GetTable(MonDKP_Loot, true)[i].hidden and MonDKP:GetTable(MonDKP_Loot, true)[i].player == filter then + table.insert(LootTable, MonDKP:GetTable(MonDKP_Loot, true)[i]) end elseif curDropDownMenuFilterCategory == L["ITEMS"] then - if not MonDKP:GetTable(MonDKP_Player_Loot, true)[i].deletes and not MonDKP:GetTable(MonDKP_Player_Loot, true)[i].deletedby and not MonDKP:GetTable(MonDKP_Player_Loot, true)[i].hidden and MonDKP:GetTable(MonDKP_Player_Loot, true)[i].loot == filter then - table.insert(LootTable, MonDKP:GetTable(MonDKP_Player_Loot, true)[i]) + if not MonDKP:GetTable(MonDKP_Loot, true)[i].deletes and not MonDKP:GetTable(MonDKP_Loot, true)[i].deletedby and not MonDKP:GetTable(MonDKP_Loot, true)[i].hidden and MonDKP:GetTable(MonDKP_Loot, true)[i].loot == filter then + table.insert(LootTable, MonDKP:GetTable(MonDKP_Loot, true)[i]) end end end elseif filter and filter == L["DELETEDENTRY"] then - for i=1, #MonDKP:GetTable(MonDKP_Player_Loot, true) do - if MonDKP:GetTable(MonDKP_Player_Loot, true)[i].deletes then - table.insert(LootTable, MonDKP:GetTable(MonDKP_Player_Loot, true)[i]) + for i=1, #MonDKP:GetTable(MonDKP_Loot, true) do + if MonDKP:GetTable(MonDKP_Loot, true)[i].deletes then + table.insert(LootTable, MonDKP:GetTable(MonDKP_Loot, true)[i]) end end else -- no filter - for i=1, #MonDKP:GetTable(MonDKP_Player_Loot, true) do - if not MonDKP:GetTable(MonDKP_Player_Loot, true)[i].deletes and not MonDKP:GetTable(MonDKP_Player_Loot, true)[i].deletedby and not MonDKP:GetTable(MonDKP_Player_Loot, true)[i].hidden then - table.insert(LootTable, MonDKP:GetTable(MonDKP_Player_Loot, true)[i]) + for i=1, #MonDKP:GetTable(MonDKP_Loot, true) do + if not MonDKP:GetTable(MonDKP_Loot, true)[i].deletes and not MonDKP:GetTable(MonDKP_Loot, true)[i].deletedby and not MonDKP:GetTable(MonDKP_Loot, true)[i].hidden then + table.insert(LootTable, MonDKP:GetTable(MonDKP_Loot, true)[i]) end end end @@ -443,10 +443,10 @@ function MonDKP:LootHistory_Update(filter) -- if "filter" is included in call local i = j processing = true local itemToLink = LootTable[i]["loot"] - local del_search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), LootTable[i].deletes, "index") + local del_search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), LootTable[i].deletes, "index") if filter == L["DELETEDENTRY"] then - thedate = MonDKP:FormatTime(MonDKP:GetTable(MonDKP_Player_Loot, true)[del_search[1][1]].date) + thedate = MonDKP:FormatTime(MonDKP:GetTable(MonDKP_Loot, true)[del_search[1][1]].date) else thedate = MonDKP:FormatTime(LootTable[i]["date"]) end @@ -598,10 +598,10 @@ function MonDKP:LootHistory_Update(filter) -- if "filter" is included in call end end end - for j=1, #MonDKP:GetTable(MonDKP_Player_Loot, true) do - if MonDKP:GetTable(MonDKP_Player_Loot, true)[j]["loot"] == itemToLink and LootTable[i].date ~= MonDKP:GetTable(MonDKP_Player_Loot, true)[j].date and not MonDKP:GetTable(MonDKP_Player_Loot, true)[j].deletedby and not MonDKP:GetTable(MonDKP_Player_Loot, true)[j].deletes then + for j=1, #MonDKP:GetTable(MonDKP_Loot, true) do + if MonDKP:GetTable(MonDKP_Loot, true)[j]["loot"] == itemToLink and LootTable[i].date ~= MonDKP:GetTable(MonDKP_Loot, true)[j].date and not MonDKP:GetTable(MonDKP_Loot, true)[j].deletedby and not MonDKP:GetTable(MonDKP_Loot, true)[j].deletes then local col; - local s = MonDKP:Table_Search(MonDKP_DKPTable, MonDKP:GetTable(MonDKP_Player_Loot, true)[j].player) + local s = MonDKP:Table_Search(MonDKP_DKPTable, MonDKP:GetTable(MonDKP_Loot, true)[j].player) if s then col = MonDKP:GetCColors(MonDKP_DKPTable[s[1][1]].class) else @@ -612,11 +612,11 @@ function MonDKP:LootHistory_Update(filter) -- if "filter" is included in call tooltip:AddLine(L["ALSOWONBY"]..":", 0.25, 0.75, 0.90, 1, true); history = 1; end - tooltip:AddDoubleLine("|cff"..col.hex..MonDKP:GetTable(MonDKP_Player_Loot, true)[j].player.."|r |cffffffff("..date("%m/%d/%y", MonDKP:GetTable(MonDKP_Player_Loot, true)[j].date)..")|r", "|cffff0000"..-MonDKP:GetTable(MonDKP_Player_Loot, true)[j].cost.." "..L["DKP"].."|r", 1.0, 0, 0) + tooltip:AddDoubleLine("|cff"..col.hex..MonDKP:GetTable(MonDKP_Loot, true)[j].player.."|r |cffffffff("..date("%m/%d/%y", MonDKP:GetTable(MonDKP_Loot, true)[j].date)..")|r", "|cffff0000"..-MonDKP:GetTable(MonDKP_Loot, true)[j].cost.." "..L["DKP"].."|r", 1.0, 0, 0) end end if filter == L["DELETEDENTRY"] then - local delOfficer,_ = strsplit("-", MonDKP:GetTable(MonDKP_Player_Loot, true)[del_search[1][1]].deletedby) + local delOfficer,_ = strsplit("-", MonDKP:GetTable(MonDKP_Loot, true)[del_search[1][1]].deletedby) local col local del_date = MonDKP:FormatTime(LootTable[i].date) local del_date1, del_date2, del_date3 = strsplit("/", strtrim(strsub(del_date, 1, 8), " ")) diff --git a/Modules/LootPriceTab.lua b/Modules/LootPriceTab.lua index b53e1690..f2b4fb5e 100644 --- a/Modules/LootPriceTab.lua +++ b/Modules/LootPriceTab.lua @@ -63,8 +63,8 @@ function MonDKP:ProcessDisenchant(loot) MonDKP:BroadcastStopBidTimer() if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_MinBids, true), itemName); - local numOfDisenchants = MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]]["disenchants"] or 0; + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_MinBids, true), itemName); + local numOfDisenchants = MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]]["disenchants"] or 0; local updatedDisenchants = numOfDisenchants + 1; local cost = core.BiddingWindow.cost:GetNumber(); @@ -87,16 +87,16 @@ function MonDKP:ProcessDisenchant(loot) if not search then - tinsert(MonDKP:GetTable(MonDKP_Player_MinBids, true), newItem) + tinsert(MonDKP:GetTable(MonDKP_MinBids, true), newItem) core.BiddingWindow.CustomMinBid:SetShown(true); core.BiddingWindow.CustomMinBid:SetChecked(true); else - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].minbid = cost; - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].link = itemLink; - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].icon = itemIcon; - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].disenchants = updatedDisenchants; - newItem = MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]]; + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].minbid = cost; + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].link = itemLink; + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].icon = itemIcon; + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].disenchants = updatedDisenchants; + newItem = MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]]; end MonDKP.Sync:SendData("MonDKPSetPrice", newItem); diff --git a/Modules/ManageEntries.lua b/Modules/ManageEntries.lua index 80a37f05..ad1dc9ad 100644 --- a/Modules/ManageEntries.lua +++ b/Modules/ManageEntries.lua @@ -10,31 +10,31 @@ local function Remove_Entries() local deleted = {} for i=1, #core.SelectedData do - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), core.SelectedData[i]["player"]); + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), core.SelectedData[i]["player"]); local flag = false -- flag = only create archive entry if they appear anywhere in the history. If there's no history, there's no reason anyone would have it. local curTime = time() if search then - local path = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]] + local path = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]] - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPHistory, true) do - if strfind(MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].players, ","..path.player..",") or strfind(MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].players, path.player..",") == 1 then + for i=1, #MonDKP:GetTable(MonDKP_DKPHistory, true) do + if strfind(MonDKP:GetTable(MonDKP_DKPHistory, true)[i].players, ","..path.player..",") or strfind(MonDKP:GetTable(MonDKP_DKPHistory, true)[i].players, path.player..",") == 1 then flag = true end end - for i=1, #MonDKP:GetTable(MonDKP_Player_Loot, true) do - if MonDKP:GetTable(MonDKP_Player_Loot, true)[i].player == path.player then + for i=1, #MonDKP:GetTable(MonDKP_Loot, true) do + if MonDKP:GetTable(MonDKP_Loot, true)[i].player == path.player then flag = true end end if flag then -- above 2 loops flags character if they have any loot/dkp history. Only inserts to archive and broadcasts if found. Other players will not have the entry if no history exists - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[core.SelectedData[i].player] then - MonDKP:GetTable(MonDKP_Player_Archive, true)[core.SelectedData[i].player] = { dkp=0, lifetime_spent=0, lifetime_gained=0, deleted=true, edited=curTime } + if not MonDKP:GetTable(MonDKP_Archive, true)[core.SelectedData[i].player] then + MonDKP:GetTable(MonDKP_Archive, true)[core.SelectedData[i].player] = { dkp=0, lifetime_spent=0, lifetime_gained=0, deleted=true, edited=curTime } else - MonDKP:GetTable(MonDKP_Player_Archive, true)[core.SelectedData[i].player].deleted = true - MonDKP:GetTable(MonDKP_Player_Archive, true)[core.SelectedData[i].player].edited = curTime + MonDKP:GetTable(MonDKP_Archive, true)[core.SelectedData[i].player].deleted = true + MonDKP:GetTable(MonDKP_Archive, true)[core.SelectedData[i].player].edited = curTime end table.insert(deleted, { player=path.player, deleted=true }) end @@ -47,12 +47,12 @@ local function Remove_Entries() end numPlayers = numPlayers + 1 - tremove(MonDKP:GetTable(MonDKP_Player_DKPTable, true), search[1][1]) + tremove(MonDKP:GetTable(MonDKP_DKPTable, true), search[1][1]) - local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Standby, true), core.SelectedData[i].player, "player"); + local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Standby, true), core.SelectedData[i].player, "player"); if search2 then - table.remove(MonDKP:GetTable(MonDKP_Player_Standby, true), search2[1][1]) + table.remove(MonDKP:GetTable(MonDKP_Standby, true), search2[1][1]) end end end @@ -102,8 +102,8 @@ function AddRaidToDKPTable() end end if tempName and InGuild then - if not MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), tempName) then - tinsert(MonDKP:GetTable(MonDKP_Player_DKPTable, true), { + if not MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), tempName) then + tinsert(MonDKP:GetTable(MonDKP_DKPTable, true), { player=tempName, class=tempClass, dkp=0, @@ -122,9 +122,9 @@ function AddRaidToDKPTable() else addedUsers = addedUsers..", |cff"..c.hex..tempName.."|r" end - if MonDKP:GetTable(MonDKP_Player_Archive, true)[tempName] and MonDKP:GetTable(MonDKP_Player_Archive, true)[tempName].deleted then - MonDKP:GetTable(MonDKP_Player_Archive, true)[tempName].deleted = "Recovered" - MonDKP:GetTable(MonDKP_Player_Archive, true)[tempName].edited = curTime + if MonDKP:GetTable(MonDKP_Archive, true)[tempName] and MonDKP:GetTable(MonDKP_Archive, true)[tempName].deleted then + MonDKP:GetTable(MonDKP_Archive, true)[tempName].deleted = "Recovered" + MonDKP:GetTable(MonDKP_Archive, true)[tempName].edited = curTime FlagRecovery = true end end @@ -158,10 +158,10 @@ local function AddGuildToDKPTable(rank, level) for i=1, guildSize do name,rankName,rankIndex,charLevel,_,_,_,_,_,_,class = GetGuildRosterInfo(i) name = strsub(name, 1, string.find(name, "-")-1) -- required to remove server name from player (can remove in classic if this is not an issue) - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), name) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), name) if not search and (level == nil or charLevel >= level) and (rank == nil or rankIndex == rank) then - tinsert(MonDKP:GetTable(MonDKP_Player_DKPTable, true), { + tinsert(MonDKP:GetTable(MonDKP_DKPTable, true), { player=name, class=class, dkp=0, @@ -180,9 +180,9 @@ local function AddGuildToDKPTable(rank, level) else addedUsers = addedUsers..", |cff"..c.hex..name.."|r" end - if MonDKP:GetTable(MonDKP_Player_Archive, true)[name] and MonDKP:GetTable(MonDKP_Player_Archive, true)[name].deleted then - MonDKP:GetTable(MonDKP_Player_Archive, true)[name].deleted = "Recovered" - MonDKP:GetTable(MonDKP_Player_Archive, true)[name].edited = curTime + if MonDKP:GetTable(MonDKP_Archive, true)[name] and MonDKP:GetTable(MonDKP_Archive, true)[name].deleted then + MonDKP:GetTable(MonDKP_Archive, true)[name].deleted = "Recovered" + MonDKP:GetTable(MonDKP_Archive, true)[name].edited = curTime FlagRecovery = true end end @@ -207,10 +207,10 @@ local function AddTargetToDKPTable() local c; local curTime = time() - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), name) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), name) if not search then - tinsert(MonDKP:GetTable(MonDKP_Player_DKPTable, true), { + tinsert(MonDKP:GetTable(MonDKP_DKPTable, true), { player=name, class=class, dkp=0, @@ -232,9 +232,9 @@ local function AddTargetToDKPTable() else MonDKP:ClassGraph() end - if MonDKP:GetTable(MonDKP_Player_Archive, true)[name] and MonDKP:GetTable(MonDKP_Player_Archive, true)[name].deleted then - MonDKP:GetTable(MonDKP_Player_Archive, true)[name].deleted = "Recovered" - MonDKP:GetTable(MonDKP_Player_Archive, true)[name].edited = curTime + if MonDKP:GetTable(MonDKP_Archive, true)[name] and MonDKP:GetTable(MonDKP_Archive, true)[name].deleted then + MonDKP:GetTable(MonDKP_Archive, true)[name].deleted = "Recovered" + MonDKP:GetTable(MonDKP_Archive, true)[name].edited = curTime MonDKP:Print(L["YOUHAVERECOVERED"]) end end @@ -252,21 +252,21 @@ end function MonDKP:reset_prev_dkp(player) if player then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), player, "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), player, "player") if search then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].previous_dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].previous_dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp end else - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPTable, true) do - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].previous_dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].dkp + for i=1, #MonDKP:GetTable(MonDKP_DKPTable, true) do + MonDKP:GetTable(MonDKP_DKPTable, true)[i].previous_dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[i].dkp end end end local function UpdateWhitelist() if #core.SelectedData > 0 then - table.wipe(MonDKP:GetTable(MonDKP_Player_Whitelist)) + table.wipe(MonDKP:GetTable(MonDKP_Whitelist)) for i=1, #core.SelectedData do local validate = MonDKP:ValidateSender(core.SelectedData[i].player) @@ -284,30 +284,30 @@ local function UpdateWhitelist() end end for i=1, #core.SelectedData do - table.insert(MonDKP:GetTable(MonDKP_Player_Whitelist), core.SelectedData[i].player) + table.insert(MonDKP:GetTable(MonDKP_Whitelist), core.SelectedData[i].player) end - local verifyLeadAdded = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Whitelist), UnitName("player")) + local verifyLeadAdded = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Whitelist), UnitName("player")) if not verifyLeadAdded then local pname = UnitName("player"); - table.insert(MonDKP:GetTable(MonDKP_Player_Whitelist), pname) -- verifies leader is included in white list. Adds if they aren't + table.insert(MonDKP:GetTable(MonDKP_Whitelist), pname) -- verifies leader is included in white list. Adds if they aren't end else - table.wipe(MonDKP:GetTable(MonDKP_Player_Whitelist)) + table.wipe(MonDKP:GetTable(MonDKP_Whitelist)) end - MonDKP.Sync:SendData("MonDKPWhitelist", MonDKP:GetTable(MonDKP_Player_Whitelist)) + MonDKP.Sync:SendData("MonDKPWhitelist", MonDKP:GetTable(MonDKP_Whitelist)) MonDKP:Print(L["WHITELISTBROADCASTED"]) end local function ViewWhitelist() - if #MonDKP:GetTable(MonDKP_Player_Whitelist) > 0 then + if #MonDKP:GetTable(MonDKP_Whitelist) > 0 then core.SelectedData = {} - for i=1, #MonDKP:GetTable(MonDKP_Player_Whitelist) do - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), MonDKP:GetTable(MonDKP_Player_Whitelist)[i]) + for i=1, #MonDKP:GetTable(MonDKP_Whitelist) do + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), MonDKP:GetTable(MonDKP_Whitelist)[i]) if search then - table.insert(core.SelectedData, MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]]) + table.insert(core.SelectedData, MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]]) end end MonDKP:FilterDKPTable(core.currentSort, "reset") @@ -372,10 +372,10 @@ function MonDKP:ManageEntries() local selected = L["CONFIRMREMOVESELECT"]..": \n\n"; for i=1, #core.SelectedData do - local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), core.SelectedData[i].player) + local classSearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), core.SelectedData[i].player) if classSearch then - c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[classSearch[1][1]].class) + c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[classSearch[1][1]].class) else c = { hex="ffffff" } end @@ -588,12 +588,12 @@ function MonDKP:ManageEntries() local count = 0; local i = 1; - while i <= #MonDKP:GetTable(MonDKP_Player_DKPTable, true) do - local search = MonDKP:TableStrFind(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].player, "players") + while i <= #MonDKP:GetTable(MonDKP_DKPTable, true) do + local search = MonDKP:TableStrFind(MonDKP:GetTable(MonDKP_DKPHistory, true), MonDKP:GetTable(MonDKP_DKPTable, true)[i].player, "players") - if MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].dkp == 0 and not search then - c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].class) - name = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].player; + if MonDKP:GetTable(MonDKP_DKPTable, true)[i].dkp == 0 and not search then + c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[i].class) + name = MonDKP:GetTable(MonDKP_DKPTable, true)[i].player; if purgeString == nil then purgeString = "|cff"..c.hex..name.."|r"; @@ -602,7 +602,7 @@ function MonDKP:ManageEntries() end count = count + 1; - table.remove(MonDKP:GetTable(MonDKP_Player_DKPTable, true), i) + table.remove(MonDKP:GetTable(MonDKP_DKPTable, true), i) else i=i+1; end @@ -692,7 +692,7 @@ function MonDKP:ManageEntries() GameTooltip:Hide() end) MonDKP.ConfigTab3.WhitelistContainer.ViewWhitelistButton:SetScript("OnClick", function () -- confirmation dialog to add user(s) - if #MonDKP:GetTable(MonDKP_Player_Whitelist) > 0 then + if #MonDKP:GetTable(MonDKP_Whitelist) > 0 then ViewWhitelist() else StaticPopupDialogs["ADD_GUILD_MEMBERS"] = { @@ -722,7 +722,7 @@ function MonDKP:ManageEntries() GameTooltip:Hide() end) MonDKP.ConfigTab3.WhitelistContainer.SendWhitelistButton:SetScript("OnClick", function () -- confirmation dialog to add user(s) - MonDKP.Sync:SendData("MonDKPWhitelist", MonDKP:GetTable(MonDKP_Player_Whitelist)) + MonDKP.Sync:SendData("MonDKPWhitelist", MonDKP:GetTable(MonDKP_Whitelist)) MonDKP:Print(L["WHITELISTBROADCASTED"]) end); diff --git a/Modules/Modes/DKPModesMain.lua b/Modules/Modes/DKPModesMain.lua index dbfb418e..eee42578 100644 --- a/Modules/Modes/DKPModesMain.lua +++ b/Modules/Modes/DKPModesMain.lua @@ -1006,11 +1006,11 @@ elseif core.DB.modes.mode == "Static Item Values" then MonDKP:Print(L["DKPMODESENTCONF"]) local temptable2 = {} table.insert(temptable2, core.DB.MinBidBySlot) - table.insert(temptable2, MonDKP:GetTable(MonDKP_Player_MinBids, true)) + table.insert(temptable2, MonDKP:GetTable(MonDKP_MinBids, true)) MonDKP.Sync:SendData("MonDKPMinBid", temptable2) local temptable3 = {} table.insert(temptable3, core.DB.MaxBidBySlot) - table.insert(temptable3, MonDKP:GetTable(MonDKP_Player_MaxBids, true)) + table.insert(temptable3, MonDKP:GetTable(MonDKP_MaxBids, true)) MonDKP.Sync:SendData("MonDKPMaxBid", temptable3) end, timeout = 0, diff --git a/Modules/Options.lua b/Modules/Options.lua index 47a0f377..8eafc387 100644 --- a/Modules/Options.lua +++ b/Modules/Options.lua @@ -484,7 +484,7 @@ function MonDKP:Options() OnAccept = function() local temptable = {} table.insert(temptable, core.DB.MinBidBySlot) - table.insert(temptable, MonDKP:GetTable(MonDKP_Player_MinBids, true)) + table.insert(temptable, MonDKP:GetTable(MonDKP_MinBids, true)) MonDKP.Sync:SendData("MonDKPMinBid", temptable) MonDKP:Print(L["MINBIDVALUESSENT"]) end, @@ -723,7 +723,7 @@ function MonDKP:Options() OnAccept = function() local temptable = {} table.insert(temptable, core.DB.MaxBidBySlot) - table.insert(temptable, MonDKP:GetTable(MonDKP_Player_MaxBids, true)) + table.insert(temptable, MonDKP:GetTable(MonDKP_MaxBids, true)) MonDKP.Sync:SendData("MonDKPMaxBid", temptable) MonDKP:Print(L["MAXBIDVALUESSENT"]) end, @@ -1259,23 +1259,23 @@ function MonDKP:Options() button1 = L["YES"], button2 = L["NO"], OnAccept = function() - MonDKP:SetTable(MonDKP_Player_Whitelist, false, nil); - MonDKP:SetTable(MonDKP_Player_DKPTable, true, nil); - MonDKP:SetTable(MonDKP_Player_Loot, true, nil); - MonDKP:SetTable(MonDKP_Player_DKPHistory, true, nil); - MonDKP:SetTable(MonDKP_Player_Archive, true, nil); - MonDKP:SetTable(MonDKP_Player_Standby, true, nil); - MonDKP:SetTable(MonDKP_Player_MinBids, true, nil); - MonDKP:SetTable(MonDKP_Player_MaxBids, true, nil); - - MonDKP:SetTable(MonDKP_Player_DKPTable, true, {}); - MonDKP:SetTable(MonDKP_Player_Loot, true, {}); - MonDKP:SetTable(MonDKP_Player_DKPHistory, true, {}); - MonDKP:SetTable(MonDKP_Player_Archive, true, {}); - MonDKP:SetTable(MonDKP_Player_Whitelist, false, {}); - MonDKP:SetTable(MonDKP_Player_Standby, true, {}); - MonDKP:SetTable(MonDKP_Player_MinBids, true, {}); - MonDKP:SetTable(MonDKP_Player_MaxBids, true, {}); + MonDKP:SetTable(MonDKP_Whitelist, false, nil); + MonDKP:SetTable(MonDKP_DKPTable, true, nil); + MonDKP:SetTable(MonDKP_Loot, true, nil); + MonDKP:SetTable(MonDKP_DKPHistory, true, nil); + MonDKP:SetTable(MonDKP_Archive, true, nil); + MonDKP:SetTable(MonDKP_Standby, true, nil); + MonDKP:SetTable(MonDKP_MinBids, true, nil); + MonDKP:SetTable(MonDKP_MaxBids, true, nil); + + MonDKP:SetTable(MonDKP_DKPTable, true, {}); + MonDKP:SetTable(MonDKP_Loot, true, {}); + MonDKP:SetTable(MonDKP_DKPHistory, true, {}); + MonDKP:SetTable(MonDKP_Archive, true, {}); + MonDKP:SetTable(MonDKP_Whitelist, false, {}); + MonDKP:SetTable(MonDKP_Standby, true, {}); + MonDKP:SetTable(MonDKP_MinBids, true, {}); + MonDKP:SetTable(MonDKP_MaxBids, true, {}); MonDKP:LootHistory_Reset() MonDKP:FilterDKPTable(core.currentSort, "reset") MonDKP:StatusVerify_Update() diff --git a/Modules/RaidTimer.lua b/Modules/RaidTimer.lua index cc6539da..a5527627 100644 --- a/Modules/RaidTimer.lua +++ b/Modules/RaidTimer.lua @@ -33,11 +33,11 @@ function SecondsToClock(seconds) end function MonDKP:AwardPlayer(name, amount) - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), name, "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), name, "player") local path; if search then - path = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]] + path = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]] path.dkp = path.dkp + amount path.lifetime_gained = path.lifetime_gained + amount; end @@ -56,7 +56,7 @@ local function AwardRaid(amount, reason) for i=1, 40 do local tempName, _rank, _subgroup, _level, _class, _fileName, zone, online = GetRaidRosterInfo(i) - local search_DKP = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), tempName) + local search_DKP = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), tempName) local OnlineOnly = core.DB.modes.OnlineOnly local limitToZone = core.DB.modes.SameZoneOnly local isSameZone = zone == GetRealZoneText() @@ -67,15 +67,15 @@ local function AwardRaid(amount, reason) end end - if #MonDKP:GetTable(MonDKP_Player_Standby, true) > 0 and core.DB.DKPBonus.IncStandby then + if #MonDKP:GetTable(MonDKP_Standby, true) > 0 and core.DB.DKPBonus.IncStandby then local i = 1 - while i <= #MonDKP:GetTable(MonDKP_Player_Standby, true) do - if strfind(tempList, MonDKP:GetTable(MonDKP_Player_Standby, true)[i].player) then - table.remove(MonDKP:GetTable(MonDKP_Player_Standby, true), i) + while i <= #MonDKP:GetTable(MonDKP_Standby, true) do + if strfind(tempList, MonDKP:GetTable(MonDKP_Standby, true)[i].player) then + table.remove(MonDKP:GetTable(MonDKP_Standby, true), i) else - MonDKP:AwardPlayer(MonDKP:GetTable(MonDKP_Player_Standby, true)[i].player, amount) - tempList = tempList..MonDKP:GetTable(MonDKP_Player_Standby, true)[i].player..","; + MonDKP:AwardPlayer(MonDKP:GetTable(MonDKP_Standby, true)[i].player, amount) + tempList = tempList..MonDKP:GetTable(MonDKP_Standby, true)[i].player..","; i=i+1 end end @@ -83,14 +83,14 @@ local function AwardRaid(amount, reason) if tempList ~= "" then local newIndex = curOfficer.."-"..curTime - tinsert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), 1, {players=tempList, dkp=amount, reason=reason, date=curTime, index=newIndex}) + tinsert(MonDKP:GetTable(MonDKP_DKPHistory, true), 1, {players=tempList, dkp=amount, reason=reason, date=curTime, index=newIndex}) if MonDKP.ConfigTab6.history and MonDKP.ConfigTab6:IsShown() then MonDKP:DKPHistory_Update(true) end DKPTable_Update() - MonDKP.Sync:SendData("MonDKPDKPDist", MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[1]) + MonDKP.Sync:SendData("MonDKPDKPDist", MonDKP:GetTable(MonDKP_DKPHistory, true)[1]) MonDKP.Sync:SendData("MonDKPBCastMsg", L["RAIDDKPADJUSTBY"].." "..amount.." "..L["FORREASON"]..": "..reason) MonDKP:Print(L["RAIDDKPADJUSTBY"].." "..amount.." "..L["FORREASON"]..": "..reason) diff --git a/Modules/Repair.lua b/Modules/Repair.lua index a097f92f..170ba176 100644 --- a/Modules/Repair.lua +++ b/Modules/Repair.lua @@ -64,11 +64,11 @@ local function ConsolidateTables(keepDKP) local perc = value * 100 DKPString = DKPString.."-"..perc.."%" - local EntrySearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), ConsolidatedTable[i].date, "date") + local EntrySearch = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPHistory, true), ConsolidatedTable[i].date, "date") if EntrySearch then - MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[EntrySearch[1][1]].players = playerString - MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[EntrySearch[1][1]].dkp = DKPString + MonDKP:GetTable(MonDKP_DKPHistory, true)[EntrySearch[1][1]].players = playerString + MonDKP:GetTable(MonDKP_DKPHistory, true)[EntrySearch[1][1]].dkp = DKPString end else local dkp = tonumber(ConsolidatedTable[i].dkp) @@ -97,14 +97,14 @@ local function ConsolidateTables(keepDKP) timer = 0 -- Create new DKPHistory entry compensating for difference between history and DKPTable (if some history was lost due to overwriting) if keepDKP then - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPTable, true) do - local search = MonDKP:Table_Search(DKPTableTemp, MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].player, "player") + for i=1, #MonDKP:GetTable(MonDKP_DKPTable, true) do + local search = MonDKP:Table_Search(DKPTableTemp, MonDKP:GetTable(MonDKP_DKPTable, true)[i].player, "player") if search then - if MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].dkp ~= DKPTableTemp[search[1][1]].dkp then - local val = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].dkp - DKPTableTemp[search[1][1]].dkp + if MonDKP:GetTable(MonDKP_DKPTable, true)[i].dkp ~= DKPTableTemp[search[1][1]].dkp then + local val = MonDKP:GetTable(MonDKP_DKPTable, true)[i].dkp - DKPTableTemp[search[1][1]].dkp val = MonDKP_round(val, core.DB.modes.rounding) - PlayerStringTemp = PlayerStringTemp..MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].player.."," + PlayerStringTemp = PlayerStringTemp..MonDKP:GetTable(MonDKP_DKPTable, true)[i].player.."," DKPStringTemp = DKPStringTemp..val.."," end end @@ -119,37 +119,37 @@ local function ConsolidateTables(keepDKP) reason = "Migration Correction", hidden = true, } - table.insert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), insert) + table.insert(MonDKP:GetTable(MonDKP_DKPHistory, true), insert) end else - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPTable, true) do - local search = MonDKP:Table_Search(DKPTableTemp, MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].player, "player") + for i=1, #MonDKP:GetTable(MonDKP_DKPTable, true) do + local search = MonDKP:Table_Search(DKPTableTemp, MonDKP:GetTable(MonDKP_DKPTable, true)[i].player, "player") if search then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].dkp = DKPTableTemp[search[1][1]].dkp - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].lifetime_spent = DKPTableTemp[search[1][1]].lifetime_spent - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].lifetime_gained = DKPTableTemp[search[1][1]].lifetime_gained + MonDKP:GetTable(MonDKP_DKPTable, true)[i].dkp = DKPTableTemp[search[1][1]].dkp + MonDKP:GetTable(MonDKP_DKPTable, true)[i].lifetime_spent = DKPTableTemp[search[1][1]].lifetime_spent + MonDKP:GetTable(MonDKP_DKPTable, true)[i].lifetime_gained = DKPTableTemp[search[1][1]].lifetime_gained end end end local curTime = time(); for i=1, #DKPTableTemp do -- finds who had history but was deleted; adds them to archive if so - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), DKPTableTemp[i].player) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), DKPTableTemp[i].player) if not search then MonDKP_Archive[DKPTableTemp[i].player] = { dkp=0, lifetime_spent=0, lifetime_gained=0, deleted=true, edited=curTime } end end - table.sort(MonDKP:GetTable(MonDKP_Player_Loot, true), function(a,b) + table.sort(MonDKP:GetTable(MonDKP_Loot, true), function(a,b) return a["date"] > b["date"] end) - table.sort(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), function(a,b) + table.sort(MonDKP:GetTable(MonDKP_DKPHistory, true), function(a,b) return a["date"] > b["date"] end) - MonDKP:GetTable(MonDKP_Player_DKPHistory, true).seed = MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[1].index; - MonDKP:GetTable(MonDKP_Player_Loot, true).seed = MonDKP:GetTable(MonDKP_Player_Loot, true)[1].index + MonDKP:GetTable(MonDKP_DKPHistory, true).seed = MonDKP:GetTable(MonDKP_DKPHistory, true)[1].index; + MonDKP:GetTable(MonDKP_Loot, true).seed = MonDKP:GetTable(MonDKP_Loot, true)[1].index MonDKP:FilterDKPTable(core.currentSort, "reset") ValInProgress = false MonDKP:Print(L["REPAIRCOMP"]) @@ -167,30 +167,30 @@ local function RepairDKPHistory(keepDKP) local ValidateTimer = ValidateTimer or CreateFrame("StatusBar", nil, UIParent) ValidateTimer:SetScript("OnUpdate", function(self, elapsed) timer = timer + elapsed - if timer > 0.01 and i <= #MonDKP:GetTable(MonDKP_Player_DKPHistory, true) and not processing then + if timer > 0.01 and i <= #MonDKP:GetTable(MonDKP_DKPHistory, true) and not processing then processing = true -- delete duplicate entries and correct DKP (DKPHistory table) - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].date, "date") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPHistory, true), MonDKP:GetTable(MonDKP_DKPHistory, true)[i].date, "date") - if MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].deletes or MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].deletedby or MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].reason == "Migration Correction" then -- removes deleted entries/Migration Correction - table.remove(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), i) + if MonDKP:GetTable(MonDKP_DKPHistory, true)[i].deletes or MonDKP:GetTable(MonDKP_DKPHistory, true)[i].deletedby or MonDKP:GetTable(MonDKP_DKPHistory, true)[i].reason == "Migration Correction" then -- removes deleted entries/Migration Correction + table.remove(MonDKP:GetTable(MonDKP_DKPHistory, true), i) elseif #search > 1 then -- removes duplicate entries for j=2, #search do - table.remove(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), search[j][1]) + table.remove(MonDKP:GetTable(MonDKP_DKPHistory, true), search[j][1]) deleted_entries = deleted_entries + 1 end else - local curTime = MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].date - MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].index = officer.."-"..curTime - if not strfind(MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].dkp, "%-%d*%.?%d+%%") then - MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].dkp = tonumber(MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].dkp) + local curTime = MonDKP:GetTable(MonDKP_DKPHistory, true)[i].date + MonDKP:GetTable(MonDKP_DKPHistory, true)[i].index = officer.."-"..curTime + if not strfind(MonDKP:GetTable(MonDKP_DKPHistory, true)[i].dkp, "%-%d*%.?%d+%%") then + MonDKP:GetTable(MonDKP_DKPHistory, true)[i].dkp = tonumber(MonDKP:GetTable(MonDKP_DKPHistory, true)[i].dkp) end - table.insert(ConsolidatedTable, MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i]) + table.insert(ConsolidatedTable, MonDKP:GetTable(MonDKP_DKPHistory, true)[i]) i=i+1 end processing = false timer = 0 - elseif i > #MonDKP:GetTable(MonDKP_Player_DKPHistory, true) then + elseif i > #MonDKP:GetTable(MonDKP_DKPHistory, true) then ValidateTimer:SetScript("OnUpdate", nil) timer = 0 ConsolidateTables(keepDKP) @@ -221,30 +221,30 @@ function MonDKP:RepairTables(keepDKP) -- Repair starts local ValidateTimer = ValidateTimer or CreateFrame("StatusBar", nil, UIParent) ValidateTimer:SetScript("OnUpdate", function(self, elapsed) timer = timer + elapsed - if timer > 0.01 and i <= #MonDKP:GetTable(MonDKP_Player_Loot, true) and not processing then + if timer > 0.01 and i <= #MonDKP:GetTable(MonDKP_Loot, true) and not processing then processing = true - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), MonDKP:GetTable(MonDKP_Player_Loot, true)[i].date, "date") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), MonDKP:GetTable(MonDKP_Loot, true)[i].date, "date") - if MonDKP:GetTable(MonDKP_Player_Loot, true)[i].deletedby or MonDKP:GetTable(MonDKP_Player_Loot, true)[i].deletes then - table.remove(MonDKP:GetTable(MonDKP_Player_Loot, true), i) + if MonDKP:GetTable(MonDKP_Loot, true)[i].deletedby or MonDKP:GetTable(MonDKP_Loot, true)[i].deletes then + table.remove(MonDKP:GetTable(MonDKP_Loot, true), i) elseif search and #search > 1 then for j=2, #search do - if MonDKP:GetTable(MonDKP_Player_Loot, true)[search[j][1]].loot == MonDKP:GetTable(MonDKP_Player_Loot, true)[i].loot then - table.remove(MonDKP:GetTable(MonDKP_Player_Loot, true), search[j][1]) + if MonDKP:GetTable(MonDKP_Loot, true)[search[j][1]].loot == MonDKP:GetTable(MonDKP_Loot, true)[i].loot then + table.remove(MonDKP:GetTable(MonDKP_Loot, true), search[j][1]) end end else - local curTime = MonDKP:GetTable(MonDKP_Player_Loot, true)[i].date - MonDKP:GetTable(MonDKP_Player_Loot, true)[i].index = officer.."-"..curTime - if tonumber(MonDKP:GetTable(MonDKP_Player_Loot, true)[i].cost) > 0 then - MonDKP:GetTable(MonDKP_Player_Loot, true)[i].cost = tonumber(MonDKP:GetTable(MonDKP_Player_Loot, true)[i].cost) * -1 + local curTime = MonDKP:GetTable(MonDKP_Loot, true)[i].date + MonDKP:GetTable(MonDKP_Loot, true)[i].index = officer.."-"..curTime + if tonumber(MonDKP:GetTable(MonDKP_Loot, true)[i].cost) > 0 then + MonDKP:GetTable(MonDKP_Loot, true)[i].cost = tonumber(MonDKP:GetTable(MonDKP_Loot, true)[i].cost) * -1 end - table.insert(ConsolidatedTable, MonDKP:GetTable(MonDKP_Player_Loot, true)[i]) + table.insert(ConsolidatedTable, MonDKP:GetTable(MonDKP_Loot, true)[i]) i=i+1 end processing = false timer = 0 - elseif i > #MonDKP:GetTable(MonDKP_Player_Loot, true) then + elseif i > #MonDKP:GetTable(MonDKP_Loot, true) then ValidateTimer:SetScript("OnUpdate", nil) timer = 0 RepairDKPHistory(keepDKP) diff --git a/Modules/Standby.lua b/Modules/Standby.lua index 35eeec24..4c2057dd 100644 --- a/Modules/Standby.lua +++ b/Modules/Standby.lua @@ -15,7 +15,7 @@ end function MonDKP_Standby_Announce(bossName) core.StandbyActive = true; -- activates opt in - table.wipe(MonDKP:GetTable(MonDKP_Player_Standby, true)); + table.wipe(MonDKP:GetTable(MonDKP_Standby, true)); if MonDKP:CheckRaidLeader() then SendChatMessage(bossName..L["STANDBYOPTINBEGIN"], "GUILD") -- only raid leader announces end @@ -46,11 +46,11 @@ function MonDKP_Standby_Handler(text, ...) if cmd and cmd:gsub("%s+", "") ~= "nil" and cmd:gsub("%s+", "") ~= "" then -- if it's !standby *name* cmd = cmd:gsub("%s+", "") -- removes unintended spaces from string - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), cmd) - local verify = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Standby, true), cmd) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), cmd) + local verify = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Standby, true), cmd) if search and not verify then - table.insert(MonDKP:GetTable(MonDKP_Player_Standby, true), MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]]) + table.insert(MonDKP:GetTable(MonDKP_Standby, true), MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]]) response = "MonolithDKP: "..cmd.." "..L["STANDBYWHISPERRESP1"] elseif search and verify then response = "MonolithDKP: "..cmd.." "..L["STANDBYWHISPERRESP2"] @@ -59,11 +59,11 @@ function MonDKP_Standby_Handler(text, ...) end else -- if it's just !standby - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), name) - local verify = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Standby, true), name) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), name) + local verify = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Standby, true), name) if search and not verify then - table.insert(MonDKP:GetTable(MonDKP_Player_Standby, true), MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]]) + table.insert(MonDKP:GetTable(MonDKP_Standby, true), MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]]) response = "MonolithDKP: "..L["STANDBYWHISPERRESP4"] elseif search and verify then response = "MonolithDKP: "..L["STANDBYWHISPERRESP5"] diff --git a/Modules/Sync.lua b/Modules/Sync.lua index 873c70cd..55b7a4a9 100644 --- a/Modules/Sync.lua +++ b/Modules/Sync.lua @@ -20,7 +20,7 @@ function MonDKP_Profile_Create(player, dkp, gained, spent) tempName = strsub(tempName, 1, string.find(tempName, "-")-1) -- required to remove server name from player (can remove in classic if this is not an issue) if tempName == player then class = tempClass - table.insert(MonDKP:GetTable(MonDKP_Player_DKPTable, true), { player=player, lifetime_spent=spent, lifetime_gained=gained, class=class, dkp=dkp, rank=10, spec=L["NOSPECREPORTED"], role=L["NOROLEDETECTED"], rankName="None", previous_dkp=0, }) + table.insert(MonDKP:GetTable(MonDKP_DKPTable, true), { player=player, lifetime_spent=spent, lifetime_gained=gained, class=class, dkp=dkp, rank=10, spec=L["NOSPECREPORTED"], role=L["NOROLEDETECTED"], rankName="None", previous_dkp=0, }) MonDKP:FilterDKPTable(core.currentSort, "reset") MonDKP:ClassGraph_Update() @@ -41,8 +41,8 @@ function MonDKP_Profile_Create(player, dkp, gained, spent) for i=1, GroupSize do tempName,_,_,_,_,tempClass = GetRaidRosterInfo(i) if tempName == player then - if not MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), tempName, "player") then - tinsert(MonDKP:GetTable(MonDKP_Player_DKPTable, true), { player=player, class=tempClass, dkp=dkp, previous_dkp=0, lifetime_gained=gained, lifetime_spent=spent, rank=10, rankName="None", spec=L["NOSPECREPORTED"], role=L["NOROLEDETECTED"], }) + if not MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), tempName, "player") then + tinsert(MonDKP:GetTable(MonDKP_DKPTable, true), { player=player, class=tempClass, dkp=dkp, previous_dkp=0, lifetime_gained=gained, lifetime_spent=spent, rank=10, rankName="None", spec=L["NOSPECREPORTED"], role=L["NOROLEDETECTED"], }) MonDKP:FilterDKPTable(core.currentSort, "reset") MonDKP:ClassGraph_Update() created = true @@ -53,7 +53,7 @@ function MonDKP_Profile_Create(player, dkp, gained, spent) end if not created then - tinsert(MonDKP:GetTable(MonDKP_Player_DKPTable, true), { player=player, class=class, dkp=dkp, previous_dkp=0, lifetime_gained=gained, lifetime_spent=spent, rank=10, rankName="None", spec=L["NOSPECREPORTED"], role=L["NOROLEDETECTED"], }) + tinsert(MonDKP:GetTable(MonDKP_DKPTable, true), { player=player, class=class, dkp=dkp, previous_dkp=0, lifetime_gained=gained, lifetime_spent=spent, rank=10, rankName="None", spec=L["NOSPECREPORTED"], role=L["NOROLEDETECTED"], }) end return created @@ -217,7 +217,7 @@ function MonDKP_BroadcastFull_Init() return end if core.Broadcast.fullCheckbox:GetChecked() == true then - tempTable = { DKPTable=MonDKP:GetTable(MonDKP_Player_DKPTable, true), DKP=MonDKP:GetTable(MonDKP_Player_DKPHistory, true), Loot=MonDKP:GetTable(MonDKP_Player_Loot, true), Archive=MonDKP:GetTable(MonDKP_Player_Archive, true), MinBids=MonDKP:GetTable(MonDKP_Player_MinBids, true) } + tempTable = { DKPTable=MonDKP:GetTable(MonDKP_DKPTable, true), DKP=MonDKP:GetTable(MonDKP_DKPHistory, true), Loot=MonDKP:GetTable(MonDKP_Loot, true), Archive=MonDKP:GetTable(MonDKP_Archive, true), MinBids=MonDKP:GetTable(MonDKP_MinBids, true) } elseif core.Broadcast.mergeCheckbox:GetChecked() == true then tempTable = MonDKP_MergeTable_Create() end @@ -235,8 +235,8 @@ function MonDKP_BroadcastFull_Init() OnAccept = function() MonDKP.Sync:SendData("MonDKPAllTabs", tempTable, player) core.Broadcast:Hide() - MonDKP:GetTable(MonDKP_Player_DKPHistory, true).seed = 0 - MonDKP:GetTable(MonDKP_Player_Loot, true).seed = 0 + MonDKP:GetTable(MonDKP_DKPHistory, true).seed = 0 + MonDKP:GetTable(MonDKP_Loot, true).seed = 0 MonDKP_BroadcastFull_Status() end, timeout = 0, @@ -260,8 +260,8 @@ function MonDKP_BroadcastFull_Init() OnAccept = function() MonDKP.Sync:SendData("MonDKPAllTabs", tempTable, player) core.Broadcast:Hide() - MonDKP:GetTable(MonDKP_Player_DKPHistory, true).seed = 0 - MonDKP:GetTable(MonDKP_Player_Loot, true).seed = 0 + MonDKP:GetTable(MonDKP_DKPHistory, true).seed = 0 + MonDKP:GetTable(MonDKP_Loot, true).seed = 0 MonDKP_BroadcastFull_Status() end, timeout = 0, @@ -461,8 +461,8 @@ end function MonDKP_SyncDeleted() local deleted = {} - for k,v in pairs(MonDKP:GetTable(MonDKP_Player_Archive, true)) do - if MonDKP:GetTable(MonDKP_Player_Archive, true)[k].deleted then + for k,v in pairs(MonDKP:GetTable(MonDKP_Archive, true)) do + if MonDKP:GetTable(MonDKP_Archive, true)[k].deleted then table.insert(deleted, { player=k, deleted=v.deleted, edited=v.edited }) end end @@ -477,24 +477,24 @@ function MonDKP_MergeTable_Create() local tempLoot = {} local profiles = {} - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPHistory, true) do - if MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].date > (time() - 1209600) and MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i].date > core.DB.defaults.installed210 then - table.insert(tempDKP, MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[i]) + for i=1, #MonDKP:GetTable(MonDKP_DKPHistory, true) do + if MonDKP:GetTable(MonDKP_DKPHistory, true)[i].date > (time() - 1209600) and MonDKP:GetTable(MonDKP_DKPHistory, true)[i].date > core.DB.defaults.installed210 then + table.insert(tempDKP, MonDKP:GetTable(MonDKP_DKPHistory, true)[i]) else break end end - for i=1, #MonDKP:GetTable(MonDKP_Player_Loot, true) do - if MonDKP:GetTable(MonDKP_Player_Loot, true)[i].date > (time() - 1209600) and MonDKP:GetTable(MonDKP_Player_Loot, true)[i].date > core.DB.defaults.installed210 then - table.insert(tempLoot, MonDKP:GetTable(MonDKP_Player_Loot, true)[i]) + for i=1, #MonDKP:GetTable(MonDKP_Loot, true) do + if MonDKP:GetTable(MonDKP_Loot, true)[i].date > (time() - 1209600) and MonDKP:GetTable(MonDKP_Loot, true)[i].date > core.DB.defaults.installed210 then + table.insert(tempLoot, MonDKP:GetTable(MonDKP_Loot, true)[i]) else break end end - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPTable, true) do - table.insert(profiles, { player=MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].player, class=MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].class }) + for i=1, #MonDKP:GetTable(MonDKP_DKPTable, true) do + table.insert(profiles, { player=MonDKP:GetTable(MonDKP_DKPTable, true)[i].player, class=MonDKP:GetTable(MonDKP_DKPTable, true)[i].class }) end local tempTable = { DKP=tempDKP, Loot=tempLoot, Profiles=profiles } diff --git a/Modules/Validate.lua b/Modules/Validate.lua index 00bcbf1f..ad8347c5 100644 --- a/Modules/Validate.lua +++ b/Modules/Validate.lua @@ -42,20 +42,20 @@ function MonDKP:ValidateDKPTable_Loot() local ValidateTimer = ValidateTimer or CreateFrame("StatusBar", nil, UIParent) ValidateTimer:SetScript("OnUpdate", function(self, elapsed) timer = timer + elapsed - if timer > 0.01 and i <= #MonDKP:GetTable(MonDKP_Player_Loot, true) and not processing then + if timer > 0.01 and i <= #MonDKP:GetTable(MonDKP_Loot, true) and not processing then processing = true - local search = MonDKP:Table_Search(DKPTableTemp, MonDKP:GetTable(MonDKP_Player_Loot, true)[i].player, "player") + local search = MonDKP:Table_Search(DKPTableTemp, MonDKP:GetTable(MonDKP_Loot, true)[i].player, "player") if search then - DKPTableTemp[search[1][1]].dkp = DKPTableTemp[search[1][1]].dkp + tonumber(MonDKP:GetTable(MonDKP_Player_Loot, true)[i].cost) - DKPTableTemp[search[1][1]].lifetime_spent = DKPTableTemp[search[1][1]].lifetime_spent + tonumber(MonDKP:GetTable(MonDKP_Player_Loot, true)[i].cost) + DKPTableTemp[search[1][1]].dkp = DKPTableTemp[search[1][1]].dkp + tonumber(MonDKP:GetTable(MonDKP_Loot, true)[i].cost) + DKPTableTemp[search[1][1]].lifetime_spent = DKPTableTemp[search[1][1]].lifetime_spent + tonumber(MonDKP:GetTable(MonDKP_Loot, true)[i].cost) else - table.insert(DKPTableTemp, { player=MonDKP:GetTable(MonDKP_Player_Loot, true)[i].player, dkp=tonumber(MonDKP:GetTable(MonDKP_Player_Loot, true)[i].cost), lifetime_gained=0, lifetime_spent=tonumber(MonDKP:GetTable(MonDKP_Player_Loot, true)[i].cost) }) + table.insert(DKPTableTemp, { player=MonDKP:GetTable(MonDKP_Loot, true)[i].player, dkp=tonumber(MonDKP:GetTable(MonDKP_Loot, true)[i].cost), lifetime_gained=0, lifetime_spent=tonumber(MonDKP:GetTable(MonDKP_Loot, true)[i].cost) }) end processing = false i=i+1 timer = 0 - elseif i > #MonDKP:GetTable(MonDKP_Player_Loot, true) then + elseif i > #MonDKP:GetTable(MonDKP_Loot, true) then ValidateTimer:SetScript("OnUpdate", nil) timer = 0 MonDKP:ValidateDKPTable_DKP() @@ -75,12 +75,12 @@ function MonDKP:ValidateDKPTable_DKP() local ValidateTimer = ValidateTimer or CreateFrame("StatusBar", nil, UIParent) ValidateTimer:SetScript("OnUpdate", function(self, elapsed) timer = timer + elapsed - if timer > 0.0001 and i <= #MonDKP:GetTable(MonDKP_Player_History, true) and not processing and not pause then + if timer > 0.0001 and i <= #MonDKP:GetTable(MonDKP_History, true) and not processing and not pause then processing = true pause = true - local players = {strsplit(",", strsub(MonDKP:GetTable(MonDKP_Player_History, true)[i].players, 1, -2))} - local dkp = {strsplit(",", MonDKP:GetTable(MonDKP_Player_History, true)[i].dkp)} + local players = {strsplit(",", strsub(MonDKP:GetTable(MonDKP_History, true)[i].players, 1, -2))} + local dkp = {strsplit(",", MonDKP:GetTable(MonDKP_History, true)[i].dkp)} if #dkp == 1 then for i=1, #players do @@ -102,11 +102,11 @@ function MonDKP:ValidateDKPTable_DKP() if search then DKPTableTemp[search[1][1]].dkp = DKPTableTemp[search[1][1]].dkp + tonumber(dkp[j]) - if ((tonumber(dkp[j]) > 0 and not MonDKP:GetTable(MonDKP_Player_History, true)[i].deletes) or (tonumber(dkp[j]) < 0 and MonDKP:GetTable(MonDKP_Player_History, true)[i].deletes)) and not strfind(MonDKP:GetTable(MonDKP_Player_History, true)[i].dkp, "%-%d*%.?%d+%%") then + if ((tonumber(dkp[j]) > 0 and not MonDKP:GetTable(MonDKP_History, true)[i].deletes) or (tonumber(dkp[j]) < 0 and MonDKP:GetTable(MonDKP_History, true)[i].deletes)) and not strfind(MonDKP:GetTable(MonDKP_History, true)[i].dkp, "%-%d*%.?%d+%%") then DKPTableTemp[search[1][1]].lifetime_gained = DKPTableTemp[search[1][1]].lifetime_gained + tonumber(dkp[j]) end else - if ((tonumber(dkp[j]) > 0 and not MonDKP:GetTable(MonDKP_Player_History, true)[i].deletes) or (tonumber(dkp[j]) < 0 and MonDKP:GetTable(MonDKP_Player_History, true)[i].deletes)) and not strfind(MonDKP:GetTable(MonDKP_Player_History, true)[i].dkp, "%-%d*%.?%d+%%") then + if ((tonumber(dkp[j]) > 0 and not MonDKP:GetTable(MonDKP_History, true)[i].deletes) or (tonumber(dkp[j]) < 0 and MonDKP:GetTable(MonDKP_History, true)[i].deletes)) and not strfind(MonDKP:GetTable(MonDKP_History, true)[i].dkp, "%-%d*%.?%d+%%") then table.insert(DKPTableTemp, { player=players[j], dkp=tonumber(dkp[j]), lifetime_gained=tonumber(dkp[j]), lifetime_spent=0 }) else table.insert(DKPTableTemp, { player=players[j], dkp=tonumber(dkp[j]), lifetime_gained=0, lifetime_spent=0 }) @@ -124,7 +124,7 @@ function MonDKP:ValidateDKPTable_DKP() timer = 0 end end) - elseif i > #MonDKP:GetTable(MonDKP_Player_History, true) and not processing and not proc2 and not pause then + elseif i > #MonDKP:GetTable(MonDKP_History, true) and not processing and not proc2 and not pause then ValidateTimer:SetScript("OnUpdate", nil) timer = 0 MonDKP:ValidateDKPTable_Final() @@ -145,7 +145,7 @@ function MonDKP:ValidateDKPTable_Final() if timer > 0.1 and i <= #DKPTableTemp and not processing then processing = true local flag = false - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), DKPTableTemp[i].player, "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), DKPTableTemp[i].player, "player") if search then if MonDKP_Archive[DKPTableTemp[i].player] then @@ -153,16 +153,16 @@ function MonDKP:ValidateDKPTable_Final() DKPTableTemp[i].lifetime_gained = DKPTableTemp[i].lifetime_gained + tonumber(MonDKP_Archive[DKPTableTemp[i].player].lifetime_gained) DKPTableTemp[i].lifetime_spent = DKPTableTemp[i].lifetime_spent + tonumber(MonDKP_Archive[DKPTableTemp[i].player].lifetime_spent) end - if tonumber(DKPTableTemp[i].dkp) ~= MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp = tonumber(DKPTableTemp[i].dkp) + if tonumber(DKPTableTemp[i].dkp) ~= MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp then + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp = tonumber(DKPTableTemp[i].dkp) flag = true end - if tonumber(DKPTableTemp[i].lifetime_gained) ~= MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].lifetime_gained then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].lifetime_gained = tonumber(DKPTableTemp[i].lifetime_gained) + if tonumber(DKPTableTemp[i].lifetime_gained) ~= MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].lifetime_gained then + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].lifetime_gained = tonumber(DKPTableTemp[i].lifetime_gained) flag = true end - if tonumber(DKPTableTemp[i].lifetime_spent) ~= MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].lifetime_spent then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].lifetime_spent = tonumber(DKPTableTemp[i].lifetime_spent) + if tonumber(DKPTableTemp[i].lifetime_spent) ~= MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].lifetime_spent then + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].lifetime_spent = tonumber(DKPTableTemp[i].lifetime_spent) flag = true end end @@ -194,22 +194,22 @@ function MonDKP:ValidateDKPHistory() local ValidateTimer = ValidateTimer or CreateFrame("StatusBar", nil, UIParent) ValidateTimer:SetScript("OnUpdate", function(self, elapsed) timer = timer + elapsed - if timer > 0.01 and i <= #MonDKP:GetTable(MonDKP_Player_History, true) and not processing then + if timer > 0.01 and i <= #MonDKP:GetTable(MonDKP_History, true) and not processing then processing = true -- delete duplicate entries and correct DKP (DKPHistory table) - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_History, true), MonDKP:GetTable(MonDKP_Player_History, true)[i].index, "index") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_History, true), MonDKP:GetTable(MonDKP_History, true)[i].index, "index") - if MonDKP:GetTable(MonDKP_Player_History, true)[i].deletes then -- adds deltedby index to field if it was received after a delete entry was received but was sent by someone that did not have the delete entry - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_History, true), MonDKP:GetTable(MonDKP_Player_History, true)[i].deletes, "index") + if MonDKP:GetTable(MonDKP_History, true)[i].deletes then -- adds deltedby index to field if it was received after a delete entry was received but was sent by someone that did not have the delete entry + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_History, true), MonDKP:GetTable(MonDKP_History, true)[i].deletes, "index") - if search and not MonDKP:GetTable(MonDKP_Player_History, true)[search[1][1]].deletedby then - MonDKP:GetTable(MonDKP_Player_History, true)[search[1][1]].deletedby = MonDKP:GetTable(MonDKP_Player_History, true)[i].index + if search and not MonDKP:GetTable(MonDKP_History, true)[search[1][1]].deletedby then + MonDKP:GetTable(MonDKP_History, true)[search[1][1]].deletedby = MonDKP:GetTable(MonDKP_History, true)[i].index end end if #search > 1 then for j=2, #search do - table.remove(MonDKP:GetTable(MonDKP_Player_History, true), search[j][1]) + table.remove(MonDKP:GetTable(MonDKP_History, true), search[j][1]) deleted_entries = deleted_entries + 1 end else @@ -218,7 +218,7 @@ function MonDKP:ValidateDKPHistory() processing = false timer = 0 - elseif i > #MonDKP:GetTable(MonDKP_Player_History, true) then + elseif i > #MonDKP:GetTable(MonDKP_History, true) then ValidateTimer:SetScript("OnUpdate", nil) timer = 0 MonDKP:ValidateDKPTable_Loot() @@ -242,13 +242,13 @@ function MonDKP:ValidateLootTable() -- validation starts here local ValidateTimer = ValidateTimer or CreateFrame("StatusBar", nil, UIParent) ValidateTimer:SetScript("OnUpdate", function(self, elapsed) timer = timer + elapsed - if timer > 0.01 and i <= #MonDKP:GetTable(MonDKP_Player_Loot, true) and not processing then + if timer > 0.01 and i <= #MonDKP:GetTable(MonDKP_Loot, true) and not processing then processing = true - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), MonDKP:GetTable(MonDKP_Player_Loot, true)[i].index, "index") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), MonDKP:GetTable(MonDKP_Loot, true)[i].index, "index") if search and #search > 1 then for j=2, #search do - table.remove(MonDKP:GetTable(MonDKP_Player_Loot, true), search[j][1]) + table.remove(MonDKP:GetTable(MonDKP_Loot, true), search[j][1]) deleted_entries = deleted_entries + 1 end else @@ -256,7 +256,7 @@ function MonDKP:ValidateLootTable() -- validation starts here end processing = false timer = 0 - elseif i > #MonDKP:GetTable(MonDKP_Player_Loot, true) then + elseif i > #MonDKP:GetTable(MonDKP_Loot, true) then ValidateTimer:SetScript("OnUpdate", nil) timer = 0 MonDKP:ValidateDKPHistory() @@ -278,28 +278,28 @@ function MonDKP_ReindexTables() end i=1 - while i <= #MonDKP:GetTable(MonDKP_Player_History, true) do - if MonDKP:GetTable(MonDKP_Player_History, true)[i].deletes or MonDKP:GetTable(MonDKP_Player_History, true)[i].deletedby or MonDKP:GetTable(MonDKP_Player_History, true)[i].reason == "Migration Correction" then - table.remove(MonDKP:GetTable(MonDKP_Player_History, true), i) + while i <= #MonDKP:GetTable(MonDKP_History, true) do + if MonDKP:GetTable(MonDKP_History, true)[i].deletes or MonDKP:GetTable(MonDKP_History, true)[i].deletedby or MonDKP:GetTable(MonDKP_History, true)[i].reason == "Migration Correction" then + table.remove(MonDKP:GetTable(MonDKP_History, true), i) else - if (MonDKP_DB.defaults.installed and MonDKP:GetTable(MonDKP_Player_History, true)[i].date < MonDKP_DB.defaults.installed) or (not MonDKP_DB.defaults.installed and MonDKP:GetTable(MonDKP_Player_History, true)[i].date < MonDKP_DB.defaults.installed210) then - MonDKP:GetTable(MonDKP_Player_History, true)[i].index = GM.."-"..MonDKP:GetTable(MonDKP_Player_History, true)[i].date -- reindexes under GMs name if the entry was created prior to 2.1 (for uniformity) + if (MonDKP_DB.defaults.installed and MonDKP:GetTable(MonDKP_History, true)[i].date < MonDKP_DB.defaults.installed) or (not MonDKP_DB.defaults.installed and MonDKP:GetTable(MonDKP_History, true)[i].date < MonDKP_DB.defaults.installed210) then + MonDKP:GetTable(MonDKP_History, true)[i].index = GM.."-"..MonDKP:GetTable(MonDKP_History, true)[i].date -- reindexes under GMs name if the entry was created prior to 2.1 (for uniformity) end i=i+1 end end i=1 - while i <= #MonDKP:GetTable(MonDKP_Player_Loot, true) do - if MonDKP:GetTable(MonDKP_Player_Loot, true)[i].deletes or MonDKP:GetTable(MonDKP_Player_Loot, true)[i].deletedby then - table.remove(MonDKP:GetTable(MonDKP_Player_Loot, true), i) + while i <= #MonDKP:GetTable(MonDKP_Loot, true) do + if MonDKP:GetTable(MonDKP_Loot, true)[i].deletes or MonDKP:GetTable(MonDKP_Loot, true)[i].deletedby then + table.remove(MonDKP:GetTable(MonDKP_Loot, true), i) else - if (MonDKP_DB.defaults.installed and MonDKP:GetTable(MonDKP_Player_Loot, true)[i].date < MonDKP_DB.defaults.installed) or (not MonDKP_DB.defaults.installed and MonDKP:GetTable(MonDKP_Player_Loot, true)[i].date < MonDKP_DB.defaults.installed210) then - MonDKP:GetTable(MonDKP_Player_Loot, true)[i].index = GM.."-"..MonDKP:GetTable(MonDKP_Player_Loot, true)[i].date -- reindexes under GMs name if the entry was created prior to 2.1 (for uniformity) + if (MonDKP_DB.defaults.installed and MonDKP:GetTable(MonDKP_Loot, true)[i].date < MonDKP_DB.defaults.installed) or (not MonDKP_DB.defaults.installed and MonDKP:GetTable(MonDKP_Loot, true)[i].date < MonDKP_DB.defaults.installed210) then + MonDKP:GetTable(MonDKP_Loot, true)[i].index = GM.."-"..MonDKP:GetTable(MonDKP_Loot, true)[i].date -- reindexes under GMs name if the entry was created prior to 2.1 (for uniformity) end i=i+1 end end - MonDKP:GetTable(MonDKP_Player_History, true).seed = 0 - MonDKP:GetTable(MonDKP_Player_Loot, true).seed = 0 + MonDKP:GetTable(MonDKP_History, true).seed = 0 + MonDKP:GetTable(MonDKP_Loot, true).seed = 0 end \ No newline at end of file diff --git a/Modules/ZeroSumBank.lua b/Modules/ZeroSumBank.lua index 374c3a17..3de03c7f 100644 --- a/Modules/ZeroSumBank.lua +++ b/Modules/ZeroSumBank.lua @@ -13,15 +13,15 @@ local function ZeroSumDistribution() local curOfficer = UnitName("player") if core.DB.modes.ZeroSumStandby then - for i=1, #MonDKP:GetTable(MonDKP_Player_Standby, true) do - tinsert(VerifyTable, MonDKP:GetTable(MonDKP_Player_Standby, true)[i].player) + for i=1, #MonDKP:GetTable(MonDKP_Standby, true) do + tinsert(VerifyTable, MonDKP:GetTable(MonDKP_Standby, true)[i].player) end end for i=1, 40 do local tempName, _rank, _subgroup, _level, _class, _fileName, zone, online = GetRaidRosterInfo(i) local search = MonDKP:Table_Search(VerifyTable, tempName) - local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), tempName) + local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), tempName) local OnlineOnly = core.DB.modes.OnlineOnly local limitToZone = core.DB.modes.SameZoneOnly local isSameZone = zone == GetRealZoneText() @@ -36,21 +36,21 @@ local function ZeroSumDistribution() for i=1, #VerifyTable do local name = VerifyTable[i] - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), name) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), name) if search then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp + distribution + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp + distribution players = players..name.."," end end local newIndex = curOfficer.."-"..curTime - tinsert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), 1, {players=players, dkp=distribution, reason=reason, date=curTime, index=newIndex}) + tinsert(MonDKP:GetTable(MonDKP_DKPHistory, true), 1, {players=players, dkp=distribution, reason=reason, date=curTime, index=newIndex}) if MonDKP.ConfigTab6.history then MonDKP:DKPHistory_Update(true) end - MonDKP.Sync:SendData("MonDKPDKPDist", MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[1]) + MonDKP.Sync:SendData("MonDKPDKPDist", MonDKP:GetTable(MonDKP_DKPHistory, true)[1]) MonDKP.Sync:SendData("MonDKPBCastMsg", L["RAIDDKPADJUSTBY"].." "..distribution.." "..L["AMONG"].." "..#VerifyTable.." "..L["PLAYERSFORREASON"]..": "..reason) MonDKP:Print("Raid DKP Adjusted by "..distribution.." "..L["AMONG"].." "..#VerifyTable.." "..L["PLAYERSFORREASON"]..": "..reason) diff --git a/Modules/comm.lua b/Modules/comm.lua index e1612d2d..6e9cf2ab 100644 --- a/Modules/comm.lua +++ b/Modules/comm.lua @@ -20,9 +20,9 @@ function MonDKP:ValidateSender(sender) -- returns true if "sender if rankIndex == 1 then -- automatically gives permissions above all settings if player is guild leader return true; end - if #MonDKP:GetTable(MonDKP_Player_Whitelist) > 0 then -- if a whitelist exists, checks that rather than officer note permissions - for i=1, #MonDKP:GetTable(MonDKP_Player_Whitelist) do - if MonDKP:GetTable(MonDKP_Player_Whitelist)[i] == sender then + if #MonDKP:GetTable(MonDKP_Whitelist) > 0 then -- if a whitelist exists, checks that rather than officer note permissions + for i=1, #MonDKP:GetTable(MonDKP_Whitelist) do + if MonDKP:GetTable(MonDKP_Whitelist)[i] == sender then return true; end end @@ -86,14 +86,14 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) local off2,date2 = strsplit("-", Loot) if MonDKP:ValidateSender(off1) and MonDKP:ValidateSender(off2) and tonumber(date1) > core.DB.defaults.installed210 and tonumber(date2) > core.DB.defaults.installed210 then -- send only if posting officer validates and the post was made after 2.1s installation - local search1 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), DKP, "index") - local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), Loot, "index") + local search1 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPHistory, true), DKP, "index") + local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), Loot, "index") if not search1 then - MonDKP:GetTable(MonDKP_Player_DKPHistory, true).seed = DKP + MonDKP:GetTable(MonDKP_DKPHistory, true).seed = DKP end if not search2 then - MonDKP:GetTable(MonDKP_Player_Loot, true).seed = Loot + MonDKP:GetTable(MonDKP_Loot, true).seed = Loot end end end @@ -130,20 +130,20 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) core.DB.defaults.CurrentTeam = message; return elseif prefix == "MonDKPTalents" then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), sender, "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), sender, "player") if search then - local curSelection = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]] + local curSelection = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]] curSelection.spec = message; end return elseif prefix == "MonDKPRoles" then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), sender, "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), sender, "player") local curClass = "None"; if search then - local curSelection = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]] - curClass = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].class + local curSelection = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]] + curClass = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].class if curClass == "WARRIOR" then local a,b,c = strsplit("/", message) @@ -310,7 +310,7 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) return a["item"] < b["item"] end) - if (#MonDKP:GetTable(MonDKP_Player_DKPHistory, true) > 0 and #MonDKP:GetTable(MonDKP_Player_Loot, true) > 0) and (deserialized.DKP[1].date < MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[1].date or deserialized.Loot[1].date < MonDKP:GetTable(MonDKP_Player_Loot, true)[1].date) then + if (#MonDKP:GetTable(MonDKP_DKPHistory, true) > 0 and #MonDKP:GetTable(MonDKP_Loot, true) > 0) and (deserialized.DKP[1].date < MonDKP:GetTable(MonDKP_DKPHistory, true)[1].date or deserialized.Loot[1].date < MonDKP:GetTable(MonDKP_Loot, true)[1].date) then local entry1 = "Loot: "..deserialized.Loot[1].loot.." |cff616ccf"..L["WONBY"].." "..deserialized.Loot[1].player.." ("..date("%b %d @ %H:%M:%S", deserialized.Loot[1].date)..") by "..strsub(deserialized.Loot[1].index, 1, strfind(deserialized.Loot[1].index, "-")-1).."|r" local entry2 = "DKP: |cff616ccf"..deserialized.DKP[1].reason.." ("..date("%b %d @ %H:%M:%S", deserialized.DKP[1].date)..") - "..strsub(deserialized.DKP[1].index, 1, strfind(deserialized.DKP[1].index, "-")-1).."|r" @@ -319,11 +319,11 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) button1 = L["YES"], button2 = L["NO"], OnAccept = function() - MonDKP:SetTable(MonDKP_Player_DKPTable, true, deserialized.DKPTable); - MonDKP:SetTable(MonDKP_Player_DKPHistory, true, deserialized.DKP); - MonDKP:SetTable(MonDKP_Player_Loot, true, deserialized.Loot); - MonDKP:SetTable(MonDKP_Player_Archive, true, deserialized.Archive); - MonDKP:SetTable(MonDKP_Player_MinBids, true, deserialized.MinBids); + MonDKP:SetTable(MonDKP_DKPTable, true, deserialized.DKPTable); + MonDKP:SetTable(MonDKP_DKPHistory, true, deserialized.DKP); + MonDKP:SetTable(MonDKP_Loot, true, deserialized.Loot); + MonDKP:SetTable(MonDKP_Archive, true, deserialized.Archive); + MonDKP:SetTable(MonDKP_MinBids, true, deserialized.MinBids); if MonDKP.ConfigTab6 and MonDKP.ConfigTab6.history and MonDKP.ConfigTab6:IsShown() then MonDKP:DKPHistory_Update(true) @@ -331,7 +331,7 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) MonDKP:LootHistory_Reset() MonDKP:LootHistory_Update(L["NOFILTER"]); elseif MonDKP.ConfigTab7 and MonDKP.ConfigTab7:IsShown() then - core.PriceTable = MonDKP:GetTable(MonDKP_Player_MinBids, true); + core.PriceTable = MonDKP:GetTable(MonDKP_MinBids, true); MonDKP:PriceTable_Update(0); end if core.ClassGraph then @@ -349,11 +349,11 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) } StaticPopup_Show ("FULL_TABS_ALERT") else - MonDKP:SetTable(MonDKP_Player_DKPTable, true, deserialized.DKPTable); - MonDKP:SetTable(MonDKP_Player_DKPHistory, true, deserialized.DKP); - MonDKP:SetTable(MonDKP_Player_Loot, true, deserialized.Loot); - MonDKP:SetTable(MonDKP_Player_Archive, true, deserialized.Archive); - MonDKP:SetTable(MonDKP_Player_MinBids, true, deserialized.MinBids); + MonDKP:SetTable(MonDKP_DKPTable, true, deserialized.DKPTable); + MonDKP:SetTable(MonDKP_DKPHistory, true, deserialized.DKP); + MonDKP:SetTable(MonDKP_Loot, true, deserialized.Loot); + MonDKP:SetTable(MonDKP_Archive, true, deserialized.Archive); + MonDKP:SetTable(MonDKP_MinBids, true, deserialized.MinBids); if MonDKP.ConfigTab6 and MonDKP.ConfigTab6.history and MonDKP.ConfigTab6:IsShown() then MonDKP:DKPHistory_Update(true) @@ -361,7 +361,7 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) MonDKP:LootHistory_Reset() MonDKP:LootHistory_Update(L["NOFILTER"]); elseif MonDKP.ConfigTab7 and MonDKP.ConfigTab7:IsShown() then - core.PriceTable = MonDKP:GetTable(MonDKP_Player_MinBids, true); + core.PriceTable = MonDKP:GetTable(MonDKP_MinBids, true); MonDKP:PriceTable_Update(0); end if core.ClassGraph then @@ -376,9 +376,9 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) return elseif prefix == "MonDKPMerge" then for i=1, #deserialized.DKP do - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), deserialized.DKP[i].index, "index") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPHistory, true), deserialized.DKP[i].index, "index") - if not search and ((MonDKP:GetTable(MonDKP_Player_Archive, true).DKPMeta and MonDKP:GetTable(MonDKP_Player_Archive, true).DKPMeta < deserialized.DKP[i].date) or (not MonDKP:GetTable(MonDKP_Player_Archive, true).DKPMeta)) then -- prevents adding entry if this entry has already been archived + if not search and ((MonDKP:GetTable(MonDKP_Archive, true).DKPMeta and MonDKP:GetTable(MonDKP_Archive, true).DKPMeta < deserialized.DKP[i].date) or (not MonDKP:GetTable(MonDKP_Archive, true).DKPMeta)) then -- prevents adding entry if this entry has already been archived local players = {strsplit(",", strsub(deserialized.DKP[i].players, 1, -2))} local dkp @@ -387,43 +387,43 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) end if deserialized.DKP[i].deletes then -- adds deletedby field to entry if the received table is a delete entry - local search_del = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), deserialized.DKP[i].deletes, "index") + local search_del = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPHistory, true), deserialized.DKP[i].deletes, "index") if search_del then - MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search_del[1][1]].deletedby = deserialized.DKP[i].index + MonDKP:GetTable(MonDKP_DKPHistory, true)[search_del[1][1]].deletedby = deserialized.DKP[i].index end end if not deserialized.DKP[i].deletedby then - local search_del = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), deserialized.DKP[i].index, "deletes") + local search_del = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPHistory, true), deserialized.DKP[i].index, "deletes") if search_del then - deserialized.DKP[i].deletedby = MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search_del[1][1]].index + deserialized.DKP[i].deletedby = MonDKP:GetTable(MonDKP_DKPHistory, true)[search_del[1][1]].index end end - table.insert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), deserialized.DKP[i]) + table.insert(MonDKP:GetTable(MonDKP_DKPHistory, true), deserialized.DKP[i]) for j=1, #players do if players[j] then - local findEntry = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), players[j], "player") + local findEntry = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), players[j], "player") if strfind(deserialized.DKP[i].dkp, "%-%d*%.?%d+%%") then -- handles decay entries if findEntry then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[findEntry[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[findEntry[1][1]].dkp + tonumber(dkp[j]) + MonDKP:GetTable(MonDKP_DKPTable, true)[findEntry[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[findEntry[1][1]].dkp + tonumber(dkp[j]) else - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[players[j]] or (MonDKP:GetTable(MonDKP_Player_Archive, true)[players[j]] and MonDKP:GetTable(MonDKP_Player_Archive, true)[players[j]].deleted ~= true) then + if not MonDKP:GetTable(MonDKP_Archive, true)[players[j]] or (MonDKP:GetTable(MonDKP_Archive, true)[players[j]] and MonDKP:GetTable(MonDKP_Archive, true)[players[j]].deleted ~= true) then MonDKP_Profile_Create(players[j], tonumber(dkp[j])) end end else if findEntry then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[findEntry[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[findEntry[1][1]].dkp + tonumber(deserialized.DKP[i].dkp) + MonDKP:GetTable(MonDKP_DKPTable, true)[findEntry[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[findEntry[1][1]].dkp + tonumber(deserialized.DKP[i].dkp) if (tonumber(deserialized.DKP[i].dkp) > 0 and not deserialized.DKP[i].deletes) or (tonumber(deserialized.DKP[i].dkp) < 0 and deserialized.DKP[i].deletes) then -- adjust lifetime if it's a DKP gain or deleting a DKP gain - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[findEntry[1][1]].lifetime_gained = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[findEntry[1][1]].lifetime_gained + deserialized.DKP[i].dkp -- NOT if it's a DKP penalty or deleteing a DKP penalty + MonDKP:GetTable(MonDKP_DKPTable, true)[findEntry[1][1]].lifetime_gained = MonDKP:GetTable(MonDKP_DKPTable, true)[findEntry[1][1]].lifetime_gained + deserialized.DKP[i].dkp -- NOT if it's a DKP penalty or deleteing a DKP penalty end else - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[players[j]] or (MonDKP:GetTable(MonDKP_Player_Archive, true)[players[j]] and MonDKP:GetTable(MonDKP_Player_Archive, true)[players[j]].deleted ~= true) then + if not MonDKP:GetTable(MonDKP_Archive, true)[players[j]] or (MonDKP:GetTable(MonDKP_Archive, true)[players[j]] and MonDKP:GetTable(MonDKP_Archive, true)[players[j]].deleted ~= true) then local class if (tonumber(deserialized.DKP[i].dkp) > 0 and not deserialized.DKP[i].deletes) or (tonumber(deserialized.DKP[i].dkp) < 0 and deserialized.DKP[i].deletes) then @@ -444,46 +444,46 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) end for i=1, #deserialized.Loot do - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), deserialized.Loot[i].index, "index") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), deserialized.Loot[i].index, "index") - if not search and ((MonDKP:GetTable(MonDKP_Player_Archive, true).LootMeta and MonDKP:GetTable(MonDKP_Player_Archive, true).LootMeta < deserialized.DKP[i].date) or (not MonDKP:GetTable(MonDKP_Player_Archive, true).LootMeta)) then -- prevents adding entry if this entry has already been archived + if not search and ((MonDKP:GetTable(MonDKP_Archive, true).LootMeta and MonDKP:GetTable(MonDKP_Archive, true).LootMeta < deserialized.DKP[i].date) or (not MonDKP:GetTable(MonDKP_Archive, true).LootMeta)) then -- prevents adding entry if this entry has already been archived if deserialized.Loot[i].deletes then - local search_del = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), deserialized.Loot[i].deletes, "index") + local search_del = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), deserialized.Loot[i].deletes, "index") - if search_del and not MonDKP:GetTable(MonDKP_Player_Loot, true)[search_del[1][1]].deletedby then - MonDKP:GetTable(MonDKP_Player_Loot, true)[search_del[1][1]].deletedby = deserialized.Loot[i].index + if search_del and not MonDKP:GetTable(MonDKP_Loot, true)[search_del[1][1]].deletedby then + MonDKP:GetTable(MonDKP_Loot, true)[search_del[1][1]].deletedby = deserialized.Loot[i].index end end if not deserialized.Loot[i].deletedby then - local search_del = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), deserialized.Loot[i].index, "deletes") + local search_del = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), deserialized.Loot[i].index, "deletes") if search_del then - deserialized.Loot[i].deletedby = MonDKP:GetTable(MonDKP_Player_Loot, true)[search_del[1][1]].index + deserialized.Loot[i].deletedby = MonDKP:GetTable(MonDKP_Loot, true)[search_del[1][1]].index end end - table.insert(MonDKP:GetTable(MonDKP_Player_Loot, true), deserialized.Loot[i]) + table.insert(MonDKP:GetTable(MonDKP_Loot, true), deserialized.Loot[i]) - local findEntry = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), deserialized.Loot[i].player, "player") + local findEntry = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), deserialized.Loot[i].player, "player") if findEntry then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[findEntry[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[findEntry[1][1]].dkp + deserialized.Loot[i].cost - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[findEntry[1][1]].lifetime_spent = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[findEntry[1][1]].lifetime_spent + deserialized.Loot[i].cost + MonDKP:GetTable(MonDKP_DKPTable, true)[findEntry[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[findEntry[1][1]].dkp + deserialized.Loot[i].cost + MonDKP:GetTable(MonDKP_DKPTable, true)[findEntry[1][1]].lifetime_spent = MonDKP:GetTable(MonDKP_DKPTable, true)[findEntry[1][1]].lifetime_spent + deserialized.Loot[i].cost else - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized.Loot[i].player] or (MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized.Loot[i].player] and MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized.Loot[i].player].deleted ~= true) then + if not MonDKP:GetTable(MonDKP_Archive, true)[deserialized.Loot[i].player] or (MonDKP:GetTable(MonDKP_Archive, true)[deserialized.Loot[i].player] and MonDKP:GetTable(MonDKP_Archive, true)[deserialized.Loot[i].player].deleted ~= true) then MonDKP_Profile_Create(deserialized.Loot[i].player, deserialized.Loot[i].cost, 0, deserialized.Loot[i].cost) end end end end - for i=1, #MonDKP:GetTable(MonDKP_Player_DKPTable, true) do - if MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].class == "NONE" then - local search = MonDKP:Table_Search(deserialized.Profiles, MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].player, "player") + for i=1, #MonDKP:GetTable(MonDKP_DKPTable, true) do + if MonDKP:GetTable(MonDKP_DKPTable, true)[i].class == "NONE" then + local search = MonDKP:Table_Search(deserialized.Profiles, MonDKP:GetTable(MonDKP_DKPTable, true)[i].player, "player") if search then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[i].class = deserialized.Profiles[search[1][1]].class + MonDKP:GetTable(MonDKP_DKPTable, true)[i].class = deserialized.Profiles[search[1][1]].class end end end @@ -494,17 +494,17 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) MonDKP:StatusVerify_Update() return elseif prefix == "MonDKPLootDist" then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), deserialized.player, "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), deserialized.player, "player") if search then - local DKPTable = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]] + local DKPTable = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]] DKPTable.dkp = DKPTable.dkp + deserialized.cost DKPTable.lifetime_spent = DKPTable.lifetime_spent + deserialized.cost else - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized.player] or (MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized.player] and MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized.player].deleted ~= true) then + if not MonDKP:GetTable(MonDKP_Archive, true)[deserialized.player] or (MonDKP:GetTable(MonDKP_Archive, true)[deserialized.player] and MonDKP:GetTable(MonDKP_Archive, true)[deserialized.player].deleted ~= true) then MonDKP_Profile_Create(deserialized.player, deserialized.cost, 0, deserialized.cost); end end - tinsert(MonDKP:GetTable(MonDKP_Player_Loot, true), 1, deserialized) + tinsert(MonDKP:GetTable(MonDKP_Loot, true), 1, deserialized) MonDKP:LootHistory_Reset() MonDKP:LootHistory_Update(L["NOFILTER"]) @@ -513,18 +513,18 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) local players = {strsplit(",", strsub(deserialized.players, 1, -2))} local dkp = deserialized.dkp - tinsert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), 1, deserialized) + tinsert(MonDKP:GetTable(MonDKP_DKPHistory, true), 1, deserialized) for i=1, #players do - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), players[i], "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), players[i], "player") if search then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp + tonumber(dkp) + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp + tonumber(dkp) if tonumber(dkp) > 0 then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].lifetime_gained = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].lifetime_gained + tonumber(dkp) + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].lifetime_gained = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].lifetime_gained + tonumber(dkp) end else - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]] or (MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]] and MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]].deleted ~= true) then + if not MonDKP:GetTable(MonDKP_Archive, true)[players[i]] or (MonDKP:GetTable(MonDKP_Archive, true)[players[i]] and MonDKP:GetTable(MonDKP_Archive, true)[players[i]].deleted ~= true) then MonDKP_Profile_Create(players[i], tonumber(dkp), tonumber(dkp)); -- creates temp profile for data and requests additional data from online officers (hidden until data received) end end @@ -538,15 +538,15 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) local players = {strsplit(",", strsub(deserialized.players, 1, -2))} local dkp = {strsplit(",", deserialized.dkp)} - tinsert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), 1, deserialized) + tinsert(MonDKP:GetTable(MonDKP_DKPHistory, true), 1, deserialized) for i=1, #players do - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), players[i], "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), players[i], "player") if search then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].dkp + tonumber(dkp[i]) + MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].dkp + tonumber(dkp[i]) else - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]] or (MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]] and MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]].deleted ~= true) then + if not MonDKP:GetTable(MonDKP_Archive, true)[players[i]] or (MonDKP:GetTable(MonDKP_Archive, true)[players[i]] and MonDKP:GetTable(MonDKP_Archive, true)[players[i]].deleted ~= true) then MonDKP_Profile_Create(players[i], tonumber(dkp[i])); -- creates temp profile for data and requests additional data from online officers (hidden until data received) end end @@ -561,39 +561,39 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) local removedUsers = "" for i=1, #deserialized do - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), deserialized[i].player, "player") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), deserialized[i].player, "player") if search and deserialized[i].deleted and deserialized[i].deleted ~= "Recovered" then - if (MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player] and MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player].edited < deserialized[i].edited) or not MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player] then + if (MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player] and MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player].edited < deserialized[i].edited) or not MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player] then --delete user, archive data - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player] then -- creates/adds to archive entry for user - MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player] = { dkp=0, lifetime_spent=0, lifetime_gained=0, deleted=deserialized[i].deleted, edited=deserialized[i].edited } + if not MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player] then -- creates/adds to archive entry for user + MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player] = { dkp=0, lifetime_spent=0, lifetime_gained=0, deleted=deserialized[i].deleted, edited=deserialized[i].edited } else - MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player].deleted = deserialized[i].deleted - MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player].edited = deserialized[i].edited + MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player].deleted = deserialized[i].deleted + MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player].edited = deserialized[i].edited end - c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].class) + c = MonDKP:GetCColors(MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].class) if i==1 then - removedUsers = "|cff"..c.hex..MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].player.."|r" + removedUsers = "|cff"..c.hex..MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].player.."|r" else - removedUsers = removedUsers..", |cff"..c.hex..MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search[1][1]].player.."|r" + removedUsers = removedUsers..", |cff"..c.hex..MonDKP:GetTable(MonDKP_DKPTable, true)[search[1][1]].player.."|r" end numPlayers = numPlayers + 1 - tremove(MonDKP:GetTable(MonDKP_Player_DKPTable, true), search[1][1]) + tremove(MonDKP:GetTable(MonDKP_DKPTable, true), search[1][1]) - local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Standby,true), deserialized[i].player, "player"); + local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Standby,true), deserialized[i].player, "player"); if search2 then - table.remove(MonDKP:GetTable(MonDKP_Player_Standby,true), search2[1][1]) + table.remove(MonDKP:GetTable(MonDKP_Standby,true), search2[1][1]) end end elseif not search and deserialized[i].deleted == "Recovered" then - if MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player] and (MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player].edited == nil or MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player].edited < deserialized[i].edited) then + if MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player] and (MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player].edited == nil or MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player].edited < deserialized[i].edited) then MonDKP_Profile_Create(deserialized[i].player); -- User was recovered, create/request profile as needed - MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player].deleted = "Recovered" - MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized[i].player].edited = deserialized[i].edited + MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player].deleted = "Recovered" + MonDKP:GetTable(MonDKP_Archive, true)[deserialized[i].player].edited = deserialized[i].edited end end end @@ -603,30 +603,30 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) end return elseif prefix == "MonDKPDelLoot" then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_Loot, true), deserialized.deletes, "index") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Loot, true), deserialized.deletes, "index") if search then - MonDKP:GetTable(MonDKP_Player_Loot, true)[search[1][1]].deletedby = deserialized.index + MonDKP:GetTable(MonDKP_Loot, true)[search[1][1]].deletedby = deserialized.index end - local search_player = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), deserialized.player, "player") + local search_player = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), deserialized.player, "player") if search_player then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search_player[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search_player[1][1]].dkp + deserialized.cost -- refund previous looter - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search_player[1][1]].lifetime_spent = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search_player[1][1]].lifetime_spent + deserialized.cost -- remove from lifetime_spent + MonDKP:GetTable(MonDKP_DKPTable, true)[search_player[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[search_player[1][1]].dkp + deserialized.cost -- refund previous looter + MonDKP:GetTable(MonDKP_DKPTable, true)[search_player[1][1]].lifetime_spent = MonDKP:GetTable(MonDKP_DKPTable, true)[search_player[1][1]].lifetime_spent + deserialized.cost -- remove from lifetime_spent else - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized.player] or (MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized.player] and MonDKP:GetTable(MonDKP_Player_Archive, true)[deserialized.player].deleted ~= true) then + if not MonDKP:GetTable(MonDKP_Archive, true)[deserialized.player] or (MonDKP:GetTable(MonDKP_Archive, true)[deserialized.player] and MonDKP:GetTable(MonDKP_Archive, true)[deserialized.player].deleted ~= true) then MonDKP_Profile_Create(deserialized.player, deserialized.cost, 0, deserialized.cost); -- creates temp profile for data and requests additional data from online officers (hidden until data received) end end - table.insert(MonDKP:GetTable(MonDKP_Player_Loot, true), 1, deserialized) + table.insert(MonDKP:GetTable(MonDKP_Loot, true), 1, deserialized) MonDKP:SortLootTable() MonDKP:LootHistory_Reset() MonDKP:LootHistory_Update(L["NOFILTER"]); MonDKP:FilterDKPTable(core.currentSort, "reset") elseif prefix == "MonDKPDelSync" then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), deserialized.deletes, "index") + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPHistory, true), deserialized.deletes, "index") local players = {strsplit(",", strsub(deserialized.players, 1, -2))} -- cuts off last "," from string to avoid creating an empty value local dkp, mod; @@ -640,26 +640,26 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) for i=1, #players do if mod == "perc" then - local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), players[i], "player") + local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), players[i], "player") if search2 then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search2[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search2[1][1]].dkp + tonumber(dkp[i]) + MonDKP:GetTable(MonDKP_DKPTable, true)[search2[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[search2[1][1]].dkp + tonumber(dkp[i]) else - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]] or (MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]] and MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]].deleted ~= true) then + if not MonDKP:GetTable(MonDKP_Archive, true)[players[i]] or (MonDKP:GetTable(MonDKP_Archive, true)[players[i]] and MonDKP:GetTable(MonDKP_Archive, true)[players[i]].deleted ~= true) then MonDKP_Profile_Create(players[i], tonumber(dkp[i])); -- creates temp profile for data and requests additional data from online officers (hidden until data received) end end else - local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_DKPTable, true), players[i], "player") + local search2 = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_DKPTable, true), players[i], "player") if search2 then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search2[1][1]].dkp = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search2[1][1]].dkp + tonumber(dkp) + MonDKP:GetTable(MonDKP_DKPTable, true)[search2[1][1]].dkp = MonDKP:GetTable(MonDKP_DKPTable, true)[search2[1][1]].dkp + tonumber(dkp) if tonumber(dkp) < 0 then - MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search2[1][1]].lifetime_gained = MonDKP:GetTable(MonDKP_Player_DKPTable, true)[search2[1][1]].lifetime_gained + tonumber(dkp) + MonDKP:GetTable(MonDKP_DKPTable, true)[search2[1][1]].lifetime_gained = MonDKP:GetTable(MonDKP_DKPTable, true)[search2[1][1]].lifetime_gained + tonumber(dkp) end else - if not MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]] or (MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]] and MonDKP:GetTable(MonDKP_Player_Archive, true)[players[i]].deleted ~= true) then + if not MonDKP:GetTable(MonDKP_Archive, true)[players[i]] or (MonDKP:GetTable(MonDKP_Archive, true)[players[i]] and MonDKP:GetTable(MonDKP_Archive, true)[players[i]].deleted ~= true) then local gained; if tonumber(dkp) < 0 then gained = tonumber(dkp) else gained = 0 end @@ -670,10 +670,10 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) end if search then - MonDKP:GetTable(MonDKP_Player_DKPHistory, true)[search[1][1]].deletedby = deserialized.index; -- adds deletedby field if the entry exists + MonDKP:GetTable(MonDKP_DKPHistory, true)[search[1][1]].deletedby = deserialized.index; -- adds deletedby field if the entry exists end - table.insert(MonDKP:GetTable(MonDKP_Player_DKPHistory, true), 1, deserialized) + table.insert(MonDKP:GetTable(MonDKP_DKPHistory, true), 1, deserialized) if MonDKP.ConfigTab6 and MonDKP.ConfigTab6.history then MonDKP:DKPHistory_Update(true) @@ -684,17 +684,17 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) core.DB.MinBidBySlot = deserialized[1] for i=1, #deserialized[2] do - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_MinBids, true), deserialized[2][i].item) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_MinBids, true), deserialized[2][i].item) if search then - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].minbid = deserialized[2][i].minbid + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].minbid = deserialized[2][i].minbid if deserialized[2][i]["link"] ~= nil then - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].link = deserialized[2][i].link + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].link = deserialized[2][i].link end if deserialized[2][i]["icon"] ~= nil then - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]].icon = deserialized[2][i].icon + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]].icon = deserialized[2][i].icon end else - table.insert(MonDKP:GetTable(MonDKP_Player_MinBids, true), deserialized[2][i]) + table.insert(MonDKP:GetTable(MonDKP_MinBids, true), deserialized[2][i]) end end end @@ -703,28 +703,28 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) core.DB.MaxBidBySlot = deserialized[1] for i=1, #deserialized[2] do - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_MaxBids, true), deserialized[2][i].item) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_MaxBids, true), deserialized[2][i].item) if search then - MonDKP:GetTable(MonDKP_Player_MaxBids, true)[search[1][1]].maxbid = deserialized[2][i].maxbid + MonDKP:GetTable(MonDKP_MaxBids, true)[search[1][1]].maxbid = deserialized[2][i].maxbid else - table.insert(MonDKP:GetTable(MonDKP_Player_MaxBids, true), deserialized[2][i]) + table.insert(MonDKP:GetTable(MonDKP_MaxBids, true), deserialized[2][i]) end end end elseif prefix == "MonDKPWhitelist" and MonDKP:GetGuildRankIndex(UnitName("player")) > 1 then -- only applies if not GM - MonDKP:SetTable(MonDKP_Player_Whitelist, false, deserialized); + MonDKP:SetTable(MonDKP_Whitelist, false, deserialized); elseif prefix == "MonDKPStand" then - MonDKP:GetTable(MonDKP_Player_Standby,true, deserialized); + MonDKP:GetTable(MonDKP_Standby,true, deserialized); elseif prefix == "MonDKPSetPrice" then local mode = core.DB.modes.mode; if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and core.DB.modes.ZeroSumBidType == "Static") then - local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_Player_MinBids, true), itemName) + local search = MonDKP:Table_Search(MonDKP:GetTable(MonDKP_MinBids, true), itemName) if not search then - tinsert(MonDKP:GetTable(MonDKP_Player_MinBids, true), deserialized) + tinsert(MonDKP:GetTable(MonDKP_MinBids, true), deserialized) elseif search and cost ~= tonumber(val) then - MonDKP:GetTable(MonDKP_Player_MinBids, true)[search[1][1]] = deserialized; + MonDKP:GetTable(MonDKP_MinBids, true)[search[1][1]] = deserialized; end MonDKP:PriceTable_Update(0); diff --git a/Modules/exportDKP.lua b/Modules/exportDKP.lua index 5f864937..9c7eb21d 100644 --- a/Modules/exportDKP.lua +++ b/Modules/exportDKP.lua @@ -10,7 +10,7 @@ local function GenerateDKPTables(table, format) local ExportDefinition; if format == "HTML" then - if table == MonDKP:GetTable(MonDKP_Player_DKPTable, true) then + if table == MonDKP:GetTable(MonDKP_DKPTable, true) then ExportString = "\n\n"; ExportString = ExportString.."\n" ExportString = ExportString.."