Ejemplo n.º 1
0
        /// <summary>
        /// Decodes an export code and applies it to the current state.
        /// </summary>
        public ItemListSettings ImportFromCode(string code)
        {
            if (string.IsNullOrEmpty(code) || string.IsNullOrWhiteSpace(code))
            {
                ValidationMessage = "You must enter an import/export code";
                Logger.Log("You must enter an import/export code");
            }
            try
            {
                var decompressedXml = ExportHelper.Decompress(ExportCode);
                var newSettings     = TrinitySetting.GetSettingsInstance <ItemListSettings>(decompressedXml);

                Grouping = newSettings.Grouping;

                using (Collection.DeferRefresh())
                {
                    SelectedItems = newSettings.SelectedItems;
                    UpdateSelectedItems();
                }
            }
            catch (Exception ex)
            {
                ValidationMessage = string.Format("Error importing itemlist. {0} {1}", ex.Message, ex.InnerException);
                Logger.Log("Error importing itemlist. {0} {1}", ex.Message, ex.InnerException);
            }
            return(this);
        }
Ejemplo n.º 2
0
 public void CopyTo(CombatSetting setting)
 {
     TrinitySetting.CopyTo(this, setting);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigViewModel" /> class.
        /// </summary>
        /// <param name="model">The model.</param>
        public ConfigViewModel(TrinitySetting model)
        {
            try
            {
                _OriginalModel = model;
                _Model         = new TrinitySetting();
                _OriginalModel.CopyTo(_Model);
                InitializeResetCommand();
                SaveCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        if (Trinity.StashRule == null && _Model.Loot.ItemFilterMode == ItemFilterMode.TrinityWithItemRules)
                        {
                            // Load interpreter for the first time if needed
                            Trinity.StashRule = new ItemRules.Interpreter();
                        }

                        _Model.CopyTo(_OriginalModel);
                        _OriginalModel.Save();

                        if (_Model.Advanced.TPSEnabled != _OriginalModel.Advanced.TPSEnabled)
                        {
                            BotManager.SetBotTicksPerSecond();
                        }

                        if (_Model.Advanced.UnstuckerEnabled != _OriginalModel.Advanced.UnstuckerEnabled)
                        {
                            BotManager.SetUnstuckProvider();
                        }

                        if (_Model.Loot.ItemFilterMode != _OriginalModel.Loot.ItemFilterMode)
                        {
                            BotManager.SetItemManagerProvider();
                        }

                        CacheData.FullClear();
                        UsedProfileManager.SetProfileInWindowTitle();

                        UILoader.CloseWindow();
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Exception in UI SaveCommand {0}", ex);
                    }
                });
                DumpBackpackCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        Logger.Log(
                            "\n############################################\n"
                            + "\nDumping Backpack Items. This will hang your client. Please wait....\n"
                            + "##########################");
                        UILoader.CloseWindow();
                        TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.Backpack);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogCategory.UserInformation, "Exception dumping Backpack: {0}", ex);
                    }
                });
                DumpQuickItemsCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        Logger.Log(
                            "\n############################################\n"
                            + "\nQuick Dumping Items. This will hang your client. Please wait....\n"
                            + "##########################");
                        UILoader.CloseWindow();
                        TrinityItemManager.DumpQuickItems();
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogCategory.UserInformation, "Exception Quick Dumping: {0}", ex);
                    }
                });
                DumpAllItemsCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        Logger.Log(
                            "\n############################################\n"
                            + "\nDumping ALL Items. This will hang your client. Please wait....\n"
                            + "##########################");
                        UILoader.CloseWindow();
                        TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.All);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogCategory.UserInformation, "Exception Dumping ALL Items: {0}", ex);
                    }
                });
                DumpMerchantItemsCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        Logger.Log(
                            "\n############################################\n"
                            + "\nDumping Merchant Items. This will hang your client. Please wait....\n"
                            + "##########################");
                        UILoader.CloseWindow();
                        TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.Merchant);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogCategory.UserInformation, "Exception dumping Merchant: {0}", ex);
                    }
                });
                DumpEquippedCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        Logger.Log(
                            "\n############################################\n"
                            + "\nDumping Equipped Items. This will hang your client. Please wait....\n"
                            + "##########################");
                        UILoader.CloseWindow();
                        TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.Equipped);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogCategory.UserInformation, "Exception dumping Equipped: {0}", ex);
                    }
                });
                DumpGroundItemsCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        Logger.Log(
                            "\n############################################\n"
                            + "\nDumping Ground Items. This will hang your client. Please wait....\n"
                            + "##########################");
                        UILoader.CloseWindow();
                        TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.Ground);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogCategory.UserInformation, "Exception dumping Ground: {0}", ex);
                    }
                });
                DumpStashCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        Logger.Log(
                            "\n############################################\n"
                            + "\nDumping Stash Items. This will hang your client. Please wait....\n"
                            + "##########################");
                        UILoader.CloseWindow();
                        TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.Stash);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogCategory.UserInformation, "Exception dumping Stash: {0}", ex);
                    }
                });
                TestScoreCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        Trinity.TestScoring();
                        //UILoader.CloseWindow();
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogCategory.UserInformation, "{0}", ex);
                    }
                });
                OrderStashCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        //TownRun.SortStash();
                        UILoader.CloseWindow();
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(LogCategory.UserInformation, "{0}", ex);
                    }
                });
                HelpLinkCommand = new RelayCommand(
                    (parameter) =>
                {
                    string link = parameter as string;
                    if (!string.IsNullOrWhiteSpace(link))
                    {
                        Process.Start(link);
                    }
                });
                ConfigureLootToHunting = new RelayCommand(
                    (parameter) =>
                {
                    ConfigHuntingLoot();
                });
                ConfigureLootToQuesting = new RelayCommand(
                    (parameter) =>
                {
                    ConfigQuestingLoot();
                });
                LoadItemRuleSetCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        LoadItemRulesPath();
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Exception in LoadItemRuleSetCommand: {0}", ex);
                    }
                });
                OpenTVarsCommand = new RelayCommand(
                    (parameter) =>
                {
                    try
                    {
                        V.ValidateLoad();
                        TVarsViewModel.CreateWindow().Show();
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Exception in OpenTVarsCommand: {0}", ex);
                    }
                });
                UseGlobalConfigFileCommand = new RelayCommand(
                    (parameter) =>
                {
                    DialogResult rusure = MessageBox.Show("This will force all bots running under this Demonbuddy directory to use a shared configuration file.\n"
                                                          + "You can undo this by removing the Trinity.xml file under your Demonbuddy settings directory. \n"
                                                          + "Are you sure?",
                                                          "Confirm global settings",
                                                          MessageBoxButtons.OKCancel);

                    if (rusure == DialogResult.OK)
                    {
                        Trinity.Settings.Save(true);
                    }
                });
                DumpSkillsCommand = new RelayCommand(
                    (parameter) =>
                {
                    PlayerInfoCache.DumpPlayerSkills();

                    UILoader.CloseWindow();
                });
            }
            catch (Exception ex)
            {
                Logger.LogError("Error creating Trinity View Model {0}", ex);
            }
        }
 public void CopyTo(CrusaderSetting setting)
 {
     TrinitySetting.CopyTo(this, setting);
 }
Ejemplo n.º 5
0
 public void CopyTo(ItemSetting setting)
 {
     TrinitySetting.CopyTo(this, setting);
 }
Ejemplo n.º 6
0
 public void CopyTo(ItemListSettings setting)
 {
     TrinitySetting.CopyTo(this, setting);
     setting.SelectedItems = SelectedItems;
 }
Ejemplo n.º 7
0
 public DemonHunterSetting Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 8
0
 public MonkSetting Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 9
0
 public BarbarianSetting Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 10
0
 public void CopyTo(DemonHunterSetting setting)
 {
     TrinitySetting.CopyTo(this, setting);
 }
Ejemplo n.º 11
0
 public void CopyTo(BarbarianSetting setting)
 {
     TrinitySetting.CopyTo(this, setting);
 }
Ejemplo n.º 12
0
 public WitchDoctorSetting Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 13
0
 public void CopyTo(WitchDoctorSetting setting)
 {
     TrinitySetting.CopyTo(this, setting);
 }
Ejemplo n.º 14
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="ConfigViewModel" /> class.
        /// </summary>
        /// <param name="model">The model.</param>
        public ConfigViewModel(TrinitySetting model)
        {
            try
            {
                _OriginalModel = model;
                _Model = new TrinitySetting();
                _OriginalModel.CopyTo(_Model);
                InitializeResetCommand();

                SaveCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            if (Trinity.StashRule == null && _Model.Loot.ItemFilterMode == ItemFilterMode.TrinityWithItemRules)
                            {
                                // Load interpreter for the first time if needed
                                Trinity.StashRule = new Interpreter();
                            }

                            _Model.CopyTo(_OriginalModel);
                            _OriginalModel.Save();

                            if (_Model.Advanced.TPSEnabled != _OriginalModel.Advanced.TPSEnabled)
                                BotManager.SetBotTicksPerSecond();

                            if (_Model.Advanced.UnstuckerEnabled != _OriginalModel.Advanced.UnstuckerEnabled)
                                BotManager.SetUnstuckProvider();

                            if (_Model.Loot.ItemFilterMode != _OriginalModel.Loot.ItemFilterMode)
                                BotManager.SetItemManagerProvider();

                            CacheData.FullClear();
                            UsedProfileManager.SetProfileInWindowTitle();

                            UILoader.CloseWindow();
                        }
                        catch (Exception ex)
                        {
                            Logger.Log("Exception in UI SaveCommand {0}", ex);
                        }
                    });
                DumpBackpackCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            Logger.Log(
                                "\n############################################\n"
                                + "\nDumping Backpack Items. This will hang your client. Please wait....\n"
                                + "##########################");
                            UILoader.CloseWindow();
                            TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.Backpack);
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogCategory.UserInformation, "Exception dumping Backpack: {0}", ex);
                        }
                    });
                DumpQuickItemsCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            Logger.Log(
                                "\n############################################\n"
                                + "\nQuick Dumping Items. This will hang your client. Please wait....\n"
                                + "##########################");
                            UILoader.CloseWindow();
                            TrinityItemManager.DumpQuickItems();
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogCategory.UserInformation, "Exception Quick Dumping: {0}", ex);
                        }
                    });
                DumpAllItemsCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            Logger.Log(
                                "\n############################################\n"
                                + "\nDumping ALL Items. This will hang your client. Please wait....\n"
                                + "##########################");
                            UILoader.CloseWindow();
                            TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.All);
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogCategory.UserInformation, "Exception Dumping ALL Items: {0}", ex);
                        }
                    });
                DumpSkillsAndItemsCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            UILoader.CloseWindow();
                            DebugUtil.LogBuildAndItems(TrinityLogLevel.Info);                          
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogCategory.UserInformation, "Exception Dumping Skill/Rune/Passive Items: {0}", ex);
                        }
                    });
                DumpInvalidItemsCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            UILoader.CloseWindow();
                            DebugUtil.LogInvalidItems(TrinityLogLevel.Info);
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogCategory.UserInformation, "Exception Dumping Invalid Items: {0}", ex);
                        }
                    });
                DumpItemSNOReference = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            UILoader.CloseWindow();
                            DebugUtil.DumpItemSNOReference();
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogCategory.UserInformation, "Exception in DumpItemSNOReference: {0}", ex);
                        }
                    });                
                DumpMerchantItemsCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            Logger.Log(
                                "\n############################################\n"
                                + "\nDumping Merchant Items. This will hang your client. Please wait....\n"
                                + "##########################");
                            UILoader.CloseWindow();
                            TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.Merchant);
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogCategory.UserInformation, "Exception dumping Merchant: {0}", ex);
                        }
                    });
                DumpEquippedCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            Logger.Log(
                                "\n############################################\n"
                                + "\nDumping Equipped Items. This will hang your client. Please wait....\n"
                                + "##########################");
                            UILoader.CloseWindow();
                            TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.Equipped);
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogCategory.UserInformation, "Exception dumping Equipped: {0}", ex);
                        }
                    });
                DumpGroundItemsCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            Logger.Log(
                                "\n############################################\n"
                                + "\nDumping Ground Items. This will hang your client. Please wait....\n"
                                + "##########################");
                            UILoader.CloseWindow();
                            TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.Ground);
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogCategory.UserInformation, "Exception dumping Ground: {0}", ex);
                        }
                    });
                DumpStashCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            Logger.Log(
                                "\n############################################\n"
                                + "\nDumping Stash Items. This will hang your client. Please wait....\n"
                                + "##########################");
                            UILoader.CloseWindow();
                            TrinityItemManager.DumpItems(TrinityItemManager.DumpItemLocation.Stash);
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogCategory.UserInformation, "Exception dumping Stash: {0}", ex);
                        }
                    });
                TestScoreCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            ItemValuation.TestScoring();
                            //UILoader.CloseWindow();
                        }
                        catch (Exception ex)
                        {
                            Logger.Log(LogCategory.UserInformation, "{0}", ex);
                        }
                    });
                HelpLinkCommand = new RelayCommand(
                    parameter =>
                    {
                        var link = parameter as string;
                        if (!string.IsNullOrWhiteSpace(link))
                        {
                            Process.Start(link);
                        }
                    });
                ConfigureLootToHunting = new RelayCommand(
                    parameter => ConfigHuntingLoot());
                ConfigureLootToQuesting = new RelayCommand(
                    parameter => ConfigQuestingLoot());
                LoadItemRuleSetCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            LoadItemRulesPath();
                        }
                        catch (Exception ex)
                        {
                            Logger.Log("Exception in LoadItemRuleSetCommand: {0}", ex);
                        }
                    });
                OpenTVarsCommand = new RelayCommand(
                    parameter =>
                    {
                        try
                        {
                            V.ValidateLoad();
                            TVarsViewModel.CreateWindow().Show();
                        }
                        catch (Exception ex)
                        {
                            Logger.Log("Exception in OpenTVarsCommand: {0}", ex);
                        }
                    });
                UseGlobalConfigFileCommand = new RelayCommand(
                    parameter =>
                    {
                        DialogResult rusure = MessageBox.Show("This will force all bots running under this Demonbuddy directory to use a shared configuration file.\n"
                                                              + "You can undo this by removing the Trinity.xml file under your Demonbuddy settings directory. \n"
                                                              + "Are you sure?",
                            "Confirm global settings",
                            MessageBoxButtons.OKCancel);

                        if (rusure == DialogResult.OK)
                        {
                            Trinity.Settings.Save(true);
                        }
                    });
                DumpSkillsCommand = new RelayCommand(
                    parameter =>
                    {
                        CacheData.Hotbar.Dump();
                        UILoader.CloseWindow();
                    });
            }
            catch (Exception ex)
            {
                Logger.LogError("Error creating Trinity View Model {0}", ex);
            }
        }
Ejemplo n.º 15
0
 public void CopyTo(AvoidanceRadiusSetting setting)
 {
     TrinitySetting.CopyTo(this, setting);
 }
Ejemplo n.º 16
0
 public void CopyTo(MonkSetting setting)
 {
     TrinitySetting.CopyTo(this, setting);
 }
Ejemplo n.º 17
0
 public AvoidanceRadiusSetting Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Generates an export code of the current state
        /// </summary>
        public string CreateExportCode()
        {
            var settingsXml = TrinitySetting.GetSettingsXml(this);

            return(ExportHelper.Compress(settingsXml));
        }
Ejemplo n.º 19
0
 public void CopyTo(TownRunSetting setting)
 {
     TrinitySetting.CopyTo(this, setting);
 }
Ejemplo n.º 20
0
 public void Reset()
 {
     TrinitySetting.Reset(this);
     Initialization();
 }
Ejemplo n.º 21
0
 public TownRunSetting Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 22
0
 public ItemListSettings Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 23
0
 public void CopyTo(WizardSetting setting)
 {
     TrinitySetting.CopyTo(this, setting);
 }
Ejemplo n.º 24
0
 public ItemSetting Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 25
0
 public WizardSetting Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 26
0
 public CrusaderSetting Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 27
0
 public void CopyTo(PickupSetting setting)
 {
     TrinitySetting.CopyTo(this, setting);
 }
Ejemplo n.º 28
0
 public void Reset()
 {
     TrinitySetting.Reset(this);
 }
Ejemplo n.º 29
0
 public PickupSetting Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 30
0
 public CombatSetting Clone()
 {
     return(TrinitySetting.Clone(this));
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigViewModel" /> class.
 /// </summary>
 /// <param name="model">The model.</param>
 public ConfigViewModel(TrinitySetting model)
 {
     _OriginalModel = model;
     _Model         = new TrinitySetting();
     _OriginalModel.CopyTo(_Model);
     InitializeResetCommand();
     SaveCommand = new RelayCommand(
         (parameter) =>
     {
         _Model.CopyTo(_OriginalModel);
         _OriginalModel.Save();
         GilesTrinity.SetBotTPS();
         GilesTrinity.SetUnstuckProvider();
         GilesTrinity.SetItemManagerProvider();
         UILoader.CloseWindow();
     });
     TestScoreCommand = new RelayCommand(
         (parameter) =>
     {
         try
         {
             GilesTrinity.TestScoring();
             UILoader.CloseWindow();
         }
         catch (Exception ex)
         {
             DbHelper.Log(LogCategory.UserInformation, "{0}", ex);
         }
     });
     OrderStashCommand = new RelayCommand(
         (parameter) =>
     {
         try
         {
             global::GilesTrinity.TownRun.SortStash();
             UILoader.CloseWindow();
         }
         catch (Exception ex)
         {
             DbHelper.Log(LogCategory.UserInformation, "{0}", ex);
         }
     });
     HelpLinkCommand = new RelayCommand(
         (parameter) =>
     {
         string link = parameter as string;
         if (!string.IsNullOrWhiteSpace(link))
         {
             Process.Start(link);
         }
     });
     ConfigureLootToHunting = new RelayCommand(
         (parameter) =>
     {
         ConfigHuntingLoot();
     });
     ConfigureLootToQuesting = new RelayCommand(
         (parameter) =>
     {
         ConfigQuestingLoot();
     });
     LoadItemRuleSetCommand = new RelayCommand(
         (parameter) =>
     {
         LoadItemRulesPath();
     });
 }