mirror of
https://github.com/sebastian-heinz/Arrowgene.DragonsDogmaOnline
synced 2026-08-03 11:12:41 -04:00
* Adds packet structures, handlers, and server support for Player Mail, Blacklists, Group Chats and Message Sets. Implements rudimentary GM features via chat command. Adds support for IP Bans and muted players. Simplifies how login stamps are handled. Cleans up and modernizes some old packet handlers. * Rebase. Fix CommandRoute and AccountRoute. Cleanup and response to PR comments. Rearrange some of the schedule_next stuff in the DB creation schema for clarity.
59 lines
2.2 KiB
C#
59 lines
2.2 KiB
C#
using Arrowgene.Ddon.Server;
|
|
using Arrowgene.Ddon.Server.Network;
|
|
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
|
|
using Arrowgene.Ddon.Shared.Entity.Structure;
|
|
using Arrowgene.Ddon.Shared.Network;
|
|
using Arrowgene.Logging;
|
|
|
|
namespace Arrowgene.Ddon.GameServer.Handler
|
|
{
|
|
public class LobbyLobbyLeaveHandler : GameStructurePacketHandler<C2SLobbyLeaveReq>
|
|
{
|
|
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(LobbyLobbyLeaveHandler));
|
|
|
|
public LobbyLobbyLeaveHandler(DdonGameServer server) : base(server)
|
|
{
|
|
server.ClientConnectionChangeEvent += OnClientConnectionChangeEvent;
|
|
}
|
|
|
|
// I have no idea on when this gets called, not when exiting the game, thats for sure
|
|
// - Return to title makes this happen
|
|
public override void Handle(GameClient client, StructurePacket<C2SLobbyLeaveReq> packet)
|
|
{
|
|
client.Send(new S2CLobbyLeaveRes());
|
|
NotifyDisconnect(client);
|
|
}
|
|
|
|
private void OnClientConnectionChangeEvent(object sender, ClientConnectionChangeArgs e)
|
|
{
|
|
if (e.Action == ClientConnectionChangeArgs.EventType.DISCONNECT)
|
|
{
|
|
NotifyDisconnect(e.Client);
|
|
}
|
|
}
|
|
|
|
private void NotifyDisconnect(GameClient client)
|
|
{
|
|
if(client.Character != null && client.Character.Stage.Id != 0) {
|
|
// Notice all other users
|
|
S2CUserListLeaveNtc ntc = new S2CUserListLeaveNtc();
|
|
ntc.CharacterList.Add(new CDataCommonU32(client.Character.CharacterId));
|
|
foreach (Client otherClient in Server.ClientLookup.GetAll())
|
|
{
|
|
if (otherClient != client)
|
|
{
|
|
otherClient.Send(ntc);
|
|
}
|
|
}
|
|
|
|
Server.GroupChatManager.LeaveGroupChatOnDisconnect(client, out var queue);
|
|
queue.Send();
|
|
|
|
Server.HubManager.LeaveAllHubs(client);
|
|
Server.CharacterManager.CleanupOnExit(client);
|
|
Server.PartyManager.CleanupOnExit(client);
|
|
Server.RpcManager.AnnouncePlayerList(client.Character);
|
|
}
|
|
}
|
|
}
|
|
}
|