Пример #1
0
	def load_card_info(self):
		pre_glob_path = os.path.join(self.base_path,'cards','*.json')
		card_files = glob.glob(pre_glob_path)
		for card_file in card_files:
			obj = PPjo(filename=card_file)
			card = obj.get_object('card')
			key = obj.get_string('index')
			name = card.get_string('name')
			effect = card.get_string('effect')
			self.db.update('insert into play_card_names values(%s,"%s","%s")'%
				(key,name,effect))
Пример #2
0
	def update_game(self,resp):
		#with open("ASDF.json","w") as f:
		#	f.write(str(resp))
		obj = PPjo(resp)
		respType = obj.get_string("respType")
		if respType == "ok":
			command = obj.get_string("command")
			gameId = obj.get_int("gameId")
			message = obj.get_string("message")
			gameRepr = obj.get_object("gameRepr")
			self.games[gameId] = Game(gameRepr.get_object("game"))
			self.current_game_id = gameId
			return message
		else:
			return 'Received error message: %s'%respType