private void BotEvents_OnBotStop(EventArgs args) { ConfigSnapshot tmpOriginalConfiguration = _persistData.OriginalConfiguration; // Restore the user's original configuration, since the bot is stopping... if (tmpOriginalConfiguration != null) { string tmpChanges = tmpOriginalConfiguration.Restore(); if (_persistData.DebugShowChangesApplied) { LogMessage("info", "Bot stopping. Original user settings restored as follows...\n" + tmpChanges); } // Remove our OnBotStop handler BotEvents.OnBotStop -= BotEvents_OnBotStop; // Done with our persistent data, since the bot is stopping -- // We want to prevent acting on stale data when the bot is restarted. _persistData.DePersistData(); } }
// To add, adjust, or remove presets, this is the only method that needs to be modified... // All other code in this class uses the information contained in the returned presetChangeRequests. // Note: If you make a spelling error while maintaining this code, by design an exception will be thrown // at runtime pointing you directly to the problem. private static Dictionary <string, ConfigurationChangeRequest> UtilBuildPresetChangeRequests(Dictionary <string, ConfigDescriptor> configurationSettings, ConfigSnapshot originalConfiguration) { Dictionary <string, ConfigurationChangeRequest> presets = new Dictionary <string, ConfigurationChangeRequest>(); presets.Add("Grind", new ConfigurationChangeRequest(configurationSettings) .Add("GroundMountFarmingMode", false) .Add("KillBetweenHotspots", true) .Add("PullDistance", 50) .Add("UseMount", false) ); presets.Add("HarvestsOff", new ConfigurationChangeRequest(configurationSettings) .Add("HarvestHerbs", false) .Add("HarvestMinerals", false) .Add("LootChests", false) .Add("LootMobs", false) .Add("NinjaSkin", false) .Add("SkinMobs", false) ); presets.Add("HarvestsOn", new ConfigurationChangeRequest(configurationSettings) .Add("HarvestHerbs", (StyxWoW.Me.GetSkill(Styx.SkillLine.Herbalism).MaxValue > 0)) .Add("HarvestMinerals", (StyxWoW.Me.GetSkill(Styx.SkillLine.Mining).MaxValue > 0)) .Add("LootChests", true) .Add("LootMobs", true) .Add("LootRadius", 45) .Add("NinjaSkin", (StyxWoW.Me.GetSkill(Styx.SkillLine.Skinning).MaxValue > 0)) .Add("SkinMobs", (StyxWoW.Me.GetSkill(Styx.SkillLine.Skinning).MaxValue > 0)) ); presets.Add("NoDistractions", new ConfigurationChangeRequest(configurationSettings) .Add("GroundMountFarmingMode", true) .Add("HarvestHerbs", false) .Add("HarvestMinerals", false) .Add("KillBetweenHotspots", false) .Add("LootChests", false) .Add("LootMobs", false) .Add("NinjaSkin", false) .Add("PullDistance", 1) .Add("SkinMobs", false) .Add("TrainNewSkills", false) ); presets.Add("NoTrain", new ConfigurationChangeRequest(configurationSettings) .Add("TrainNewSkills", false) .Add("FindVendorsAutomatically", false) ); presets.Add("NormalQuesting", new ConfigurationChangeRequest(configurationSettings) .Add("FindMountAutomatically", true) .Add("FindVendorsAutomatically", true) .Add("GroundMountFarmingMode", false) .Add("HarvestHerbs", (StyxWoW.Me.GetSkill(Styx.SkillLine.Herbalism).MaxValue > 0)) .Add("HarvestMinerals", (StyxWoW.Me.GetSkill(Styx.SkillLine.Mining).MaxValue > 0)) .Add("KillBetweenHotspots", false) .Add("LearnFlightPaths", true) .Add("LootChests", true) .Add("LootMobs", true) .Add("LootRadius", 45) .Add("MountDistance", 75) .Add("NinjaSkin", (StyxWoW.Me.GetSkill(Styx.SkillLine.Skinning).MaxValue > 0)) .Add("PullDistance", 30) .Add("RessAtSpiritHealers", false) .Add("SkinMobs", (StyxWoW.Me.GetSkill(Styx.SkillLine.Skinning).MaxValue > 0)) .Add("TrainNewSkills", true) .Add("UseFlightPaths", true) .Add("UseMount", true) .Add("UseRandomMount", true) ); presets.Add("UserOriginal", originalConfiguration.MakeChangeRequest()); return(presets); }