Exemple #1
0
        public static void p_Warp_c(InPacket lea, Client c)
        {
            if (/*c == null || */ lea.Available < 4)
            {
                return;
            }

            int CharacterID = lea.ReadInt();

            Character find = null;

            foreach (Character findCharacter in MapFactory.AllCharacters)
            {
                if (CharacterID == findCharacter.CharacterID)
                {
                    find = findCharacter;
                    break;
                }
            }

            if (find != null)
            {
                Map Map = MapFactory.GetMap(find.MapX, find.MapY);
                if (Map.Characters.Contains(find))
                {
                    Map.Characters.Remove(find);
                    foreach (Character All in Map.Characters)
                    {
                        MapPacket.removeUser(All.Client, CharacterID);
                    }
                    Log.Inform("(P_WARP_C) CharacterID = {0} , MapX = {1} , MapY = {2}", CharacterID, find.MapX,
                               find.MapY);
                }
            }
        }
Exemple #2
0
        protected override void Unregister()
        {
            try
            {
                if (this.Character != null)
                {
                    if (this.Character.IsFuring)
                    {
                        this.Character.MaxAttack -= this.Character.FuryAttack;
                        this.Character.Attack    -= this.Character.FuryAttack;
                        this.Character.MaxMagic  -= this.Character.FuryMagic;
                        this.Character.Magic     -= this.Character.FuryMagic;
                        this.Character.Defense   -= this.Character.FuryDefense;
                    }
                    this.Character.CancelSkill();

                    CharacterID_List.Remove(this.Character.CharacterID);

                    Map Map = MapFactory.GetMap(this.Character.MapX, this.Character.MapY);

                    Character find = null;
                    foreach (Character findCharacter in MapFactory.AllCharacters)
                    {
                        if (this.Character.CharacterID == findCharacter.CharacterID)
                        {
                            find = findCharacter;
                            break;
                        }
                    }
                    if (find != null)
                    {
                        MapFactory.AllCharacters.Remove(find);
                    }

                    Character find2 = null;
                    foreach (Character findCharacter in Map.Characters)
                    {
                        if (this.Character.CharacterID == findCharacter.CharacterID)
                        {
                            find2 = findCharacter;
                            break;
                        }
                    }
                    if (find2 != null)
                    {
                        Map.Characters.Remove(find2);
                        foreach (Character All in Map.Characters)
                        {
                            MapPacket.removeUser(All.Client, this.Character.CharacterID);
                        }
                    }

                    this.Account.Save();
                    this.Character.Save();
                }

                GameServer.Clients.Remove(this);

                Log.Inform("Lost connection from {0}.", this.Title);
            }
            catch (Exception e)
            {
                Log.Error("Unregister exception from {0}: \n{1}", this.Title, e.ToString());
            }
        }