you see an egg
This commit is contained in:
parent
bcbf753506
commit
4d972f8eaa
2 changed files with 58 additions and 5 deletions
Binary file not shown.
|
@ -1,12 +1,13 @@
|
||||||
|
|
||||||
import dataset
|
import dataset
|
||||||
|
import random
|
||||||
|
|
||||||
|
|
||||||
async def cheat(self, c, n, m):
|
async def cheat(self, c, n, m):
|
||||||
if not await self.is_admin(n):
|
if not await self.is_admin(n):
|
||||||
await self.message(c,'{} was a bad bad bad. {} got sucked into the oven'.format(n,n))
|
await self.message(c,'{} was a bad bad bad. {} got sucked into the oven'.format(n,n))
|
||||||
m = m.split(' ')
|
m = m.split(' ')
|
||||||
if len(m) > 2:
|
if len(m) < 2:
|
||||||
await message(c, 'i refuse.')
|
await message(c, 'i refuse.')
|
||||||
return
|
return
|
||||||
inv = self.db['inv']
|
inv = self.db['inv']
|
||||||
|
@ -18,17 +19,69 @@ async def bake(self, c, n, m):
|
||||||
await self.message(c, 'Dummy thicc you cant bake air!')
|
await self.message(c, 'Dummy thicc you cant bake air!')
|
||||||
return
|
return
|
||||||
inv = self.db['inv']
|
inv = self.db['inv']
|
||||||
its = (inv.find(name=n, item=m))
|
its = (inv.find_one(name=n, item=m))
|
||||||
supp = len(list(its))
|
if its == None:
|
||||||
if supp < 1:
|
|
||||||
await self.message(c, 'You dont have any {}'.format(m))
|
await self.message(c, 'You dont have any {}'.format(m))
|
||||||
return
|
return
|
||||||
await self.message(c, 'You bake one of your {}, and out pops a undefined!'.format(m))
|
|
||||||
|
# if item has value, use that, else use a okay value
|
||||||
|
if m in list(self.bakedGoods.keys()):
|
||||||
|
value = self.bakedGoods[m]
|
||||||
|
else:
|
||||||
|
value = 15
|
||||||
|
|
||||||
|
# consume the item
|
||||||
|
inv.delete(id=its['id'])
|
||||||
|
|
||||||
|
# oooo randomize what will pop out
|
||||||
|
value += random.uniform(-15, 15)
|
||||||
|
|
||||||
|
# choose the output
|
||||||
|
while value not in list(self.bakedPrice.keys()):
|
||||||
|
value = int(value - 1)
|
||||||
|
if value < 0:
|
||||||
|
value = 0
|
||||||
|
|
||||||
|
newitem = self.bakedPrice[value]
|
||||||
|
|
||||||
|
inv.insert(dict(name=n, item=newitem))
|
||||||
|
|
||||||
|
await self.message(c, 'You bake your {}, and out pops a {}!'.format(m, newitem))
|
||||||
|
|
||||||
|
async def invsee(self, c, n, m):
|
||||||
|
if len(m) < 1:
|
||||||
|
m = n
|
||||||
|
inv = self.db['inv']
|
||||||
|
it = [ i['item'] for i in inv.find(name=m) ]
|
||||||
|
if len(it) < 1:
|
||||||
|
await self.message(c, 'you look through your kitchen and see nothing')
|
||||||
|
else:
|
||||||
|
await self.message(c, 'you look through your kitchen and see {}'.format(' '.join(it)))
|
||||||
|
|
||||||
async def init(self):
|
async def init(self):
|
||||||
self.db = dataset.connect('sqlite:///database.db')
|
self.db = dataset.connect('sqlite:///database.db')
|
||||||
|
|
||||||
self.cmd['bake'] = bake
|
self.cmd['bake'] = bake
|
||||||
self.cmd['cheat'] = cheat
|
self.cmd['cheat'] = cheat
|
||||||
|
self.cmd['inv'] = invsee
|
||||||
|
self.cmd['items'] = invsee
|
||||||
|
self.cmd['goods'] = invsee
|
||||||
|
|
||||||
|
self.bakedGoods = {
|
||||||
|
'cheese': 50,
|
||||||
|
'wheat': 1,
|
||||||
|
'turd': 0,
|
||||||
|
'flour': 10,
|
||||||
|
'bread': 30,
|
||||||
|
'crispy': 15,
|
||||||
|
'tortilla': 35,
|
||||||
|
'egg': 20,
|
||||||
|
'bird': 32,
|
||||||
|
'erotic': 69,
|
||||||
|
'phallic': 65,
|
||||||
|
'pizza': 34,
|
||||||
|
'hairball': 6,
|
||||||
|
'cookie': 44
|
||||||
|
}
|
||||||
|
self.bakedPrice = dict((v,k) for k,v in self.bakedGoods.items())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue