Пример #1
0
        public static void SendInventoryError(RealmClient client, Item item1, Item item2, InventoryError error)
        {
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_INVENTORY_CHANGE_FAILURE,
                                                              error == InventoryError.YOU_MUST_REACH_LEVEL_N ? 22 : 18))
            {
                packet.WriteByte((byte)error);

                if (error == InventoryError.YOU_MUST_REACH_LEVEL_N)
                {
                    packet.WriteUInt(item1.Template.RequiredLevel);
                }

                if (item1 != null)
                {
                    packet.Write(item1.EntityId.Full);
                }
                else
                {
                    packet.WriteULong(0);
                }

                if (item2 != null)
                {
                    packet.Write(item2.EntityId.Full);
                }
                else
                {
                    packet.WriteULong(0);
                }

                packet.WriteByte(0);

                client.Send(packet);
            }
        }
Пример #2
0
        public static void SendPetitionSignatures(IPacketReceiver client, PetitionCharter charter)
        {
            if (charter.Petition == null)
            {
                return;
            }

            var signs = charter.Petition.SignedIds;

            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PETITION_SHOW_SIGNATURES, 8 + 8 + 4 + 1 + signs.Count * 12))
            {
                packet.WriteULong(charter.EntityId.Full);
                packet.WriteULong(charter.Owner.EntityId.Full);
                packet.WriteUInt(charter.EntityId.Low);
                packet.WriteByte(signs.Count);

                foreach (var guid in signs)
                {
                    packet.WriteULong(guid);
                    packet.WriteUInt(0);
                }

                client.Send(packet);
            }
        }
Пример #3
0
        public static void SendPetitionSignatures(IPacketReceiver client, PetitionCharter charter)
        {
            if (charter.Petition == null)
            {
                return;
            }
            List <uint> signedIds = charter.Petition.SignedIds;

            using (RealmPacketOut packet =
                       new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_PETITION_SHOW_SIGNATURES,
                                          21 + signedIds.Count * 12))
            {
                packet.WriteULong(charter.EntityId.Full);
                packet.WriteULong(charter.Owner.EntityId.Full);
                packet.WriteUInt(charter.EntityId.Low);
                packet.WriteByte(signedIds.Count);
                foreach (uint val in signedIds)
                {
                    packet.WriteULong(val);
                    packet.WriteUInt(0);
                }

                client.Send(packet, false);
            }
        }
Пример #4
0
 /// <summary>
 /// item1 and item2 can be null, but item1 must be set in case of YOU_MUST_REACH_LEVEL_N.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="error"></param>
 public static void SendInventoryError(IPacketReceiver client, InventoryError error)
 {
     using (RealmPacketOut packet = new RealmPacketOut(
                (PacketId)RealmServerOpCode.SMSG_INVENTORY_CHANGE_FAILURE,
                error == InventoryError.YOU_MUST_REACH_LEVEL_N ? 22 : 18))
     {
         packet.WriteByte((byte)error);
         packet.WriteULong(0);
         packet.WriteULong(0);
         packet.WriteByte(0);
         client.Send(packet, false);
     }
 }
Пример #5
0
        public static bool BuildAuctionPacket(Auction auction, RealmPacketOut packet)
        {
            var item = AuctionMgr.Instance.AuctionItems[auction.ItemLowId];

            if (item == null)
            {
                return(false);
            }

            var timeleft = auction.TimeEnds - DateTime.Now;

            if (timeleft.TotalMilliseconds < 0)
            {
                return(false);
            }

            packet.Write(auction.ItemLowId);
            packet.Write(item.Template.Id);

            for (var i = 0; i < 7; i++)
            {
                if (item.EnchantIds != null)
                {
                    packet.Write(item.EnchantIds[i]);
                    packet.Write(i);                                                            // enchant duration
                    packet.Write(item.GetEnchant((EnchantSlot)i).Charges);                      // TODO: Fix enchant charges
                }
                else
                {
                    packet.Write(0);
                    packet.Write(0);
                    packet.Write(0);
                }
            }

            packet.Write(item.RandomProperty);
            packet.Write(item.RandomSuffix);
            packet.Write(item.Amount);
            packet.Write((uint)item.Charges);
            packet.WriteUInt(0);                                             //Unknown
            packet.WriteULong(auction.OwnerLowId);
            packet.Write(auction.CurrentBid);                                //auction start bid
            packet.WriteUInt(AuctionMgr.GetMinimumNewBidIncrement(auction)); //amount required to outbid
            packet.Write(auction.BuyoutPrice);
            packet.Write((int)timeleft.TotalMilliseconds);
            packet.WriteULong(auction.BidderLowId);
            packet.Write(auction.CurrentBid);
            return(true);
        }
Пример #6
0
        /// <summary>
        /// Sends the packet to show the battleground window
        /// </summary>
        /// <param name="client"></param>
        /// <param name="speaker"></param>
        /// <param name="character"></param>
        /// <returns></returns>
        public bool SendBattlegroundWindow(IRealmClient client, NPC speaker, Character character)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_LIST))
            {
                packet.WriteULong(speaker != null ? speaker.EntityId.Full : 0);
                packet.WriteUInt((uint)m_bgqueue.Template.BgID);
                packet.WriteByte(m_battlegroupId); //Battle group
                // TODO: Add sync'ing?
                //m_syncLock.EnterReadLock();
                try
                {
                    packet.WriteUInt(m_battlegrounds.Count); //Count

                    foreach (var bg in m_battlegrounds.Values)
                    {
                        packet.WriteUInt(bg.InstanceId);
                    }
                }
                finally
                {
                    //m_syncLock.ExitReadLock();
                }
                client.Send(packet);
                return(true);
            }
        }
Пример #7
0
        private static RealmPacketOut CreateArenaTeamRosterResponsePacket(ArenaTeam team)
        {
            var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_ROSTER, 100);

            packet.WriteUInt(team.Id);
            packet.WriteByte(0);
            packet.WriteUInt(team.MemberCount);
            packet.WriteUInt(team.Type);

            foreach (var member in team.Members.Values)
            {
                packet.WriteULong(member.Character.EntityId.Full);
                var pl = World.GetCharacter(member.Character.EntityId.Low);
                packet.WriteByte((pl != null) ? 1 : 0);
                packet.WriteCString(member.Character.Name);
                packet.WriteByte((team.Leader == member) ? 0 : 1);
                packet.WriteByte((pl != null) ? pl.Level : 0);
                packet.WriteUInt((uint)member.Class);
                packet.WriteUInt(member.GamesWeek);
                packet.WriteUInt(member.WinsWeek);
                packet.WriteUInt(member.GamesSeason);
                packet.WriteUInt(member.WinsSeason);
                packet.WriteUInt(member.PersonalRating);
                packet.WriteFloat(0.0f);
                packet.WriteFloat(0.0f);
            }
            return(packet);
        }
Пример #8
0
        /// <summary>
        /// Sends the packet to show the battleground window
        /// </summary>
        /// <param name="client"></param>
        /// <param name="speaker"></param>
        /// <param name="character"></param>
        /// <returns></returns>
        public bool SendBattlegroundWindow(IRealmClient client, NPC speaker, Character character)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_LIST))
            {
                packet.WriteULong(speaker != null ? speaker.EntityId.Full : 0);
                packet.WriteUInt((uint)m_bgqueue.Template.BgID);
                packet.WriteByte(m_battlegroupId); //Battle group
				// TODO: Add sync'ing?
                //m_syncLock.EnterReadLock();
                try
                {
                    packet.WriteUInt(m_battlegrounds.Count); //Count

                    foreach (var bg in m_battlegrounds.Values)
                    {
                        packet.WriteUInt(bg.InstanceId);
                    }
                }
                finally
                {
                    //m_syncLock.ExitReadLock();
                }
                client.Send(packet);
                return true;
            }
        }
Пример #9
0
        private static RealmPacketOut CreateArenaTeamRosterResponsePacket(ArenaTeam team)
        {
            RealmPacketOut realmPacketOut =
                new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_ROSTER, 100);

            realmPacketOut.WriteUInt(team.Id);
            realmPacketOut.WriteByte(0);
            realmPacketOut.WriteUInt(team.MemberCount);
            realmPacketOut.WriteUInt(team.Type);
            foreach (ArenaTeamMember arenaTeamMember in team.Members.Values)
            {
                realmPacketOut.WriteULong(arenaTeamMember.Character.EntityId.Full);
                Character character = World.GetCharacter(arenaTeamMember.Character.EntityId.Low);
                realmPacketOut.WriteByte(character != null ? 1 : 0);
                realmPacketOut.WriteCString(arenaTeamMember.Character.Name);
                realmPacketOut.WriteByte(team.Leader == arenaTeamMember ? 0 : 1);
                realmPacketOut.WriteByte(character != null ? character.Level : 0);
                realmPacketOut.WriteUInt((uint)arenaTeamMember.Class);
                realmPacketOut.WriteUInt(arenaTeamMember.GamesWeek);
                realmPacketOut.WriteUInt(arenaTeamMember.WinsWeek);
                realmPacketOut.WriteUInt(arenaTeamMember.GamesSeason);
                realmPacketOut.WriteUInt(arenaTeamMember.WinsSeason);
                realmPacketOut.WriteUInt(arenaTeamMember.PersonalRating);
                realmPacketOut.WriteFloat(0.0f);
                realmPacketOut.WriteFloat(0.0f);
            }

            return(realmPacketOut);
        }
Пример #10
0
        public static bool BuildAuctionPacket(Auction auction, RealmPacketOut packet)
        {
            ItemRecord auctionItem = Singleton <AuctionMgr> .Instance.AuctionItems[auction.ItemLowId];

            if (auctionItem == null)
            {
                return(false);
            }
            TimeSpan timeSpan = auction.TimeEnds - DateTime.Now;

            if (timeSpan.TotalMilliseconds < 0.0)
            {
                return(false);
            }
            packet.Write(auction.ItemLowId);
            packet.Write(auctionItem.Template.Id);
            for (int index = 0; index < 7; ++index)
            {
                if (auctionItem.EnchantIds != null)
                {
                    packet.Write(auctionItem.EnchantIds[index]);
                    packet.Write(index);
                    packet.Write(auctionItem.GetEnchant((EnchantSlot)index).Charges);
                }
                else
                {
                    packet.Write(0);
                    packet.Write(0);
                    packet.Write(0);
                }
            }

            packet.Write(auctionItem.RandomProperty);
            packet.Write(auctionItem.RandomSuffix);
            packet.Write(auctionItem.Amount);
            packet.Write((uint)auctionItem.Charges);
            packet.WriteUInt(0);
            packet.WriteULong(auction.OwnerLowId);
            packet.Write(auction.CurrentBid);
            packet.WriteUInt(AuctionMgr.GetMinimumNewBidIncrement(auction));
            packet.Write(auction.BuyoutPrice);
            packet.Write((int)timeSpan.TotalMilliseconds);
            packet.WriteULong(auction.BidderLowId);
            packet.Write(auction.CurrentBid);
            return(true);
        }
Пример #11
0
        /// <summary>
        /// Usually caused by jumping too high, diving too long, standing too close to fire etc
        /// </summary>
        public static void SendEnvironmentDamage(WorldObject target, EnviromentalDamageType type, uint totalDamage)
        {
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_ENVIRONMENTALDAMAGELOG, 21)) {
                target.EntityId.WritePacked(packet);

                packet.WriteByte((byte)type);
                packet.WriteUInt(totalDamage);
                packet.WriteULong(0);
                target.PushPacketToSurroundingArea(packet, true, false);
            }
        }
Пример #12
0
 /// <summary>
 /// Usually caused by jumping too high, diving too long, standing too close to fire etc
 /// </summary>
 public static void SendEnvironmentalDamage(WorldObject target, EnviromentalDamageType type, uint totalDamage)
 {
     using (RealmPacketOut packet =
                new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_ENVIRONMENTALDAMAGELOG, 21))
     {
         target.EntityId.WritePacked((BinaryWriter)packet);
         packet.WriteByte((byte)type);
         packet.WriteUInt(totalDamage);
         packet.WriteULong(0);
         target.SendPacketToArea(packet, true, false, Locale.Any, new float?());
     }
 }
Пример #13
0
        public static void SendPetitionRename(IPacketReceiver client, PetitionCharter petition)
        {
            var name = petition.Petition.Name;

            using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_PETITION_RENAME, 8 + name.Length + 1))
            {
                packet.WriteULong(petition.EntityId.Full);
                packet.WriteCString(name);

                client.Send(packet);
            }
        }
Пример #14
0
        public static void SendPetitionQueryResponse(IPacketReceiver client, PetitionCharter charter)
        {
            string name = charter.Petition.Name;

            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PETITION_QUERY_RESPONSE, 4 + 8 + name.Length + 1 + 1 + 4 * 12 + 2 + 10))
            {
                packet.WriteUInt(charter.EntityId.Low);
                packet.WriteULong(charter.Owner.EntityId.Full);
                packet.WriteCString(name);
                packet.WriteByte(0);

                var type = (uint)charter.Petition.Type;
                if (type == (uint)PetitionType.Guild)
                {
                    packet.WriteUInt(type);
                    packet.WriteUInt(type);
                    packet.WriteUInt(0);
                }
                else
                {
                    packet.WriteUInt(type - 1);
                    packet.WriteUInt(type - 1);
                    packet.WriteUInt(type);
                }
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUShort(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);

                for (int i = 0; i < 10; ++i)
                {
                    packet.WriteByte(0);
                }

                packet.WriteUInt(0);

                if (type == (uint)PetitionType.Guild)
                {
                    packet.WriteUInt(0);
                }
                else
                {
                    packet.WriteUInt(1);
                }

                client.Send(packet);
            }
        }
Пример #15
0
        public static void SendPetitionDecline(IPacketReceiver client, Character chr, PetitionRecord record)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_PETITION_DECLINE, 8))
            {
                var character = World.GetCharacter(record.OwnerId);
                if (character != null)
                {
                    packet.WriteULong(chr.EntityId.Full);

                    character.Client.Send(packet);
                }
            }
        }
Пример #16
0
 public static void SendPetitionDecline(IPacketReceiver client, Character chr, PetitionRecord record)
 {
     using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.MSG_PETITION_DECLINE, 8))
     {
         Character character = WCell.RealmServer.Global.World.GetCharacter(record.OwnerId);
         if (character == null)
         {
             return;
         }
         packet.WriteULong(chr.EntityId.Full);
         character.Client.Send(packet, false);
     }
 }
Пример #17
0
        public static void SendPetitionQueryResponse(IPacketReceiver client, PetitionCharter charter)
        {
            string name = charter.Petition.Name;

            using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_PETITION_QUERY_RESPONSE,
                                                              12 + name.Length + 1 + 1 + 48 + 2 + 10))
            {
                packet.WriteUInt(charter.EntityId.Low);
                packet.WriteULong(charter.Owner.EntityId.Full);
                packet.WriteCString(name);
                packet.WriteByte(0);
                uint type = (uint)charter.Petition.Type;
                if (type == 9U)
                {
                    packet.WriteUInt(type);
                    packet.WriteUInt(type);
                    packet.WriteUInt(0);
                }
                else
                {
                    packet.WriteUInt(type - 1U);
                    packet.WriteUInt(type - 1U);
                    packet.WriteUInt(type);
                }

                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUShort(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                for (int index = 0; index < 10; ++index)
                {
                    packet.WriteByte(0);
                }
                packet.WriteUInt(0);
                if (type == 9U)
                {
                    packet.WriteUInt(0);
                }
                else
                {
                    packet.WriteUInt(1);
                }
                client.Send(packet, false);
            }
        }
Пример #18
0
		public static void SendPetitionQueryResponse(IPacketReceiver client, PetitionCharter charter)
		{
            string name = charter.Petition.Name;
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PETITION_QUERY_RESPONSE, 4 + 8 + name.Length + 1 + 1 + 4 * 12 + 2 + 10))
			{
                packet.WriteUInt(charter.EntityId.Low);
                packet.WriteULong(charter.Owner.EntityId.Full);
                packet.WriteCString(name);
                packet.WriteByte(0);

                var type = (uint)charter.Petition.Type;
                if(type == (uint)PetitionType.Guild)
                {
                    packet.WriteUInt(type);
                    packet.WriteUInt(type);
                    packet.WriteUInt(0);
                }
                else
                {
                    packet.WriteUInt(type-1);
                    packet.WriteUInt(type-1);
                    packet.WriteUInt(type);
                }
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUShort(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);
                packet.WriteUInt(0);

                for(int i = 0; i < 10; ++i)
                    packet.WriteByte(0);

                packet.WriteUInt(0);

                if(type == (uint)PetitionType.Guild)
                    packet.WriteUInt(0);
                else
                    packet.WriteUInt(1);

                client.Send(packet);
			}
		}
Пример #19
0
        public static void SendPetitionRename(IPacketReceiver client, PetitionCharter petition)
        {
            var name = petition.Petition.Name;
            using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_PETITION_RENAME, 8 + name.Length + 1))
            {
                packet.WriteULong(petition.EntityId.Full);
                packet.WriteCString(name);

                client.Send(packet);
            }
        }
Пример #20
0
		public static void SendPetitionDecline(IPacketReceiver client, Character chr, PetitionRecord record)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_PETITION_DECLINE, 8))
			{
                var character = World.GetCharacter(record.OwnerId);
                if(character != null)
                {
				    packet.WriteULong(chr.EntityId.Full);

				    character.Client.Send(packet);
                }
			}
		}
Пример #21
0
		public static void SendPetitionSignatures(IPacketReceiver client, PetitionCharter charter)
		{
            var signs = charter.Petition.SignedIds;
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PETITION_SHOW_SIGNATURES, 8+8+4+1+signs.Count*12))
			{
                packet.WriteULong(charter.EntityId.Full);
                packet.WriteULong(charter.Owner.EntityId.Full);
                packet.WriteUInt(charter.EntityId.Low);
                packet.WriteByte(signs.Count);
                
                foreach(var guid in signs)
                {
                    packet.WriteULong(guid);
                    packet.WriteUInt(0);
                }

				client.Send(packet);
			}
		}
Пример #22
0
		/// <summary>
		/// Usually caused by jumping too high, diving too long, standing too close to fire etc
		/// </summary>
		public static void SendEnvironmentDamage(WorldObject target, EnviromentalDamageType type, uint totalDamage)
		{
			using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_ENVIRONMENTALDAMAGELOG, 21)) {
				target.EntityId.WritePacked(packet);

				packet.WriteByte((byte)type);
				packet.WriteUInt(totalDamage);
				packet.WriteULong(0);
				target.PushPacketToSurroundingArea(packet, true, false);
			}
		}
Пример #23
0
        public static void SendInventoryError(RealmClient client, Item item1, Item item2, InventoryError error)
        {
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_INVENTORY_CHANGE_FAILURE, 
				error == InventoryError.YOU_MUST_REACH_LEVEL_N ? 22 : 18))
            {
                packet.WriteByte((byte)error);

                if (error == InventoryError.YOU_MUST_REACH_LEVEL_N)
                {
                    packet.WriteUInt(item1.Template.RequiredLevel);
                }

                if (item1 != null)
                {
                    packet.Write(item1.EntityId.Full);
                }
                else
                {
                    packet.WriteULong(0);
                }

                if (item2 != null)
                {
                    packet.Write(item2.EntityId.Full);
                }
                else
                {
                    packet.WriteULong(0);
                }

                packet.WriteByte(0);

                client.Send(packet);
            }
        }
Пример #24
0
        private static RealmPacketOut CreateArenaTeamRosterResponsePacket(ArenaTeam team)
        {
            var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_ROSTER, 100);

            packet.WriteUInt(team.Id);
            packet.WriteByte(0);
            packet.WriteUInt(team.MemberCount);
            packet.WriteUInt(team.Type);

            foreach (var member in team.Members.Values)
            {
                packet.WriteULong(member.Character.EntityId.Full);
                var pl = World.GetCharacter(member.Character.EntityId.Low);
                packet.WriteByte((pl != null) ? 1 : 0);
                packet.WriteCString(member.Character.Name);
                packet.WriteByte((team.Leader == member) ? 0 : 1);
                packet.WriteByte((pl != null) ? pl.Level : 0);
                packet.WriteUInt((uint)member.Class);
                packet.WriteUInt(member.GamesWeek);
                packet.WriteUInt(member.WinsWeek);
                packet.WriteUInt(member.GamesSeason);
                packet.WriteUInt(member.WinsSeason);
                packet.WriteUInt(member.PersonalRating);
                packet.WriteFloat(0.0f);
                packet.WriteFloat(0.0f);
            }
            return packet;
        }
Пример #25
0
		public static void BuildAuctionPacket(Auction auction, RealmPacketOut packet)
		{
			var item = AuctionMgr.Instance.AuctionItems[auction.ItemLowId];

			if (item == null)
				return;

			var timeleft = auction.TimeEnds - DateTime.Now;
			if (timeleft.Milliseconds < 0)
				return;

			packet.Write(auction.ItemLowId);
			packet.Write(item.Template.Id);

			for (var i = 0; i < 6; i++)
			{
				if (item.EnchantIds != null)
				{
					packet.Write(item.EnchantIds[i]);
					packet.Write(i);					// enchant slot?
					packet.Write(3);					// TODO: Fix enchant charges
				}
				else
				{
					packet.Write(0);
					packet.Write(0);
					packet.Write(0);
				}
			}


			//packet.Write(item.RandomPropertiesId);
			packet.Write(0);
			packet.Write(item.RandomSuffix);
			packet.WriteUInt(0);
			packet.WriteUInt(0);
			packet.WriteUInt(0);
			packet.Write(item.Amount);
			packet.WriteUInt(0);
			packet.WriteUInt(0);
			packet.WriteULong(auction.OwnerLowId);
			packet.Write(auction.CurrentBid); //auction start bid   
			packet.Write(50);
			packet.Write(auction.BuyoutPrice);
			packet.Write(timeleft.Milliseconds);
			packet.WriteULong(auction.BidderLowId);
			packet.Write(auction.CurrentBid);
		}
Пример #26
0
        /// <summary>
        /// item1 and item2 can be null, but item1 must be set in case of YOU_MUST_REACH_LEVEL_N.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="error"></param>
        public static void SendInventoryError(IPacketReceiver client, InventoryError error)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_INVENTORY_CHANGE_FAILURE,
                error == InventoryError.YOU_MUST_REACH_LEVEL_N ? 22 : 18))
            {
                packet.WriteByte((byte)error);

                packet.WriteULong(0);
                packet.WriteULong(0);
                packet.WriteByte(0);

                client.Send(packet);
            }
        }
Пример #27
0
		public static bool BuildAuctionPacket(Auction auction, RealmPacketOut packet)
		{
			var item = AuctionMgr.Instance.AuctionItems[auction.ItemLowId];

			if (item == null)
				return false;

			var timeleft = auction.TimeEnds - DateTime.Now;
			if (timeleft.TotalMilliseconds < 0)
				return false;

			packet.Write(auction.ItemLowId);
			packet.Write(item.Template.Id);

			for (var i = 0; i < 7; i++)
			{
				if (item.EnchantIds != null)
				{
					packet.Write(item.EnchantIds[i]);
					packet.Write(i);					// enchant duration
					packet.Write(item.GetEnchant((EnchantSlot)i).Charges);	// TODO: Fix enchant charges
				}
				else
				{
					packet.Write(0);
					packet.Write(0);
					packet.Write(0);
				}
			}

			packet.Write(item.RandomProperty);
			packet.Write(item.RandomSuffix);
			packet.Write(item.Amount);
			packet.Write((uint)item.Charges);
            packet.WriteUInt(0);                    //Unknown
            packet.WriteULong(auction.OwnerLowId);
            packet.Write(auction.CurrentBid);       //auction start bid
		    packet.WriteUInt(AuctionMgr.GetMinimumNewBidIncrement(auction));                    //amount required to outbid
            packet.Write(auction.BuyoutPrice);
            packet.Write((int)timeleft.TotalMilliseconds);
            packet.WriteULong(auction.BidderLowId);
            packet.Write(auction.CurrentBid);
		    return true;
		}