Ejemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:

                m_Points     = reader.ReadInt();
                m_Credits    = reader.ReadInt();
                m_Completed  = reader.ReadInt();
                m_Rank       = reader.ReadInt();
                m_DeltaRank  = reader.ReadInt();
                m_WhenRanked = reader.ReadDateTime();

                int nquests = reader.ReadInt();

                if (nquests > 0)
                {
                    QuestList = new ArrayList(nquests);
                    for (int i = 0; i < nquests; i++)
                    {
                        QuestEntry e = new QuestEntry();
                        e.Deserialize(reader);

                        QuestList.Add(e);
                    }
                }



                // get the owner of this in order to rebuild the rankings
                Mobile quester = reader.ReadMobile();

                // rebuild the ranking list
                // if they have never made a kill, then dont rank
                if (quester != null && QuestsCompleted > 0)
                {
                    XmlQuestLeaders.UpdateQuestRanking(quester, this);
                }
                break;
            }
        }
Ejemplo n.º 2
0
        public static void GiveQuestPoints(Mobile from, IXmlQuest quest)
        {
            if (from == null || quest == null)
            {
                return;
            }

            // find the XmlQuestPoints attachment

            XmlQuestPoints p = (XmlQuestPoints)XmlAttach.FindAttachment(from, typeof(XmlQuestPoints));

            // if doesnt have one yet, then add it
            if (p == null)
            {
                p = new XmlQuestPoints();
                XmlAttach.AttachTo(from, p);
            }

            // if you wanted to scale the points given based on party size, karma, fame, etc.
            // this would be the place to do it
            int points = quest.Difficulty;

            // update the questpoints attachment information
            p.Points  += points;
            p.Credits += points;
            p.QuestsCompleted++;

            if (from != null)
            {
                from.SendMessage("You have received {0} quest points!", points);
            }

            // add the completed quest to the quest list
            QuestEntry.AddQuestEntry(from, quest);

            // update the overall ranking list
            XmlQuestLeaders.UpdateQuestRanking(from, p);
        }