ice.playerprofile

Classes related to player profiles.

class ProfileGUI: ice.guiswapper.SwappableGUI;

GUI frontend for the profile manager.

this(ProfileManager profileManager, GUISystem gui, SlotWidget parentSlot, VFSDir gameDir);

Construct a ProfileGUI.

This loads the widget tree.

Parameters:
ProfileManager profileManager ProfileManager this GUI is working with.
GUISystem gui Reference to the GUI system to load widgets with.
SlotWidget parentSlot Parent slot widget of the profile GUI (profile GUI internally swaps its main GUI for dialogs connected here).
VFSDir gameDir Game data directory to load the GUI from.
Throws:
GUIInitException on GUI loading failure. VFSException if the GUI file/s could not be found.
class ProfileException: object.Exception;

Exception thrown at player profile related errors.

class ProfileManager;

Loads, saves, and provides access to player profiles.

this(VFSDir gameDir);

Construct a ProfileManager.

Loads profiles from the profiles/ directory. Creates the directory if it does not exist.

Parameters:
VFSDir gameDir Game directory (parent of the profiles/ directory).
Throws:
ProfileException if the profile directory could not be read or on a YAML error.
void save();

Save the current state of all profiles.

Should be called before destruction.

Throws:
ProfileException if the profiles directory could not be written to.
const pure nothrow @property size_t profileCount();

Get the number of player profiles.

pure nothrow @property PlayerProfile currentProfile();

Get the current profile.

void nextProfile();

Switch to the next profile.

void previousProfile();

Switch to the previous profile.

void deleteProfile(PlayerProfile profile);

Delete specified profile.

This will delete the profile directory.

Parameters:
PlayerProfile profile Profile to delete. Must be in the ProfileManager.
Throws:
ProfileException if the profile directory could not be deleted or if this was the last profile.
bool createProfile(const string name);

Create a new profile.

Parameters:
string name Name of the profile.
Returns:
true if the profile was succesfully created, false if the profile with this name already exists or if the name is invalid (all characters must be alphanumeric or '').
Throws:
ProfileException if the profile directory could not be created.
class PlayerProfile;

Player profile, handling things such as campaign progress and ship modifications.

pure nothrow @property YAMLNode playerShipSpawner();

Get the entity that will spawn the player ship and modify it at spawn time.

const pure nothrow uint campaignProgress(string vfsName, string humanName);

Get progress in a campaign.

Parameters:
string vfsName Virtual file system name of the campaign. If multiple campaigns have the same human readable name, this is used to determine which one should be used.
string humanName Human readable name of the campaign.
Returns:
Current level in the campaign.
pure nothrow @trusted void campaignProgress(string vfsName, string humanName, uint progress);

Set progress for a campaign.

Parameters:
string vfsName Virtual file system name of the campaign. If multiple campaigns have the same human readable name, this is used to determine which one should be used.
string humanName Human readable name of the campaign.
uint progress Campaign progress (current level) to set.
const pure nothrow uint bestExpGained(string vfsName, string humanName, uint level);

Get the best experience gained for specified level in specified campaign.

Parameters:
string vfsName Virtual file system name of the campaign. If multiple campaigns have the same human readable name, this is used to determine which one should be used.
string humanName Human readable name of the campaign.
uint level Level to get experience for.
void processWinStatistics(string vfsName, string humanName, uint level, ref const StatisticsComponent statistics);

Process statistics after the player wins a game.

Parameters:
string vfsName Virtual file system name of the campaign. If multiple campaigns have the same human readable name, this is used to determine which one should be used.
string humanName Human readable name of the campaign.
uint level Level the player has won.