Skip to content

Commit

Permalink
Merge pull request #35 from EliphasNUIT/feature/phase
Browse files Browse the repository at this point in the history
Feature/phase
  • Loading branch information
baaron4 authored Jun 14, 2018
2 parents daf8695 + e012172 commit 2409ee4
Show file tree
Hide file tree
Showing 57 changed files with 3,853 additions and 4,691 deletions.
4,366 changes: 912 additions & 3,454 deletions LuckParser/Controllers/Controller1.cs

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions LuckParser/Controllers/FlashWindow.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using Microsoft.Win32;

namespace LuckParser.Controllers
{
Expand Down
2 changes: 0 additions & 2 deletions LuckParser/Controllers/GW2APIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace LuckParser.Controllers
Expand Down
1,476 changes: 1,476 additions & 0 deletions LuckParser/Controllers/HTMLHelper.cs

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions LuckParser/Controllers/ParseHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
using System;
using System.IO;

namespace LuckParser.Controllers
{
class ParseHelper
{
public static void safeSkip(MemoryStream stream,long bytes_to_skip)
{

while (bytes_to_skip > 0)
{
int dummyByte = stream.ReadByte();
long bytes_actually_skipped = 1;
if (bytes_actually_skipped > 0)
{
bytes_to_skip -= bytes_actually_skipped;
}
else if (bytes_actually_skipped == 0)
{
if (stream.ReadByte() == -1)
{
break;
}
else
{
bytes_to_skip--;
}
}
}

return;
}
public static ushort getShort(MemoryStream stream)
{
byte[] bytes = new byte[2];
for (int b = 0; b < bytes.Length; b++)
{
bytes[b] = Convert.ToByte(stream.ReadByte());
//stream.Position++;
}
// return Short.toUnsignedInt(ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).getShort());
return BitConverter.ToUInt16(bytes, 0);
}
public static int getInt(MemoryStream stream)
{
byte[] bytes = new byte[4];
for (int b = 0; b < bytes.Length; b++)
{
bytes[b] = Convert.ToByte(stream.ReadByte());
// stream.Position++;
}
//return ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).getInt();
return BitConverter.ToInt32(bytes, 0);
}
public static uint getUInt(MemoryStream stream)
{
byte[] bytes = new byte[4];
for (int b = 0; b < bytes.Length; b++)
{
bytes[b] = Convert.ToByte(stream.ReadByte());
// stream.Position++;
}
//return ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).getInt();
return BitConverter.ToUInt32(bytes, 0);
}
public static long getLong(MemoryStream stream)
{
byte[] bytes = new byte[8];
for (int b = 0; b < bytes.Length; b++)
{
bytes[b] = Convert.ToByte(stream.ReadByte());
// stream.Position++;
}

// return ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).getLong();
return BitConverter.ToInt64(bytes, 0);
}
public static ulong getULong(MemoryStream stream)
{
byte[] bytes = new byte[8];
for (int b = 0; b < bytes.Length; b++)
{
bytes[b] = Convert.ToByte(stream.ReadByte());
// stream.Position++;
}

// return ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).getLong();
return BitConverter.ToUInt64(bytes, 0);
}
public static string getString(MemoryStream stream, int length)
{
byte[] bytes = new byte[length];
for (int b = 0; b < bytes.Length; b++)
{
bytes[b] = Convert.ToByte(stream.ReadByte());
// stream.Position++;
}

string s = new String(System.Text.Encoding.UTF8.GetString(bytes).ToCharArray()).TrimEnd();
if (s != null)
{
return s;
}
return "UNKNOWN";
}
}
}
11 changes: 9 additions & 2 deletions LuckParser/LuckParser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,23 @@
<Compile Include="Controllers\Controller1.cs" />
<Compile Include="Controllers\FlashWindow.cs" />
<Compile Include="Controllers\GW2APIController.cs" />
<Compile Include="Controllers\HTMLHelper.cs" />
<Compile Include="Controllers\ParseHelper.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Models\ParseModels\Players\AbstractMasterPlayer.cs" />
<Compile Include="Models\ParseModels\Players\AbstractPlayer.cs" />
<Compile Include="Models\ParseModels\Boons\BoonsGraphModel.cs" />
<Compile Include="Models\ParseModels\Boons\BoonDistribution.cs" />
<Compile Include="Models\ParseModels\Players\Minion.cs" />
<Compile Include="Models\ParseModels\Players\Minions.cs" />
<Compile Include="Models\ParseModels\PhaseData.cs" />
<Compile Include="Models\ParseModels\Simulator\BoonSimulationItem.cs" />
<Compile Include="Models\ParseModels\Boss.cs" />
<Compile Include="Models\ParseModels\Players\Boss.cs" />
<Compile Include="Models\ParseModels\GW2APISpec.cs" />
<Compile Include="Models\ParseModels\Logs\DamageLogCondition.cs" />
<Compile Include="Models\ParseModels\GW2APISkillCheck.cs" />
Expand Down Expand Up @@ -120,7 +127,7 @@
<Compile Include="Models\ParseModels\Mechanic.cs" />
<Compile Include="Models\ParseModels\MechanicData.cs" />
<Compile Include="Models\ParseModels\Logs\MechanicLog.cs" />
<Compile Include="Models\ParseModels\Player.cs" />
<Compile Include="Models\ParseModels\Players\Player.cs" />
<Compile Include="Models\ParseModels\Logs\DamageLogPower.cs" />
<Compile Include="Models\ParseModels\SkillData.cs" />
<Compile Include="Models\ParseModels\SkillItem.cs" />
Expand Down
12 changes: 6 additions & 6 deletions LuckParser/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void m_DoWork(Logger logger, Cancellation cancel, DoWorkEventArgs e)
logger(i, "Working...", 20);
Controller1 control = new Controller1();

if (fInfo.Extension.Equals(".evtc", StringComparison.OrdinalIgnoreCase) ||
if (fInfo.Extension.Equals(".evtc", StringComparison.OrdinalIgnoreCase) ||
fInfo.Name.EndsWith(".evtc.zip", StringComparison.OrdinalIgnoreCase))
{
//Process evtc here
Expand Down Expand Up @@ -207,8 +207,8 @@ void m_DoWork(Logger logger, Cancellation cancel, DoWorkEventArgs e)

string outputType = Properties.Settings.Default.SaveOutHTML ? "html" : "csv";
string outputFile = Path.Combine(
saveDirectory.FullName,
$"{fInfo.Name}_{control.GetLink(bossid + "-ext")}_{result}.{outputType}"
saveDirectory.FullName,
$"{fInfo.Name}_{HTMLHelper.GetLink(bossid + "-ext")}_{result}.{outputType}"
);

logger(i, "Creating File...", 60);
Expand Down Expand Up @@ -247,7 +247,7 @@ void m_DoWork(Logger logger, Cancellation cancel, DoWorkEventArgs e)
System.Threading.Thread.CurrentThread.CurrentUICulture = before;
}
}

/// Worker job
void m_oWorker_DoWork(object sender, DoWorkEventArgs e)
{
Expand Down Expand Up @@ -297,7 +297,7 @@ private void LvFileList_AddItems(string[] filesArray)
lvFileList.Items.Add(lvItem);
}
}

private void LvFileList_DragDrop(object sender, DragEventArgs e)
{
btnParse.Enabled = true;
Expand Down Expand Up @@ -358,4 +358,4 @@ private void LvFilesList_MouseClick(object sender, MouseEventArgs e)
}
}
}
}
}
7 changes: 1 addition & 6 deletions LuckParser/Models/ParseEnums/Activation.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LuckParser.Models.ParseEnums
namespace LuckParser.Models.ParseEnums
{
public class Activation
{
Expand Down
3 changes: 0 additions & 3 deletions LuckParser/Models/ParseEnums/BuffRemove.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LuckParser.Models.ParseEnums
{
Expand Down
9 changes: 2 additions & 7 deletions LuckParser/Models/ParseEnums/IFF.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LuckParser.Models.ParseEnums
namespace LuckParser.Models.ParseEnums
{


public class IFF
{
// Constants
Expand Down
3 changes: 0 additions & 3 deletions LuckParser/Models/ParseEnums/Result.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LuckParser.Models.ParseEnums
{
Expand Down
3 changes: 0 additions & 3 deletions LuckParser/Models/ParseEnums/StateChange.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LuckParser.Models.ParseEnums
{
Expand Down
21 changes: 8 additions & 13 deletions LuckParser/Models/ParseModels/Agents/Agent.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Http;
using System.Net.Http.Formatting;
using LuckParser.Controllers;

namespace LuckParser.Models.ParseModels
Expand Down Expand Up @@ -36,12 +31,12 @@ public class Agent

// Fields
private String name;
private long ID;
private int is_elite;
private int prof;
private ulong ID;
private uint is_elite;
private uint prof;

// Constructor
public Agent(long ID, String name, int prof, int elite)
public Agent(ulong ID, String name, uint prof, uint elite)
{
this.name = name;
this.ID = ID;
Expand All @@ -51,8 +46,8 @@ public Agent(long ID, String name, int prof, int elite)

// Public Methods
public string getProf(string build, GW2APIController apiController) {
if (is_elite == -1) {
if ((ID & 0xffff0000) == 0xffff0000)
if (is_elite == 0xFFFFFFFF) {
if ((prof & 0xffff0000) == 0xffff0000)
{
return "GDG";
}
Expand Down Expand Up @@ -173,7 +168,7 @@ public string getProf(string build, GW2APIController apiController) {

}

GW2APISpec spec = apiController.GetSpec(is_elite);
GW2APISpec spec = apiController.GetSpec((int)is_elite);
if (spec.elite)
{
return spec.name;
Expand All @@ -198,7 +193,7 @@ public String getName()
return name;
}

public long getID()
public ulong getID()
{
return ID;
}
Expand Down
12 changes: 9 additions & 3 deletions LuckParser/Models/ParseModels/Agents/AgentData.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using LuckParser.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LuckParser.Models.ParseModels
{
Expand All @@ -29,6 +27,7 @@ public void addItem(Agent agent, AgentItem item,string buildVersion,GW2APIContro
else if (agent.getProf(buildVersion, apiController) == "GDG")
{
gadget_agent_list.Add(item);
return;
}
else
{
Expand Down Expand Up @@ -57,7 +56,7 @@ public List<AgentItem> getAllAgentsList()
{
return all_agents_list;
}
public AgentItem GetAgent(long agent) {
public AgentItem GetAgent(ulong agent) {
if (agent != 0)
{
AgentItem agtreturn = all_agents_list.FirstOrDefault(x => x.getAgent() == agent);
Expand All @@ -75,5 +74,12 @@ public AgentItem GetAgentWInst(ushort instid)
{
return all_agents_list.FirstOrDefault(x => x.getInstid() == instid);
}

public void clean()
{
NPC_agent_list = NPC_agent_list.Where(x => x.getInstid() != 0).ToList();
gadget_agent_list = NPC_agent_list.Where(x => x.getInstid() != 0).ToList();
all_agents_list = all_agents_list.Where(x => x.getInstid() != 0).ToList();
}
}
}
11 changes: 4 additions & 7 deletions LuckParser/Models/ParseModels/Agents/AgentItem.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LuckParser.Models.ParseModels
{
public class AgentItem
{
// Fields
private long agent;
private ulong agent;
private ushort instid = 0;
private long first_aware = 0;
private long last_aware = long.MaxValue;
Expand All @@ -19,14 +16,14 @@ public class AgentItem
private int condition = 0;

// Constructors
public AgentItem(long agent, String name, String prof)
public AgentItem(ulong agent, String name, String prof)
{
this.agent = agent;
this.name = name;
this.prof = prof;
}

public AgentItem(long agent, String name, String prof, int toughness, int healing, int condition)
public AgentItem(ulong agent, String name, String prof, int toughness, int healing, int condition)
{
this.agent = agent;
this.name = name;
Expand All @@ -53,7 +50,7 @@ public String[] toStringArray()
}

// Getters
public long getAgent()
public ulong getAgent()
{
return agent;
}
Expand Down
Loading

0 comments on commit 2409ee4

Please sign in to comment.