diff --git a/Arrowgene.Ddon.GameServer/GameStructure.cs b/Arrowgene.Ddon.GameServer/GameStructure.cs index bf9b0dea1..4b3033171 100644 --- a/Arrowgene.Ddon.GameServer/GameStructure.cs +++ b/Arrowgene.Ddon.GameServer/GameStructure.cs @@ -11,7 +11,7 @@ public static void CDataCharacterListElement( Character character) { CDataCommunityCharacterBaseInfo(cDataCharacterListElement.CommunityCharacterBaseInfo, character); - cDataCharacterListElement.ServerId = 0; + cDataCharacterListElement.ServerId = character.Server.Id; cDataCharacterListElement.OnlineStatus = 0; CDataJobBaseInfo(cDataCharacterListElement.CurrentJobBaseInfo, character.Job, (byte)character.ActiveCharacterJobData.Lv); diff --git a/Arrowgene.Ddon.GameServer/Handler/PartyPartyCreateHandler.cs b/Arrowgene.Ddon.GameServer/Handler/PartyPartyCreateHandler.cs index 7fa6f14f1..1fbb665bf 100644 --- a/Arrowgene.Ddon.GameServer/Handler/PartyPartyCreateHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/PartyPartyCreateHandler.cs @@ -2,6 +2,7 @@ using Arrowgene.Ddon.Server; using Arrowgene.Ddon.Shared; using Arrowgene.Ddon.Shared.Entity.PacketStructure; +using Arrowgene.Ddon.Shared.Model; using Arrowgene.Ddon.Shared.Network; using Arrowgene.Logging; @@ -17,52 +18,54 @@ public PartyPartyCreateHandler(DdonGameServer server) : base(server) public override void Handle(GameClient client, StructurePacket packet) { - S2CPartyPartyCreateRes partyCreateRes = new S2CPartyPartyCreateRes(); + S2CPartyPartyCreateRes res = new S2CPartyPartyCreateRes(); PartyGroup party = Server.PartyManager.NewParty(); if (party == null) { - Logger.Error(client, "Failed to create party"); - // TODO return error + Logger.Error(client, "can not create party (Server.PartyManager.NewParty() == null)"); + res.Error = (uint)ErrorCode.ERROR_CODE_FAIL; + client.Send(res); return; } - PlayerPartyMember member = party.Invite(client, client); - if (member == null) + ErrorRes invite = party.Invite(client, client); + if (invite.HasError) { - Logger.Error(client, "Failed to join new party"); - // TODO return error + Logger.Error(client, "failed to invite to new party"); + res.Error = (uint)invite.ErrorCode; + client.Send(res); return; } - ErrorRes memberRes = party.Accept(client); - if (memberRes.HasError) + ErrorRes accept = party.Accept(client); + if (accept.HasError) { - Logger.Error(client, "Failed to accept new party"); - partyCreateRes.Error = (uint)memberRes.ErrorCode; - client.Send(partyCreateRes); + Logger.Error(client, "failed to accept new party"); + res.Error = (uint)accept.ErrorCode; + client.Send(res); return; } - member = party.Join(client); - if (member == null) + ErrorRes join = party.Join(client); + if (join.HasError) { Logger.Error(client, "Failed to join new party"); - // TODO return error + res.Error = (uint)join.ErrorCode; + client.Send(res); return; } - Logger.Info(client, $"Created Party with PartyId:{party.Id}"); - - S2CPartyPartyJoinNtc partyJoinNtc = new S2CPartyPartyJoinNtc(); - partyJoinNtc.HostCharacterId = client.Character.Id; - partyJoinNtc.LeaderCharacterId = client.Character.Id; - partyJoinNtc.PartyMembers.Add(member.GetCDataPartyMember()); - client.Send(partyJoinNtc); + S2CPartyPartyJoinNtc ntc = new S2CPartyPartyJoinNtc(); + ntc.HostCharacterId = client.Character.Id; + ntc.LeaderCharacterId = client.Character.Id; + ntc.PartyMembers.Add(join.Value.GetCDataPartyMember()); + client.Send(ntc); + res.PartyId = party.Id; + client.Send(res); - partyCreateRes.PartyId = party.Id; - client.Send(partyCreateRes); + Logger.Info(client, $"created party with PartyId:{party.Id}"); } } } diff --git a/Arrowgene.Ddon.GameServer/Handler/PartyPartyInviteCancelHandler.cs b/Arrowgene.Ddon.GameServer/Handler/PartyPartyInviteCancelHandler.cs index 7fed8846a..c1b1927f8 100644 --- a/Arrowgene.Ddon.GameServer/Handler/PartyPartyInviteCancelHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/PartyPartyInviteCancelHandler.cs @@ -15,8 +15,15 @@ public PartyPartyInviteCancelHandler(DdonGameServer server) : base(server) { } + + /// + /// There seems to be no way to + /// + /// + /// public override void Handle(GameClient client, StructurePacket packet) { + Logger.Info(client, $"C2SPartyPartyInviteCancelReq -> ServerId:{packet.Structure.ServerId} PartyId:{packet.Structure.PartyId}"); S2CPartyPartyInviteCancelRes res = new S2CPartyPartyInviteCancelRes(); PartyGroup party = client.Party; diff --git a/Arrowgene.Ddon.GameServer/Handler/PartyPartyInviteCharacterHandler.cs b/Arrowgene.Ddon.GameServer/Handler/PartyPartyInviteCharacterHandler.cs index 358174e43..e9b6ea91a 100644 --- a/Arrowgene.Ddon.GameServer/Handler/PartyPartyInviteCharacterHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/PartyPartyInviteCharacterHandler.cs @@ -1,6 +1,8 @@ using Arrowgene.Ddon.GameServer.Party; using Arrowgene.Ddon.Server; +using Arrowgene.Ddon.Shared; using Arrowgene.Ddon.Shared.Entity.PacketStructure; +using Arrowgene.Ddon.Shared.Model; using Arrowgene.Ddon.Shared.Network; using Arrowgene.Logging; @@ -33,38 +35,37 @@ public PartyPartyInviteCharacterHandler(DdonGameServer server) : base(server) // S2CContextGetLobbyPlayerContextNtc to the new party member, it should maybe also be sent to all members // More stuff to determine // TODO: Figure out just how much packets/data within those packets we can do without while keeping everything functioning. - // TODO PartyGorup need invite management public override void Handle(GameClient client, StructurePacket packet) { + S2CPartyPartyInviteCharacterRes res = new S2CPartyPartyInviteCharacterRes(); + GameClient invitedClient = Server.ClientLookup.GetClientByCharacterId(packet.Structure.CharacterId); if (invitedClient == null) { - Logger.Error(client, - $"Could not locate CharacterId:{packet.Structure.CharacterId} for party invitation"); - // TODO error response + Logger.Error(client, $"not found CharacterId:{packet.Structure.CharacterId} for party invitation"); + res.Error = (uint)ErrorCode.ERROR_CODE_FAIL; + client.Send(res); return; } PartyGroup party = client.Party; if (party == null) { - Logger.Error(client, - $"can not invite, as he is not inside party"); - // TODO error response + Logger.Error(client, "can not invite (client.Party == null)"); + res.Error = (uint)ErrorCode.ERROR_CODE_FAIL; + client.Send(res); return; } - PlayerPartyMember invitedMember = party.Invite(invitedClient, client); - if (invitedMember == null) + ErrorRes invitedMember = party.Invite(invitedClient, client); + if (invitedMember.HasError) { - Logger.Error(client, - $"could not invite {invitedClient.Identity}, party did not accept invitiation"); - // TODO error response + Logger.Error(client, $"could not invite {invitedClient.Identity}"); + res.Error = (uint)invitedMember.ErrorCode; + client.Send(res); return; } - Logger.Info(client, $"Invited Client:{invitedClient.Identity} to PartyId:{party.Id}"); - S2CPartyPartyInviteNtc ntc = new S2CPartyPartyInviteNtc(); ntc.TimeoutSec = PartyManager.InvitationTimeoutSec; ntc.PartyListInfo.PartyId = party.Id; @@ -73,15 +74,17 @@ public override void Handle(GameClient client, StructurePacket packet) { S2CPartyPartyInviteRefuseRes res = new S2CPartyPartyInviteRefuseRes(); - + PartyInvitation invitation = Server.PartyManager.GetPartyInvitation(client); if (invitation == null) { Logger.Error(client, "failed to find invitation"); + res.Error = (uint)ErrorCode.ERROR_CODE_PARTY_NOT_INVITED; client.Send(res); return; } @@ -30,27 +33,30 @@ public override void Handle(GameClient client, StructurePacket refuse = party.RefuseInvite(client); + if (refuse.HasError) + { + res.Error = (uint)refuse.ErrorCode; + client.Send(res); + return; + } client.Send(res); - Logger.Info(client, $"refuse invite for PartyId:{invitation.Party.Id}"); } } } diff --git a/Arrowgene.Ddon.GameServer/Handler/PartyPartyJoinHandler.cs b/Arrowgene.Ddon.GameServer/Handler/PartyPartyJoinHandler.cs index 4000e413e..92467ad20 100644 --- a/Arrowgene.Ddon.GameServer/Handler/PartyPartyJoinHandler.cs +++ b/Arrowgene.Ddon.GameServer/Handler/PartyPartyJoinHandler.cs @@ -1,6 +1,8 @@ using Arrowgene.Ddon.GameServer.Party; using Arrowgene.Ddon.Server; +using Arrowgene.Ddon.Shared; using Arrowgene.Ddon.Shared.Entity.PacketStructure; +using Arrowgene.Ddon.Shared.Model; using Arrowgene.Ddon.Shared.Network; using Arrowgene.Logging; @@ -16,40 +18,38 @@ public PartyPartyJoinHandler(DdonGameServer server) : base(server) public override void Handle(GameClient client, StructurePacket packet) { + S2CPartyPartyJoinRes res = new S2CPartyPartyJoinRes(); + PartyGroup party = Server.PartyManager.GetParty(packet.Structure.PartyId); if (party == null) { - Logger.Error(client, "Could not join party, does not exist"); - // todo return error + Logger.Error(client, "failed to find party (Server.PartyManager.GetParty() == null)"); + res.Error = (uint)ErrorCode.ERROR_CODE_FAIL; + client.Send(res); return; } - PartyMember partyMember = party.Join(client); - if (partyMember == null) + ErrorRes join = party.Join(client); + if (join.HasError) { - Logger.Error(client, "Could not join party, its full"); - // todo return error + Logger.Error(client, "failed to join party"); + res.Error = (uint)join.ErrorCode; + client.Send(res); return; } - - Logger.Info(client, $"Joined PartyId:{party.Id}"); - - S2CPartyPartyJoinRes response = new S2CPartyPartyJoinRes(); - response.PartyId = party.Id; - client.Send(response); + res.PartyId = party.Id; + client.Send(res); - // Send updated member list to all party members - S2CPartyPartyJoinNtc partyJoinNtc = new S2CPartyPartyJoinNtc(); - partyJoinNtc.HostCharacterId = party.Host.Character.Id; - partyJoinNtc.LeaderCharacterId = party.Leader.Character.Id; - // Send party player context NTCs to the new member + S2CPartyPartyJoinNtc ntc = new S2CPartyPartyJoinNtc(); + ntc.HostCharacterId = party.Host.Character.Id; + ntc.LeaderCharacterId = party.Leader.Character.Id; foreach (PartyMember member in party.Members) { - partyJoinNtc.PartyMembers.Add(member.GetCDataPartyMember()); + ntc.PartyMembers.Add(member.GetCDataPartyMember()); } - party.SendToAll(partyJoinNtc); + party.SendToAll(ntc); // Send party player context NTCs to the new member @@ -58,6 +58,8 @@ public override void Handle(GameClient client, StructurePacket packet) { + S2CPartyPartyMemberKickRes res = new S2CPartyPartyMemberKickRes(); + PartyGroup party = client.Party; if (party == null) { - Logger.Error(client, "party null"); - // TODO + Logger.Error(client, "(party == null)"); + res.Error = (uint)ErrorCode.ERROR_CODE_FAIL; + client.Send(res); return; } - PartyMember member = party.Kick(packet.Structure.MemberIndex); - if (member == null) + ErrorRes member = party.Kick(client, packet.Structure.MemberIndex); + if (member.HasError) { - Logger.Error(client, "failed to kick"); - // TODO + res.Error = (uint)member.ErrorCode; + client.Send(res); return; } S2CPartyPartyMemberKickNtc ntc = new S2CPartyPartyMemberKickNtc(); - ntc.MemberIndex = (byte)member.MemberIndex; + ntc.MemberIndex = (byte)member.Value.MemberIndex; party.SendToAll(ntc); - if (member is PlayerPartyMember playerMember) + if (member.Value is PlayerPartyMember playerMember) { playerMember.Client.Send(ntc); } - - S2CPartyPartyMemberKickRes res = new S2CPartyPartyMemberKickRes(); + client.Send(res); } } diff --git a/Arrowgene.Ddon.GameServer/Party/PartyGroup.cs b/Arrowgene.Ddon.GameServer/Party/PartyGroup.cs index 787b18f0f..fe55daa0a 100644 --- a/Arrowgene.Ddon.GameServer/Party/PartyGroup.cs +++ b/Arrowgene.Ddon.GameServer/Party/PartyGroup.cs @@ -106,16 +106,18 @@ public List Members } } - /// - /// Player has been invited and will be holding a slot for them. - /// However they are not assigned to this party until joined. - /// - /// PlayerPartyMember if a slot could be secured, or null on failure - public PlayerPartyMember Invite(GameClient invitee, GameClient host) + public ErrorRes Invite(GameClient invitee, GameClient host) { if (invitee == null) { - return null; + Logger.Error($"[PartyId:{Id}][Invite] (invitee == null)"); + return ErrorRes.Fail; + } + + if (host == null) + { + Logger.Error($"[PartyId:{Id}][Invite] (host == null)"); + return ErrorRes.Fail; } PlayerPartyMember partyMember = CreatePartyMember(invitee); @@ -123,19 +125,20 @@ public PlayerPartyMember Invite(GameClient invitee, GameClient host) { if (!_partyManager.InviteParty(invitee, host, this)) { - Logger.Error(invitee, "could not register client for invitation"); - return null; + Logger.Error(invitee, $"[PartyId:{Id}][Invite] could not be invited"); + return ErrorRes.Error(ErrorCode.ERROR_CODE_PARTY_IS_NOT_LEADER); } int slotIndex = TakeSlot(partyMember); if (slotIndex <= InvalidSlotIndex) { - Logger.Error(invitee, "No free slot available for client"); - return null; + Logger.Error(invitee, $"[PartyId:{Id}][Invite] no free slot available"); + return ErrorRes.Error(ErrorCode.ERROR_CODE_PARTY_IS_NOT_LEADER); } + Logger.Info(host, $"[PartyId:{Id}][Invite] invited {invitee.Identity}"); partyMember.JoinState = JoinState.Prepare; - return partyMember; + return ErrorRes.Success(partyMember); } } @@ -143,6 +146,7 @@ public ErrorRes RefuseInvite(GameClient client) { if (client == null) { + Logger.Error($"[PartyId:{Id}][RefuseInvite] (client == null)"); return ErrorRes.Fail; } @@ -151,32 +155,28 @@ public ErrorRes RefuseInvite(GameClient client) PartyInvitation invitation = _partyManager.RemovePartyInvitation(client); if (invitation == null) { - Logger.Error(client, "client was not registered for party"); + Logger.Error(client, $"[PartyId:{Id}][RefuseInvite] was not invited"); return ErrorRes.Fail; } PlayerPartyMember partyMember = GetPlayerPartyMember(client); if (partyMember == null) { - Logger.Error(client, "client has no slot in this party"); + Logger.Error(client, $"[PartyId:{Id}][RefuseInvite] has no slot"); return ErrorRes.Fail; } FreeSlot(partyMember.MemberIndex); + Logger.Info(client, $"[PartyId:{Id}][RefuseInvite] refused invite"); return ErrorRes.Success(invitation); } } - - /// - /// Player has accepted the invitation and will progress to joining the party. - /// - /// - /// PlayerPartyMember on joining, or null on failure public ErrorRes Accept(GameClient client) { if (client == null) { + Logger.Error($"[PartyId:{Id}][Accept] (client == null)"); return ErrorRes.Fail; } @@ -185,39 +185,41 @@ public ErrorRes Accept(GameClient client) PartyInvitation invitation = _partyManager.RemovePartyInvitation(client); if (invitation == null) { - Logger.Error(client, "client was not registered for party"); + Logger.Error(client, $"[PartyId:{Id}][Accept] not invited"); return ErrorRes.Fail; } if (invitation.Party != this) { - Logger.Error(client, "client was not invited to this party"); + Logger.Error(client, $"[PartyId:{Id}][Accept] not invited to this party"); return ErrorRes.Fail; } TimeSpan invitationAge = DateTime.Now - invitation.Date; if (invitationAge > TimeSpan.FromSeconds(PartyManager.InvitationTimeoutSec)) { - Logger.Error(client, "invitation expired"); + Logger.Error(client, $"[PartyId:{Id}][Accept] invitation expired"); return ErrorRes.Error(ErrorCode.ERROR_CODE_PARTY_INVITE_FAIL_REASON_TIMEOUT); } PlayerPartyMember partyMember = GetPlayerPartyMember(client); if (partyMember == null) { - Logger.Error(client, "client has no slot in this party"); + Logger.Error(client, $"[PartyId:{Id}][Accept] has no slot"); return ErrorRes.Fail; } + Logger.Info(client, $"[PartyId:{Id}][Accept] accepted invite"); return ErrorRes.Success(partyMember); } } - public PlayerPartyMember Join(GameClient client) + public ErrorRes Join(GameClient client) { if (client == null) { - return null; + Logger.Error($"[PartyId:{Id}][Join(GameClient)] (client == null)"); + return ErrorRes.Fail; } lock (_lock) @@ -225,8 +227,8 @@ public PlayerPartyMember Join(GameClient client) PlayerPartyMember partyMember = GetPlayerPartyMember(client); if (partyMember == null) { - Logger.Error(client, "client has no slot in this party"); - return null; + Logger.Error(client, $"[PartyId:{Id}][Join(GameClient)] has no slot"); + return ErrorRes.Fail; } client.Party = this; @@ -239,8 +241,8 @@ public PlayerPartyMember Join(GameClient client) } partyMember.JoinState = JoinState.On; - - return partyMember; + Logger.Info(client, $"[PartyId:{Id}][Join(GameClient)] joined"); + return ErrorRes.Success(partyMember); } } @@ -248,6 +250,7 @@ public PawnPartyMember Join(Pawn pawn) { if (pawn == null) { + Logger.Error($"[PartyId:{Id}][Join(Pawn)] (pawn == null)"); return null; } @@ -257,13 +260,13 @@ public PawnPartyMember Join(Pawn pawn) int slotIndex = TakeSlot(partyMember); if (slotIndex <= InvalidSlotIndex) { - Logger.Error("No free slot available for pawn"); + Logger.Error($"[PartyId:{Id}][Join(Pawn)Id:{pawn.Id}] no slot available"); return null; } partyMember.JoinState = JoinState.On; - + Logger.Info($"[PartyId:{Id}][Join(Pawn)Id:{pawn.Id}] joined"); return partyMember; } } @@ -272,15 +275,15 @@ public void Leave(GameClient client) { if (client == null) { + Logger.Error($"[PartyId:{Id}][Leave(GameClient)] (client == null)"); return; } - Logger.Info(client, $"Leaving Party:{Id}"); lock (_lock) { if (client.Party != this) { - Logger.Error(client, "client not part of this party"); + Logger.Error(client, $"[PartyId:{Id}][Leave(GameClient)] not part of this party"); return; } @@ -292,80 +295,135 @@ public void Leave(GameClient client) PlayerPartyMember partyMember = GetPlayerPartyMember(client); if (partyMember == null) { - Logger.Error(client, "client has no slot in this party"); + Logger.Error(client, $"[PartyId:{Id}][Leave(GameClient)] has no slot"); return; } FreeSlot(partyMember.MemberIndex); + Logger.Info(client, $"[PartyId:{Id}][Leave(GameClient)] left"); if (Clients.Count <= 0) { - Logger.Info(client, $"last person of party:{Id} left, disband party"); + Logger.Info(client, $"[PartyId:{Id}][Leave(GameClient)] was the last person, disband"); _partyManager.DisbandParty(Id); return; } if (partyMember.IsLeader) { - Logger.Info(client, $"was leader of party:{Id}, leader left"); - // TODO designate new leader + _leader = null; + Logger.Info(client, $"[PartyId:{Id}][Leave(GameClient)] leader left"); } } } - public PartyMember Kick(byte memberIndex) + public ErrorRes Kick(GameClient client, byte memberIndex) { + if (client == null) + { + Logger.Error($"[PartyId:{Id}][Kick] (client == null)"); + return ErrorRes.Fail; + } + lock (_lock) { + PlayerPartyMember changeRequester = GetPlayerPartyMember(client); + if (changeRequester == null) + { + Logger.Error(client, $"[PartyId:{Id}][Kick] has no slot"); + return ErrorRes.Fail; + } + PartyMember member = GetSlot(memberIndex); if (member == null) { - Logger.Error($"memberIndex:{memberIndex} not occupied in partyId:{Id}"); - return null; + Logger.Error(client, $"[PartyId:{Id}][Kick] memberIndex:{memberIndex} not occupied"); + return ErrorRes.Error(ErrorCode.ERROR_CODE_PARTY_NOT_PARTY_JOIN); + } + + if (member is PlayerPartyMember player) + { + if (!changeRequester.IsLeader) + { + Logger.Error(client, $"[PartyId:{Id}][Kick] is not authorized (not leader)"); + return ErrorRes.Error(ErrorCode.ERROR_CODE_PARTY_IS_NOT_LEADER); + } + + FreeSlot(member.MemberIndex); + Logger.Info(client, $"[PartyId:{Id}][Kick] kicked player {player.Client.Identity}"); + return ErrorRes.Success(member); } - FreeSlot(member.MemberIndex); + if (member is PawnPartyMember pawn) + { + if (pawn.Character.Id != changeRequester.Character.Id) + { + Logger.Error(client, $"[PartyId:{Id}][Kick] is not authorized (not pawn owner)"); + return ErrorRes.Error(ErrorCode.ERROR_CODE_PARTY_IS_NOT_LEADER); + } + + FreeSlot(member.MemberIndex); + Logger.Info(client, $"[PartyId:{Id}][Kick] kicked pawnId: {pawn.PawnId}"); + return ErrorRes.Success(member); + } - return member; + Logger.Error(client, $"[PartyId:{Id}][Kick] unknown object {member}"); + return ErrorRes.Fail; } } /// /// Changes to a new leader, returns new leader as value /// - /// + /// /// /// - public ErrorRes ChangeLeader(GameClient client, uint leaderCharacterId) + public ErrorRes ChangeLeader(GameClient changeRequester, uint leaderCharacterId) { - if (client == null) + if (changeRequester == null) { + Logger.Error($"[PartyId:{Id}][ChangeLeader] (changeRequester == null)"); return ErrorRes.Fail; } lock (_lock) { - PlayerPartyMember currentLeader = GetPlayerPartyMember(client); - if (currentLeader == null) + PlayerPartyMember changeRequestMember = GetPlayerPartyMember(changeRequester); + if (changeRequestMember == null) { + Logger.Error(changeRequester, $"[PartyId:{Id}][ChangeLeader] has no slot"); return ErrorRes.Error(ErrorCode.ERROR_CODE_PARTY_NOT_PARTY_JOIN); } - if (!currentLeader.IsLeader) + if (_leader == null) { + Logger.Info(changeRequester, $"[PartyId:{Id}][ChangeLeader] has no leader, allow to change"); + } + else if (_leader != changeRequestMember) + { + Logger.Error(changeRequester, $"[PartyId:{Id}][ChangeLeader] is not authorized"); return ErrorRes.Error(ErrorCode.ERROR_CODE_PARTY_IS_NOT_LEADER); } PlayerPartyMember newLeader = GetByCharacterId(leaderCharacterId); if (newLeader == null) { + Logger.Error(changeRequester, + $"[PartyId:{Id}][ChangeLeader] new leader characterId:{leaderCharacterId} has no slot"); return ErrorRes.Error(ErrorCode.ERROR_CODE_PARTY_NOT_PARTY_JOIN); } - currentLeader.IsLeader = false; + if (_leader != null) + { + _leader.IsLeader = false; + } + newLeader.IsLeader = true; _leader = newLeader; + + Logger.Info(changeRequester, + $"[PartyId:{Id}][ChangeLeader] leader changed to {newLeader.Client.Identity}"); return ErrorRes.Success(newLeader); } } @@ -374,6 +432,7 @@ public ErrorRes> Breakup(GameClient client) { if (client == null) { + Logger.Error($"[PartyId:{Id}][Breakup] (client == null)"); return ErrorRes>.Fail; } @@ -490,6 +549,7 @@ private int TakeSlot(PartyMember partyMember) { if (partyMember == null) { + Logger.Error($"[PartyId:{Id}][TakeSlot] (partyMember == null)"); return InvalidSlotIndex; } @@ -524,8 +584,8 @@ private PartyMember GetSlot(uint index) { if (index >= MaxSlots) { - Logger.Error( - $"can not retrieve slot {index} is out of bounds for maximum party size of {MaxSlots}"); + Logger.Error($"[PartyId:{Id}][GetSlot] index:{index} >= MaxSlots:{MaxSlots}, out of bounds"); + return null; } lock (_lock) diff --git a/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CPartyPartyInviteCancelNtc.cs b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CPartyPartyInviteCancelNtc.cs index 483e719c5..47d50bb8f 100644 --- a/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CPartyPartyInviteCancelNtc.cs +++ b/Arrowgene.Ddon.Shared/Entity/PacketStructure/S2CPartyPartyInviteCancelNtc.cs @@ -7,16 +7,24 @@ public class S2CPartyPartyInviteCancelNtc : IPacketStructure { public PacketId Id => PacketId.S2C_PARTY_PARTY_INVITE_CANCEL_NTC; + public uint ErrorCode { get; set; } + + public S2CPartyPartyInviteCancelNtc() + { + ErrorCode = 0; + } public class Serializer : PacketEntitySerializer { public override void Write(IBuffer buffer, S2CPartyPartyInviteCancelNtc obj) { + WriteUInt32(buffer, obj.ErrorCode); } public override S2CPartyPartyInviteCancelNtc Read(IBuffer buffer) { S2CPartyPartyInviteCancelNtc obj = new S2CPartyPartyInviteCancelNtc(); + obj.ErrorCode = ReadUInt32(buffer); return obj; } } diff --git a/Arrowgene.Ddon.Shared/Files/Assets/GameServerList.csv b/Arrowgene.Ddon.Shared/Files/Assets/GameServerList.csv index 83224de84..211f991df 100644 --- a/Arrowgene.Ddon.Shared/Files/Assets/GameServerList.csv +++ b/Arrowgene.Ddon.Shared/Files/Assets/GameServerList.csv @@ -1,2 +1,2 @@ #Id,Name,Brief,TrafficName,TrafficLevel,MaxLoginNum,IpAddress,Port,IsHide -0,Local Host,Brief,Traffic Name,0,1000,127.0.0.1,52000,false \ No newline at end of file +10,Local Host,Brief,Traffic Name,0,1000,127.0.0.1,52000,false \ No newline at end of file