예제 #1
0
        public static EntitySpawn EntitySpawn(Entity Entity)
        {
            byte[] Payload = StringPayload(Entity.Name);

            int         Size   = 57 + Payload.Length;
            EntitySpawn Packet = new EntitySpawn();

            Packet.Size      = (ushort)Size;
            Packet.Type      = 0x3F6;
            Packet.UID       = Entity.UID;
            Packet.Mesh      = Entity.Model;
            Packet.Status    = Entity.Status;
            Packet.GuildID   = 0;
            Packet.GuildRank = 0;
            Packet.Items     = new EntityItems();

            ConquerItem Item;

            if (Entity.Owner.TryGetEquipment(ItemPosition.Headgear, out Item))
            {
                Packet.Items.Helmet = Item.ID;
            }
            if (Entity.Owner.TryGetEquipment(ItemPosition.Armor, out Item))
            {
                Packet.Items.Armor = Item.ID;
            }
            if (Entity.Owner.TryGetEquipment(ItemPosition.Left, out Item))
            {
                Packet.Items.LeftHand = Item.ID;
            }
            if (Entity.Owner.TryGetEquipment(ItemPosition.Right, out Item))
            {
                Packet.Items.RightHand = Item.ID;
            }

            Packet.X         = Entity.Location.X;
            Packet.Y         = Entity.Location.Y;
            Packet.HairStyle = Entity.HairStyle;
            Packet.Angle     = Entity.Angle;
            Packet.Action    = Entity.Action;
            Packet.ShowNames = true;

            fixed(byte *pPayload = Payload)
            {
                Memory.Copy(pPayload, Packet.Name, Payload.Length);
            }

            return(Packet);
        }
예제 #2
0
        public bool Add(Entity Entity)
        {
            lock (PlayerDictionary)
            {
                if (!PlayerDictionary.ContainsKey(Entity.UID))
                {
                    EntitySpawn Spawn = PacketHelper.EntitySpawn(Entity);
                    Client.Send(&Spawn, Spawn.Size);

                    PlayerDictionary.Add(Entity.UID, Entity);
                    Entity[] tmp = new Entity[PlayerDictionary.Count];
                    PlayerDictionary.Values.CopyTo(tmp, 0);
                    ScreenPlayers = tmp;
                    return(true);
                }
            }
            return(false);
        }
예제 #3
0
        public static EntitySpawn EntitySpawn(Entity Entity)
        {
            byte[] Payload = StringPayload(Entity.Name);

            int Size = 57 + Payload.Length;
            EntitySpawn Packet = new EntitySpawn();
            Packet.Size = (ushort)Size;
            Packet.Type = 0x3F6;
            Packet.UID = Entity.UID;
            Packet.Mesh = Entity.Model;
            Packet.Status = Entity.Status;
            Packet.GuildID = 0;
            Packet.GuildRank = 0;
            Packet.Items = new EntityItems();

            ConquerItem Item;
            if (Entity.Owner.TryGetEquipment(ItemPosition.Headgear, out Item))
                Packet.Items.Helmet = Item.ID;
            if (Entity.Owner.TryGetEquipment(ItemPosition.Armor, out Item))
                Packet.Items.Armor = Item.ID;
            if (Entity.Owner.TryGetEquipment(ItemPosition.Left, out Item))
                Packet.Items.LeftHand = Item.ID;
            if (Entity.Owner.TryGetEquipment(ItemPosition.Right, out Item))
                Packet.Items.RightHand = Item.ID;

            Packet.X = Entity.Location.X;
            Packet.Y = Entity.Location.Y;
            Packet.HairStyle = Entity.HairStyle;
            Packet.Angle = Entity.Angle;
            Packet.Action = Entity.Action;
            Packet.ShowNames = true;

            fixed (byte* pPayload = Payload)
            {
                Memory.Copy(pPayload, Packet.Name, Payload.Length);
            }
            return Packet;
        }