public static void Start(object sender, EventArgs e) { Stopwatch sw = Stopwatch.StartNew(); Direct3D.RegisterCallbacks( ObjectManager = new ObjectManager(), ExecutionQueue = new EndSceneExecute(), Movement = new Movement(), Events = new WoWEvents(), Spellbook = new SpellCollection(), Scripts = new ScriptManager() ); Helper.Initialize(); Helper.FixInvalidPtrCheck(); DBC = new WoWDB(); Quests = new QuestCollection(); Inventory = new WoWInventory(); Camera = new WoWCamera(); Console = new WoWConsole(); ClientServices = new WoWClientServices(); sw.Stop(); Log.WriteLine(LogType.Good, "Initialization took {0} ms", sw.ElapsedMilliseconds); }
private static bool IsCompleteableAutosplit(AutoSplit autoSplit, QuestCollection currentQuests, DataReadEventArgs eventArgs, GameDifficulty difficulty) { if (autoSplit.IsReached || !autoSplit.MatchesDifficulty(difficulty)) { return(false); } switch (autoSplit.Type) { case AutoSplit.SplitType.CharLevel: return(autoSplit.Value <= eventArgs.Character.Level); case AutoSplit.SplitType.Area: return(autoSplit.Value == eventArgs.CurrentArea); case AutoSplit.SplitType.Item: return(eventArgs.ItemIds.Contains(autoSplit.Value)); case AutoSplit.SplitType.Quest: return(currentQuests != null && currentQuests.IsQuestCompleted((QuestId)autoSplit.Value)); case AutoSplit.SplitType.Gems: return(eventArgs.ItemIds.Contains(autoSplit.Value)); } return(false); }
public MainViewModel(QuestCollectionWrapper config, HttpClientHandler handler, IPageProvider pageProvider, ITextResultsProvider textResults, IErrorLogger errorLogger, Func <string, CompareInfo, CompareOptions, int> hashFunction) { ErrorLog.LogUsing(errorLogger); Agnostic.HashStringsUsing(hashFunction); if (config != null) { QuestList = config.QuestCollection; QuestList.Sort(); SelectQuest(config.CurrentQuest); } else { QuestList = new QuestCollection(); SelectQuest(null); } SetupNetwork(pageProvider, handler); SetupTextResults(textResults); AllVotesCollection = new ObservableCollectionExt <string>(); AllVotersCollection = new ObservableCollectionExt <string>(); BuildCheckForNewRelease(); BuildTally(); BindVoteCounter(); SetupCommands(); }
public ViewModelService Configure(QuestCollection quests, string currentQuest) { if (this.quests == null) { this.quests = quests; } this.currentQuest = currentQuest; return(this); }
private void Awake() { _center = new Center(); _center.Name = "Digital Humanities Initiative (DHi)"; _center.Description = "The Digital Humanities Initiative (DHi) at Hamilton College"; _center.Type = CenterType.LiberalArts; _center.Stats.Add(StatType.Funding, new Stat("Funding", 133300)); _center.Stats.Add(StatType.Recognition, new Stat("Recognition", 2)); _center.Stats.Add(StatType.Support, new Stat("Support", 1)); GameObject _uiPanel = Instantiate(Resources.Load("CenterPanel", typeof(GameObject))) as GameObject; _uiPanel.GetComponent <RectTransform>().SetParent(_canvas); _uiPanel.GetComponent <RectTransform>().anchoredPosition = new Vector3(10, -10, 0); _uiPanel.GetComponent <RectTransform>().localScale = Vector3.one; _center.UI = _uiPanel.GetComponent <UICenterPanel>(); _center.UI.Center = _center; _center.UI.Setup(); StaffCollection staff = new StaffCollection(_center); _center.Staff = staff; _center.Staff.OnRosterChange += UI.OnStaffRosterChange; _achievements = new AchievementCollection(); Achievement newAchievement = new Achievement(_center.Stats[StatType.Recognition], 100); newAchievement.Name = "Gettin' that Street Cred"; _achievements.Achievements.Add(newAchievement); newAchievement = new Achievement(_center.Staff, SkillType.Technologist); newAchievement.Name = "Prettier Colors"; _achievements.Achievements.Add(newAchievement); newAchievement = new Achievement(_center.Staff, 1); newAchievement.Name = "It Takes Two"; _achievements.Achievements.Add(newAchievement); newAchievement = new Achievement(_center.Staff, 5); newAchievement.Name = "It's a Party!"; _achievements.Achievements.Add(newAchievement); // Debug.Log(newPlayer.Name + " is level " + newPlayer.Level + " and needs " + newPlayer.XPRequired + "xp to level up."); // Debug.Log(newPlayer.Name + "'s Satisfaction is " + newPlayer.Satisfaction + " and Productiveness is " + newPlayer.Productiveness); _quests = new DefaultQuests(); // Debug.Log(_quests.QuestDictionary[1].Name); _quests.List[1].Activate(); }
public void Start() { ManagerServices.Instance.GetService <QuestSubscriptionHandler>().AddSubscriber(this); List <Quest> questList = QuestCollection.GetInstance().quests; foreach (Quest quest in questList) { Notify(quest); } }
/// <summary> /// Loads the configuration information into the provided quest wrapper. /// Global information is stored in the advanced options instance. /// </summary> /// <param name="quests">The collection of saved quests.</param> /// <param name="currentQuest">The currently selected quest.</param> /// <param name="options">The program configuration options.</param> public void Load(out QuestCollection quests, out string currentQuest, AdvancedOptions options) { currentQuest = CurrentQuest; quests = new QuestCollection(); foreach (QuestElement questElement in Quests) { try { Quest q = new Quest { DisplayName = questElement.DisplayName, ThreadName = questElement.ThreadName, PostsPerPage = questElement.PostsPerPage, StartPost = questElement.StartPost, EndPost = questElement.EndPost, CheckForLastThreadmark = questElement.CheckForLastThreadmark, PartitionMode = questElement.PartitionMode, UseCustomThreadmarkFilters = questElement.UseCustomThreadmarkFilters, CustomThreadmarkFilters = questElement.CustomThreadmarkFilters, UseCustomUsernameFilters = questElement.UseCustomUsernameFilters, CustomUsernameFilters = questElement.CustomUsernameFilters, UseCustomPostFilters = questElement.UseCustomPostFilters, CustomPostFilters = questElement.CustomPostFilters, WhitespaceAndPunctuationIsSignificant = questElement.WhitespaceAndPunctuationIsSignificant, CaseIsSignificant = questElement.CaseIsSignificant, ForcePlanReferencesToBeLabeled = questElement.ForcePlanReferencesToBeLabeled, ForbidVoteLabelPlanNames = questElement.ForbidVoteLabelPlanNames, DisableProxyVotes = questElement.DisableProxyVotes, ForcePinnedProxyVotes = questElement.ForcePinnedProxyVotes, IgnoreSpoilers = questElement.IgnoreSpoilers, TrimExtendedText = questElement.TrimExtendedText, UseRSSThreadmarks = questElement.UseRSSThreadmarks, }; quests.Add(q); } catch (Exception) { continue; } } if (options != null) { options.DisplayMode = DisplayMode; options.AllowRankedVotes = AllowRankedVotes; options.GlobalSpoilers = GlobalSpoilers; options.DisplayPlansWithNoVotes = DisplayPlansWithNoVotes; options.DisableWebProxy = DisableWebProxy; } }
public QuestCollectionWrapper(QuestCollection questCollection, string currentQuest) { if (questCollection == null) { QuestCollection = new QuestCollection(); CurrentQuest = null; } else { QuestCollection = questCollection; CurrentQuest = currentQuest; } }
/// <summary> /// Initializes the quests when defining the view model. /// Must be set separately from the class construction to avoid circular /// references when raising events. /// Takes the provided collection of quests and initializes the ViewModel /// with them. Sets the current quest, if provided. /// </summary> /// <param name="quests">The quests.</param> /// <param name="currentQuest">The currently selected quest.</param> public void InitializeQuests(QuestCollection quests, string currentQuest) { if (quests != null) { QuestList = quests; QuestList.Sort(); SelectQuest(currentQuest); } else { QuestList = new QuestCollection(); SelectQuest(null); } }
void UpdateQuestData(QuestCollection quests, GameDifficulty difficulty) { QuestDebugRow[,] rows = questRows[difficulty]; foreach (var quest in quests) { try { rows[quest.Act - 1, quest.ActOrder - 1].Update(quest); } catch (NullReferenceException) { // System.NullReferenceException } } }
/// <summary> /// Saves the data from the specified quests wrapper into the config file. /// Tries to save in both the portable location (same directory as the executable), /// and to the roaming location (AppData). /// The portable location is transferable between computers without needing /// a corresponding user account, while the roaming location keeps data from /// being lost if you unzip a new version of the program to a differently-named /// folder. /// </summary> /// <param name="quests">The quests wrapper.</param> public static void Save(QuestCollection quests, string currentQuest, AdvancedOptions options) { // If there's nothing to save, don't do anything. if (quests == null) { return; } // Write to each config location (portable and roaming) List <Configuration> configs = NetTallyConfigHelper.GetConfigsToWriteTo(); foreach (var config in configs) { WriteConfigInformation(config, quests, currentQuest, options); } }
private void Awake() { // _center = new Center(); // _center.Name = "Digital Humanities Initiative (DHi)"; // _center.Description = "The Digital Humanities Initiative (DHi) at Hamilton College"; // _center.Type = CenterType.LiberalArts; // _center.Stats.Add(StatType.Funding, new Stat("Funding", 133300)); // _center.Stats.Add(StatType.Recognition, new Stat("Recognition", 2)); // _center.Stats.Add(StatType.Support, new Stat("Support", 1)); // GameObject _uiPanel = Instantiate(Resources.Load("CenterPanel", typeof(GameObject))) as GameObject; // _uiPanel.GetComponent<RectTransform>().SetParent(_canvas); // _uiPanel.GetComponent<RectTransform>().anchoredPosition = new Vector3(10, -10, 0); // _uiPanel.GetComponent<RectTransform>().localScale = Vector3.one; // _center.UI = _uiPanel.GetComponent<UICenterPanel>(); // _center.UI.Center = _center; // _center.UI.Setup(); // StaffCollection staff = new StaffCollection(_center); // _center.Staff = staff; // _center.Staff.OnRosterChange += UI.OnStaffRosterChange; // _achievements = new AchievementCollection(); // Achievement newAchievement = new Achievement(_center.Stats[StatType.Recognition], 100); // newAchievement.Name = "Gettin' that Street Cred"; // _achievements.Achievements.Add(newAchievement); // newAchievement = new Achievement(_center.Staff, SkillType.Technologist); // newAchievement.Name = "Prettier Colors"; // _achievements.Achievements.Add(newAchievement); // newAchievement = new Achievement(_center.Staff, 1); // newAchievement.Name = "It Takes Two"; // _achievements.Achievements.Add(newAchievement); // newAchievement = new Achievement(_center.Staff, 5); // newAchievement.Name = "It's a Party!"; // _achievements.Achievements.Add(newAchievement); _quests = new DefaultQuests(); // _quests.List[1].Activate(); }
public void InitQuestDependencyData() { QuestCollection collection = MonoBehaviourSingleton <QuestManager> .I.questCollection; if (collection != null) { questTable.ForEach(delegate(QuestTableData data) { EnemyTable.EnemyData enemyData = Singleton <EnemyTable> .I.GetEnemyData((uint)data.GetMainEnemyID()); if (enemyData != null) { collection.Collect(enemyData.type, data.questType); } }); collection.Sort(); } }
public override void Init() { _questCollection = Resources.Load <QuestCollection>("QuestCollection"); _senderCollection = Resources.Load <SenderCollection>("SenderCollection"); _tweetSpritesCollection = Resources.Load <TweetSpritesCollection>("TweetSpritesCollection"); SetupCurrentTweets(); var questInfo = _questCollection.TryGetQuestInfo(_questIndex); if (questInfo == null) { Debug.LogError("No quests"); return; } _pendingQuestEvents.AddRange(questInfo.QuestEvents); OnQuestStarted(); }
/// <summary> /// Reads the configuration information from the provided configuration object into /// the provided quests collection wrapper. /// </summary> /// <param name="configs">The list of configuration objects to attempt to read.</param> /// <param name="quests">The quests wrapper to store data in.</param> private static void ReadConfigInformation(List <Configuration> configs, out QuestCollection quests, out string currentQuest, AdvancedOptions options) { if (configs.Count > 0) { ConfigurationException failure = null; ConfigPrefs.Strict = true; while (true) { foreach (var config in configs) { try { if (config.Sections[QuestsSection.SectionName] is QuestsSection questsSection) { questsSection.Load(out quests, out currentQuest, options); return; } } catch (ConfigurationException e) { failure = e; } } ConfigPrefs.Strict = !ConfigPrefs.Strict; if (ConfigPrefs.Strict) { break; } } // If all config files generated an error, throw the last one we got. if (failure != null) { throw failure; } } // If nothing was loaded, just provide default values. quests = new QuestCollection(); currentQuest = null; }
/// <summary> /// Writes the data from the provided quests wrapper object into the specified configuration file. /// </summary> /// <param name="quests">The quests wrapper with program data.</param> /// <param name="config">The configuration file to save to.</param> private static void WriteConfigInformation(Configuration config, QuestCollection quests, string currentQuest, AdvancedOptions options) { try { ConfigPrefs.Strict = false; if (config.Sections[QuestsSection.SectionName] is QuestsSection questsSection) { questsSection.Save(quests, currentQuest, options); } config.Save(ConfigurationSaveMode.Minimal); } catch (ConfigurationErrorsException) { // May not have permission to write, or the original config may have errors. } }
/// <summary> /// Function that's run when the program first starts. /// Set up the data context links with the local variables. /// </summary> public MainWindow() { try { _syncContext = SynchronizationContext.Current; // Set up an event handler for any otherwise unhandled exceptions in the code. AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException; // Set up the logger to use the Windows error log. Logger.LogUsing(new WindowsErrorLog()); // Initialize the window. InitializeComponent(); // Set the title. Title = $"{ProductInfo.Name} - {ProductInfo.Version}"; // Load configuration data QuestCollection quests = null; string currentQuest = null; try { NetTallyConfig.Load(out quests, out currentQuest, AdvancedOptions.Instance); } catch (ConfigurationErrorsException e) { MessageBox.Show(e.Message, "Error in configuration. Current configuration ignored.", MessageBoxButton.OK, MessageBoxImage.Error); } // Complete the platform setup. PlatformSetup(quests, currentQuest); } catch (Exception e) { Logger.Error("Failure during program startup.", e); MessageBox.Show(e.Message, "Unable to start up. Closing.", MessageBoxButton.OK, MessageBoxImage.Error); this.Close(); } }
/// <summary> /// Saves the information from the provided quest wrapper into this config object. /// Also pulls global advanced options. /// </summary> /// <param name="quests">The collection of saved quests.</param> /// <param name="currentQuest">The currently selected quest.</param> /// <param name="options">The program configuration options.</param> public void Save(QuestCollection quests, string currentQuest, AdvancedOptions options) { if (quests == null) { throw new ArgumentNullException(nameof(quests)); } Quests.Clear(); foreach (var quest in quests) { Quests.Add(quest); } CurrentQuest = currentQuest; if (options != null) { DisplayMode = options.DisplayMode; AllowUsersToUpdatePlans = options.AllowUsersToUpdatePlans; GlobalSpoilers = options.GlobalSpoilers; DisplayPlansWithNoVotes = options.DisplayPlansWithNoVotes; DisableWebProxy = options.DisableWebProxy; } }
/// <summary> /// Set up the program with various platform-specific configurations. /// </summary> /// <param name="quests">The program's config data.</param> private void PlatformSetup(QuestCollection quests, string currentQuest) { try { System.Net.ServicePointManager.DefaultConnectionLimit = 4; System.Net.ServicePointManager.Expect100Continue = true; System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; mainViewModel = ViewModelService.Instance .Configure(quests, currentQuest) .HashAgnosticStringsUsing(UnicodeHashFunction.HashFunction) .Build(); DataContext = mainViewModel; mainViewModel.PropertyChanged += MainViewModel_PropertyChanged; mainViewModel.ExceptionRaised += MainViewModel_ExceptionRaised; ViewModelService.MainViewModel.CheckForNewRelease(); } catch (InvalidOperationException e) { Logger.Error("Invalid operation during platform setup.", e); } }
/// <summary> /// Loads the program user data config and returns a collection of /// quests. /// </summary> /// <returns>Returns the quests wrapper to store data in.</returns> public static void Load(out QuestCollection quests, out string currentQuest, AdvancedOptions options) { List <Configuration> configs = NetTallyConfigHelper.GetConfigsToLoadFrom(); ReadConfigInformation(configs, out quests, out currentQuest, options); }
/// <summary> /// Loads the configuration information into the provided quest wrapper. /// Global information is stored in the advanced options instance. /// </summary> /// <param name="quests">The collection of saved quests.</param> /// <param name="currentQuest">The currently selected quest.</param> /// <param name="options">The program configuration options.</param> public void Load(out QuestCollection quests, out string currentQuest, AdvancedOptions?options) { currentQuest = CurrentQuest; quests = new QuestCollection(); Dictionary <IQuest, string> linkedQuestNames = new Dictionary <IQuest, string>(); foreach (QuestElement?questElement in Quests) { if (questElement == null) { continue; } try { Quest q = new Quest { DisplayName = questElement.DisplayName, ThreadName = questElement.ThreadName, PostsPerPage = questElement.PostsPerPage, StartPost = questElement.StartPost, EndPost = questElement.EndPost, CheckForLastThreadmark = questElement.CheckForLastThreadmark, PartitionMode = questElement.PartitionMode, UseCustomThreadmarkFilters = questElement.UseCustomThreadmarkFilters, CustomThreadmarkFilters = questElement.CustomThreadmarkFilters, UseCustomUsernameFilters = questElement.UseCustomUsernameFilters, CustomUsernameFilters = questElement.CustomUsernameFilters, UseCustomPostFilters = questElement.UseCustomPostFilters, CustomPostFilters = questElement.CustomPostFilters, WhitespaceAndPunctuationIsSignificant = questElement.WhitespaceAndPunctuationIsSignificant, CaseIsSignificant = questElement.CaseIsSignificant, ForcePlanReferencesToBeLabeled = questElement.ForcePlanReferencesToBeLabeled, ForbidVoteLabelPlanNames = questElement.ForbidVoteLabelPlanNames, AllowUsersToUpdatePlans = questElement.AllowUsersToUpdatePlans, DisableProxyVotes = questElement.DisableProxyVotes, ForcePinnedProxyVotes = questElement.ForcePinnedProxyVotes, IgnoreSpoilers = questElement.IgnoreSpoilers, TrimExtendedText = questElement.TrimExtendedText, UseRSSThreadmarks = questElement.UseRSSThreadmarks, }; if (!string.IsNullOrEmpty(questElement.LinkedQuests)) { linkedQuestNames[q] = questElement.LinkedQuests; } quests.Add(q); } catch (Exception) { continue; } } foreach (var(quest, linkedNames) in linkedQuestNames) { var names = linkedNames.Split(new char[] { '⦂' }); foreach (var name in names) { var linkedQuest = quests.FirstOrDefault(q => q.ThreadName == name); if (linkedQuest != null) { quest.LinkedQuests.Add(linkedQuest); } } } if (options != null) { options.DisplayMode = DisplayMode; options.AllowUsersToUpdatePlans = AllowUsersToUpdatePlans; options.GlobalSpoilers = GlobalSpoilers; options.DisplayPlansWithNoVotes = DisplayPlansWithNoVotes; options.DisableWebProxy = DisableWebProxy; } }
public override void UpdateUI() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown int i = 0; for (int num = enemyButton.Length; i < num; i++) { SetActive(GetCtrl(enemyButton[i]).get_parent(), false); } QuestCollection questCollection = MonoBehaviourSingleton <QuestManager> .I.questCollection; questCollection.GetEnemyTypeList(QUEST_TYPE.ORDER)?.ForEach(delegate(ENEMY_TYPE _enemy) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown int num7 = (int)(_enemy - 1); SetActive(GetCtrl(enemyButton[num7]).get_parent(), true); }); base.GetComponent <UIGrid>((Enum)UI.GRD_ENEMY).Reposition(); UpdateAnchors(); int j = 0; for (int num2 = enemyButton.Length; j < num2; j++) { bool value = (sortOrder.type & (1 << j)) != 0; SetEvent((Enum)enemyButton[j], "ENEMY", j); SetToggle(GetCtrl(enemyButton[j]).get_parent(), value); } int num3 = 1035; int k = 0; for (int num4 = requirementButton.Length; k < num4; k++) { int num5 = (int)requirementValue[k]; if ((num5 & num3) != 0) { bool value2 = sortOrder.requirement == (SORT_REQUIREMENT)num5; SetEvent((Enum)requirementButton[k], "REQUIREMENT", num5); SetToggle((Enum)requirementButton[k], value2); } else { SetActive((Enum)requirementButton[k], false); } } int l = 0; for (int num6 = ascButton.Length; l < num6; l++) { bool value3 = false; if ((l == 0 && sortOrder.orderTypeAsc) || (l == 1 && !sortOrder.orderTypeAsc)) { value3 = true; } SetEvent((Enum)ascButton[l], "ORDER_TYPE", l); SetToggle((Enum)ascButton[l], value3); } }
public QuestCollectionWrapper() { QuestCollection = new QuestCollection(); CurrentQuest = null; }