Player State Saving [HR]
ProdigyMathGameHacking - Hacking for the right reasons.
Brought to you by:
boredfish
Originally created by: PatheticMustan
Originally owned by: SwxtchCode
Describe the hack in 5 words or less:
Save player+inventory to LocalStorage
Have you made sure this hack isn't available yet?* (Yes/No)
Yes
Being able to save the player's state and inventory would allow users to undo hacks, and restore their account to it's initial state. It's also relatively easy to implement.
Originally posted by: PatheticMustan
whatever
Originally posted by: SwxtchCode
var playerStates = [];
then save with
input into
saveState
'sstate
param is_.player.data
ik this is pretty basic, i don't have access to my laptop RN tho so I cant do much
Originally posted by: PatheticMustan
the idea is to load/save into and from localStorage.
We'd also need to get some things outside of _.player.data, but it shouldn't be too hard.
I'll try doing this over the weekend, haha
Originally posted by: SwxtchCode
Hmm ok-
localStorage.setItem(JSON.Stringify(playerState))
Originally posted by: ArcerionDev
unfortunately, the only things that are saved globally are things under
_.player
, everything else doesn't work. Also, JSON.stringify isn't necessary, since a lot of the game data is circular. Just dothen when we load in the hacked gamemin, do something like
Just a thought.
Originally posted by: PatheticMustan
Arc, that's horrible... you should use
localStorage.setItem
Originally posted by: ArcerionDev
it doesn't matter tbh
Originally posted by: ArcerionDev
Look,
is 33 chars long,
is 24.
May I ask
Originally posted by: SwxtchCode
Alr, I'm on my Linux machine now (my laptop is still broken).
I'm going to work on this for a bit, gimme some time.
Originally posted by: SwxtchCode
We'll need to add something to prevent Prodigy from screwing it up and wiping the player, of course.
Originally posted by: SwxtchCode
Also, this should totally be a part of [#318] in my opinion (or is it there and I didn't realize it?), because this will be another WCM thing.
Originally posted by: ArcerionDev
dont wanna be technical but do
Instead of
lmao
Originally posted by: SwxtchCode
Lmao- thanks. Updated.
Originally posted by: SwxtchCode
K, so, there might be stuff we don't want to save (temporary values or something), I'll look into that soon.
Originally posted by: SwxtchCode
Another thing:
We'll either have to save this in the extension or add some kind of verification hash (explained how to do that in DMs with Arc) to prevent Prodigy from tampering with local storage, 'cause they can easily add some JS to overwrite the value.
Originally posted by: SwxtchCode
commenting to remind people to help
Originally posted by: PatheticMustan
I promise I'll try doing it today.
While we wait, a list of what to save would be nice.
Originally posted by: ArcerionDev
Originally posted by: ArcerionDev
this is what we have done for now
Originally posted by: ArcerionDev
these things all SHOULD save, but sometimes they don't, idk why