예제 #1
0
        public void RecoverConfig()
        {
            string spath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "BlueSheep", "Accounts", account.AccountName, account.CharacterBaseInformations.Name + ".xml");

            if (File.Exists(spath))
            {
                Config conf = DeserializeConfig(spath);
                if (conf == null)
                {
                    return;
                }
                if (conf.m_AIPath != "")
                {
                    account.FightParser = new FightParser(account, conf.m_AIPath, conf.m_IA);
                    account.Fight       = new BFight(account, account.FightParser, account.FightData);
                    account.ModLabel(conf.m_IA, account.NomIA);
                }
                if (conf.m_Path != null && conf.m_BotPath != null && conf.m_Path != "")
                {
                    account.Path = new Core.Path.PathManager(account, conf.m_Path, conf.m_BotPath);
                    if (conf.m_BotPath != null)
                    {
                        account.Log(new BotTextInformation("Trajet chargé : " + conf.m_BotPath), 0);
                    }
                    else
                    {
                        account.Log(new BotTextInformation("Trajet chargé : UNKNOWN"), 0);
                    }
                }

                if (account.Fight == null)
                {
                    account.Log(new ErrorTextInformation("WARNING : T'as chargé aucune IA, fait gaffe mon coco :p"), 0);
                }

                if (conf.m_FloodContent != "")
                {
                    account.FloodUC.FloodContentRbox.Text = conf.m_FloodContent;
                }
                //if (conf.m_L1R != null)
                //{
                //    Dictionary<string, int> ressources = conf.m_L1R.ToDictionary(x => x, x => conf.m_L2R[conf.m_L1R.IndexOf(x)]);
                //    account.Gather.Stats = ressources;
                //}

                if (conf.m_AutoUp.Count > 0)
                {
                    if (conf.m_AutoUp[0])
                    {
                        account.CaracUC.VitaRb.Checked = true;
                    }
                    else if (conf.m_AutoUp[1])
                    {
                        account.CaracUC.WisRb.Checked = true;
                    }
                    else if (conf.m_AutoUp[2])
                    {
                        account.CaracUC.StreRb.Checked = true;
                    }
                    else if (conf.m_AutoUp[3])
                    {
                        account.CaracUC.InteRb.Checked = true;
                    }
                    else if (conf.m_AutoUp[4])
                    {
                        account.CaracUC.LuckRb.Checked = true;
                    }
                    else if (conf.m_AutoUp[5])
                    {
                        account.CaracUC.AgiRb.Checked = true;
                    }
                }
                if (conf.m_Elevage != null)
                {
                    account.checkBoxBegin.Checked = conf.m_Elevage;
                }
                if (conf.m_IsLockingFight)
                {
                    account.IsLockingFight.Checked = conf.m_IsLockingFight;
                }
                if (conf.m_RegenValue != null)
                {
                    account.RegenChoice.Value = conf.m_RegenValue;
                }
                if (conf.m_Restrictions.Count > 0)
                {
                    account.nudMinMonstersLevel.Value  = conf.m_Restrictions[0];
                    account.nudMaxMonstersLevel.Value  = conf.m_Restrictions[1];
                    account.nudMinMonstersNumber.Value = conf.m_Restrictions[2];
                    account.nudMaxMonstersNumber.Value = conf.m_Restrictions[3];
                }
                if (conf.m_AutoDeletion != null)
                {
                    account.GestItemsUC.AutoDeletionBox.Checked = conf.m_AutoDeletion;
                }
                if (conf.m_RelaunchPath && account.Path != null)
                {
                    account.Path.Relaunch = true;
                }
                //if (conf.m_GestItems != null)
                //{
                //    foreach (ListViewItem i in conf.m_GestItems)
                //        account.GestItemsUC.LVGestItems.Items.Add(i);
                //}

                account.Log(new BotTextInformation("Configuration restaurée."), 0);
            }
            else
            {
                account.Log(new BotTextInformation("Aucune config pour ce personnage."), 0);
            }
            Restored = true;
        }