重新粘一下贴图和代码, 需要原文件的留邮箱


import re,os
def get_member(saves,output_file): f = open(saves, "rb") # 按字符"maps"分割文件, 一共分割成349份,即348支队伍 split_by_team = f.read().split(b'maps') f.close() f = open(output_file, "wb+") f.write(str('队名,球员,年龄,位置,速度,灵活,加速,耐力,力量,健康,射门,传球,头球,控球,盘带,判断,技巧,\冷静,意识,才华,开球,抛球,救球,掷球,领导,稳定,判断,进球欲').encode('gbk')+b'\x0d\x0a') count=0 tn_list=[] position = ['守门员','右后卫','左后卫','中后卫','右边卫','左边卫','清道夫','后腰','右前卫','左前卫','前腰',\ '右边锋','左边锋','自由人','前锋','影锋','待查证'] for portion in split_by_team: teamname = b'' if len(split_by_team)-1 > count: teamname_offset = - (11*16+13) while portion[teamname_offset] != 0: if portion[teamname_offset] == 13 and portion[teamname_offset+1] == 10: teamname_offset = teamname_offset + 2 else: teamname = teamname + portion[teamname_offset].to_bytes(1,'little') teamname_offset = teamname_offset + 1 teamname = teamname +b'\x2c' tn_list.append(teamname) # f.write(tn_list[count]) if count > 0: tb0 = (count-1)%256 tb1 = (count-1)//256
# 打个patch, 实际teambyte中间漏了0x0121(=D'289)这一个 if count > 288: tb0 = count%256 tb1 = count//256
teambyte_offset = 7*16
+3
player_length = 8*16 player_offset = 0 while portion[teambyte_offset+player_offset] == tb0 and \ portion[teambyte_offset+player_offset+1] == tb1:
# 获取球员姓名 playername_offset = 1*16+10 playername=b'' while portion[teambyte_offset+player_offset+playername_offset] != 0: playername = playername + \ portion[teambyte_offset+player_offset+playername_offset].to_bytes(1,'little') playername_offset = playername_offset + 1 playername = playername + b'\x2c'
# f.write(playername) #
获取球员年龄 age_offset = 7*16+6 age = bytes(ascii(portion[teambyte_offset+player_offset+age_offset]),encoding='UTF-8') + b'\x2c' # f.write(tn_list[count-1]+playername+age+b'\x0d\x0a')
# 获取当前位置 position_offset=2*16+14 if portion[teambyte_offset+player_offset+position_offset] > 15: pos_index = 16 else: pos_index = portion[teambyte_offset+player_offset+position_offset] pos = bytes(str(position[pos_index]).encode('gbk') + b'\x2c')
# 获取各种属性 attr_offset = 3*16+1 # 速度 move1 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+0]),encoding='UTF-8') + b'\x2c' # 灵活 move2 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+1]),encoding='UTF-8') + b'\x2c' # 加速 move3 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+2]),encoding='UTF-8') + b'\x2c' # 耐力 pwr1 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+3]),encoding='UTF-8') + b'\x2c' # 力量 pwr2 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+4]),encoding='UTF-8') + b'\x2c' # 健康 pwr3 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+5]),encoding='UTF-8') + b'\x2c' # 射门 skill1 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+6]),encoding='UTF-8') + b'\x2c' # 传球 skill2 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+7]),encoding='UTF-8') + b'\x2c' # 头球 skill3 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+8]),encoding='UTF-8') + b'\x2c' # 控球 skill4 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+9]),encoding='UTF-8') + b'\x2c' # 盘带 skill5 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+10]),encoding='UTF-8') + b'\x2c' # 铲球_判断 tack1 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+13]),encoding='UTF-8') + b'\x2c' # 铲球_技巧 tack2 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+14]),encoding='UTF-8') + b'\x2c' # 冷静 cool = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+11]),encoding='UTF-8') + b'\x2c' # 意识 awar = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+12]),encoding='UTF-8') + b'\x2c' # 才华 flair = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+15]),encoding='UTF-8') + b'\x2c' # 开球 gk1 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+16]),encoding='UTF-8') + b'\x2c' # 抛球 gk2 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+17]),encoding='UTF-8') + b'\x2c' # 救球 gk3 = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+18]),encoding='UTF-8') + b'\x2c' # 掷球 thrw = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+19]),encoding='UTF-8') + b'\x2c' # 领导 lead = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+20]),encoding='UTF-8') + b'\x2c' # 稳定 consis = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+21]),encoding='UTF-8') + b'\x2c' # 判断 deter = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+22]),encoding='UTF-8') + b'\x2c' # 进球欲 greed = bytes(ascii(portion[teambyte_offset+player_offset+attr_offset+23]),encoding='UTF-8')
f.write(tn_list[count-1]+playername+age+pos+move1+move2+move3+pwr1+pwr2+pwr3+skill1+skill2+skill3+ \ skill4+skill5+tack1+tack2+cool+awar+flair+gk1+gk2+gk3+thrw+lead+consis+deter+greed+b'\x0d\x0a')
# 跳到下一位球员 player_offset = player_offset + player_length
# exit(100) count = count + 1
f.close()
if __name__ == '__main__': fsm97_saves = r'C:\Media\Fsm97\games\shark' output_file = r'C:\Media\Fsm97\members.txt' get_member(fsm97_saves,output_file)