Ejemplo n.º 1
0
	def from_string(cls, s):
		if "#" in s:
			id, charm_list = s.split("#")
		else:
			id = s
			charm_list = s
		gear = []
		for charms in charm_list.split():
			num, charm_id = charms.split("x")
			gear.append((DataHandler.load_charm_from_id(charm_id), int(num)))
		return cls(id, gear)
Ejemplo n.º 2
0
	def from_json_obj(cls, obj):
		id = obj['id']
		gear = obj['gear']
		gear = [(DataHandler.load_charm_from_id(charm['charm_id']), charm['number']) for charm in gear]
		return cls(id, gear)