returntrue,"You sold "..item_count.." item(s) of "..item_name.." for "..sell_price.." BitGold. Your new balance is: "..new_balance.." BitGold"
else
-- item does not exists in the store
returnfalse,"You cannot sell this item. Search in store for items you can sell, example: /mp find stone. See some suggestion from the store: "..x_marketplace.store_get_random()
returntrue,item_name.." buy: "..store_item.buy.." sell: "..store_item.sell..". You can sell the item(s) you are holding for: "..sell_price.." BitGold. example: /mp sellhand"
else
-- item does not exists in the store
returnfalse,"This item is not in store. See some suggestion from the store: "..x_marketplace.store_get_random()
returnfalse,"You don't have enought BitGold. Price for "..amount.." item(s) of "..item_name.." is "..buy_price.." BitGold, but your current balance is: "..x_marketplace.get_player_balance(caller).." BitGold"
end
-- drop items what doesn't fit in the inventory
localleftover_item=inv:add_item("main",itemstack)
ifleftover_item:get_count()>0then
localp=table.copy(player:get_pos())
p.y=p.y+1.2
localobj=minetest.add_item(p,itemstack)
ifobjthen
localdir=player:get_look_dir()
dir.x=dir.x*2.9
dir.y=dir.y*2.9+2
dir.z=dir.z*2.9
obj:set_velocity(dir)
obj:get_luaentity().dropped_by=caller
end
end
returntrue,"You bought "..amount.." item(s) of "..item_name.." for "..buy_price.." BitGold. Your new balance is: "..new_balance.." BitGold"
else
-- item does not exists in the store
returnfalse,"This item is not in store. See some suggestion from the store: "..x_marketplace.store_get_random()
end
--
-- sell inventory
--
elseifparams[1]=="sellinv"then
-- item name is missing from param[2]
ifnotparams[2]then
returnfalse,"You need to write the item name you want to sell. example: /mp sellinv default:stone. See some suggestion from the store: "..x_marketplace.store_get_random()
returntrue,"You sold "..amount.." item(s) of "..params[2].." for "..sell_price.." BitGold. Your new balance is: "..new_balance.." BitGold"
else
-- item does not exists in the store
returnfalse,"You cannot sell this item. Search in store for items you can sell, example: /mp find stone. See some suggestion from the store: "..x_marketplace.store_get_random()
returnfalse,"You need to write the item name you want to buy. example: /mp buyinv default:stone, or check out other items in the store: "..x_marketplace.store_get_random()
returnfalse,"You don't have enought BitGold. Price for "..amount.." item(s) of "..params[2].." is "..buy_price.." BitGold, but your current balance is: "..x_marketplace.get_player_balance(caller).." BitGold."
end
fork,vinipairs(inv:get_list("main"))do
ifv:get_name()==""andv:get_count()==0then
inv:add_item("main",itemstack)
end
end
returntrue,"You bought "..amount.." item(s) of "..params[2].." for "..buy_price.." BitGold. Your new balance is: "..new_balance.." BitGold"
else
-- item not in store
returnfalse,"This item is not in store, check out other items from the store: "..x_marketplace.store_get_random()
returnfalse,"You need to write the item name you want to buy. example: /mp buy default:stone 10, or check out other items in the store: "..x_marketplace.store_get_random()
returnfalse,"You don't have enought BitGold. Price for "..amount.." item(s) of "..params[2].." is "..buy_price.." BitGold, but your current balance is: "..x_marketplace.get_player_balance(caller).." BitGold"
end
-- drop items what doesn't fit in the inventory
localleftover_item=inv:add_item("main",itemstack)
ifleftover_item:get_count()>0then
localp=table.copy(player:get_pos())
p.y=p.y+1.2
localobj=minetest.add_item(p,itemstack)
ifobjthen
localdir=player:get_look_dir()
dir.x=dir.x*2.9
dir.y=dir.y*2.9+2
dir.z=dir.z*2.9
obj:set_velocity(dir)
obj:get_luaentity().dropped_by=caller
end
end
returntrue,"You bought "..amount.." item(s) of "..params[2].." for "..buy_price.." BitGold. Your new balance is: "..new_balance.." BitGold"
minetest.colorize("#00FFFF","/mp find").." <item name>, find item in store\n"..
minetest.colorize("#00FFFF","/mp balance")..", show your current balance in BitGold\n"..
minetest.colorize("#00FFFF","/mp sellhand")..", sell item(s) currently holding in hand\n"..
minetest.colorize("#00FFFF","/mp buyhand").." [<amount>], buy <amount> of item(s) currently holding in hand, when <amount> is not provided then amount is 1\n"..
minetest.colorize("#00FFFF","/mp infohand")..", show more information about the item(s) you are currently holding in hand from the store\n"..
minetest.colorize("#00FFFF","/mp buy").." <item name> [<amount>], buy <amount> of <item name> from store, if <amount> is not provided then amount is 1\n"..
minetest.colorize("#00FFFF","/mp sellinv").." <item name>, sell all items <item name> from the 'main' inventory list\n"..
minetest.colorize("#00FFFF","/mp buyinv").." <item name>, buy full inventory of items <item name>, empty slots in the 'main' inventory are required\n"..