Commit 67dd09f6 authored by Tommy Ang's avatar Tommy Ang 🤣

Rework town chunk buy mechanic

parent 0c4c02f3
......@@ -12,7 +12,6 @@ import:
options:
ChunkPrice: 5000
ChunksPerPurchase: 5
MaxChunksPerTown: 300
command /potatotown <text="help"> [<text>]:
aliases: ptown
......@@ -162,11 +161,21 @@ command /potatotown <text="help"> [<text>]:
if {_town} is not set:
message "Town not found."
stop
set {_town} to {ptown.%player%}
set {_playerSize} to size of {ptown.%{_town}%.playerlist::*}
set {_townSize} to {ptown.%{_town}%.maxsize}
set {_boughtSize} to ({_townSize} - ({_playerSize} * 20))
set {_boughtTime} to ({_boughtSize} / 5)
set {_nextUpgrade} to ({@ChunksPerPurchase} * {@ChunkPrice} * ({_boughtTime} + 1))
if {_boughtTime} is more than 9:
message "E"
set {_nextUpgrade} to "Max"
message "&6--------------------- Potato Town ---------------------"
message "Town: %{_town}%"
message "Desc: %{ptown.%{_town}%.desc}%"
message "Size: %{ptown.%{_town}%.size}%/%{ptown.%{_town}%.maxsize}%"
message "Bank: %{ptown.money::%{_town}%}%" #(+%{ptown.tax.%{_town}%}%)
message "Land Expansion Bought: %{_boughtTime}% (Next Upgrade: %{_nextUpgrade}%)"
#message "Nation: "
set {_fire} to {ptown.%{_town}%.flag::fire}
if {_fire} is not set:
......@@ -802,18 +811,24 @@ command /potatotown <text="help"> [<text>]:
message "[&6PTown&f] You are not in a town"
stop
set {_town} to {ptown.%player%}
if {ptown.%{_town}%.maxsize} is more than or equal to {@MaxChunksPerTown}:
message "Failed to buy more, your town is already at the max size of {@MaxChunksPerTown}"
stop
if "%{ptown.%{_town}%.owner}%" is player's name:
# add ({@ChunksPerPurchase} * {@ChunkPrice}) to {ptown.money::%{_town}%} # Use this to buy a chunk at no cost
if {ptown.money::%{_town}%} is more than or equal to ({@ChunksPerPurchase} * {@ChunkPrice}):
add {@ChunksPerPurchase} to {ptown.%{_town}%.maxsize}
message "Successfully bought {@ChunksPerPurchase} chunks for %{@ChunksPerPurchase} * {@ChunkPrice}%"
remove ({@ChunksPerPurchase} * {@ChunkPrice}) from {ptown.money::%{_town}%}
set {_playerSize} to size of {ptown.%{_town}%.playerlist::*}
set {_townSize} to {ptown.%{_town}%.maxsize}
set {_boughtSize} to ({_townSize} - ({_playerSize} * 20))
set {_boughtTime} to ({_boughtSize} / 5)
if {_boughtTime} is more than 9:
message "You have reached the limit of land expansion permit. (Limit: 10)"
else:
if "%{ptown.%{_town}%.owner}%" is player's name:
# add ({@ChunksPerPurchase} * {@ChunkPrice}) to {ptown.money::%{_town}%} # Use this to buy a chunk at no cost
if {ptown.money::%{_town}%} is more than or equal to ({@ChunksPerPurchase} * {@ChunkPrice} * ({_boughtTime} + 1)):
add {@ChunksPerPurchase} to {ptown.%{_town}%.maxsize}
message "Successfully bought {@ChunksPerPurchase} chunks for %{@ChunksPerPurchase} * {@ChunkPrice} * ({_boughtTime} + 1)%"
remove ({@ChunksPerPurchase} * {@ChunkPrice}) from {ptown.money::%{_town}%}
stop
message "Not enough funds"
stop
message "Not enough funds"
stop
else:
message "You are not the owner of the town to buy this"
# if arg 1 is "tax":
# if arg 2 is set:
# set {_number} to arg 2 parsed as number
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment