Date: 2014/09/19 13:21:52 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
"StartPrison":
type: world
debug: false
events:
on server start:
- ^inject SetRanks
- run PrisonScoreboard
on reload scripts:
- ^inject SetRanks
- ^foreach <w@Prison.players> {
- ^flag %value% sbrank:!
- ^flag %value% sbbalance:!
- ^flag %value% sbnextrank:!
- ^flag %value% sbneeded:!
}
- ^run PrisonScoreboard
on player join:
- ^scoreboard remove id:rank<player.name>
- ^flag player sbrank:!
- ^flag player sbbalance:!
- ^flag player sbnextrank:!
- ^flag player sbneeded:!
- run StartPlayerScoreboardHeaders as:<player> instantly
- execute as_player "/spawn"
on player quit:
- ^flag player sbrank:!
- ^flag player sbbalance:!
- ^flag player sbnextrank:!
- ^flag player sbneeded:!
on player right clicks dispenser:
- if !<player.is_op> && <player.location.world> == w@Prison {
- determine cancelled
}
on player right clicks dropper:
- if !<player.is_op> && <player.location.world> == w@Prison {
- determine cancelled
}
on sbreset command:
- ^flag player sbrank:!
- ^flag player sbbalance:!
- ^flag player sbnextrank:!
- ^flag player sbneeded:!
- scoreboard remove id:rank<player.name>
- run StartPlayerScoreboardHeaders as:<player>
- determine fulfilled
"PrisonScoreboard":
type: task
debug: false
script:
- foreach <server.list_online_players> {
- run UpdateScoreboard as:%value% instantly
}
- wait 10s
- run PrisonScoreboard
"UpdateScoreboard":
type: task
debug: false
script:
- ^inject GetPlayerRank
- ^define prank <player.flag[rank]>
- ^define nrank <global.flag[Ranks.list].as_list.get[<global.flag[Ranks.list].as_list.find[%prank%].sub[1].as_int>]>
- ^define balance <proc[formatmoney].context[<player.money>]>
- ^define nextrank <proc[formatmoney].context[<global.flag[Ranks.%nrank%.Amount]>]>
- ^define needed <global.flag[Ranks.%nrank%.Amount].sub[<player.money>]>
- ^define needed <proc[formatmoney].context[<tern[<def[needed].as_int.is[LESS].than[0]>]:0||%needed%>]>
- ^define pname <player.name>
- if <player.flag[sbrank].is[!EQUALS].to[%prank%]> {
- ^scoreboard remove id:rank%pname% "obj:<red>Ranking Info" score:8 lines:<player.flag[sbrank]>
- ^flag player sbrank:%prank%
- ^scoreboard add id:rank%pname% "obj:<red>Ranking Info" score:8 lines:%prank%
}
- if <player.flag[sbbalance].is[!EQUALS].to[<def[balance]>]> {
- ^scoreboard remove id:rank%pname% "obj:<red>Ranking Info" score:6 lines:<player.flag[sbbalance]>
- ^flag player "sbbalance:<def[balance]>"
- ^scoreboard add id:rank%pname% "obj:<red>Ranking Info" score:6 lines:<def[balance]>
}
- if <player.flag[sbnextrank].is[!EQUALS].to[<def[nextrank]>]> {
- ^scoreboard remove id:rank%pname% "obj:<red>Ranking Info" score:4 lines:<player.flag[sbnextrank]>
- ^flag player sbnextrank:<def[nextrank]>
- ^scoreboard add id:rank%pname% "obj:<red>Ranking Info" score:4 lines:<def[nextrank]>
}
- if <player.flag[sbneeded].is[!EQUALS].to[<def[needed]>]> {
- ^scoreboard remove id:rank%pname% "obj:<red>Ranking Info" score:2 lines:<player.flag[sbneeded]>
- ^flag player sbneeded:<def[needed]>
- ^scoreboard add id:rank%pname% "obj:<red>Ranking Info" score:2 lines:<def[needed]>
}
"StartPlayerScoreBoardHeaders":
type: task
debug: false
script:
- ^define pname <player.name>
- ^scoreboard add id:rank%pname% "obj:<red>Ranking Info" score:9 "lines:<blue><bold>Rank"
- ^scoreboard add id:rank%pname% "obj:<red>Ranking Info" score:7 "lines:<blue><bold>Balance"
- ^scoreboard add id:rank%pname% "obj:<red>Ranking Info" score:5 "lines:<blue><bold>Next Rank"
- ^scoreboard add id:rank%pname% "obj:<red>Ranking Info" score:3 "lines:<blue><bold>Needed"
- ^scoreboard id:rank%pname% viewers:%pname%
- run UpdateScoreboard instantly
"GetPlayerRank":
type: task
debug: false
script:
- foreach <global.flag[Ranks.List].as_list> {
- if <player.in_group[%value%]> {
- ^flag player rank:%value%
- foreach stop
}
}
- if !<player.has_flag[rank]> ^flag player rank:Prisoner
"SetRanks":
type: task
debug: false
script:
- ^flag global Ranks:!
- ^flag global Ranks.List:|:Free|Z|Y|X|W|V|U|T|S|R|Q|P|O|N|M|L|K|J|I|H|G|F|E|D|C|B|A|Prisoner
- ^flag global Ranks.Prisoner.Amount:0
- ^flag global Ranks.A.Amount:0
- ^flag global Ranks.B.Amount:30000
- ^flag global Ranks.C.Amount:75000
- ^flag global Ranks.D.Amount:120000
- ^flag global Ranks.E.Amount:200000
- ^flag global Ranks.F.Amount:400000
- ^flag global Ranks.G.Amount:750000
- ^flag global Ranks.H.Amount:1000000
- ^flag global Ranks.I.Amount:5000000
- ^flag global Ranks.J.Amount:10000000
- ^flag global Ranks.K.Amount:15000000
- ^flag global Ranks.L.Amount:20000000
- ^flag global Ranks.M.Amount:30000000
- ^flag global Ranks.N.Amount:50000000
- ^flag global Ranks.O.Amount:75000000
- ^flag global Ranks.P.Amount:100000000
- ^flag global Ranks.Q.Amount:200000000
- ^flag global Ranks.R.Amount:400000000
- ^flag global Ranks.S.Amount:750000000
- ^flag global Ranks.T.Amount:1000000000
- ^flag global Ranks.U.Amount:1500000000
- ^flag global Ranks.V.Amount:2000000000
- ^flag global Ranks.W.Amount:3000000000
- ^flag global Ranks.X.Amount:5000000000
- ^flag global Ranks.Y.Amount:7500000000
- ^flag global Ranks.Z.Amount:10000000000
- ^flag global Ranks.Free.Amount:20000000000
#
# Inject task script for all mines to rank up
#
"rankup":
type: assignment
debug: true
script:
# If the NPC guard has the mission flag and the players flag for that mission is false
- ^define mine <npc.name.char_at[1]>
- ^define pmine <global.flag[Ranks.list].as_list.get[<global.flag[Ranks.list].as_list.find[%mine%].add[1].as_int>]>
- if <player.in_group[%mine%]> {
- ^narrate "You have already ranked up to %mine%, please proceed to the mine or use /warp %mine%."
} else if !<player.in_group[%pmine%]> {
- ^narrate "You haven't achieved Rank %pmine% yet. Come back later."
} else if <player.money> >= <global.flag[Ranks.%mine%.Amount].as_int> {
- ^narrate "Taking your fee to rank up."
- ^take money qty:<global.flag[Ranks.%mine%.Amount].as_int>
- ^narrate "You have now achieved the <gold>Prisoner Rank of %mine%!"
- ^announce "<white>Prisoner <gold><player.name><white> has achieved <red> Rank %mine%"
- ^wait 1
- ^group add %mine% world:prison
- ^narrate "You may now proceed to mine %mine%."
} else {
- ^narrate "You don't have the required fee to rank up."
- ^narrate "Come back when you have <proc[formatmoney].context[<global.flag[Ranks.%mine%.Amount]>]>."
}
# - ^execute as_server "manselect Prison"
# - ^execute as_server "manuaddsub <player.name> %mine%"