forked from PGR/ascnet
backgroundsss
This commit is contained in:
parent
303fb25027
commit
d289d50221
|
@ -112,6 +112,9 @@ namespace AscNet.Common.Database
|
|||
[BsonElement("gather_rewards")]
|
||||
public List<int> GatherRewards { get; set; } = new();
|
||||
|
||||
[BsonElement("use_background_id")]
|
||||
public int UseBackgroundId { get; set; } = 14000001;
|
||||
|
||||
[BsonElement("team_groups")]
|
||||
[BsonRequired]
|
||||
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfDocuments)]
|
||||
|
|
|
@ -3,6 +3,7 @@ using AscNet.Common.MsgPack;
|
|||
using AscNet.Common.Util;
|
||||
using AscNet.Table.V2.share.chat;
|
||||
using AscNet.Table.V2.share.guide;
|
||||
using AscNet.Table.V2.share.photomode;
|
||||
using MessagePack;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
@ -138,7 +139,7 @@ namespace AscNet.GameServer.Handlers
|
|||
FubenMainLineData = new(),
|
||||
FubenChapterExtraLoginData = new(),
|
||||
FubenUrgentEventData = new(),
|
||||
UseBackgroundId = 14000001 // main ui theme, table still failed to dump
|
||||
UseBackgroundId = session.player.UseBackgroundId
|
||||
};
|
||||
if (notifyLogin.PlayerData.DisplayCharIdList.Count < 1)
|
||||
notifyLogin.PlayerData.DisplayCharIdList.Add(notifyLogin.PlayerData.DisplayCharId);
|
||||
|
@ -206,6 +207,11 @@ namespace AscNet.GameServer.Handlers
|
|||
ItemDataList = session.inventory.Items
|
||||
};
|
||||
|
||||
NotifyBackgroundLoginData notifyBackground = new()
|
||||
{
|
||||
HaveBackgroundIds = TableReaderV2.Parse<BackgroundTable>().Select(x => (uint)x.Id).ToList()
|
||||
};
|
||||
|
||||
session.SendPush(notifyLogin);
|
||||
session.SendPush(notifyStageData);
|
||||
session.SendPush(notifyCharacterData);
|
||||
|
@ -213,6 +219,7 @@ namespace AscNet.GameServer.Handlers
|
|||
session.SendPush(notifyAssistData);
|
||||
session.SendPush(notifyChatLoginData);
|
||||
session.SendPush(notifyItemDataList);
|
||||
session.SendPush(notifyBackground);
|
||||
|
||||
#region DisclamerMail
|
||||
NotifyMails notifyMails = new();
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
using AscNet.Common.MsgPack;
|
||||
using AscNet.Common.Util;
|
||||
using AscNet.Table.V2.share.fashion;
|
||||
using MessagePack;
|
||||
|
||||
namespace AscNet.GameServer.Handlers
|
||||
{
|
||||
#region MsgPackScheme
|
||||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
[MessagePackObject(true)]
|
||||
public class ChangeDisplayRequest
|
||||
{
|
||||
public int FashionId;
|
||||
public int CharId;
|
||||
public int BackgroundId;
|
||||
}
|
||||
|
||||
[MessagePackObject(true)]
|
||||
public class ChangeDisplayResponse
|
||||
{
|
||||
public int Code;
|
||||
public List<long> DisplayCharIdList;
|
||||
}
|
||||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
#endregion
|
||||
|
||||
internal class PhotographModule
|
||||
{
|
||||
[RequestPacketHandler("ChangeDisplayRequest")]
|
||||
public static void ChangeDisplayRequestHandler(Session session, Packet.Request packet)
|
||||
{
|
||||
ChangeDisplayRequest request = packet.Deserialize<ChangeDisplayRequest>();
|
||||
|
||||
session.player.UseBackgroundId = request.BackgroundId;
|
||||
if (!session.player.PlayerData.DisplayCharIdList.Contains(request.CharId))
|
||||
{
|
||||
session.player.PlayerData.DisplayCharId = request.CharId;
|
||||
session.player.PlayerData.DisplayCharIdList.Add(request.CharId);
|
||||
}
|
||||
|
||||
NotifyCharacterDataList.CharacterData? character = session.character.Characters.Find(x => x.Id == request.CharId);
|
||||
if (character is not null && character.FashionId != request.FashionId && TableReaderV2.Parse<FashionTable>().Any(x => x.CharacterId == request.CharId && x.Id == request.FashionId))
|
||||
{
|
||||
character.FashionId = (uint)request.FashionId;
|
||||
|
||||
NotifyCharacterDataList notifyCharacterData = new();
|
||||
notifyCharacterData.CharacterDataList.Add(character);
|
||||
|
||||
session.SendPush(notifyCharacterData);
|
||||
}
|
||||
|
||||
session.SendResponse(new ChangeDisplayResponse() { DisplayCharIdList = session.player.PlayerData.DisplayCharIdList }, packet.Id);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue