View Single Post
03/13/23, 04:41 PM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Yes, looks okay to me. Not sure why you get items of a guildId where no trader exists though. How should one list any item there?

Did you testreset the SV table before trying new so there is no old data in it?
Add d() debit messages to your code to see where it runs through, which items are added at what loop etc.



Originally Posted by cabwav View Post
Thank you for your reply. I changed the code as follows:
Lua Code:
  1. for j = 1, GetNumGuilds() do
  2.         local guildId = GetGuildId(j)
  3.         local gotTrader = DoesGuildHavePrivilege(guildId, GUILD_PRIVILEGE_TRADING_HOUSE) or false
  4.         local isPlayerAllowedToSell = DoesPlayerHaveGuildPermission(guildId, GUILD_PERMISSION_STORE_SELL)
  5.  
  6.         if gotTrader and isPlayerAllowedToSell then
  7.             if (SelectTradingHouseGuildId(guildId)) then
  8.                 local currentListingCount, maxListingCount = GetTradingHouseListingCounts()
  9.                 if(currentListingCount > 0) then
  10.                     for i = 1, currentListingCount do
  11.                         local _,itemName,displayQuality,stackCount,_,timeRemaining,salePrice = GetTradingHouseListingItemInfo(i)
  12.                         local link = GetTradingHouseListingItemLink(i)
  13.                         local linkItemId = GetItemLinkItemId(link)
  14.                         table.insert(mytable,string.format("%s;%s;%s;%s;%s",guildId,linkItemId,itemName,salePrice,timeRemaining))
  15.                     end
  16.                 end
  17.             end
  18.         end
  19.     end

Unfortunately, I am still getting the double amount of items, i.e. the items that are actually sold in the Trading Guild, plus the same number of items for the 'regular' guild (that has no trader)

Did I understand your answer correctly?

thanks again,

cabwav
  Reply With Quote