public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_container = reader.ReadItem() as BaseContainer;
            m_expires   = reader.ReadDateTime();
            m_PrizeID   = reader.ReadInt();

            // okay, add deeds read from disk to our quest manager
            if (m_container != null && Expired == false)
            {
                // when we deserialize we don't know the ordr in which the deeds will be read,
                //	so insure they are stored sorted.
                PlayerQuestManager.AddSorted(this);
            }
            else
            {
                LogHelper Logger = new LogHelper("PlayerQuest.log", false);
                string    temp;
                if (m_container == null)
                {
                    temp = String.Format("Orphaned Quest Deed({0}) loaded for nonexistent Chest(0x{1:X}).", this.Serial, m_PrizeID);
                }
                else                 // Expired == true
                {
                    temp = String.Format("Expired Quest Deed({0}) loaded for (non)existent Chest(0x{1:X}).", this.Serial, m_PrizeID);
                }
                Logger.Log(LogType.Text, temp);
                Logger.Finish();
            }
        }
        public PlayerQuestDeed(BaseContainer c) : base(0x14F0)
        {
            base.Weight = 1.0;
            base.Name   = "a quest ticket";
            m_container = c;                                                    // the prize
            m_expires   = DateTime.Now + TimeSpan.FromHours(24.0);              // Heartbeat has it's own hadrcoded notion of 24 hours not tied to this value
            m_PrizeID   = (int)m_container.Serial;                              // identifies the prize
            PlayerQuestManager.Deeds.Add(this);                                 // add to our managers list
            PlayerQuestManager.Announce();                                      // force an announcement now
            LogHelper Logger = new LogHelper("PlayerQuest.log", false);
            string    temp   = String.Format("A Player Quest Deed({0}) has been created.", this.Serial);

            Logger.Log(LogType.Item, m_container, temp);
            Logger.Finish();
        }
        public static int Announce(out int PlayerQuestsAnnounced)
        {
            PlayerQuestsAnnounced = 0;
            //LogHelper Logger = new LogHelper("PlayerQuest.log", false);
            int count = 0;

            try
            {
                int       msgndx       = 0;
                ArrayList ToDelete     = new ArrayList();
                ArrayList ParentMobile = new ArrayList();

                // clear any messages currently on the TC
                PlayerQuestManager.ClearAllMessages();

                // find expired
                foreach (object o in PlayerQuestManager.Deeds)
                {
                    if (o is PlayerQuestDeed == false)
                    {
                        continue;
                    }
                    PlayerQuestDeed pqd = o as PlayerQuestDeed;

                    if (pqd.Deleted == true)
                    {
                        ToDelete.Add(pqd);
                    }
                    else
                    {
                        object root = pqd.RootParent;
                        //bool exclude = false;
                        count++;

                        // don't announce an expired quest
                        if (pqd.Expired == true)
                        {
                            continue;
                        }

                        // don't announce if in a locked down container in a house
                        if (root is BaseContainer && Server.Multis.BaseHouse.FindHouseAt(pqd) != null)
                        {
                            BaseContainer bc = root as BaseContainer;
                            if (bc.IsLockedDown == true || bc.IsSecure == true)
                            {
                                continue;
                            }
                        }

                        // don't announce if locked down or secure
                        if (pqd.IsLockedDown == true || pqd.IsSecure == true)
                        {
                            continue;
                        }

                        // don't announce if on the internal map
                        if (pqd.Map == Map.Internal || root is Mobile && (root as Mobile).Map == Map.Internal)
                        {
                            continue;
                        }

                        // don't announce if in bankbox
                        if (root is Mobile && pqd.IsChildOf((root as Mobile).BankBox))
                        {
                            continue;
                        }

                        // only announce 1 ticket per mobile or container
                        // (15 tickets on a mob, or in a chest should generate 1 announcement)
                        if (root != null)
                        {
                            if (ParentMobile.Contains(root))
                            {
                                continue;
                            }
                        }

                        // only public houses
                        Server.Multis.BaseHouse house = null;
                        if (root is Item)
                        {
                            house = Server.Multis.BaseHouse.FindHouseAt(root as Item);
                        }
                        if (root is Mobile)
                        {
                            house = Server.Multis.BaseHouse.FindHouseAt(root as Mobile);
                        }
                        if (house != null && house.Public == false)
                        {
                            continue;
                        }

                        ///////////////////////////////////////////////////////
                        // okay announce it !
                        // record the parent
                        if (root != null)
                        {
                            ParentMobile.Add(root);
                        }

                        // format the message
                        string[] lines = new string[2];
                        if (root is Mobile)
                        {
                            Mobile mob = root as Mobile;
                            lines[0] = String.Format(
                                "{0} was last seen near {1}. {2} is not to be trusted.",
                                mob.Name,
                                BaseOverland.DescribeLocation(mob),
                                mob.Female == true ? "She" : "He");

                            lines[1] = String.Format(
                                "Do what you will with {0}, but get that quest ticket {1} carries.",
                                mob.Female == true ? "her" : "him",
                                mob.Female == true ? "she" : "he");
                        }
                        else
                        {
                            lines[0] = String.Format(
                                "A quest ticket was last seen near {0}",
                                BaseOverland.DescribeLocation(root == null ? pqd : root as Item));

                            lines[1] = String.Format(
                                "It may be of significant value, but be careful!");
                        }

                        // queue it
                        PlayerQuestManager.SetMessage(lines, msgndx++);

                        // count it
                        PlayerQuestsAnnounced++;
                    }

                    // record the expiring quest chest
                    //Logger.Log(LogType.Item, bc, "Player Quest prize being deleted because the quest has expired.");
                }

                // cleanup
                for (int i = 0; i < ToDelete.Count; i++)
                {
                    PlayerQuestDeed pqd = ToDelete[i] as PlayerQuestDeed;
                    if (pqd != null)
                    {
                        PlayerQuestManager.Deeds.Remove(pqd);
                    }
                }
            }
            catch (Exception e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("Exception while running PlayerQuestManager.Announce() job");
                Console.WriteLine(e);
            }
            finally
            {
                //Logger.Finish();
            }

            return(count);
        }