# Conflicts: # .github/CODEOWNERS # .github/workflows/publish.yml # Content.Client/Administration/UI/BanPanel/BanPanel.xaml # Content.Client/Administration/UI/BanPanel/BanPanel.xaml.cs # Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTabEntry.xaml.cs # Content.Client/Entry/EntryPoint.cs # Content.Client/Hands/Systems/HandsSystem.cs # Content.Client/Humanoid/HumanoidAppearanceSystem.cs # Content.Client/Humanoid/SingleMarkingPicker.xaml.cs # Content.Client/IoC/ClientContentIoC.cs # Content.Client/Lobby/LobbyState.cs # Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs # Content.Client/Lobby/UI/Loadouts/LoadoutGroupContainer.xaml.cs # Content.Client/Lobby/UI/LobbyGui.xaml # Content.Client/NetworkConfigurator/NetworkConfiguratorConfigurationMenu.xaml # Content.Client/Options/UI/EscapeMenu.xaml # Content.Client/Stealth/StealthSystem.cs # Content.Client/SurveillanceCamera/UI/SurveillanceCameraMonitorWindow.xaml.cs # Content.Client/UserInterface/Systems/Chat/Widgets/ChatBox.xaml.cs # Content.Client/UserInterface/Systems/Emotes/EmotesUIController.cs # Content.Client/Weapons/Ranged/Systems/GunSystem.cs # Content.IntegrationTests/Tests/Commands/SuicideCommandTests.cs # Content.IntegrationTests/Tests/Damageable/DamageableTest.cs # Content.IntegrationTests/Tests/PostMapInitTest.cs # Content.Server/Administration/Commands/AdminWhoCommand.cs # Content.Server/Administration/Commands/PardonCommand.cs # Content.Server/Administration/Commands/RoleUnbanCommand.cs # Content.Server/Administration/Commands/SetOutfitCommand.cs # Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs # Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs # Content.Server/AlertLevel/Commands/SetAlertLevelCommand.cs # Content.Server/Body/Components/BloodstreamComponent.cs # Content.Server/Body/Systems/BloodstreamSystem.cs # Content.Server/Body/Systems/MetabolizerSystem.cs # Content.Server/Body/Systems/RespiratorSystem.cs # Content.Server/Chat/Managers/ChatSanitizationManager.cs # Content.Server/Chat/Systems/ChatSystem.Emote.cs # Content.Server/Chat/Systems/ChatSystem.cs # Content.Server/CrewManifest/CrewManifestSystem.cs # Content.Server/Emp/EmpSystem.cs # Content.Server/Explosion/EntitySystems/TriggerSystem.cs # Content.Server/Fax/FaxSystem.cs # Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs # Content.Server/GameTicking/Commands/ForceMapCommand.cs # Content.Server/GameTicking/Commands/ForcePresetCommand.cs # Content.Server/GameTicking/Presets/GamePresetPrototype.cs # Content.Server/GameTicking/Rules/ChangelingRuleSystem.cs # Content.Server/GameTicking/Rules/Components/ChangelingRuleComponent.cs # Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs # Content.Server/Ghost/Roles/GhostRoleSystem.cs # Content.Server/Implants/Components/ScramImplantComponent.cs # Content.Server/Implants/SubdermalImplantSystem.cs # Content.Server/Materials/ProduceMaterialExtractorSystem.cs # Content.Server/Medical/HealthAnalyzerSystem.cs # Content.Server/NPC/Systems/NPCCombatSystem.Ranged.cs # Content.Server/NPC/Systems/NPCSystem.cs # Content.Server/Polymorph/Systems/PolymorphSystem.cs # Content.Server/Radio/EntitySystems/HeadsetSystem.cs # Content.Server/Repairable/RepairableSystem.cs # Content.Server/Revenant/EntitySystems/RevenantSystem.cs # Content.Server/RoundEnd/RoundEndSystem.cs # Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs # Content.Server/Speech/EntitySystems/FrenchAccentSystem.cs # Content.Server/Speech/EntitySystems/FrontalLispSystem.cs # Content.Server/Speech/EntitySystems/LizardAccentSystem.cs # Content.Server/Speech/EntitySystems/MothAccentSystem.cs # Content.Server/Speech/EntitySystems/OwOAccentSystem.cs # Content.Server/Station/Systems/StationSpawningSystem.cs # Content.Server/StationEvents/Events/MeteorSwarmSystem.cs # Content.Server/Stunnable/Components/StunOnCollideComponent.cs # Content.Server/SurveillanceCamera/Components/SurveillanceCameraRouterComponent.cs # Content.Server/Weapons/Ranged/Systems/GunSystem.Cartridges.cs # Content.Server/Zombies/ZombieSystem.Transform.cs # Content.Server/Zombies/ZombieSystem.cs # Content.Shared/Actions/SharedActionsSystem.cs # Content.Shared/Bed/SharedBedSystem.cs # Content.Shared/Blocking/BlockingSystem.cs # Content.Shared/Body/Systems/SharedBodySystem.Parts.cs # Content.Shared/Chemistry/Components/SolutionRegenerationComponent.cs # Content.Shared/Chemistry/EntitySystems/HypospraySystem.cs # Content.Shared/Construction/Conditions/TileNotBlocked.cs # Content.Shared/Cuffs/SharedCuffableSystem.cs # Content.Shared/Doors/Systems/SharedDoorSystem.cs # Content.Shared/Emoting/EmoteAttemptEvent.cs # Content.Shared/Eye/Blinding/Systems/BlindableSystem.cs # Content.Shared/Eye/VisibilityFlags.cs # Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs # Content.Shared/Humanoid/HumanoidCharacterAppearance.cs # Content.Shared/Interaction/SmartEquipSystem.cs # Content.Shared/Inventory/InventorySystem.Relay.cs # Content.Shared/Medical/Cryogenics/SharedCryoPodSystem.cs # Content.Shared/Medical/Healing/HealingSystem.cs # Content.Shared/Medical/HealingComponent.cs # Content.Shared/Nutrition/EntitySystems/FoodSystem.cs # Content.Shared/Slippery/SlipperySystem.cs # Content.Shared/SprayPainter/SharedSprayPainterSystem.cs # Content.Shared/Standing/StandingStateComponent.cs # Content.Shared/Standing/StandingStateSystem.cs # Content.Shared/Station/SharedStationSpawningSystem.cs # Content.Shared/Stunnable/SharedStunSystem.cs # Content.Shared/SurveillanceCamera/SharedSurveillanceCameraMonitorSystem.cs # Content.Shared/VendingMachines/VendingMachineComponent.cs # Content.Shared/Warps/WarpPointSystem.cs # Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs # Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs # Content.Shared/Wieldable/SharedWieldableSystem.cs # Resources/Audio/Ambience/Antag/attributions.yml # Resources/Audio/Ambience/Antag/changeling_start.ogg # Resources/Audio/Effects/attributions.yml # Resources/Audio/Lobby/attributions.yml # Resources/Audio/Machines/attributions.yml # Resources/Audio/Weapons/Guns/Gunshots/attributions.yml # Resources/Locale/en-US/_strings/administration/antag.ftl # Resources/Locale/en-US/_strings/administration/commands/camera.ftl # Resources/Locale/en-US/_strings/administration/commands/dsay-command.ftl # Resources/Locale/en-US/_strings/administration/commands/follow-command.ftl # Resources/Locale/en-US/_strings/administration/smites.ftl # Resources/Locale/en-US/_strings/administration/ui/admin-camera-window.ftl # Resources/Locale/en-US/_strings/administration/ui/role-bans.ftl # Resources/Locale/en-US/_strings/alerts/alerts.ftl # Resources/Locale/en-US/_strings/atmos/gas-pressure-regulator-system.ftl # Resources/Locale/en-US/_strings/bonk/components/bonkable-component.ftl # Resources/Locale/en-US/_strings/commands/add-body-part-command.ftl # Resources/Locale/en-US/_strings/commands/admin-logs-command.ftl # Resources/Locale/en-US/_strings/commands/admin-who-command.ftl # Resources/Locale/en-US/_strings/commands/asay-command.ftl # Resources/Locale/en-US/_strings/commands/crew-manifest-command.ftl # Resources/Locale/en-US/_strings/commands/deadmin-command.ftl # Resources/Locale/en-US/_strings/commands/delete-component-command.ftl # Resources/Locale/en-US/_strings/commands/destroy-mechanism-command.ftl # Resources/Locale/en-US/_strings/commands/dirty-command.ftl # Resources/Locale/en-US/_strings/commands/dsay-command.ftl # Resources/Locale/en-US/_strings/commands/dump-reagent-guide-text-command.ftl # Resources/Locale/en-US/_strings/commands/eye-commands.ftl # Resources/Locale/en-US/_strings/commands/follow-command.ftl # Resources/Locale/en-US/_strings/commands/force-map-command.ftl # Resources/Locale/en-US/_strings/commands/force-preset-command.ftl # Resources/Locale/en-US/_strings/commands/ghost-kick-command.ftl # Resources/Locale/en-US/_strings/commands/ghost-visibility-commands.ftl # Resources/Locale/en-US/_strings/commands/go-lobby-command.ftl # Resources/Locale/en-US/_strings/commands/grid-drag-command.ftl # Resources/Locale/en-US/_strings/commands/is-afk-command.ftl # Resources/Locale/en-US/_strings/commands/makesentient-command.ftl # Resources/Locale/en-US/_strings/commands/map-commands.ftl # Resources/Locale/en-US/_strings/commands/mapping-client-side-setup-command.ftl # Resources/Locale/en-US/_strings/commands/mappingclientsidesetup-command.ftl # Resources/Locale/en-US/_strings/commands/me-command.ftl # Resources/Locale/en-US/_strings/commands/mind-info-command.ftl # Resources/Locale/en-US/_strings/commands/node-vis-commands.ftl # Resources/Locale/en-US/_strings/commands/npc-command.ftl # Resources/Locale/en-US/_strings/commands/nukecodes-command.ftl # Resources/Locale/en-US/_strings/commands/ooc-command.ftl # Resources/Locale/en-US/_strings/commands/pardon-command.ftl # Resources/Locale/en-US/_strings/commands/powerstat-command.ftl # Resources/Locale/en-US/_strings/commands/promote-host-command.ftl # Resources/Locale/en-US/_strings/commands/radiation-command.ftl # Resources/Locale/en-US/_strings/commands/readmin-command.ftl # Resources/Locale/en-US/_strings/commands/remove-extra-components-command.ftl # Resources/Locale/en-US/_strings/commands/role-commands.ftl # Resources/Locale/en-US/_strings/commands/say-command.ftl # Resources/Locale/en-US/_strings/commands/set-battery-percent-command.ftl # Resources/Locale/en-US/_strings/commands/show-ambient-command.ftl # Resources/Locale/en-US/_strings/commands/show-gun-spread-command.ftl # Resources/Locale/en-US/_strings/commands/show-htn-command.ftl # Resources/Locale/en-US/_strings/commands/showrules-command.ftl # Resources/Locale/en-US/_strings/commands/spawn-entity-list-command.ftl # Resources/Locale/en-US/_strings/commands/start-singularity-command.ftl # Resources/Locale/en-US/_strings/commands/tile-pry-command.ftl # Resources/Locale/en-US/_strings/commands/toggle-decals-command.ftl # Resources/Locale/en-US/_strings/commands/toggle-disallow-late-join-command.ftl # Resources/Locale/en-US/_strings/commands/unlocknode-command.ftl # Resources/Locale/en-US/_strings/commands/whisper-command.ftl # Resources/Locale/en-US/_strings/components/gas-pressure-regulator-component.ftl # Resources/Locale/en-US/_strings/engineer-painter/engineer-painter.ftl # Resources/Locale/en-US/_strings/game-ticking/forcemap-command.ftl # Resources/Locale/en-US/_strings/interaction/interaction-popup-component.ftl # Resources/Locale/en-US/_strings/markings/vox_tattoos.ftl # Resources/Locale/en-US/_strings/materials/material-extractor.ftl # Resources/Locale/en-US/_strings/movement/eye.ftl # Resources/Locale/en-US/_strings/nutrition/components/food-component.ftl # Resources/Locale/en-US/_strings/nutrition/components/ingestion-system.ftl # Resources/Locale/en-US/_strings/nutrition/components/sealable-component.ftl # Resources/Locale/en-US/_strings/radiation/radiation-command.ftl # Resources/Locale/en-US/_strings/reagents/meta/physical-desc.ftl # Resources/Locale/en-US/_strings/research/technologies.ftl # Resources/Locale/en-US/_strings/seeds/seeds.ftl # Resources/Locale/en-US/_strings/weapons/grenades/timer-trigger.ftl # Resources/Locale/en-US/_strings/weapons/grenades/voice-trigger.ftl # Resources/Locale/en-US/commands/mapping-client-side-setup-command.ftl # Resources/Locale/en-US/recipes/tags.ftl # Resources/Maps/_Sunrise/Station/bagel.yml # Resources/Maps/_Sunrise/Station/barratry.yml # Resources/Maps/_Sunrise/Station/box.yml # Resources/Maps/_Sunrise/Station/fland.yml # Resources/Maps/_Sunrise/Station/marathon.yml # Resources/Maps/_Sunrise/Station/oasis.yml # Resources/Maps/_Sunrise/Station/packed.yml # Resources/Maps/_Sunrise/Station/plasma.yml # Resources/Maps/amber.yml # Resources/Maps/centcomm.yml # Resources/Prototypes/Catalog/Fills/Backpacks/duffelbag.yml # Resources/Prototypes/Catalog/Fills/Lockers/security.yml # Resources/Prototypes/Catalog/Fills/Lockers/service.yml # Resources/Prototypes/Catalog/Fills/Lockers/suit_storage.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/coffee.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/sustenance.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/winterdrobe.yml # Resources/Prototypes/Entities/Clothing/Belt/belts.yml # Resources/Prototypes/Entities/Clothing/Eyes/glasses.yml # Resources/Prototypes/Entities/Clothing/Eyes/hud.yml # Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml # Resources/Prototypes/Entities/Clothing/Head/hats.yml # Resources/Prototypes/Entities/Clothing/Head/helmets.yml # Resources/Prototypes/Entities/Clothing/Head/hoods.yml # Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml # Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml # Resources/Prototypes/Entities/Clothing/OuterClothing/softsuits.yml # Resources/Prototypes/Entities/Clothing/OuterClothing/suits.yml # Resources/Prototypes/Entities/Mobs/NPCs/animals.yml # Resources/Prototypes/Entities/Mobs/NPCs/carp.yml # Resources/Prototypes/Entities/Mobs/NPCs/pets.yml # Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml # Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml # Resources/Prototypes/Entities/Mobs/Player/clone.yml # Resources/Prototypes/Entities/Mobs/Species/base.yml # Resources/Prototypes/Entities/Mobs/Species/dwarf.yml # Resources/Prototypes/Entities/Mobs/base.yml # Resources/Prototypes/Entities/Objects/Fun/pai.yml # Resources/Prototypes/Entities/Objects/Fun/toys.yml # Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml # Resources/Prototypes/Entities/Objects/Shields/shields.yml # Resources/Prototypes/Entities/Objects/Specific/Medical/healing.yml # Resources/Prototypes/Entities/Objects/Specific/Medical/hypospray.yml # Resources/Prototypes/Entities/Objects/Tools/access_configurator.yml # Resources/Prototypes/Entities/Objects/Tools/matches.yml # Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml # Resources/Prototypes/Entities/Objects/Weapons/Bombs/spider.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magazines/caseless_rifle.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magazines/light_rifle.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magazines/magnum.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/grenade.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Shotguns/shotguns.yml # Resources/Prototypes/Entities/Objects/Weapons/Melee/mining.yml # Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml # Resources/Prototypes/Entities/Structures/Doors/Airlocks/airlocks.yml # Resources/Prototypes/Entities/Structures/Doors/airlock_groups.yml # Resources/Prototypes/Entities/Structures/Furniture/beds.yml # Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml # Resources/Prototypes/Entities/Structures/Power/debug_power.yml # Resources/Prototypes/Entities/Structures/Storage/Crates/crates.yml # Resources/Prototypes/Entities/Structures/Wallmounts/Misc/mirror.yml # Resources/Prototypes/GameRules/subgamemodes.yml # Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml # Resources/Prototypes/Reagents/Consumable/Drink/soda.yml # Resources/Prototypes/Reagents/medicine.yml # Resources/Prototypes/Recipes/Lathes/Packs/tiles.yml # Resources/Prototypes/Recipes/Lathes/categories.yml # Resources/Prototypes/Recipes/Reactions/chemicals.yml # Resources/Prototypes/Roles/Antags/changeling.yml # Resources/Prototypes/name_identifier_groups.yml # Resources/Prototypes/tool_qualities.yml # Resources/ServerInfo/Guidebook/Antagonist/Zombies.xml # Resources/ServerInfo/Guidebook/Cargo/CargoBounties.xml # Resources/ServerInfo/Guidebook/Command.xml # Resources/ServerInfo/Guidebook/Glossary.xml # Resources/ServerInfo/Guidebook/NewPlayer/YourFirstCharacter.xml # Resources/ServerInfo/Guidebook/Science/Robotics.xml # Resources/ServerInfo/Guidebook/Science/ScannersAndVessels.xml # Resources/ServerInfo/Guidebook/Science/Science.xml # Resources/ServerInfo/Guidebook/SpaceStation14.xml # Resources/ServerInfo/Guidebook/Survival.xml # Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/capspace.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/cybersun.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/engineering-white.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/engineering-white.rsi/on-equipped-HELMET.png # Resources/Textures/Clothing/Head/Hardsuits/engineering.rsi/icon.png # Resources/Textures/Clothing/Head/Hardsuits/engineering.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/engineering.rsi/on-equipped-HELMET.png # Resources/Textures/Clothing/Head/Hardsuits/medical.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/rd.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/salvage.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/security.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/spatiohelm.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/syndicate.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/syndiecommander.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/syndieelite.rsi/meta.json # Resources/Textures/Clothing/Head/Hardsuits/wizard.rsi/meta.json # Resources/Textures/Clothing/Head/Helmets/atmos_firehelmet.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Armor/captain_carapace.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Armor/security.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/atmospherics.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/capspace.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/cybersun.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/engineering-white.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/engineering.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/medical.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/paramed.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/rd.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/salvage.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/security.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/spatio.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/syndicate.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/syndiecommander.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/syndieelite.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Hardsuits/wizard.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Suits/atmos_firesuit.rsi/meta.json # Resources/Textures/Clothing/OuterClothing/Suits/eva.rsi/meta.json # Resources/Textures/Interface/Misc/job_icons.rsi/meta.json # Resources/Textures/Objects/Misc/Lights/lampgreen.rsi/meta.json # Resources/Textures/Objects/Specific/Janitorial/janitorial_cart.rsi/meta.json # Resources/Textures/Objects/Tools/spray_painter.rsi/meta.json # Resources/Textures/Objects/Weapons/Melee/baseball_bat.rsi/meta.json # Resources/engineCommandPerms.yml # Resources/keybinds.yml # Resources/migration.yml
623 lines
22 KiB
C#
623 lines
22 KiB
C#
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
using System.Numerics;
|
|
using Content.Client.Administration.UI.CustomControls;
|
|
using Content.Shared.Administration;
|
|
using Content.Shared.CCVar;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.Roles;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Timing;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Client.Administration.UI.BanPanel;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class BanPanel : DefaultWindow
|
|
{
|
|
public event Action<string?, (IPAddress, int)?, bool, ImmutableTypedHwid?, bool, uint, string, NoteSeverity, string[]?, bool>? BanSubmitted;
|
|
public event Action<string>? PlayerChanged;
|
|
private string? PlayerUsername { get; set; }
|
|
private (IPAddress, int)? IpAddress { get; set; }
|
|
private ImmutableTypedHwid? Hwid { get; set; }
|
|
private double TimeEntered { get; set; }
|
|
private uint Multiplier { get; set; }
|
|
private bool HasBanFlag { get; set; }
|
|
private TimeSpan? ButtonResetOn { get; set; }
|
|
|
|
// This is less efficient than just holding a reference to the root control and enumerating children, but you
|
|
// have to know how the controls are nested, which makes the code more complicated.
|
|
// Role group name -> the role buttons themselves.
|
|
private readonly Dictionary<string, List<Button>> _roleCheckboxes = new();
|
|
private readonly ISawmill _banpanelSawmill;
|
|
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
[Dependency] private readonly ILogManager _logManager = default!;
|
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
|
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
|
|
|
private const string ExpandedArrow = "▼";
|
|
private const string ContractedArrow = "▶";
|
|
|
|
private readonly string _antagCategory = Loc.GetString("ban-panel-role-selection-antag");
|
|
private readonly string _antagAllSelection = Loc.GetString("ban-panel-role-selection-antag-all-option");
|
|
|
|
private enum TabNumbers
|
|
{
|
|
BasicInfo,
|
|
//Text,
|
|
Players,
|
|
Roles
|
|
}
|
|
|
|
private enum Multipliers
|
|
{
|
|
Minutes,
|
|
Hours,
|
|
Days,
|
|
Weeks,
|
|
Months,
|
|
Years,
|
|
Permanent
|
|
}
|
|
|
|
private enum Types
|
|
{
|
|
None,
|
|
Server,
|
|
Role
|
|
}
|
|
|
|
public BanPanel()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
_banpanelSawmill = _logManager.GetSawmill("admin.banpanel");
|
|
PlayerList.OnSelectionChanged += OnPlayerSelectionChanged;
|
|
PlayerNameLine.OnFocusExit += _ => OnPlayerNameChanged();
|
|
PlayerCheckbox.OnPressed += _ =>
|
|
{
|
|
PlayerNameLine.Editable = PlayerCheckbox.Pressed;
|
|
PlayerNameLine.ModulateSelfOverride = null;
|
|
};
|
|
TimeLine.OnTextChanged += OnMinutesChanged;
|
|
MultiplierOption.OnItemSelected += args =>
|
|
{
|
|
MultiplierOption.SelectId(args.Id);
|
|
OnMultiplierChanged();
|
|
};
|
|
IpLine.OnFocusExit += _ => OnIpChanged();
|
|
IpCheckbox.OnPressed += _ =>
|
|
{
|
|
IpLine.Editable = IpCheckbox.Pressed;
|
|
OnIpChanged();
|
|
};
|
|
HwidLine.OnFocusExit += _ => OnHwidChanged();
|
|
HwidCheckbox.OnPressed += _ =>
|
|
{
|
|
HwidLine.Editable = HwidCheckbox.Pressed;
|
|
OnHwidChanged();
|
|
};
|
|
TypeOption.OnItemSelected += args =>
|
|
{
|
|
TypeOption.SelectId(args.Id);
|
|
OnTypeChanged();
|
|
};
|
|
LastConnCheckbox.OnPressed += args =>
|
|
{
|
|
IpLine.ModulateSelfOverride = null;
|
|
HwidLine.ModulateSelfOverride = null;
|
|
OnIpChanged();
|
|
OnHwidChanged();
|
|
};
|
|
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
|
|
|
|
IpCheckbox.Pressed = _cfg.GetCVar(CCVars.ServerBanIpBanDefault);
|
|
HwidCheckbox.Pressed = _cfg.GetCVar(CCVars.ServerBanHwidBanDefault);
|
|
LastConnCheckbox.Pressed = _cfg.GetCVar(CCVars.ServerBanUseLastDetails);
|
|
EraseCheckbox.Pressed = _cfg.GetCVar(CCVars.ServerBanErasePlayer);
|
|
|
|
SeverityOption.AddItem(Loc.GetString("admin-note-editor-severity-none"), (int) NoteSeverity.None);
|
|
SeverityOption.AddItem(Loc.GetString("admin-note-editor-severity-low"), (int) NoteSeverity.Minor);
|
|
SeverityOption.AddItem(Loc.GetString("admin-note-editor-severity-medium"), (int) NoteSeverity.Medium);
|
|
SeverityOption.AddItem(Loc.GetString("admin-note-editor-severity-high"), (int) NoteSeverity.High);
|
|
SeverityOption.SelectId((int) NoteSeverity.Medium);
|
|
SeverityOption.OnItemSelected += args => SeverityOption.SelectId(args.Id);
|
|
|
|
MultiplierOption.AddItem(Loc.GetString("ban-panel-minutes"), (int) Multipliers.Minutes);
|
|
MultiplierOption.AddItem(Loc.GetString("ban-panel-hours"), (int) Multipliers.Hours);
|
|
MultiplierOption.AddItem(Loc.GetString("ban-panel-days"), (int) Multipliers.Days);
|
|
MultiplierOption.AddItem(Loc.GetString("ban-panel-weeks"), (int) Multipliers.Weeks);
|
|
MultiplierOption.AddItem(Loc.GetString("ban-panel-months"), (int) Multipliers.Months);
|
|
MultiplierOption.AddItem(Loc.GetString("ban-panel-years"), (int) Multipliers.Years);
|
|
MultiplierOption.AddItem(Loc.GetString("ban-panel-permanent"), (int) Multipliers.Permanent);
|
|
MultiplierOption.SelectId((int) Multipliers.Minutes);
|
|
OnMultiplierChanged();
|
|
|
|
Tabs.SetTabTitle((int) TabNumbers.BasicInfo, Loc.GetString("ban-panel-tabs-basic"));
|
|
//Tabs.SetTabTitle((int) TabNumbers.Text, Loc.GetString("ban-panel-tabs-reason"));
|
|
Tabs.SetTabTitle((int) TabNumbers.Players, Loc.GetString("ban-panel-tabs-players"));
|
|
Tabs.SetTabTitle((int) TabNumbers.Roles, Loc.GetString("ban-panel-tabs-role"));
|
|
Tabs.SetTabVisible((int) TabNumbers.Roles, false);
|
|
|
|
TypeOption.AddItem(Loc.GetString("ban-panel-select"), (int) Types.None);
|
|
TypeOption.AddItem(Loc.GetString("ban-panel-server"), (int) Types.Server);
|
|
TypeOption.AddItem(Loc.GetString("ban-panel-role"), (int) Types.Role);
|
|
|
|
|
|
|
|
ReasonTextEdit.Placeholder = new Rope.Leaf(Loc.GetString("ban-panel-reason"));
|
|
|
|
var departmentJobs = _protoMan.EnumeratePrototypes<DepartmentPrototype>()
|
|
.OrderBy(x => x.Weight);
|
|
foreach (var proto in departmentJobs)
|
|
{
|
|
var roles = proto.Roles.Select(x => _protoMan.Index(x))
|
|
.OrderBy(x => x.ID);
|
|
CreateRoleGroup(proto.ID, proto.Color, roles);
|
|
}
|
|
|
|
var antagRoles = _protoMan.EnumeratePrototypes<AntagPrototype>()
|
|
.OrderBy(x => x.ID);
|
|
CreateRoleGroup("Antagonist", Color.Red, antagRoles);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a "Role group" which stores information and logic for one "group" of roll bans.
|
|
/// For example, all antags are one group, logi is a group, medical is a group, etc...
|
|
/// </summary>
|
|
private void CreateRoleGroup<T>(string groupName, Color color, IEnumerable<T> roles) where T : class, IPrototype
|
|
{
|
|
var outerContainer = new BoxContainer
|
|
{
|
|
Name = $"{groupName}GroupOuterBox",
|
|
HorizontalExpand = true,
|
|
VerticalExpand = true,
|
|
Orientation = BoxContainer.LayoutOrientation.Vertical,
|
|
Margin = new Thickness(4),
|
|
};
|
|
|
|
// Stores stuff like ban all and expand buttons.
|
|
var roleGroupHeader = new BoxContainer
|
|
{
|
|
Orientation = BoxContainer.LayoutOrientation.Horizontal,
|
|
};
|
|
|
|
// Stores the role checkboxes themselves.
|
|
var innerContainer = new GridContainer
|
|
{
|
|
Name = $"{groupName}GroupInnerBox",
|
|
HorizontalExpand = true,
|
|
Columns = 2,
|
|
Visible = false,
|
|
Margin = new Thickness(15, 5, 0, 5),
|
|
};
|
|
|
|
var roleGroupCheckbox = CreateRoleGroupHeader(groupName, roleGroupHeader, color, innerContainer);
|
|
|
|
outerContainer.AddChild(roleGroupHeader);
|
|
|
|
// Add the roles themselves
|
|
foreach (var role in roles)
|
|
{
|
|
AddRoleCheckbox(groupName, role.ID, innerContainer, roleGroupCheckbox);
|
|
}
|
|
|
|
outerContainer.AddChild(innerContainer);
|
|
|
|
RolesContainer.AddChild(new PanelContainer
|
|
{
|
|
PanelOverride = new StyleBoxFlat
|
|
{
|
|
BackgroundColor = color
|
|
}
|
|
});
|
|
RolesContainer.AddChild(outerContainer);
|
|
RolesContainer.AddChild(new HSeparator());
|
|
}
|
|
|
|
private Button CreateRoleGroupHeader(string groupName, BoxContainer header, Color color, GridContainer innerContainer)
|
|
{
|
|
var roleGroupCheckbox = new Button
|
|
{
|
|
Name = $"{groupName}GroupCheckbox",
|
|
Text = "Ban all",
|
|
Margin = new Thickness(0, 0, 5, 0),
|
|
ToggleMode = true,
|
|
};
|
|
|
|
// When this is toggled, toggle all buttons in this group so they match.
|
|
roleGroupCheckbox.OnToggled += args =>
|
|
{
|
|
foreach (var role in _roleCheckboxes[groupName])
|
|
{
|
|
role.Pressed = args.Pressed;
|
|
}
|
|
|
|
if (args.Pressed)
|
|
{
|
|
if (!Enum.TryParse(_cfg.GetCVar(CCVars.DepartmentBanDefaultSeverity), true, out NoteSeverity newSeverity))
|
|
{
|
|
_banpanelSawmill
|
|
.Warning("Departmental role ban severity could not be parsed from config!");
|
|
return;
|
|
}
|
|
SeverityOption.SelectId((int)newSeverity);
|
|
}
|
|
else
|
|
{
|
|
foreach (var roleButtons in _roleCheckboxes.Values)
|
|
{
|
|
foreach (var button in roleButtons)
|
|
{
|
|
if (button.Pressed)
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (!Enum.TryParse(_cfg.GetCVar(CCVars.RoleBanDefaultSeverity), true, out NoteSeverity newSeverity))
|
|
{
|
|
_banpanelSawmill
|
|
.Warning("Role ban severity could not be parsed from config!");
|
|
return;
|
|
}
|
|
SeverityOption.SelectId((int)newSeverity);
|
|
}
|
|
};
|
|
|
|
var hideButton = new Button
|
|
{
|
|
Text = Loc.GetString("role-bans-expand-roles") + " " + ContractedArrow,
|
|
ToggleMode = true,
|
|
};
|
|
hideButton.OnPressed += args =>
|
|
{
|
|
innerContainer.Visible = args.Button.Pressed;
|
|
((Button)args.Button).Text = args.Button.Pressed
|
|
? Loc.GetString("role-bans-contract-roles") + " " + ExpandedArrow
|
|
: Loc.GetString("role-bans-expand-roles") + " " + ContractedArrow;
|
|
};
|
|
header.AddChild(new Label
|
|
{
|
|
Text = groupName,
|
|
Modulate = color,
|
|
Margin = new Thickness(0, 0, 5, 0),
|
|
});
|
|
header.AddChild(roleGroupCheckbox);
|
|
header.AddChild(hideButton);
|
|
return roleGroupCheckbox;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Adds a checkbutton specifically for one "role" in a "group"
|
|
/// E.g. it would add the Chief Medical Officer "role" into the "Medical" group.
|
|
/// </summary>
|
|
private void AddRoleCheckbox(string group, string role, GridContainer roleGroupInnerContainer, Button roleGroupCheckbox)
|
|
{
|
|
var roleCheckboxContainer = new BoxContainer();
|
|
var roleCheckButton = new Button
|
|
{
|
|
Name = $"{role}RoleCheckbox",
|
|
Text = role,
|
|
ToggleMode = true,
|
|
};
|
|
roleCheckButton.OnToggled += args =>
|
|
{
|
|
// Checks the role group checkbox if all the children are pressed
|
|
if (args.Pressed && _roleCheckboxes[group].All(e => e.Pressed))
|
|
roleGroupCheckbox.Pressed = args.Pressed;
|
|
else
|
|
roleGroupCheckbox.Pressed = false;
|
|
};
|
|
|
|
// This is adding the icon before the role name
|
|
// Yeah, this is sus, but having to split the functions up and stuff is worse imo.
|
|
if (_protoMan.TryIndex<JobPrototype>(role, out var jobPrototype) && _protoMan.TryIndex(jobPrototype.Icon, out var iconProto))
|
|
{
|
|
var jobIconTexture = new TextureRect
|
|
{
|
|
Texture = _entMan.System<SpriteSystem>().Frame0(iconProto.Icon),
|
|
TextureScale = new Vector2(2.5f, 2.5f),
|
|
Stretch = TextureRect.StretchMode.KeepCentered,
|
|
Margin = new Thickness(5, 0, 0, 0),
|
|
};
|
|
roleCheckboxContainer.AddChild(jobIconTexture);
|
|
}
|
|
|
|
roleCheckboxContainer.AddChild(roleCheckButton);
|
|
|
|
roleGroupInnerContainer.AddChild(roleCheckboxContainer);
|
|
|
|
_roleCheckboxes.TryAdd(group, []);
|
|
_roleCheckboxes[group].Add(roleCheckButton);
|
|
}
|
|
|
|
public void UpdateBanFlag(bool newFlag)
|
|
{
|
|
HasBanFlag = newFlag;
|
|
SubmitButton.Visible = HasBanFlag;
|
|
ModulateSelfOverride = HasBanFlag ? Color.Red : null;
|
|
}
|
|
|
|
public void UpdatePlayerData(string playerName)
|
|
{
|
|
if (string.IsNullOrEmpty(playerName))
|
|
{
|
|
PlayerNameLine.ModulateSelfOverride = Color.Red;
|
|
ErrorLevel |= ErrorLevelEnum.PlayerName;
|
|
UpdateSubmitEnabled();
|
|
return;
|
|
}
|
|
PlayerNameLine.ModulateSelfOverride = null;
|
|
ErrorLevel &= ~ErrorLevelEnum.PlayerName;
|
|
UpdateSubmitEnabled();
|
|
PlayerUsername = playerName;
|
|
PlayerNameLine.Text = playerName;
|
|
}
|
|
|
|
[Flags]
|
|
private enum ErrorLevelEnum : byte
|
|
{
|
|
None = 0,
|
|
Minutes = 1 << 0,
|
|
PlayerName = 1 << 1,
|
|
IpAddress = 1 << 2,
|
|
Hwid = 1 << 3,
|
|
}
|
|
|
|
private ErrorLevelEnum ErrorLevel { get; set; }
|
|
|
|
private void OnMinutesChanged(LineEdit.LineEditEventArgs args)
|
|
{
|
|
TimeLine.Text = args.Text;
|
|
if (!double.TryParse(args.Text, out var result))
|
|
{
|
|
ExpiresLabel.Text = "err";
|
|
ErrorLevel |= ErrorLevelEnum.Minutes;
|
|
TimeLine.ModulateSelfOverride = Color.Red;
|
|
UpdateSubmitEnabled();
|
|
return;
|
|
}
|
|
|
|
ErrorLevel &= ~ErrorLevelEnum.Minutes;
|
|
TimeLine.ModulateSelfOverride = null;
|
|
TimeEntered = result;
|
|
UpdateSubmitEnabled();
|
|
UpdateExpiresLabel();
|
|
}
|
|
|
|
private void OnMultiplierChanged()
|
|
{
|
|
TimeLine.Editable = MultiplierOption.SelectedId != (int) Multipliers.Permanent;
|
|
Multiplier = MultiplierOption.SelectedId switch
|
|
{
|
|
(int) Multipliers.Minutes => 1,
|
|
(int) Multipliers.Hours => 60,
|
|
(int) Multipliers.Days => 60 * 24,
|
|
(int) Multipliers.Weeks => 60 * 24 * 7,
|
|
(int) Multipliers.Months => 60 * 24 * 30,
|
|
(int) Multipliers.Years => 60 * 24 * 365,
|
|
(int) Multipliers.Permanent => 0,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(MultiplierOption.SelectedId), "Multiplier out of range")
|
|
};
|
|
UpdateExpiresLabel();
|
|
}
|
|
|
|
private void UpdateExpiresLabel()
|
|
{
|
|
var minutes = (uint) (TimeEntered * Multiplier);
|
|
ExpiresLabel.Text = minutes == 0
|
|
? $"{Loc.GetString("admin-note-editor-expiry-label")} {Loc.GetString("server-ban-string-never")}"
|
|
: $"{Loc.GetString("admin-note-editor-expiry-label")} {DateTime.Now + TimeSpan.FromMinutes(minutes):yyyy/MM/dd HH:mm:ss}";
|
|
}
|
|
|
|
private void OnIpChanged()
|
|
{
|
|
if (LastConnCheckbox.Pressed && IpAddress is null || !IpCheckbox.Pressed)
|
|
{
|
|
IpAddress = null;
|
|
ErrorLevel &= ~ErrorLevelEnum.IpAddress;
|
|
IpLine.ModulateSelfOverride = null;
|
|
UpdateSubmitEnabled();
|
|
return;
|
|
}
|
|
var ip = IpLine.Text;
|
|
var hid = "0";
|
|
if (ip.Contains('/'))
|
|
{
|
|
var split = ip.Split('/');
|
|
ip = split[0];
|
|
hid = split[1];
|
|
}
|
|
|
|
if (!IPAddress.TryParse(ip, out var parsedIp) || !byte.TryParse(hid, out var hidInt) || hidInt > 128 || hidInt > 32 && parsedIp.AddressFamily == AddressFamily.InterNetwork)
|
|
{
|
|
ErrorLevel |= ErrorLevelEnum.IpAddress;
|
|
IpLine.ModulateSelfOverride = Color.Red;
|
|
UpdateSubmitEnabled();
|
|
return;
|
|
}
|
|
|
|
if (hidInt == 0)
|
|
hidInt = (byte) (parsedIp.AddressFamily == AddressFamily.InterNetworkV6 ? 128 : 32);
|
|
IpAddress = (parsedIp, hidInt);
|
|
ErrorLevel &= ~ErrorLevelEnum.IpAddress;
|
|
IpLine.ModulateSelfOverride = null;
|
|
UpdateSubmitEnabled();
|
|
}
|
|
|
|
private void OnHwidChanged()
|
|
{
|
|
var hwidString = HwidLine.Text;
|
|
ImmutableTypedHwid? hwid = null;
|
|
if (HwidCheckbox.Pressed && !(string.IsNullOrEmpty(hwidString) && LastConnCheckbox.Pressed) && !ImmutableTypedHwid.TryParse(hwidString, out hwid))
|
|
{
|
|
ErrorLevel |= ErrorLevelEnum.Hwid;
|
|
HwidLine.ModulateSelfOverride = Color.Red;
|
|
UpdateSubmitEnabled();
|
|
return;
|
|
}
|
|
|
|
ErrorLevel &= ~ErrorLevelEnum.Hwid;
|
|
HwidLine.ModulateSelfOverride = null;
|
|
UpdateSubmitEnabled();
|
|
|
|
if (LastConnCheckbox.Pressed || !HwidCheckbox.Pressed)
|
|
{
|
|
Hwid = null;
|
|
return;
|
|
}
|
|
Hwid = hwid;
|
|
}
|
|
|
|
private void OnTypeChanged()
|
|
{
|
|
TypeOption.ModulateSelfOverride = null;
|
|
Tabs.SetTabVisible((int) TabNumbers.Roles, TypeOption.SelectedId == (int) Types.Role);
|
|
NoteSeverity? newSeverity = null;
|
|
switch (TypeOption.SelectedId)
|
|
{
|
|
case (int)Types.Server:
|
|
if (Enum.TryParse(_cfg.GetCVar(CCVars.ServerBanDefaultSeverity), true, out NoteSeverity serverSeverity))
|
|
newSeverity = serverSeverity;
|
|
else
|
|
{
|
|
_banpanelSawmill
|
|
.Warning("Server ban severity could not be parsed from config!");
|
|
}
|
|
|
|
break;
|
|
case (int) Types.Role:
|
|
|
|
if (Enum.TryParse(_cfg.GetCVar(CCVars.RoleBanDefaultSeverity), true, out NoteSeverity roleSeverity))
|
|
{
|
|
newSeverity = roleSeverity;
|
|
}
|
|
else
|
|
{
|
|
_banpanelSawmill
|
|
.Warning("Role ban severity could not be parsed from config!");
|
|
}
|
|
break;
|
|
}
|
|
|
|
if (newSeverity != null)
|
|
SeverityOption.SelectId((int) newSeverity.Value);
|
|
}
|
|
|
|
private void UpdateSubmitEnabled()
|
|
{
|
|
SubmitButton.Disabled = ErrorLevel != ErrorLevelEnum.None;
|
|
}
|
|
|
|
private void OnPlayerNameChanged()
|
|
{
|
|
if (PlayerUsername == PlayerNameLine.Text)
|
|
return;
|
|
PlayerUsername = PlayerNameLine.Text;
|
|
if (!PlayerCheckbox.Pressed)
|
|
return;
|
|
if (string.IsNullOrWhiteSpace(PlayerUsername))
|
|
ErrorLevel |= ErrorLevelEnum.PlayerName;
|
|
else
|
|
ErrorLevel &= ~ErrorLevelEnum.PlayerName;
|
|
|
|
UpdateSubmitEnabled();
|
|
PlayerChanged?.Invoke(PlayerUsername);
|
|
}
|
|
|
|
public void OnPlayerSelectionChanged(PlayerInfo? player)
|
|
{
|
|
PlayerNameLine.Text = player?.Username ?? string.Empty;
|
|
OnPlayerNameChanged();
|
|
}
|
|
|
|
private void ResetTextEditor(GUIBoundKeyEventArgs _)
|
|
{
|
|
ReasonTextEdit.ModulateSelfOverride = null;
|
|
ReasonTextEdit.OnKeyBindDown -= ResetTextEditor;
|
|
}
|
|
|
|
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
|
{
|
|
string[]? roles = null;
|
|
if (TypeOption.SelectedId == (int) Types.Role)
|
|
{
|
|
var rolesList = new List<string>();
|
|
if (_roleCheckboxes.Count == 0)
|
|
throw new DebugAssertException("RoleCheckboxes was empty");
|
|
|
|
foreach (var button in _roleCheckboxes.Values.SelectMany(departmentButtons => departmentButtons))
|
|
{
|
|
if (button is { Pressed: true, Text: not null })
|
|
{
|
|
rolesList.Add(button.Text);
|
|
}
|
|
}
|
|
|
|
if (rolesList.Count == 0)
|
|
{
|
|
Tabs.CurrentTab = (int) TabNumbers.Roles;
|
|
return;
|
|
}
|
|
|
|
roles = rolesList.ToArray();
|
|
}
|
|
|
|
if (TypeOption.SelectedId == (int) Types.None)
|
|
{
|
|
TypeOption.ModulateSelfOverride = Color.Red;
|
|
Tabs.CurrentTab = (int) TabNumbers.BasicInfo;
|
|
return;
|
|
}
|
|
|
|
var reason = Rope.Collapse(ReasonTextEdit.TextRope);
|
|
if (string.IsNullOrWhiteSpace(reason))
|
|
{
|
|
//Tabs.CurrentTab = (int) TabNumbers.Text;
|
|
Tabs.CurrentTab = (int) TabNumbers.BasicInfo;
|
|
ReasonTextEdit.GrabKeyboardFocus();
|
|
ReasonTextEdit.ModulateSelfOverride = Color.Red;
|
|
ReasonTextEdit.OnKeyBindDown += ResetTextEditor;
|
|
return;
|
|
}
|
|
|
|
if (ButtonResetOn is null)
|
|
{
|
|
ButtonResetOn = _gameTiming.CurTime.Add(TimeSpan.FromSeconds(3));
|
|
SubmitButton.ModulateSelfOverride = Color.Red;
|
|
SubmitButton.Text = Loc.GetString("ban-panel-confirm");
|
|
return;
|
|
}
|
|
|
|
var player = PlayerCheckbox.Pressed ? PlayerUsername : null;
|
|
var useLastIp = IpCheckbox.Pressed && LastConnCheckbox.Pressed && IpAddress is null;
|
|
var useLastHwid = HwidCheckbox.Pressed && LastConnCheckbox.Pressed && Hwid is null;
|
|
var severity = (NoteSeverity) SeverityOption.SelectedId;
|
|
var erase = EraseCheckbox.Pressed;
|
|
BanSubmitted?.Invoke(player, IpAddress, useLastIp, Hwid, useLastHwid, (uint) (TimeEntered * Multiplier), reason, severity, roles, erase);
|
|
}
|
|
|
|
protected override void FrameUpdate(FrameEventArgs args)
|
|
{
|
|
base.FrameUpdate(args);
|
|
|
|
// This checks for null for free, do not invert it as null always produces a false value
|
|
if (_gameTiming.CurTime > ButtonResetOn)
|
|
{
|
|
ButtonResetOn = null;
|
|
SubmitButton.ModulateSelfOverride = null;
|
|
SubmitButton.Text = Loc.GetString("ban-panel-submit");
|
|
}
|
|
}
|
|
}
|