bpm91
Advanced OT User
- Joined
- May 23, 2019
- Messages
- 1,021
- Solutions
- 7
- Reaction score
- 163
- Location
- Brazil
- YouTube
- caruniawikibr
I discovered this bug by testing. when the player buys the item from the client's store, and he has a depot open in another city, then I log in to receive the teleport, and when I arrive at the depot the item hasn't arrived. however, if I have the correct depot open, I receive it. The script works by sending a package of items to the player's hometown.
i discovered the problem is when relogging.
here is function
i discovered the problem is when relogging.
here is function
Code:
function addPackage(category, title, description, itemId, count, price, source, callback, premiumOnly)
if not GAME_STORE.offers[category] then
GAME_STORE.offers[category] = {}
end
if not callback then
callback = defaultPackageCallback
end
-- if not source then
-- source = nil
-- end
local imager
if source then
imager = true
end
table.insert(
GAME_STORE.offers[category],
{
type = "item",
title = title,
description = description,
itemId = itemId,
count = count,
price = price,
clientId = ItemType(itemId[1]):getClientId(),
source = source,
image = imager or false,
callback = callback,
premiumOnly = premiumOnly or false,
}
)
end
LUA:
function defaultPackageCallback(player, offer)
local weight = 1
for i = 1, #offer.itemId do
weight = weight + ItemType(offer.itemId[i]):getWeight(offer.count[i])
end
local itemName = offer.title
local parcel = Game.createItem(2596, 1)
local label = parcel:addItem(2598, 1)
for y = 1, #offer.itemId do
parcel:addItem(offer.itemId[y], offer.count[y])
end
player:getDepotChest(player:getTown():getId(), true):addItemEx(parcel)
label:setAttribute(ITEM_ATTRIBUTE_TEXT, "Here is your order!\n\nThank you for purchasing '" .. itemName .. "'.\n\nSincerely,\nCarunia Team.")
return true
end
Last edited: