/// <summary> /// Returns an appropriately selected TrinityPower and related information /// </summary> /// <returns></returns> internal static TrinityPower AbilitySelector() { using (new PerformanceLogger("AbilitySelector")) { // See if archon just appeared/disappeared, so update the hotbar if (Trinity.ShouldRefreshHotbarAbilities || Trinity.HotbarRefreshTimer.ElapsedMilliseconds > 5000) { PlayerInfoCache.RefreshHotbar(); } // Switch based on the cached character class TrinityPower power = CurrentPower; using (new PerformanceLogger("AbilitySelector.ClassAbility")) { switch (Player.ActorClass) { // Barbs case ActorClass.Barbarian: power = BarbarianCombat.GetPower(); break; case ActorClass.Crusader: power = CrusaderCombat.GetPower(); break; // Monks //case ActorClass.Monk: // power = GetMonkPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower); // break; //// Wizards //case ActorClass.Wizard: // power = GetWizardPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower); // break; //// Witch Doctors //case ActorClass.Witchdoctor: // power = GetWitchDoctorPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower); // break; //// Demon Hunters //case ActorClass.DemonHunter: // power = GetDemonHunterPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower); // break; } } // use IEquatable to check if they're equal if (CurrentPower == power) { Logger.Log(TrinityLogLevel.Debug, LogCategory.Behavior, "Keeping {0}", CurrentPower.ToString()); return(CurrentPower); } if (power != null) { Logger.Log(TrinityLogLevel.Debug, LogCategory.Behavior, "Selected new {0}", power.ToString()); return(power); } return(DefaultPower); } }
/// <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); } }