Exemplo n.º 1
0
def parse_drop():
    workbook = xlrd.open_workbook(r'src/t_drop.xlsx')
    sheet = workbook.sheet_by_name(r'Drop')
    drops = {}
    drops['drops'] = list()
    for i in range(sheet.nrows):
		try:
			if i == 0 or i == 1 or i == 2 or i == 3:
				continue
			item = {}
			item['id'] = int(sheet.cell_value(i, 0))
			item['randomCount'] = int(sheet.cell_value(i, 2))
			item['fixedReward'] = _parse_reward(sheet.cell_value(i, 4))
			item['randomReward'] = _parse_reward(sheet.cell_value(i, 5))
			if(str(sheet.cell_value(i, 6))!=""):
			
				item['ownRewardCount'] = int(sheet.cell_value(i, 6))
				item['ownReward'] = _parse_reward(sheet.cell_value(i, 7))
			if(str(sheet.cell_value(i, 8))!=""):
				item['killRewardCount'] = int(sheet.cell_value(i, 8))
				item['killReward'] = _parse_reward(sheet.cell_value(i, 9))
		except:
			print (i)
		drops['drops'].append(item)
    fd = open('tar/drops.json', 'w')
    json.dump(drops, fd, ensure_ascii=False, indent=2)
    fd.close()
Exemplo n.º 2
0
def parse_gift():
    fd = open('src/t_item_gift.json', 'r')
    data = json.load(fd)
    equips = {}
    equips['gifts'] = list()
    for i in data:
        item = {}
        item['id'] = i[1]
        item['subtype'] = i[5]
        item['reward'] = _parse_reward(i[29])
        item['extend'] = _parse_reward(i[30])
        equips['gifts'].append(item)
    fd.close()
    fd = open('tar/gifts.json', 'w')
    json.dump(equips, fd, ensure_ascii=False, indent=2)
Exemplo n.º 3
0
def parse_monster():
    fd = open("src/t_monster.json", "r")
    data = json.load(fd)
    out = {}
    out["monsters"] = list()
    for i in data:
        item = {}
        item["id"] = i[24]
        item["level"] = i[25]
        item["hpPercent"] = i[28]
        item["hp"] = i[29]
        item["attack"] = i[1]
        item["speed"] = i[31]
        item["reward"] = _parse_reward(i[34])
        item["exp"] = i[16]
        item["skill"] = i[33]
        item["skill2"] = i[37]
        item["width"] = i[5]
        item["defence"] = i[11]
        item["wuxing"] = i[40]
        item["alive"] = i[0]
        item["fixDmgDec"] = i[20]
        item["dmgDec"] = i[14]
        item["critBreakRate"] = i[10]
        item["critBreak"] = i[9]
        out["monsters"].append(item)
    fd.close()
    fd = open("tar/monsters.json", "w")
    json.dump(out, fd, ensure_ascii=False, indent=2)
    fd.close()
Exemplo n.º 4
0
def parse_mission():
    fd = open("src/t_mission.json", "r")
    data = json.load(fd)
    missions = {}
    missions["missions"] = list()
    types = {}
    for i in data:
        arr = i[3].split(r'&')
        # if i[19] != 1:
        #    continue
        item = {}
        item["exp"] = i[0]
        item["id"] = i[6]
        item["condition"] = list()
        item["reward"] = _parse_reward(i[15])
        item["type"] = i[19]
        item["shengId"] = i[20]
        for j in arr:
            cc = parse_contition(j.split(r'#'))
            tt = cc['v1']
            if tt not in types:
                types[tt] = {}
            types[tt][i[9]] = True
            item["condition"].append(cc)
        missions["missions"].append(item)
    fd.close()
    fd = open("tar/missions.json", "w")
    json.dump(missions, fd, ensure_ascii=False, indent=2)
    fd.close()
    # print(json.dumps(types, ensure_ascii=False))
    for k in types.keys():
        print(k)
Exemplo n.º 5
0
def parse_equip():
    fd = open('src/t_item_equip.json', 'r')
    data = json.load(fd)
    equips = {}
    equips['equips'] = list()
    for i in data:
        item = {}
        item['id'] = i[1]
        item['part'] = i[5]
        item['career'] = i[13]
        item['active_min'] = i[14]
        item['smeltAward'] = _parse_reward(i[31])
        item['attr'] = _parse_attribut(i[19])
        item['starRate'] = parse_star_rate(i[20])
        item['sub'] = i[30]
        item['color'] = i[6]
        item['changeLevel'] = i[17]
        arr = i[27].split(r'#')
        if len(arr) == 2:
            sundry = {}
            sundry['id'] = int(arr[0])
            sundry['num'] = int(arr[1])
            item['sundry'] = sundry
        item['type'] = i[4]
        equips['equips'].append(item)
        #if i[30] != 10001 and i[30] > 6:
        #    print(i[1])
        #    return True
    fd.close()
    fd = open('tar/equips.json', 'w')
    json.dump(equips, fd, ensure_ascii=False, indent=2)
Exemplo n.º 6
0
def parse_grid():
    fd = io.open("./src/t_copy.json", "r", encoding="utf-8")
    fd2 = io.open("./src/t_copy_ex.json", "r", encoding="utf-8")
    data = json.load(fd)
    data2 = json.load(fd2)
    dict = {}
    dict["copys"] = []
    for i in data:
        item = {}
        item["daily"] = int(i[1])
        item["reincarnLevel"] = int(i[2])
        item["copyId"] = int(i[3])

        for tmp in data2['t_copy_ex']:
            if (tmp['copy_id'] == item["copyId"]):
                item['preapareTime'] = tmp['prepare_time']
                item['duringTime'] = tmp['during_time']
                break

        item["firstReward"] = _parse_reward((i[4]))
        item["costId"] = int(i[6])
        item["costNum"] = int(i[7])
        item["time"] = int(i[10])
        #
        item["num"] = int(i[13])
        item["type"] = int(i[26])
        item["mapId"] = int(i[15])
        item["needLevel"] = int(i[20])
        item["quickDay"] = int(i[22])
        if (str(i[25]).isdigit()):
            item["reward"] = []
            reward_tmp = {}
            reward_tmp.setdefault('item', int(i[25]))
            reward_tmp.setdefault('num', 1)
            item["reward"].append(reward_tmp)
        else:
            item["reward"] = _parse_reward((i[25]))
        dict["copys"].append(item)
    fd.close()
    with io.open("./tar/copy.json", 'w', encoding="utf-8") as outfile:
        outfile.write(unicode(json.dumps(dict, ensure_ascii=False)))
def parse_island():
	workbook = xlrd.open_workbook(r'src/t_partner_island.xlsx')
	sheet = workbook.sheet_by_name(r't_partner_island')
	out = {}
	out["partner_islands"] = []
	for i in range(sheet.nrows):
		if i == 0 or i==1:
			continue
		item = {}
		item['layer'] = int(sheet.cell_value(i, 0))
		item['reward'] = _parse_reward(sheet.cell_value(i, 1))
		item['type'] = int(sheet.cell_value(i, 2))
		if(item['type'] ==1 and str(sheet.cell_value(i, 3))):
			item['exReward'] =  _parse_reward(sheet.cell_value(i, 3))
		else:
			item['exReward']=[]

		out["partner_islands"].append(item)
	fd = open("tar/partnerIsland.json", "w")
	json.dump(out, fd, ensure_ascii=False, indent=2)
	fd.close()
Exemplo n.º 8
0
def parse_equip_purify():
    fd = open('src/t_equip_purify.json', 'r')
    data = json.load(fd)
    items = {}
    items['purifys'] = list()
    for i in data:
        item = {}
        item['attr'] = _parse_attribut(i[1])
        item['level'] = i[5]
        item['useProps'] = _parse_reward(i[4])
        items['purifys'].append(item)
    fd.close()
    fd = open('tar/t_equip_purify.json', 'w')
    json.dump(items, fd, ensure_ascii=False, indent=2)
Exemplo n.º 9
0
def parse_grid():
    fd = io.open("./src/t_magic_tower.json", "r", encoding="utf-8")
    data = json.load(fd)
    dict = {}
    dict["magic_towers"] = []
    for i in data:
        item = {}
        item["id"] = int(i[0])
        item["dailyReward"] = int(i[1])
        item["reward"] = _parse_reward((i[2]))
        dict["magic_towers"].append(item)
    fd.close()
    with io.open("./tar/magic_towers.json", 'w', encoding="utf-8") as outfile:
        outfile.write(unicode(json.dumps(dict, ensure_ascii=False)))
Exemplo n.º 10
0
def parse_equip_strengthen():
    fd = open('src/t_equip_strengthen.json', 'r')
    data = json.load(fd)
    items = {}
    items['strengthens'] = list()
    for i in data:
        item = {}
        item['attr'] = _parse_attribut(i[0])
        item['type'] = i[1]
        item['cost'] = _parse_reward(i[2])
        item['id'] = i[3]
        items['strengthens'].append(item)
    fd.close()
    fd = open('tar/equip_strengthens.json', 'w')
    json.dump(items, fd, ensure_ascii=False, indent=2)
Exemplo n.º 11
0
def parse_active():
    fd = open('src/t_daily_activity.json', 'r')
    data = json.load(fd)
    actives = {}
    actives['active'] = list()
    for i in data:
        item = {}
        item['limit'] = i[0]
        item['type'] = i[1]
        item['reward'] = _parse_reward(i[5])
        actives['active'].append(item)
        fd.close()
    fd = open('tar/active.json', 'w')
    json.dump(actives, fd, ensure_ascii=False, indent=2)
    fd.close()
Exemplo n.º 12
0
def parse_online_reward():
	fd = io.open("./src/t_online_reward.json", "r", encoding="utf-8")
	data = json.load(fd)
	dict = {}
	dict["onlineRewards"] = []
	for i in data:
		item = {}
		item["id"] = int(i[1])
		item["reward"] = _parse_reward(i[4])
		item["onlineTime"] = int(i[6])
		item["registeredDay"] = int(i[0].split(r'#')[1])
		
		dict["onlineRewards"].append(item)
	fd.close()
	with io.open("./tar/t_online_reward.json",'w',encoding="utf-8") as outfile:
		outfile.write(unicode(json.dumps(dict, ensure_ascii=False)))
Exemplo n.º 13
0
def parse_grid():
    fd = io.open("./src/t_boss.json", "r", encoding="utf-8")
    data = json.load(fd)
    dict = {}
    dict["boss"] = []
    for i in data:
        item = {}
        item["bossid"] = int(i[0])
        item["reincarnLevel"] = int(i[1])
        item["copyId"] = int(i[2])
        item["reward"] = _parse_reward((i[3]))
        item["useType"] = int(i[11])
        dict["boss"].append(item)

    fd.close()
    with io.open("./tar/boss.json", 'w', encoding="utf-8") as outfile:
        outfile.write(unicode(json.dumps(dict, ensure_ascii=False)))
Exemplo n.º 14
0
def parse_item():
    fd = open('src/preloadData.json', 'r')
    data = json.load(fd)
    items = {}
    items['items'] = list()
    for i in data['t_item']:
        item = {}
        item['id'] = i[1]
        item['type'] = int(i[3])
        item['itemType'] = i[4]
        item['subType'] = i[5]
        item['color'] = i[6]
        item['level'] = i[7]
        item['data'] = i[14]
        item['attr'] = _parse_attribut(i[19])
        item['smeltAward'] = _parse_reward(i[31])
        items['items'].append(item)
    fd.close()
    fd = open('tar/items.json', 'w')
    json.dump(items, fd, ensure_ascii=False, indent=2)