Esempio n. 1
0
        public static void SendRaidInfo(Character chr)
        {
            RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_RAID_INSTANCE_INFO);

            try
            {
                if (chr.HasInstanceCollection)
                {
                    packet.Position += 4L;
                    uint count = 0;
                    chr.Instances.ForeachBinding(BindingType.Hard, binding =>
                    {
                        TimeSpan timeSpan = binding.NextResetTime - DateTime.Now;
                        if (timeSpan.Ticks <= 0L)
                        {
                            return;
                        }
                        ++count;
                        packet.Write((uint)binding.MapId);
                        packet.Write(binding.DifficultyIndex);
                        packet.Write(binding.InstanceId);
                        packet.WriteByte(1);
                        packet.WriteByte(0);
                        packet.Write((uint)timeSpan.TotalSeconds);
                    });
                    packet.Position = packet.HeaderSize;
                    packet.Write(count);
                }
                else
                {
                    packet.Write(0);
                }

                chr.Client.Send(packet, false);
            }
            finally
            {
                if (packet != null)
                {
                    packet.Dispose();
                }
            }
        }