Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spread, Recoil x/y #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ public string FormatKey(string key)
return value;

return errReturn;
case "shake":
string shake_type = this.GetValue("type");
case "spread":
string spread_type = this.GetValue("type");

if (shake_type == "Grip" ||
shake_type == "Barrel" ||
shake_type == "Tactical")
if (spread_type == "Grip" ||
spread_type == "Barrel" ||
spread_type == "Tactical")
return value;

return errReturn;
Expand Down Expand Up @@ -240,8 +240,10 @@ public enum CompareModes
VehicleHealth,
StructureCapacity,
BuildingHealth,
Shake,
BarrelDamage,
Spread,
Recoil_X,
Recoil_Y,
BarrelDamage,
BarrelVolume,
AmmoAmount
}
Expand All @@ -265,13 +267,25 @@ public static int CompareTo(this Item a, Item val, CompareModes mode)
case CompareModes.VehicleHealth:
return (val.GetValue("type") == "Vehicle" ? val.GetValue("health", "0").ToFloat() : 0)
.CompareTo(a.GetValue("type") == "Vehicle" ? a.GetValue("health", "0").ToFloat() : 0);
case CompareModes.Shake:
string shake_type_a = a.GetValue("type"),
shake_type_val = val.GetValue("type");

return (shake_type_a == "Grip" || shake_type_a == "Barrel" || shake_type_a == "Tactical" ? a.GetValue("shake", "1").ToFloat() : 1)
.CompareTo(shake_type_val == "Grip" || shake_type_val == "Barrel" || shake_type_val == "Tactical" ? val.GetValue("shake", "1").ToFloat() : 1);
case CompareModes.BarrelDamage:
case CompareModes.Spread:
string spread_type_a = a.GetValue("type"),
spread_type_val = val.GetValue("type");

return (spread_type_a == "Grip" || spread_type_a == "Barrel" || spread_type_a == "Tactical" ? a.GetValue("spread", "1").ToFloat() : 1)
.CompareTo(spread_type_val == "Grip" || spread_type_val == "Barrel" || spread_type_val == "Tactical" ? val.GetValue("spread", "1").ToFloat() : 1);
case CompareModes.Recoil_X:
string recoil_x_type_a = a.GetValue("type"),
recoil_x_type_val = val.GetValue("type");

return (recoil_x_type_a == "Grip" || recoil_x_type_a == "Barrel" || recoil_x_type_a == "Tactical" ? a.GetValue("recoil_x", "1").ToFloat() : 1)
.CompareTo(recoil_x_type_val == "Grip" || recoil_x_type_val == "Barrel" || recoil_x_type_val == "Tactical" ? val.GetValue("recoil_x", "1").ToFloat() : 1);
case CompareModes.Recoil_Y:
string recoil_y_type_a = a.GetValue("type"),
recoil_y_type_val = val.GetValue("type");

return (recoil_y_type_a == "Grip" || recoil_y_type_a == "Barrel" || recoil_y_type_a == "Tactical" ? a.GetValue("recoil_y", "1").ToFloat() : 1)
.CompareTo(recoil_y_type_val == "Grip" || recoil_y_type_val == "Barrel" || recoil_y_type_val == "Tactical" ? val.GetValue("recoil_y", "1").ToFloat() : 1);
case CompareModes.BarrelDamage:
return (a.GetValue("type") == "Barrel" ? a.GetValue("damage", "0").ToFloat() : 0)
.CompareTo(val.GetValue("type") == "Barrel" ? val.GetValue("damage", "0").ToFloat() : 0);
case CompareModes.BarrelVolume:
Expand Down
163 changes: 116 additions & 47 deletions ItemList.Designer.cs

Large diffs are not rendered by default.

30 changes: 22 additions & 8 deletions ItemList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ private void SortByBuildingHealthBtn_Click(object sender, EventArgs e)

UpdateItemList();
}

private void SortBySpreadBtn_Click(object sender, EventArgs e)
{
items.Sort((a, b) => a.CompareTo(b, Core.CompareModes.Spread));

private void SortByShakeBtn_Click(object sender, EventArgs e)
{
items.Sort((a, b) => a.CompareTo(b, Core.CompareModes.Shake));

UpdateItemList();
}
UpdateItemList();
}

private void SortByBarrelDamageBtn_Click(object sender, EventArgs e)
private void SortByBarrelDamageBtn_Click(object sender, EventArgs e)
{
items.Sort((a, b) => a.CompareTo(b, Core.CompareModes.BarrelDamage));

Expand Down Expand Up @@ -245,7 +245,21 @@ private void SortByPelletsBtn_Click(object sender, EventArgs e)
UpdateItemList();
}

private void SortByVolumeBtn_Click(object sender, EventArgs e)
private void SortByRecoilYBtn_Click(object sender, EventArgs e)
{
items.Sort((a, b) => a.CompareTo(b, Core.CompareModes.Recoil_Y));

UpdateItemList();
}

private void SortByRecoilXBtn_Click(object sender, EventArgs e)
{
items.Sort((a, b) => a.CompareTo(b, Core.CompareModes.Recoil_X));

UpdateItemList();
}

private void SortByVolumeBtn_Click(object sender, EventArgs e)
{
items.Sort((a, b) => a.CompareTo(b, Core.CompareModes.BarrelVolume));

Expand Down
118 changes: 94 additions & 24 deletions ItemsCategories.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading