New tables + Lucia messages

This commit is contained in:
rfi
2023-11-20 22:19:46 +07:00
parent 6976803f97
commit 989e02aeaf
5113 changed files with 344818 additions and 188939 deletions

View File

@@ -206,7 +206,7 @@ namespace AscNet.GameServer.Handlers
Content = @"Hello Commandant!
Welcome to AscNet, we are happy that you are using this Server Software.
This Server Software is always free and if you are paying to gain access to this you are being SCAMMED, we encourage you to help prevent another buyer like you by making a PSA or telling others whom you may see as potential users.
Sorry for the inconvinience.
Sorry for the inconvenience.
欢迎来到 AscNet我们很高兴您使用本服务器软件。
本服务器软件始终是免费的,如果您是通过付费来使用本软件,那您就被骗了,我们鼓励您告诉其他潜在用户,以防止再有像您这样的买家。
@@ -217,7 +217,12 @@ Sorry for the inconvinience.
ExpireTime = DateTimeOffset.Now.ToUnixTimeSeconds() * 2,
IsForbidDelete = true
});
NotifyWorldChat notifyWorldChat = new();
notifyWorldChat.ChatMessages.Add(ChatModule.MakeLuciaMessage($"Hello {session.player.PlayerData.Name}! Welcome to AscNet, please read mails if you haven't already.\n如果您还没有阅读邮件请阅读邮件"));
session.SendPush(notifyMails);
session.SendPush(notifyWorldChat);
#endregion
// NEEDED to not softlock!

View File

@@ -11,14 +11,15 @@ namespace AscNet.GameServer.Handlers
CharacterUpgradeSkillGroupRequest request = packet.Deserialize<CharacterUpgradeSkillGroupRequest>();
var upgradeResult = session.character.UpgradeCharacterSkillGroup(request.SkillGroupId, request.Count);
session.inventory.Do(Inventory.Coin, upgradeResult.CoinCost * -1);
session.inventory.Do(Inventory.SkillPoint, upgradeResult.SkillPointCost * -1);
NotifyCharacterDataList notifyCharacterData = new();
notifyCharacterData.CharacterDataList.AddRange(session.character.Characters.Where(x => upgradeResult.AffectedCharacters.Contains(x.Id)));
NotifyItemDataList notifyItemData = new();
notifyItemData.ItemDataList.AddRange(session.inventory.Items.Where(x => x.Id == Inventory.Coin || x.Id == Inventory.SkillPoint));
notifyItemData.ItemDataList.AddRange(new Item[] {
session.inventory.Do(Inventory.Coin, upgradeResult.CoinCost * -1),
session.inventory.Do(Inventory.SkillPoint, upgradeResult.SkillPointCost * -1)
});
session.SendPush(notifyCharacterData);
session.SendPush(notifyItemData);

View File

@@ -103,7 +103,7 @@ namespace AscNet.GameServer.Handlers
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
#endregion
internal class ChatModule
internal class ChatModule
{
[RequestPacketHandler("EnterWorldChatRequest")]
public static void EnterWorldChatRequestHandler(Session session, Packet.Request packet)
@@ -153,6 +153,9 @@ internal class ChatModule
request.ChatData.Icon = (int)session.player.PlayerData.CurrHeadPortraitId;
request.ChatData.NickName = session.player.PlayerData.Name;
NotifyWorldChat notifyWorldChat = new();
notifyWorldChat.ChatMessages.Add(request.ChatData);
if (request.ChatData.Content is not null && request.ChatData.Content.StartsWith('/'))
{
var cmdStrings = request.ChatData.Content.Split(" ");
@@ -162,20 +165,17 @@ internal class ChatModule
Command? cmd = CommandFactory.CreateCommand(cmdStrings.First().Split('/').Last(), session, cmdStrings[1..]);
if (cmd is null)
{
// Invalid command
notifyWorldChat.ChatMessages.Add(MakeLuciaMessage($"Invalid command {cmdStrings.First().Split('/').Last()}, try /help"));
}
cmd?.Execute();
}
catch (Exception)
{
// Failed to execute command
notifyWorldChat.ChatMessages.Add(MakeLuciaMessage($"Command {cmdStrings.First().Split('/').Last()} failed to execute!"));
}
}
NotifyWorldChat notifyWorldChat = new();
notifyWorldChat.ChatMessages.Add(request.ChatData);
session.SendPush(notifyWorldChat);
session.SendResponse(new SendChatResponse() { Code = 0, ChatData = request.ChatData, RefreshTime = DateTimeOffset.Now.ToUnixTimeSeconds() }, packet.Id);
}
@@ -192,6 +192,18 @@ internal class ChatModule
}, packet.Id);
}
public static ChatData MakeLuciaMessage(string content)
{
return new ChatData()
{
Content = content,
Icon = 9010102,
ChannelType = ChatChannelType.World,
MsgType = ChatMsgType.Normal,
NickName = "System - Lucia"
};
}
#region EmojiPackModule
[RequestPacketHandler("GetEmojiPackageIdRequest")]
public static void GetEmojiPackageIdRequestHandler(Session session, Packet.Request packet)