-
Notifications
You must be signed in to change notification settings - Fork 6
/
Database.rb
49 lines (37 loc) · 1.04 KB
/
Database.rb
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
module Database
def self.load_items
$data_items = Array.new(1)
items = File.readlines("database/objects.txt").map { |line| line.chomp }
#@items = []
for i in 0...items.size
$data_items.push(items[i].split(';'))
end
end
def self.load_npcs(npc)
npc_load = File.readlines("events/"+npc+".txt").map { |line| line.chomp }
x = npc_load[1]
x.gsub!('x:', '')
y = npc_load[2]
y.gsub!('y:', '')
filename = npc_load[3]
filename.gsub!('filename:', '')
movement = npc_load[4]
movement.gsub!('movement:', '')
movement = eval(':'+movement)
face = npc_load[5]
face.gsub!('face:', '')
face = eval(':'+face)
solid = npc_load[6]
solid.gsub!('solid:', '')
solid = eval(solid)
route = npc_load[7]
route.gsub!('route:', '')
commands = []
for i in 0...npc_load.size
next if (0...8).include?(i)
commands.push(npc_load[i])
end
commands.to_s.gsub!('commands:', '')
return x.to_i,y.to_i,filename,movement,face,solid,route,commands
end
end