# -*- encoding:Latin-1 -*-
#this program converts chinese videogame ROTK11 scenarios to english scenarios
#opening the two files
f1 = input("Please enter chinese scenario file path")
f2 = input("Please enter an english scenario path. Warning ! English scenario will be
deleted !")
chine = open(f1, "rb")
engl = open(f2, "r+b")
#seeking and copying starting date and map description
chine.seek(91,0)
date = chine.read(3)
engl.seek(91,0)
engl.write(date)
chine.seek(475,0)
dmap = chine.read(42)
engl.seek(722,0)
engl.write(dmap)
chine.seek(16184,0)
date = chine.read(2)
engl.seek(26427,0)
engl.write(date)
#copy and write officers
x = 669
while x:
chine.seek(17813+x*152, 0)
engl.seek(28056+x*152, 0)
officer = chine.read(99)
engl.write(officer)
x-=1
#copy and write emperors
z = 3
while z:
z-=1
chine.seek(124213+z*152, 0)
engl.seek(134456+z*152, 0)
officer = chine.read(99)
engl.write(officer)
#copy and write forces
y = 43
while y :
y-=1
chine.seek(152660+y*72, 0)
engl.seek(160603+y*68, 0)
force = chine.read(68)
engl.write(force)
chine.seek(156044, 0)
engl.seek(163799, 0)
codes = chine.read(336)
engl.write(codes)
#copy cities, gates and ports
chine.seek(156420,0)
engl.seek(164175,0)
cities = chine.read(6282)
engl.write(cities)
input("Conversion finished! Please press enter to quit")
engl.close()
chine.close()