public virtual void SendLivingEquipmentUpdate(GameLiving living)
		{
			if (m_gameClient.Player == null || living.IsVisibleTo(m_gameClient.Player) == false)
				return;

			using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.EquipmentUpdate)))
			{
				pak.WriteShort((ushort) living.ObjectID);
				pak.WriteByte((byte) ((living.IsCloakHoodUp ? 0x01 : 0x00) | (int) living.ActiveQuiverSlot));
				//bit0 is hood up bit4 to 7 is active quiver
				pak.WriteByte(living.VisibleActiveWeaponSlots);

				if (living.Inventory != null)
				{
					var items = living.Inventory.VisibleItems;
					pak.WriteByte((byte) items.Count);
					foreach (InventoryItem item in items)
					{
						pak.WriteByte((byte) item.SlotPosition);
						var model = (ushort) (item.Model & 0x1FFF);
						int texture = (item.Emblem != 0) ? item.Emblem : item.Color;

						if ((texture & ~0xFF) != 0)
							model |= 0x8000;
						else if ((texture & 0xFF) != 0)
							model |= 0x4000;
						if (item.Effect != 0)
							model |= 0x2000;

						pak.WriteShort(model);

						if ((texture & ~0xFF) != 0)
							pak.WriteShort((ushort) texture);
						else if ((texture & 0xFF) != 0)
							pak.WriteByte((byte) texture);
						if (item.Effect != 0)
							pak.WriteShort((ushort) item.Effect);
					}
				}
				else
				{
					pak.WriteByte(0x00);
				}
				SendTCP(pak);
			}
		}
Beispiel #2
0
		public override void SendLivingEquipmentUpdate(GameLiving living)
		{
			if (m_gameClient.Player == null || living.IsVisibleTo(m_gameClient.Player) == false)
				return;

			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.EquipmentUpdate));

			ICollection<InventoryItem> items = null;
			if (living.Inventory != null)
				items = living.Inventory.VisibleItems;

			pak.WriteShort((ushort)living.ObjectID);
			pak.WriteByte((byte)((living.IsCloakHoodUp ? 0x01 : 0x00) | (int)living.ActiveQuiverSlot)); //bit0 is hood up bit4 to 7 is active quiver

			pak.WriteByte((byte)living.VisibleActiveWeaponSlots);
			if (items != null)
			{
				pak.WriteByte((byte)items.Count);
				foreach (InventoryItem item in items)
				{
					ushort model = (ushort)(item.Model & 0x1FFF);
					int slot = item.SlotPosition;
					int texture = (item.Emblem != 0) ? item.Emblem : item.Color;
					if (item.SlotPosition == Slot.LEFTHAND || item.SlotPosition == Slot.CLOAK) // for test only cloack and shield
						slot = slot | ((texture & 0x010000) >> 9); // slot & 0x80 if new emblem
					pak.WriteByte((byte)slot);
					if ((texture & ~0xFF) != 0)
						model |= 0x8000;
					else if ((texture & 0xFF) != 0)
						model |= 0x4000;
					if (item.Effect != 0)
						model |= 0x2000;

					pak.WriteShort(model);

					if (item.SlotPosition > Slot.RANGED || item.SlotPosition < Slot.RIGHTHAND)
						pak.WriteByte((byte)item.Extension);

					if ((texture & ~0xFF) != 0)
						pak.WriteShort((ushort)texture);
					else if ((texture & 0xFF) != 0)
						pak.WriteByte((byte)texture);
					if (item.Effect != 0)
						pak.WriteByte((byte)item.Effect);
				}
			}
			else
			{
				pak.WriteByte(0x00);
			}
			SendTCP(pak);
		}
Beispiel #3
0
        public override void SendLivingEquipmentUpdate(GameLiving living)
        {
            if (m_gameClient.Player == null || living.IsVisibleTo(m_gameClient.Player) == false)
            {
                return;
            }

            using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.EquipmentUpdate)))
            {
                ICollection <InventoryItem> items = null;
                if (living.Inventory != null)
                {
                    items = living.Inventory.VisibleItems;
                }

                pak.WriteShort((ushort)living.ObjectID);
                pak.WriteByte((byte)((living.IsCloakHoodUp ? 0x01 : 0x00) | (int)living.ActiveQuiverSlot));                 //bit0 is hood up bit4 to 7 is active quiver

                pak.WriteByte((byte)living.VisibleActiveWeaponSlots);
                if (items != null)
                {
                    pak.WriteByte((byte)items.Count);
                    foreach (InventoryItem item in items)
                    {
                        pak.WriteByte((byte)item.SlotPosition);

                        ushort model   = (ushort)(item.Model & 0x1FFF);
                        int    texture = (item.Emblem != 0) ? item.Emblem : item.Color;

                        if ((texture & ~0xFF) != 0)
                        {
                            model |= 0x8000;
                        }
                        else if ((texture & 0xFF) != 0)
                        {
                            model |= 0x4000;
                        }
                        if (item.Effect != 0)
                        {
                            model |= 0x2000;
                        }

                        pak.WriteShort(model);

                        if (item.SlotPosition > Slot.RANGED || item.SlotPosition < Slot.RIGHTHAND)
                        {
                            pak.WriteByte((byte)item.Extension);
                        }

                        if ((texture & ~0xFF) != 0)
                        {
                            pak.WriteShort((ushort)texture);
                        }
                        else if ((texture & 0xFF) != 0)
                        {
                            pak.WriteByte((byte)texture);
                        }
                        if (item.Effect != 0)
                        {
                            pak.WriteShort((ushort)item.Effect);
                        }
                    }
                }
                else
                {
                    pak.WriteByte(0x00);
                }
                SendTCP(pak);
            }
        }