@@ -283,7 +283,6 @@ on trade site to work on other leagues and realms)]]
283283 " Instant buyout and in person" ,
284284 " In person (online in league)" ,
285285 " In person (online)" ,
286- " Any" ,
287286 }
288287
289288 self .controls .tradeTypeSelection = new (" DropDownControl" , { " TOPLEFT" , self .controls .poesessidButton , " BOTTOMLEFT" },
@@ -942,6 +941,7 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
942941 return
943942 end
944943 context .controls [" priceButton" .. context .row_idx ].label = " Searching..."
944+ self .lastQuery = query
945945 self .tradeQueryRequests :SearchWithQueryWeightAdjusted (self .pbRealm , self .pbLeague , query ,
946946 function (items , errMsg )
947947 if errMsg then
@@ -1105,8 +1105,6 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
11051105 local firstValidSlot = self :findValidSlotForWatchersEye ()
11061106 local currentItem = firstValidSlot .selItemId ~= 0 and self .itemsTab .items [firstValidSlot .selItemId ]
11071107 local eyeEquipped = currentItem and currentItem .name :find (" Watcher's Eye" )
1108- -- for watcher's eye we can compare to an already existing one, or
1109- -- default to comparing with all active sockets
11101108 self .itemsTab :AddItemTooltip (tooltip , item , eyeEquipped and firstValidSlot or nil , true )
11111109 else
11121110 self .itemsTab :AddItemTooltip (tooltip , item , slotTbl , true )
@@ -1118,23 +1116,53 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
11181116 return self .itemIndexTbl [row_idx ] and self .resultTbl [row_idx ][self .itemIndexTbl [row_idx ]].item_string ~= nil
11191117 end
11201118 -- Whisper so we can copy to clipboard
1121- controls [" whisperButton" .. row_idx ] = new (" ButtonControl" , { " TOPLEFT" , controls [" importButton" .. row_idx ], " TOPRIGHT" }, {8 , 0 , 185 , row_height }, function ()
1122- return self .totalPrice [row_idx ] and " Whisper for " .. self .totalPrice [row_idx ].amount .. " " .. self .totalPrice [row_idx ].currency or " Whisper"
1123- end , function ()
1124- Copy (self .resultTbl [row_idx ][self .itemIndexTbl [row_idx ]].whisper )
1125- end )
1126- controls [" whisperButton" .. row_idx ].enabled = function ()
1127- return self .itemIndexTbl [row_idx ] and self .resultTbl [row_idx ][self .itemIndexTbl [row_idx ]].whisper ~= nil
1128- end
1129- controls [" whisperButton" .. row_idx ].tooltipFunc = function (tooltip )
1119+ controls [" whisperButton" .. row_idx ] = new (" ButtonControl" ,
1120+ { " TOPLEFT" , controls [" importButton" .. row_idx ], " TOPRIGHT" }, { 8 , 0 , 185 , row_height }, function ()
1121+ local itemResult = self .itemIndexTbl [row_idx ] and self .resultTbl [row_idx ][self .itemIndexTbl [row_idx ]]
1122+
1123+ if not itemResult then return " " end
1124+
1125+ local price = self .totalPrice [row_idx ] and
1126+ self .totalPrice [row_idx ].amount .. " " .. self .totalPrice [row_idx ].currency
1127+
1128+ if itemResult .whisper then
1129+ return price and " Whisper for " .. price or " Whisper"
1130+ else
1131+ return price and " Search for selected item"
1132+ end
1133+
1134+ end , function ()
1135+ local itemResult = self .itemIndexTbl [row_idx ] and self .resultTbl [row_idx ][self .itemIndexTbl [row_idx ]]
1136+ if itemResult .whisper then
1137+ Copy (itemResult .whisper )
1138+ else
1139+ local exactQuery = dkjson .decode (self .lastQuery )
1140+ -- use trade sum to get the specific item. we could also add the
1141+ -- trader name as it is contained in the fetch responses, but
1142+ -- this alone doesn't seem to really result in multiple results.
1143+ -- trade weight min is exclusive while max is inclusive (makes no sense to me)
1144+ exactQuery .query .stats [1 ].value = { min = tonumber (itemResult .weight ) - 0.1 , max = tonumber (itemResult .weight ) }
1145+
1146+ local exactQueryStr = dkjson .encode (exactQuery )
1147+
1148+ self .tradeQueryRequests :SearchWithQuery (self .pbRealm , self .pbLeague , exactQueryStr , function (_ , _ )
1149+ end , {callbackQueryId = function (queryId )
1150+ local url = self .hostName .. " trade/search/" .. self .pbLeague .. " /" .. queryId
1151+ Copy (url )
1152+ OpenURL (url )
1153+ end })
1154+ end
1155+ end )
1156+
1157+ controls [" whisperButton" .. row_idx ].tooltipFunc = function (tooltip )
11301158 tooltip :Clear ()
1131- if self .itemIndexTbl [row_idx ] and self .resultTbl [row_idx ][self .itemIndexTbl [row_idx ]].item_string then
1132- tooltip .center = true
1133- tooltip :AddLine (16 , " Copies the item purchase whisper to the clipboard" )
1134- end
1159+ tooltip .center = true
1160+ local itemResult = self .itemIndexTbl [row_idx ] and self .resultTbl [row_idx ][self .itemIndexTbl [row_idx ]]
1161+ local text = itemResult .whisper and " Copies the item purchase whisper to the clipboard" or
1162+ " Opens the search page to show the item"
1163+ tooltip :AddLine (16 , text )
11351164 end
11361165end
1137-
11381166-- Method to update the Total Price string sum of all items
11391167function TradeQueryClass :GetTotalPriceString ()
11401168 local text = " "
0 commit comments