dewarim / LittleGoblin

A browser game framework written in Grails
Other
10 stars 2 forks source link

Change from pc.id in post/get requests to storing pc in session #54

Open dewarim opened 9 years ago

dewarim commented 9 years ago

The player's current character id is set in two ways: via the URL parameter (pc ) or via the session.pc field. The session is the fallback if no pc.id is set on the URL.

Task: change the BaseController.fetchPc method to only use the session's field as the method of loading the PlayerCharacter from the database, unless necessary (like in TownController.show()).

UserAccount should get a field like "lastCharacterId" in case a user logs in on a sub page (like shop/show). This way it should be possible to load the correct character for this page. (Unless someone uses multiple chars and logs in with an old browser tab, but since pages cannot be guaranteed to be fully reentrant {example: fight pages}, this seems like a small price to pay.)