Untitled
unknown
plain_text
2 years ago
6.4 kB
20
Indexable
on script load:
delete {Gens::*}
set {Gens::Blocks::*} to glowing blue wool and glowing prismarine bricks
set {Gens::Worth::*} to 10 and 50
set {Gens::UpgradeCosts::*} to 200 and 1200
## Items - Drops
add blue wool named "&9&lBLUE WOOL &8[&a$10&8]" with lore "%nl%&e&l$ &8&l➜ &7&oExecute the command &a&l/SELL&7&o to earn money selling this drop!%nl%&r" with nbt from "{SellPrice:10b}" to {Gens::Drops::*}
add prismarine shard named "<#419292>&lPRISMARINE SHARD &8[&a$50&8]" with lore "%nl%&e&l$ &8&l➜ &7&oExecute the command &a&l/SELL&7&o to earn money selling this drop!%nl%&r" with nbt from "{SellPrice:50b}" to {Gens::Drops::*}
## Items - Generator
add glowing blue wool named "&b&lBLUE WOOL GENERATOR &8[&cT1&8]" with lore "%nl%&e&l? &8&l➜ &7&oGenerates a &9&lBLUE WOOL&7&o every 5 seconds.%nl%&e&l? &8&l➜ &7&oDrop worth: &a$10%nl%&e&l? &8&l➜ &7&oUpgrade cost: &a$200%nl%&r" to {Gens::GenItems::*}
add glowing prismarine bricks named "&b&lPRISMARINE SHARD GENERATOR &8[&cT2&8]" with lore "%nl%&e&l? &8&l➜ &7Generates a <#419292>&lPRISMARINE SHARD&7&o every 5 seconds.%nl%&e&l? &8&l➜ &7&oDrop worth: &a$50%nl%&e&l? &8&l➜ &7&oUpgrade cost: &a$1200%nl%&r" to {Gens::GenItems::*}
on place:
{Gens::GenItems::*} contains 1 of tool of player:
set {_i1} to 0
loop {Gens::GenItems::*}:
add 1 to {_i1}
1 of tool of player = loop-value:
set {_i} to {_i1}
add 1 to {GensIds}
exit loop
set {_loc} to location of event-block
set {GenId::%{_loc}%} to {GensIds}
set {GenTypeNum::%{_loc}%} to {_i}
set {GenOwner::%{_loc}%} to player
set {GenItem::%{_loc}%} to 1 of tool of player
set {GenUpCost::%{_loc}%} to {_i}nd element out of {Gens::UpgradeCosts::*}
set {GenDrop::%{_loc}%} to {_i}nd element out of {Gens::Drops::*}
add {_loc} to {OwnedGens::%player's uuid%::*}
play sound "entity.wither.break_block" at volume 5 at pitch 2 to player
set {_a} to uncolored unformatted 4th line of lore of player's tool
wait 1 tick
startDropping(player, {_loc}, {GensIds})
function startDropping(p: player, loc: location, i2: number):
while {_p} is online:
wait 10 seconds
if block at {_loc} is air:
stop
else:
{GenOwner::%{_loc}%} is set:
{GenId::%{_loc}%} = {_i2}:
drop 1 of {GenDrop::%{_loc}%} above location of {_loc} without velocity
play sound "entity.item.pickup" to {_p} if distance between {_loc} and {_p} <= 6
draw 2 of smoke at block above {_loc}
else:
stop
else:
stop
command /sell:
trigger:
set {_e1} to 0
loop items in player's inventory where [input is not air]:
byte tag "SellPrice" of nbt of loop-item is set:
set {_f} to byte tag "SellPrice" of nbt of loop-item
set {_e} to amount of loop-item in player's inventory
remove {_e} of loop-item from player's inventory
add {_e}*{_f} to player's balance
add {_e}*{_f} to {_e1}
send action bar "&8『<#228B22>&l✔&8』 &7Sold all sellable items in your inventory for &2$%{_e1}%" if {_e1} != 0, else "&8『&c&l❗&8』 &7You have no sellable items in your inventory"
play sound "BLOCK_CHAIN_PLACE" at volume 10 at pitch 5 to player if {_e1} != 0
play sound "block.anvil.place" at volume 10 at pitch 5 to player if {_e1} = 0
on left click:
{GenOwner::%location at event-block%} is set:
cancel event
{GenOwner::%location at event-block%} = player:
set event-block to air
give player {GenItem::%location at event-block%}
send action bar "&8『&a⛏&8』 &7Picked up generator!"
clear {GenOwner::%location at event-block%} and {GenItem::%location at event-block%} and {GenUpCost::%location at event-block%} and {GenTypeNum::%{_loc}%} and {GenId::%{_loc}%} and {GenDrop::%{_loc}%}
remove location at event-block from {OwnedGens::%player's uuid%::*}
play sound "entity.wither.break_block" at pitch 2 to player
else:
send action bar "&8『&c&l❌&8』 &7You do not own this generator!"
play sound "item.shield.break" to player
on right click:
player is sneaking:
{GenOwner::%location at event-block%} is set:
{GenOwner::%location at event-block%} = player:
{GenTypeNum::%location at event-block%} != size of {Gens::Blocks::*}:
player's balance >= {GenUpCost::%location at event-block%}:
remove {GenUpCost::%location at event-block%} parsed as number from player's balance
set {_i} to {GenTypeNum::%location at event-block%}+1
set event-block to {_i}nd element out of {Gens::Blocks::*}
set {GenItem::%location at event-block%} to {_i}nd element out of {Gens::GenItems::*}
set {GenTypeNum::%location at event-block%} to {_i}
set {GenUpCost::%location at event-block%} to {_i}nd element out of {Gens::UpgradeCosts::*}
set {GenDrop::%location at event-block%} to {_i}nd element out of {Gens::Drops::*}
play sound "block.anvil.place" to player
send action bar "&8『<#228B22>&l✔&8』 &7This generator has been upgraded! Next upgrade: &a$%{GenUpCost::%location at event-block%}%" to player
else:
send action bar "&8『&c&l❌&8』 &7You do not have enough money to upgrade! You need &a$%{GenUpCost::%location at event-block%}%" to player
play sound "item.shield.break" to player
else:
send action bar "&8『&c&l❌&8』 &7There are no more upgrades!" to player
play sound "item.shield.break" to player
else:
send action bar "&8『&c&l❌&8』 &7You do not own this generator!" to player
play sound "item.shield.break" to player
on join:
loop {OwnedGens::%player's uuid%::*}:
startDropping(player, loop-value, {GenId::%loop-value%})
on break:
{GenOwner::%location at event-block%} is set:
cancel event
send action bar "&8『&c&l❌&8』 &7You can not break a generator!" to player
play sound "item.shield.break" to player
command /getgen [<integer=1>]:
permission: staff.getgen.use
trigger:
{Gens::GenItems::%arg-1%} is set:
give player {Gens::GenItems::%arg-1%}
send action bar "&8『&4&lSTAFF&8』 &aGenerator has been given!"
play sound "block.anvil.place" to player
else:
send action bar "&8『&c&l❌&8』 &7That generator does not exist!" to player
play sound "item.shield.break" to player
on place:
if name of event-item is "&b&lBLUE WOOL &8[&a$10&8]":
cancel event
send "&cYou can not place gen drops." to playerEditor is loading...
Leave a Comment