示例#1
0
def load(self):
    data = general.get_config(self.path, base=env.USER_DIR)
    if data.has_option("main", "data_ver"):
        data_ver = data.get("main", "data_ver")
    else:
        data_ver = "1.0.0"
    name_map[data_ver](self, data)
示例#2
0
def load(self):
	data = general.get_config(self.path, base=env.USER_DIR)
	if data.has_option("main", "data_ver"):
		data_ver = data.get("main","data_ver")
	else:
		data_ver = "1.0.0"
	name_map[data_ver](self, data)
示例#3
0
def save(self):
    data = general.get_config()
    data.add_section("main")
    data.set("main", "data_ver", str(env.USERDATA_FORMAT_VERSION))
    data.set("main", "id", str(self.id))
    data.set("main", "name", str(self.name))
    data.set("main", "gmlevel", str(self.gmlevel))
    data.set("main", "race", str(self.race))
    data.set("main", "race_motion", str(self.race_motion))
    data.set("main", "form", str(self.form))
    data.set("main", "gender", str(self.gender))
    data.set("main", "hair", str(self.hair))
    data.set("main", "haircolor", str(self.haircolor))
    data.set("main", "wig", str(self.wig))
    data.set("main", "face", str(self.face))
    data.set("main", "base_lv", str(self.base_lv))
    data.set("main", "ex", str(self.ex))
    data.set("main", "wing", str(self.wing))
    data.set("main", "wingcolor", str(self.wingcolor))
    data.set("main", "job", str(self.job))
    data.set("main", "map_id", str(self.map_id))
    data.set("main", "lv_base", str(self.lv_base))
    data.set("main", "lv_job1", str(self.lv_job1))
    data.set("main", "lv_job2x", str(self.lv_job2x))
    data.set("main", "lv_job2t", str(self.lv_job2t))
    data.set("main", "lv_job3", str(self.lv_job3))
    data.set("main", "gold", str(self.gold))
    data.set("main", "x", str(self.x))
    data.set("main", "y", str(self.y))
    data.set("main", "dir", str(self.dir))
    data.add_section("status")
    data.set("status", "str", str(self.str))
    data.set("status", "dex", str(self.dex))
    data.set("status", "int", str(self.int))
    data.set("status", "vit", str(self.vit))
    data.set("status", "agi", str(self.agi))
    data.set("status", "mag", str(self.mag))
    data.set("status", "stradd", str(self.stradd))
    data.set("status", "dexadd", str(self.dexadd))
    data.set("status", "intadd", str(self.intadd))
    data.set("status", "vitadd", str(self.vitadd))
    data.set("status", "agiadd", str(self.agiadd))
    data.set("status", "magadd", str(self.magadd))
    data.add_section("equip")
    for attr in general.EQUIP_ATTR_LIST:
        data.set("equip", attr, str(getattr(self.equip_std, attr)))
    data.add_section("equip_dem")
    for attr in general.EQUIP_ATTR_LIST:
        data.set("equip_dem", attr, str(getattr(self.equip_dem, attr)))
    #"iid,iid,iid, ..."
    data.add_section("sort")
    data.set("sort", "item", general.list_to_str(self.sort.item))
    data.set("sort", "warehouse", general.list_to_str(self.sort.warehouse))
    #"iid = id,count"
    data.add_section("item")
    for key, value in self.item.iteritems():
        data.set("item", str(key), item_dumps(value))
    #"iid = id,count,warehouse"
    data.add_section("warehouse")
    for key, value in self.warehouse.iteritems():
        data.set("warehouse", str(key), item_dumps(value))
    data.add_section("mirror")
    data.set("mirror", "face", general.list_to_str(self.mirror_face))
    data.set("mirror", "hair", general.list_to_str(self.mirror_hair))
    data.set("mirror", "wig", general.list_to_str(self.mirror_wig))
    data.set("mirror", "haircolor", general.list_to_str(self.mirror_haircolor))
    # "name = value"
    for key, value in self.item.iteritems():
        data.set("item", str(key), item_dumps(value))
    data.add_section("var")
    for key, value in self.var.iteritems():
        try:
            dump = dumpobj.dumps(value)
        except:
            general.log_error("[ pc  ] dump var error", self, key, value)
            general.log_error(traceback.format_exc())
            dump = str(value)
        data.set("var", str(key), dump)
    #"skill_id,skill_id,skill_id, ..."
    data.add_section("skill")
    data.set("skill", "list", general.list_to_str(self.skill_list))
    #
    data.write(open(self.path, "wb", base=env.USER_DIR))
示例#4
0
def save(self):
	data = general.get_config()
	data.add_section("main")
	data.set("main","data_ver", str(env.USERDATA_FORMAT_VERSION))
	data.set("main", "id", str(self.id))
	data.set("main", "name", str(self.name))
	data.set("main", "gmlevel", str(self.gmlevel))
	data.set("main", "race", str(self.race))
	data.set("main", "form", str(self.form))
	data.set("main", "gender", str(self.gender))
	data.set("main", "hair", str(self.hair))
	data.set("main", "haircolor", str(self.haircolor))
	data.set("main", "wig", str(self.wig))
	data.set("main", "face", str(self.face))
	data.set("main", "base_lv", str(self.base_lv))
	data.set("main", "ex", str(self.ex))
	data.set("main", "wing", str(self.wing))
	data.set("main", "wingcolor", str(self.wingcolor))
	data.set("main", "job", str(self.job))
	data.set("main", "map_id", str(self.map_id))
	data.set("main", "lv_base", str(self.lv_base))
	data.set("main", "lv_job1", str(self.lv_job1))
	data.set("main", "lv_job2x", str(self.lv_job2x))
	data.set("main", "lv_job2t", str(self.lv_job2t))
	data.set("main", "lv_job3", str(self.lv_job3))
	data.set("main", "gold", str(self.gold))
	data.set("main", "x", str(self.x))
	data.set("main", "y", str(self.y))
	data.set("main", "dir", str(self.dir))
	data.add_section("status")
	data.set("status", "str", str(self.str))
	data.set("status", "dex", str(self.dex))
	data.set("status", "int", str(self.int))
	data.set("status", "vit", str(self.vit))
	data.set("status", "agi", str(self.agi))
	data.set("status", "mag", str(self.mag))
	data.set("status", "stradd", str(self.stradd))
	data.set("status", "dexadd", str(self.dexadd))
	data.set("status", "intadd", str(self.intadd))
	data.set("status", "vitadd", str(self.vitadd))
	data.set("status", "agiadd", str(self.agiadd))
	data.set("status", "magadd", str(self.magadd))
	data.add_section("equip")
	for attr in general.EQUIP_ATTR_LIST:
		data.set("equip", attr, str(getattr(self.equip_std, attr)))
	data.add_section("equip_dem")
	for attr in general.EQUIP_ATTR_LIST:
		data.set("equip_dem", attr, str(getattr(self.equip_dem, attr)))
	#"iid,iid,iid, ..."
	data.add_section("sort")
	data.set("sort", "item", general.list_to_str(self.sort.item))
	data.set("sort", "warehouse", general.list_to_str(self.sort.warehouse))
	#"iid = id,count"
	data.add_section("item")
	for key, value in self.item.iteritems():
		data.set("item", str(key), item_dumps(value))
	#"iid = id,count,warehouse"
	data.add_section("warehouse")
	for key, value in self.warehouse.iteritems():
		data.set("warehouse", str(key), item_dumps(value))
	#"name = value"
	data.add_section("var")
	for key, value in self.var.iteritems():
		try:
			dump = dumpobj.dumps(value)
		except:
			general.log_error("[ pc  ] dump var error", self, key, value)
			general.log_error(traceback.format_exc())
			dump = str(value)
		data.set("var", str(key), dump)
	#"skill_id,skill_id,skill_id, ..."
	data.add_section("skill")
	data.set("skill", "list", general.list_to_str(self.skill_list))
	#
	data.write(open(self.path, "wb", base=env.USER_DIR))