allow cash shop to open again

This commit is contained in:
Mikhail
2024-12-20 15:30:29 -05:00
parent b022eb688c
commit 5028d24b5c
3 changed files with 44 additions and 7 deletions

View File

@@ -54,11 +54,11 @@ namespace EpinelPS.StaticInfo
public Dictionary<int, ArchiveEventQuestRecord> archiveEventQuestRecords = new Dictionary<int, ArchiveEventQuestRecord>();
public Dictionary<int, ArchiveEventDungeonStageRecord> archiveEventDungeonStageRecords = new Dictionary<int, ArchiveEventDungeonStageRecord>();
public Dictionary<int, UserTitleRecord> userTitleRecords = new Dictionary<int, UserTitleRecord>();
public Dictionary<int, ArchiveMessengerConditionRecord> archiveMessengerConditionRecords;
public Dictionary<int, CharacterStatRecord> characterStatTable;
public Dictionary<int, SkillInfoRecord> skillInfoTable;
public Dictionary<int, CostRecord> costTable;
public Dictionary<int, ArchiveMessengerConditionRecord> archiveMessengerConditionRecords = [];
public Dictionary<int, CharacterStatRecord> characterStatTable = [];
public Dictionary<int, SkillInfoRecord> skillInfoTable = [];
public Dictionary<int, CostRecord> costTable = [];
public Dictionary<string, MidasProductRecord> mediasProductTable = [];
@@ -492,6 +492,12 @@ namespace EpinelPS.StaticInfo
{
this.costTable.Add(obj.id, obj);
}
var mediasProductTable = await LoadZip<MidasProductTable>("MidasProductTable.json", progress);
foreach (var obj in mediasProductTable.records)
{
this.mediasProductTable.Add(obj.midas_product_id_proximabeta, obj);
}
}
public async Task LoadJukeboxListData(ProgressBar bar)

View File

@@ -532,4 +532,19 @@
{
public List<CostRecord> records;
}
public class MidasProductRecord
{
public int id;
public string product_type;
public int product_id;
public string item_type;
public string midas_product_id_proximabeta;
public string midas_product_id_gamamobi;
public bool is_free;
public string cost;
}
public class MidasProductTable
{
public List<MidasProductRecord> records;
}
}

View File

@@ -1,4 +1,5 @@
using EpinelPS.Utils;
using EpinelPS.StaticInfo;
using EpinelPS.Utils;
namespace EpinelPS.LobbyServer.Msgs.Shop
{
@@ -14,7 +15,22 @@ namespace EpinelPS.LobbyServer.Msgs.Shop
var response = new ResGetJupiterProductList();
foreach (var item in x.ProductIdList)
{
response.ProductInfoList.Add(new NetJupiterProductInfo() { CurrencyCode = "US", CurrencySymbol = "$", MicroPrice = 0, Price = "1", ProductId = item });
// 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;
long microPrice = (long)(double.Parse(record.cost) * 1000000);
response.ProductInfoList.Add(new NetJupiterProductInfo() { CurrencyCode = "USD", CurrencySymbol = "$", MicroPrice = microPrice, Price = record.cost, ProductId = item });
}
else
{
Console.WriteLine("Missing!!!! " + item);
}
}
await WriteDataAsync(response);
}