Пример #1
0
        /// <summary>
        /// Respawns a monster or mapobject
        /// </summary>
        /// <param name="c"></param>
        private static void SendRespawn(MapObject c)
        {
            bool isnpc     = MapObject.IsNpc(c);
            bool ismapitem = MapObject.IsMapItem(c);

            c.OnDeregister();
            c.OnSpawn();
            c.OnRegister();

            Regiontree tree = c._currentzone.Regiontree;

            if (isnpc)
            {
                foreach (Character regionObject in tree.SearchActors(SearchFlags.Characters))
                {
                    Actor actor = c as Actor;
                    actor.stance = (byte)StancePosition.Reborn;
                    SMSG_NPCINFO spkt2 = new SMSG_NPCINFO(0);
                    spkt2.ActorID   = actor.id;
                    spkt2.HP        = actor.HPMAX;
                    spkt2.SP        = actor.SPMAX;
                    spkt2.MaxHP     = actor.HPMAX;
                    spkt2.MaxSP     = actor.SPMAX;
                    spkt2.NPCID     = actor.ModelId;
                    spkt2.X         = actor.Position.x;
                    spkt2.Y         = actor.Position.y;
                    spkt2.Z         = actor.Position.z;
                    spkt2.SessionId = regionObject.id;
                    regionObject.client.Send((byte[])spkt2);
                    c.Appears(regionObject);
                }
            }
            else if (ismapitem)
            {
                foreach (Character regionObject in tree.SearchActors(SearchFlags.Characters))
                {
                    MapItem       item  = c as MapItem;
                    SMSG_ITEMINFO spkt2 = new SMSG_ITEMINFO();
                    spkt2.ActorID     = item.id;
                    spkt2.CanInteract = item.IsInteractable(regionObject);
                    spkt2.IsActive    = item.IsHighlighted(regionObject);
                    spkt2.NPCID       = item.ModelId;
                    spkt2.X           = item.Position.x;
                    spkt2.Y           = item.Position.y;
                    spkt2.Z           = item.Position.z;
                    spkt2.SessionId   = regionObject.id;
                    regionObject.client.Send((byte[])spkt2);
                    c.Appears(regionObject);
                }
            }
        }
Пример #2
0
        public override void ShowObject(Character character)
        {
            SMSG_NPCINFO spkt2 = new SMSG_NPCINFO(1);

            lock (this)
            {
                spkt2.ActorID     = this.id;
                spkt2.NPCID       = this.ModelId;
                spkt2.SessionId   = character.id;
                spkt2.SP          = this.SP;
                spkt2.MaxSP       = this.SPMAX;
                spkt2.HP          = this.HP;
                spkt2.MaxHP       = this.HPMAX;
                spkt2.Yaw         = this.Yaw;
                spkt2.X           = this.Position.x;
                spkt2.Y           = this.Position.y;
                spkt2.Z           = this.Position.z;
                spkt2.IsAggresive = (byte)this.ComputeIsAggresive(character);
                spkt2.Icon        = (byte)this.ComputeIcon(character);
            }
            character.client.Send((byte[])spkt2);
        }