Skip to content

Commit

Permalink
Update addon for WoW 8.1 and fixed small issue with non-sellable gray…
Browse files Browse the repository at this point in the history
… items
  • Loading branch information
csarrazi committed Jan 15, 2019
1 parent acf19e6 commit 3a85371
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
39 changes: 23 additions & 16 deletions Seller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,35 @@ local Seller = Seller or {};
Seller.frame = CreateFrame("Frame", "Seller", UIParent);
Seller.frame:SetFrameStrata("BACKGROUND");

Seller.frame:SetScript("OnEvent",
function (self, event, ...)
local sum = 0;
function Seller:sellItem (bag, slot, item)
local price = select(11, GetItemInfo(item));
local quantity, _, _, _, _, _, _, noValue = select(2, GetContainerItemInfo(bag, slot));

for bag = 0, 4 do
for slot = 1, GetContainerNumSlots(bag) do
local item = GetContainerItemID(bag, slot);
if (not noValue) then
UseContainerItem(bag, slot);
end

return price * quantity;
end

function Seller:sellAllGrays(event, ...)
local sum = 0;

if (item and 0 == select(3, GetItemInfo(item))) then
local price = select(11, GetItemInfo(item));
local quantity = select(2, GetContainerItemInfo(bag, slot));
for bag = 0, 4 do
for slot = 1, GetContainerNumSlots(bag) do
local item = GetContainerItemID(bag, slot);

sum = sum + price * quantity;
UseContainerItem(bag, slot);
end
if (item and 0 == select(3, GetItemInfo(item))) then
sum = sum + Seller:sellItem(bag, slot, item);
end
end
end

if (sum ~= 0) then
print("Selling gray items for", GetCoinTextureString(sum));
end
if (sum ~= 0) then
print("Selling gray items for", GetCoinTextureString(sum));
end
);
end

Seller.frame:SetScript("OnEvent", Seller.sellAllGrays);

Seller.frame:RegisterEvent("MERCHANT_SHOW");
4 changes: 2 additions & 2 deletions Seller.toc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Interface: 70100
## Interface: 80100
## Title: Seller
## Notes: Sells your gray items when you speak to a vendor.
## Author: Akcent
## Version: 1.0.4
## Version: 1.0.5

Seller.lua

0 comments on commit 3a85371

Please sign in to comment.