1.6.6a
```diff + Reapply gravity/speed with timer + Added shake effect for slap + Fixed css_gravity and css_speed command + Fixed css_give command, for example weapon_knife returns weapon_knife instead of weapon_knife and weapon_knife_t + Small code improvements ```
This commit is contained in:
parent
82b82722a6
commit
7a69c5387a
12 changed files with 240 additions and 89 deletions
|
|
@ -690,11 +690,30 @@ public static class WeaponHelper
|
|||
|
||||
public static List<(string EnumMemberValue, CsItem EnumValue)> GetWeaponsByPartialName(string input)
|
||||
{
|
||||
// Normalize input for case-insensitive comparison
|
||||
var normalizedInput = input.ToLowerInvariant();
|
||||
|
||||
// Find all matching weapons based on the input
|
||||
var matchingWeapons = WeaponsEnumCache.Value
|
||||
.Where(kvp => kvp.Key.Contains(input))
|
||||
.Select(kvp => (kvp.Key, kvp.Value))
|
||||
.Where(kvp => kvp.Key.Contains(normalizedInput, StringComparison.InvariantCultureIgnoreCase))
|
||||
.Select(kvp => (EnumMemberValue: kvp.Key, EnumValue: kvp.Value))
|
||||
.ToList();
|
||||
|
||||
return matchingWeapons;
|
||||
// Check for an exact match first
|
||||
var exactMatch = matchingWeapons
|
||||
.FirstOrDefault(m => m.EnumMemberValue.Equals(input, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (exactMatch.EnumMemberValue != null)
|
||||
{
|
||||
// Return a list containing only the exact match
|
||||
return [exactMatch];
|
||||
}
|
||||
|
||||
// If no exact match, get all matches that start with the input
|
||||
var filteredWeapons = matchingWeapons
|
||||
.Where(m => m.EnumMemberValue.StartsWith(normalizedInput, StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
|
||||
return filteredWeapons; // Return all relevant matches for the partial input
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue