Example #1
0
        public string heroIDtoName(string s)
        {
            switch (s)
            {
            case "HERO_05": return("hunter");

            case "HERO_05a": return("hunter");

            case "HERO_09": return("priest");

            case "HERO_09a": return("priest");

            case "HERO_06": return("druid");

            case "HERO_07": return("warlock");

            case "HERO_03": return("thief");

            case "HERO_04": return("pala");

            case "HERO_04a": return("pala");

            case "HERO_01": return("warrior");

            case "HERO_01a": return("warrior");

            case "HERO_02": return("shaman");

            case "HERO_02a": return("shaman");

            case "HERO_08": return("mage");

            case "HERO_08a": return("mage");

            case "HERO_08b": return("mage");

            case "EX1_323h": return("lordjaraxxus");

            case "BRM_027h": return("ragnarosthefirelord");

            default:
                string retval = cdb.getCardDataFromID(cdb.cardIdstringToEnum(s)).name.ToString();
                return(retval);
            }
        }
Example #2
0
        public void readCombos(string behavName)
        {
            if (!Silverfish.Instance.BehaviorPath.ContainsKey(behavName))
            {
                help.ErrorLog(behavName + ": no special combos.");
                return;
            }

            string pathToCombo = Path.Combine(Silverfish.Instance.BehaviorPath[behavName], "_combo.txt");

            if (!System.IO.File.Exists(pathToCombo))
            {
                help.ErrorLog(behavName + ": no special combos.");
                return;
            }

            help.ErrorLog("[Combo] Load combos for " + behavName);
            string[] lines = new string[0] {
            };
            combos.Clear();
            playByValue.Clear();
            try
            {
                lines = System.IO.File.ReadAllLines(pathToCombo);
            }
            catch
            {
                help.logg("cant find _combo.txt");
                help.ErrorLog("cant find _combo.txt (if you dont created your own combos, ignore this message)");
                return;
            }
            help.logg("read _combo.txt...");
            help.ErrorLog("read _combo.txt...");
            foreach (string line in lines)
            {
                if (line == "" || line == null)
                {
                    continue;
                }
                if (line.StartsWith("//"))
                {
                    continue;
                }
                if (line.Contains("weapon:"))
                {
                    try
                    {
                        this.attackFaceHP = Convert.ToInt32(line.Replace("weapon:", ""));
                    }
                    catch
                    {
                        help.logg("combomaker cant read: " + line);
                        help.ErrorLog("combomaker cant read: " + line);
                    }
                }
                else
                {
                    if (line.Contains("cardvalue:"))
                    {
                        try
                        {
                            string            cardvalue = line.Replace("cardvalue:", "");
                            CardDB.cardIDEnum ce        = cdb.cardIdstringToEnum(cardvalue.Split(',')[0]);
                            int val = Convert.ToInt32(cardvalue.Split(',')[1]);
                            if (this.playByValue.ContainsKey(ce))
                            {
                                continue;
                            }
                            this.playByValue.Add(ce, val);
                            //help.ErrorLog("adding: " + line);
                        }
                        catch
                        {
                            help.logg("combomaker cant read: " + line);
                            help.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                    else
                    {
                        try
                        {
                            combo c = new combo(line);
                            this.combos.Add(c);
                        }
                        catch
                        {
                            help.logg("combomaker cant read: " + line);
                            help.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                }
            }
            help.ErrorLog("[Combo] " + combos.Count + " combos loaded successfully, " + playByValue.Count + " values loaded successfully");
        }
Example #3
0
        public void loadCards(string path)
        {
            try
            {
                this.settings = System.IO.File.ReadAllText(path + "simsettings.txt");
            }
            catch
            {
                this.settings = "control 5000 face 15 twoturnsim 1000 ntss 6 20 200 ets 40 ets2 200 ents 40 plcmnt";
            }

            string data = System.IO.File.ReadAllText(path + "deck.txt");
            int    i    = 0;

            foreach (String ss in data.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries))
            {
                String s = ss;
                if (s.Contains(" "))
                {
                    s = s.Split(' ')[0];
                }
                if (s.Contains("/"))
                {
                    s = s.Split('/')[0];
                }
                if (s.Contains(";"))
                {
                    s = s.Split(';')[0];
                }
                //Console.WriteLine("read: " + s);
                if (i == 0)
                {
                    //hero:

                    this.hero     = Hrtprozis.Instance.heroNametoEnum(s);
                    this.heroname = s;
                    Console.WriteLine("heroname: " + s);
                    CardDB.cardIDEnum arbilityenum = CardDB.cardIDEnum.CS2_102;
                    if (this.hero == HeroEnum.druid)
                    {
                        arbilityenum = CardDB.cardIDEnum.CS2_017;
                    }
                    if (this.hero == HeroEnum.hunter)
                    {
                        arbilityenum = CardDB.cardIDEnum.DS1h_292;
                    }
                    if (this.hero == HeroEnum.lordjaraxxus)
                    {
                        arbilityenum = CardDB.cardIDEnum.EX1_tk33;
                    }
                    if (this.hero == HeroEnum.mage)
                    {
                        arbilityenum = CardDB.cardIDEnum.CS2_034;
                    }
                    if (this.hero == HeroEnum.pala)
                    {
                        arbilityenum = CardDB.cardIDEnum.CS2_101;
                    }
                    if (this.hero == HeroEnum.priest)
                    {
                        arbilityenum = CardDB.cardIDEnum.CS1h_001;
                    }
                    if (this.hero == HeroEnum.ragnarosthefirelord)
                    {
                        arbilityenum = CardDB.cardIDEnum.BRM_027p;
                    }
                    if (this.hero == HeroEnum.shaman)
                    {
                        arbilityenum = CardDB.cardIDEnum.CS2_049;
                    }
                    if (this.hero == HeroEnum.thief)
                    {
                        arbilityenum = CardDB.cardIDEnum.CS2_083b;
                    }
                    if (this.hero == HeroEnum.warlock)
                    {
                        arbilityenum = CardDB.cardIDEnum.CS2_056;
                    }
                    if (this.hero == HeroEnum.warrior)
                    {
                        arbilityenum = CardDB.cardIDEnum.CS2_102;
                    }


                    this.heroAbility = CardDB.Instance.getCardDataFromID(arbilityenum);
                }
                else
                {
                    usedCards.Add(cdb.cardIdstringToEnum(s));
                }
                i++;
            }

            if (this.usedCards.Count != 30)
            {
                Console.WriteLine("ERROR, deck contains not 30 cards");
            }
            foreach (CardDB.cardIDEnum cie in usedCards)
            {
                //Console.WriteLine(cie.ToString() + "");
            }
        }
Example #4
0
        public void ReadCombos(string behavName, bool nameIsPath = false)
        {
            string pathToCombo = behavName;

            if (!nameIsPath)
            {
                if (!SilverFishBot.Instance.BehaviorPath.ContainsKey(behavName))
                {
                    help.ErrorLog(behavName + ": no special combos.");
                    return;
                }
                pathToCombo = Path.Combine(SilverFishBot.Instance.BehaviorPath[behavName], "_combo.txt");
            }

            if (!File.Exists(pathToCombo))
            {
                help.InfoLog(behavName + ": no special combos.");
                return;
            }

            help.InfoLog($"[Combo] Load combos for {behavName}");
            string[] lines = new string[0] {
            };
            combos.Clear();
            playByValue.Clear();
            try
            {
                lines = File.ReadAllLines(pathToCombo);
            }
            catch (Exception ex)
            {
                LogHelper.WriteCombatLog("cant find _combo.txt");
                help.ErrorLog(ex);
                help.ErrorLog("cant find _combo.txt (if you don't created your own combos, ignore this message)");
                return;
            }
            help.InfoLog("read _combo.txt...");
            foreach (string line in lines)
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }
                if (line.StartsWith("//"))
                {
                    continue;
                }
                if (line.Contains("weapon:"))
                {
                    try
                    {
                        this.attackFaceHP = Convert.ToInt32(line.Replace("weapon:", ""));
                    }
                    catch (Exception ex)
                    {
                        LogHelper.WriteCombatLog("combomaker cant read: " + line);
                        help.ErrorLog(ex);
                        help.ErrorLog("combomaker cant read: " + line);
                    }
                }
                else
                {
                    if (line.Contains("cardvalue:"))
                    {
                        try
                        {
                            string            cardvalue = line.Replace("cardvalue:", "");
                            CardDB.cardIDEnum ce        = cdb.cardIdstringToEnum(cardvalue.Split(',')[0]);
                            int val = Convert.ToInt32(cardvalue.Split(',')[1]);
                            if (this.playByValue.ContainsKey(ce))
                            {
                                continue;
                            }
                            this.playByValue.Add(ce, val);
                            //help.ErrorLog("adding: " + line);
                        }
                        catch (Exception ex)
                        {
                            LogHelper.WriteCombatLog("combomaker cant read: " + line);
                            help.ErrorLog(ex);
                            help.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                    else
                    {
                        try
                        {
                            combo c = new combo(line);
                            this.combos.Add(c);
                        }
                        catch (Exception ex)
                        {
                            LogHelper.WriteCombatLog("combomaker cant read: " + line);
                            help.ErrorLog(ex);
                            help.ErrorLog("combomaker cant read: " + line);
                        }
                    }
                }
            }
            help.InfoLog("[Combo] " + combos.Count + " combos loaded successfully, " + playByValue.Count + " values loaded successfully");
        }
Example #5
0
        public void readCombos(string behavName, bool nameIsPath = false)
        {
            string pathToCombo = behavName;

            if (!nameIsPath)
            {
                if (!Silverfish.Instance.BehaviorPath.ContainsKey(behavName))
                {
                    help.ErrorLog(behavName + ": 没有特定的“连招”.");
                    return;
                }
                pathToCombo = Path.Combine(Silverfish.Instance.BehaviorPath[behavName], "_combo.txt");
            }

            if (!System.IO.File.Exists(pathToCombo))
            {
                help.ErrorLog(behavName + ": 没有特定的“连招”.");
                return;
            }

            help.ErrorLog("[连招功能] 成功加载“连招” " + behavName);
            string[] lines = new string[0] {
            };
            combos.Clear();
            playByValue.Clear();
            try
            {
                lines = System.IO.File.ReadAllLines(pathToCombo);
            }
            catch
            {
                help.logg("没有发现“连招功能”文本 _combo.txt");
                help.ErrorLog("“连招功能”文本 _combo.txt ");
                return;
            }
            help.logg("加载“连招功能”文本 _combo.txt...");
            help.ErrorLog("加载“连招功能”文本 _combo.txt...");
            foreach (string line in lines)
            {
                if (line == "" || line == null)
                {
                    continue;
                }
                if (line.StartsWith("//"))
                {
                    continue;
                }
                if (line.Contains("weapon:"))
                {
                    try
                    {
                        this.attackFaceHP = Convert.ToInt32(line.Replace("weapon:", ""));
                    }
                    catch
                    {
                        help.logg("[连招功能]不能加载: " + line);
                        help.ErrorLog("[连招功能]不能加载: " + line);
                    }
                }
                else
                {
                    if (line.Contains("cardvalue:"))
                    {
                        try
                        {
                            string            cardvalue = line.Replace("cardvalue:", "");
                            CardDB.cardIDEnum ce        = cdb.cardIdstringToEnum(cardvalue.Split(',')[0]);
                            int val = Convert.ToInt32(cardvalue.Split(',')[1]);
                            if (this.playByValue.ContainsKey(ce))
                            {
                                continue;
                            }
                            this.playByValue.Add(ce, val);
                            //help.ErrorLog("adding: " + line);
                        }
                        catch
                        {
                            help.logg("[连招功能]不能加载: " + line);
                            help.ErrorLog("[连招功能]不能加载: " + line);
                        }
                    }
                    else
                    {
                        try
                        {
                            combo c = new combo(line);
                            this.combos.Add(c);
                        }
                        catch
                        {
                            help.logg("[连招功能]不能加载: " + line);
                            help.ErrorLog("[连招功能]不能加载: " + line);
                        }
                    }
                }
            }
            help.ErrorLog("[连招功能] " + combos.Count + " “连招”功能激活成功, " + playByValue.Count + " 个权重值已加载");
        }
Example #6
0
        public string heroIDtoName(string s)
        {
            switch (s)
            {
            case "HERO_01": return("warrior");

            case "HERO_01a": return("warrior");

            case "HERO_01b": return("warrior");

            case "HERO_01c": return("warrior");

            case "ICC_834": return("warrior");

            case "BOT_238": return("warrior");

            case "DRG_650": return("warrior");

            case "DRG_650t2": return("warrior");

            case "DRG_650t3": return("warrior");

            case "HERO_02": return("shaman");

            case "HERO_02a": return("shaman");

            case "HERO_02b": return("shaman");

            case "HERO_02c": return("shaman");

            case "HERO_02d": return("shaman");

            case "HERO_02e": return("shaman");

            case "ICC_481": return("shaman");

            case "GIL_504": return("shaman");

            case "DRG_620": return("shaman");

            case "DRG_620t2": return("shaman");

            case "DRG_620t3": return("shaman");

            case "HERO_03": return("thief");

            case "HERO_03a": return("thief");

            case "HERO_03b": return("thief");

            case "ICC_827": return("thief");

            case "DRG_610": return("thief");

            case "DRG_610t2": return("thief");

            case "DRG_610t3": return("thief");

            case "HERO_04": return("pala");

            case "HERO_04a": return("pala");

            case "HERO_04b": return("pala");

            case "HERO_04c": return("pala");

            case "HERO_04d": return("pala");

            case "ICC_829": return("pala");

            case "HERO_05": return("hunter");

            case "HERO_05a": return("hunter");

            case "HERO_05b": return("hunter");

            case "HERO_05c": return("hunter");

            case "ICC_828": return("hunter");

            case "TRL_065": return("hunter");

            case "HERO_06": return("druid");

            case "HERO_06a": return("druid");

            case "HERO_06b": return("druid");

            case "HERO_06c": return("druid");

            case "HERO_06d": return("druid");

            case "ICC_832": return("druid");

            case "HERO_07": return("warlock");

            case "HERO_07a": return("warlock");

            case "HERO_07b": return("warlock");

            case "HERO_07c": return("warlock");

            case "ICC_831": return("warlock");

            case "DRG_600": return("warlock");

            case "DRG_600t2": return("warlock");

            case "DRG_600t3": return("warlock");

            case "HERO_08": return("mage");

            case "HERO_08a": return("mage");

            case "HERO_08b": return("mage");

            case "HERO_08c": return("mage");

            case "ICC_833": return("mage");

            case "YOD_009": return("mage");

            case "HERO_09": return("priest");

            case "HERO_09a": return("priest");

            case "HERO_09b": return("priest");

            case "HERO_09c": return("priest");

            case "ICC_830": return("priest");

            case "DRG_660": return("priest");

            case "DRG_660t2": return("priest");

            case "DRG_660t3": return("priest");

            case "HERO_10": return("demonhunter");

            case "HERO_10a": return("demonhunter");

            case "EX1_323h": return("lordjaraxxus");

            case "BRM_027h": return("ragnarosthefirelord");

            default:
                string retval = cdb.getCardDataFromID(cdb.cardIdstringToEnum(s)).name.ToString();
                return(retval);
            }
        }