-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathauto_include.ms
59 lines (48 loc) · 1.49 KB
/
auto_include.ms
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
#########################################
# Copyright 2016 ITSTAKE GPL v2.0
# Script by itstake ([email protected])
#########################################
proc(_itemmenu_create, @array,
if(import('MenuOpen'.player()) != true) {
export('MenuOpen'.player(), true)
export('CurMenu'.player(), @array)
@title = @array['title']
@id = @array['id']
if(array_index_exists(@array, size)) {
@size = @array['size']
} else {
@size = ceil((array_size(@array['menu'])) / 9) * 9 # Dynamically set the size
}
@chest = array(id: @id, size: @size, title: @title)
@items = @array['menu']
foreach(@key:@value in @items) {
array_set(@chest, @key, @value['item'])
}
create_virtualchest(@chest)
popen_virtualchest(@id)
)
proc(_itemmenu_update, @array,
export('MenuOpen'.player(), true)
export('CurMenu'.player(), @array)
@title = @array['title']
@id = @array['id']
if(array_index_exists(@array, size)) {
@size = @array['size']
} else {
@size = ceil((array_size(@array['menu'])) / 9) * 9 # Dynamically set the size
}
@chest = array(id: @id, size: @size, title: @title)
@items = @array['menu']
for(@i = 0, @i < @size, @i++,
if(!array_index_exists(@items, @i)) {
array_set(@chest, @i, array(type: 0,data: 0,qty: 0))
}
)
foreach(@key:@value in @items) {
array_set(@chest, @key, @value['item'])
}
msg(@chest)
create_virtualchest(@chest)
popen_virtualchest(@id)
}
)