From d2bcd89e3d2ad243476cb463ec08dad292b2a88e Mon Sep 17 00:00:00 2001 From: baaron4 Date: Fri, 15 Jun 2018 20:14:43 -0500 Subject: [PATCH] Added ability to toggle phase parsing on and off in settings window --- LuckParser/App.config | 3 ++ LuckParser/Controllers/Controller1.cs | 36 ++++++++++--------- LuckParser/Controllers/HTMLHelper.cs | 20 ++++++----- LuckParser/MainForm.cs | 5 +-- LuckParser/Models/ParseModels/Players/Boss.cs | 11 +++++- LuckParser/Properties/Settings.Designer.cs | 12 +++++++ LuckParser/Properties/Settings.settings | 3 ++ LuckParser/SettingsForm.Designer.cs | 28 +++++++++++++++ LuckParser/SettingsForm.cs | 6 ++++ 9 files changed, 96 insertions(+), 28 deletions(-) diff --git a/LuckParser/App.config b/LuckParser/App.config index d02ede323..e0f0c73c8 100644 --- a/LuckParser/App.config +++ b/LuckParser/App.config @@ -64,6 +64,9 @@ False + + True + \ No newline at end of file diff --git a/LuckParser/Controllers/Controller1.cs b/LuckParser/Controllers/Controller1.cs index 4efe58a9e..6a551f45f 100644 --- a/LuckParser/Controllers/Controller1.cs +++ b/LuckParser/Controllers/Controller1.cs @@ -714,7 +714,7 @@ private void CreateDPSGraph(StreamWriter sw, int phase_index) //Generate DPS graph sw.Write("
"); sw.Write(""); sw.Write(""); { @@ -1349,7 +1349,7 @@ private void CreateDPSTable(StreamWriter sw, int phase_index) { /// Duration of the fight private void CreateDMGStatsTable(StreamWriter sw, int phase_index) { //generate dmgstats table - PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data)[phase_index]; + PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14])[phase_index]; sw.Write(""); sw.Write("
"); { @@ -1480,7 +1480,7 @@ private void CreateDMGStatsTable(StreamWriter sw, int phase_index) { /// Duration of the fight private void CreateDefTable(StreamWriter sw, int phase_index) { //generate Tankstats table - PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data)[phase_index]; + PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14])[phase_index]; sw.Write(""); sw.Write("
"); { @@ -1670,7 +1670,7 @@ private void CreateSupTable(StreamWriter sw, int phase_index) { /// id of the table private void CreateUptimeTable(StreamWriter sw, List list_to_use, string table_id, int phase_index) { - List phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data); + List phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14]); //Generate Boon table------------------------------------------------------------------------------------------------ sw.Write(""); List> footList = new List>(); @@ -1911,7 +1911,7 @@ private void CreateGenSquadTable(StreamWriter sw, List list_to_use, string /// Settings to use private void CreatePlayerTab(StreamWriter sw, bool[] settingsSnap, int phase_index) { - List phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data); + List phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14]); PhaseData phase = phases[phase_index]; long start = phase.getStart() + boss_data.getFirstAware(); long end = phase.getEnd() + boss_data.getFirstAware(); @@ -2202,7 +2202,7 @@ private void CreatePlayerTab(StreamWriter sw, bool[] settingsSnap, int phase_ind private void CreateSimpleRotationTab(StreamWriter sw,Player p,int simpleRotSize, int phase_index) { if (SnapSettings[6])//Display rotation { - PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data)[phase_index]; + PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14])[phase_index]; List casting = p.getCastLogs(boss_data, combat_data.getCombatList(), agent_data, phase.getStart(), phase.getEnd()); GW2APISkill autoSkill = null; int autosCount = 0; @@ -2527,7 +2527,7 @@ private void CreateDMGDistTableBody(StreamWriter sw, bool toBoss, List /// The player private void CreateDMGDistTable(StreamWriter sw, AbstractMasterPlayer p, bool toBoss, int phase_index) { - PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data)[phase_index]; + PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14])[phase_index]; List casting = p.getCastLogs(boss_data, combat_data.getCombatList(), agent_data, phase.getStart(), phase.getEnd()); List damageLogs = p.getJustPlayerDamageLogs(toBoss ? boss_data.getInstid() : 0, boss_data, combat_data.getCombatList(), agent_data, phase.getStart(), phase.getEnd()); string finalDPSdata = HTMLHelper.getFinalDPS(boss_data, combat_data, agent_data, p, boss, phase_index); @@ -2564,7 +2564,7 @@ private void CreateDMGDistTable(StreamWriter sw, AbstractMasterPlayer p, Minions string finalDPSdata = HTMLHelper.getFinalDPS(boss_data, combat_data, agent_data, p, boss, phase_index); int totalDamage = toBoss ? Int32.Parse(finalDPSdata.Split('|')[7]) : Int32.Parse(finalDPSdata.Split('|')[1]); string tabid = p.getInstid() +"_"+phase_index + "_" + minions.getInstid() + (toBoss ? "_boss" : ""); - PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data)[phase_index]; + PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14])[phase_index]; List casting = minions.getCastLogs(boss_data, combat_data.getCombatList(), agent_data, phase.getStart(), phase.getEnd()); List damageLogs = minions.getDamageLogs(toBoss ? boss_data.getInstid() : 0, boss_data, combat_data.getCombatList(), agent_data, phase.getStart(), phase.getEnd()); int finalTotalDamage = damageLogs.Count > 0 ? damageLogs.Sum(x => x.getDamage()) : 0; @@ -2593,7 +2593,7 @@ private void CreateDMGDistTable(StreamWriter sw, AbstractMasterPlayer p, Minions /// The player private void CreateDMGTakenDistTable(StreamWriter sw, Player p, int phase_index) { - PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data)[phase_index]; + PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14])[phase_index]; List damageLogs = p.getDamageTakenLogs(boss_data, combat_data.getCombatList(), agent_data,mech_data, phase.getStart(), phase.getEnd()); List s_list = skill_data.getSkillList(); int finalTotalDamage = damageLogs.Count > 0 ? damageLogs.Sum(x => x.getDamage()) : 0; @@ -2736,7 +2736,7 @@ private void CreateDMGTakenDistTable(StreamWriter sw, Player p, int phase_index) /// Stream writer private void CreateMechanicTable(StreamWriter sw, int phase_index) { Dictionary> presMech = new Dictionary>(); - PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data)[phase_index]; + PhaseData phase = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14])[phase_index]; foreach (Mechanic item in mech_data.GetMechList(boss_data.getID())) { if (mech_data.GetMDataLogs().FirstOrDefault(x => x.GetSkill() == item.GetSkill()) != null) @@ -2960,7 +2960,7 @@ private void CreateCondiUptimeTable(StreamWriter sw,Boss boss, int phase_index) private void CreateBossSummary(StreamWriter sw, int phase_index) { //generate Player list Graphs - List phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data); + List phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14]); PhaseData phase = phases[phase_index]; List casting = boss.getCastLogsActDur(boss_data, combat_data.getCombatList(), agent_data, phase.getStart(), phase.getEnd()); List s_list = skill_data.getSkillList(); @@ -3151,6 +3151,7 @@ public void CreateHTML(StreamWriter sw, bool[] settingsSnap) { SnapSettings = settingsSnap; + HTMLHelper.SnapSettings = settingsSnap; double fight_duration = (boss_data.getAwareDuration()) / 1000.0; TimeSpan duration = TimeSpan.FromSeconds(fight_duration); string durationString = duration.ToString("mm") + "m " + duration.ToString("ss") + "s"; @@ -3160,7 +3161,7 @@ public void CreateHTML(StreamWriter sw, bool[] settingsSnap) } string bossname = FilterStringChars(boss_data.getName()); setPresentBoons(settingsSnap); - List phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data); + List phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data,SnapSettings[14]); // HTML STARTS sw.Write(""); { @@ -3617,11 +3618,13 @@ public void CreateHTML(StreamWriter sw, bool[] settingsSnap) } public void CreateSoloHTML(StreamWriter sw, bool[] settingsSnap) { - List phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data); + List phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14]); double fight_duration = (boss_data.getAwareDuration()) / 1000.0; Player p = p_list[0]; List casting = p.getCastLogsActDur(boss_data, combat_data.getCombatList(), agent_data, 0, boss_data.getAwareDuration()); List s_list = skill_data.getSkillList(); + SnapSettings = settingsSnap; + HTMLHelper.SnapSettings = settingsSnap; CreateDPSTable(sw, 0); CreateDMGStatsTable(sw, 0); @@ -3746,12 +3749,13 @@ public void CreateSoloHTML(StreamWriter sw, bool[] settingsSnap) sw.Write(""); } //Creating CSV--------------------------------------------------------------------------------- - public void CreateCSV(StreamWriter sw,String delimiter) + public void CreateCSV(StreamWriter sw,String delimiter, bool[] settingsSnap) { double fight_duration = (boss_data.getAwareDuration()) / 1000.0; TimeSpan duration = TimeSpan.FromSeconds(fight_duration); String durationString = duration.ToString("mm") +":" + duration.ToString("ss") ; - + SnapSettings = settingsSnap; + HTMLHelper.SnapSettings = settingsSnap; sw.Write("Group" + delimiter + "Class" + delimiter + "Character" + delimiter + diff --git a/LuckParser/Controllers/HTMLHelper.cs b/LuckParser/Controllers/HTMLHelper.cs index a54d690cb..0597c1334 100644 --- a/LuckParser/Controllers/HTMLHelper.cs +++ b/LuckParser/Controllers/HTMLHelper.cs @@ -10,7 +10,9 @@ namespace LuckParser.Controllers { class HTMLHelper { - + + public static bool[] SnapSettings; + public static string getFinalDPS(BossData b_data, CombatData c_data, AgentData a_data, AbstractPlayer p, Boss boss, int phase_index) { int totalboss_dps = 0; @@ -25,7 +27,7 @@ public static string getFinalDPS(BossData b_data, CombatData c_data, AgentData a int totalAllcondi_damage = 0; int totalAllphys_dps = 0; int totalAllphys_damage = 0; - PhaseData phase = boss.getPhases(b_data, c_data.getCombatList(), a_data)[phase_index]; + PhaseData phase = boss.getPhases(b_data, c_data.getCombatList(), a_data, SnapSettings[14])[phase_index]; double fight_duration = (phase.getDuration()) / 1000.0; double damage = 0.0; @@ -87,7 +89,7 @@ public static string getFinalDPS(BossData b_data, CombatData c_data, AgentData a public static string[] getFinalStats(BossData b_data, CombatData c_data, AgentData a_data, Player p, Boss boss, int phase_index) { String[] statsArray; - PhaseData phase = boss.getPhases(b_data, c_data.getCombatList(), a_data)[phase_index]; + PhaseData phase = boss.getPhases(b_data, c_data.getCombatList(), a_data, SnapSettings[14])[phase_index]; long start = phase.getStart() + b_data.getFirstAware(); long end = phase.getEnd() + b_data.getFirstAware(); List damage_logs = p.getDamageLogs(0, b_data, c_data.getCombatList(), a_data, phase.getStart(), phase.getEnd()); @@ -235,7 +237,7 @@ public static string[] getFinalStats(BossData b_data, CombatData c_data, AgentDa } public static string[] getFinalDefenses(BossData b_data, CombatData c_data, AgentData a_data, MechanicData m_data, Player p, Boss boss, int phase_index) { - PhaseData phase = boss.getPhases(b_data, c_data.getCombatList(), a_data)[phase_index]; + PhaseData phase = boss.getPhases(b_data, c_data.getCombatList(), a_data, SnapSettings[14])[phase_index]; long start = phase.getStart() + b_data.getFirstAware(); long end = phase.getEnd() + b_data.getFirstAware(); List damage_logs = p.getDamageTakenLogs(b_data, c_data.getCombatList(), a_data, m_data, phase.getStart(), phase.getEnd()); @@ -295,7 +297,7 @@ public static string[] getFinalDefenses(BossData b_data, CombatData c_data, Agen //(currently not correct) public static string[] getFinalSupport(BossData b_data, CombatData c_data, AgentData a_data, Player p, Boss boss, int phase_index) { - PhaseData phase = boss.getPhases(b_data, c_data.getCombatList(), a_data)[phase_index]; + PhaseData phase = boss.getPhases(b_data, c_data.getCombatList(), a_data, SnapSettings[14])[phase_index]; long start = phase.getStart() + b_data.getFirstAware(); long end = phase.getEnd() + b_data.getFirstAware(); // List damage_logs = p.getDamageTakenLogs(b_data, c_data.getCombatList(), getAgentData()); @@ -318,7 +320,7 @@ public static string[] getFinalSupport(BossData b_data, CombatData c_data, Agent } public static Dictionary getfinalboons(BossData b_data, CombatData c_data, SkillData s_data, AgentData a_data, Boss boss, Player p, int phase_index) { - List phases = boss.getPhases(b_data, c_data.getCombatList(), a_data); + List phases = boss.getPhases(b_data, c_data.getCombatList(), a_data, SnapSettings[14]); BoonDistribution boon_distrib = p.getBoonDistribution(b_data, s_data, c_data.getCombatList(), phases, phase_index); Dictionary rates = new Dictionary(); long fight_duration = phases[phase_index].getEnd() - phases[phase_index].getStart(); @@ -347,7 +349,7 @@ public static Dictionary getfinalboons(BossData b_data, CombatData { return getfinalboons(b_data, c_data, s_data, a_data, boss, p, phase_index); } - List phases = boss.getPhases(b_data, c_data.getCombatList(), a_data); + List phases = boss.getPhases(b_data, c_data.getCombatList(), a_data, SnapSettings[14]); long fight_duration = phases[phase_index].getDuration(); Dictionary boon_logsDist = new Dictionary(); foreach (Player player in trgetPlayers) @@ -394,7 +396,7 @@ public static Dictionary getfinalboons(BossData b_data, CombatData } public static Dictionary getfinalcondis(BossData b_data, CombatData c_data, SkillData s_data, AgentData a_data, Boss boss, AbstractPlayer p, int phase_index) { - List phases = boss.getPhases(b_data, c_data.getCombatList(), a_data); + List phases = boss.getPhases(b_data, c_data.getCombatList(), a_data, SnapSettings[14]); BoonDistribution boon_distrib = p.getBoonDistribution(b_data, s_data, c_data.getCombatList(),phases, phase_index); Dictionary rates = new Dictionary(); PhaseData phase = phases[phase_index]; @@ -429,7 +431,7 @@ public static List getDPSGraph(BossData b_data, CombatData c_data, AgentD } List dmgList = new List(); - PhaseData phase = boss.getPhases(b_data, c_data.getCombatList(), a_data)[phase_index]; + PhaseData phase = boss.getPhases(b_data, c_data.getCombatList(), a_data, SnapSettings[14])[phase_index]; List damage_logs = p.getDamageLogs(dstid, b_data, c_data.getCombatList(), a_data, phase.getStart(), phase.getEnd()); // fill the graph, full precision List dmgListFull = new List(); diff --git a/LuckParser/MainForm.cs b/LuckParser/MainForm.cs index 7adef218d..83c4e62c1 100644 --- a/LuckParser/MainForm.cs +++ b/LuckParser/MainForm.cs @@ -163,7 +163,8 @@ void m_DoWork(Logger logger, Cancellation cancel, DoWorkEventArgs e) Properties.Settings.Default.SimpleRotation, Properties.Settings.Default.ShowAutos, Properties.Settings.Default.LargeRotIcons, - Properties.Settings.Default.ShowEstimates + Properties.Settings.Default.ShowEstimates, + Properties.Settings.Default.ParsePhases }; for (int i = 0; i < lvFileList.Items.Count; i++) { @@ -224,7 +225,7 @@ void m_DoWork(Logger logger, Cancellation cancel, DoWorkEventArgs e) } else { - control.CreateCSV(sw, ","); + control.CreateCSV(sw, ",",settingsSnap); } } } diff --git a/LuckParser/Models/ParseModels/Players/Boss.cs b/LuckParser/Models/ParseModels/Players/Boss.cs index 164f49221..76fc0b8fc 100644 --- a/LuckParser/Models/ParseModels/Players/Boss.cs +++ b/LuckParser/Models/ParseModels/Players/Boss.cs @@ -14,10 +14,19 @@ public Boss(AgentItem agent) : base(agent) private List phases = new List(); private List phaseData = new List(); - public List getPhases(BossData bossData, List combatList, AgentData agentData) + public List getPhases(BossData bossData, List combatList, AgentData agentData,bool getAllPhases) { + if (phases.Count == 0) { + if (!getAllPhases) + { + long fight_dur = bossData.getAwareDuration(); + phases.Add(new PhaseData(0, fight_dur)); + phases[0].setName("Full Fight"); + getCastLogs(bossData, combatList, agentData, 0, fight_dur); + return phases; + } setPhases(bossData, combatList, agentData); } return phases; diff --git a/LuckParser/Properties/Settings.Designer.cs b/LuckParser/Properties/Settings.Designer.cs index 5922c8f69..35579f9c9 100644 --- a/LuckParser/Properties/Settings.Designer.cs +++ b/LuckParser/Properties/Settings.Designer.cs @@ -238,5 +238,17 @@ public bool ShowEstimates { this["ShowEstimates"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool ParsePhases { + get { + return ((bool)(this["ParsePhases"])); + } + set { + this["ParsePhases"] = value; + } + } } } diff --git a/LuckParser/Properties/Settings.settings b/LuckParser/Properties/Settings.settings index 451a4ea9b..4f08a3984 100644 --- a/LuckParser/Properties/Settings.settings +++ b/LuckParser/Properties/Settings.settings @@ -56,5 +56,8 @@ False + + True + \ No newline at end of file diff --git a/LuckParser/SettingsForm.Designer.cs b/LuckParser/SettingsForm.Designer.cs index 0b2165008..e72f681f9 100644 --- a/LuckParser/SettingsForm.Designer.cs +++ b/LuckParser/SettingsForm.Designer.cs @@ -59,6 +59,8 @@ private void InitializeComponent() this.chkOutputHtml = new System.Windows.Forms.CheckBox(); this.chkOutputCsv = new System.Windows.Forms.CheckBox(); this.chkShowEstimates = new System.Windows.Forms.CheckBox(); + this.checkPhaseParsing = new System.Windows.Forms.CheckBox(); + this.label1 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // lblDamageGraphSection @@ -386,12 +388,36 @@ private void InitializeComponent() this.chkShowEstimates.UseVisualStyleBackColor = true; this.chkShowEstimates.CheckedChanged += new System.EventHandler(this.ShowEstimates_CheckedChanged); // + // checkPhaseParsing + // + this.checkPhaseParsing.AutoSize = true; + this.checkPhaseParsing.Checked = true; + this.checkPhaseParsing.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkPhaseParsing.Location = new System.Drawing.Point(404, 100); + this.checkPhaseParsing.Name = "checkPhaseParsing"; + this.checkPhaseParsing.Size = new System.Drawing.Size(144, 17); + this.checkPhaseParsing.TabIndex = 30; + this.checkPhaseParsing.Text = "Parse all possible phases"; + this.checkPhaseParsing.UseVisualStyleBackColor = true; + this.checkPhaseParsing.CheckedChanged += new System.EventHandler(this.checkPhaseParsing_CheckedChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(385, 84); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(78, 13); + this.label1.TabIndex = 29; + this.label1.Text = "Global Settings"; + // // SettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScroll = true; this.ClientSize = new System.Drawing.Size(577, 368); + this.Controls.Add(this.checkPhaseParsing); + this.Controls.Add(this.label1); this.Controls.Add(this.chkShowEstimates); this.Controls.Add(this.chkOutputCsv); this.Controls.Add(this.chkOutputHtml); @@ -463,5 +489,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox chkOutputHtml; private System.Windows.Forms.CheckBox chkOutputCsv; private System.Windows.Forms.CheckBox chkShowEstimates; + private System.Windows.Forms.CheckBox checkPhaseParsing; + private System.Windows.Forms.Label label1; } } \ No newline at end of file diff --git a/LuckParser/SettingsForm.cs b/LuckParser/SettingsForm.cs index 316a229d8..b7507aa50 100644 --- a/LuckParser/SettingsForm.cs +++ b/LuckParser/SettingsForm.cs @@ -90,6 +90,7 @@ private void SettingsForm_Load(object sender, EventArgs e) chkOutputHtml.Checked = Properties.Settings.Default.SaveOutHTML; chkOutputCsv.Checked = Properties.Settings.Default.SaveOutCSV; chkShowEstimates.Checked = Properties.Settings.Default.ShowEstimates; + checkPhaseParsing.Checked = Properties.Settings.Default.ParsePhases; } private void DefaultOutputLocation_CheckedChanged(object sender, EventArgs e) @@ -172,5 +173,10 @@ private void ShowEstimates_CheckedChanged(object sender, EventArgs e) { Properties.Settings.Default.ShowEstimates = chkShowEstimates.Checked; } + + private void checkPhaseParsing_CheckedChanged(object sender, EventArgs e) + { + Properties.Settings.Default.ParsePhases = checkPhaseParsing.Checked; + } } }