@page "/storage"
@inject IStorageService StorageService
@using Services.Website
@implements IDisposable
@layout PageLayout
@if (!_enabledPermissions)
{
Storage Disabled
Enable Storage on the Permissions Page.
}
else
{
Attack Time
@if (_attackTime != null)
{
T @Interval.ToTime((int)_attackTime)
}
Travel Time
@if (_travelTime != null)
{
T @Interval.ToTime((int)_travelTime)
}
Faction
Immortal
@if (Faction == DataType.FACTION_QRath)
{
}
@if (Faction == DataType.FACTION_Aru)
{
}
Building Input Delay
Add a input delay to constructing buildings for simulating worker movement and player micro.
Wait Time
Wait To
}
@code {
bool _enabledPermissions;
protected override void OnInitialized()
{
_enabledPermissions = StorageService.GetValue(StorageKeys.EnabledStorage);
RefreshDefaults();
StorageService.Subscribe(RefreshDefaults);
}
void IDisposable.Dispose()
{
StorageService.Unsubscribe(RefreshDefaults);
}
private int? _attackTime = null;
private int? _travelTime = null;
private string? _faction = null;
private string? _immortal = null;
private string? Faction => _faction == null ? DataType.FACTION_QRath : _faction;
private string? Immortal => _immortal == null ? DataType.IMMORTAL_Orzum : _immortal;
private int? _buildingInputDelay;
private int? _waitTime;
private int? _waitTo;
void RefreshDefaults()
{
_isEntityPlainView = StorageService.GetValue(StorageKeys.IsPlainView);
_isDynamicFormatting = StorageService.GetValue(StorageKeys.IsDynamicFormatting);
_attackTime = StorageService.GetValue(StorageKeys.AttackTime);
_travelTime = StorageService.GetValue(StorageKeys.TravelTime);
_faction = StorageService.GetValue(StorageKeys.SelectedFaction);
_immortal = StorageService.GetValue(StorageKeys.SelectedImmortal);
_buildingInputDelay = StorageService.GetValue(StorageKeys.BuildInputDelay);
_waitTime = StorageService.GetValue(StorageKeys.WaitTime);
_waitTo = StorageService.GetValue(StorageKeys.WaitTo);
StateHasChanged();
}
private bool _isEntityPlainView;
private bool _isDynamicFormatting;
private void EntityViewChanged(ChangeEventArgs obj)
{
StorageService.SetValue(StorageKeys.IsPlainView, obj.Value);
}
private void DynamicFormattingChanged(ChangeEventArgs obj)
{
StorageService.SetValue(StorageKeys.IsDynamicFormatting, obj.Value);
}
private void AttackTimeChanged(ChangeEventArgs obj)
{
StorageService.SetValue(StorageKeys.AttackTime, obj.Value);
}
private void TravelTimeChanged(ChangeEventArgs obj)
{
StorageService.SetValue(StorageKeys.TravelTime, obj.Value);
}
private void OnFactionChanged(ChangeEventArgs obj)
{
StorageService.SetValue(StorageKeys.SelectedFaction, obj.Value);
}
private void OnImmortalChanged(ChangeEventArgs obj)
{
StorageService.SetValue(StorageKeys.SelectedImmortal, obj.Value);
}
private void OnBuildingInputDelayChanged(ChangeEventArgs obj)
{
StorageService.SetValue(StorageKeys.BuildInputDelay, obj.Value);
}
private void OnWaitTimeChanged(ChangeEventArgs obj)
{
StorageService.SetValue(StorageKeys.WaitTime, obj.Value);
}
private void OnWaitToChanged(ChangeEventArgs obj)
{
StorageService.SetValue(StorageKeys.WaitTo, obj.Value);
}
}