mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-12 15:04:36 +01:00
Update GetProductList.cs
This commit is contained in:
@@ -8,36 +8,36 @@ namespace EpinelPS.LobbyServer.Msgs.Shop
|
|||||||
{
|
{
|
||||||
protected override async Task HandleAsync()
|
protected override async Task HandleAsync()
|
||||||
{
|
{
|
||||||
try
|
var x = await ReadData<ReqGetJupiterProductList>();
|
||||||
|
|
||||||
|
var response = new ResGetJupiterProductList();
|
||||||
|
foreach (var item in x.ProductIdList)
|
||||||
{
|
{
|
||||||
var x = await ReadData<ReqGetJupiterProductList>();
|
// TODO: Optimize this!
|
||||||
|
var product = GameData.Instance.mediasProductTable.Where(x => x.Key == item);
|
||||||
|
|
||||||
var response = new ResGetJupiterProductList();
|
if (product.Any())
|
||||||
foreach (var item in x.ProductIdList)
|
|
||||||
{
|
{
|
||||||
// TODO: Optimize this!
|
// Example:
|
||||||
var product = GameData.Instance.mediasProductTable.Where(x => x.Key == item);
|
// Midas RequestGetLocalPriceAsync res ProductId = com.proximabeta.nikke.costumegacha11_02, Price = 3.99, MicroPrice = 3990000, CurrencyCode = USD, CurrencySymbol = $
|
||||||
|
MidasProductRecord? record = product.FirstOrDefault().Value;
|
||||||
if (product.Any())
|
if (record != null)
|
||||||
{
|
{
|
||||||
// Example:
|
if(!double.TryParse(record.cost, out double price))
|
||||||
// Midas RequestGetLocalPriceAsync res ProductId = com.proximabeta.nikke.costumegacha11_02, Price = 3.99, MicroPrice = 3990000, CurrencyCode = USD, CurrencySymbol = $
|
{
|
||||||
MidasProductRecord? record = product.FirstOrDefault().Value;
|
Console.WriteLine("Failed to parse " + record.cost+" Cash shop will not work probably");
|
||||||
|
}
|
||||||
long microPrice = (long)(double.Parse(record.cost) * 1000000);
|
|
||||||
|
long microPrice = (long)(price * 1000000);
|
||||||
response.ProductInfoList.Add(new NetJupiterProductInfo() { CurrencyCode = "USD", CurrencySymbol = "$", MicroPrice = microPrice, Price = record.cost, ProductId = item });
|
response.ProductInfoList.Add(new NetJupiterProductInfo() { CurrencyCode = "USD", CurrencySymbol = "$", MicroPrice = microPrice, Price = record.cost, ProductId = item });
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("Missing!!!! " + item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
await WriteDataAsync(response);
|
else
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
Console.WriteLine("Missing!!!! " + item);
|
||||||
{
|
}
|
||||||
Console.WriteLine("Error while handling GetProductList request. Have you replaced sodium library?" + ex);
|
|
||||||
}
|
}
|
||||||
|
await WriteDataAsync(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user