lamadaemon / phigros-save-manager

A Typescript library for parse and modify the save file of game Phigros
14 stars 0 forks source link
phigros

phigros-save-manager

A simple libaray for modify Phigros cloud save data.

996.icu LICENSE npm


API V2 is comming soon! The new API WILL BREAK existing code. Some big changes including seperated cloud save management APIs with save editing APIs, rename main branch to master, and a lot of APIs are no longer async.

For more details please see Pull Request #6

Features

CLI Usage

phigros-save-manager provides a useful CLI to easily reset chapter 8, backup your cloud save, and other debug utilities.

You can use the following command to get detialed subcommand explaination.

phigrous-save-manager

Future plans

Examples

// Example: re8 (aka clear unlocks in chapter 8)

import { PhigrosSaveManager } from 'phigros-save-manager'

const saveManager = await PhigrosSaveManager.loadCloudSave("<Your Session Token>")
await saveManager.re8().uploadSave()
// Example: Edit in-game currency (money):

import { PhigrosSaveManager } from 'phigros-save-manager'

const saveManager = await PhigrosSaveManager.loadCloudSave("<Your Session Token>")

saveManager.gameProgress.money[0] = 99
saveManager.gameProgress.money[1] = 99
saveManager.gameProgress.money[2] = 99
saveManager.gameProgress.money[3] = 99
saveManager.gameProgress.money[4] = 99

await saveManager.uploadSave()
// Exmaple: Edit 'gameProgress' from binary

import { PhigrosSaveManager, PlayerGameProgress } from "."
import fs from 'fs'

const binary = new PlayerGameProgress(PhigrosSaveManager.decrypt(fs.readFileSync("/path/to/gameProgress")));
binary.money[0] = 99

// You'll need a type because the version number is inserted at here
fs.writeFileSync("/path/to/gameProgress", PhigrosSaveManager.encrypt(binary.save(), 'gameProgress'))