// Constructor public SkillItem(long ID, string name) { this.ID = ID; Name = name.Replace("\0", ""); _apiSkill = GW2APIController.GetAPISkill(ID); CompleteItem(); }
private void RetrySkillList_Click(object sender, EventArgs e) { //Update skill list GW2APIController tempcontroller = new GW2APIController(); tempcontroller.RetryWriteSkillListtoFile(); }
public SkillItem(long ID, string name, GW2APIController apiController) { this.ID = ID; Name = name.Replace("\0", ""); ApiSkill = apiController.GetSkill(ID); CompleteItem(); }
private void ResetSkillListClick(object sender, EventArgs e) { //Update skill list GW2APIController tempcontroller = new GW2APIController(); tempcontroller.WriteSkillListToFile(); }
private void ResetSkillListClick(object sender, EventArgs e) { //Update skill list GW2APIController tempcontroller = new GW2APIController(); tempcontroller.WriteSkillListToFile(); MessageBox.Show("Skill List has been redone"); }
public EvtcParser(EvtcParserSettings parserSettings, GW2APIController apiController) { _apiController = apiController; _parserSettings = parserSettings; _allAgentsList = new List <AgentItem>(); _combatItems = new List <CombatItem>(); _playerList = new List <Player>(); _logStartTime = 0; _logEndTime = 0; _enabledExtensions = new Dictionary <uint, AbstractExtensionHandler>(); }
public EvtcParser(EvtcParserSettings parserSettings, GW2EIGW2API.GW2APIController apiController) { _apiController = apiController; _parserSettings = parserSettings; _allAgentsList = new List <AgentItem>(); _skillData = new SkillData(apiController); _combatItems = new List <CombatItem>(); _playerList = new List <Player>(); _logStartTime = 0; _logEndTime = 0; }
public SkillItem(long ID, String name, GW2APIController apiController) { this.ID = ID; Name = name.Replace("\0", ""); ApiSkill = apiController.GetSkill(ID); if (ApiSkill != null) { Name = ApiSkill.name; } CompleteItem(); }
//setter public void SetGW2APISkill(GW2APIController apiController) { if (ApiSkill == null) { GW2APISkill skillAPI = apiController.GetSkill(ID); if (skillAPI != null) { ApiSkill = skillAPI; _name = skillAPI.name; } } }
public void TestCrashed() { GW2APIController.InitAPICache(); string testLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/../../GW2EIParser.tst/EvtcLogs/Crashes/Logs"; if (!Directory.Exists(testLocation)) { Directory.CreateDirectory(testLocation); } var failed = new BlockingCollection <string>(); int failedCount = 0; var messages = new BlockingCollection <string>(); var toCheck = Directory.EnumerateFiles(testLocation, "*.zevtc", SearchOption.AllDirectories).ToList(); foreach (string file in toCheck) { if (Loop(failed, messages, file)) { File.Delete(file); } } GenerateCrashData(failed, messages, "zevtc_remaining", false); failedCount += failed.Count; toCheck = Directory.EnumerateFiles(testLocation, "*.evtc", SearchOption.AllDirectories).ToList(); foreach (string file in toCheck) { if (Loop(failed, messages, file)) { File.Delete(file); } } GenerateCrashData(failed, messages, "evtc_remaining", false); failedCount += failed.Count; toCheck = Directory.EnumerateFiles(testLocation, "*.evtc.zip", SearchOption.AllDirectories).ToList(); foreach (string file in toCheck) { if (Loop(failed, messages, file)) { File.Delete(file); } } GenerateCrashData(failed, messages, "evtczip_remaining", false); failedCount += failed.Count; Assert.IsTrue(failedCount == 0, "Check Crashes folder"); }
// Constructor internal SkillItem(long ID, string name, GW2APIController apiController) { this.ID = ID; Name = name.Replace("\0", ""); ApiSkill = apiController.GetAPISkill(ID); // if (_overrideNames.TryGetValue(ID, out string overrideName)) { Name = overrideName; } else if (ApiSkill != null && UnknownSkill) { Name = ApiSkill.Name; } if (_overrideIcons.TryGetValue(ID, out string icon)) { Icon = icon; } else { Icon = ApiSkill != null ? ApiSkill.Icon : DefaultIcon; } if (ApiSkill != null && ApiSkill.Type == "Weapon" && ApiSkill.WeaponType != "None" && ApiSkill.Professions.Count > 0 && (ApiSkill.Categories == null || ApiSkill.Categories.Count == 0 || ApiSkill.Categories.Contains("Clone") || ApiSkill.Categories.Contains("Phantasm") || ApiSkill.Categories.Contains("DualWield"))) { _weaponDescriptor = new WeaponDescriptor(ApiSkill); } AA = (ApiSkill?.Slot == "Weapon_1" || ApiSkill?.Slot == "Downed_1"); if (AA) { if (ApiSkill.Categories != null) { AA = AA && !ApiSkill.Categories.Contains("StealthAttack") && !ApiSkill.Categories.Contains("Ambush"); // Ambush in case one day it's added } if (ApiSkill.Description != null) { AA = AA && !ApiSkill.Description.Contains("Ambush."); } } #if DEBUG Name += " (" + ID + ")"; #endif }
public void TestEvtcZip() { GW2APIController.InitAPICache(); string testLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/../../GW2EIParser.tst/EvtcLogs/StabilityTest"; if (!Directory.Exists(testLocation)) { Directory.CreateDirectory(testLocation); } Assert.IsTrue(Directory.Exists(testLocation), "Test Directory missing"); var failed = new BlockingCollection <string>(); var messages = new BlockingCollection <string>(); var toCheck = Directory.EnumerateFiles(testLocation, "*.evtc.zip", SearchOption.AllDirectories).ToList(); Parallel.ForEach(toCheck, file => Loop(failed, messages, file)); GenerateCrashData(failed, messages, "evtczip", true); Assert.IsTrue(failed.Count == 0, "Check Crashes folder"); }
/// <summary> /// Parses skill related data /// </summary> private void ParseSkillData(Stream stream) { var apiController = new GW2APIController(); using (var reader = CreateReader(stream)) { // 4 bytes: player count uint skillCount = reader.ReadUInt32(); //TempData["Debug"] += "Skill Count:" + skill_count.ToString(); // 68 bytes: each skill for (int i = 0; i < skillCount; i++) { // 4 bytes: skill ID int skillId = reader.ReadInt32(); // 64 bytes: name var name = ParseHelper.GetString(stream, 64); //Save var skill = new SkillItem(skillId, name, apiController); _skillData.Add(skill); } } }
private static int Main(string[] args) { // Migrate previous settings if version changed if (Properties.Settings.Default.Outdated) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.Outdated = false; } var logFiles = new List <string>(); bool uiMode = true; Application.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); if (args.Length > 0) { uiMode = false; int parserArgOffset = 0; if (args.Contains("-h")) { Console.WriteLine("GuildWars2EliteInsights.exe [arguments] [logs...]"); Console.WriteLine(""); Console.WriteLine("-c [config path] : use another config file"); Console.WriteLine("-p : disable windows specific functions"); Console.WriteLine("-ui : runs in the application with user interface"); Console.WriteLine("-h : help"); return(0); } if (args.Contains("-ui")) { parserArgOffset += 1; uiMode = true; } if (args.Contains("-p")) { parserArgOffset += 1; } else { /* * Magic for windows: * - opens a console window if used from a non-console with command line options * - fixes output on windows cmd (other consoles tested behaved better)(otherwise no console output or piped file output) * * We need to do this, because the console output is lazy initialized * and if we are redirecting to a file or pipe we want to make sure Console.out points to the correct handle * and doesn't init with the console ignoring existing stdout */ if (IsRedirected(GetStdHandle(StandardHandle.Output))) { _ = Console.Out; } if (!AttachConsole(AttachParentProcess)) { AllocConsole(); } AttachConsole(AttachParentProcess); } if (args.Contains("-c")) { if (args.Length - parserArgOffset >= 2) { // Do not access settings before this, else this will not work int argPos = Array.IndexOf(args, "-c"); CustomSettingsManager.ReadConfig(args[argPos + 1]); parserArgOffset += 2; } else { Console.WriteLine("More arguments required for option -c:"); Console.WriteLine("GuildWars2EliteInsights.exe -c [config path] [logs]"); return(0); } } for (int i = parserArgOffset; i < args.Length; i++) { logFiles.Add(args[i]); } } ProgramHelper.htmlAssets = new HTMLAssets(); GW2APIController.InitAPICache(); if (uiMode) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var form = new MainForm(logFiles); Application.Run(form); form.Dispose(); } else { if (logFiles.Count > 0) { // Use the application through console _ = new ConsoleProgram(logFiles); return(0); } } return(0); }
public EliteInsightsLogChecker(GW2APIController eiApiController) { this.eiApiController = eiApiController; }
private void ResetSpecListClick(object sender, EventArgs e) { //Update skill list GW2APIController.WriteAPISpecsToFile(); MessageBox.Show("Spec List has been redone"); }
/// <summary> /// Parses agent related data /// </summary> private void ParseAgentData(Stream stream) { using (BinaryReader reader = CreateReader(stream)) { // 4 bytes: player count int playerCount = reader.ReadInt32(); // 96 bytes: each player for (int i = 0; i < playerCount; i++) { // 8 bytes: agent ulong agent = reader.ReadUInt64(); // 4 bytes: profession uint prof = reader.ReadUInt32(); // 4 bytes: is_elite uint isElite = reader.ReadUInt32(); // 2 bytes: toughness uint toughness = reader.ReadUInt16(); // 2 bytes: healing uint concentration = reader.ReadUInt16(); // 2 bytes: healing uint healing = reader.ReadUInt16(); // 2 bytes: hitbox width uint hbWidth = (uint)2 * reader.ReadUInt16(); // 2 bytes: condition uint condition = reader.ReadUInt16(); // 2 bytes: hitbox height uint hbHeight = (uint)2 * reader.ReadUInt16(); // 68 bytes: name string name = ParseHelper.GetString(stream, 68, false); //Save string agentProf = GW2APIController.GetAgentProfString(prof, isElite); AgentItem.AgentType type; ushort ID = 0; switch (agentProf) { case "NPC": // NPC try { ID = ushort.Parse(prof.ToString().PadLeft(5, '0')); } catch (FormatException) { ID = 0; } type = AgentItem.AgentType.NPC; break; case "GDG": // Gadget try { ID = ushort.Parse((prof & 0x0000ffff).ToString().PadLeft(5, '0')); } catch (FormatException) { ID = 0; } type = AgentItem.AgentType.Gadget; break; default: // Player type = AgentItem.AgentType.Player; break; } _allAgentsList.Add(new AgentItem(agent, name, agentProf, ID, type, toughness, healing, condition, concentration, hbWidth, hbHeight)); } } }
// Public Methods public string getProf(string build, GW2APIController apiController) { if (is_elite == 0xFFFFFFFF) { if ((prof & 0xffff0000) == 0xffff0000) { return("GDG"); } else { return("NPC"); } } else if (is_elite == 0) { switch (prof) { case 1: return("Guardian"); case 2: return("Warrior"); case 3: return("Engineer"); case 4: return("Ranger"); case 5: return("Thief"); case 6: return("Elementalist"); case 7: return("Mesmer"); case 8: return("Necromancer"); case 9: return("Revenant"); } } else if (Convert.ToInt32(build.Substring(4, 8)) < 20170914) { if (is_elite == 1) { switch (prof + 9) { case 10: return("Dragonhunter"); case 11: return("Berserker"); case 12: return("Scrapper"); case 13: return("Druid"); case 14: return("Daredevil"); case 15: return("Tempest"); case 16: return("Chronomancer"); case 17: return("Reaper"); case 18: return("Herald"); } } } else if (Convert.ToInt32(build.Substring(4, 8)) >= 20170914) { if (is_elite == 1) { switch (prof + 9) { case 10: return("Dragonhunter"); case 11: return("Berserker"); case 12: return("Scrapper"); case 13: return("Druid"); case 14: return("Daredevil"); case 15: return("Tempest"); case 16: return("Chronomancer"); case 17: return("Reaper"); case 18: return("Herald"); } } else if (is_elite > 1) { switch (is_elite) { case 55: return("Soulbeast"); case 56: return("Weaver"); case 57: return("Holosmith"); case 58: return("Deadeye"); case 59: return("Mirage"); case 60: return("Scourge"); case 61: return("Spellbreaker"); case 62: return("Firebrand"); case 63: return("Renegade"); } GW2APISpec spec = apiController.GetSpec((int)is_elite); if (spec.elite) { return(spec.name); } else { return(spec.profession); } } } return(null); }
private static string GetAgentProfString(uint prof, uint elite) { // non player if (elite == 0xFFFFFFFF) { if ((prof & 0xffff0000) == 0xffff0000) { return("GDG"); } else { return("NPC"); } } // base profession else if (elite == 0) { switch (prof) { case 1: return("Guardian"); case 2: return("Warrior"); case 3: return("Engineer"); case 4: return("Ranger"); case 5: return("Thief"); case 6: return("Elementalist"); case 7: return("Mesmer"); case 8: return("Necromancer"); case 9: return("Revenant"); } } // old elite else if (elite == 1) { switch (prof) { case 1: return("Dragonhunter"); case 2: return("Berserker"); case 3: return("Scrapper"); case 4: return("Druid"); case 5: return("Daredevil"); case 6: return("Tempest"); case 7: return("Chronomancer"); case 8: return("Reaper"); case 9: return("Herald"); } } // new way else { GW2APISpec spec = GW2APIController.GetAPISpec((int)elite); if (spec == null) { throw new InvalidOperationException("Missing or outdated GW2 API Cache"); } if (spec.Elite) { return(spec.Name); } else { return(spec.Profession); } } throw new InvalidDataException("Unknown profession"); }
private void BtnResetTraitListClick(object sender, EventArgs e) { //Update skill list GW2APIController.WriteAPITraitsToFile(); MessageBox.Show("Trait List has been redone"); }