Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Python Script to make 0exp GMon.dat
- #Author: Append Huang ([email protected])
- #Reference: https://www.ptt.cc/bbs/pal/M.1461154467.A.F26.html
- #Reference: https://goo.gl/VypRfq
- #read binary file as bytearray to make modification
- with open("GMon.dat","rb") as f:
- gmon = bytearray(f.read())
- #begin from 0x200, read every 4 bytes:
- for i in range(0x200,len(gmon)-4):
- if gmon[i:i+4] == b'\x00\xF0\xF2\x7F':
- #Name: 00F0F27F_name_2525
- j=i+4
- while gmon[j:j+2] != b'\x25\x25':
- j+=1
- mon_name = gmon[i+4:j].decode(encoding='big5') #name is in big5
- elif gmon[i:i+4] == b'\x01\x10\x20\x7F':
- #Stats: 01 10 20 7F "Type"(1byte) 00 00 00 "EXP"(4byte)
- tup_48 = tuple() #type of stats
- if gmon[i+4:i+8] == b'\xBE\x00\x00\x00': #BE: Exp
- #Whole Data (12byte):
- #print(" ".join(["%02X"]*12)%tuple(gmon[i:i+12]))
- mon_exp = int.from_bytes(gmon[i+8:i+12],'little')
- print("%d %s"%(mon_exp, mon_name))
- # Hacking (0exp)
- gmon[i+8:i+12] = (0).to_bytes(4,"little")
- mon_exp = int.from_bytes(gmon[i+8:i+12],'little')
- print("=> %d %s"%(mon_exp, mon_name))
- #Store it back
- with open("GMon_0exp.dat","wb") as f:
- f.write(bytes(gmon))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement