コード例 #1
0
        void tas_BattleUserJoined(object sender, TasEventArgs e)
        {
            string name = e.ServerParams[0];
            string welc = config.Welcome;

            if (welc != "")
            {
                welc = welc.Replace("%1", name);
                welc = welc.Replace("%2", GetUserLevel(name).ToString());
                welc = welc.Replace("%3", MainConfig.SpringieVersion);
                SayBattle(welc);
            }
            if (config.DisplayMapLink)
            {
                SayBattle("maplink: " + linker.GetMapBounceLink(tas.GetBattle().Map.Name));
            }

            HandleKickSpecServerLocking();
            HandleAutoLocking();

            if (minCpuSpeed > 0)
            {
                User u;
                if (tas.GetExistingUser(name, out u))
                {
                    if (u.cpu != 0 && u.cpu < minCpuSpeed * 1000)
                    {
                        System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                        SayBattle(name + ", your CPU speed is below minimum set for this server:" + minCpuSpeed + "GHz - sorry");
                        ComKick(TasSayEventArgs.Default, new string[] { u.name });
                    }
                }
            }
        }
コード例 #2
0
 void CheckForBattleExit()
 {
     if ((DateTime.Now - spring.GameStarted) > TimeSpan.FromSeconds(20))
     {
         /*if (spring.IsRunning && !spring.IsBattleOver)
          * { // don't exit here if game is already over; leave it to the timed exit thread in spring_GameOver
          *  Battle b = tas.MyBattle;
          *  int count = 0;
          *  foreach (UserBattleStatus p in b.Users) {
          *      if (p.IsSpectator) continue;
          *
          *      User u;
          *      if (!tas.GetExistingUser(p.Name, out u)) continue;
          *      if (u.IsInGame) count++;
          *  }
          *  if (count < 1) {
          *      SayBattle("closing game, " + count + " active player left in game");
          *      spring.ExitGame();
          *  }
          * }*/
         // kontrola pro pripad ze by se nevypl spring
         User us;
         if (!spring.IsRunning && tas.GetExistingUser(tas.UserName, out us) && us.IsInGame)
         {
             tas.ChangeMyUserStatus(false, false);
         }
     }
 }
コード例 #3
0
        void CheckForBattleExit()
        {
            if (spring.IsRunning && (DateTime.Now - spring.GameStarted) > TimeSpan.FromSeconds(20))
            {
                TasClient.Battle b = tas.GetBattle();
                int count          = 0;
                foreach (TasClient.UserBattleStatus p in b.Users)
                {
                    if (p.IsSpectator)
                    {
                        continue;
                    }

                    TasClient.User u;
                    if (!tas.GetExistingUser(p.name, out u))
                    {
                        continue;
                    }
                    if (u.isInGame)
                    {
                        count++;
                    }
                }
                if (count < 1)
                {
                    tas.Say(TasClient.SayPlace.Battle, "", "closing game, " + count + " active player left in game", true);
                    spring.ExitGame();
                }
            }
        }
コード例 #4
0
        public int GetUserLevel(string name)
        {
            foreach (var pu in config.PrivilegedUsers)
            {
                if (pu.Name == name)
                {
                    return(pu.Level);
                }
            }
            User u;

            if (tas.GetExistingUser(name, out u))
            {
                if (u.isAdmin)
                {
                    return(config.DefaulRightsLevelForLobbyAdmins);
                }
            }
            return(config.DefaulRightsLevel);
        }
コード例 #5
0
 private void HandleMinRankKicking()
 {
     if (kickMinRank && config.MinRank > 0)
     {
         Battle b = tas.GetBattle();
         if (b != null)
         {
             foreach (UserBattleStatus u in b.Users)
             {
                 User x;
                 tas.GetExistingUser(u.name, out x);
                 if (u.name != tas.UserName && x.rank < config.MinRank)
                 {
                     SayBattle(x.name + ", your rank is too low, rank kicking is enabled here");
                     ComKick(TasSayEventArgs.Default, new string[] { u.name });
                 }
             }
         }
     }
 }