예제 #1
0
 /// <summary>
 /// Sends a corpse delete message to every visible
 /// player.
 /// </summary>
 /// <param name="c"></param>
 private static void SendCorpseClear(MapObject c)
 {
     Regiontree tree = c.currentzone.Regiontree;
     foreach (Character character in tree.SearchActors(c, SearchFlags.Characters))
     {
         try
         {
             SMSG_ACTORDELETE spkt = new SMSG_ACTORDELETE();
             spkt.ActorID = c.id;
             spkt.SessionId = character.id;
             character.client.Send((byte[])spkt);
         }
         catch (ObjectDisposedException)
         {
             //Do nothing if the object is disposed
         }
     }
 }
예제 #2
0
        public void Clear()
        {
            lock (this.regiontree)
            {
                List<MapObject> list = new List<MapObject>();
                list.AddRange(regiontree.Clear());

                foreach (Character character in Regiontree.SearchActors(SearchFlags.Characters))
                {
                    foreach (MapObject regionObject in list)
                    {
                        try
                        {
                            SMSG_ACTORDELETE spkt = new SMSG_ACTORDELETE();
                            spkt.ActorID = regionObject.id;
                            spkt.SessionId = character.id;
                            character.client.Send((byte[])spkt);
                        }
                        catch (SocketException)
                        {
                            break;
                        }
                        catch (Exception e)
                        {
                            Trace.TraceWarning(e.ToString());
                        }
                    }
                }

                foreach (MapObject regionObject in list)
                {
                    try
                    {
                        regionObject.OnDeregister();
                    }
                    catch (Exception)
                    {
                        //Do nothing
                    }
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Internal function to hide the object
 /// </summary>
 /// <param name="character"></param>
 public virtual void HideObject(Character character)
 {
     try
     {
         //Actor disappears
         SMSG_ACTORDELETE spkt2 = new SMSG_ACTORDELETE();
         spkt2.ActorID = this.id;
         spkt2.SessionId = character.id;
         character.client.Send((byte[])spkt2);
     }
     catch (Exception)
     {
         Trace.TraceError("Error sending delete actor");
     }
 }