示例#1
0
 public override void Disconnect()
 {
     if (Connected)
     {
         SendData.LogActivity(Character_ID, Activity.LOGIN, SessionID);
         Username  = "";
         Version   = "";
         Email     = "";
         SessionID = "";
         Player player = null;
         if (World.instance.players.ContainsKey(Character_ID))
         {
             World.instance.players[Character_ID].InWorld = false;
             player = World.instance.players[Character_ID];
         }
         if (player != null)
         {
             for (int i = 0; i < Network.instance.Clients.Length; i++)
             {
                 if (Network.instance.Clients[i] != null && Network.instance.Clients[i].Connected &&
                     Network.instance.Clients[i].InGame())
                 {
                     SendData.PlayerStateChange(i, player, PlayerState.Logout);
                 }
             }
             World.instance.playersInWorld.Remove(player);
         }
         Character_ID = -1;
         LoggedIn     = false;
         LoggedInTime = default(DateTime);
         Network.instance.RemoveWhiteList(IP.Substring(0, IP.IndexOf(':')));
         Log.log("Removed IP " + IP.Substring(0, IP.IndexOf(':')) + " from whitelist.", Log.LogType.SYSTEM);
         base.Disconnect();
     }
 }
示例#2
0
        private static void PacketReceived(ConnectionType type, int index, byte[] data)
        {
            ByteBuffer.ByteBuffer buffer = new ByteBuffer.ByteBuffer();
            buffer.WriteBytes(data);
            ReadHeader(ref buffer);
            ClientSendPacketNumbers ReceivedPacket = (ClientSendPacketNumbers)buffer.ReadInteger();

            switch (ReceivedPacket)
            {
            case ClientSendPacketNumbers.Invalid:
                break;

            case ClientSendPacketNumbers.WorldPacket:
                break;

            case ClientSendPacketNumbers.CharacterDetails:
                Player player = World.instance.players[Network.instance.Clients[index].Character_ID];
                for (int i = 0; i < Network.instance.Clients.Length; i++)
                {
                    if (Network.instance.Clients[i] != null && Network.instance.Clients[i].Connected &&
                        Network.instance.Clients[i].InGame())
                    {
                        SendData.PlayerStateChange(i, player, PlayerState.Login);
                    }
                }
                SendData.WorldPacket(index);
                break;

            case ClientSendPacketNumbers.PlayerStateChange:
                break;

            case ClientSendPacketNumbers.QuestReturn:
                break;

            case ClientSendPacketNumbers.QuestInteractConfirm:
                break;

            case ClientSendPacketNumbers.CollectableInteractConfirm:
                break;

            case ClientSendPacketNumbers.CollectableToggle:
                break;

            case ClientSendPacketNumbers.AttackResponse:
                break;

            default:
                break;
            }
        }