diff --git a/AscNet.GameServer/Handlers/AccountModule.cs b/AscNet.GameServer/Handlers/AccountModule.cs
index 56cb6cb..5463497 100644
--- a/AscNet.GameServer/Handlers/AccountModule.cs
+++ b/AscNet.GameServer/Handlers/AccountModule.cs
@@ -140,7 +140,6 @@ namespace AscNet.GameServer.Handlers
FubenMainLineData = new(),
FubenChapterExtraLoginData = new(),
FubenUrgentEventData = new(),
- ItemList = session.inventory.Items,
UseBackgroundId = 14000001 // main ui theme, table still failed to dump
};
if (notifyLogin.PlayerData.DisplayCharIdList.Count < 1)
@@ -191,11 +190,24 @@ namespace AscNet.GameServer.Handlers
UnlockEmojis = EmojiTableReader.Instance.All.Select(x => new NotifyChatLoginData.NotifyChatLoginDataUnlockEmoji() { Id = (uint)x.Id }).ToList()
};
+ NotifyItemDataList notifyItemDataList = new()
+ {
+ /*ItemDataList = TableReaderV2.Parse
().Select(x => new Item()
+ {
+ Id = x.Id,
+ Count = x.MaxCount ?? 999_999_999,
+ RefreshTime = DateTimeOffset.Now.ToUnixTimeSeconds(),
+ CreateTime = DateTimeOffset.Now.ToUnixTimeSeconds()
+ }).ToList(),*/
+ ItemDataList = session.inventory.Items
+ };
+
session.SendPush(notifyLogin);
session.SendPush(notifyCharacterData);
session.SendPush(notifyEquipData);
session.SendPush(notifyAssistData);
session.SendPush(notifyChatLoginData);
+ session.SendPush(notifyItemDataList);
#region DisclamerMail
NotifyMails notifyMails = new();
diff --git a/AscNet.GameServer/Handlers/FightModule.cs b/AscNet.GameServer/Handlers/FightModule.cs
index 2a287aa..8b31614 100644
--- a/AscNet.GameServer/Handlers/FightModule.cs
+++ b/AscNet.GameServer/Handlers/FightModule.cs
@@ -1,4 +1,5 @@
-using AscNet.Common.MsgPack;
+using AscNet.Common.Database;
+using AscNet.Common.MsgPack;
using AscNet.Common.Util;
using AscNet.Table.share.fuben;
using AscNet.Table.V2.share.reward;
@@ -204,9 +205,13 @@ namespace AscNet.GameServer.Handlers
session.SendResponse(new FightSettleResponse() { Code = 20032004 }, packet.Id);
return;
}
+
List rewards = new();
List rewardTables = TableReaderV2.Parse().Where(x => session.stage.Stages.ContainsKey(req.Result.StageId) ? x.Id == stageTable.FinishDropId : (x.Id == stageTable.FinishDropId || x.Id == stageTable.FirstRewardId)).ToList();
+ NotifyItemDataList notifyItemData = new();
+ notifyItemData.ItemDataList.Add(session.inventory.Do(Inventory.TeamExp, stageTable.TeamExp ?? 0));
+
foreach (var rewardGoodsId in rewardTables.SelectMany(x => x.SubIds))
{
RewardGoodsTable? rewardGood = TableReaderV2.Parse().FirstOrDefault(x => x.Id == rewardGoodsId);
@@ -227,9 +232,7 @@ namespace AscNet.GameServer.Handlers
// TODO: Implement other types. Other types are behaving weirdly
if (rewardType == RewardType.Item)
{
- NotifyItemDataList notifyItemData = new();
notifyItemData.ItemDataList.Add(session.inventory.Do(rewardGood.TemplateId, rewardGood.Count));
- session.SendPush(notifyItemData);
rewards.Add(new()
{
@@ -242,6 +245,9 @@ namespace AscNet.GameServer.Handlers
}
}
+ session.SendPush(notifyItemData);
+ session.ExpSanityCheck();
+
StageDatum stageData = new()
{
StageId = req.Result.StageId,
diff --git a/AscNet.GameServer/SessionExtensions.cs b/AscNet.GameServer/SessionExtensions.cs
new file mode 100644
index 0000000..bf04ba3
--- /dev/null
+++ b/AscNet.GameServer/SessionExtensions.cs
@@ -0,0 +1,44 @@
+using AscNet.Common.Database;
+using AscNet.Common.MsgPack;
+using AscNet.Common.Util;
+using AscNet.Table.V2.share.player;
+
+namespace AscNet.GameServer
+{
+ public static class SessionExtensions
+ {
+ ///
+ /// Please invoke after messing with TeamExp(commandant exp) count!
+ ///
+ ///
+ public static void ExpSanityCheck(this Session session)
+ {
+ Item? expItem = session.inventory.Items.FirstOrDefault(x => x.Id == Inventory.TeamExp);
+ if (expItem is null)
+ return;
+
+ PlayerTable? playerLevel = TableReaderV2.Parse().FirstOrDefault(x => x.Level == session.player.PlayerData.Level);
+ if (playerLevel is null)
+ return;
+
+ if (expItem.Count < playerLevel.MaxExp)
+ return;
+
+ expItem.Count -= playerLevel.MaxExp;
+ session.player.PlayerData.Level++;
+
+ NotifyPlayerLevel notifyPlayerLevel = new()
+ {
+ Level = (int)session.player.PlayerData.Level
+ };
+ NotifyItemDataList notifyItemDataList = new();
+ notifyItemDataList.ItemDataList.Add(expItem);
+ notifyItemDataList.ItemDataList.Add(session.inventory.Do(Inventory.ActionPoint, playerLevel.FreeActionPoint));
+
+ session.SendPush(notifyPlayerLevel);
+ session.SendPush(notifyItemDataList);
+
+ session.ExpSanityCheck();
+ }
+ }
+}