Skip to content

Commit

Permalink
Merge branch 'master' into fix-display-of-current-item-icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Roeshambo authored Mar 5, 2020
2 parents cbc9d02 + 52a45d8 commit 2461bcb
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Localization/Localization.de.lua
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ if GetLocale() == "deDE" then
ZEROSUMITEMCOST = "Zero Sum Item Costs",
ZEROSUMITEMCOSTTTDESC = "Wählen Sie die Art der Artikelkosten aus, die Sie verwenden möchten. Static gibt Artikeln einen definierten Preis. Während Mindestgebot ermöglicht es den Spielern, ein Gebot abzugeben, das die Kosten definiert, während Sie einen Mindestgebotsschwellenwert festlegen.",
ZONE = "Zone",
PASS = "Weitergeben",
PASS = "Passen",

CHANGELOG1 = "- Verbessertes Broadcast-System mit zugänglicher Schnittstelle durch Klicken auf das Statusanzeigesymbol in der unteren linken Ecke der DKP-Hauptschnittstelle.",
CHANGELOG2 = " - Die Option \"Vollständige Übertragung\" überträgt alle Daten und überschreibt die Empfängertabellen mit identischen Kopien von Ihnen. Alle Daten, die sie hatten und die Sie nicht hatten, gehen verloren (Funktioniert genauso wie die Broadcast-Schaltfläche in 1.6 und früher).",
Expand Down
6 changes: 3 additions & 3 deletions Modules/Award.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ local function AwardItem(player, cost, boss, zone, loot, reassign)
core.BidInProgress = false;
MonDKP:BroadcastStopBidTimer()

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")
else
SendChatMessage(L["CONGRATS"].." "..winner.." "..L["ON"].." "..loot.." @ "..-cost.." "..L["DKP"], "RAID_WARNING")
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())
Expand Down
37 changes: 30 additions & 7 deletions Modules/BidInterface.lua
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ local function BidWindowCreateRow(parent, id) -- Create 3 buttons for each row i
return f
end

function MonDKP:CurrItem_Set(item, value, value2, icon)
function MonDKP:CurrItem_Set(item, value, icon, value2)
CurrItemForBid = item;
CurrItemIcon = icon;

Expand Down Expand Up @@ -630,23 +630,25 @@ function MonDKP:BidInterface_Create()
else
behavior = "Max DKP"
end

local dkp = 0
local search = MonDKP:Table_Search(MonDKP_DKPTable, UnitName("player"), "player")
if search then
dkp = MonDKP_DKPTable[search[1][1]].dkp;
end

if behavior == "Max DKP" or itemValue == 0 then
f.Bid:SetNumber(dkp);
elseif behavior == "Max Item Value" then
f.Bid:SetNumber(itemValue);
else
elseif behavior == "Min(Max DKP, Max Item Value)" then
if dkp < itemValue then
f.Bid:SetNumber(dkp)
else
f.Bid:SetNumber(itemValue);
end
else
f.Bid:SetNumber(dkp);
end
end)

Expand All @@ -658,12 +660,33 @@ function MonDKP:BidInterface_Create()
f.BidHalf:SetNormalFontObject("MonDKPSmallCenter");
f.BidHalf:SetHighlightFontObject("MonDKPSmallCenter");
f.BidHalf:SetScript("OnClick", function()
local search = MonDKP:Table_Search(MonDKP_DKPTable, UnitName("player"), "player")
local behavior = MonDKP_DB.modes.MaxBehavior
local itemValue = 0
if mode == "Minimum Bid Values" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Minimum Bid") then
local value, text = strsplit(" ", f.MaxBid:GetText())
itemValue = tonumber(value)
else
behavior = "Max DKP"
end

local dkp = 0
local search = MonDKP:Table_Search(MonDKP_DKPTable, UnitName("player"), "player")
if search then
f.Bid:SetNumber(MonDKP_DKPTable[search[1][1]].dkp/2);
dkp = MonDKP_DKPTable[search[1][1]].dkp;
end

if behavior == "Max DKP" or itemValue == 0 then
f.Bid:SetNumber(dkp/2);
elseif behavior == "Max Item Value" then
f.Bid:SetNumber(itemValue/2);
elseif behavior == "Min(Max DKP, Max Item Value)" then
if dkp < itemValue then
f.Bid:SetNumber(dkp/2)
else
f.Bid:SetNumber(itemValue/2);
end
else
f.Bid:SetNumber(0);
f.Bid:SetNumber(dkp/2)
end
end)

Expand Down
19 changes: 11 additions & 8 deletions Modules/Bidding.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ function MonDKP_CHAT_MSG_WHISPER(text, ...)
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
if (cmd and core.BiddingWindow.minBid and tonumber(core.BiddingWindow.minBid:GetNumber()) <= cmd) or mode == "Static Item Values" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static") or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Minimum Bid" and cmd >= core.BiddingWindow.minBid:GetNumber()) then
for i=1, #Bids_Submitted do -- checks if a bid was submitted, removes last bid if it was
if (mode ~= "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType ~= "Static") and Bids_Submitted[i] and Bids_Submitted[i].player == name and Bids_Submitted[i].bid < cmd then
if (not (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static")) and Bids_Submitted[i] and Bids_Submitted[i].player == name and Bids_Submitted[i].bid < cmd then
table.remove(Bids_Submitted, i)
elseif (mode ~= "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType ~= "Static") and Bids_Submitted[i] and Bids_Submitted[i].player == name and Bids_Submitted[i].bid >= cmd then
elseif (not (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static")) and Bids_Submitted[i] and Bids_Submitted[i].player == name and Bids_Submitted[i].bid >= cmd then
SendChatMessage(L["BIDEQUALORLESS"], "WHISPER", nil, name)
return
end
Expand All @@ -185,7 +185,11 @@ function MonDKP_CHAT_MSG_WHISPER(text, ...)
MonDKP.Sync:SendData("MonDKPBidShare", Bids_Submitted)
end
if Timer ~= 0 and Timer > (core.BiddingWindow.bidTimer:GetText() - 10) and MonDKP_DB.modes.AntiSnipe > 0 then
MonDKP:BroadcastBidTimer(core.BiddingWindow.bidTimer:GetText().."{"..MonDKP_DB.modes.AntiSnipe, core.BiddingWindow.item:GetText().." Min Bid: "..core.BiddingWindow.minBid:GetText(), core.BiddingWindow.itemIcon:GetTexture());
if core.BiddingWindow.maxBid:GetNumber() ~= 0 then
MonDKP:BroadcastBidTimer(core.BiddingWindow.bidTimer:GetText().."{"..MonDKP_DB.modes.AntiSnipe, core.BiddingWindow.item:GetText().." Min Bid: "..core.BiddingWindow.minBid:GetText().." Max Bid: "..core.BiddingWindow.maxBid:GetText(), core.BiddingWindow.itemIcon:GetTexture());
else
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
elseif mode == "Static Item Values" or (mode == "Zero Sum" and MonDKP_DB.modes.ZeroSumBidType == "Static") then
if MonDKP_DB.modes.AnnounceBid and ((Bids_Submitted[1] and Bids_Submitted[1].dkp < dkp) or not Bids_Submitted[1]) then
Expand Down Expand Up @@ -545,8 +549,8 @@ local function StartBidding()
else
MonDKP:BroadcastBidTimer(core.BiddingWindow.bidTimer:GetText(), core.BiddingWindow.item:GetText().." Min Bid: "..core.BiddingWindow.minBid:GetText(), CurrItemIcon)
end
MonDKP.Sync:SendData("MonDKPCommand", "BidInfo,"..core.BiddingWindow.item:GetText()..","..core.BiddingWindow.minBid:GetText()..","..core.BiddingWindow.maxBid:GetText()..","..CurrItemIcon)
MonDKP:CurrItem_Set(core.BiddingWindow.item:GetText(), core.BiddingWindow.minBid:GetText(), core.BiddingWindow.maxBid:GetText(), CurrItemIcon)
MonDKP.Sync:SendData("MonDKPCommand", "BidInfo,"..core.BiddingWindow.item:GetText().."#"..core.BiddingWindow.minBid:GetText().."#"..CurrItemIcon.."#"..core.BiddingWindow.maxBid:GetText())
MonDKP:CurrItem_Set(core.BiddingWindow.item:GetText(), core.BiddingWindow.minBid:GetText(), CurrItemIcon, core.BiddingWindow.maxBid:GetText())

if MonDKP_DB.defaults.AutoOpenBid then -- toggles bid window if option is set to
MonDKP:BidInterface_Toggle()
Expand Down Expand Up @@ -595,10 +599,9 @@ local function StartBidding()
else
if MonDKP_DB.modes.costvalue == "Percent" then perc = "%" else perc = " DKP" end;
MonDKP:BroadcastBidTimer(core.BiddingWindow.bidTimer:GetText(), core.BiddingWindow.item:GetText().." Cost: "..core.BiddingWindow.cost:GetNumber()..perc, CurrItemIcon)
MonDKP.Sync:SendData("MonDKPCommand", "BidInfo,"..core.BiddingWindow.item:GetText()..","..core.BiddingWindow.cost:GetText()..perc..",0,"..CurrItemIcon)
MonDKP.Sync:SendData("MonDKPCommand", "BidInfo,"..core.BiddingWindow.item:GetText().."#"..core.BiddingWindow.cost:GetText()..perc.."#"..CurrItemIcon.."#0")
MonDKP:BidInterface_Toggle()
MonDKP:CurrItem_Set(core.BiddingWindow.item:GetText(), core.BiddingWindow.cost:GetText()..perc, 0, CurrItemIcon)

MonDKP:CurrItem_Set(core.BiddingWindow.item:GetText(), core.BiddingWindow.cost:GetText()..perc, CurrItemIcon, 0)
end

if mode == "Roll Based Bidding" then
Expand Down
10 changes: 5 additions & 5 deletions Modules/ManageEntries.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,27 @@ function AddRaidToDKPTable()
end
end

local function AddGuildToDKPTable(rank)
local function AddGuildToDKPTable(rank, level)
local guildSize = GetNumGuildMembers();
local class, addedUsers, c, name, rankName, rankIndex;
local class, addedUsers, c, name, rankName, rankIndex, charLevel;
local numPlayers = 0;
local FlagRecovery = false
local curTime = time()

for i=1, guildSize do
name,rankName,rankIndex,_,_,_,_,_,_,_,class = GetGuildRosterInfo(i)
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_DKPTable, name)

if not search and rankIndex == rank then
if not search and (level == nil or charLevel >= level) and (rank == nil or rankIndex == rank) then
tinsert(MonDKP_DKPTable, {
player=name,
class=class,
dkp=0,
previous_dkp=0,
lifetime_gained = 0,
lifetime_spent = 0,
rank=rank,
rank=rankIndex,
rankName=rankName,
spec = "No Spec Reported",
role = "No Role Reported",
Expand Down
5 changes: 3 additions & 2 deletions Modules/comm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender)
if MonDKP_DB.defaults.AutoOpenBid and not core.BidInterface:IsShown() then -- toggles bid window if option is set to
MonDKP:BidInterface_Toggle()
end
MonDKP:CurrItem_Set(arg1, arg2, arg3, arg4) -- populates bid window
local subarg1, subarg2, subarg3, subarg4 = strsplit("#", arg1);
MonDKP:CurrItem_Set(subarg1, subarg2, subarg3, subarg4) -- populates bid window
end
end
elseif prefix == "MonDKPRaidTime" and sender ~= UnitName("player") and core.IsOfficer and MonDKP.ConfigTab2 then
Expand Down Expand Up @@ -703,7 +704,7 @@ function MonDKP.Sync:OnCommReceived(prefix, message, distribution, sender)
end
end
elseif prefix == "MonDKPDKPModes" then
if MonDKP_DB.modes.mode ~= deserialized[1].mode then
if (MonDKP_DB.modes.mode ~= deserialized[1].mode) or (MonDKP_DB.modes.MaxBehavior ~= deserialized[1].MaxBehavior) then
MonDKP:Print(L["RECOMMENDRELOAD"])
end
MonDKP_DB.modes = deserialized[1]
Expand Down
32 changes: 30 additions & 2 deletions Modules/exportDKP.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,21 @@ local function GenerateDKPTables(table, format)

ExportString = "<dkphistory>\n";
for i=1, numrows do
ExportString = ExportString.." <historyentry>\n <playerstring>"..MonDKP_DKPHistory[i].players.."</playerstring>\n <dkp>"..MonDKP_DKPHistory[i].dkp.."</dkp>\n <timestamp>"..MonDKP_DKPHistory[i].date.."</timestamp>\n <reason>"..MonDKP_DKPHistory[i].reason.."</reason>\n </historyentry>\n";
local deletes;
local deletedby;
if MonDKP_DKPHistory[i].deletes == nil then
deletes = ''
else
deletes = MonDKP_DKPHistory[i].deletes
end

if MonDKP_DKPHistory[i].deletedby == nil then
deletedby = ''
else
deletedby = MonDKP_DKPHistory[i].deletedby
end

ExportString = ExportString.." <historyentry>\n <playerstring>"..MonDKP_DKPHistory[i].players.."</playerstring>\n <dkp>"..MonDKP_DKPHistory[i].dkp.."</dkp>\n <timestamp>"..MonDKP_DKPHistory[i].date.."</timestamp>\n <reason>"..MonDKP_DKPHistory[i].reason.."</reason>\n <deletes>"..deletes.."</deletes>\n <deletedby>"..deletedby.."</deletedby>\n </historyentry>\n";
end
ExportString = ExportString.."</dkphistory>";
elseif table == MonDKP_Loot then
Expand All @@ -148,7 +162,21 @@ local function GenerateDKPTables(table, format)
local itemNumber = strsub(cur, string.find(cur, "Hitem:")+6, string.find(cur, ":", string.find(cur, "Hitem:")+6)-1)
local itemName = strsub(cur, string.find(cur, "::|h%[")+5, string.find(cur, "%]", string.find(cur, "::|h%[")+5)-1)

ExportString = ExportString.." <lootentry>\n <player>"..MonDKP_Loot[i].player.."</player>\n <itemname>"..itemName.."</itemname>\n <itemnumber>"..itemNumber.."</itemnumber>\n <zone>"..MonDKP_Loot[i].zone.."</zone>\n <boss>"..MonDKP_Loot[i].boss.."</boss>\n <timestamp>"..MonDKP_Loot[i].date.."</timestamp>\n <cost>"..MonDKP_Loot[i].cost.."</cost>\n </lootentry>\n";
local deletes;
local deletedby;
if MonDKP_Loot[i].deletes == nil then
deletes = ''
else
deletes = MonDKP_Loot[i].deletes
end

if MonDKP_Loot[i].deletedby == nil then
deletedby = ''
else
deletedby = MonDKP_Loot[i].deletedby
end

ExportString = ExportString.." <lootentry>\n <player>"..MonDKP_Loot[i].player.."</player>\n <itemname>"..itemName.."</itemname>\n <itemnumber>"..itemNumber.."</itemnumber>\n <zone>"..MonDKP_Loot[i].zone.."</zone>\n <boss>"..MonDKP_Loot[i].boss.."</boss>\n <timestamp>"..MonDKP_Loot[i].date.."</timestamp>\n <cost>"..MonDKP_Loot[i].cost.."</cost>\n <deletes>"..deletes.."</deletes>\n <deletedby>"..deletedby.."</deletedby>\n </lootentry>\n";
end
ExportString = ExportString.."</loothistory>";
end
Expand Down
10 changes: 7 additions & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,13 @@ function MonDKP_OnEvent(self, event, arg1, ...)
end
elseif event == "CHAT_MSG_WHISPER" then
MonDKP:CheckOfficer()
arg1 = strlower(arg1)
if (core.BidInProgress or string.find(arg1, "!dkp") == 1 or string.find(arg1, "!dkp") == 1) and core.IsOfficer == true then
MonDKP_CHAT_MSG_WHISPER(arg1, ...)
if core.IsOfficer then
arg1 = strlower(arg1)
if (core.BidInProgress or string.find(arg1, "!dkp") == 1 or string.find(arg1, "!dkp") == 1) then
MonDKP_CHAT_MSG_WHISPER(arg1, ...)
elseif string.find(arg1, "!standby") == 1 and core.StandbyActive then
MonDKP_Standby_Handler(arg1, ...)
end
end
elseif event == "GUILD_ROSTER_UPDATE" then
if IsInGuild() and not core.InitStart then
Expand Down

0 comments on commit 2461bcb

Please sign in to comment.