def set(self, username, password): #FIX try: self.conn.sync() assert not self.root['Players'][username].password except Exception: #this exception looks dangerous self.root['Players'][username] = wPlayer(username, password) self.root._p_changed = 1 return transaction.commit()
def set(self, username, password): # FIX try: self.conn.sync() assert not self.root["Players"][username].password except Exception: # this exception looks dangerous self.root["Players"][username] = wPlayer(username, password) self.root._p_changed = 1 return transaction.commit()
def do_it(): world['resigntime'] = 21600#amount of time in seconds before attacker is forced to resign. world['version'] = version world['x'] = x world['y'] = y world['DOB'] = datetime.utcnow() #Fields should be a frozendict #http://stackoverflow.com/questions/2703599/what-would-be-a-frozen-dict world['Fields'] = {} world['Players'] = persistent.mapping.PersistentMapping() player = wPlayer('World', None) world['Players']['World'] = player make_wFields(world['x'], world['y']) transaction.commit()
"""creates the World object and populates it with fields. VERY DESTRUCTIVE.""" from equanimity.world import wPlayer, World, Stone #from stores.yaml_store import load from binary_tactics.const import * w = World() wr = w.root w.open_connection() w.create() #player stuff w.add_player(wPlayer('dfndr', 'dfndr')) w.add_player(wPlayer('atkr', 'atkr')) w.award_field('World', '(0, 0)', 'dfndr') w.award_field('World', '(0, 1)', 'atkr') #Fields are automatically populated with Ice mins. #below we create attacking Fire mins. #get fields af = wr['Players']['atkr'].wFields['(0, 1)'] df = wr['Players']['dfndr'].wFields['(0, 0)'] #get stronghold. afs = af.stronghold #put Fire min stones into stronghold. afs._add_stones([Stone((2, 4, 0, 2)) for n in xrange(4)]) #create scients. for n in xrange(4): afs._form_scient('Fire', -1)
"""creates the World object and populates it with fields. VERY DESTRUCTIVE.""" from equanimity.world import wPlayer, World, Stone #from stores.yaml_store import load from binary_tactics.const import * w = World() wr = w.root w.open_connection() w.create() #player stuff w.add_player(wPlayer('dfndr', 'dfndr')) w.add_player(wPlayer('atkr', 'atkr')) w.award_field('World', '(0, 0)', 'dfndr') w.award_field('World', '(0, 1)', 'atkr') #Fields are automatically populated with Ice mins. #below we create attacking Fire mins. #get fields af = wr['Players']['atkr'].wFields['(0, 1)'] df = wr['Players']['dfndr'].wFields['(0, 0)'] #get stronghold. afs = af.stronghold #put Fire min stones into stronghold. afs._add_stones([Stone((2,4,0,2)) for n in xrange(4)]) #create scients. for n in xrange(4): afs._form_scient('Fire', -1)