예제 #1
0
        public TeamNamesDisplayLegend(KillDisplayColours legendType, Dictionary<int, Color> dicTeamColours, CLocalization language, CMap mapDetails)
        {
            this.TeamNamesText = new MapTextBlock();
            this.LegendType = legendType;

            if (legendType == KillDisplayColours.TeamColours) {

                foreach (CTeamName teamName in mapDetails.TeamNames) {
                    if (teamName.TeamID > 0 && dicTeamColours.ContainsKey(teamName.TeamID)) {
                        this.TeamNamesText.Strings.Add(new MapTextBlockString(language.GetLocalized(teamName.LocalizationKey), ControlPaint.LightLight(dicTeamColours[teamName.TeamID]), true));
                    }
                }
            }
            else {
                this.TeamNamesText.Strings.Add(new MapTextBlockString("Killer", Color.LightSeaGreen, true));
                this.TeamNamesText.Strings.Add(new MapTextBlockString("Victim", ControlPaint.Light(Color.Red), true));
            }
        }
예제 #2
0
        // BFBC2 only
        // on round start we reset some of the ProconRulz counts
        // (e.g. # times players have triggered rules)
        // the only subtlety is the rules haven't changed so we can keep those,
        // and hence keep the list of 'watched' items
        // the 'Rates' counts (Rate 5 10) as of v32 continue past round/map change transitions...
        public override void OnLoadingLevel(string strMapFileName, int roundsPlayed, int roundsTotal)
        {
            // EVENT EXCEPTION BLOCK:
            try
            {
                WriteDebugInfo("ProconRulz: *******************OnLoadingLevel*****************************" +
                    strMapFileName);
                rulz_enable = true;
                current_map = this.GetMapByFilename(strMapFileName);
                current_map_mode = current_map.GameMode;

                // empty the rulz vars
                rulz_vars.reset();

                zero_counts();
                clear_blocks();
                // remove players no longer on the server from the rates counts
                scrub_rates(players.list_players());
                // exec listPlayers to initialise players global
                ExecuteCommand("procon.protected.send", "admin.listPlayers", "all");
                load_reserved_slot_players();
                // initialise ProconRulz On Init vars
                OnInit();
                // check rules for On Round trigger
                scan_rules(TriggerEnum.Round, null, new Dictionary<SubstEnum, string>(), null, null, null);
            }
            catch (Exception ex)
            {
                WriteConsole("ProconRulz: recoverable exception in OnLoadingLevel");
                PrintException(ex);
            }
        }
예제 #3
0
 public void OnCurrentLevel(string strMapFileName)
 {
     // EVENT EXCEPTION BLOCK:
     try
     {
     WriteDebugInfo("ProconRulz: *******************OnCurrentLevel*****************************" +
         strMapFileName);
     current_map = this.GetMapByFilename(strMapFileName);
     current_map_mode = current_map.GameMode;
     }
     catch (Exception ex)
     {
         WriteConsole("ProconRulz: recoverable exception in OnCurrentLevel");
         PrintException(ex);
     }
 }
예제 #4
0
 public virtual void OnServerInfo(CServerInfo serverInfo)
 {
     List<TeamScore> scores = new List<TeamScore>(); // number of tickets remaining per team
     // EVENT EXCEPTION BLOCK:
     try
     {
         WriteDebugInfo("ProconRulz: *******************OnServerInfo*****************************");
         current_map = this.GetMapByFilename(serverInfo.Map);
         current_map_mode = serverInfo.GameMode;
         if (serverInfo.TeamScores != null)
         {
             // set up team score variables %server_team_score[1]%, %server_team_score[2]% ...
             foreach (TeamScore t in serverInfo.TeamScores)
             {
                 if (t.TeamID == null || t.Score == null)
                 {
                     WriteConsole(String.Format("ProconRulz: OnServerInfo TeamID,Score error [{0}][{1}]", t.TeamID, t.Score));
                     break;
                 }
                 string var_name = "%server_team_score[" + t.TeamID.ToString() + "]%";
                 rulz_vars.set_value(null, var_name, t.Score.ToString(), null);
             }
         }
     }
     catch (Exception ex)
     {
         WriteConsole("ProconRulz: recoverable exception in OnServerInfo");
         PrintException(ex);
     }
 }