-
Notifications
You must be signed in to change notification settings - Fork 7
Code and Functions (for devs) Page 1
this is a list of the functions and operations used in E. X. P.
this was made to make the devs life easier (your welcome)
the saveFile variable is a single, unified save file that saves everything except for the username. an example would be:
"MjEzNzkjMTAjMTAjMTEjMTUjNjAjMTAjMjExIzY2Ny4wMDAwMDAwMDAwMDAxI2ZhbHNlI2ZhbHNlIzE2MXwwfDAsMTYyfDB8MCwxODZ8MHwwLDE4N3wwfDAsMjExfDB8MCwyMzZ8MHwwLDI2MXwwfDAsMjg2fDB8MCwyODd8NXw0LDMxMXwwfDAsMzEyfDB8MA=="
decoded, the string above will say:
"21379#10#10#11#15#60#10#211#667.0000000000001#false#false#161|0|0,162|0|0,186|0|0,187|0|0,211|0|0,236|0|0,261|0|0,286|0|0,287|5|4,311|0|0,312|0|0"
each value is seperated by a #
hashtag and the last value is the lootArray, with each of its elements separated by a ,
comma, and inside of each element, there are three values separated by a |
straight slash. the first value stands for the index of the element. the second value stands for how much ammo is stored in the element, and the third value stands for the food stored in the element. these values are read and assigned to the lootArray.
you can probably tell that it is encoded in base64. to decode it, you can use the window.atob()
method, or simply use readSaveFile()
. readSaveFile()
decodes the save file and returns the values in an object. readSaveFile()
will return an object like this:
{ammo: 100 currentCell: 211 energy: 15 fightingMode: false food: 100 gameProgression: 667.0000000000001 health: 10 isTown: false lootArray: (313) [empty × 161, {…}, {…}, empty × 23, {…}, {…}, empty × 23, {…}, empty × 24, {…}, empty × 24, {…}, empty × 24, {…}, {…}, empty × 23, {…}, {…}] maxEnergy: 15 maxHealth: 10 seed: 21379}
the initFromSave()
function will read the save file and set all variables that it saves to their respective saved values.
if you are a developer, please add code in here as you add new features (really, please, please do it)