diff --git a/Classes/AwardedLoot.lua b/Classes/AwardedLoot.lua index e45d4b84..46a273bb 100644 --- a/Classes/AwardedLoot.lua +++ b/Classes/AwardedLoot.lua @@ -828,6 +828,11 @@ end function AwardedLoot:initiateTrade(AwardDetails) local tradingPartner = AwardDetails.awardedTo; + -- No need to trade with yourself + if (GL:iEquals(tradingPartner, GL.User.fqn)) then + return; + end + -- Check whether we have the item in our inventory, no point opening a trade window if not local itemPositionInBag = GL:findBagIdAndSlotForItem(AwardDetails.itemLink or AwardDetails.itemID); if (GL:empty(itemPositionInBag)) then @@ -843,9 +848,22 @@ function AwardedLoot:initiateTrade(AwardDetails) if (not TradeFrame:IsShown()) then -- Open a trade window with the winner - GL.TradeWindow:open(tradingPartner, function () + GL.TradeWindow:open(tradingPartner, function (success) + if (not success) then + if (Settings:get("AwardingLoot.notifyOfFailedTradeStart")) then + GL:sendChatMessage( + GL:printfn(L.CHAT.TRADE_START_FAILED, { + item = AwardDetails.itemLink or "?", + }), + "WHISPER", nil, tradingPartner + ); + end + + return; + end + self:tradeInitiated(); - end); + end, true); -- We're already trading with the winner elseif (GL:tableGet(GL.TradeWindow, "State.partner") == tradingPartner) then diff --git a/Classes/TradeWindow.lua b/Classes/TradeWindow.lua index 01571ea1..e8f4cc68 100644 --- a/Classes/TradeWindow.lua +++ b/Classes/TradeWindow.lua @@ -70,7 +70,7 @@ function TradeWindow:open(playerName, callback, allwaysExecuteCallback) if (type(callback) == "function" and (allwaysExecuteCallback or self.Sate.partner == playerName) ) then - callback(); + callback(GL:iEquals(self.Sate.partner, playerName)); end return; @@ -85,7 +85,7 @@ function TradeWindow:open(playerName, callback, allwaysExecuteCallback) GL.Events:unregister("TradeWindowTradeShowCallbackListener"); if (allwaysExecuteCallback) then - callback(); + callback(false); end end, 1); @@ -100,10 +100,10 @@ function TradeWindow:open(playerName, callback, allwaysExecuteCallback) if (allwaysExecuteCallback or ( TradeFrame:IsShown() - and self.Sate.partner == playerName + and GL:iEquals(self.Sate.partner, playerName) ) ) then - callback(); + callback(true); end end); end diff --git a/Data/DefaultSettings.lua b/Data/DefaultSettings.lua index 9eeb6ff4..fc349d75 100644 --- a/Data/DefaultSettings.lua +++ b/Data/DefaultSettings.lua @@ -88,6 +88,7 @@ GL.Data.DefaultSettings = { awardMessagesEnabled = true, awardOnReceive = false, awardOnReceiveMinimumQuality = 4, + notifyOfFailedTradeStart = true, skipAwardConfirmationDialog = false, }, ExportingLoot = { diff --git a/Data/Localizations/chat.lua b/Data/Localizations/chat.lua index 4e024fb1..50b596cb 100644 --- a/Data/Localizations/chat.lua +++ b/Data/Localizations/chat.lua @@ -89,6 +89,7 @@ L.CHAT = { ROLLING_TMB_INFO = "These players have the highest %s prio: %s", -- First %s can be TMB/DFT/CPR --[[ TradeWindow / Trade ]] + TRADE_START_FAILED = "I tried to trade you, but was unsuccessful - trade me for ${item} asap!", TRADE_TO = "%s to %s", TRADE_TO_PART = "to %s", TRADE_GAVE = "I gave %s", @@ -204,6 +205,7 @@ L.CHAT = { ROLLING_TMB_INFO = "Die folgenden Spieler haben die höchste %s-Prio: %s", -- First %s can be TMB/DFT/CPR --[[ TradeWindow / Trade ]] + TRADE_START_FAILED = "I tried to trade you, but was unsuccessful - trade me for ${item} asap!", TRADE_TO = "%s an %s", TRADE_TO_PART = "an %s", TRADE_GAVE = "Ich habe %s gegeben", @@ -319,6 +321,7 @@ L.CHAT = { ROLLING_TMB_INFO = "以下玩家的 %s 优先级最高:%s", -- First %s can be TMB/DFT/CPR --[[ TradeWindow / Trade ]] + TRADE_START_FAILED = "I tried to trade you, but was unsuccessful - trade me for ${item} asap!", TRADE_TO = "%s 给 %s", TRADE_TO_PART = "给 %s", TRADE_GAVE = "我给了%s", @@ -434,6 +437,7 @@ L.CHAT = { ROLLING_TMB_INFO = "Los siguientes jugadores tienen el %s prio más alto: %s", -- First %s can be TMB/DFT/CPR --[[ TradeWindow / Trade ]] + TRADE_START_FAILED = "I tried to trade you, but was unsuccessful - trade me for ${item} asap!", TRADE_TO = "%s a %s", TRADE_TO_PART = "a %s", TRADE_GAVE = "Le di %s", @@ -549,6 +553,7 @@ L.CHAT = { ROLLING_TMB_INFO = "Les joueurs suivants ont la plus haute prio %s : %s", -- First %s can be TMB/DFT/CPR --[[ TradeWindow / Trade ]] + TRADE_START_FAILED = "I tried to trade you, but was unsuccessful - trade me for ${item} asap!", TRADE_TO = "%s à %s", TRADE_TO_PART = "à %s", TRADE_GAVE = "J'ai donné %s", @@ -664,6 +669,7 @@ L.CHAT = { ROLLING_TMB_INFO = "I seguenti giocatori hanno il vantaggio di %s più alto: %s", -- First %s can be TMB/DFT/CPR --[[ TradeWindow / Trade ]] + TRADE_START_FAILED = "I tried to trade you, but was unsuccessful - trade me for ${item} asap!", TRADE_TO = "Da %s a %s", TRADE_TO_PART = "a %s", TRADE_GAVE = "Ho dato %s", @@ -779,6 +785,7 @@ L.CHAT = { ROLLING_TMB_INFO = "다음 플레이어의 %s 우선 순위가 가장 높습니다: %s", -- First %s can be TMB/DFT/CPR --[[ TradeWindow / Trade ]] + TRADE_START_FAILED = "I tried to trade you, but was unsuccessful - trade me for ${item} asap!", TRADE_TO = "%s ~ %s", TRADE_TO_PART = "%s에게", TRADE_GAVE = "%s을(를) 줬습니다", @@ -894,6 +901,7 @@ L.CHAT = { ROLLING_TMB_INFO = "Os seguintes jogadores têm o maior %s prio: %s", -- First %s can be TMB/DFT/CPR --[[ TradeWindow / Trade ]] + TRADE_START_FAILED = "I tried to trade you, but was unsuccessful - trade me for ${item} asap!", TRADE_TO = "%s para %s", TRADE_TO_PART = "para% s", TRADE_GAVE = "Eu dei %s", @@ -1009,6 +1017,7 @@ L.CHAT = { ROLLING_TMB_INFO = "Следующие игроки имеют самый высокий процент %s: %s", -- First %s can be TMB/DFT/CPR --[[ TradeWindow / Trade ]] + TRADE_START_FAILED = "I tried to trade you, but was unsuccessful - trade me for ${item} asap!", TRADE_TO = "от %s до %s", TRADE_TO_PART = "до %s", TRADE_GAVE = "я дал %s", @@ -1124,6 +1133,7 @@ L.CHAT = { ROLLING_TMB_INFO = "以下玩家的 %s 優先順序最高:%s", -- First %s can be TMB/DFT/CPR --[[ TradeWindow / Trade ]] + TRADE_START_FAILED = "I tried to trade you, but was unsuccessful - trade me for ${item} asap!", TRADE_TO = "%s 至 %s", TRADE_TO_PART = "至 %s", TRADE_GAVE = "我給了%s", diff --git a/Interface/Settings/AwardingLoot.lua b/Interface/Settings/AwardingLoot.lua index 1180f1fb..32267026 100644 --- a/Interface/Settings/AwardingLoot.lua +++ b/Interface/Settings/AwardingLoot.lua @@ -45,6 +45,11 @@ function AwardingLoot:draw(Parent) description = "If you award an item from your inventory then automatically trade the winner if he's within reach", setting = "AwardingLoot.autoTradeAfterAwardingAnItem", }, + { + label = "Notify in case trade fails", + description = "Send a whisper to the winner if you couldn't open a trade window with them", + setting = "AwardingLoot.notifyOfFailedTradeStart", + }, { label = "Skip award confirmation dialog", setting = "AwardingLoot.skipAwardConfirmationDialog",