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