Skip to content

Commit

Permalink
Added ability to toggle phase parsing on and off in settings window
Browse files Browse the repository at this point in the history
  • Loading branch information
baaron4 committed Jun 16, 2018
1 parent b965a82 commit d2bcd89
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 28 deletions.
3 changes: 3 additions & 0 deletions LuckParser/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
<setting name="ShowEstimates" serializeAs="String">
<value>False</value>
</setting>
<setting name="ParsePhases" serializeAs="String">
<value>True</value>
</setting>
</LuckParser.Properties.Settings>
</userSettings>
</configuration>
36 changes: 20 additions & 16 deletions LuckParser/Controllers/Controller1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ private void CreateDPSGraph(StreamWriter sw, int phase_index)
//Generate DPS graph
sw.Write("<div id=\"DPSGraph"+ phase_index + "\" style=\"height: 600px;width:1200px; display:inline-block \"></div>");
sw.Write("<script>");
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("var data = [");
int maxDPS = 0;
List<Point> totalDpsAllPlayers = new List<Point>();
Expand Down Expand Up @@ -1233,7 +1233,7 @@ private void CreateCompTable(StreamWriter sw) {
/// <param name="fight_duration">Duration of the fight</param>
private void CreateDPSTable(StreamWriter sw, int phase_index) {
//generate dps 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("<script> $(function () { $('#dps_table"+ phase_index + "').DataTable({ \"order\": [[4, \"desc\"]]});});</script>");
sw.Write("<table class=\"display table table-striped table-hover compact\" cellspacing=\"0\" width=\"100%\" id=\"dps_table" + phase_index + "\">");
{
Expand Down Expand Up @@ -1349,7 +1349,7 @@ private void CreateDPSTable(StreamWriter sw, int phase_index) {
/// <param name="fight_duration">Duration of the fight</param>
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("<script> $(function () { $('#dmgstats_table"+ phase_index + "').DataTable({ \"order\": [[3, \"desc\"]]});});</script>");
sw.Write("<table class=\"display table table-striped table-hover compact\" cellspacing=\"0\" width=\"100%\" id=\"dmgstats_table"+ phase_index + "\">");
{
Expand Down Expand Up @@ -1480,7 +1480,7 @@ private void CreateDMGStatsTable(StreamWriter sw, int phase_index) {
/// <param name="fight_duration">Duration of the fight</param>
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("<script> $(function () { $('#defstats_table"+ phase_index + "').DataTable({ \"order\": [[3, \"desc\"]]});});</script>");
sw.Write("<table class=\"display table table-striped table-hover compact\" cellspacing=\"0\" width=\"100%\" id=\"defstats_table"+ phase_index+"\">");
{
Expand Down Expand Up @@ -1670,7 +1670,7 @@ private void CreateSupTable(StreamWriter sw, int phase_index) {
/// <param name="table_id">id of the table</param>
private void CreateUptimeTable(StreamWriter sw, List<Boon> list_to_use, string table_id, int phase_index)
{
List<PhaseData> phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data);
List<PhaseData> phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14]);
//Generate Boon table------------------------------------------------------------------------------------------------
sw.Write("<script> $(function () { $('#" + table_id+ phase_index + "').DataTable({ \"order\": [[0, \"asc\"]]});});</script>");
List<List<string>> footList = new List<List<string>>();
Expand Down Expand Up @@ -1911,7 +1911,7 @@ private void CreateGenSquadTable(StreamWriter sw, List<Boon> list_to_use, string
/// <param name="settingsSnap">Settings to use</param>
private void CreatePlayerTab(StreamWriter sw, bool[] settingsSnap, int phase_index)
{
List<PhaseData> phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data);
List<PhaseData> 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();
Expand Down Expand Up @@ -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<CastLog> casting = p.getCastLogs(boss_data, combat_data.getCombatList(), agent_data, phase.getStart(), phase.getEnd());
GW2APISkill autoSkill = null;
int autosCount = 0;
Expand Down Expand Up @@ -2527,7 +2527,7 @@ private void CreateDMGDistTableBody(StreamWriter sw, bool toBoss, List<CastLog>
/// <param name="p">The player</param>
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<CastLog> casting = p.getCastLogs(boss_data, combat_data.getCombatList(), agent_data, phase.getStart(), phase.getEnd());
List<DamageLog> 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);
Expand Down Expand Up @@ -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<CastLog> casting = minions.getCastLogs(boss_data, combat_data.getCombatList(), agent_data, phase.getStart(), phase.getEnd());
List<DamageLog> 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;
Expand Down Expand Up @@ -2593,7 +2593,7 @@ private void CreateDMGDistTable(StreamWriter sw, AbstractMasterPlayer p, Minions
/// <param name="p">The player</param>
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<DamageLog> damageLogs = p.getDamageTakenLogs(boss_data, combat_data.getCombatList(), agent_data,mech_data, phase.getStart(), phase.getEnd());
List<SkillItem> s_list = skill_data.getSkillList();
int finalTotalDamage = damageLogs.Count > 0 ? damageLogs.Sum(x => x.getDamage()) : 0;
Expand Down Expand Up @@ -2736,7 +2736,7 @@ private void CreateDMGTakenDistTable(StreamWriter sw, Player p, int phase_index)
/// <param name="sw">Stream writer</param>
private void CreateMechanicTable(StreamWriter sw, int phase_index) {
Dictionary<string,List<Mechanic>> presMech = new Dictionary<string, List<Mechanic>>();
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)
Expand Down Expand Up @@ -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<PhaseData> phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data);
List<PhaseData> phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data, SnapSettings[14]);
PhaseData phase = phases[phase_index];
List<CastLog> casting = boss.getCastLogsActDur(boss_data, combat_data.getCombatList(), agent_data, phase.getStart(), phase.getEnd());
List<SkillItem> s_list = skill_data.getSkillList();
Expand Down Expand Up @@ -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";
Expand All @@ -3160,7 +3161,7 @@ public void CreateHTML(StreamWriter sw, bool[] settingsSnap)
}
string bossname = FilterStringChars(boss_data.getName());
setPresentBoons(settingsSnap);
List<PhaseData> phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data);
List<PhaseData> phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data,SnapSettings[14]);
// HTML STARTS
sw.Write("<!DOCTYPE html><html lang=\"en\">");
{
Expand Down Expand Up @@ -3617,11 +3618,13 @@ public void CreateHTML(StreamWriter sw, bool[] settingsSnap)
}
public void CreateSoloHTML(StreamWriter sw, bool[] settingsSnap)
{
List<PhaseData> phases = boss.getPhases(boss_data, combat_data.getCombatList(), agent_data);
List<PhaseData> 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<CastLog> casting = p.getCastLogsActDur(boss_data, combat_data.getCombatList(), agent_data, 0, boss_data.getAwareDuration());
List<SkillItem> s_list = skill_data.getSkillList();
SnapSettings = settingsSnap;
HTMLHelper.SnapSettings = settingsSnap;

CreateDPSTable(sw, 0);
CreateDMGStatsTable(sw, 0);
Expand Down Expand Up @@ -3746,12 +3749,13 @@ public void CreateSoloHTML(StreamWriter sw, bool[] settingsSnap)
sw.Write("</div>");
}
//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 +
Expand Down
20 changes: 11 additions & 9 deletions LuckParser/Controllers/HTMLHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<DamageLog> damage_logs = p.getDamageLogs(0, b_data, c_data.getCombatList(), a_data, phase.getStart(), phase.getEnd());
Expand Down Expand Up @@ -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<DamageLog> damage_logs = p.getDamageTakenLogs(b_data, c_data.getCombatList(), a_data, m_data, phase.getStart(), phase.getEnd());
Expand Down Expand Up @@ -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<DamageLog> damage_logs = p.getDamageTakenLogs(b_data, c_data.getCombatList(), getAgentData());
Expand All @@ -318,7 +320,7 @@ public static string[] getFinalSupport(BossData b_data, CombatData c_data, Agent
}
public static Dictionary<int, string> getfinalboons(BossData b_data, CombatData c_data, SkillData s_data, AgentData a_data, Boss boss, Player p, int phase_index)
{
List<PhaseData> phases = boss.getPhases(b_data, c_data.getCombatList(), a_data);
List<PhaseData> 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<int, string> rates = new Dictionary<int, string>();
long fight_duration = phases[phase_index].getEnd() - phases[phase_index].getStart();
Expand Down Expand Up @@ -347,7 +349,7 @@ public static Dictionary<int, string> getfinalboons(BossData b_data, CombatData
{
return getfinalboons(b_data, c_data, s_data, a_data, boss, p, phase_index);
}
List<PhaseData> phases = boss.getPhases(b_data, c_data.getCombatList(), a_data);
List<PhaseData> phases = boss.getPhases(b_data, c_data.getCombatList(), a_data, SnapSettings[14]);
long fight_duration = phases[phase_index].getDuration();
Dictionary<Player, BoonDistribution> boon_logsDist = new Dictionary<Player, BoonDistribution>();
foreach (Player player in trgetPlayers)
Expand Down Expand Up @@ -394,7 +396,7 @@ public static Dictionary<int, string> getfinalboons(BossData b_data, CombatData
}
public static Dictionary<int, string> getfinalcondis(BossData b_data, CombatData c_data, SkillData s_data, AgentData a_data, Boss boss, AbstractPlayer p, int phase_index)
{
List<PhaseData> phases = boss.getPhases(b_data, c_data.getCombatList(), a_data);
List<PhaseData> 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<int, string> rates = new Dictionary<int, string>();
PhaseData phase = phases[phase_index];
Expand Down Expand Up @@ -429,7 +431,7 @@ public static List<Point> getDPSGraph(BossData b_data, CombatData c_data, AgentD
}

List<Point> dmgList = new List<Point>();
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<DamageLog> damage_logs = p.getDamageLogs(dstid, b_data, c_data.getCombatList(), a_data, phase.getStart(), phase.getEnd());
// fill the graph, full precision
List<double> dmgListFull = new List<double>();
Expand Down
5 changes: 3 additions & 2 deletions LuckParser/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down Expand Up @@ -224,7 +225,7 @@ void m_DoWork(Logger logger, Cancellation cancel, DoWorkEventArgs e)
}
else
{
control.CreateCSV(sw, ",");
control.CreateCSV(sw, ",",settingsSnap);
}
}
}
Expand Down
Loading

0 comments on commit d2bcd89

Please sign in to comment.