Skip to content

Commit

Permalink
Adding Loot Pricing Tab and Disenchant Counter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vapok committed May 18, 2020
1 parent addd37f commit a6761fc
Show file tree
Hide file tree
Showing 12 changed files with 498 additions and 51 deletions.
20 changes: 15 additions & 5 deletions ConfigMenuTabs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 }
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -245,6 +249,12 @@ function MonDKP:ConfigMenuTabs()

MonDKP:AdjustDKPTab_Create()

---------------------------------------
-- Price TAB
---------------------------------------

MonDKP:PriceTab_Create()

---------------------------------------
-- Manage DKP TAB
---------------------------------------
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions Libs/AceComm-3.0/AceComm-3.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 "")
Expand All @@ -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
Expand All @@ -117,15 +116,13 @@ 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)

-- 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

Expand Down
3 changes: 3 additions & 0 deletions Localization/Localization.en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
80 changes: 61 additions & 19 deletions Modules/Award.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down Expand Up @@ -111,14 +140,14 @@ 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)
MonDKP:LootHistory_Reset();
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)
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
12 changes: 9 additions & 3 deletions Modules/Bidding.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();

Expand Down
Loading

0 comments on commit a6761fc

Please sign in to comment.