Skip to content

Instantly share code, notes, and snippets.

@magician11
Created January 12, 2019 19:44
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save magician11/fb540016c55cc4732efb7ff833321e1f to your computer and use it in GitHub Desktop.
Save magician11/fb540016c55cc4732efb7ff833321e1f to your computer and use it in GitHub Desktop.
How to edit HTML game files
/*
This will take a .save game file, decode it into its JSON form,
and then save it to game-data.json
*/
const fs = require('fs');
const LZString = require('lz-string');
if (process.argv.length === 3) {
try {
const encodedData = fs.readFileSync(process.argv[2], 'utf8');
const extractedData = LZString.decompressFromBase64(encodedData);
fs.writeFileSync('game-data.json', extractedData);
console.log('All done :)');
} catch (error) {
console.log("That didn't work...");
console.log(error);
}
} else {
console.log('usage: node decoder.js [.save file]');
}
/*
This will read the game-data.json file, encode it, and save that into mygame.save
*/
const fs = require('fs');
const LZString = require('lz-string');
try {
const contents = fs.readFileSync('game-data.json', 'utf8');
const dataToSave = LZString.compressToBase64(contents);
fs.writeFileSync('mygame.save', JSON.stringify(dataToSave));
console.log('All done :)');
} catch (error) {
console.log("That didn't work...");
console.log(error);
}
@magician11
Copy link
Author

magician11 commented Jan 12, 2019

Some online HTML games allow you to save your game to disk. It looks impossible to edit that game file, but it's not.

Download your game file..

and then run..

node decoder.js the-company-alpha-20190109-133236.save

Now you can edit the saved game data to your heart's content. Then when you're ready to upload it again, re-encode the file by running...

node encoder.js

and upload mygame.save

@adyrevhive
Copy link

[LOCAL_DATA_INFO]
local_mac_addr = B6:9D:02:4D:0D:15
key_send_bankruptcy_208365691 = 0
last_login_userid = 208365691
key_local_first_login_time_208365691 = 1651084998
key_local_today_game_time_208365691 = 0
key_local_login_day_208365691 = 5
login_guest_userid = 208365691
login_guest_code = oFW9v053mZR3W6A6C862LnWW4104D7hX
last_login_type = 2
key_free_get_rose_last_update_time_208365691 = 1651084999
key_free_get_rose_online_time_208365691 = 30
key_show_first_vac_208365691 = 0
key_show_off_yd_1_208365691 = 0
key_show_off_yd_2_208365691 = 0
key_show_off_yd_3_208365691 = 0
key_into_free_room_208365691 = 0
sys_atuo_game_first = 1
lobby_vip_type = 96
key_lobby_last_enter_game = 10
key_free_get_rose_online_time_87372127 = 30
key_send_bankruptcy_203704921 = 0
key_local_first_login_time_203704921 = 1647620411
key_local_today_game_time_203704921 = 0
key_local_login_day_203704921 = 23
hw_account_id_0 = 203704921
hw_account_password_0 = AF17E2EE190B406CE9DE509B5E9A4742D675F6E946D0
hw_account_type_0 = 1
hw_account_id_1 = 87372127
hw_account_password_1 = AF17E2EE190B406CE9DE509B5E9A4742D675F6E946D0
hw_account_type_1 = 1
hw_account_id_2 =
hw_account_password_2 =
hw_account_type_2 = -1
hw_account_id_3 =
hw_account_password_3 =
hw_account_type_3 = -1
key_free_get_rose_last_update_time_203704921 = 1647620412
key_free_get_rose_online_time_203704921 = 90
key_friend_yd_203704921 = 0
key_into_free_room_203704921 = 0
key_item_mall_yd_203704921 = 1
show_cz_libao_type_203704921 = 2
get_relief_num_203704921 = 4
key_show_first_vac_203704921 = 0
key_show_off_yd_1_203704921 = 0
key_show_off_yd_2_203704921 = 0
key_show_off_yd_3_203704921 = 0
key_last_CharmWeekRankIssue_203704921 = 20220110
key_item_mall_yd_208365691 = 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment