Account Form

Account management system for scriptform. This module handles all account profile functionality including storage, validation, and UI dialogs.

Credits: Developed by TazE Acknowledgements: Thanks to XJ for design concepts and initial prototyping


TAccountForm

The account management system that handles profile storage, validation, and UI.


TAccountForm.GetProfilePath

function TAccountForm.GetProfilePath(index: Integer): String;

Constructs the file path for a profile based on its index.


TAccountForm.SaveProfileToFile

procedure TAccountForm.SaveProfileToFile(index: Integer; profile: TProfile);

Saves profile as a JSON file at the specified index.


TAccountForm.LoadProfileFromFile

function TAccountForm.LoadProfileFromFile(index: Integer): TProfile;

Loads a profile from disk at the specified index. Returns a default profile if the file doesn’t exist or is invalid.


TAccountForm.GetExistingProfileIndices

function TAccountForm.GetExistingProfileIndices(): TIntegerArray;

Scans the accounts directory and returns a sorted array of all existing profile indices.


TAccountForm.ReindexProfiles

procedure TAccountForm.ReindexProfiles(fromIndex: Integer);

Renumbers profile files after a deletion to maintain sequential indexing. All profiles with indices greater than fromIndex are decremented by 1.


TAccountForm.ValidateProfile

function TAccountForm.ValidateProfile(profile: TProfile): Boolean;

Validates a profile has required fields filled.


TAccountForm.Setup

procedure TAccountForm.Setup();

Sets up the account system and loads existing profiles from config.


TAccountForm.UpdateProfileCombo

procedure TAccountForm.UpdateProfileCombo();

Updates the profile combo box with current profiles.


TAccountForm.AddProfile

function TAccountForm.AddProfile(profile: TProfile): Boolean;

Adds a new profile to the configuration after validation.


TAccountForm.UpdateProfile

function TAccountForm.UpdateProfile(index: Integer; profile: TProfile): Boolean;

Updates an existing profile at the specified index after validation.


TAccountForm.DeleteProfile

function TAccountForm.DeleteProfile(index: Integer): Boolean;

Deletes a profile at the specified index.


TAccountForm.GetSelectedProfile

function TAccountForm.GetSelectedProfile(): TProfile;

Returns the currently selected account profile.


TAccountForm.ValidateInput

function TAccountForm.ValidateInput(profile: TProfile): String;

Validates user input and returns error message if validation fails.


TAccountForm.BuildFilterSettings

function TAccountForm.BuildFilterSettings(): TSettings;

Builds a TSettings record from the current state of all filter UI controls.


TAccountForm.ApplyActivityFilters

procedure TAccountForm.ApplyActivityFilters();

Filters the current world list based on selected specific activity checkboxes.


TAccountForm.GetLocationString

function TAccountForm.GetLocationString(loc: EWorldLocation): String;

Converts a world location enum to its display string.


TAccountForm.GetTypeString

function TAccountForm.GetTypeString(worldType: EWorldType): String;

Converts a world type enum to its display string.


TAccountForm.DisplayResults

procedure TAccountForm.DisplayResults();

Formats and displays the filtered world list in the list box with columns for world number, location, type, activity, and player count.


TAccountForm.RefreshActivities

procedure TAccountForm.RefreshActivities();

Dynamically creates checkboxes for all unique specific activities found in the currently filtered worlds. Removes previous activity checkboxes before creating new ones.


TAccountForm.OnSaveClick

procedure TAccountForm.OnSaveClick(sender: TLazObject);

Handles the Save button click event. Validates and saves the profile data from the edit form.


TAccountForm.OnDeleteClick

procedure TAccountForm.OnDeleteClick(sender: TLazObject);

Handles the Delete button click event. Shows confirmation dialog before deleting the profile.


TAccountForm.OnCloseClick

procedure TAccountForm.OnCloseClick(sender: TLazObject);

Handles the Close button click event. Closes the edit dialog without saving.


TAccountForm.OnGenerateClick

procedure TAccountForm.OnGenerateClick(sender: TLazObject);

Handles the Generate Worlds button click. Applies current filter settings and refreshes the world list.


TAccountForm.OnSelectAllActivitiesClick

procedure TAccountForm.OnSelectAllActivitiesClick(sender: TLazObject);

Handles the Select/Deselect All checkbox click. Toggles all activity checkboxes to match the master checkbox state.


TAccountForm.OnSortChange

procedure TAccountForm.OnSortChange(sender: TLazObject);

Handles sort order combo box change. Re-generates the world list with the new sort order.


TAccountForm.SetupWorldTypePanel

procedure TAccountForm.SetupWorldTypePanel();

Sets up the world type filter panel with F2P and Members checkboxes.


TAccountForm.SetupLocationPanel

procedure TAccountForm.SetupLocationPanel();

Sets up the location filter panel with checkboxes for Germany, UK, USA, and Australia.


TAccountForm.SetupActivityPanel

procedure TAccountForm.SetupActivityPanel();

Sets up the activity type filter panel with checkboxes for Normal, Dangerous, Restricted, and Skill Total worlds.


TAccountForm.SetupSpecificActivityPanel

procedure TAccountForm.SetupSpecificActivityPanel();

Sets up the specific activities panel with a master select/deselect all checkbox. Individual activity checkboxes are added dynamically by RefreshActivities.


TAccountForm.LoadWorldData

procedure TAccountForm.LoadWorldData();

Fetches all available worlds from the world fetcher and caches them. Automatically generates the initial world list after fetching.


TAccountForm.LoadSavedWorlds

procedure TAccountForm.LoadSavedWorlds(worldsStr: String);

Loads a comma-separated list of world numbers and displays them. Disables all filter checkboxes when showing saved worlds.


TAccountForm.SetupEditDialog

procedure TAccountForm.SetupEditDialog(profile: TProfile; isNew: Boolean; editIndex: Integer);

Sets up the modal edit dialog for profile details.


TAccountForm.OnEditClick

procedure TAccountForm.OnEditClick(sender: TLazObject);

Handles the Edit button click event. Opens the profile edit dialog for the selected profile or creates a new one.


TAccountForm.SetupUI

procedure TAccountForm.SetupUI(combo: TLazComboBox; button: TLazButton);

Sets up the UI components provided by the parent form.