Skip to content

Commit

Permalink
Merge pull request Roeshambo#319 from quiqua/fix-display-of-current-i…
Browse files Browse the repository at this point in the history
…tem-icon

Set max DKP/Perc value when updating the current item
  • Loading branch information
Roeshambo authored Mar 5, 2020
2 parents 52a45d8 + 2461bcb commit 0f5f77d
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions Modules/Bidding.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function MonDKP_CHAT_MSG_WHISPER(text, ...)
SendChatMessage(L["INVALIDPLAYER"], "WHISPER", nil, name)
return
end

if (tonumber(cmd) and (core.BiddingWindow.maxBid == nil or tonumber(cmd) <= core.BiddingWindow.maxBid:GetNumber() or core.BiddingWindow.maxBid:GetNumber() == 0)) or ((mode == "Static Item Values" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static")) and not cmd) then
if dkp then
if (cmd and cmd <= dkp) or (MonDKP_DB.modes.SubZeroBidding == true and dkp >= 0) or (MonDKP_DB.modes.SubZeroBidding == true and MonDKP_DB.modes.AllowNegativeBidders == true) or (mode == "Static Item Values" and dkp > 0 and (dkp > core.BiddingWindow.cost:GetNumber() or MonDKP_DB.modes.SubZeroBidding == true or MonDKP_DB.modes.costvalue == "Percent")) or ((mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static") and not cmd) then
Expand Down Expand Up @@ -208,7 +208,7 @@ function MonDKP_CHAT_MSG_WHISPER(text, ...)
MonDKP:BroadcastBidTimer(core.BiddingWindow.bidTimer:GetText().."{"..MonDKP_DB.modes.AntiSnipe, core.BiddingWindow.item:GetText().." Min Bid: "..core.BiddingWindow.minBid:GetText(), core.BiddingWindow.itemIcon:GetTexture());
end
end

BidScrollFrame_Update()
else
response = L["BIDDENIEDMINBID"].." "..core.BiddingWindow.minBid:GetNumber().."!"
Expand All @@ -231,7 +231,7 @@ function MonDKP_CHAT_MSG_WHISPER(text, ...)
SendChatMessage(response, "WHISPER", nil, name)
else
SendChatMessage(L["NOBIDINPROGRESS"], "WHISPER", nil, name)
end
end
elseif string.find(text, "!dkp") == 1 and core.IsOfficer == true then
cmd = tostring(BidCmd(text))

Expand Down Expand Up @@ -260,7 +260,7 @@ function MonDKP_CHAT_MSG_WHISPER(text, ...)
else
minimum = MonDKP_DKPTable[search[1][1]].dkp * (MonDKP_DB.modes.rolls.min / 100);
end

perc = " ("..MonDKP_DB.modes.rolls.min.."% - "..MonDKP_DB.modes.rolls.max.."%)";
maximum = MonDKP_DKPTable[search[1][1]].dkp * (MonDKP_DB.modes.rolls.max / 100) + MonDKP_DB.modes.rolls.AddToMax;
elseif not MonDKP_DB.modes.rolls.UsePerc then
Expand Down Expand Up @@ -323,7 +323,7 @@ function MonDKP_CHAT_MSG_WHISPER(text, ...)
return true
end
end

if strfind(msg, "!dkp") == 1 and MonDKP_DB.defaults.SupressTells then
return true
end
Expand Down Expand Up @@ -425,7 +425,7 @@ function MonDKP:ToggleBidWindow(loot, lootIcon, itemName)

core.BiddingWindow:SetShown(true)
core.BiddingWindow:SetFrameLevel(10)

if MonDKP_DB.modes.mode == "Zero Sum" then
core.ZeroSumBank = core.ZeroSumBank or MonDKP:ZeroSumBank_Create()
core.ZeroSumBank:SetShown(true)
Expand Down Expand Up @@ -481,7 +481,7 @@ function MonDKP:ToggleBidWindow(loot, lootIcon, itemName)
core.BiddingWindow.minBid:SetText(MonDKP:GetMinBid(CurrItemForBid))
end
end)

core.BiddingWindow.CustomMaxBid:Show();
core.BiddingWindow.CustomMaxBid:SetChecked(true)
core.BiddingWindow.CustomMaxBid:SetScript("OnClick", function(self)
Expand Down Expand Up @@ -560,7 +560,7 @@ local function StartBidding()
local val_min = MonDKP:GetMinBid(CurrItemForBid);
local search_max = MonDKP:Table_Search(MonDKP_MaxBids, core.BiddingWindow.itemName:GetText())
local val_max = MonDKP:GetMaxBid(CurrItemForBid);

-- Min
if not search_min and core.BiddingWindow.minBid:GetNumber() ~= tonumber(val_min) then
tinsert(MonDKP_MinBids, {item=core.BiddingWindow.itemName:GetText(), minbid=core.BiddingWindow.minBid:GetNumber()})
Expand All @@ -578,7 +578,7 @@ local function StartBidding()
table.remove(MonDKP_MinBids, 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_MaxBids, {item=core.BiddingWindow.itemName:GetText(), maxbid=core.BiddingWindow.maxBid:GetNumber()})
Expand Down Expand Up @@ -608,7 +608,7 @@ local function StartBidding()
events:RegisterEvent("CHAT_MSG_SYSTEM")
events:SetScript("OnEvent", Roll_OnEvent);
end

if CurrItemForBid then
local channels = {};
local channelText = "";
Expand Down Expand Up @@ -745,7 +745,7 @@ end

function MonDKP_Register_ShiftClickLootWindowHook() -- hook function into LootFrame window. All slots on ElvUI. But only first 4 in default UI.
local num = GetNumLootItems();

if getglobal("ElvLootSlot1") then -- fixes hook for ElvUI loot frame
for i = 1, num do
local searchHook = MonDKP:Table_Search(hookedSlots, i) -- blocks repeated hooking
Expand Down Expand Up @@ -861,7 +861,7 @@ function MonDKP:StartBidTimer(seconds, title, itemIcon)
else
MonDKP.BidTimer:SetPoint("CENTER") -- sets to center if no position has been saved
end

MonDKP.BidTimer:SetScript("OnUpdate", function(self, elapsed)
timer = timer + elapsed
Timer = timer; -- stores external copy of timer for extending
Expand Down Expand Up @@ -889,7 +889,7 @@ function MonDKP:StartBidTimer(seconds, title, itemIcon)
else
MonDKP.BidTimer:SetStatusBarColor(0, 0.8, 0)
end

if tonumber(timerText) == 10 and messageSent[1] == false then
if audioPlayed == false then
PlaySound(23639);
Expand Down Expand Up @@ -928,7 +928,7 @@ function MonDKP:StartBidTimer(seconds, title, itemIcon)
_G["MonDKPBiddingStartBiddingButton"]:SetText(L["STARTBIDDING"])
_G["MonDKPBiddingStartBiddingButton"]:SetScript("OnClick", function (self)
local pass, err = pcall(ToggleTimerBtn, self)

if core.BiddingWindow.minBid then core.BiddingWindow.minBid:ClearFocus(); end
core.BiddingWindow.bidTimer:ClearFocus()
core.BiddingWindow.boss:ClearFocus()
Expand Down Expand Up @@ -1003,7 +1003,7 @@ function MonDKP:CreateTimer()
f.border:SetFrameLevel(19)
f.border:SetSize(300, 25);
f.border:SetBackdrop( {
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 2,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 2,
insets = { left = 0, right = 0, top = 0, bottom = 0 }
});
f.border:SetBackdropColor(0,0,0,0);
Expand Down Expand Up @@ -1069,7 +1069,7 @@ end

local function RightClickMenu(self)
local menu;

menu = {
{ text = L["REMOVEENTRY"], notCheckable = true, func = function()
if Bids_Submitted[self.index].bid then
Expand Down Expand Up @@ -1103,7 +1103,7 @@ local function BidWindowCreateRow(parent, id) -- Create 3 buttons for each row i
for i=1, 3 do
f.Strings[i] = f:CreateFontString(nil, "OVERLAY");
f.Strings[i]:SetTextColor(1, 1, 1, 1);
if i==1 then
if i==1 then
f.Strings[i]:SetFontObject("MonDKPNormalLeft");
else
f.Strings[i]:SetFontObject("MonDKPNormalCenter");
Expand Down Expand Up @@ -1225,7 +1225,7 @@ function MonDKP:CreateBidWindow()
f:SetClampedToScreen(true)
f: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 = 3,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 3,
insets = { left = 0, right = 0, top = 0, bottom = 0 }
});
f:SetBackdropColor(0,0,0,0.9);
Expand Down Expand Up @@ -1265,15 +1265,15 @@ function MonDKP:CreateBidWindow()
f.closeContainer:SetPoint("CENTER", f, "TOPRIGHT", -4, 0)
f.closeContainer:SetBackdrop({
bgFile = "Textures\\white.blp", tile = true,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 2,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 2,
});
f.closeContainer:SetBackdropColor(0,0,0,0.9)
f.closeContainer:SetBackdropBorderColor(1,1,1,0.2)
f.closeContainer:SetSize(28, 28)

f.closeBtn = CreateFrame("Button", nil, f, "UIPanelCloseButton")
f.closeBtn:SetPoint("CENTER", f.closeContainer, "TOPRIGHT", -14, -14)

if core.IsOfficer then
f.bossHeader = f:CreateFontString(nil, "OVERLAY")
f.bossHeader:SetFontObject("MonDKPLargeRight");
Expand All @@ -1288,7 +1288,7 @@ function MonDKP:CreateBidWindow()
f.boss:SetTextInsets(10, 15, 5, 5)
f.boss:SetBackdrop({
bgFile = "Textures\\white.blp", tile = true,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile", tile = true, tileSize = 32, edgeSize = 2,
});
f.boss:SetBackdropColor(0,0,0,0.6)
f.boss:SetBackdropBorderColor(1,1,1,0.6)
Expand Down Expand Up @@ -1338,13 +1338,13 @@ function MonDKP:CreateBidWindow()
f.minBidHeader:SetFontObject("MonDKPLargeRight");
f.minBidHeader:SetScale(0.7)
f.minBidHeader:SetPoint("TOP", f.itemHeader, "BOTTOM", -30, -25);

if mode == "Minimum Bid Values" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Minimum Bid") then
-- Min Bid
f.minBidHeader:SetText(L["MINIMUMBID"]..": ")

f.minBid = CreateFrame("EditBox", nil, f)
f.minBid:SetPoint("LEFT", f.minBidHeader, "RIGHT", 8, 0)
f.minBid:SetPoint("LEFT", f.minBidHeader, "RIGHT", 8, 0)
f.minBid:SetAutoFocus(false)
f.minBid:SetMultiLine(false)
f.minBid:SetSize(70, 28)
Expand Down Expand Up @@ -1403,9 +1403,9 @@ function MonDKP:CreateBidWindow()
f.maxBidHeader:SetScale(0.7)
f.maxBidHeader:SetPoint("TOP", f.minBidHeader, "BOTTOM", -2, -25);
f.maxBidHeader:SetText(L["MAXIMUMBID"]..": ")

f.maxBid = CreateFrame("EditBox", nil, f)
f.maxBid:SetPoint("LEFT", f.maxBidHeader, "RIGHT", 8, 0)
f.maxBid:SetPoint("LEFT", f.maxBidHeader, "RIGHT", 8, 0)
f.maxBid:SetAutoFocus(false)
f.maxBid:SetMultiLine(false)
f.maxBid:SetSize(70, 28)
Expand Down Expand Up @@ -1468,7 +1468,7 @@ function MonDKP:CreateBidWindow()
f.bidTimerHeader:SetText(L["BIDTIMER"]..": ")

f.bidTimer = CreateFrame("EditBox", nil, f)
f.bidTimer:SetPoint("LEFT", f.bidTimerHeader, "RIGHT", 8, 0)
f.bidTimer:SetPoint("LEFT", f.bidTimerHeader, "RIGHT", 8, 0)
f.bidTimer:SetAutoFocus(false)
f.bidTimer:SetMultiLine(false)
f.bidTimer:SetSize(70, 28)
Expand Down Expand Up @@ -1579,7 +1579,7 @@ function MonDKP:CreateBidWindow()
f.bidTable:SetSize(width, height*numrows+3)
f.bidTable:SetBackdrop({
bgFile = "Textures\\white.blp", tile = true,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 2,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 2,
});
f.bidTable:SetBackdropColor(0,0,0,0.2)
f.bidTable:SetBackdropBorderColor(1,1,1,0.4)
Expand All @@ -1590,7 +1590,7 @@ function MonDKP:CreateBidWindow()
f.bidTable.Rows[i] = BidWindowCreateRow(f.bidTable, i)
if i==1 then
f.bidTable.Rows[i]:SetPoint("TOPLEFT", f.bidTable, "TOPLEFT", 0, -3)
else
else
f.bidTable.Rows[i]:SetPoint("TOPLEFT", f.bidTable.Rows[i-1], "BOTTOMLEFT")
end
end
Expand All @@ -1600,7 +1600,7 @@ function MonDKP:CreateBidWindow()

---------------------------------------
-- Header Buttons
---------------------------------------
---------------------------------------
local headerButtons = {}
mode = MonDKP_DB.modes.mode;

Expand All @@ -1609,7 +1609,7 @@ function MonDKP:CreateBidWindow()
f.BidTable_Headers:SetPoint("BOTTOMLEFT", f.bidTable, "TOPLEFT", 0, 1)
f.BidTable_Headers:SetBackdrop({
bgFile = "Textures\\white.blp", tile = true,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 2,
edgeFile = "Interface\\AddOns\\MonolithDKP\\Media\\Textures\\edgefile.tga", tile = true, tileSize = 1, edgeSize = 2,
});
f.BidTable_Headers:SetBackdropColor(0,0,0,0.8);
f.BidTable_Headers:SetBackdropBorderColor(1,1,1,0.5)
Expand Down Expand Up @@ -1642,25 +1642,25 @@ function MonDKP:CreateBidWindow()
v:SetSize((width/4)-1, height)
end
end

end
end

headerButtons.player.t = headerButtons.player:CreateFontString(nil, "OVERLAY")
headerButtons.player.t:SetFontObject("MonDKPNormalLeft")
headerButtons.player.t:SetTextColor(1, 1, 1, 1);
headerButtons.player.t:SetPoint("LEFT", headerButtons.player, "LEFT", 20, 0);
headerButtons.player.t:SetText(L["PLAYER"]);
headerButtons.player.t:SetText(L["PLAYER"]);

headerButtons.bid.t = headerButtons.bid:CreateFontString(nil, "OVERLAY")
headerButtons.bid.t:SetFontObject("MonDKPNormal");
headerButtons.bid.t:SetTextColor(1, 1, 1, 1);
headerButtons.bid.t:SetPoint("CENTER", headerButtons.bid, "CENTER", 0, 0);

if mode == "Minimum Bid Values" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Minimum Bid") then
headerButtons.bid.t:SetText(L["BID"]);
headerButtons.bid.t:SetText(L["BID"]);
elseif mode == "Static Item Values" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static") then
headerButtons.bid.t:Hide();
headerButtons.bid.t:Hide();
elseif mode == "Roll Based Bidding" then
headerButtons.bid.t:SetText(L["PLAYERROLL"])
end
Expand All @@ -1669,21 +1669,21 @@ function MonDKP:CreateBidWindow()
headerButtons.dkp.t:SetFontObject("MonDKPNormal")
headerButtons.dkp.t:SetTextColor(1, 1, 1, 1);
headerButtons.dkp.t:SetPoint("CENTER", headerButtons.dkp, "CENTER", 0, 0);

if mode == "Minimum Bid Values" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Minimum Bid") then
headerButtons.dkp.t:SetText(L["TOTALDKP"]);
elseif mode == "Static Item Values" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static") then
headerButtons.dkp.t:SetText(L["DKP"]);
elseif mode == "Roll Based Bidding" then
headerButtons.dkp.t:SetText(L["EXPECTEDROLL"])
end

------------------------------------
-- AWARD ITEM
------------------------------------

f.cost = CreateFrame("EditBox", nil, f)
f.cost:SetPoint("TOPLEFT", f.bidTable, "BOTTOMLEFT", 71, -15)
f.cost:SetPoint("TOPLEFT", f.bidTable, "BOTTOMLEFT", 71, -15)
f.cost:SetAutoFocus(false)
f.cost:SetMultiLine(false)
f.cost:SetSize(70, 28)
Expand Down Expand Up @@ -1747,8 +1747,8 @@ function MonDKP:CreateBidWindow()
StaticPopup_Show ("VALIDATE_BOSS")
return;
end
MonDKP:AwardConfirm(SelectedBidder["player"], tonumber(f.cost:GetText()), f.boss:GetText(), MonDKP_DB.bossargs.CurrentRaidZone, CurrItemForBid)

MonDKP:AwardConfirm(SelectedBidder["player"], tonumber(f.cost:GetText()), f.boss:GetText(), MonDKP_DB.bossargs.CurrentRaidZone, CurrItemForBid)
else
local selected = L["PLAYERVALIDATE"];

Expand Down Expand Up @@ -1780,4 +1780,4 @@ function MonDKP:CreateBidWindow()
end

return f;
end
end

0 comments on commit 0f5f77d

Please sign in to comment.