Skip to content

Commit

Permalink
merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
baaron4 committed Jun 11, 2018
2 parents 6ef5c78 + 6179187 commit 8682bd6
Show file tree
Hide file tree
Showing 7 changed files with 459 additions and 381 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ all boons can be added to private static List<Boon> allBoons

* source an enum on BoonSource indicating from which class the boon originates (MIXED in doubt)

* type: either "duration" ex: switness or "intensity" ex:might
* type: either BoonType.Duration ex: switness or BoonType.Intensity ex:might

* capacity: both types have a max stacks. If unsure about duration go with 1

Expand Down
41 changes: 23 additions & 18 deletions LuckParser/Controllers/Controller1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using LuckParser.Models;
using System.IO.Compression;
using System.Windows.Forms;
using static LuckParser.Models.ParseModels.Boss;
//recomend CTRL+M+O to collapse all
namespace LuckParser.Controllers
{
Expand Down Expand Up @@ -117,7 +118,7 @@ private String getString(int length)
}
return "UNKNOWN";
}
private String FilterStringChars(string str)
private static String FilterStringChars(string str)
{
string filtered = "";
string filter = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
Expand All @@ -139,6 +140,7 @@ private String FilterStringChars(string str)
private CombatData combat_data = new CombatData();
private MechanicData mech_data = new MechanicData();
private List<Player> p_list = new List<Player>();
private Boss boss;

// Public Methods
public LogData getLogData()
Expand Down Expand Up @@ -672,6 +674,8 @@ private void fillMissingData()
}

}
AgentItem bossAgent = agent_data.GetAgent(boss_data.getAgent());
boss = new Boss(bossAgent);
// Sort
p_list = p_list.OrderBy(a => int.Parse(a.getGroup())).ToList();//p_list.Sort((a, b)=>int.Parse(a.getGroup()) - int.Parse(b.getGroup()))
setMechData();
Expand Down Expand Up @@ -1024,11 +1028,11 @@ private Dictionary<int, string> getfinalboons(Player p)
string rate = "0";
if (boon_distrib.ContainsKey(boon.getID()))
{
if (boon.getType().Equals("duration"))
if (boon.getType() == Boon.BoonType.Duration)
{
rate = Math.Round(100.0 * boon_distrib.getUptime(boon.getID()) / fight_duration, 1) + "%";
}
else if (boon.getType().Equals("intensity"))
else if (boon.getType() == Boon.BoonType.Intensity)
{
rate = Math.Round((double)boon_distrib.getUptime(boon.getID()) / fight_duration, 1).ToString();
}
Expand Down Expand Up @@ -1071,14 +1075,14 @@ private Dictionary<int, string> getfinalboons(Player p, List<Player> trgetPlayer
totaloverstack += total;
if (total > 0)
{
if (boon.getType().Equals("duration"))
if (boon.getType() == Boon.BoonType.Duration)
{
rate = "<span data-toggle=\"tooltip\" data-html=\"true\" data-placement=\"top\" title=\"\" data-original-title=\""
+ Math.Round(100.0 * totaloverstack / fight_duration / trgetPlayers.Count, 1) + "% with overstack \">"
+ Math.Round(100.0 * total / fight_duration / trgetPlayers.Count, 1)
+ "%</span>";
}
else if (boon.getType().Equals("intensity"))
else if (boon.getType() == Boon.BoonType.Intensity)
{
rate = "<span data-toggle=\"tooltip\" data-html=\"true\" data-placement=\"top\" title=\"\" data-original-title=\""
+ Math.Round((double)totaloverstack / fight_duration / trgetPlayers.Count, 1).ToString() + " with overstack \">"
Expand All @@ -1104,12 +1108,12 @@ private Dictionary<int, string> getfinalcondis(Player p)
if (boon_distrib.ContainsKey(boon.getID()))
{
string rate = "0";
if (boon.getType().Equals("duration"))
if (boon.getType() == Boon.BoonType.Duration)
{
long fight_duration = b_data.getLastAware() - b_data.getFirstAware();
rate = Math.Round(100.0 * boon_distrib.getUptime(boon.getID()) / fight_duration, 1) + "%";
}
else if (boon.getType().Equals("intensity"))
else if (boon.getType() == Boon.BoonType.Intensity)
{
long fight_duration = b_data.getLastAware() - b_data.getFirstAware();
rate = Math.Round((double)boon_distrib.getUptime(boon.getID()) / fight_duration, 1).ToString();
Expand Down Expand Up @@ -1802,11 +1806,12 @@ private void PrintWeapons(StreamWriter sw, Player p)
AgentData a_data = getAgentData();
//print weapon sets
string[] wep = p.getWeaponsArray(s_data,c_data,b_data,a_data);
sw.Write("<div>");
if (wep[0] != null)
{
sw.Write("<img src=\"" + GetLink(wep[0]) + " \" alt=\"" + wep[0] + "\" data-toggle=\"tooltip\" title=\"\" height=\"18\" width=\"18\" data-original-title=\"" +wep[0] + "\">");
}
else
else if(wep[1] != null)
{
sw.Write("<img src=\"" + GetLink("Question") + " \" alt=\"Unknown\" data-toggle=\"tooltip\" title=\"\" height=\"18\" width=\"18\" data-original-title=\"Unknown\">");
}
Expand All @@ -1826,16 +1831,16 @@ private void PrintWeapons(StreamWriter sw, Player p)

}
else {
sw.Write("/");
sw.Write(" / ");
}

if (wep[2] != null)
{
sw.Write("<img src=\"" + GetLink(wep[2]) + " \" alt=\"" + wep[2] + "\" data-toggle=\"tooltip\" title=\"\" height=\"18\" width=\"18\" data-original-title=\"" + wep[2] + "\">");
}
else
else if(wep[3] != null)
{
// sw.Write("<img src=\"" + GetLink("Question") + " \" alt=\"Unknown\" height=\"18\" width=\"18\" >");
sw.Write("<img src=\"" + GetLink("Question") + " \" alt=\"Unknown\" height=\"18\" width=\"18\" >");
}
if (wep[3] != null)
{
Expand All @@ -1849,6 +1854,7 @@ private void PrintWeapons(StreamWriter sw, Player p)
//sw.Write("<img src=\"" + GetLink("Question") + " \" alt=\"Unknown\" height=\"18\" width=\"18\" >");
}
sw.Write("<br>");
sw.Write("</div>");
}

bool[] SnapSettings;
Expand Down Expand Up @@ -1909,8 +1915,9 @@ private void CreateCompTable(StreamWriter sw) {
sw.Write("<td style=\"width: 120px; border:1px solid #EE5F5B;\">");
{
sw.Write("<img src=\"" + GetLink(gPlay.getProf().ToString()) + " \" alt=\"" + gPlay.getProf().ToString() + "\" height=\"18\" width=\"18\" >");
sw.Write(build);
PrintWeapons(sw,gPlay);
sw.Write(build + "<br/>" + charName);
sw.Write(charName);
}
sw.Write("</td>");
}
Expand Down Expand Up @@ -2417,7 +2424,7 @@ private void CreateUptimeTable(StreamWriter sw, List<Boon> list_to_use, string t
}
foreach (Boon boon in list_to_use)
{
if (boon.getType() == "intensity")
if (boon.getType() == Boon.BoonType.Intensity)
{
intensityBoon.Add(count);
}
Expand Down Expand Up @@ -3464,10 +3471,10 @@ private void CreateDeathRecap(StreamWriter sw, Player p)
List<DamageLog> damageLogs = p.getDamageTakenLogs(b_data, c_data.getCombatList(), getAgentData(), getMechData());
SkillData s_data = getSkillData();
List<SkillItem> s_list = s_data.getSkillList();
List<Point> down = getCombatData().getStates(p.getInstid(), "CHANGE_DOWN");
List<Point> down = getCombatData().getStates(p.getInstid(), "CHANGE_DOWN", b_data.getFirstAware(), b_data.getLastAware());
if (down.Count > 0)
{
List<Point> ups = getCombatData().getStates(p.getInstid(), "CHANGE_UP");
List<Point> ups = getCombatData().getStates(p.getInstid(), "CHANGE_UP", b_data.getFirstAware(), b_data.getLastAware());
down = down.GetRange(ups.Count(), down.Count()-ups.Count());
}
List<Point> dead = getCombatData().getStates(p.getInstid(), "CHANGE_DEAD");
Expand Down Expand Up @@ -4588,8 +4595,6 @@ private void CreateCondiUptimeTable(StreamWriter sw,Player boss)
private void CreateBossSummary(StreamWriter sw)
{
//generate Player list Graphs
AgentItem bossAgent = agent_data.GetAgent(boss_data.getAgent());
Boss boss = new Boss(bossAgent);
CombatData c_data = getCombatData();
BossData b_data = getBossData();
List<CastLog> casting = boss.getCastLogs(b_data, c_data.getCombatList(), getAgentData());
Expand Down Expand Up @@ -5066,6 +5071,7 @@ public void CreateHTML(StreamWriter sw, bool[] settingsSnap)
}
string bossname = FilterStringChars(b_data.getName());
setPresentBoons(settingsSnap);
List<PhaseData> phases = boss.getPhases(getBossData(), getCombatData().getCombatList(), getAgentData());
string Html_playerDropdown = "";
foreach (Player p in p_list)
{
Expand Down Expand Up @@ -6062,7 +6068,6 @@ public string GetLink(string name)
return "https://wiki.guildwars2.com/images/1/19/Crimson_Antique_Musket.png";
case "Staff":
return "https://wiki.guildwars2.com/images/5/5f/Crimson_Antique_Spire.png";
//dont use these as it only works for english
case "Vale Guardian-icon":
return "https://wiki.guildwars2.com/images/f/fb/Mini_Vale_Guardian.png";
case "Gorseval the Multifarious-icon":
Expand Down
Loading

0 comments on commit 8682bd6

Please sign in to comment.