-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitemcreator.py
36 lines (30 loc) · 1.05 KB
/
itemcreator.py
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
class Item (object):
def __init__(self, name, id, desc, type, price, shoplevel, output):
self.name = name
self.id = id
self.desc = desc
self.type = type
self.price = price
self.shoplevel = shoplevel
self.output = output
def load_item_file(file):
itemfile = open(file, "r")
itemlist = []
linelist = []
for line in itemfile:
linelist.append(line.strip())
while linelist[0] != "STOP":
if linelist[5] == "never":
s = None
else:
s = int(linelist[5])
if linelist[3] == "weapon":
l = linelist[6].split("-")
for x in range(0, len(l)):
l[x] = int(l[x])
itemlist.append(Item(linelist[0], linelist[1], linelist[2], linelist[3], int(linelist[4]), s, l))
elif linelist[3] == "potion":
itemlist.append(Item(linelist[0], linelist[1], linelist[2], linelist[3], int(linelist[4]), s, int(linelist[6])))
for x in range(0, 8):
del(linelist[0])
return itemlist