1
Serverside Modding / [QUESTION] [WotLk] [ELUNA/LUA] Event for item purchase.
« on: July 31, 2016, 04:16:21 am »
Is there any way to hook into an event for an item purchase?
I'm trying to make a vendor where some items can only be purchased if certain conditions are met. There doesn't seem to be an 'item purchased' hook anywhere, but I'm wondering if anyone has done this in a more hacky way?
Ideally, I'd like to be able to do this:
function itemPurchased(event, player, item)
local arbitraryCondition = GetPointsFor(player)
local itemID = item:GetEntry()
if(itemID == VENDOR_ITEM_1) then
if(arbitraryCondition >= 3000)then
return true;
else
player:SendBroadcastMessage("Requires 3000 arbitrary condition points dumbass")
return false; (or, like, player:RemoveItem(itemID, 1))
end
end
end
Obviously, I'm using LUA. If anyone has any insight on this it would be greatly appreciated. Thanks guys.
I'm trying to make a vendor where some items can only be purchased if certain conditions are met. There doesn't seem to be an 'item purchased' hook anywhere, but I'm wondering if anyone has done this in a more hacky way?
Ideally, I'd like to be able to do this:
function itemPurchased(event, player, item)
local arbitraryCondition = GetPointsFor(player)
local itemID = item:GetEntry()
if(itemID == VENDOR_ITEM_1) then
if(arbitraryCondition >= 3000)then
return true;
else
player:SendBroadcastMessage("Requires 3000 arbitrary condition points dumbass")
return false; (or, like, player:RemoveItem(itemID, 1))
end
end
end
Obviously, I'm using LUA. If anyone has any insight on this it would be greatly appreciated. Thanks guys.