Tigran %!s(int64=4) %!d(string=hai) anos
pai
achega
fe819ec547

+ 5 - 6
MafiaTelegramBot/Game/GameRooms/FastGameRoom.cs

@@ -47,6 +47,7 @@ namespace MafiaTelegramBot.Game.GameRooms
         {
             return await Task.Run(() =>
             {
+                Settings.Clear();
                 List<Roles> openedRoles = new();
                 foreach (var player in Players.Values)
                     openedRoles.ConcatenateUnique(player.OpenedRoles.ToList());
@@ -68,10 +69,9 @@ namespace MafiaTelegramBot.Game.GameRooms
                                 mafiaList.Remove(Roles.Don);
                                 break;
                         }
-                        Settings.Add(role, 1);
+                        Settings.AddUniqueByKey(role, 1);
                     }
-                    else if (Settings.ContainsKey(Roles.Mafia)) Settings[Roles.Mafia]++;
-                    else Settings.Add(Roles.Mafia, 1);
+                    else if (!Settings.AddUniqueByKey(Roles.Mafia, 1)) Settings[Roles.Mafia]++;
                 }
                 for (var i = 0; i < Players.Count - Players.Count / 3; ++i)
                 {
@@ -92,10 +92,9 @@ namespace MafiaTelegramBot.Game.GameRooms
                                 openedRoles.Remove(Roles.Journalist);
                                 break;
                         }
-                        Settings.Add(role, 1);
+                        Settings.AddUniqueByKey(role, 1);
                     }
-                    else if (Settings.ContainsKey(Roles.Villager)) Settings[Roles.Villager]++;
-                    else Settings.Add(Roles.Villager, 1);
+                    else if (!Settings.AddUniqueByKey(Roles.Villager, 1)) Settings[Roles.Villager]++;
                 }
                 return ResultCode.CodeOk;
             });

+ 1 - 2
MafiaTelegramBot/Models/Commands/StartCommand.cs

@@ -35,8 +35,7 @@ namespace MafiaTelegramBot.Models.Commands
 
         protected override bool IsMatches(string command)
         {
-            var commandPart = command.Split(' ')[0];
-            return base.IsMatches(commandPart);
+            return command.Contains(Name);
         }
 
         private async Task<Message> GiveawayCommand(Player player, int id)

+ 2 - 2
MafiaTelegramBot/Resources/Constants.cs

@@ -8,7 +8,7 @@ namespace MafiaTelegramBot.Resources
 {
     public static class Constants
     {
-        public const bool DEBUG = true;
+        public const bool DEBUG = false;
         
         public const int PLAYER_LIMITS_MIN = DEBUG ? 1 : 6;
         public const int MEMORY_CLEANER_INTERVAL = DEBUG ? 20 * 1000 : 30 * 60 * 1000;
@@ -21,7 +21,7 @@ namespace MafiaTelegramBot.Resources
         
         public const int ACTIVE_MAFIA_CHANCE = 30;
         public const int ACTIVE_VILLAGER_CHANCE = 50;
-        public const int PLAYERS_TO_START_FAST_GAME = DEBUG ? 5 : 10;
+        public const int PLAYERS_TO_START_FAST_GAME = DEBUG ? 7 : 10;
         
         public const string SHOP_CURRENCY = "RUB";
         public static List<LabeledPrice> RANDOM_ROLE_PRICE = new()