Commit 88d8c445 authored by Tommy Ang's avatar Tommy Ang 🤣

Tweak buy chunk mechanic

parent e840caf0
......@@ -14,6 +14,18 @@ options:
ChunkPrice: 5000
ChunksPerPurchase: 5
command /migrate:
permission: op
trigger:
loop {ptownlist::*}:
if {ptown.%loop-value%.landexpansion} is not set:
set {_playerSize} to size of {ptown.%loop-value%.playerlist::*}
set {_townSize} to {ptown.%loop-value%.maxsize}
set {_boughtSize} to ({_townSize} - ({_playerSize} * 20))
set {_boughtTime} to ({_boughtSize} / 5)
set {ptown.%loop-value%.landexpansion} to {_boughtTime}
message "Setting %loop-value%: %{_boughtTime}%"
command /potatotown <text="help"> [<text>]:
aliases: ptown
description: Potato Town
......@@ -69,7 +81,7 @@ command /potatotown <text="help"> [<text>]:
message "&e/ptown help 5 &aFor Next Page"
if arg 2 is "5":
message "&6-------------------Potato Town (&e5&6/&e5&6)-------------------"
message "&e/ptown buy chunk - &aBuy {@ChunksPerPurchase} for ({@ChunksPerPurchase} * {@ChunkPrice}) &2RC"
message "&e/ptown buy chunk - &aBuy {@ChunksPerPurchase} chunks based on certain criteria for pricing"
message ""
message ""
message ""
......@@ -122,6 +134,7 @@ command /potatotown <text="help"> [<text>]:
set {ptown.%arg 2%.desc} to "Default description. Please change."
set {ptown.%arg 2%.home} to location of player
set {ptown.%arg 2%.money} to 0
set {ptown.%arg 2%.landexpansion} to 0
broadcast "[&6PTown&f] &9%player% created a new sexy town named %arg 2%"
stop
if {ptownlist.chunk::%chunk at player%} is set:
......@@ -163,13 +176,9 @@ command /potatotown <text="help"> [<text>]:
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 {_boughtTime} to {ptown.%{_town}%.landexpansion}
set {_nextUpgrade} to ({@ChunksPerPurchase} * {@ChunkPrice} * ({_boughtTime} + 1)) * 0.75
if {_boughtTime} is more than 29:
set {_nextUpgrade} to "Max"
message "&6--------------------- Potato Town ---------------------"
message "Town: %{_town}%"
......@@ -815,22 +824,24 @@ command /potatotown <text="help"> [<text>]:
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)
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"
if {ptown.%{_town}%.landexpansion} is not set:
set {ptown.%{_town}%.landexpansion} to 0
else if {ptown.%{_town}%.landexpansion} is more than 29:
message "You have reached the limit of land expansion permit. (Limit: 30)"
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
set {_purchasePrice} to {@ChunksPerPurchase} * {@ChunkPrice} * ({ptown.%{_town}%.landexpansion} + 1) * 0.75
if {ptown.money::%{_town}%} is more than or equal to {_purchasePrice}:
add {@ChunksPerPurchase} to {ptown.%{_town}%.maxsize}
add 1 to {ptown.%{_town}%.landexpansion}
message "Successfully bought {@ChunksPerPurchase} chunks for %{_purchasePrice} %"
remove ({_purchasePrice} ) from {ptown.money::%{_town}%}
stop
else:
message "You are not the owner of the town to buy this"
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