Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- THINGS = []
- LEVELS = 19
- class thing:
- def __init__(self,name,prob,amount=[1,1],requireByLevel=LEVELS):
- self.name = name
- self.prob = prob
- self.amount = amount
- self.requireByLevel = requireByLevel
- self.appeared = False
- THINGS.append(self)
- def get(self,level):
- #force generate
- if level >= self.requireByLevel and not self.appeared:
- self.appeared = True
- return '1'
- #generate nothing
- if random.randint(1,100) > self.prob: return ''
- #generate an amount
- self.appeared = True
- total = 0
- for i in xrange(self.amount[0]):
- total += random.randint(1,self.amount[1])
- return str(total)
- def getline(self):
- txt = self.name
- for i in xrange(LEVELS):
- txt += ','+self.get(i)
- return txt+'\n'
- thing('pystol',10)
- thing('pump',5,[1,1],0)
- thing('agl',5,[1,1],0)
- thing('revolver',10,[1,1],1)
- thing('automaat',10,[1,1],2)
- thing('riflehv',10,[1,1],5)
- thing('rifle',10,[1,1],8)
- thing('lasgun',10,[1,1],10)
- thing('taser',5,[1,1],18)
- thing('pyammo',100,[2,3])
- thing('ppammo',80,[1,2])
- thing('revolverammo',75,[1,2])
- thing('auammo',90,[1,2])
- thing('hvammo',60,[1,3])
- thing('riammo',90)
- thing('pexpammo',100)
- thing('battery',75,[1,3])
- thing('smtimebomb',100,[2,3])
- thing('timebomb',60)
- thing('cmeat',100,[1,2])
- thing('medkit',75,[1,1],True)
- thing('smmedkit',95,[1,3])
- thing('tube',80)
- thing('fattube',15)
- thing('emptycan',75)
- thing('hardware',75)
- thing('mchip',75,[1,2])
- thing('metalplate',75,[1,3])
- thing('motor',5)
- thing('magnet',5)
- thing('nailbox',95,[1,2])
- thing('minigun',1,[1,1],18)
- items = open('items.csv','w')
- items.write('A level items:,1,2,3,4,5,6,7,8,9,10,2b,3b,4b,6b,8b\n')
- for i in THINGS:
- items.write(i.getline())
- items.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement