forked from PGR/ascnet
1
0
Fork 0

don't throw up in leveling up equip when using equip, BIG TODO

This commit is contained in:
rfi 2024-04-10 19:10:24 +07:00
parent db41e1c69e
commit feaf5f8a41
1 changed files with 9 additions and 3 deletions

View File

@ -85,8 +85,8 @@ namespace AscNet.GameServer.Handlers
public class EquipLevelUpRequest public class EquipLevelUpRequest
{ {
public int EquipId; public int EquipId;
public Dictionary<int, int> UseItems; public Dictionary<int, int>? UseItems;
public List<int> UseEquipIdList; public List<int>? UseEquipIdList;
} }
[MessagePackObject(true)] [MessagePackObject(true)]
@ -109,7 +109,7 @@ namespace AscNet.GameServer.Handlers
NotifyItemDataList notifyItemData = new(); NotifyItemDataList notifyItemData = new();
int totalExp = 0; int totalExp = 0;
int totalCost = 0; int totalCost = 0;
foreach (var item in request.UseItems) foreach (var item in request.UseItems ?? [])
{ {
ItemTable? itemTable = TableReaderV2.Parse<ItemTable>().FirstOrDefault(x => x.Id == item.Key); ItemTable? itemTable = TableReaderV2.Parse<ItemTable>().FirstOrDefault(x => x.Id == item.Key);
if (itemTable is not null) if (itemTable is not null)
@ -121,6 +121,12 @@ namespace AscNet.GameServer.Handlers
} }
} }
// TODO: Handle equip enchantment with equip cost
/*foreach (var costEquipId in request.UseEquipIdList ?? [])
{
}*/
notifyItemData.ItemDataList.Add(session.inventory.Do(Inventory.Coin, totalCost * -1)); notifyItemData.ItemDataList.Add(session.inventory.Do(Inventory.Coin, totalCost * -1));
session.SendPush(notifyItemData); session.SendPush(notifyItemData);