-
Notifications
You must be signed in to change notification settings - Fork 31
Updare StationRecords #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cfa306b
8c73227
becbcd9
d626c21
d847a12
9ec21b9
867d9b4
4297bd9
2608f37
ca1db0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Client.Sprite; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Client.UserInterface.Systems.Guidebook; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared._WL.Skills; // WL-Skills | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared._WL.Records; // WL-Records | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.CCVar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.Clothing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Shared.Corvax.CCCVars; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -41,7 +42,8 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Robust.Shared.Utility; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Direction = Robust.Shared.Maths.Direction; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using static Content.Client.Corvax.SponsorOnlyHelpers; // Corvax-Sponsors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Client.Corvax.TTS; // Corvax-TTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Client.Corvax.TTS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Content.Client.Lathe.UI; // Corvax-TTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace Content.Client.Lobby.UI | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -195,6 +197,15 @@ public sealed partial class HumanoidProfileEditor : BoxContainer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private TextEdit? _securityRecordEdit; // WL-Records | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private TextEdit? _employmentRecordEdit; // WL-Records | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private LineEdit? _generalRecordNameEdit; // WL-Records | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private LineEdit? _generalRecordAgeEdit; // WL-Records | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private LineEdit? _generalRecordCountryEdit; // WL-Records | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private OptionButton? _confederationButton; // WL-Records | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private List<ConfederationRecordsPrototype> _confederations = new(); // WL-Recordss | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo in comment: 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private SingleMarkingPicker _underwearPicker => CUnderwearPicker; // WL-Underwear | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private SingleMarkingPicker _undershirtPicker => CUndershirtPicker; // WL-Underwear | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private SingleMarkingPicker _socksPicker => CSocksPicker; // WL-Underwear | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -743,6 +754,12 @@ public HumanoidProfileEditor( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RefreshFlavorText(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RefreshRecords(); // WL-Records | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //_confederationButton.OnItemSelected += args => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RefreshVoiceTab(); // Corvax-TTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #region Dummy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -822,9 +839,37 @@ public void RefreshRecords() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _securityRecordEdit = _recordsTab.SecurityRecordInput; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _employmentRecordEdit = _recordsTab.EmploymentRecordInput; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _generalRecordNameEdit = _recordsTab.NameEdit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _generalRecordAgeEdit = _recordsTab.AgeEdit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _generalRecordCountryEdit = _recordsTab.CountryEdit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _confederationButton = _recordsTab.ConfederationButton; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _recordsTab.OnMedicalRecordChanged += OnMedicalRecordChange; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _recordsTab.OnSecurityRecordChanged += OnSecurityRecordChange; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _recordsTab.OnEmploymentRecordChanged += OnEmploymentRecordChange; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _recordsTab.OnGeneralRecordNameChanged += OnGeneralRecordNameChanged; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _recordsTab.OnGeneralRecordAgeChanged += OnGeneralRecordDateOfBirthChanged; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _recordsTab.OnGeneralRecordCountryChanged += OnGeneralRecordCountryChanged; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _recordsTab.OnGeneralRecordConfederationChanged += SetConfederation; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _confederations.AddRange(_prototypeManager.EnumeratePrototypes<ConfederationRecordsPrototype>()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _confederations.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.CurrentCultureIgnoreCase)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (var i = 0; i < _confederations.Count; i++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var name = Loc.GetString(_confederations[i].Name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _recordsTab.ConfederationButton.AddItem(name, i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (_confederations[i].ID == "NoConfederation") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _recordsTab.ConfederationButton.SelectId(i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private void OnMedicalRecordChange(string content) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -853,6 +898,44 @@ private void OnEmploymentRecordChange(string content) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Profile = Profile.WithEmploymentRecord(content); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SetDirty(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private void OnGeneralRecordNameChanged(string content) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (Profile is null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Profile = Profile.WithFullName(content); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SetDirty(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private void OnGeneralRecordDateOfBirthChanged(string content) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (Profile is null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Profile = Profile.WithDateOfBirth(content); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SetDirty(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private void OnGeneralRecordCountryChanged(string content) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (Profile is null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Profile = Profile.WithCountry(content); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SetDirty(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private void SetConfederation(OptionButton.ItemSelectedEventArgs args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (_confederationButton is null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (Profile is null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _confederationButton.SelectId(args.Id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Profile = Profile.WithConfederation(_confederations[args.Id].ID); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SetDirty(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+902
to
+937
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's understand the project structure
git ls-files | grep -E "\.(xaml|xaml\.cs)$" | head -20Repository: corvax-team/ss14-wl Length of output: 1256 🏁 Script executed: # Find OptionButton definition
rg "class OptionButton" -A 10Repository: corvax-team/ss14-wl Length of output: 1104 🏁 Script executed: # Look for SelectId method definition
rg "void SelectId|SelectId\(" -B 2 -A 5Repository: corvax-team/ss14-wl Length of output: 50375 🏁 Script executed: # Search for OnItemSelected handler in the HumanoidProfileEditor file
rg "OnItemSelected|SetConfederation" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -B 2 -A 5Repository: corvax-team/ss14-wl Length of output: 2389 🏁 Script executed: # Find OptionButton class definition
rg "class OptionButton" -A 30 --type csRepository: corvax-team/ss14-wl Length of output: 2175 🏁 Script executed: # Search for SelectId method implementation
rg "void SelectId|SelectId\(" --type cs -B 2 -A 10 | head -100Repository: corvax-team/ss14-wl Length of output: 9087 🏁 Script executed: # Look for OptionButton in the UI framework
find . -name "*.cs" -type f | xargs grep -l "class OptionButton" 2>/dev/nullRepository: corvax-team/ss14-wl Length of output: 127 🏁 Script executed: # Look for OptionButton usage to understand the Select vs SelectId pattern
rg "\.Select\(|\.SelectId\(" --type cs | head -50Repository: corvax-team/ss14-wl Length of output: 7466 🏁 Script executed: # Check if there's a RobustToolbox or external reference
find . -name "*.csproj" -type f | head -5 | xargs grep -l "RobustToolbox\|OptionButton" 2>/dev/nullRepository: corvax-team/ss14-wl Length of output: 256 🏁 Script executed: # Look at the HumanoidProfileEditor file directly around the SetConfederation method
sed -n '890,935p' Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.csRepository: corvax-team/ss14-wl Length of output: 1285 🏁 Script executed: # Check for bounds checking patterns in the codebase with _confederations
rg "_confederations\[" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -B 3 -A 3Repository: corvax-team/ss14-wl Length of output: 713 🏁 Script executed: # Check the .csproj file for RobustToolbox reference
cat Content.Client/Content.Client.csproj | grep -A 5 -B 5 "RobustToolbox\|OptionButton"Repository: corvax-team/ss14-wl Length of output: 1109 🏁 Script executed: # Look for more context on how confederations is populated and used
rg "_confederations" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -B 2 -A 2Repository: corvax-team/ss14-wl Length of output: 1087 🏁 Script executed: # Check if there's any validation before indexing _confederations anywhere else in this file
rg "args.Id|args\.Id" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -B 3 -A 3Repository: corvax-team/ss14-wl Length of output: 1673 🏁 Script executed: # Search for OptionButton in RobustToolbox directory if it exists
find . -name "OptionButton.cs" -o -name "*OptionButton*" -type f 2>/dev/null | grep -v ".xaml\|StyleSheetlets"Repository: corvax-team/ss14-wl Length of output: 125 🏁 Script executed: # Check if RobustToolbox is a submodule or external
ls -la RobustToolbox 2>/dev/null || echo "RobustToolbox not found as directory"Repository: corvax-team/ss14-wl Length of output: 175 🏁 Script executed: # Look at other similar validation patterns in the codebase for args.Id
rg "args\.Id.*>=" --type cs -B 2 -A 2 | head -50Repository: corvax-team/ss14-wl Length of output: 45 🏁 Script executed: # Check the Options.OnItemSelected pattern in the same file to see if there's validation
sed -n '700,750p' Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.csRepository: corvax-team/ss14-wl Length of output: 2081 🏁 Script executed: # Look for bounds validation pattern with ItemSelectedEventArgs
rg "ItemSelectedEventArgs" --type cs -B 5 -A 8 | head -80Repository: corvax-team/ss14-wl Length of output: 6927 🏁 Script executed: # Search for any error handling or validation of args.Id in handlers
rg "args\.Id.*<|args\.Id.*>=" --type csRepository: corvax-team/ss14-wl Length of output: 45 🏁 Script executed: # Check if there are any cases where handlers guard against invalid IDs
rg "if.*args\.Id|if.*args\.ButtonId" --type cs -B 2 -A 5 | head -60Repository: corvax-team/ss14-wl Length of output: 4621 Add bounds validation before accessing _confederations, but keep SelectId to maintain selection state sync. The bounds check is good defensive programming: 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // WL-Records-End | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Corvax-TTS-Start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #region Voice | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1909,6 +1992,24 @@ private void UpdateRecordsEdit() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (_employmentRecordEdit != null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _employmentRecordEdit.TextRope = new Rope.Leaf(Profile?.EmploymentRecord ?? ""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (_generalRecordNameEdit != null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _generalRecordNameEdit.Text = Profile?.FullName ?? ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (_generalRecordAgeEdit != null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _generalRecordAgeEdit.Text = Profile?.DateOfBirth ?? ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (_generalRecordCountryEdit != null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _generalRecordCountryEdit.Text = Profile?.Country ?? ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (_confederationButton != null) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (var i = 0; i < _confederations.Count; i++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (Profile?.Confederation.Equals(_confederations[i].ID) == true) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _confederationButton.SelectId(i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1996
to
+2012
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# First, let's find and examine the HumanoidProfileEditor.xaml.cs file
fd -t f "HumanoidProfileEditor.xaml.cs" | head -5Repository: corvax-team/ss14-wl Length of output: 116 🏁 Script executed: #!/bin/bash
# Read the file around lines 1989-2006
wc -l Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
echo "---"
sed -n '1980,2020p' Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.csRepository: corvax-team/ss14-wl Length of output: 1642 🏁 Script executed: #!/bin/bash
# Search for _confederations initialization and usage
echo "=== _confederations initialization ==="
rg "_confederations\s*=" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -B 2 -A 2
echo -e "\n=== _confederationButton initialization ==="
rg "_confederationButton\s*=" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -B 2 -A 2
echo -e "\n=== OptionButton class/type check ==="
rg "OptionButton" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -B 1 -A 1 | head -30Repository: corvax-team/ss14-wl Length of output: 862 🏁 Script executed: #!/bin/bash
# Look at the SetConfederation method and surrounding context
echo "=== SetConfederation method ==="
rg "SetConfederation" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -B 2 -A 10
echo -e "\n=== OptionButton definition/API ==="
fd -t f "OptionButton" --extension cs | head -5Repository: corvax-team/ss14-wl Length of output: 1082 🏁 Script executed: #!/bin/bash
# Find and examine OptionButton class
cat -n Content.Client/Stylesheets/Sheetlets/OptionButtonSheetlet.cs | head -100Repository: corvax-team/ss14-wl Length of output: 1442 🏁 Script executed: #!/bin/bash
# Search for OptionButton class definition and methods
echo "=== Searching for OptionButton class ==="
rg "class OptionButton" --type cs
echo -e "\n=== Searching for SelectId method ==="
rg "SelectId\(" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -B 1 -A 3
echo -e "\n=== Searching for OptionButton methods in codebase ==="
rg "\.OptionButton\?\." Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -oRepository: corvax-team/ss14-wl Length of output: 2312 🏁 Script executed: #!/bin/bash
# Look at how other controls handle missing/no match scenarios
echo "=== UpdateGenders/UpdateSpecies patterns ==="
rg "UpdateGenders|UpdateSpecies|UpdateSex" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -A 8 | head -60
echo -e "\n=== Profile class to check Confederation property ==="
fd -t f "Profile\\.cs" | head -3Repository: corvax-team/ss14-wl Length of output: 1650 🏁 Script executed: #!/bin/bash
# Get the full UpdateSexControls method
echo "=== Full UpdateSexControls method ==="
rg "private void UpdateSexControls" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -A 20
echo -e "\n=== Full UpdateGenderControls method ==="
rg "private void UpdateGenderControls" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -A 15
echo -e "\n=== Check Confederation property in Profile ==="
rg "Confederation" Content.Shared/Preferences/HumanoidCharacterProfile.cs -B 2 -A 2Repository: corvax-team/ss14-wl Length of output: 3062 🏁 Script executed: #!/bin/bash
# Search for how Clear() is used with option buttons
echo "=== Clear() usage with buttons ==="
rg "Button\.Clear\(\)" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs -B 2 -A 2
echo -e "\n=== Check if confederation can be empty in practice ==="
rg "Profile\.Confederation|WithConfederation" Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs | head -20Repository: corvax-team/ss14-wl Length of output: 443 Reset confederation selection when profile value is empty or unmatched. The current logic persists previous selection when Note: The suggested diff in the original comment assumes index 0 is a "None/—" entry, but 🔧 Corrected approach if (_confederationButton != null)
- for (var i = 0; i < _confederations.Count; i++)
+ {
+ var idx = _confederations.FindIndex(c =>
+ string.Equals(Profile?.Confederation, c, StringComparison.CurrentCultureIgnoreCase));
+
+ if (idx >= 0)
+ _confederationButton.SelectId(idx);
+ else
+ _confederationButton.Clear();
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // WL-Records-End | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| using Content.Shared.StationRecords; | ||
| using Content.Shared._WL.Languages; | ||
| using Content.Shared._WL.Records; // WL-Records | ||
| using Content.Shared.Humanoid.Prototypes; | ||
| using Content.Shared.StationRecords; | ||
| using Robust.Client.AutoGenerated; | ||
| using Robust.Client.UserInterface; | ||
| using Robust.Client.UserInterface.XAML; | ||
|
|
@@ -22,9 +24,39 @@ public GeneralRecord(GeneralStationRecord record, bool canDelete, uint? id, IPro | |
| // Species.Text = Loc.GetString("general-station-record-console-record-species", ("species", record.Species)); | ||
| // Gender.Text = Loc.GetString("general-station-record-console-record-gender", | ||
| // ("gender", record.Gender.ToString())); | ||
| Record.Text = !string.IsNullOrEmpty(record.EmploymentRecord) | ||
| ? record.EmploymentRecord | ||
| : Loc.GetString("general-station-console-no-employment-record"); | ||
|
|
||
| var confederation = string.Empty; | ||
|
|
||
| if (prototypeManager.TryIndex<ConfederationRecordsPrototype>(record.Confederation, out var proto)) | ||
| confederation = Loc.GetString(proto.Name); | ||
| else | ||
| confederation = Loc.GetString("generic-not-available-shorthand"); | ||
|
|
||
| string languages = string.Empty; | ||
|
|
||
| for (int i = 0; i < record.Languages.Count; i++) | ||
| { | ||
| languages += Loc.GetString(prototypeManager.Index<LanguagePrototype>(record.Languages[i]).Name); | ||
|
|
||
| if (i != record.Languages.Count - 1) | ||
| languages += ", "; | ||
| else | ||
| languages += "."; | ||
| } | ||
|
Comment on lines
+37
to
+45
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The loop assumes all language IDs in 🛡️ Proposed fix string languages = string.Empty;
for (int i = 0; i < record.Languages.Count; i++)
{
- languages += Loc.GetString(prototypeManager.Index<LanguagePrototype>(record.Languages[i]).Name);
+ if (!prototypeManager.TryIndex<LanguagePrototype>(record.Languages[i], out var langProto))
+ continue;
+
+ if (languages.Length > 0)
+ languages += ", ";
+ languages += Loc.GetString(langProto.Name);
+ }
- if (i != record.Languages.Count - 1)
- languages += ", ";
- else
- languages += ".";
- }
+ if (languages.Length > 0)
+ languages += ".";
+ else
+ languages = Loc.GetString("generic-not-available-shorthand");🤖 Prompt for AI Agents |
||
|
|
||
| Record.Text = $""" | ||
| {Loc.GetString("records-full-name-edit")} {(!string.IsNullOrEmpty(record.Fullname) | ||
| ? record.Fullname : record.Name)} | ||
| {Loc.GetString("records-date-of-birth-edit")} {(!string.IsNullOrEmpty(record.DateOfBirth) | ||
| ? record.DateOfBirth : Loc.GetString("generic-not-available-shorthand"))} | ||
| {Loc.GetString("records-confederation-edit")} {confederation} | ||
| {Loc.GetString("records-country-edit")} {(!string.IsNullOrEmpty(record.Country) | ||
| ? record.Country : Loc.GetString("generic-not-available-shorthand"))} | ||
| {Loc.GetString("records-species")} {Loc.GetString(prototypeManager.Index<SpeciesPrototype>(record.Species).Name)} | ||
| {Loc.GetString("records-language")} {languages} | ||
| {(!string.IsNullOrEmpty(record.EmploymentRecord) ? record.EmploymentRecord | ||
| : Loc.GetString("general-station-console-no-employment-record"))} | ||
| """; | ||
| // WL-Records-Edit-End | ||
| Fingerprint.Text = Loc.GetString("general-station-record-console-record-fingerprint", | ||
| ("fingerprint", record.Fingerprint ?? Loc.GetString("generic-not-available-shorthand"))); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_proto.Index<SpeciesPrototype>can throw ifrecord.Speciesis invalid.The confederation lookup defensively uses
TryIndex, but the species lookup usesIndexdirectly, which will throw ifrecord.Speciescontains an invalid prototype ID. This is inconsistent with the defensive pattern used a few lines above.🛡️ Proposed fix — use TryIndex for species lookup
📝 Committable suggestion
🤖 Prompt for AI Agents