Пример #1
0
        /// <summary>
        /// Broadcast <see cref="ServerItemVisualUpdate"/> for supplied <see cref="Item"/>, this will update the players look in the world.
        /// </summary>
        private void SendItemVisualUpdate(Item item)
        {
            if (item == null)
            {
                throw new ArgumentNullException();
            }

            Item2TypeEntry typeEntry = GameTableManager.ItemType.GetEntry(item.Entry.Item2TypeId);

            if (typeEntry.ItemSlotId == 0)
            {
                throw new ArgumentException($"Item {item.Entry.Id} isn't equippable!");
            }

            if (!player?.IsLoading ?? false)
            {
                bool visible = item.Location != InventoryLocation.None;
                player.EnqueueToVisible(new ServerItemVisualUpdate
                {
                    Guid        = player.Guid,
                    ItemVisuals = new List <ItemVisual>
                    {
                        new ItemVisual
                        {
                            Slot      = (ItemSlot)typeEntry.ItemSlotId,
                            DisplayId = (ushort)(visible ? item.DisplayId : 0),
                            // TODO: send colour and dye data
                            ColourSetId = 0,
                            DyeData     = 0
                        }
                    }
                }, true);
            }
        }
Пример #2
0
 /// <summary>
 /// Used to tell the world (and the player) which Path Type this Player is.
 /// </summary>
 public void SendSetUnitPathTypePacket()
 {
     player.EnqueueToVisible(new ServerSetUnitPathType
     {
         Guid = player.Guid,
         Path = player.Path,
     }, true);
 }
Пример #3
0
        /// <summary>
        /// Update <see cref="ItemVisual"/> and broadcast <see cref="ServerItemVisualUpdate"/> for optional supplied <see cref="Costume"/>.
        /// </summary>
        public void VisualUpdate(Costume costume)
        {
            var itemVisualUpdate = new ServerItemVisualUpdate
            {
                Guid = player.Guid
            };

            itemVisualUpdate.ItemVisuals.Add(VisualUpdate(ItemSlot.WeaponPrimary, costume));
            for (ItemSlot index = ItemSlot.ArmorChest; index <= ItemSlot.ArmorHands; index++)
            {
                itemVisualUpdate.ItemVisuals.Add(VisualUpdate(index, costume));
            }

            if (!player.IsLoading)
            {
                player.EnqueueToVisible(itemVisualUpdate, true);
            }
        }
Пример #4
0
        public override void OnAddToMap(BaseMap map, uint guid, Vector3 vector)
        {
            base.OnAddToMap(map, guid, vector);
            Player owner = GetVisible <Player>(OwnerGuid);

            owner.PetGuid = Guid;

            owner.EnqueueToVisible(new Server08B3
            {
                MountGuid = Guid,
                Unknown0  = 0,
                Unknown1  = true
            }, true);
        }
Пример #5
0
        public override void OnAddToMap(BaseMap map, uint guid, Vector3 vector)
        {
            base.OnAddToMap(map, guid, vector);

            Player owner = GetVisible <Player>(OwnerGuid);

            if (owner == null)
            {
                // this shouldn't happen, log it anyway
                log.Error($"VanityPet {Guid} has lost it's owner {OwnerGuid}!");
                RemoveFromMap();
                return;
            }

            owner.VanityPetGuid = Guid;

            owner.EnqueueToVisible(new Server08B3
            {
                MountGuid = Guid,
                Unknown0  = 0,
                Unknown1  = true
            }, true);
        }