Skip to content

Commit

Permalink
Merge pull request #27 from tobitege/master
Browse files Browse the repository at this point in the history
v1.0.2 smaller fixes
  • Loading branch information
Dimencia authored Nov 25, 2022
2 parents aba9a18 + fcca5c8 commit c61dd62
Show file tree
Hide file tree
Showing 16 changed files with 140 additions and 114 deletions.
6 changes: 6 additions & 0 deletions DU-Industry-Tool/Classes/CalculatorClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public static void Collect(CalculatorClass calc)
}

// calculate T2+ ore schematic costs
calc.ResetSchematicCost();
CollectSchematics(calc, SummationType.PURES);
CollectSchematics(calc, SummationType.PRODUCTS);

Expand Down Expand Up @@ -697,6 +698,11 @@ public void AddSchematicCost(decimal quantity)
SchematicsCost += quantity;
}

public void ResetSchematicCost()
{
SchematicsCost = 0;
}

public void AddSchema(string schemaKey, int qty, decimal amount)
{
if (string.IsNullOrEmpty(schemaKey) || qty < 1) return;
Expand Down
11 changes: 10 additions & 1 deletion DU-Industry-Tool/Classes/IndustryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Krypton.Toolkit;

namespace DU_Industry_Tool
Expand Down Expand Up @@ -398,6 +397,16 @@ public IndustryManager()
// DetermineIndustryFor(kvp.Value);
//}

//if (!string.IsNullOrEmpty(kvp.Value.SchemaType))
//{
// var r = DUData.Schematics.FirstOrDefault(x => x.Key == kvp.Value.SchemaType);
// if (r.Value != null && kvp.Value.SchemaPrice != r.Value.Cost)
// {
// Console.WriteLine(kvp.Value.Name + $" schema cost fix {kvp.Value.SchemaPrice} to {r.Value.Cost}");
// kvp.Value.SchemaPrice = r.Value.Cost;
// }
//}

// Skip further processing on some conditions...
if (SkipProcessing ||
(!string.IsNullOrEmpty(kvp.Value.SchemaType) && kvp.Value.SchemaPrice > 0) ||
Expand Down
6 changes: 3 additions & 3 deletions DU-Industry-Tool/Classes/MarketData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public class MarketData
public long BuyQuantity { get; set; } // Negative when selling
public DateTime ExpirationDate { get; set; }
public DateTime UpdateDate { get; set; }
public ulong PlayerId { get; set; }
public ulong OrganizationId { get; set; }
public string OwnerName { get; set; }
//public ulong PlayerId { get; set; }
//public ulong OrganizationId { get; set; }
//public string OwnerName { get; set; }
public decimal Price { get; set; }
public DateTime LogDate { get; set; }
}
Expand Down
13 changes: 7 additions & 6 deletions DU-Industry-Tool/Classes/MarketManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ namespace DU_Industry_Tool
public class MarketManager
{
// This is a terrible idea.
private readonly Regex MarketRegex = new Regex(@"MarketOrder:\[marketId = ([0-9]*), orderId = ([0-9]*), itemType = ([0-9]*), buyQuantity = ([\-0-9]*), expirationDate = @\([0-9]*\) ([^,]*), updateDate = @\([0-9]*\) ([^,]*), ownerId = EntityId:\[playerId = ([0-9]*), organizationId = ([0-9]*)\], ownerName = ([^,]*), unitPrice = Currency:\[amount = ([0-9]*)");
//private readonly Regex MarketRegex = new Regex(@"MarketOrder:\[marketId = ([0-9]*), orderId = ([0-9]*), itemType = ([0-9]*), buyQuantity = ([\-0-9]*), expirationDate = @\([0-9]*\) ([^,]*), updateDate = @\([0-9]*\) ([^,]*), ownerId = EntityId:\[playerId = ([0-9]*), organizationId = ([0-9]*)\], ownerName = ([^,]*), unitPrice = Currency:\[amount = ([0-9]*)");
private readonly Regex MarketRegex = new Regex(@"MarketOrder:\[marketId = ([0-9]*), orderId = ([0-9]*), itemType = ([0-9]*), buyQuantity = ([\-0-9]*), expirationDate = @\([0-9]*\) ([^,]*), updateDate = @\([0-9]*\) ([^,]*), unitPrice = Currency:\[amount = ([0-9]*)");

public readonly Dictionary<ulong,MarketData> MarketOrders = new Dictionary<ulong, MarketData>(); // Indexed by orderId for our purposes
private readonly List<string> CheckedLogFiles = new List<string>();
Expand All @@ -43,7 +44,7 @@ public MarketManager()

// Do an initial scan?
//UpdateMarketData();
Console.WriteLine("Parsed " + MarketOrders.Count + " market orders from settings file");
//Console.WriteLine("Parsed " + MarketOrders.Count + " market orders from settings file");
}

public void UpdateMarketData(LoadingForm form = null)
Expand Down Expand Up @@ -93,10 +94,10 @@ public void UpdateMarketData(LoadingForm form = null)
BuyQuantity = long.Parse(match.Groups[4].Value),
ExpirationDate = DateTime.ParseExact(match.Groups[5].Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture),
UpdateDate = DateTime.ParseExact(match.Groups[6].Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture),
PlayerId = ulong.Parse(match.Groups[7].Value),
OrganizationId = ulong.Parse(match.Groups[8].Value),
OwnerName = match.Groups[9].Value,
Price = ulong.Parse(match.Groups[10].Value)/100, // Weirdly, their prices are *100
//PlayerId = ulong.Parse(match.Groups[7].Value),
//OrganizationId = ulong.Parse(match.Groups[8].Value),
//OwnerName = match.Groups[9].Value,
Price = ulong.Parse(match.Groups[7].Value)/100, // Weirdly, their prices are *100
LogDate = lastDate
};

Expand Down
6 changes: 5 additions & 1 deletion DU-Industry-Tool/Classes/Recipe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public string ParentGroupName
IsPart = false;
IsPure = false;
IsProduct = false;
IsFuel = false;
return;
}
IsOre = _parentGroupName.Equals("Ore");
Expand All @@ -36,6 +37,7 @@ public string ParentGroupName
_parentGroupName.Equals("Consumables");
IsPure = _parentGroupName.Equals("Pure");
IsProduct = _parentGroupName.Equals("Product");
IsFuel = _parentGroupName.Equals("Fuels");
}
}

Expand All @@ -50,7 +52,9 @@ public string ParentGroupName
[JsonIgnore]
public bool IsProduct { get; protected set; }
[JsonIgnore]
public bool IsBatchmode => IsOre || IsPure || IsProduct;
public bool IsFuel { get; protected set; }
[JsonIgnore]
public bool IsBatchmode => IsOre || IsPure || IsProduct || IsFuel;
}

public class SchematicRecipe : ProductNameClass
Expand Down
2 changes: 0 additions & 2 deletions DU-Industry-Tool/Forms/ContentDocumentTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ private void SetFont(float fontDelta)
fontSize += fontDelta;
}
Font = new Font("Segoe UI", fontSize, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
//kryptonPanel.Font = Font;
foreach (var ct in this.Controls.OfType<KryptonLabel>())
{
ct.Font = Font;
Expand All @@ -549,6 +548,5 @@ private void SetFont(float fontDelta)
}
treeListView.Font = Font;
}

}
}
Loading

0 comments on commit c61dd62

Please sign in to comment.