def write_battlelog(): """writes the battle log to persistent storage.""" print "writing battle log here." """addr = 'localhost', 9101 storage = ClientStorage.ClientStorage(addr) db = DB(storage) conn = db.open() logs = conn.root()""" '''logs should be indexed by a hash of starttime and where the battle happened. ...or something ''' game.log['world_coords'] = world_coords out = get_persisted(game.log) #print "out type %s" %type(out) ##logs['battle'][game.log['end_time']] = out #main.out = out ##transaction.commit() print game.log['change_list']
def jsonrpc_initial_state(self): #needs to filter if self.settings.init_state == None: self.settings.init_state = \ yield get_persisted(self.settings.game.initial_state()) defer.returnValue(self.settings.init_state)
from binary_tactics.player import Player from binary_tactics.units import Squad from stores.store import get_persisted #which is actually buggy in this case. import pycassa pool = pycassa.connect('bt') cf = pycassa.ColumnFamily(pool, 'PLAYERS') p = Player({}, 'player 1', get_persisted(Squad()), {}, {}, {}) foo = {'1': p} cf.insert(foo.keys()[0], foo['1']) === from stores.store import * from binary_tactics.player import Player from binary_tactics.helpers import * from binary_tactics.weapons import * from binary_tactics.units import * from binary_tactics.stone import *
from binary_tactics.units import Scient, Squad, Stone from stores import yaml_store from binary_tactics.weapons import * from stores.store import get_persisted from stores.yaml_store import * from copy import deepcopy sq1 = Squad() s = Scient('Fire', Stone((2, 4, 0, 2))) s.equip(Sword('Fire', Stone())) for n in xrange(3): sq1.append(deepcopy(s)) s = Scient('Wind', Stone((0, 2, 2, 4))) s.equip(Wand('Wind', Stone())) for n in xrange(2): sq1.append(deepcopy(s)) i = Scient('Ice', Stone((2, 0, 4, 2))) i.equip(Glove('Ice', Stone())) for n in xrange(3): sq1.append(deepcopy(i)) sq0 = deepcopy(sq1) sq0.name = "pt_0" sq1.name = "pt_1" for n in xrange(len(sq0)): sq0[n].location = Loc(n + 4, 4) sq1[n].location = Loc(n + 4, 11) yaml.dump(get_persisted(sq0), file('pt_0.yaml', 'w')) yaml.dump(get_persisted(sq1), file('pt_1.yaml', 'w'))
from binary_tactics.units import Scient, Squad, Stone from stores import yaml_store from binary_tactics.weapons import * from stores.store import get_persisted from stores.yaml_store import * from copy import deepcopy sq1 = Squad() s = Scient('Fire', Stone((2,4,0,2))) s.equip(Sword('Fire', Stone())) for n in xrange(3): sq1.append(deepcopy(s)) s = Scient('Wind', Stone((0,2,2,4))) s.equip(Wand('Wind', Stone())) for n in xrange(2): sq1.append(deepcopy(s)) i = Scient('Ice', Stone((2,0,4,2))) i.equip(Glove('Ice', Stone())) for n in xrange(3): sq1.append(deepcopy(i)) sq0 = deepcopy(sq1) sq0.name = "pt_0" sq1.name = "pt_1" for n in xrange(len(sq0)): sq0[n].location = Loc(n+4, 4) sq1[n].location = Loc(n+4, 11) yaml.dump(get_persisted(sq0), file('pt_0.yaml', 'w')) yaml.dump(get_persisted(sq1), file('pt_1.yaml', 'w'))