Esempio n. 1
0
        public static Dictionary <string, string> split_config_player(string src)
        {
            var split = new ListMap <string, string>(Q3Utils.split_config(src));
            Dictionary <string, string> replaces = new Dictionary <string, string>();

            replaces.Add("n", "name");
            replaces.Add("dfn", "df_name");
            replaces.Add("t", "team");
            replaces.Add("c1", "color1");
            replaces.Add("c2", "color2");
            replaces.Add("hc", "maxHealth");
            replaces.Add("w", "wins");
            replaces.Add("l", "losses");
            replaces.Add("tt", "teamTask");
            replaces.Add("tl", "teamLeader");

            replaceKeys(split, replaces);
            var nameIndex = Ext.IndexOf(split, x => x.Key.ToLowerInvariant() == "name");

            if (nameIndex >= 0)
            {
                var    name          = split[nameIndex].Value;
                string unColoredName = removeColors(name);
                if (!name.Equals(unColoredName))
                {
                    split.Insert(nameIndex + 1, new KeyValuePair <string, string>("uncoloredName", unColoredName));
                }
            }

            Dictionary <string, string> res = split.ToDictionary();

            if (res.ContainsKey("team"))
            {
                int teamvalue;
                int.TryParse(res["team"], out teamvalue);
                if (teamvalue >= 0 && teamvalue < teamsFrendlyInfo.Length)
                {
                    res["team"] = teamsFrendlyInfo[teamvalue];
                }
            }
            return(res);
        }