Skip to content

Commit

Permalink
Removed the temporary save files and replaced with the final db schem…
Browse files Browse the repository at this point in the history
…a 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.
  • Loading branch information
Vapok committed May 26, 2020
1 parent 444706f commit 3355289
Show file tree
Hide file tree
Showing 26 changed files with 716 additions and 718 deletions.
6 changes: 3 additions & 3 deletions ConfigMenuTabs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
94 changes: 47 additions & 47 deletions Core.lua

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions Modules/AdjustDKP.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions Modules/AutoAward.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -25,24 +25,24 @@ 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)
if tempName then
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
Expand All @@ -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
Expand Down
Loading

0 comments on commit 3355289

Please sign in to comment.