Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Zxian authored and Zxian committed Feb 23, 2011
1 parent 3cccc3a commit dbdb5d6
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions Core.lua
Expand Up @@ -37,17 +37,17 @@ end
-------------------------------------


local function ItemLinkToItemID(itemLink)
return tonumber(string.match(itemLink, "item:(%d+)"))
local function ItemLinkToItemID(itemlink)
return tonumber(string.match(itemlink, "item:(%d+)"))
end

local function TR_GetItemInventoryCount(itemID)
local count = 0
for bag = 0, 4, 1 do
for slot = 1, GetContainerNumSlots(bag), 1 do
if itemID == GetContainerItemID(bag,slot) then
local _, slotCount = GetContainerItemInfo(bag,slot)
count = count + slotCount
local _, slotcount = GetContainerItemInfo(bag,slot)
count = count + slotcount
end
end
end
Expand All @@ -58,14 +58,9 @@ end
local function TR_GetMerchantItemIndex(itemID)
for i = 1, GetMerchantNumItems() do
local merchantIL = GetMerchantItemLink(i)
if not merchantIL then
merchantIL = GetMerchantItemLink(i)
end
if merchantIL then
local merchantIID = ItemLinkToItemID(merchantIL)
if itemID == merchantIID then
return i
end
local merchantIID = ItemLinkToItemID(merchantIL)
if itemID == merchantIID then
return i
end
end
return
Expand All @@ -82,6 +77,7 @@ end
local function eventHandler(self, event, ...)
for item,stack in pairs(items) do
local _, itemLink, _, _, _, _, _, iStackCount = GetItemInfo(item)
local itemID = ItemLinkToItemID(itemLink)
local invItemCount = TR_GetItemInventoryCount(item)
local merchantIndex = TR_GetMerchantItemIndex(item)
local numPurchase = stack - invItemCount
Expand Down

0 comments on commit dbdb5d6

Please sign in to comment.