Date: 2015/07/22 11:21: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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
Drop:
type: command
speed: 0
debug: false
name: Drop
description: Setze Drops
usage: /drops
aliases:
- drops
allowed help:
- determine true
commandArgs:
setzen:
usage: '/drop setzen'
erzeugen:
usage: '/drop erzeugen'
loeschen:
usage: '/drop loeschen'
anzeige:
usage: '/drop anzeige'
hinzu:
usage: 'drop hinzu'
script:
- define command '<c.args.get[1].escaped||help]>'
- define args '<script.list_keys[commandargs].alphanumeric.to_lowercase||li@>'
- if !<def[args].contains[%command%]> {
- inject local help
}
else {
- inject local %command% }
setzen:
- if <player.is_op> {
- if <c.args.get[2]||null> == null {
- narrate "<yellow>[DropWorld] <gray>Du musst diesen Ort einen Namen geben!"
- queue clear }
- if <yaml[spawning].list_keys[Drop]||null> contains <c.args.get[2]> {
- narrate "<yellow>[DropWorld] <gray>Der Name exestiert schon!"
- queue clear }
- if <c.args.get[2].length> >= 9 {
- narrate "<yellow>[DropWorld] <gray>Der Name darf nur maximal 8 Buchstaben lang sein!!"
- queue clear }
- if <c.args.get[3]||null> == null {
- narrate "<yellow>[DropWorld] <gray>Bitte gib eine Wahrscheinlichkeit noch an!"
- queue clear }
- if <c.args.get[3].as_int||null> == null {
- narrate "<yellow>[DropWorld] <gray>Es sollte schon eine Zahl sein!"
- queue clear }
- if <c.args.get[3]> <= 0 || <c.args.get[3]> > 1000 {
- narrate "<yellow>[DropWorld] <gray>Es stehen dir Zahlen zwischen 1 und 1000 zur Verf<ü>gung!"
- queue clear }
- define name <c.args.get[2]>
- define location <player.location.simple>
- define wahrscheinlichkeit <c.args.get[3]>
- define sichtwinkel <player.location.cursor_on.add[0.5,0,0.5]>
- narrate %sichtwinkel%
- foreach <player.location.find.blocks[chest].within[10]> {
- if %value% == %sichtwinkel% {
- define slotzahl 1
- while true {
- define itemm <%value%.inventory.slot[<def[slotzahl].as_int>].simple>
- if <%value%.inventory.slot[1].simple> == i@air {
- narrate "<yellow>[DropWorld] <red> Es muss aufjedenfall in Slot 1 ein Item sein! Dies wird immer gedropt egal welche wahrscheinlichkeit, dient dazu immer ein item spawnen zu lassen!"
- queue clear }
- if %itemm% !== i@air {
- define itemanzahl <%value%.inventory.qty[%itemm%].as_int>
- if <yaml[spawning].list_keys[Drop.%name%.item]> !contains %itemm% {
- yaml id:spawning set Drop.%name%.item.%itemm%.itemanzahl:->:%itemanzahl%
- yaml id:spawning set Drop.%name%.item.%itemm%.wahrscheinlichkeit:->:%wahrscheinlichkeit% } }
- define slotzahl <math:%slotzahl%+1>
- if <def[slotzahl]> == 28 {
- narrate "<yellow>[DropWorld] <gray>Gespeichert als <yellow>N:<gray>[%name%] <yellow>O:<gray>[%location%] <yellow>I:<gray>[S. Kiste] <yellow>A:<gray>[S. Kiste] <yellow>W:<gray>[%wahrscheinlichkeit%]"
- yaml id:spawning set Drop.%name%.Ort:->:%location%
- yaml savefile:dropeinstellung/spawning.yml id:spawning
- queue clear }
}
}
}
- narrate "<yellow>[DropWorld] <red>Cursor muss sich auf einer Truhe in deiner n<ä>he befinden!"
- queue clear
}
- narrate "<yellow>[DropWorld] <red>Du hast auf diesen Befehl kein Zugriff!"
- queue clear
loeschen:
- if <player.is_op> {
- if <c.args.get[2]||null> == null {
- narrate "<yellow>[DropWorld] <gray>Du musst diesen Ort einen Namen geben!"
- queue clear }
- if <yaml[spawning].list_keys[Drop]||null> !contains <c.args.get[2]> {
- narrate "<yellow>[DropWorld] <gray>Der Name exestiert nicht in deiner Liste!"
- queue clear }
- define name <c.args.get[2]>
- narrate "<yellow>[DropWorld] <gray>Deine Position %name% wurde gel<ö>scht!"
- yaml id:spawning set Drop.%name%:!
- yaml savefile:dropeinstellung/spawning.yml id:spawning
- queue clear
}
- narrate "<yellow>[DropWorld] <red>Du hast auf diesen Befehl kein Zugriff!"
- queue clear
erzeugen:
- if <player.is_op> || <c.server> {
- define eingabe <context.args.get[2]||null>
- if %eingabe% == null {
- narrate "<yellow>[DropWorld] <gray>Bitte gib einen Namen ein!"
- queue clear
}
- if <yaml[spawning].list_keys[Drop]||null> !contains %eingabe% {
- narrate "<yellow>[DropWorld] <gray>Der Name exestiert nicht in der Liste!"
- queue clear
}
- define ort <yaml[spawning].read[drop.%eingabe%.ort].as_string>
- foreach <yaml[spawning].list_keys[drop.%eingabe%.item]> {
- narrate %value%
- flag server item_%eingabe%:->:%value%
}
- while true {
- define zahl <util.random.int[1].to[27]>
- define itemm <server.flag[item_%eingabe%].as_list.get[<def[zahl]>].simple||null>
- if %itemm% !== null {
- define itemanzahl <yaml[spawning].read[drop.%eingabe%.item.%itemm%.itemanzahl].as_String>
- define wahrscheinlichkeit <yaml[spawning].read[drop.%eingabe%.item.<def[itemm].simple>.wahrscheinlichkeit].as_string>
- while stop
}
}
- if <util.random.int[1].to[1000]> <= %wahrscheinlichkeit% {
- drop %itemm% location:%ort% qty:%itemanzahl%
- flag server item_%eingabe%:!
- narrate "wurde gespawnt: %itemm% mit %wahrscheinlichkeit%"
- queue clear
} else {
- define %itemm% <server.flag[item_%eingabe%].as_list.get[1]>
- drop %itemm% location:%ort% qty:%itemanzahl%
- flag server item_%eingabe%:!
- queue clear
}
}
- narrate "<yellow>[DropWorld] <red>Du hast auf diesen Befehl kein Zugriff!"
- queue clear
anzeige:
- if <player.is_op> {
- define count 1
- narrate "<gray>_______________<yellow>[Drop World]<gray>_______________"
- narrate ""
- foreach <yaml[spawning].list_keys[Drop]||null> {
- narrate "<red>[<def[count].as_int>] <yellow>N: <gray>%value% <yellow>O: <gray><yaml[spawning].read[Drop.%value%.ort].as_string||null> <yellow>I: <gray><yaml[spawning].read[Drop.%value%.item].as_string||null> <yellow>A: <gray><yaml[spawning].read[Drop.%value%.itemanzahl].as_string||null> <yellow>W: <gray><yaml[spawning].read[Drop.%value%.wahrscheinlichkeit].as_string||null>"
- define count <math:%count%+1> }
- queue clear
}
- narrate "<yellow>[DropWorld] <red>Du hast auf diesen Befehl kein Zugriff!"
- queue clear
help:
- if <player.is_op> {
- narrate "<gray>_______________<yellow>[Drop World]<gray>_______________"
- narrate ""
- narrate "<yellow>/drop setzen NAME ITEMANZAHL WAHRSCHEINLICHKEIT <gray>[Drop-Punkt unter Spieler]"
- narrate "<yellow>/drop loeschen NAME <gray>[L<ö>scht den Drop-Punkt]"
- narrate "<yellow>/drop erzeugen NAME <gray>[Spawnt Item am Drop-Punkt]"
- narrate "<yellow>/drop anzeige <gray>[Zeigt alle Drop-Orte an]"
}