pub struct GameState {Show 20 fields
pub character: Character,
pub tavern: Tavern,
pub arena: Arena,
pub last_fight: Option<Fight>,
pub shops: EnumMap<ShopType, Shop>,
pub guild: Option<Guild>,
pub specials: TimedSpecials,
pub dungeons: Dungeons,
pub underworld: Option<Underworld>,
pub fortress: Option<Fortress>,
pub pets: Option<Pets>,
pub hellevator: HellevatorEvent,
pub blacksmith: Option<Blacksmith>,
pub witch: Option<Witch>,
pub achievements: Achievements,
pub idle_game: Option<IdleGame>,
pub pending_unlocks: Vec<Unlockable>,
pub hall_of_fames: HallOfFames,
pub lookup: Lookup,
pub mail: Mail,
/* private fields */
}
Expand description
Represent the full state of the game at some point in time
Fields§
§character: Character
Everything, that can be considered part of the character, or his immediate surrounding and not the rest of the world
tavern: Tavern
Information about quests and work
arena: Arena
The place to fight other players
last_fight: Option<Fight>
The last fight, that this player was involved in
shops: EnumMap<ShopType, Shop>
Both shops. You can access a specific one either with get()
,
get_mut()
, or []
and the ShopType
as the key.
guild: Option<Guild>
If the player is in a guild, this will contain information about it
specials: TimedSpecials
Everything, that is time sensitive, like events, calendar, etc.
dungeons: Dungeons
Everything, that can be found under the Dungeon tab
underworld: Option<Underworld>
Contains information about the underworld, if it has been unlocked
fortress: Option<Fortress>
Contains information about the fortress, if it has been unlocked
pets: Option<Pets>
Information the pet collection, that a player can build over time
hellevator: HellevatorEvent
Contains information about the hellevator, if it is currently active
blacksmith: Option<Blacksmith>
Contains information about the blacksmith, if it has been unlocked
witch: Option<Witch>
Contains information about the witch, if it has been unlocked
achievements: Achievements
Tracker for small challenges, that a player can complete
idle_game: Option<IdleGame>
The boring idle game
pending_unlocks: Vec<Unlockable>
Contains the features this char is able to unlock right now
hall_of_fames: HallOfFames
Anything related to hall of fames
lookup: Lookup
Contains both other guilds & players, that you can look at via commands
mail: Mail
Anything you can find in the mail tab of the official client
Implementations§
Source§impl GameState
impl GameState
Sourcepub fn new(response: Response) -> Result<Self, SFError>
pub fn new(response: Response) -> Result<Self, SFError>
Constructs a new GameState
from the provided response. The response
has to be the login response from a Session
.
§Errors
If the response contains any errors, or does not contain enough
information about the player to build a full GameState
, this will
return a ParsingError
, or TooShortResponse
depending on the
exact error
Sourcepub fn update<R: Borrow<Response>>(
&mut self,
response: R,
) -> Result<(), SFError>
pub fn update<R: Borrow<Response>>( &mut self, response: R, ) -> Result<(), SFError>
Updates the players information with the new data received from the server. Any error that is encounters terminates the update process
§Errors
Mainly returns ParsingError
if the response does not exactly follow
the expected length, type and layout
Sourcepub fn server_time(&self) -> ServerTime
pub fn server_time(&self) -> ServerTime
Returns the time of the server. This is just an 8 byte copy behind the scenes, so feel free to NOT cache/optimize calling this in any way