forked from PGR/ascnet
assistant/displaychar swithcing
This commit is contained in:
parent
cc2fc93cc8
commit
cbf97c56ae
|
@ -277,8 +277,12 @@ namespace AscNet.GameServer.Handlers
|
||||||
|
|
||||||
foreach (KeyValuePair<int, long> member in team)
|
foreach (KeyValuePair<int, long> member in team)
|
||||||
{
|
{
|
||||||
session.character.AddCharacterExp((int)member.Value, stageTable.CardExp ?? 0);
|
if (member.Value > 0)
|
||||||
charData.CharacterDataList.Add(session.character.Characters.Find(c => c.Id == member.Value));
|
{
|
||||||
|
var character = session.character.AddCharacterExp((int)member.Value, stageTable.CardExp ?? 0, (int)session.player.PlayerData.Level);
|
||||||
|
if (character is not null)
|
||||||
|
charData.CharacterDataList.Add(character);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
session.SendPush(charData);
|
session.SendPush(charData);
|
||||||
|
|
|
@ -76,6 +76,59 @@ namespace AscNet.GameServer.Handlers
|
||||||
public int Code;
|
public int Code;
|
||||||
public long NextCanChangeTime;
|
public long NextCanChangeTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MessagePackObject(true)]
|
||||||
|
public class RemovePlayerDisplayCharIdRequest
|
||||||
|
{
|
||||||
|
public long CharId;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MessagePackObject(true)]
|
||||||
|
public class RemovePlayerDisplayCharIdResponse
|
||||||
|
{
|
||||||
|
public int Code;
|
||||||
|
public List<long> DisplayCharIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MessagePackObject(true)]
|
||||||
|
public class AddPlayerDisplayCharIdRequest
|
||||||
|
{
|
||||||
|
public long CharId;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MessagePackObject(true)]
|
||||||
|
public class AddPlayerDisplayCharIdResponse
|
||||||
|
{
|
||||||
|
public int Code;
|
||||||
|
public List<long> DisplayCharIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MessagePackObject(true)]
|
||||||
|
public class UpdatePlayerDisplayCharIdRequest
|
||||||
|
{
|
||||||
|
public long NewCharId;
|
||||||
|
public long OldCharId;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MessagePackObject(true)]
|
||||||
|
public class UpdatePlayerDisplayCharIdResponse
|
||||||
|
{
|
||||||
|
public int Code;
|
||||||
|
public List<long> DisplayCharIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MessagePackObject(true)]
|
||||||
|
public class SetDisplayCharIdFirstRequest
|
||||||
|
{
|
||||||
|
public long CharId;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MessagePackObject(true)]
|
||||||
|
public class SetDisplayCharIdFirstResponse
|
||||||
|
{
|
||||||
|
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.
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -141,5 +194,45 @@ namespace AscNet.GameServer.Handlers
|
||||||
|
|
||||||
session.SendResponse(new ChangePlayerBirthdayResponse(), packet.Id);
|
session.SendResponse(new ChangePlayerBirthdayResponse(), packet.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[RequestPacketHandler("UpdatePlayerDisplayCharIdRequest")]
|
||||||
|
public static void UpdatePlayerDisplayCharIdRequestHandler(Session session, Packet.Request packet)
|
||||||
|
{
|
||||||
|
UpdatePlayerDisplayCharIdRequest request = MessagePackSerializer.Deserialize<UpdatePlayerDisplayCharIdRequest>(packet.Content);
|
||||||
|
if (session.player.PlayerData.DisplayCharIdList.Contains(request.OldCharId))
|
||||||
|
{
|
||||||
|
session.player.PlayerData.DisplayCharIdList[session.player.PlayerData.DisplayCharIdList.IndexOf(request.OldCharId)] = request.NewCharId;
|
||||||
|
}
|
||||||
|
|
||||||
|
session.SendResponse(new UpdatePlayerDisplayCharIdResponse() { DisplayCharIdList = session.player.PlayerData.DisplayCharIdList }, packet.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RequestPacketHandler("AddPlayerDisplayCharIdRequest")]
|
||||||
|
public static void AddPlayerDisplayCharIdRequestHandler(Session session, Packet.Request packet)
|
||||||
|
{
|
||||||
|
AddPlayerDisplayCharIdRequest request = MessagePackSerializer.Deserialize<AddPlayerDisplayCharIdRequest>(packet.Content);
|
||||||
|
session.player.PlayerData.DisplayCharIdList.Add(request.CharId);
|
||||||
|
|
||||||
|
session.SendResponse(new AddPlayerDisplayCharIdResponse() { DisplayCharIdList = session.player.PlayerData.DisplayCharIdList }, packet.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RequestPacketHandler("RemovePlayerDisplayCharIdRequest")]
|
||||||
|
public static void RemovePlayerDisplayCharIdRequestHandler(Session session, Packet.Request packet)
|
||||||
|
{
|
||||||
|
RemovePlayerDisplayCharIdRequest request = MessagePackSerializer.Deserialize<RemovePlayerDisplayCharIdRequest>(packet.Content);
|
||||||
|
session.player.PlayerData.DisplayCharIdList.Remove(request.CharId);
|
||||||
|
|
||||||
|
session.SendResponse(new RemovePlayerDisplayCharIdResponse() { DisplayCharIdList = session.player.PlayerData.DisplayCharIdList }, packet.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RequestPacketHandler("SetDisplayCharIdFirstRequest")]
|
||||||
|
public static void SetDisplayCharIdFirstRequestHandler(Session session, Packet.Request packet)
|
||||||
|
{
|
||||||
|
SetDisplayCharIdFirstRequest request = MessagePackSerializer.Deserialize<SetDisplayCharIdFirstRequest>(packet.Content);
|
||||||
|
session.player.PlayerData.DisplayCharIdList.Remove(request.CharId);
|
||||||
|
session.player.PlayerData.DisplayCharIdList.Insert(0, request.CharId);
|
||||||
|
|
||||||
|
session.SendResponse(new SetDisplayCharIdFirstResponse() { DisplayCharIdList = session.player.PlayerData.DisplayCharIdList }, packet.Id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue