Date: 2020/07/09 10:26:34 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# |==================================|
# | Slime Economy |
# | Internal economy manager for |
# | $lime. |
# |==================================|
#
# Author: mcmonkey
# For: New2PC
# Denizen version: REL-1710
# Original Date: 2019-08-11
# Last Update Date: 2020-06-10
#
# Setup:
# Just add the script.
# Adjust the ranks list below.
#
# Give ops permissions:
# slime.balance.other
# slime.eco.edit
#
slime_max_money:
type: procedure
debug: false
definitions: player
script:
- define player <[player]||<player>>
# ================ List ranks -> amount here, keep it from highest to lowest. ================
- if <[player].has_permission[eco.500000]>:
- determine 500000
- if <[player].has_permission[eco.250000]>:
- determine 250000
- if <[player].has_permission[eco.100000]>:
- determine 100000
- if <[player].has_permission[eco.50000]>:
- determine 50000
- if <[player].has_permission[eco.10000]>:
- determine 10000
- if <[player].has_permission[eco.5000]>:
- determine 5000
# The default limit
- determine 2500
# ================ End editable ================
Slime_Economy:
type: economy
debug: false
priority: normal
name single: $lime
name plural: $limes
digits: 0
format: $<amount.round>
balance: <player.flag[slime_money].round||0>
has: <player.money.is[or_more].than[<amount.round>]||false>
withdraw:
- flag <player> slime_money:-:<[amount].round>
deposit:
- if !<player.is_online>:
- flag player banked_money:+:<[amount].round>
- stop
- define orig_money <player.money>
- flag <player> slime_money:+:<[amount].round>
- if <player.flag[slime_money]> > <proc[slime_max_money]>:
- flag player slime_money:<proc[slime_max_money]>
- narrate "<red>You lost <green><server.economy.format[<[amount].add[<[orig_money]>].sub[<player.money>]>]><red> to the void, due to exceeding your max."
balance_command:
type: command
debug: false
name: balance
usage: /balance
description: Shows your current balance.
aliases:
- bal
script:
- if <context.args.size> == 0:
- narrate "<gold>Your wallet balance is <green><player.formatted_money><gold>. Your max is <server.economy.format[<proc[slime_max_money]>]>."
- else if <player.has_permission[slime.balance.other].global>:
- define player <server.match_offline_player[<context.args.get[1]>]||null>
- if <[player]> == null:
- narrate "<red>'<context.args.get[1]>' is not a valid player."
- stop
- narrate "<green><[player].name><gold>'s balance is <green><[player].money.formatted><gold>."
- else:
- narrate "<red>You don't have permission to look at the balance of others."
- stop
pay_command:
type: command
debug: false
name: pay
usage: /pay [player] [amount]
description: Sends money to a player.
script:
- if <context.args.size.is[less].than[2]>:
- narrate "<red>/pay [player] [amount]"
- stop
- define player <server.match_offline_player[<context.args.get[1]>]||null>
- if <[player]> == null:
- narrate "<red>'<context.args.get[1]>' is not a valid player."
- stop
- define amount <context.args.get[2].escaped>
- if !<[amount].is_decimal>:
- narrate "<red>'<[amount]>' is not a valid number."
- stop
- if <[amount]> <= 0:
- narrate "<red>May only pay a positive number."
- stop
- if <[amount]> > <player.money>:
- narrate "<red>You don't have <green><server.economy.format[<[amount]>]><red> in your wallet."
- stop
- define targetmax <proc[slime_max_money].context[<[player]>]>
- if <[amount].add[<[player].money>]> > <[targetmax]>:
- narrate "<green><[player].name><gold> does not have room in their wallet for <green><server.economy.format[<[amount]>]><red>."
- stop
- take money quantity:<[amount]>
- give money quantity:<[amount]> player:<[player]>
- narrate "<gold>Sent <server.economy.format[<[amount]>]><gold> to <green><[player].name><gold>."
- narrate "<gold>You received <server.economy.format[<[amount]>]><gold> from <green><player.name><gold>." t:<[player]>
economy_command:
type: command
name: economy
usage: /economy give/take/set [player] [amount]
description: Gives, takes, or sets the economy value for a specific player.
aliases:
- eco
- slimeeconomy
- slimeeco
permission: slime.eco.edit
script:
- if <context.args.size.is[less].than[3]> || give|take|set !contains <context.args.get[1]>:
- narrate "<red>/economy give/take/set [player] [amount]"
- stop
- define player <server.match_offline_player[<context.args.get[2]>]||null>
- if <[player]> == null:
- narrate "<red>'<context.args.get[1]>' is not a valid player."
- stop
- define amount <context.args.get[3].escaped>
- if !<[amount].is_decimal>:
- narrate "<red>'<[amount]>' is not a valid number."
- stop
- choose <context.args.get[1]>:
- case give:
- give money quantity:<[amount]> player:<[player]>
- case take:
- take money quantity:<[amount]> player:<[player]>
- case set:
- money set quantity:<[amount]> player:<[player]>
- narrate "<green><[player].name><gold>'s balance has been updated to <green><[player].money.formatted><gold>."