Exemplo n.º 1
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;

            OurDirectory = executableDirectoryName;
            var pIniManager = new IniManager(OurDirectory + SettingsName);

            LureBar = pIniManager.GetString("Fishing", "LureBar", "1");
            LureKey = pIniManager.GetString("Fishing", "LureKey", "1");
            UseLure = pIniManager.GetBoolean("Fishing", "UseLure", false);
        }
Exemplo n.º 2
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;

            OurDirectory = executableDirectoryName;
            var pIniManager = new IniManager(OurDirectory + SettingsName);

            try
            {
                if (!string.IsNullOrEmpty(pIniManager.GetString("Relog", "AccoutnName", string.Empty)))
                {
                    AccountName = Encryptor.Decrypt(pIniManager.GetString("Relog", "AccoutnName", string.Empty));
                }
                else
                {
                    AccountName = string.Empty;
                }
                if (!string.IsNullOrEmpty(pIniManager.GetString("Relog", "AccoutnPW", string.Empty)))
                {
                    AccountPw = Encryptor.Decrypt(pIniManager.GetString("Relog", "AccoutnPW", string.Empty));
                }
                else
                {
                    AccountPw = string.Empty;
                }
                ReloggingEnabled         = pIniManager.GetBoolean("Relog", "EnableRelogging", false);
                PeriodicReloggingEnabled = pIniManager.GetBoolean("Relog", "EnablePeriodicRelogging", false);
                PeriodicLogOut           = pIniManager.GetInt("Relog", "PeriodicLogOut", 60);
                PeriodicLogIn            = pIniManager.GetInt("Relog", "PeriodicLogIn", 30);
                AccountAccount           = pIniManager.GetInt("Relog", "AccountAccount", 1);
                CharacterName            = pIniManager.GetString("Relog", "CharacterName", string.Empty);
            }
            catch (Exception)
            {
                Logging.Debug("Could not load relogger settings. All relogger values have been reset.");
                AccountName              = "";
                AccountPw                = "";
                ReloggingEnabled         = false;
                PeriodicReloggingEnabled = false;
                PeriodicLogIn            = 30;
                PeriodicLogOut           = 60;
                AccountAccount           = 1;
            }
        }
Exemplo n.º 3
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;
            string ourDirectory            = executableDirectoryName;
            var    pIniManager             = new IniManager(ourDirectory + SettingsName);

            LoadedRotationManager = pIniManager.GetString("Config", "LoadedRotationManager", String.Empty);
            LoadKeys();
        }
Exemplo n.º 4
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;
            string ourDirectory            = executableDirectoryName;
            var    pIniManager             = new IniManager(ourDirectory + SettingsName);

            LoadedBeharvior = pIniManager.GetString("Config", "LoadedBeharvior", String.Empty);
            AvoidAddsCombat = pIniManager.GetBoolean("Config", "AvoidAddsCombat", false);
            SkipAddsDis     = pIniManager.GetInt("Config", "SkipAddsDis", 0);
            AllowScripts    = pIniManager.GetBoolean("Config", "AllowScripts", false);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Processes the INI file, applying any changes.
        /// </summary>
        static void ProcessINI()
        {
            var ini = new IniManager(IniFile)
            {
                ReturnDefaultIfEmpty = true
            };

            ini.Load();

            if (ini.Contains(IniSectionLauncher))
            {
                // Fallout Launcher
                PathLauncher      = ini.GetString(IniSectionLauncher, IniKeyPath, PathLauncher);
                ArgumentsLauncher = ini.GetString(IniSectionLauncher, IniKeyArguments, ArgumentsLauncher);
            }

            if (ini.Contains(IniSectionFOSE))
            {
                // FOSE
                PathFOSE      = ini.GetString(IniSectionFOSE, IniKeyPath, PathFOSE);
                ArgumentsFOSE = ini.GetString(IniSectionFOSE, IniKeyArguments, ArgumentsFOSE);
            }

            if (ini.Contains(IniSectionMO))
            {
                // Mod Organizer
                PathModOrganizer      = ini.GetString(IniSectionMO, IniKeyPath, PathModOrganizer);
                ArgumentsModOrganizer = ini.GetString(IniSectionMO, IniKeyArguments, ArgumentsModOrganizer);
            }

            if (ini.Contains(IniSectionCustom))
            {
                // Custom
                NameCustom      = ini.GetString(IniSectionCustom, IniKeyName, NameCustom);
                PathCustom      = ini.GetString(IniSectionCustom, IniKeyPath, PathCustom);
                ArgumentsCustom = ini.GetString(IniSectionCustom, IniKeyArguments, ArgumentsCustom);
            }
        }
Exemplo n.º 6
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;

            OurDirectory = executableDirectoryName;
            var pIniManager = new IniManager(OurDirectory + SettingsName);

            MainGeometry    = pIniManager.GetString("Geometry", "MainGeometry", string.Empty);
            RotatorStatus   = pIniManager.GetString("Geometry", "RotatorStatus", string.Empty);
            RotationForm    = pIniManager.GetString("Geometry", "RotationForm", string.Empty);
            ProcessSelector = pIniManager.GetString("Geometry", "ProcessSelector", string.Empty);
            RotatorForm     = pIniManager.GetString("Geometry", "RotatorForm", string.Empty);
            RuleEditor      = pIniManager.GetString("Geometry", "RuleEditor", string.Empty);
            ScriptEditor    = pIniManager.GetString("Geometry", "ScriptEditor", string.Empty);
        }
Exemplo n.º 7
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;

            OurDirectory = executableDirectoryName;
            var pIniManager = new IniManager(OurDirectory + SettingsName);

            Skin             = pIniManager.GetBoolean("Grinding", "Skin", false);
            WaitForLoot      = pIniManager.GetBoolean("Grinding", "WaitForLoot", false);
            StopLootOnFull   = pIniManager.GetBoolean("Grinding", "StopLootOnFull", false);
            Loot             = pIniManager.GetBoolean("Grinding", "Loot", true);
            Mount            = pIniManager.GetBoolean("Grinding", "Mount", true);
            ApproachRange    = pIniManager.GetInt("Grinding", "ApproachRange", 40);
            Profile          = pIniManager.GetString("Grinding", "Profile", string.Empty);
            Jump             = pIniManager.GetBoolean("Grinding", "Jump", false);
            SkipMobsWithAdds = pIniManager.GetBoolean("Grinding", "SkipMobsWithAdds", false);
            //ShouldTrain = pIniManager.GetBoolean("Grinding", "ShouldTrain", false);
            ShouldTrain      = false;
            SkipAddsDistance = pIniManager.GetInt("Grinding", "SkipAddsDistance", 20);
            SkipAddsCount    = pIniManager.GetInt("Grinding", "SkipAddsCount", 2);
        }
Exemplo n.º 8
0
    public void Create(WeatherType weatherType, Material material)
    {
        var section = $"Weather {weatherType}";

        // Create the gradients
        skyGradient     = GetGradient(section, "Sky");
        fogGradient     = GetGradient(section, "Fog");
        ambientGradient = GetGradient(section, "Ambient");
        sunGradient     = GetGradient(section, "Sun");

        // Sky needs alpha keys for fading to night sky too
        skyGradient.alphaKeys = new GradientAlphaKey[]
        {
            new GradientAlphaKey(1, 19f / 24f),
            new GradientAlphaKey(0, 21f / 24f),
            new GradientAlphaKey(0, 4f / 24f),
            new GradientAlphaKey(1, 6f / 24f)
        };

        // Based on the following settings, plus sunrise/sunset times
        //Stars Post - Sunset Start = 1
        //Stars Pre-Sunrise Finish = 2
        //Stars Fading Duration = 2

        // Initializing some settings
        cloudTexture         = BsaFileReader.LoadTexture("textures/" + IniManager.GetString(section, "Cloud Texture")) as Texture2D;
        material.mainTexture = cloudTexture;

        RenderSettings.sun.transform.eulerAngles = new Vector3(90, 270, 0);
        RenderSettings.sun.shadows = LightShadows.Soft;

        RenderSettings.ambientMode = AmbientMode.Flat;

        RenderSettings.fog     = true;
        RenderSettings.fogMode = FogMode.Linear;

        RenderSettings.fogEndDistance   = Camera.main.farClipPlane;
        RenderSettings.fogStartDistance = RenderSettings.fogEndDistance * (1 - IniManager.GetFloat(section, $"Land Fog Day Depth"));
    }
Exemplo n.º 9
0
        //private string description;

        public Card.Cards HandlePickDecision(Card.Cards originCard, List <Card.Cards> choices, Board board) //originCard; ID of card played by SB: choices; names of cards for selection: board; 3 states , Even, Losing, Winning
        {
            // Local variables declaration
            int    _discoverIndex = 1;
            string Version = "V4.9", description;
            string Divider     = new string('=', 47);
            string Divider2    = new string('=', 50);
            string Origin_Card = CardTemplate.LoadFromId(originCard).Name;

            // Get play mode
            _mode = CurrentMode(Bot.CurrentMode());

            //Create card list
            List <CardValue> choicesCardValue = new List <CardValue>();

            // Get custom file if exists
            try
            {
                string currentAchetype = !String.IsNullOrEmpty(GetCurrentHSReplayArchetype()) ? GetCurrentHSReplayArchetype() : GetCurrentLocalArchetype();
                // Only get files that contains with the word "Custom" and bot current deck or discover card name.
                string[] fileNames = Directory.GetFiles(Directory.GetCurrentDirectory() + @"\DiscoverCC\" + _mode + '\\', "Custom*.ini");
                foreach (string discoverFile in fileNames)
                {
                    // Get custom file if origin card name and current archetype matches
                    if (Regex.Replace(discoverFile, @"[\s+_,]", String.Empty).IndexOf(Regex.Replace(Origin_Card, @"[\s+_,]", String.Empty), StringComparison.OrdinalIgnoreCase) >= 0 && Regex.Replace(discoverFile, @"[\s+_,]", String.Empty).IndexOf(Regex.Replace(currentAchetype, @"[\s+_,]", String.Empty), StringComparison.OrdinalIgnoreCase) >= 0)
                    {
                        Bot.Log("Using archetype: " + currentAchetype);
                        _discoverFile  = discoverFile;
                        _discoverIndex = 0;
                        break;
                    }
                    else if (String.Equals(discoverFile, "Custom " + Origin_Card + ".ini", StringComparison.OrdinalIgnoreCase))
                    {
                        _discoverFile  = discoverFile;
                        _discoverIndex = 0;
                        break;
                    }
                }
            }
            catch (Exception)
            {
                Bot.Log("[Discover] -> File not found");
                Bot.Log("More information in SmartBot forums");
                Bot.Log("https://smartbot.ws/forums/index.php?/topic/9672-evil_eyes-hsreplay-discover-choices/");
                _discoverIndex = 1;
            }
            //Main loop starts here
            double TotalPoints = 0;

            LogChoice = 4;
            do
            {
                switch (_discoverIndex)
                {
                case 0:
                    fileName      = Path.GetFileName(_discoverFile);
                    _iniTierList0 = new IniManager(fileName);     // load custom file into List
                    break;

                case 1:
                    fileName      = Origin_Card + ".ini";
                    _iniTierList0 = new IniManager(Directory.GetCurrentDirectory() + @"\DiscoverCC\" + _mode + '\\' + fileName);     // load HSReplay file into List
                    break;

                case 2:
                    _iniTierList0 = new IniManager(Directory.GetCurrentDirectory() + @"\DiscoverCC\" + _mode + '\\' + "discover.ini");     // load "discover.ini" file into List
                    LogChoice     = 3;
                    break;
                }
                choicesCardValue.Clear();

                //Search for best points
                int heroIndex = 0;
                int friend;
                int.TryParse(_iniTierList0.GetString("Hero", "FriendClass", "0"), out friend);
                foreach (var card in choices) // loops for each card
                {
                    double points       = 0;
                    var    cardTemplate = CardTemplate.LoadFromId(card); //cardTemplate = Name of card + [CardId], card = CardId
                    // Check for any special conditions
                    if (originCard == Card.Cards.BAR_079)                //Kazakus, Golem Shaper
                    {
                        points    = KazakusGolemShaper(CardTemplate.LoadFromId(bestChoice).Name, cardTemplate.Name, board);
                        LogChoice = 1;
                    }
                    else if (originCard == Card.Cards.DMF_075)        //Guess the Weight
                    {
                        if (card == Card.Cards.DMF_075a2)             //Less!
                        {
                            Guess_The_Weight = GuessTheWeight(board); //Guess the Weight, sub program read once
                            points           = Convert.ToDouble(Guess_The_Weight.Split(new char[] { '/' })[0].Trim());
                        }
                        else if (card == Card.Cards.DMF_075a) //More!
                        {
                            points = Convert.ToDouble(Guess_The_Weight.Split(new char[] { '/' })[1].Trim());
                        }
                        else
                        {
                            Guess_The_Weight = cardTemplate.Name + ", Cost: " + cardTemplate.Cost.ToString(); //Display name and cost of weight card
                            LogChoice        = 2;
                        }
                    }
                    else
                    {
                        string HeroClass = friend == 1 ? board.FriendClass.ToString() : board.EnemyClass.ToString();                                             // Get friendly/opponent hero class
                        double.TryParse(_iniTierList0.GetString(cardTemplate.Name, HeroClass, "0"), NumberStyles.Any, CultureInfo.InvariantCulture, out points); // search for card from TierList
                        if (points < 0.001)                                                                                                                      // if points is zero, search for default points
                        {
                            double.TryParse(_iniTierList0.GetString(cardTemplate.Name, "points", "0"), NumberStyles.Any, CultureInfo.InvariantCulture, out points);
                        }
                        else
                        {
                            heroIndex = Array.IndexOf(heroes, HeroClass);
                        }
                    }
                    choicesCardValue.Add(new CardValue(card, points, heroIndex, friend)); //add points, class, hero to each card
                    TotalPoints += points;                                                // Adding points, check if points is not = zero
                }
                _discoverIndex++;
            } while (!(TotalPoints > 0 || _discoverIndex > 2));

            // Select best card
            double bestPoints = 0;

            for (var i = 0; i < choicesCardValue.Count; i++)                                                                              //index through each card
            {
                var    cardValue = choicesCardValue[i];                                                                                   // index through cardValue
                double pts       = cardValue.GetPoints();                                                                                 // calls cardValue subroutine, get points
                int    heroIndex = cardValue.GetHeroClass();                                                                              // calls cardValue subroutine, get hero class
                bool   friend    = Convert.ToBoolean(cardValue.GetFriend());                                                              // calls cardValue subroutine, get friend/opponent hero
                string hero      = heroIndex != 0 ? friend ? ", friend - " + heroes[heroIndex] : ", enemy - " + heroes[heroIndex] : null; //preparation to log
                Bot.Log(i + 1 + ") " + CardTemplate.LoadFromId(cardValue.GetCard()).Name + ": " + pts + hero);                            // output cards choices to log
                if (!(bestPoints < pts))
                {
                    continue;                     // selects highest points
                }
                bestChoice = cardValue.GetCard(); // calls cardValue subroutine, get card assign to bestChoice
                bestPoints = pts;                 // calls cardValue subroutine, get points assign to bestPoints
            }

            //Log description choices
            switch (LogChoice)
            {
            case 1:
                description = "From: Kazakus, Golem Shaper, minion count: " + board.MinionFriend.Count + " mana available: " + board.ManaAvailable;
                break;

            case 2:
                description = "From:  Guess the Weight: " + Guess_The_Weight;
                break;

            case 3:
                description = "No cards found from: " + Origin_Card + ".ini, using: discover.ini, Mode - " + _mode;
                break;

            default:
                description = "From: " + fileName + ", Mode - " + _mode;
                break;
            }

            // Out to Bot log
            Bot.Log(Version + Divider);
            Bot.Log("Best: " + CardTemplate.LoadFromId(bestChoice).Name + ": " + bestPoints);
            Bot.Log(description);
            Bot.Log(Divider2);
            return(bestChoice); // returns cardID
        }
Exemplo n.º 10
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;

            OurDirectory = executableDirectoryName;
            var pIniManager = new IniManager(OurDirectory + SettingsName);

            Herb                        = pIniManager.GetBoolean("Flying", "Herb", false);
            Mine                        = pIniManager.GetBoolean("Flying", "Mine", false);
            ApproachModifier            = (float)Convert.ToDouble(pIniManager.GetString("Flying", "ApproachModifier", "0"));
            MaxUnits                    = pIniManager.GetString("Flying", "MaxUnits", "3");
            StopOnDeath                 = pIniManager.GetBoolean("Flying", "StopOnDeath", false);
            StopHarvestWithPlayerAround = pIniManager.GetBoolean("Flying", "StopHarvest", true);
            AvoidPlayers                = pIniManager.GetBoolean("Flying", "AvoidPlayers", true);
            AutoBlacklist               = pIniManager.GetBoolean("Flying", "AutoBlacklist", false);
            StopOnFullBags              = pIniManager.GetBoolean("Flying", "StopOnFullBags", false);
            AvoidElites                 = pIniManager.GetBoolean("Flying", "AvoidElites", true);
            FindCorpse                  = pIniManager.GetBoolean("Flying", "FindCorpse", true);
            WaitForLoot                 = pIniManager.GetBoolean("Flying", "WaitForLoot", true);
            WaitForRessSick             = pIniManager.GetBoolean("Flying", "WaitForRessSick", false);
            FlyingMountBar              = pIniManager.GetString("Flying", "FlyingMountBar", "0");
            FlyingMountKey              = pIniManager.GetString("Flying", "FlyingMountKey", "0");
            Profile                     = pIniManager.GetString("Flying", "Profile", string.Empty);
            DruidAvoidCombat            = pIniManager.GetBoolean("Flying", "DruidAvoidCombat", false);
            Fish                        = pIniManager.GetBoolean("Flying", "Fish", false);
            Lure                        = pIniManager.GetBoolean("Flying", "Lure", false);
            SendKeyOnStartCombat        = pIniManager.GetBoolean("Flying", "SendKeyOnStartCombat", false);
            MaxTimeAtSchool             = Convert.ToDouble(pIniManager.GetString("Flying", "MaxTimeAtSchool", "4"));
            FishApproach                = Convert.ToDouble(pIniManager.GetString("Flying", "FishApproach", "30"));
            LureBar                     = pIniManager.GetString("Flying", "LureBar", "1");
            LureKey                     = pIniManager.GetString("Flying", "LureKey", "1");
            WaterwalkBar                = pIniManager.GetString("Flying", "WaterwalkBar", "1");
            WaterwalkKey                = pIniManager.GetString("Flying", "WaterwalkKey", "1");
            ExtraBar                    = pIniManager.GetString("Flying", "ExtraBar", "1");
            ExtraKey                    = pIniManager.GetString("Flying", "ExtraKey", "1");
        }
Exemplo n.º 11
0
        public static void LoadSettings()
        {
            var    executableFileInfo      = new FileInfo(Application.ExecutablePath);
            string executableDirectoryName = executableFileInfo.DirectoryName;

            OurDirectory = executableDirectoryName;
            var pIniManager = new IniManager(OurDirectory + SettingsName);

            SelectedEngine     = pIniManager.GetString("Engine", "Selected", string.Empty);
            SelectedCombat     = pIniManager.GetString("Combat", "Selected", string.Empty);
            FirstRun           = pIniManager.GetBoolean("Config", "FirstRun", true);
            DebugMode          = pIniManager.GetBoolean("Config", "DebugMode", false);
            Password           = pIniManager.GetString("Config", "UserName", String.Empty);
            UserName           = pIniManager.GetString("Config", "Password", String.Empty);
            BackgroundMode     = pIniManager.GetBoolean("Config", "BackgroundMode", false);
            HookMouse          = pIniManager.GetBoolean("Config", "HookMouse", false);
            SetupUseHotkeys    = pIniManager.GetBoolean("Config", "UseHotkeys", false);
            StopAfterBool      = pIniManager.GetBoolean("Config", "StopAfter", false);
            StopAfter          = pIniManager.GetString("Config", "StopAfterTime", "120");
            LogOutOnFollowTime = pIniManager.GetString("Config", "LogoutOnFollowTime", "2");
            SoundFollow        = pIniManager.GetBoolean("Config", "FollowSound", true);
            SoundWhisper       = pIniManager.GetBoolean("Config", "WhisperSound", true);
            SoundStop          = pIniManager.GetBoolean("Config", "SoundStop", true);
            Shutdown           = pIniManager.GetBoolean("Config", "ShutdownComputer", false);
            LogoutOnFollow     = pIniManager.GetBoolean("Config", "LogoutOnFollow", false);
            UseCtm             = pIniManager.GetBoolean("Config", "UseCtm", false);
            DebugLog           = pIniManager.GetBoolean("Config", "DebugLog", false);
            Latency            = pIniManager.GetInt("Config", "Latency", 0);
            Language           = (LazyLanguage)pIniManager.GetInt("Config", "Language", 0);
            //
            CombatBoolEat   = pIniManager.GetBoolean("Combat", "CBEat", true);
            CombatBoolDrink = pIniManager.GetBoolean("Combat", "CBDrink", true);
            CombatEatAt     = pIniManager.GetString("Combat", "COEat", "0");
            CombatDrinkAt   = pIniManager.GetString("Combat", "CODrink", "0");

            KeysGroundMountBar       = pIniManager.GetString("Keys", "GroundMountBar", "1");
            KeysGroundMountKey       = pIniManager.GetString("Keys", "GroundMountKey", "1");
            KeysAttack1Bar           = pIniManager.GetString("Keys", "Attack1Bar", "1");
            KeysAttack1Key           = pIniManager.GetString("Keys", "Attack1Key", "1");
            KeysEatBar               = pIniManager.GetString("Keys", "EatBar", "1");
            KeysEatKey               = pIniManager.GetString("Keys", "EatKey", "1");
            KeysDrinkBar             = pIniManager.GetString("Keys", "DrinkBar", "1");
            KeysDrinkKey             = pIniManager.GetString("Keys", "DrinkKey", "1");
            KeysMoteExtractorBar     = pIniManager.GetString("Keys", "MoteBar", "1");
            KeysMoteExtractorKey     = pIniManager.GetString("Keys", "MoteKey", "1");
            KeysStafeLeftKeyText     = pIniManager.GetString("Keys", "StafeLeftKeyText", "Q");
            KeysStafeRightKeyText    = pIniManager.GetString("Keys", "StafeRightKeyText", "E");
            KeysInteractKeyText      = pIniManager.GetString("Keys", "InteractText", "U");
            KeysInteractTargetText   = pIniManager.GetString("Keys", "InteractTargetText", "P");
            KeysTargetLastTargetText = pIniManager.GetString("Keys", "KeysTargetLastTargetText", "G");

            //Mail
            ShouldMail = pIniManager.GetBoolean("Mail", "ShouldMail", false);
            MailTo     = pIniManager.GetString("Mail", "MailTo", string.Empty);
            //MacroForMail = pIniManager.GetBoolean("Mail", "MacroForMail", false);
            MacroForMail     = false;
            KeysMailMacroBar = pIniManager.GetString("Mail", "KeysMailMacroBar", "1");
            KeysMailMacroKey = pIniManager.GetString("Mail", "KeysMailMacroKey", "1");

            //Vendor
            ShouldVendor  = pIniManager.GetBoolean("Vendor", "ShouldVendor", false);
            ShouldRepair  = pIniManager.GetBoolean("Vendor", "ShouldRepair", false);
            SellCommon    = pIniManager.GetBoolean("Vendor", "SellCommon", false);
            SellUncommon  = pIniManager.GetBoolean("Vendor", "SellUncommon", false);
            SellPoor      = pIniManager.GetBoolean("Vendor", "SellPoor", false);
            FreeBackspace = pIniManager.GetString("Vendor", "FreeBackspace", "2");
        }
Exemplo n.º 12
0
        // Retrieve card details from SB
        public Card.Cards HandlePickDecision(Card.Cards originCard, List <Card.Cards> choices, Board board) //originCard; ID of card played by SB: choices; names of cards for selection: board; 3 states , Even, Losing, Winning
        {
            // Local variables declaration
            int  _discoverIndex = 0, _standard = 0, _wild = 0;
            bool ExitLoop = false;

            //Create card list
            List <CardValue> choicesCardValue = new List <CardValue>();

            // Search for cards from external files
            do
            {
                // Decide to use standard, wild or discover database
                switch (_discoverIndex)
                {
                case 0:
                    fileName = CardTemplate.LoadFromId(originCard).Name;
                    _mode    = "Standard";
                    break;

                case 1:
                    _mode = "Wild";
                    break;

                case 2:
                    if (_standard + _wild > 0)
                    {
                        if (_standard >= _wild)
                        {
                            _mode = "Standard";
                        }
                        else
                        {
                            _mode = "Wild";
                        }
                        ExitLoop = true;     //Re-discover card?, Exit while loop add standard or wild cards to list
                    }
                    else
                    {
                        fileName  = "discover";
                        _standard = 0;
                        _wild     = 0;
                        _mode     = "Standard";
                        Bot.Log("Cards not found, using: " + fileName + ".ini");
                    }
                    break;

                case 3:
                    _mode = "Wild";
                    break;

                case 4:
                    if (_standard + _wild > 0)
                    {
                        if (_standard >= _wild)
                        {
                            _mode = "Standard";
                        }
                        else
                        {
                            _mode = "Wild";
                        }
                    }
                    ExitLoop = true;     //Re-discover card?, Exit while loop add standard or wild cards to list
                    break;
                }
                _iniTierList0 = new IniManager(Directory.GetCurrentDirectory() + @"\DiscoverCC\" + _mode + '\\' + fileName + ".ini"); // load HSReplay file into List
                choicesCardValue.Clear();
                double points;
                int    heroIndex = 0;
                string HeroClass = board.FriendClass.ToString();// Get friendly hero class

                //Search for best points from external files
                foreach (var card in choices)                                                                                                                   // loops for each card
                {
                    var cardTemplate = CardTemplate.LoadFromId(card);                                                                                           //converts cardID to CardName
                    double.TryParse(_iniTierList0.GetString(cardTemplate.Name, HeroClass, "0"), NumberStyles.Any, CultureInfo.InvariantCulture, out points);    //search for card from TierList hero class
                    if (points < 0.001)                                                                                                                         // if points is zero, search for default points
                    {
                        double.TryParse(_iniTierList0.GetString(cardTemplate.Name, "points", "0"), NumberStyles.Any, CultureInfo.InvariantCulture, out points); //search for card from TierList default points
                    }
                    else
                    {
                        heroIndex = Array.IndexOf(heroes, HeroClass);
                    }
                    // Add cards found for comparison
                    switch (_mode)
                    {
                    case "Standard":
                        if (points > 0)
                        {
                            _standard++;
                        }
                        break;

                    case "Wild":
                        if (points > 0)
                        {
                            _wild++;
                        }
                        break;
                    }
                    if (ExitLoop)                                                     // _rediscover set to false, add points, class and hero class to card list
                    {
                        choicesCardValue.Add(new CardValue(card, points, heroIndex)); //add points, class to each card
                    }
                }
                _discoverIndex++;
            } while (!(ExitLoop || _discoverIndex > 4));

            // Select best card
            double bestPoints = 0;

            for (var i = 0; i < choicesCardValue.Count; i++)                                                   //loops through each card
            {
                var    cardValue = choicesCardValue[i];                                                        // index through cardValue
                double pts       = cardValue.GetPoints();                                                      // calls cardValue subroutine, get points
                int    heroIndex = cardValue.GetHeroClass();                                                   // calls cardValue subroutine, get hero class
                string hero      = heroIndex != 0 ? ", friend - " + heroes[heroIndex] : "";                    //preparation to log
                Bot.Log(i + 1 + ") " + CardTemplate.LoadFromId(cardValue.GetCard()).Name + ": " + pts + hero); // output to SB log
                if (!(bestPoints < pts))
                {
                    continue;                     // selects highest points
                }
                bestChoice = cardValue.GetCard(); // calls cardValue subroutine, get card assign to bestChoice
                bestPoints = pts;                 // calls cardValue subroutine, get points assign to bestPoints
            }

            // Out to Bot log
            Bot.Log(Version + Divider);
            Bot.Log("Best: " + CardTemplate.LoadFromId(bestChoice).Name + ": " + bestPoints + ", " + fileName + ".ini, " + _mode + " tier list");
            Bot.Log(Divider2);
            return(bestChoice); // returns bestChoice of card to SB
        }
Exemplo n.º 13
0
        public Card.Cards HandlePickDecision(Card.Cards originCard, List <Card.Cards> choices, Board board) //originCard; ID of card played by SB: choices; names of cards for selection: board; 3 states , Even, Losing, Winning
        {
            // Get play mode
            if (IsStandardMode(Bot.CurrentMode())) // retrieve game mode from SB ,Standard, Arena
            {
                _mode = "Standard";
            }
            if (IsArenaMode(Bot.CurrentMode()))
            {
                _mode = "Arena";
            }

            //Get card list
            List <CardValue> choicesCardValue = new List <CardValue>();

            int _indexDiscoverList;

            // Get custom file if exists
            try
            {
                // Only get files that contains with the word "Custom" and bot current deck or discover card name.
                string[] fileNames = Directory.GetFiles(Directory.GetCurrentDirectory() + @"\DiscoverCC\" + _mode + '\\', "Custom*.ini");
                foreach (string discoverFile in fileNames)
                {
                    // if (discoverFile.Contains(Bot.CurrentDeck().Name)) // using deck name
                    if (discoverFile.Contains(CardTemplate.LoadFromId(originCard).Name)) //using card name
                    {
                        _discoverFile = discoverFile;
                    }
                }
                _indexDiscoverList = File.Exists(_discoverFile) ? 0 : 1;
            }
            catch (Exception)
            {
                Bot.Log("[Discover] -> File not found");
                Bot.Log("More information in SmartBot forums");
                Bot.Log("https://smartbot.ws/forums/index.php?/topic/9672-evil_eyes-hsreplay-discover-choices/");
                _indexDiscoverList = 1;
            }

            //Main loop starts here
            bool _reDiscoverCard;

            do
            {
                switch (_indexDiscoverList)
                {
                case 0:
                    _iniTierList0 = new IniManager(_discoverFile);     // load custom file into List
                    FileName      = Path.GetFileName(_discoverFile);
                    break;

                case 1:
                    _iniTierList0 = new IniManager(Directory.GetCurrentDirectory() + @"\DiscoverCC\" + _mode + '\\' + CardTemplate.LoadFromId(originCard).Name + ".ini");     // load HSReplay file into List
                    FileName      = CardTemplate.LoadFromId(originCard).Name + ".ini";
                    break;

                case 2:
                    _iniTierList0 = new IniManager(Directory.GetCurrentDirectory() + @"\DiscoverCC\" + _mode + '\\' + "discover.ini");     // load "discover.ini" file into List
                    FileName      = "discover.ini";
                    break;
                }
                choicesCardValue.Clear();

                //Search for best points
                int h;
                int.TryParse(_iniTierList0.GetString("Hero", "FriendClass", "0"), out h);
                double TotalPoints = 0;
                foreach (var card in choices)                                                                  // loops for each card
                {
                    var    cardTemplate = CardTemplate.LoadFromId(card);                                       //converts cardID to CardName
                    string HeroClass    = h == 1 ? board.FriendClass.ToString() : board.EnemyClass.ToString(); // Get friendly/opponent hero class
                    double p;
                    double.TryParse(_iniTierList0.GetString(cardTemplate.Name, HeroClass, "0"), out p);        // search for card from TierList
                    if (p < 0.001)                                                                             // if points is zero, search for default points
                    {
                        double.TryParse(_iniTierList0.GetString(cardTemplate.Name, "points", "0"), out p);
                        HeroClass = "none";
                    }
                    int c = Array.IndexOf(heroes, HeroClass);
                    choicesCardValue.Add(new CardValue(card, p, c, h)); //add points, class, hero to each card
                    TotalPoints += p;                                   // Adding points, check if points is not = zero
                }
                if (TotalPoints > 0 || _indexDiscoverList > 1)          //Break from loop if points > 0 or on 3rd loop
                {
                    _reDiscoverCard = false;
                }
                else
                {
                    _reDiscoverCard = true; // no points found, re-loop using other tier lists
                    _indexDiscoverList++;
                }
            } while (_reDiscoverCard);

            // Select best card
            double bestPoints = 0;

            for (var i = 0; i < choicesCardValue.Count; i++)                                                                   //loops through each card
            {
                var    cardValue = choicesCardValue[i];                                                                        // index through cardValue
                double pts       = cardValue.GetPoints();                                                                      // calls cardValue subroutine, get points
                int    heroIndex = cardValue.GetHeroClass();                                                                   // calls cardValue subroutine, get hero class
                bool   friend    = Convert.ToBoolean(cardValue.GetFriend());                                                   // calls cardValue subroutine, get friend/opponent hero
                string hero      = heroIndex != 0 ? friend ? ", f - " + heroes[heroIndex] : ", e - " + heroes[heroIndex] : ""; //preparation to log
                Bot.Log(i + 1 + ") " + CardTemplate.LoadFromId(cardValue.GetCard()).Name + ": " + pts + hero);                 // output to SB log
                if (!(bestPoints < pts))
                {
                    continue;                     // selects highest points
                }
                bestChoice = cardValue.GetCard(); // calls cardValue subroutine, get card assign to bestChoice
                bestPoints = pts;                 // calls cardValue subroutine, get points assign to bestPoints
            }

            // Out to Bot log
            Bot.Log("============================");
            Bot.Log("Best: " + CardTemplate.LoadFromId(bestChoice).Name + ": " + bestPoints + ": " + FileName + ", " + _mode + " tier-list");
            Bot.Log("============================");
            return(bestChoice); // returns bestChoice of card to SB
        }
Exemplo n.º 14
0
        public Card.Cards HandlePickDecision(Card.Cards originCard, List <Card.Cards> choices, Board board) //originCard; ID of card played by SB: choices; names of cards for selection: board; 3 states , Even, Losing, Winning
        {
            // Get play mode
            if (IsStandardMode(Bot.CurrentMode())) // retrieve game mode from SB ,Standard, Arena
            {
                _mode = "Standard";
            }
            if (IsArenaMode(Bot.CurrentMode()))
            {
                _mode = "Arena";
            }

            //Get card list
            List <CardValue> choicesCardValue = new List <CardValue>();                                                        // creates an empty list, adding stuff to it afterwards

            _iniTierList0 = new IniManager(Directory.GetCurrentDirectory() + @"\DiscoverCC\" + _mode + '\\' + "discover.ini"); // location and name of second preference file. IniManager; load into buffer

            //Search for best points add to choicesCardValue List
            int h;

            int.TryParse(_iniTierList0.GetString("Hero", "FriendClass", "0"), out h);
            foreach (var card in choices)                                                               // loops for each card
            {
                var    cardTemplate = CardTemplate.LoadFromId(card);                                    //converts cardID to CardName
                double p;
                string HeroClass = h == 1 ? board.FriendClass.ToString() : board.EnemyClass.ToString(); // Get friendly/opponent hero class
                double.TryParse(_iniTierList0.GetString(cardTemplate.Name, HeroClass, "0"), out p);     // search for card from TierList, retrieve points from opponent hero
                if (p < 0.001)                                                                          // if points is zero, search for default points
                {
                    double.TryParse(_iniTierList0.GetString(cardTemplate.Name, "points", "0"), out p);
                    HeroClass = "none";
                }
                int c = Array.IndexOf(heroes, HeroClass);
                choicesCardValue.Add(new CardValue(card, p, c, h)); //add card, points, class, hero to each choicesCardValue List
            }

            //Select best card
            double bestPoints = 0;

            for (var i = 0; i < choicesCardValue.Count; i++)                                                                   //loops through each card
            {
                var    cardValue = choicesCardValue[i];                                                                        // index through cardValue
                double pts       = cardValue.GetPoints();                                                                      // calls cardValue subroutine, get points
                int    heroIndex = cardValue.GetHeroClass();                                                                   // calls cardValue subroutine, get hero class
                bool   friend    = Convert.ToBoolean(cardValue.GetFriend());                                                   // calls cardValue subroutine, get friend/opponent hero
                string hero      = heroIndex != 0 ? friend ? ", f - " + heroes[heroIndex] : ", e - " + heroes[heroIndex] : ""; //preparation to log
                Bot.Log(i + 1 + ") " + CardTemplate.LoadFromId(cardValue.GetCard()).Name + ": " + pts + hero);                 //output to SB log
                if (!(bestPoints < pts))
                {
                    continue;                     // selects highest points
                }
                bestChoice = cardValue.GetCard(); // calls cardValue subroutine, get card assign to bestChoice
                bestPoints = pts;                 // calls cardValue subroutine, get points assign to bestPoints
            }

            // Out to Bot log
            Bot.Log("============================");
            Bot.Log("Best: " + CardTemplate.LoadFromId(bestChoice).Name + ": " + bestPoints + ": discover.ini, " + _mode + " tier-list");
            Bot.Log("============================");
            return(bestChoice); // returns bestChoice of card to SB
        }