EndLeaveGame() public static méthode

public static EndLeaveGame ( ) : byte[]
Résultat byte[]
Exemple #1
0
 void Player_Wait_CallBack(object e)
 {
     try
     {
         if (Character.Information.Quit)
         {
             //##############################################
             // checks before logout
             //##############################################
             if (Character.Position.Walking)
             {
                 Character.Position.RecordedTime = 0;
                 Timer.Movement.Dispose();
                 Timer.Movement = null;
             }
             //##############################################
             // checks before logout
             //##############################################
             if (Character.Information.CheckParty)
             {
                 LeaveParty();
             }
             //##############################################
             // checks before logout
             //##############################################
             if (Character.Network.Guild.Guildid != 0)
             {
                 Character.Information.Online = 0;
                 //Send packets to network and spawned players
                 foreach (int member in Character.Network.Guild.Members)
                 {
                     //Make sure the member is there
                     if (member != 0)
                     {
                         //We dont send this info to the invited user.
                         if (member != Character.Information.CharacterID)
                         {
                             //If the user is not the newly invited member get player info
                             Systems tomember = GetPlayerMainid(member);
                             //Send guild update packet
                             if (tomember != null)
                             {
                                 tomember.client.Send(Packet.GuildUpdate(Character, 6, Character.Information.CharacterID, 0, 0));
                             }
                         }
                     }
                 }
                 Character.Network.Guild.Members.Remove(Character.Information.CharacterID);
                 Character.Network.Guild.MembersClient.Remove(this.client);
             }
             //##############################################
             // checks before logout
             //##############################################
             if (Character.Transport.Right)
             {
                 Character.Transport.Horse.DeSpawnMe();
             }
             if (Character.Grabpet.Active)
             {
                 UnSummonPetLogoff(Character.Grabpet.Details.UniqueID);
             }
             if (Character.Attackpet.Active)
             {
                 UnSummonPetLogoff(Character.Attackpet.Details.UniqueID);
             }
             if (Character.Network.Exchange.Window)
             {
                 Exchange_Close();
             }
             //##############################################
             // checks before logout
             //##############################################
             MsSQL ms    = new MsSQL("SELECT * FROM friends WHERE owner='" + Character.Information.CharacterID + "'");
             int   count = ms.Count();
             if (count >= 0)
             {
                 using (SqlDataReader reader = ms.Read())
                 {
                     while (reader.Read())
                     {
                         int     getid = reader.GetInt32(2);
                         Systems sys   = GetPlayerid(getid);
                         if (sys != null)
                         {
                             sys.client.Send(Packet.FriendData(Character.Information.CharacterID, 4, Character.Information.Name, Character, true));
                         }
                     }
                 }
             }
             //##############################################
             // Send packet leave game
             //##############################################
             client.Send(Packet.EndLeaveGame());
             //##############################################
             // Updated database
             //##############################################
             MsSQL.UpdateData("UPDATE character SET online='0' WHERE id='" + Character.Information.CharacterID + "'");
             //##############################################
             // Remove all remaining parts
             //##############################################
             BuffAllClose();
             DeSpawnMe();
             SavePlayerPosition();
             SavePlayerInfo();
             this.client.Close();
             this.Character.Dispose();
             this.Dispose();
             Character.InGame = false;
             Disconnect("normal");
         }
         Timer.Logout.Dispose();
     }
     catch (Exception ex)
     {
         Console.WriteLine("Logout error: {0}", ex);
     }
 }