You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: headerapi.md
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,10 @@ nav_order: 3
5
5
title: Header API
6
6
---
7
7
8
+
## Quick Start
8
9
9
10
## Misc
10
-
*`utf8` - A global var that determines whether to use `cp932` (JP ver.) or `UTF-8` (International ver.). True by default.
11
+
*`utf8` - A global boolean that determines whether to use `cp932` (JP ver.) or `UTF-8` (International ver.). True by default.
11
12
*`panic()` - A function used to signal warnings - this is usually used by the API to signal errors, more can be found in the Error section.
12
13
*`api` - A global (and pre-defined) instance of `HeaderAPI`.
13
14
*`fileBuffer` - decrypted save data used by the UI - stored as a `Uint8Array`.
@@ -29,6 +30,8 @@ title: Header API
29
30
30
31
## Formats
31
32
*`playerIndex` - A number from 0-2 where 0 is the 1st save file/player, 1 is the 2nd and 2 is the 3rd.
33
+
*`rankVal` - A `Number` that controls Rank - `0` = E, `1` = D, ... `5` = S
34
+
*`timeBlock` - An object structured like `{ year: 0x7E9, month: 0x0A, day: 0x02, hour: 0xB, minute: 0x00 }`.
32
35
33
36
## HeaderAPI
34
37
* Constructor: `HeaderAPI(filebuf = fileBuffer)`
@@ -39,7 +42,12 @@ title: Header API
39
42
*`getPlayers()` - Exports a JSON snapshot of the API's save data in this format:
40
43
*`[{ name, rank, playTime, year, month, day, hour, minute, party } /* player 1 */, { name, rank, playTime, year, month, day, hour, minute, party } /* player 2 */, { name, rank, playTime, year, month, day, hour, minute, party } /* player 3 */]`
41
44
*`setPlayerName(index, newName)` - Takes a `playerIndex` and `name` and sets that player's name to the input.
45
+
*`setWatchRank(index, rankVal)` - Takes a `playerIndex` and a `rankVal` and sets that player's watch rank to that rank.
46
+
*`setPlayTime(index, seconds)` - Takes a `playerIndex` and a `Number` (seconds) and sets that player's play time to that time.
47
+
*`setLastSaveDate(index, { year, month, day, hour, minute })` - Takes a `playerIndex` and a `timeBlock` and sets that player's last save date to that date.
42
48
49
+
50
+
43
51
## Text Class
44
52
*`static Encode(str, utf8 = window.utf8)` - Encodes a string -> `Uint8Array`, if `utf8` is true it'll use UTF-8 encoding otherwise cp932/Windows 31-J (UTF-8 is needed for INTL versions while cp932 for JP).
45
53
*`static Decode(bytes, utf8 = window.utf8)` - Decodes a `Uint8Array` -> string, if `utf8` is true it'll use UTF-8 encoding otherwise cp932/Windows 31-J (UTF-8 is needed for INTL versions while cp932 for JP).
0 commit comments