mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-08 22:25:42 +12:00
allow for graceful quitting
This commit is contained in:
parent
c0355ad755
commit
e1ae589e93
3 changed files with 14 additions and 0 deletions
|
@ -183,6 +183,9 @@ namespace HISP.Server
|
||||||
case PacketBuilder.PACKET_ITEM_INTERACTION:
|
case PacketBuilder.PACKET_ITEM_INTERACTION:
|
||||||
GameServer.OnItemInteraction(this,Packet);
|
GameServer.OnItemInteraction(this,Packet);
|
||||||
break;
|
break;
|
||||||
|
case PacketBuilder.PACKET_QUIT:
|
||||||
|
GameServer.OnQuitPacket(this, Packet);
|
||||||
|
break;
|
||||||
case PacketBuilder.PACKET_NPC:
|
case PacketBuilder.PACKET_NPC:
|
||||||
GameServer.OnNpcInteraction(this, Packet);
|
GameServer.OnNpcInteraction(this, Packet);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -394,6 +394,16 @@ namespace HISP.Server
|
||||||
|
|
||||||
Update(sender);
|
Update(sender);
|
||||||
}
|
}
|
||||||
|
public static void OnQuitPacket(GameClient sender, byte[] packet)
|
||||||
|
{
|
||||||
|
if(!sender.LoggedIn)
|
||||||
|
{
|
||||||
|
Logger.ErrorPrint(sender.RemoteIp + " Sent quit packet when not logged in.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Logger.InfoPrint(sender.LoggedinUser.Username + " Clicked \"Quit Game\".. Disconnecting");
|
||||||
|
sender.Disconnect();
|
||||||
|
}
|
||||||
public static void OnNpcInteraction(GameClient sender, byte[] packet)
|
public static void OnNpcInteraction(GameClient sender, byte[] packet)
|
||||||
{
|
{
|
||||||
if (!sender.LoggedIn)
|
if (!sender.LoggedIn)
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace HISP.Server
|
||||||
public const byte PACKET_KICK = 0x80;
|
public const byte PACKET_KICK = 0x80;
|
||||||
public const byte PACKET_LEAVE = 0x7D;
|
public const byte PACKET_LEAVE = 0x7D;
|
||||||
public const byte PACKET_NPC = 0x28;
|
public const byte PACKET_NPC = 0x28;
|
||||||
|
public const byte PACKET_QUIT = 0x7D;
|
||||||
public const byte PACKET_PLAYERINFO = 0x16;
|
public const byte PACKET_PLAYERINFO = 0x16;
|
||||||
public const byte PACKET_INFORMATION = 0x28;
|
public const byte PACKET_INFORMATION = 0x28;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue