From a6761fc63abd216f0c9d838c115e65aaa7f0271e Mon Sep 17 00:00:00 2001 From: Vapok Date: Mon, 18 May 2020 01:10:17 -0400 Subject: [PATCH] Adding Loot Pricing Tab and Disenchant Counter. --- ConfigMenuTabs.lua | 20 +- Core.lua | 7 +- Libs/AceComm-3.0/AceComm-3.0.lua | 5 +- Localization/Localization.en.lua | 3 + Modules/Award.lua | 80 +++++-- Modules/Bidding.lua | 12 +- Modules/LootPriceTab.lua | 345 +++++++++++++++++++++++++++++++ Modules/Sync.lua | 2 +- Modules/comm.lua | 49 ++++- MonolithDKP.lua | 8 +- MonolithDKP.toc | 3 +- init.lua | 15 +- 12 files changed, 498 insertions(+), 51 deletions(-) create mode 100644 Modules/LootPriceTab.lua diff --git a/ConfigMenuTabs.lua b/ConfigMenuTabs.lua index d1d7fcc1..97d0d5f5 100644 --- a/ConfigMenuTabs.lua +++ b/ConfigMenuTabs.lua @@ -68,6 +68,10 @@ local function Tab_OnClick(self) MonDKP:DKPHistory_Update(true) end + if self:GetID() == 7 then + self:GetParent().ScrollFrame.ScrollBar:Hide() + end + local scrollChild = self:GetParent().ScrollFrame:GetScrollChild(); if (scrollChild) then scrollChild:Hide(); @@ -120,8 +124,8 @@ function MonDKP:ConfigMenuTabs() --------------------------------------- MonDKP.UIConfig.TabMenu = CreateFrame("Frame", "MonDKPMonDKP.ConfigTabMenu", MonDKP.UIConfig); - MonDKP.UIConfig.TabMenu:SetPoint("TOPRIGHT", MonDKP.UIConfig, "TOPRIGHT", -25, -25); - MonDKP.UIConfig.TabMenu:SetSize(477, 510); + MonDKP.UIConfig.TabMenu:SetPoint("TOPRIGHT", MonDKP.UIConfig, "TOPRIGHT", -25, -25); --Moves the entire tabframe (defaults -25, -25) + MonDKP.UIConfig.TabMenu:SetSize(535, 510); --default: 477,510 MonDKP.UIConfig.TabMenu:SetBackdrop( { edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 2, insets = { left = 0, right = 0, top = 0, bottom = 0 } @@ -132,7 +136,7 @@ function MonDKP:ConfigMenuTabs() MonDKP.UIConfig.TabMenuBG = MonDKP.UIConfig.TabMenu:CreateTexture(nil, "OVERLAY", nil); MonDKP.UIConfig.TabMenuBG:SetColorTexture(0, 0, 0, 1) MonDKP.UIConfig.TabMenuBG:SetPoint("TOPLEFT", MonDKP.UIConfig.TabMenu, "TOPLEFT", 2, -2); - MonDKP.UIConfig.TabMenuBG:SetSize(478, 511); + MonDKP.UIConfig.TabMenuBG:SetSize(536, 511); MonDKP.UIConfig.TabMenuBG:SetTexture("Interface\\AddOns\\MonolithDKP\\Media\\Textures\\menu-bg"); -- TabMenu ScrollFrame and ScrollBar @@ -149,7 +153,7 @@ function MonDKP:ConfigMenuTabs() MonDKP.UIConfig.TabMenu.ScrollFrame.ScrollBar:SetPoint("TOPLEFT", MonDKP.UIConfig.TabMenu.ScrollFrame, "TOPRIGHT", -20, -12); MonDKP.UIConfig.TabMenu.ScrollFrame.ScrollBar:SetPoint("BOTTOMRIGHT", MonDKP.UIConfig.TabMenu.ScrollFrame, "BOTTOMRIGHT", -2, 15); - MonDKP.ConfigTab1, MonDKP.ConfigTab2, MonDKP.ConfigTab3, MonDKP.ConfigTab4, MonDKP.ConfigTab5, MonDKP.ConfigTab6 = MonDKP:SetTabs(MonDKP.UIConfig.TabMenu, 6, 475, 490, L["FILTERS"], L["ADJUSTDKP"], L["MANAGE"], L["OPTIONS"], L["LOOTHISTORY"], L["DKPHISTORY"]); + MonDKP.ConfigTab1, MonDKP.ConfigTab2, MonDKP.ConfigTab3, MonDKP.ConfigTab4, MonDKP.ConfigTab5, MonDKP.ConfigTab6, MonDKP.ConfigTab7 = MonDKP:SetTabs(MonDKP.UIConfig.TabMenu, 7, 533, 490, L["FILTERS"], L["ADJUSTDKP"], L["MANAGE"], L["OPTIONS"], L["LOOTHISTORY"], L["DKPHISTORY"], L["PRICETAB"]); --------------------------------------- -- MENU TAB 1 @@ -245,6 +249,12 @@ function MonDKP:ConfigMenuTabs() MonDKP:AdjustDKPTab_Create() + --------------------------------------- + -- Price TAB + --------------------------------------- + + MonDKP:PriceTab_Create() + --------------------------------------- -- Manage DKP TAB --------------------------------------- @@ -253,7 +263,7 @@ function MonDKP:ConfigMenuTabs() MonDKP.ConfigTab3.header:ClearAllPoints(); MonDKP.ConfigTab3.header:SetFontObject("MonDKPLargeCenter"); MonDKP.ConfigTab3.header:SetPoint("TOPLEFT", MonDKP.ConfigTab3, "TOPLEFT", 15, -10); - MonDKP.ConfigTab3.header:SetText(L["MANAGEDKP"]); + MonDKP.ConfigTab3.header:SetText(L["MANAGEDKP"]); MonDKP.ConfigTab3.header:SetScale(1.2) -- Populate Manage Tab diff --git a/Core.lua b/Core.lua index 4b441b1f..fc766a7c 100644 --- a/Core.lua +++ b/Core.lua @@ -50,6 +50,7 @@ local defaults = { theme2 = { r = 1, g = 0.37, b = 0.37, hex = "ff6060" } } +core.PriceSortButtons = {} core.WorkingTable = {}; -- table of all entries from MonDKP_DKPTable that are currently visible in the window. From MonDKP_DKPTable core.EncounterList = { -- Event IDs must be in the exact same order as core.BossList declared in localization files MC = { @@ -88,9 +89,9 @@ core.EncounterList = { -- Event IDs must be in the exact same order as core } core.MonDKPUI = {} -- global storing entire Configuration UI to hide/show UI -core.MonVersion = "v2.1.2"; +core.MonVersion = "v2.2.2 - LJT"; core.BuildNumber = 20102; -core.TableWidth, core.TableRowHeight, core.TableNumRows = 500, 18, 27; -- width, row height, number of rows +core.TableWidth, core.TableRowHeight, core.TableNumRows, core.PriceNumRows = 500, 18, 27, 22; -- width, row height, number of rows core.SelectedData = { player="none"}; -- stores data of clicked row for manipulation. core.classFiltered = {}; -- tracks classes filtered out with checkboxes core.IsOfficer = nil; @@ -385,7 +386,7 @@ function MonDKP:CreateContainer(parent, name, header) f.header.text:SetFontObject("MonDKPSmallCenter"); f.header.text:SetPoint("CENTER", f.header, "CENTER", 0, 0); f.header.text:SetText(header); - f.header:SetWidth(f.header.text:GetWidth() + 10) + f.header:SetWidth(f.header.text:GetWidth() + 600) f.header:SetHeight(f.header.text:GetHeight() + 4) return f; diff --git a/Libs/AceComm-3.0/AceComm-3.0.lua b/Libs/AceComm-3.0/AceComm-3.0.lua index 3fca6923..5b1f454a 100644 --- a/Libs/AceComm-3.0/AceComm-3.0.lua +++ b/Libs/AceComm-3.0/AceComm-3.0.lua @@ -85,6 +85,7 @@ local warnedPrefix=false -- @param callbackFn OPTIONAL: callback function to be called as each chunk is sent. receives 3 args: the user supplied arg (see next), the number of bytes sent so far, and the number of bytes total to send. -- @param callbackArg: OPTIONAL: first arg to the callback function. nil will be passed if not specified. function AceComm:SendCommMessage(prefix, text, distribution, target, prio, callbackFn, callbackArg) + prio = prio or "NORMAL" -- pasta's reference implementation had different prio for singlepart and multipart, but that's a very bad idea since that can easily lead to out-of-sequence delivery! if not( type(prefix)=="string" and type(text)=="string" and @@ -94,7 +95,6 @@ function AceComm:SendCommMessage(prefix, text, distribution, target, prio, callb ) then error('Usage: SendCommMessage(addon, "prefix", "text", "distribution"[, "target"[, "prio"[, callbackFn, callbackarg]]])', 2) end - local textlen = #text local maxtextlen = 255 -- Yes, the max is 255 even if the dev post said 256. I tested. Char 256+ get silently truncated. /Mikk, 20110327 local queueName = prefix..distribution..(target or "") @@ -105,7 +105,6 @@ function AceComm:SendCommMessage(prefix, text, distribution, target, prio, callb return callbackFn(callbackArg, sent, textlen) end end - local forceMultipart if match(text, "^[\001-\009]") then -- 4.1+: see if the first character is a control character -- we need to escape the first character with a \004 @@ -117,7 +116,6 @@ function AceComm:SendCommMessage(prefix, text, distribution, target, prio, callb end if not forceMultipart and textlen <= maxtextlen then - -- fits all in one message CTL:SendAddonMessage(prio, prefix, text, distribution, target, queueName, ctlCallback, textlen) else maxtextlen = maxtextlen - 1 -- 1 extra byte for part indicator in prefix(4.0)/start of message(4.1) @@ -125,7 +123,6 @@ function AceComm:SendCommMessage(prefix, text, distribution, target, prio, callb -- first part local chunk = strsub(text, 1, maxtextlen) CTL:SendAddonMessage(prio, prefix, MSG_MULTI_FIRST..chunk, distribution, target, queueName, ctlCallback, maxtextlen) - -- continuation local pos = 1+maxtextlen diff --git a/Localization/Localization.en.lua b/Localization/Localization.en.lua index 4ae2a830..0f4c12cd 100644 --- a/Localization/Localization.en.lua +++ b/Localization/Localization.en.lua @@ -457,6 +457,9 @@ core.L = { PLAYERSFORREASON = "players for reason", PLAYERVALIDATE = "No Player Selected", PLEASEUSENUMS = "Please use numbers.", + PRICETAB = "Pricing", + PRICETITLE = "Loot Prices", + PRICEDESC = "Use the following table to view pricing for managed loot.", POINTS = "Points", POINTSTTDESC = "Enter amount of DKP to be distributed to selected players on the DKP table. Default values can be changed in the \"Options\" tab below.", POINTSTTWARN = "Use a negative number to remove DKP from selected players.", diff --git a/Modules/Award.lua b/Modules/Award.lua index 55fa4ca9..a12605ee 100644 --- a/Modules/Award.lua +++ b/Modules/Award.lua @@ -3,6 +3,34 @@ local _G = _G; local MonDKP = core.MonDKP; local L = core.L; +local function SetItemPrice(cost, loot) + local itemName,itemLink,_,_,_,_,_,_,_,itemIcon = GetItemInfo(loot) + local cost = cost; + local mode = MonDKP_DB.modes.mode; + + if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static") then + local search = MonDKP:Table_Search(MonDKP_MinBids, itemName) + local newItem = {item=itemName, minbid=cost, link=itemLink, icon=itemIcon, disenchants=0} + + if not search then + tinsert(MonDKP_MinBids, newItem) + elseif search then + if MonDKP_MinBids[search[1][1]].minbid ~= itemName then + MonDKP_MinBids[search[1][1]].minbid = MonDKP_round(cost, MonDKP_DB.modes.rounding); + MonDKP_MinBids[search[1][1]].link = itemLink; + MonDKP_MinBids[search[1][1]].icon = itemIcon; + if cost == 0 then + MonDKP_MinBids[search[1][1]].disenchants = 0; + end + newItem = MonDKP_MinBids[search[1][1]]; + end + end + core.PriceTable = MonDKP_MinBids; + MonDKP:PriceTable_Update(0); + MonDKP.Sync:SendData("MonDKPSetPrice", newItem); + end +end + local function AwardItem(player, cost, boss, zone, loot, reassign) local cost = cost; local winner = player; @@ -15,10 +43,11 @@ local function AwardItem(player, cost, boss, zone, loot, reassign) local curOfficer = UnitName("player") local bids; local search_reassign; + local itemName,itemLink,_,_,_,_,_,_,_,itemIcon = GetItemInfo(loot) MonDKP:StatusVerify_Update() - if core.IsOfficer then + print("Is Officer"); if MonDKP_DB.modes.costvalue == "Percent" then local search = MonDKP:Table_Search(MonDKP_DKPTable, winner); @@ -111,7 +140,6 @@ local function AwardItem(player, cost, boss, zone, loot, reassign) MonDKP_Loot[1].bids = bids end end - MonDKP:BidsSubmitted_Clear() MonDKP.Sync:SendData("MonDKPLootDist", MonDKP_Loot[1]) MonDKP:DKPTable_Set(winner, "dkp", MonDKP_round(cost, MonDKP_DB.modes.rounding), true) @@ -119,6 +147,7 @@ local function AwardItem(player, cost, boss, zone, loot, reassign) MonDKP:LootHistory_Update(L["NOFILTER"]) if core.BiddingWindow and core.BiddingWindow:IsShown() then -- runs below if award is through bidding window (update minbids and zerosum bank) + print("Bid Window Open"); if _G["MonDKPBiddingStartBiddingButton"] then _G["MonDKPBiddingStartBiddingButton"]:SetText(L["STARTBIDDING"]) _G["MonDKPBiddingStartBiddingButton"]:SetScript("OnClick", function (self) @@ -133,30 +162,31 @@ local function AwardItem(player, cost, boss, zone, loot, reassign) SendChatMessage(L["CONGRATS"].." "..winner.." "..L["ON"].." "..loot.." @ "..-cost.." "..L["DKP"], "RAID_WARNING") if MonDKP_DB.modes.AnnounceAward then SendChatMessage(L["CONGRATS"].." "..winner.." "..L["ON"].." "..loot.." @ "..-cost.." "..L["DKP"], "GUILD") - end - - + end + if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static") then - local search = MonDKP:Table_Search(MonDKP_MinBids, core.BiddingWindow.itemName:GetText()) + local search = MonDKP:Table_Search(MonDKP_MinBids, itemName) local val = MonDKP:GetMinBid(loot); if not search and core.BiddingWindow.cost:GetNumber() ~= tonumber(val) then - tinsert(MonDKP_MinBids, {item=core.BiddingWindow.itemName:GetText(), minbid=core.BiddingWindow.cost:GetNumber()}) + tinsert(MonDKP_MinBids, {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_MinBids[search[1][1]].minbid ~= core.BiddingWindow.cost:GetText() then - MonDKP_MinBids[search[1][1]].minbid = MonDKP_round(core.BiddingWindow.cost:GetNumber(), MonDKP_DB.modes.rounding); - core.BiddingWindow.CustomMinBid:SetShown(true); - core.BiddingWindow.CustomMinBid:SetChecked(true); + MonDKP_MinBids[search[1][1]].minbid = MonDKP_round(core.BiddingWindow.cost:GetNumber(), MonDKP_DB.modes.rounding); + MonDKP_MinBids[search[1][1]].link = itemLink; + MonDKP_MinBids[search[1][1]].icon = itemIcon; + core.BiddingWindow.CustomMinBid:SetShown(true); + core.BiddingWindow.CustomMinBid:SetChecked(true); + end end - end - - if search and core.BiddingWindow.CustomMinBid:GetChecked() == false then - table.remove(MonDKP_MinBids, search[1][1]) - core.BiddingWindow.CustomMinBid:SetShown(false); - end + + if search and core.BiddingWindow.CustomMinBid:GetChecked() == false then + table.remove(MonDKP_MinBids, search[1][1]) + core.BiddingWindow.CustomMinBid:SetShown(false); end + end if mode == "Zero Sum" and not reassign then MonDKP_DB.modes.ZeroSumBank.balance = MonDKP_DB.modes.ZeroSumBank.balance + -tonumber(cost) @@ -285,6 +315,8 @@ local function AwardConfirm_Create() UIDropDownMenu_JustifyText(f.zoneDropDown, "LEFT") f.yesButton = MonDKP:CreateButton("BOTTOMLEFT", f, "BOTTOMLEFT", 20, 15, L["CONFIRM"]); + f.setPriceButton = MonDKP:CreateButton("BOTTOMLEFT", f, "BOTTOMLEFT", 150, 15, "Set Price"); + f.setPriceButton:SetShown(false); f.noButton = MonDKP:CreateButton("BOTTOMRIGHT", f, "BOTTOMRIGHT", -20, 15, L["CANCEL"]); return f; @@ -296,10 +328,11 @@ function MonDKP:AwardConfirm(player, cost, boss, zone, loot, reassign) local class, search; local PlayerList = {}; local curSelected = 0; - - if cost == 0 then + local mode = MonDKP_DB.modes.mode; + +--[[ if cost == 0 then cost = MonDKP:GetMinBid(itemLink) - end + end ]] if player then search = MonDKP:Table_Search(MonDKP_DKPTable, player) @@ -317,6 +350,10 @@ function MonDKP:AwardConfirm(player, cost, boss, zone, loot, reassign) core.AwardConfirm = core.AwardConfirm or AwardConfirm_Create() core.AwardConfirm:SetShown(not core.AwardConfirm:IsShown()) + if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static") then + core.AwardConfirm.setPriceButton:SetShown(true); + end + --core.AwardConfirm.player:SetText("|cff"..class.hex..player.."|r") core.AwardConfirm.lootIcon:SetTexture(itemIcon) core.AwardConfirm.loot:SetText(loot) @@ -467,4 +504,9 @@ function MonDKP:AwardConfirm(player, cost, boss, zone, loot, reassign) PlaySound(851) core.AwardConfirm:SetShown(false) end) + core.AwardConfirm.setPriceButton:SetScript("OnClick", function() -- Run when "Set Price" is clicked + SetItemPrice(cost, loot) + PlaySound(851) + core.AwardConfirm:SetShown(false) + end) end \ No newline at end of file diff --git a/Modules/Bidding.lua b/Modules/Bidding.lua index 89fb9002..98a00be8 100644 --- a/Modules/Bidding.lua +++ b/Modules/Bidding.lua @@ -116,7 +116,7 @@ function MonDKP_CHAT_MSG_WHISPER(text, ...) local dkp; local seconds; local response = L["ERRORPROCESSING"]; - local snipemessage; + mode = MonDKP_DB.modes.mode; if string.find(name, "-") then -- finds and removes server name from name if exists @@ -560,9 +560,9 @@ local function StartBidding() MonDKP:BidInterface_Toggle() end - local search_min = MonDKP:Table_Search(MonDKP_MinBids, core.BiddingWindow.itemName:GetText()) + local search_min = MonDKP:Table_Search(MonDKP_MinBids, core.BiddingWindow.itemName:GetText(), "item") local val_min = MonDKP:GetMinBid(CurrItemForBid); - local search_max = MonDKP:Table_Search(MonDKP_MaxBids, core.BiddingWindow.itemName:GetText()) + local search_max = MonDKP:Table_Search(MonDKP_MaxBids, core.BiddingWindow.itemName:GetText(), "item") local val_max = MonDKP:GetMaxBid(CurrItemForBid); -- Min @@ -1768,6 +1768,12 @@ function MonDKP:CreateBidWindow() end end); + f.ItemDE = MonDKP:CreateButton("LEFT", f.cost, "RIGHT", 190, 0, "DE"); + f.ItemDE:SetSize(35,25) + f.ItemDE:SetScript("OnClick", function () + MonDKP:ProcessDisenchant(CurrItemForBid) + end); + f:SetScript("OnMouseUp", function(self) -- clears focus on esc local item,_,link = GetCursorInfo(); diff --git a/Modules/LootPriceTab.lua b/Modules/LootPriceTab.lua new file mode 100644 index 00000000..aa01478e --- /dev/null +++ b/Modules/LootPriceTab.lua @@ -0,0 +1,345 @@ +local _, core = ...; +local _G = _G; +local MonDKP = core.MonDKP; +local L = core.L; + + +local function CreateRow(parent, id) -- Create 3 buttons for each row in the list + local f = CreateFrame("Button", "$parentLine"..id, parent) + f.PriceInfo = {} + f:SetSize(core.TableWidth, core.TableRowHeight) + f:SetHighlightTexture("Interface\\AddOns\\MonolithDKP\\Media\\Textures\\ListBox-Highlight"); + f:SetNormalTexture("Interface\\COMMON\\talent-blue-glow") + f:GetNormalTexture():SetAlpha(0.2) + --f:SetScript("OnClick", DKPTable_OnClick) + for i=1, 3 do + f.PriceInfo[i] = f:CreateFontString(nil, "OVERLAY"); + f.PriceInfo[i]:SetFontObject("MonDKPSmallOutlineLeft") + f.PriceInfo[i]:SetTextColor(1, 1, 1, 1); + if (i==1) then + f.PriceInfo[i].rowCounter = f:CreateFontString(nil, "OVERLAY"); + f.PriceInfo[i].rowCounter:SetFontObject("MonDKPSmallOutlineLeft") + f.PriceInfo[i].rowCounter:SetTextColor(1, 1, 1, 0.3); + f.PriceInfo[i].rowCounter:SetPoint("LEFT", f, "LEFT", 3, -1); + f.PriceInfo[i]:SetSize((370)-1, core.TableRowHeight); + + end + if (i==2) then + f.PriceInfo[i]:SetFontObject("MonDKPSmallLeft") + f.PriceInfo[i]:SetSize((60)-1, core.TableRowHeight); + end + if (i==3) then + f.PriceInfo[i]:SetFontObject("MonDKPSmallLeft") + f.PriceInfo[i]:SetSize((70)-1, core.TableRowHeight); + end + end + f.PriceInfo[1]:SetPoint("LEFT", 30, 0); + f.PriceInfo[2]:SetPoint("CENTER", 155, 0) + f.PriceInfo[3]:SetPoint("RIGHT", 15, 0) + + + + + + --f:SetScript("OnMouseDown", function(self, button) + -- if button == "RightButton" then + -- RightClickMenu(self) + -- end + --end) + + return f +end + +function MonDKP:ProcessDisenchant(loot) + local itemName,itemLink,_,_,_,_,_,_,_,itemIcon = GetItemInfo(loot) + local mode = MonDKP_DB.modes.mode; + + if core.BiddingWindow and core.BiddingWindow:IsShown() then -- can only process through bidding process + if _G["MonDKPBiddingStartBiddingButton"] then + _G["MonDKPBiddingStartBiddingButton"]:SetText(L["STARTBIDDING"]) + _G["MonDKPBiddingStartBiddingButton"]:SetScript("OnClick", function (self) + ToggleTimerBtn(self) + end) + timerToggle = 0; + end + + core.BidInProgress = false; + MonDKP:BroadcastStopBidTimer() + print("Got here"); + if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static") then + local search = MonDKP:Table_Search(MonDKP_MinBids, itemName) + local numOfDisenchants = MonDKP_MinBids[search[1][1]].disenchants or 0 + local updatedDisenchants = numOfDisenchants + 1 + local cost = core.BiddingWindow.cost:GetNumber(); + print("Got here 2"); + SendChatMessage("No votes for ".." "..itemLink.." for "..cost.." "..L["DKP"].." and will be disenchanted. This will be disenchant number "..updatedDisenchants, "RAID_WARNING"); + + --If cost is 0, dont' track. + if cost == 0 then + updatedDisenchants = 0; + end + + --Adjust Price + if updatedDisenchants >= 3 then + cost = MonDKP_round(cost/2, MonDKP_DB.modes.rounding); + if cost < 5 then + cost = 5 + end + end + print("Got here 3"); + local newItem = {item=itemName, minbid=cost, link=itemLink, icon=itemIcon, disenchant=updatedDisenchants}; + print("Got here 4"); + if not search then + print("Got here 5"); + tinsert(MonDKP_MinBids, newItem) + core.BiddingWindow.CustomMinBid:SetShown(true); + core.BiddingWindow.CustomMinBid:SetChecked(true); + else + print("Got here 6"); + MonDKP_MinBids[search[1][1]].minbid = cost; + MonDKP_MinBids[search[1][1]].link = itemLink; + MonDKP_MinBids[search[1][1]].icon = itemIcon; + MonDKP_MinBids[search[1][1]].disenchants = updatedDisenchants; + newItem = MonDKP_MinBids[search[1][1]]; + end + print("Got here 7"); + MonDKP.Sync:SendData("MonDKPSetPrice", newItem); + else + print("Got here 8"); + SendChatMessage("No votes for ".." "..itemLink.." for "..-cost.." "..L["DKP"].." and will be disenchanted.", "RAID_WARNING") + end + print("Got here 9"); + core.BiddingWindow:Hide() + print("Got here 10"); + ClearBidWindow() + print("Got here 11"); + end + +end + +function MonDKP:PriceTable_Update(scrollOffset) + + local numOptions = #core.PriceTable + local numOfRows = core.PriceNumRows; + local index, row + local offset = MonDKP_round(scrollOffset / core.TableRowHeight, 0) + + for i=1, numOfRows do -- hide all rows before displaying them 1 by 1 as they show values + row = MonDKP.ConfigTab7.PriceTable.Rows[i]; + row:Hide(); + end + for i=1, numOfRows do -- show rows if they have values + row = MonDKP.ConfigTab7.PriceTable.Rows[i] + index = tonumber(offset) + i; + if core.PriceTable[index] then + row:Show() + row.index = index + local curItemName = core.PriceTable[index].item; + local curItemPrice = core.PriceTable[index].minbid; + + local curDisenchants = 0; + + if core.PriceTable[index]["disenchants"] ~= nil then + curDisenchants = core.PriceTable[index].disenchants; + end + + if core.PriceTable[index]["link"] ~= nil then + curItemName = core.PriceTable[index].link; + MonDKP.ConfigTab7.PriceTable.Rows[i]:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self:GetParent(), "ANCHOR_BOTTOMRIGHT", 0, 500); + GameTooltip:SetHyperlink(curItemName) + GameTooltip:Show(); + end) + MonDKP.ConfigTab7.PriceTable.Rows[i]:SetScript("OnLeave", function() + GameTooltip:Hide() + end) + else + MonDKP.ConfigTab7.PriceTable.Rows[i]:SetScript("OnEnter", nil) + MonDKP.ConfigTab7.PriceTable.Rows[i]:SetScript("OnLeave", nil) + end + row.PriceInfo[1]:SetText(curItemName) + row.PriceInfo[1].rowCounter:SetText(index) + + row.PriceInfo[2]:SetText(curItemPrice) + + row.PriceInfo[3]:SetText(curDisenchants) + else + row:Hide() + end + end + + if #core.PriceTable == 0 then -- Displays "No Entries Returned" if the result of filter combinations yields an empty table + --MonDKP_RestoreFilterOptions() + MonDKP.ConfigTab7.PriceTable.Rows[1].PriceInfo[1].rowCounter:SetText("") + MonDKP.ConfigTab7.PriceTable.Rows[1].PriceInfo[1]:SetText("") + MonDKP.ConfigTab7.PriceTable.Rows[1].PriceInfo[2]:SetText("|cffff6060"..L["NOENTRIESRETURNED"].."|r") + MonDKP.ConfigTab7.PriceTable.Rows[1].PriceInfo[3]:SetText("") + + if MonDKP.ConfigTab7.PriceTable.Rows[1].PriceInfo[3].rollrange then MonDKP.ConfigTab7.PriceTable.Rows[1].PriceInfo[3].rollrange:SetText("") end + MonDKP.ConfigTab7.PriceTable.Rows[1]:SetScript("OnEnter", nil) + MonDKP.ConfigTab7.PriceTable.Rows[1]:SetScript("OnMouseDown", function() + MonDKP_RestoreFilterOptions() -- restores filter selections to default on click. + end) + MonDKP.ConfigTab7.PriceTable.Rows[1]:SetScript("OnClick", function() + MonDKP_RestoreFilterOptions() -- restores filter selections to default on click. + end) + MonDKP.ConfigTab7.PriceTable.Rows[1]:Show() + --else + --MonDKP.ConfigTab7.PriceTable.Rows[1]:SetScript("OnMouseDown", function(self, button) + -- if button == "RightButton" then + -- RightClickMenu(self) + -- end + --end) + --MonDKP.ConfigTab7.PriceTable.Rows[1]:SetScript("OnClick", DKPTable_OnClick) + end + + + FauxScrollFrame_Update(MonDKP.ConfigTab7.PriceTable, numOptions, numOfRows, core.TableRowHeight, nil, nil, nil, nil, nil, nil, true) -- alwaysShowScrollBar= true to stop frame from hiding + +end + +function MonDKP:PriceListSort(id, reset) + local button; -- passing "reset" forces it to do initial sort (A to Z repeatedly instead of A to Z then Z to A toggled) + local PriceSortButtons = core.PriceSortButtons + + if id == "disenchants" then + button = PriceSortButtons["item"] + else + button = PriceSortButtons[id] + end + + if reset and reset ~= "Clear" then -- reset is useful for check boxes when you don't want it repeatedly reversing the sort + button.Ascend = button.Ascend + else + button.Ascend = not button.Ascend + end + for k, v in pairs(PriceSortButtons) do + if v ~= button then + v.Ascend = nil + end + end + table.sort(core.PriceTable, function(a, b) + if button.Ascend then + if id == "minbid" then + return a[button.Id] > b[button.Id] + else + return a[button.Id] < b[button.Id] + end + else + if id == "minbid" then + return a[button.Id] < b[button.Id] + else + return a[button.Id] > b[button.Id] + end + end + end) + core.currentSort = id; + MonDKP:PriceTable_Update(0) + +end + +function MonDKP:PriceTab_Create() + + local numOfRows = core.PriceNumRows; + local PriceSortButtons = core.PriceSortButtons + + MonDKP.ConfigTab7.header = MonDKP.ConfigTab7:CreateFontString(nil, "OVERLAY"); + MonDKP.ConfigTab7.header:ClearAllPoints(); + MonDKP.ConfigTab7.header:SetPoint("TOPLEFT", MonDKP.ConfigTab7, "TOPLEFT", 15, -10); + MonDKP.ConfigTab7.header:SetFontObject("MonDKPLargeCenter"); + MonDKP.ConfigTab7.header:SetText(L["PRICETITLE"]); + MonDKP.ConfigTab7.header:SetScale(1.2); + + MonDKP.ConfigTab7.description = MonDKP.ConfigTab7:CreateFontString(nil, "OVERLAY"); + MonDKP.ConfigTab7.description:ClearAllPoints(); + MonDKP.ConfigTab7.description:SetPoint("TOPLEFT", MonDKP.ConfigTab7.header, "BOTTOMLEFT", 7, -10); + MonDKP.ConfigTab7.description:SetWidth(400); + MonDKP.ConfigTab7.description:SetFontObject("MonDKPNormalLeft"); + MonDKP.ConfigTab7.description:SetText(L["PRICEDESC"]); + + MonDKP.ConfigTab7.PriceTable = CreateFrame("ScrollFrame", "MonDKPPriceScrollFrame", MonDKP.ConfigTab7, "FauxScrollFrameTemplate") + MonDKP.ConfigTab7.PriceTable:SetSize(core.TableWidth, core.TableRowHeight*numOfRows) + MonDKP.ConfigTab7.PriceTable:SetPoint("TOPLEFT", 0, -95) + MonDKP.ConfigTab7.PriceTable:SetBackdrop( { + bgFile = "Textures\\white.blp", tile = true, -- White backdrop allows for black background with 1.0 alpha on low alpha containers + edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 2, + insets = { left = 0, right = 0, top = 0, bottom = 0 } + }); + + MonDKP.ConfigTab7.PriceTable:SetBackdropColor(0,0,0,0.4); + MonDKP.ConfigTab7.PriceTable:SetBackdropBorderColor(1,1,1,0.5) + MonDKP.ConfigTab7.PriceTable:SetClipsChildren(false); + + MonDKP.ConfigTab7.PriceTable.ScrollBar = FauxScrollFrame_GetChildFrames(MonDKP.ConfigTab7.PriceTable) + MonDKP.ConfigTab7.PriceTable.Rows = {} + + for i=1, numOfRows do + MonDKP.ConfigTab7.PriceTable.Rows[i] = CreateRow(MonDKP.ConfigTab7.PriceTable, i) + if i==1 then + MonDKP.ConfigTab7.PriceTable.Rows[i]:SetPoint("TOPLEFT", MonDKP.ConfigTab7.PriceTable, "TOPLEFT", 0, -2) + else + MonDKP.ConfigTab7.PriceTable.Rows[i]:SetPoint("TOPLEFT", MonDKP.ConfigTab7.PriceTable.Rows[i-1], "BOTTOMLEFT") + end + end + + MonDKP.ConfigTab7.PriceTable:SetScript("OnVerticalScroll", function(self, offset) + FauxScrollFrame_OnVerticalScroll(self, offset, core.TableRowHeight, MonDKP:PriceTable_Update(offset)) + end) + + MonDKP.ConfigTab7.PriceTable.Headers = CreateFrame("Frame", "MonDKPPriceTableHeaders", MonDKP.ConfigTab7) + MonDKP.ConfigTab7.PriceTable.Headers:SetSize(500, 22) + MonDKP.ConfigTab7.PriceTable.Headers:SetPoint("BOTTOMLEFT", MonDKP.ConfigTab7.PriceTable, "TOPLEFT", 0, 1) + MonDKP.ConfigTab7.PriceTable.Headers:SetBackdrop({ + bgFile = "Textures\\white.blp", tile = true, + edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 2, + }); + MonDKP.ConfigTab7.PriceTable.Headers:SetBackdropColor(0,0,0,0.8); + MonDKP.ConfigTab7.PriceTable.Headers:SetBackdropBorderColor(1,1,1,0.5) + MonDKP.ConfigTab7.PriceTable.Headers:Show() + + PriceSortButtons.item = CreateFrame("Button", "$ParentPriceSortButtonItem", MonDKP.ConfigTab7.PriceTable.Headers) + PriceSortButtons.disenchants = CreateFrame("Button", "$ParentPriceSortButtonDisenchants", MonDKP.ConfigTab7.PriceTable.Headers) + PriceSortButtons.minbid = CreateFrame("Button", "$ParentPriceSortButtonDkp", MonDKP.ConfigTab7.PriceTable.Headers) + + PriceSortButtons.minbid:SetPoint("BOTTOM", MonDKP.ConfigTab7.PriceTable.Headers, "BOTTOM", 130, 2) + PriceSortButtons.item:SetPoint("RIGHT", PriceSortButtons.minbid, "LEFT", 0, 0) + PriceSortButtons.disenchants:SetPoint("LEFT", PriceSortButtons.minbid, "RIGHT") + + for k, v in pairs(PriceSortButtons) do + v.Id = k + v:SetHighlightTexture("Interface\\BUTTONS\\BlueGrad64_faded.blp"); + if k == "minbid" then + v:SetSize((60), core.TableRowHeight) + elseif k == "item" then + v:SetSize((370), core.TableRowHeight) + else + v:SetSize((70), core.TableRowHeight) + end + v:SetScript("OnClick", function(self) MonDKP:PriceListSort(self.Id, "Clear") end) + end + + --PriceSortButtons.item:SetSize((370), core.TableRowHeight) + --PriceSortButtons.disenchants:SetSize((70), core.TableRowHeight) + --PriceSortButtons.minbid:SetSize((60), core.TableRowHeight) + + PriceSortButtons.item.t = PriceSortButtons.item:CreateFontString(nil, "OVERLAY") + PriceSortButtons.item.t:SetFontObject("MonDKPNormal") + PriceSortButtons.item.t:SetTextColor(1, 1, 1, 1); + PriceSortButtons.item.t:SetPoint("LEFT", PriceSortButtons.item, "LEFT", 50, 0); + PriceSortButtons.item.t:SetText("Item Name"); + + PriceSortButtons.disenchants.t = PriceSortButtons.disenchants:CreateFontString(nil, "OVERLAY") + PriceSortButtons.disenchants.t:SetFontObject("MonDKPNormal"); + PriceSortButtons.disenchants.t:SetTextColor(1, 1, 1, 1); + PriceSortButtons.disenchants.t:SetPoint("CENTER", PriceSortButtons.disenchants, "CENTER", 0, 0); + PriceSortButtons.disenchants.t:SetText("Disenchants"); + + PriceSortButtons.minbid.t = PriceSortButtons.minbid:CreateFontString(nil, "OVERLAY") + PriceSortButtons.minbid.t:SetFontObject("MonDKPNormal") + PriceSortButtons.minbid.t:SetTextColor(1, 1, 1, 1); + PriceSortButtons.minbid.t:SetPoint("CENTER", PriceSortButtons.minbid, "CENTER", 0, 0); + PriceSortButtons.minbid.t:SetText("DKP"); + core.PriceSortButtons = PriceSortButtons; + + MonDKP:PriceTable_Update(0) +end \ No newline at end of file diff --git a/Modules/Sync.lua b/Modules/Sync.lua index bdfe9141..b7df837d 100644 --- a/Modules/Sync.lua +++ b/Modules/Sync.lua @@ -220,7 +220,7 @@ function MonDKP_BroadcastFull_Init() end if core.Broadcast.fullCheckbox:GetChecked() == true then - tempTable = { DKPTable=MonDKP_DKPTable, DKP=MonDKP_DKPHistory, Loot=MonDKP_Loot, Archive=MonDKP_Archive } + tempTable = { DKPTable=MonDKP_DKPTable, DKP=MonDKP_DKPHistory, Loot=MonDKP_Loot, Archive=MonDKP_Archive, MinBids=MonDKP_MinBids } elseif core.Broadcast.mergeCheckbox:GetChecked() == true then tempTable = MonDKP_MergeTable_Create() end diff --git a/Modules/comm.lua b/Modules/comm.lua index fef6c423..53774e51 100644 --- a/Modules/comm.lua +++ b/Modules/comm.lua @@ -66,6 +66,7 @@ function MonDKP.Sync:OnEnable() MonDKP.Sync:RegisterComm("MonDKPBidShare", MonDKP.Sync:OnCommReceived()) -- broadcast accepted bids MonDKP.Sync:RegisterComm("MonDKPBidder", MonDKP.Sync:OnCommReceived()) -- Submit bids MonDKP.Sync:RegisterComm("MonDKPAllTabs", MonDKP.Sync:OnCommReceived()) -- Full table broadcast + MonDKP.Sync:RegisterComm("MonDKPSetPrice", MonDKP.Sync:OnCommReceived()) -- Set Single Item Price --MonDKP.Sync:RegisterComm("MonDKPEditLoot", MonDKP.Sync:OnCommReceived()) -- not in use --MonDKP.Sync:RegisterComm("MonDKPDataSync", MonDKP.Sync:OnCommReceived()) -- not in use --MonDKP.Sync:RegisterComm("MonDKPDKPLogSync", MonDKP.Sync:OnCommReceived()) -- not in use @@ -289,17 +290,21 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) if (sender ~= UnitName("player")) then if prefix == "MonDKPLootDist" or prefix == "MonDKPDKPDist" or prefix == "MonDKPDelLoot" or prefix == "MonDKPDelSync" or prefix == "MonDKPMinBid" or prefix == "MonDKPWhitelist" or prefix == "MonDKPDKPModes" or prefix == "MonDKPStand" or prefix == "MonDKPZSumBank" or prefix == "MonDKPBossLoot" or prefix == "MonDKPDecay" or prefix == "MonDKPDelUsers" or - prefix == "MonDKPAllTabs" or prefix == "MonDKPBidShare" or prefix == "MonDKPMerge" then + prefix == "MonDKPAllTabs" or prefix == "MonDKPBidShare" or prefix == "MonDKPMerge" or prefix == "MonDKPSetPrice" then decoded = LibDeflate:DecompressDeflate(LibDeflate:DecodeForWoWAddonChannel(message)) local success, deserialized = LibAceSerializer:Deserialize(decoded); if success then if prefix == "MonDKPAllTabs" then -- receives full table broadcast + print("[MonolithDKP] COMMS: Full Broadcast Receive Started"); table.sort(deserialized.Loot, function(a, b) return a["date"] > b["date"] end) table.sort(deserialized.DKP, function(a, b) return a["date"] > b["date"] end) + table.sort(deserialized.MinBids, function(a, b) + return a["item"] < b["item"] + end) if (#MonDKP_DKPHistory > 0 and #MonDKP_Loot > 0) and (deserialized.DKP[1].date < MonDKP_DKPHistory[1].date or deserialized.Loot[1].date < MonDKP_Loot[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" @@ -313,14 +318,17 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) MonDKP_DKPTable = deserialized.DKPTable MonDKP_DKPHistory = deserialized.DKP MonDKP_Loot = deserialized.Loot - MonDKP_Archive = deserialized.Archive + MonDKP_MinBids = deserialized.MinBids if MonDKP.ConfigTab6 and MonDKP.ConfigTab6.history and MonDKP.ConfigTab6:IsShown() then MonDKP:DKPHistory_Update(true) elseif MonDKP.ConfigTab5 and MonDKP.ConfigTab5:IsShown() then MonDKP:LootHistory_Reset() MonDKP:LootHistory_Update(L["NOFILTER"]); + elseif MonDKP.ConfigTab7 and MonDKP.ConfigTab7:IsShown() then + core.PriceTable = MonDKP_MinBids; + MonDKP:PriceTable_Update(0); end if core.ClassGraph then MonDKP:ClassGraph_Update() @@ -340,7 +348,7 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) MonDKP_DKPTable = deserialized.DKPTable MonDKP_DKPHistory = deserialized.DKP MonDKP_Loot = deserialized.Loot - + MonDKP_MinBids = deserialized.MinBids MonDKP_Archive = deserialized.Archive if MonDKP.ConfigTab6 and MonDKP.ConfigTab6.history and MonDKP.ConfigTab6:IsShown() then @@ -348,6 +356,9 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) elseif MonDKP.ConfigTab5 and MonDKP.ConfigTab5:IsShown() then MonDKP:LootHistory_Reset() MonDKP:LootHistory_Update(L["NOFILTER"]); + elseif MonDKP.ConfigTab7 and MonDKP.ConfigTab7:IsShown() then + core.PriceTable = MonDKP_MinBids; + MonDKP:PriceTable_Update(0); end if core.ClassGraph then MonDKP:ClassGraph_Update() @@ -357,6 +368,7 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) MonDKP:FilterDKPTable(core.currentSort, "reset") MonDKP:StatusVerify_Update() end + print("[MonolithDKP] COMMS: Full Broadcast Receive Finished"); return elseif prefix == "MonDKPMerge" then for i=1, #deserialized.DKP do @@ -671,6 +683,12 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) local search = MonDKP:Table_Search(MonDKP_MinBids, deserialized[2][i].item) if search then MonDKP_MinBids[search[1][1]].minbid = deserialized[2][i].minbid + if deserialized[2][i]["link"] ~= nil then + MonDKP_MinBids[search[1][1]].link = deserialized[2][i].link + end + if deserialized[2][i]["icon"] ~= nil then + MonDKP_MinBids[search[1][1]].icon = deserialized[2][i].icon + end else table.insert(MonDKP_MinBids, deserialized[2][i]) end @@ -693,6 +711,21 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender) MonDKP_Whitelist = deserialized; elseif prefix == "MonDKPStand" then MonDKP_Standby = deserialized; + elseif prefix == "MonDKPSetPrice" then + local mode = MonDKP_DB.modes.mode; + + if mode == "Static Item Values" or mode == "Roll Based Bidding" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static") then + local search = MonDKP:Table_Search(MonDKP_MinBids, itemName) + + if not search then + tinsert(MonDKP_MinBids, deserialized) + elseif search and cost ~= tonumber(val) then + MonDKP_MinBids[search[1][1]] = deserialized; + end + + MonDKP:PriceTable_Update(0); + end + elseif prefix == "MonDKPZSumBank" then if core.IsOfficer then MonDKP_DB.modes.ZeroSumBank = deserialized; @@ -742,6 +775,12 @@ function MonDKP.Sync:SendData(prefix, data, target) --if prefix ~= "MDKPProfile" then print("|cff00ff00Sent: "..prefix.."|r") end if data == nil or data == "" then data = " " end -- just in case, to prevent disconnects due to empty/nil string AddonMessages + --AceComm Communication doesn't work if the prefix is longer than 15. And if sucks if you try. + if #prefix > 15 then + MonDKP:Print("MonolithDKP Error: Prefix ["..prefix.."] is longer than 15. Please shorten."); + return; + end + -- non officers / not encoded if IsInGuild() then if prefix == "MonDKPQuery" or prefix == "MonDKPBuild" or prefix == "MonDKPTalents" or prefix == "MonDKPRoles" then @@ -752,12 +791,10 @@ function MonDKP.Sync:SendData(prefix, data, target) return; end end - -- officers if IsInGuild() and core.IsOfficer then local serialized = nil; local packet = nil; - if prefix == "MonDKPCommand" or prefix == "MonDKPRaidTime" then MonDKP.Sync:SendCommMessage(prefix, data, "RAID") return; @@ -771,7 +808,6 @@ function MonDKP.Sync:SendData(prefix, data, target) if data then serialized = LibAceSerializer:Serialize(data); -- serializes tables to a string end - local compressed = LibDeflate:CompressDeflate(serialized, {level = 9}) if compressed then packet = LibDeflate:EncodeForWoWAddonChannel(compressed) @@ -791,7 +827,6 @@ function MonDKP.Sync:SendData(prefix, data, target) end return end - if target then MonDKP.Sync:SendCommMessage(prefix, packet, "WHISPER", target) else diff --git a/MonolithDKP.lua b/MonolithDKP.lua index 4b40dc81..383f7736 100644 --- a/MonolithDKP.lua +++ b/MonolithDKP.lua @@ -34,9 +34,9 @@ function MonDKP:Toggle() -- toggles IsShown() state of MonDKP.UIConfig, t end --core.IsOfficer = C_GuildInfo.CanEditOfficerNote() -- seemingly removed from classic API if core.IsOfficer == false then - for i=2, 3 do - _G["MonDKPMonDKP.ConfigTabMenuTab"..i]:Hide(); - end + _G["MonDKPMonDKP.ConfigTabMenuTab2"]:Hide(); --Adjust DKP + _G["MonDKPMonDKP.ConfigTabMenuTab3"]:Hide(); -- Manage + --_G["MonDKPMonDKP.ConfigTabMenuTab7"]:Hide(); -- Loot Prices _G["MonDKPMonDKP.ConfigTabMenuTab4"]:SetPoint("TOPLEFT", _G["MonDKPMonDKP.ConfigTabMenuTab1"], "TOPRIGHT", -14, 0) _G["MonDKPMonDKP.ConfigTabMenuTab5"]:SetPoint("TOPLEFT", _G["MonDKPMonDKP.ConfigTabMenuTab4"], "TOPRIGHT", -14, 0) _G["MonDKPMonDKP.ConfigTabMenuTab6"]:SetPoint("TOPLEFT", _G["MonDKPMonDKP.ConfigTabMenuTab5"], "TOPRIGHT", -14, 0) @@ -474,7 +474,7 @@ function MonDKP:CreateMenu() MonDKP.UIConfig.expand.trigger:SetPoint("CENTER", MonDKP.UIConfig.expand, "CENTER", 0, 0) MonDKP.UIConfig.expand.trigger:SetScript("OnClick", function(self) if core.ShowState == false then - MonDKP.UIConfig:SetWidth(1050) + MonDKP.UIConfig:SetWidth(1106) MonDKP.UIConfig.TabMenu:Show() MonDKP.UIConfig.expandtab:SetTexture("Interface\\AddOns\\MonolithDKP\\Media\\Textures\\collapse-arrow"); else diff --git a/MonolithDKP.toc b/MonolithDKP.toc index 71489bea..e20d8e4f 100644 --- a/MonolithDKP.toc +++ b/MonolithDKP.toc @@ -28,6 +28,7 @@ Modules\LootHistory.lua Modules\DKPHistory.lua ConfigMenuTabs.lua Modules\Award.lua +Modules\LootPriceTab.lua Modules\AdjustDKP.lua Modules\ManageEntries.lua Modules\ClassGraph.lua @@ -43,4 +44,4 @@ Modules\exportDKP.lua Modules\Repair.lua Modules\RaidTimer.lua Modules\ZeroSumBank.lua -Modules\Validate.lua +Modules\Validate.lua \ No newline at end of file diff --git a/init.lua b/init.lua index b2ee9203..18e0fee6 100644 --- a/init.lua +++ b/init.lua @@ -76,8 +76,10 @@ MonDKP.Commands = { local item = strjoin(" ", ...) if not item then return end item = name.." "..item; - - MonDKP:AwardConfirm(nil, 0, MonDKP_DB.bossargs.LastKilledBoss, MonDKP_DB.bossargs.CurrentRaidZone, item) + local itemName,itemLink,_,_,_,_,_,_,_,_ = GetItemInfo(item) + local search = MonDKP:Table_Search(MonDKP_MinBids, itemName) + local cost = MonDKP_MinBids[search[1][1]].minbid or MonDKP:GetMinBid(itemLink); + MonDKP:AwardConfirm(nil, cost, MonDKP_DB.bossargs.LastKilledBoss, MonDKP_DB.bossargs.CurrentRaidZone, item) else MonDKP:Print(L["NOPERMISSION"]) end @@ -256,7 +258,7 @@ function MonDKP_OnEvent(self, event, arg1, ...) MonDKP:CheckOfficer() MonDKP:SortLootTable() MonDKP:SortDKPHistoryTable() - MonDKP:Print(L["VERSION"].." "..core.MonVersion..", "..L["CREATEDMAINTAIN"].." Roeshambo@Stalagg-PvP"); + MonDKP:Print(L["VERSION"].." "..core.MonVersion..", "..L["CREATEDMAINTAIN"].." Kyliee@BloodsailBuccaneers-Classic"); MonDKP:Print(L["LOADED"].." "..#MonDKP_DKPTable.." "..L["PLAYERRECORDS"]..", "..#MonDKP_Loot.." "..L["LOOTHISTRECORDS"].." "..#MonDKP_DKPHistory.." "..L["DKPHISTRECORDS"].."."); MonDKP:Print(L["USE"].." /dkp ? "..L["SUBMITBUGS"].." @ https://github.com/Roeshambo/MonolithDKP/issues"); MonDKP.Sync:SendData("MonDKPBuild", tostring(core.BuildNumber)) -- broadcasts build number to guild to check if a newer version is available @@ -534,7 +536,8 @@ function MonDKP:OnInitialize(event, name) -- This is the FIRST function to run ------------------------------------ -- Import SavedVariables ------------------------------------ - core.WorkingTable = MonDKP_DKPTable; -- imports full DKP table to WorkingTable for list manipulation + core.WorkingTable = MonDKP_DKPTable; -- imports full DKP table to WorkingTable for list manipulation + core.PriceTable = MonDKP_MinBids; core.CurrentRaidZone = MonDKP_DB.bossargs.CurrentRaidZone; -- stores raid zone as a redundency core.LastKilledBoss = MonDKP_DB.bossargs.LastKilledBoss; -- stores last boss killed as a redundency core.LastKilledNPC = MonDKP_DB.bossargs.LastKilledNPC -- Stores last 30 mobs killed in raid. @@ -544,6 +547,10 @@ function MonDKP:OnInitialize(event, name) -- This is the FIRST function to run return a["player"] < b["player"] end) + table.sort(core.PriceTable, function(a, b) + return a["item"] < b["item"] + end) + MonDKP:StartBidTimer("seconds", nil) -- initiates timer frame for use if MonDKP.BidTimer then MonDKP.BidTimer:SetScript("OnUpdate", nil) end