Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f6aaeeb
Update RetakesAllocator.cs
Micka2302 Apr 1, 2025
4bb7783
Update AdvancedGunMenu.cs
Micka2302 Apr 1, 2025
faca5bc
Merge branch 'yonilerner:main' into main
Micka2302 Sep 19, 2025
01c1da1
Treat SSG08 as preferred weapon
Micka2302 Sep 19, 2025
a680303
Merge pull request #1 from Micka2302/codex/update-weapon-allocation-f…
Micka2302 Sep 19, 2025
ce49905
Merge pull request #3 from Micka2302/dev
Micka2302 Sep 19, 2025
8850aaf
Rename preferred weapon configuration to AWP
Micka2302 Sep 19, 2025
f770043
Merge pull request #5 from Micka2302/codex/rename-preferredweapon-to-…
Micka2302 Sep 19, 2025
901db5e
Merge pull request #6 from Micka2302/dev2
Micka2302 Sep 19, 2025
0f10864
Add SSG queue configuration and tests
Micka2302 Sep 19, 2025
b9838d0
Merge pull request #7 from Micka2302/codex/enhance-ssg-weapon-support…
Micka2302 Sep 19, 2025
2826d8a
Merge pull request #8 from Micka2302/dev-ssg08
Micka2302 Sep 19, 2025
439a27c
Update README.md
Micka2302 Sep 20, 2025
5a94ca0
Add EnableAllWeaponForEveryone option
Micka2302 Sep 27, 2025
2532dcd
Merge pull request #11 from Micka2302/dev
Micka2302 Sep 27, 2025
819a1a0
!guns menu rework
Micka2302 Sep 27, 2025
1855b91
Rework with Kitsune menu
Micka2302 Sep 27, 2025
662eabc
Update en.json
Micka2302 Sep 27, 2025
ce50dde
Update menu for vip player
Micka2302 Sep 27, 2025
7b7b929
Add Random option for Sniper Preference
Micka2302 Sep 30, 2025
831d889
Add !zeus command like !awp or !ssg
Micka2302 Sep 30, 2025
0b79426
Merge pull request #12 from Micka2302/dev
Micka2302 Sep 30, 2025
fbeac6c
Fix random give 2 awp on same team
Micka2302 Oct 11, 2025
a72f14b
Feat : Add EnemyStuff
Micka2302 Oct 11, 2025
0f38418
update
Micka2302 Oct 11, 2025
6968b29
Merge pull request #13 from Micka2302/dev
Micka2302 Oct 13, 2025
6bfb635
Zeus config update
Micka2302 Oct 24, 2025
8c2ddf0
Merge pull request #14 from Micka2302/dev
Micka2302 Oct 25, 2025
60612e6
ADD team choice for Enemy stuff (Not tested)
Micka2302 Nov 2, 2025
5144a85
Fix Mysql Crash, and updated Db
Micka2302 Nov 2, 2025
1dcd241
Update database SQL
Micka2302 Nov 4, 2025
aa2b9e9
Merge pull request #16 from Micka2302/dev
Micka2302 Nov 6, 2025
634cfde
Fix migration after first launch
Micka2302 Nov 9, 2025
7322a45
Delete .tools directory
Micka2302 Nov 9, 2025
077487f
Merge pull request #17 from Micka2302/dev
Micka2302 Nov 9, 2025
4235a82
Update ReadME
Micka2302 Nov 10, 2025
6b25047
Update 13/11/2025
Micka2302 Nov 13, 2025
9ebbf22
Merge branch 'dev' of https://github.com/Micka2302/cs2-retakes-alloca…
Micka2302 Nov 13, 2025
6503fa9
Merge pull request #18 from Micka2302/dev
Micka2302 Nov 13, 2025
41c2330
Update gamedata URL
Micka2302 Nov 13, 2025
494752e
Merge pull request #19 from Micka2302/dev
Micka2302 Nov 13, 2025
fbe6430
Refactor RetakesAllocator_gamedata.json structure
Micka2302 Nov 13, 2025
69300a6
Update RetakesAllocator_gamedata.json
Micka2302 Nov 13, 2025
778376b
Update RetakesAllocator.cs
Micka2302 Nov 13, 2025
aa0f938
Merge pull request #21 from Micka2302/dev
Micka2302 Nov 14, 2025
4044ae4
Update for Dathost database and fix error
Micka2302 Nov 14, 2025
912a2fb
Update README.md
Micka2302 Nov 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "9.0.9",
"commands": [
"dotnet-ef"
],
"rollForward": false
}
}
}
14 changes: 14 additions & 0 deletions MigrationRunner/MigrationRunner.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\RetakesAllocatorCore\RetakesAllocatorCore.csproj" />
</ItemGroup>

</Project>
27 changes: 27 additions & 0 deletions MigrationRunner/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using RetakesAllocatorCore.Config;
using RetakesAllocatorCore.Db;

var config = new ConfigData
{
DatabaseProvider = DatabaseProvider.MySql,
DatabaseConnectionString = "Server=127.0.0.1;Port=3307;Database=cs2allocator_test;Uid=root;Pwd=;",
MigrateOnStartup = true,
};

Configs.OverrideConfigDataForTests(config);

try
{
Console.WriteLine("Running migrations...");
Queries.Migrate();
Console.WriteLine("Migrations completed.");
}
catch (Exception ex)
{
Console.WriteLine("Migration failed:");
Console.WriteLine(ex);
}
finally
{
Queries.Disconnect();
}
51 changes: 35 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# CS2 Retakes Allocator

[![Build RetakesAllocator.zip](https://github.com/yonilerner/cs2-retakes-allocator/actions/workflows/build.yml/badge.svg)](https://github.com/yonilerner/cs2-retakes-allocator/actions/workflows/build.yml)
# CS2 Retakes Allocator

## Retakes

Expand All @@ -10,7 +8,7 @@ This plugin is made to run alongside B3none's retakes implementation: https://gi

- Ensure you have https://github.com/b3none/cs2-retakes installed already
- Update the `RetakesPlugin` config to have `EnableFallbackAllocation` disabled
- Download a release from https://github.com/yonilerner/cs2-retakes-allocator/releases
- Download a release from https://github.com/Micka2302/cs2-retakes-allocator-2.0
- Extract the zip archive and upload the `RetakesAllocator` plugin to your CounterStrikeSharp plugins folder on your
server
- Each build comes with two necessary runtimes for sqlite3, one for linux64 and one for win64. If you need a
Expand All @@ -36,7 +34,7 @@ This plugin relies on some function signatures that:
- Are not included in the default CS# signatures:
- `GiveNamedItem2`

Custom game data signatures are maintained in https://github.com/yonilerner/cs2-retakes-allocator/blob/main/Resources/RetakesAllocator_gamedata.json. There are a few ways to keep these up to date on your server:
Custom game data signatures are maintained in https://github.com/Micka2302/cs2-retakes-allocator-2.0/blob/main/Resources/RetakesAllocator_gamedata.json. There are a few ways to keep these up to date on your server:
- If you want the plugin to automatically download the signatures, you can do so by running the plugin with the `AutoUpdateSignatures` config set to `true`. **This is the recommended approach**. See more below in the "Configuration" section.
- If you want to manually download the signatures, you can do so by downloading the `RetakesAllocator_gamedata.json` file from Github and placing it in the `RetakesAllocator/gamedata` folder in the plugin. You may have to create that folder if it does not exist.

Expand Down Expand Up @@ -69,17 +67,23 @@ There are a few different ways to set weapon preferences:

- Built-in buy menu (See "Buy Menu" section for more info on how to set that up)
- `!gun <gun>` - Set a preference for a particular gun (will automatically figure out the round type)
- `!awp` - Toggles if you want an AWP or not.
- `!awp` - Toggles if you want an AWP or not. (Fullbuy Rounds)
- `!ssg` - Toggle if you want SSG or not (Fullbuy Rounds)
- `!zeus` - Toggle whether you will receive a Zeus each round.
- `!guns` - Opens a chat-based menu for weapon preferences

See more info below about the commands in the "Commands" section.


#### AWP Queue

Currently one AWPer will be selected per team as long as at least one person on the team has chosen to get an AWP. AWP
queue features will be expanded over time, you can take a look at existing Github Issues to see what has been proposed
so far.

#### SSG Queue

Players who prefer the SSG (Scout) can also enter a dedicated queue. On full buy rounds the plugin will independently
roll for SSG availability, apply the SSG-specific limits and then merge the resulting list with any AWP picks before
weapons are allocated. See the configuration section below for the options that control the SSG queue.

### Buy Menu

If the convars are set to give players money and let them buy, player weapon choices can be selected via the buy menu.
Expand Down Expand Up @@ -169,12 +173,21 @@ Here are the weapon configs:
```


- `ZeusPreference`: Whether or not to give a Zeus. Options are `Always` or `Never`. Defaults to `Never`.
- `AllowPreferredWeaponForEveryone`: If `true`, everyone can get the AWP. This overrides every other "preferred" weapon
- `EnableZeusPreference`: Enables the Zeus toggle in the Kitsune loadout menu. When disabled, no one receives a Zeus and the menu entry is hidden. Defaults to `false`.
- `EnableEnemyStuffPreference`: Enables the enemy weapon toggle in the Kitsune loadout menu for players holding the configured permission flag. Players can enable enemy weapons separately for Terrorist, Counter-Terrorist, or both teams. Defaults to `false`.
- `EnemyStuffPermission`: Permission flag required to see and toggle enemy weapons when the feature is enabled. Defaults to `@css/vip`.
- `EnableAllWeaponsForEveryone`: When `true`, Counter-Terrorists and Terrorists can equip each other's primary and secondary weapons while VIP-restricted weapons keep their existing limits. Defaults to `false`.
- `AllowAwpWeaponForEveryone`: If `true`, everyone can get the AWP. This overrides every other "preferred" weapon
setting. Defaults to `false`.
- `MaxPreferredWeaponsPerTeam`: The maximum number of AWPs for each team.
- `MinPlayersPerTeamForPreferredWeapon`: The minimum number of players on each team necessary for someone to get an AWP.
- `ChanceForPreferredWeapon`: The % chance that the round will have an AWP.
- `AllowSsgWeaponForEveryone`: If `true`, everyone with an SSG preference can receive one. Defaults to `false`.
- `MaxAwpWeaponsPerTeam`: The maximum number of AWPs for each team.
- `MaxSsgWeaponsPerTeam`: The maximum number of SSGs for each team.
- `MinPlayersPerTeamForAwpWeapon`: The minimum number of players on each team necessary for someone to get an AWP.
- `MinPlayersPerTeamForSsgWeapon`: The minimum number of players on each team necessary for someone to get an SSG.
- `ChanceForAwpWeapon`: The % chance that the round will have an AWP.
- `ChanceForSsgWeapon`: The % chance that the round will have an SSG.
- `ChanceForEnemyStuff`: The % chance that a player who has enabled enemy weapons will receive gear from the opposing team.
- `MaxEnemyStuffPerTeam`: Maximum number of players per team who can receive enemy weapons each round. Set to `-1` for no limit.

#### Nade Configuration

Expand Down Expand Up @@ -267,7 +280,7 @@ room for it*.
#### Other Configuration

- `EnableNextRoundTypeVoting`: Whether to allow voting for the next round type via `!nextround`. `false` by default.
- `NumberOfExtraVipChancesForPreferredWeapon`: When randomly selecting preferred weapons per team (ie. "AWP queue"), how
- `NumberOfExtraVipChancesForAwpWeapon`: When randomly selecting AWPs per team (ie. "AWP queue"), how
many extra chances should VIPs get.
- The default is 1, meaning VIPs will get 1 extra chance. For example, lets say
there are 3 players on the team and this config is set to 1. Normally each person would have a 33% chance of
Expand All @@ -277,7 +290,11 @@ room for it*.
the other two players will each have 25% chance of getting the AWP.
- If you set this to 0, there will be no preference for VIPs.
- If you set this to -1, only VIPs can get the AWP
- `ChanceForPreferredWeapon`: This allows you to determine chance of players getting preferred weapon. (ie. 100 = %100, 50 = %50)
- `ChanceForAwpWeapon`: This allows you to determine chance of players getting the AWP. (ie. 100 = %100, 50 = %50)
- `NumberOfExtraVipChancesForSsgWeapon`: When randomly selecting SSGs per team, how many extra chances VIPs get.
- The behaviour matches the AWP queue. `1` gives VIPs an extra entry, `0` removes the bonus and `-1` restricts SSGs
to VIPs.
- `ChanceForSsgWeapon`: This allows you to determine the chance of players getting the SSG. (ie. 100 = %100, 50 = %50)
- `AllowedWeaponSelectionTypes`: The types of weapon allocation that are allowed.
- Choices:
- `PlayerChoice` - Allow players to choose their preferences for the round type
Expand Down Expand Up @@ -339,6 +356,7 @@ You can use the following commands to select specific weapon preferences per-use
Galil
- `!guns` - Opens up a chat-based menu for setting weapon preferences.
- `!awp` - Toggle whether or not you want to get an AWP.
- `!zeus` - Toggle whether you will receive a Zeus each round.
- `!removegun <weapon> [T|CT]` - Remove a preference for the chosen weapon for the team you are currently on, or T/CT if
provided
- For example, if you previously did `!gun galil` while a terrorist, and you do `!removegun galil` while a
Expand All @@ -358,3 +376,4 @@ Notes:

- Run the dedicated server
with `start cs2.exe -dedicated -insecure +game_type 0 +game_mode 0 +map de_dust2 +servercfgfile server.cfg`

8 changes: 5 additions & 3 deletions Resources/RetakesAllocator_gamedata.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"GetCSWeaponDataFromKey": {
"signatures": {
"library": "server",
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 33 ED 48 8B FA 8B F1",
"linux": "55 31 D2 48 89 E5 53 89 FB"
"library": "server",
"windows": "48 89 5C 24 ? 57 48 83 EC ? 33 FF 4C 8B CA 8B D9",
"linux": "55 31 D2 48 89 E5 41 56 41 55 41 54"
}
},
"CCSPlayer_ItemServices_CanAcquire": {
Expand All @@ -23,3 +23,5 @@
}




24 changes: 23 additions & 1 deletion RetakesAllocator/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,28 @@ public static bool IsWindows()

public static bool IsVip(CCSPlayerController player) => AdminManager.PlayerHasPermissions(player, "@css/vip");

public static bool PlayerHasPermission(CCSPlayerController player, string? permission)
{
if (string.IsNullOrWhiteSpace(permission))
{
return false;
}

return AdminManager.PlayerHasPermissions(player, permission) ||
AdminManager.PlayerHasPermissions(player, "@css/root");
}

public static bool HasEnemyStuffPermission(CCSPlayerController player)
{
var permission = Configs.GetConfigData().EnemyStuffPermission;
if (string.IsNullOrWhiteSpace(permission))
{
return true;
}

return PlayerHasPermission(player, permission);
}

public static async Task<bool> DownloadMissingFiles()
{
if (!Configs.GetConfigData().AutoUpdateSignatures)
Expand All @@ -211,7 +233,7 @@ public static async Task<bool> DownloadMissingFiles()
string baseFolderPath = Configs.Shared.Module!;

string gamedataFileName = "gamedata/RetakesAllocator_gamedata.json";
string gamedataGithubUrl = "https://raw.githubusercontent.com/yonilerner/cs2-retakes-allocator/main/Resources/RetakesAllocator_gamedata.json";
string gamedataGithubUrl = "https://raw.githubusercontent.com/Micka2302/cs2-retakes-allocator-2.0/main/Resources/RetakesAllocator_gamedata.json";
string gamedataFilePath = Path.Combine(baseFolderPath, gamedataFileName);
string gamedataDirectoryPath = Path.GetDirectoryName(gamedataFilePath)!;

Expand Down
12 changes: 12 additions & 0 deletions RetakesAllocator/KitsuneMenu/Core/Enums/MenuTextSize.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace KitsuneMenu.Core.Enums;

public enum MenuTextSize
{
ExtraSmall, // fontSize-xs
Small, // fontSize-s
SmallMedium, // fontSize-sm
Medium, // fontSize-m
MediumLarge, // fontSize-ml
Large, // fontSize-l
ExtraLarge // fontSize-xl
}
Loading