|
|
|
@ -298,7 +298,7 @@ core.register_on_player_receive_fields(function(sender, formname, fields)
|
|
|
|
|
|
|
|
|
|
-- owner try exchanges
|
|
|
|
|
if meta:get_string("owner") == name then
|
|
|
|
|
mcl_title.set(sender, "subtitle", {text=S("This is your own shop, you can't exchange to yourself!"), color="red"})
|
|
|
|
|
mcl_title.set(sender, "subtitle", {text=S("This is your own shop, you can't exchange to yourself!"), color="dark_red"})
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
@ -307,13 +307,13 @@ core.register_on_player_receive_fields(function(sender, formname, fields)
|
|
|
|
|
-- have u money?
|
|
|
|
|
if bankemeralds < old_price then
|
|
|
|
|
can_exchange = false
|
|
|
|
|
mcl_title.set(sender, "subtitle", {text=S("Not enough Emeralds in your account"), color="red"})
|
|
|
|
|
mcl_title.set(sender, "subtitle", {text=S("Not enough Emeralds in your account"), color="dark_red"})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--there are enough items?
|
|
|
|
|
if not minv:contains_item("stock", shop_item.." "..old_count, true) then
|
|
|
|
|
can_exchange = false
|
|
|
|
|
mcl_title.set(sender, "subtitle", {text=S("Out of Stock!"), color="red"})
|
|
|
|
|
mcl_title.set(sender, "subtitle", {text=S("Out of Stock!"), color="dark_red"})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- do not trade air
|
|
|
|
@ -326,7 +326,7 @@ core.register_on_player_receive_fields(function(sender, formname, fields)
|
|
|
|
|
core.add_item(player_pos, shop_item.." "..old_count)
|
|
|
|
|
emeraldbank.add_emeralds(sender, -old_price)
|
|
|
|
|
meta:set_int("stonks", meta:get_int("stonks")+old_price)
|
|
|
|
|
core.chat_send_player(name, S("Exchanged!"))
|
|
|
|
|
mcl_title.set(sender, "subtitle", {text=S("Exchanged!"), color="green"})
|
|
|
|
|
check_empty(pos)
|
|
|
|
|
core.show_formspec(sender:get_player_name(), formspec_prefix..core.pos_to_string(pos), emeraldbank.get_shop_fs(pos, sender) )
|
|
|
|
|
end
|
|
|
|
|