• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IXmlQuest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IXmlQuest的典型用法代码示例。如果您正苦于以下问题:C# IXmlQuest类的具体用法?C# IXmlQuest怎么用?C# IXmlQuest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IXmlQuest类属于命名空间,在下文中一共展示了IXmlQuest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: QuestEntry

			public QuestEntry(Mobile m, IXmlQuest quest)
			{
				Quester = m;
				if (quest != null)
				{
					WhenStarted = quest.TimeCreated;
					WhenCompleted = DateTime.UtcNow;
					Difficulty = quest.Difficulty;
					Name = quest.Name;
				}
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:11,代码来源:XmlQuestPoints.cs


示例2: ApplyCollected

		public static void ApplyCollected(Item target, IXmlQuest quest)
		{
			// check the quest objectives for special COLLECT keywords
			string newstatestr;
			bool collectstatus = false;

			if (!quest.Completed1 && CheckCollectObjective(quest, target, quest.Objective1, quest.State1, out newstatestr, out collectstatus))
			{
				quest.State1 = newstatestr;
				quest.Completed1 = collectstatus;
			}
			else if (!quest.Completed2 && CheckCollectObjective(quest, target, quest.Objective2, quest.State2, out newstatestr, out collectstatus))
			{
				quest.State2 = newstatestr;
				quest.Completed2 = collectstatus;
			}
			else if (!quest.Completed3 && CheckCollectObjective(quest, target, quest.Objective3, quest.State3, out newstatestr, out collectstatus))
			{
				quest.State3 = newstatestr;
				quest.Completed3 = collectstatus;
			}
			else if (!quest.Completed4 && CheckCollectObjective(quest, target, quest.Objective4, quest.State4, out newstatestr, out collectstatus))
			{
				quest.State4 = newstatestr;
				quest.Completed4 = collectstatus;
			}
			else if (!quest.Completed5 && CheckCollectObjective(quest, target, quest.Objective5, quest.State5, out newstatestr, out collectstatus))
			{
				quest.State5 = newstatestr;
				quest.Completed5 = collectstatus;

			}
			if (!quest.Deleted && quest.Owner != null && collectstatus)
			{
				quest.Owner.SendMessage("Quest objective completed.");

				// check to see if the quest has been completed and there is a reward to be automatically handed out
				quest.CheckAutoReward();

			}
		}
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:41,代码来源:XmlQuest.cs


示例3: TakeGiven

		private static void TakeGiven(Mobile to, IXmlQuest quest, Item item)
		{
			if (item == null) return;

			XmlSaveItem si = (XmlSaveItem)XmlAttach.FindAttachment(to, typeof(XmlSaveItem), "Given");

			if (si == null)
			{
				XmlAttach.AttachTo(to, new XmlSaveItem("Given", item, quest.Owner));
			}
			else
			{
				si.SavedItem = item;
				si.WasOwnedBy = quest.Owner;
			}

			// just delete it
			//item.Delete();
		}
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:19,代码来源:XmlQuest.cs


示例4: QuestEntry

 public QuestEntry(Mobile m, IXmlQuest quest)
 {
     this.Quester = m;
     if (quest != null)
     {
         this.WhenStarted = quest.TimeCreated;
         this.WhenCompleted = DateTime.Now;
         this.Difficulty = quest.Difficulty;
         this.Name = quest.Name;
     }
 }
开发者ID:m309,项目名称:ForkUO,代码行数:11,代码来源:XmlQuestPoints.cs


示例5: XmlPlayerQuestGump

		public XmlPlayerQuestGump( PlayerMobile from, IXmlQuest questitem ) : base( 12, 140 )
		{

			from.CloseGump( typeof( XmlPlayerQuestGump ) );

			if(from == null || from.Deleted || questitem == null || questitem.Deleted) return;

			m_From = from;
			m_QuestItem = questitem;

			int width = 600;

			//width = 516;

			X = (624 - width) / 2;

			AddPage( 0 );

			AddBackground( 10, 10, width, 439, 5054 );
			AddImageTiled( 18, 20, width - 17, 420, 2624 );

			AddAlphaRegion( 18, 20, width - 17, 420 );
			AddImage( 5, 5, 10460 );
			AddImage( width - 15, 5, 10460 );
			AddImage( 5, 424, 10460 );
			AddImage( width - 15, 424, 10460 );

			// add the Quest Title
            AddLabel( width/2 - 50, 15, 0x384, "Player Quest Maker" );
			
			int y = 35;

			// add the Quest Name
            AddLabel( 28, y, 0x384, "Quest Name" );
            string name = questitem.Name;
            if(name != null)
            {
                name = name.Substring(4);
            }
            AddImageTiled( 26, y + 20, 232, 20, 0xBBC );
            AddTextEntry( 26, y + 20, 250, 20, 0, 100, name );

            // add the Quest Title
            AddLabel( 328, y, 0x384, "Quest Title" );
            AddImageTiled( 306, y + 20, 232, 20, 0xBBC );
            AddTextEntry( 306, y + 20, 230, 20, 0, 102, questitem.TitleString );

            y += 50;
            // add the Quest Text
            AddLabel( 28, y, 0x384, "Quest Text" );
            AddImageTiled( 26, y + 20, 532, 80, 0xBBC );
            AddTextEntry( 26, y + 20, 530, 80, 0, 103, questitem.NoteString );

            y += 110;
            // add the Quest Expiration
            AddLabel( 28, y, 0x384, "Expiration" );
            AddLabel( 98, y + 20, 0x384, "Hours" );
            AddImageTiled( 26, y + 20, 52, 20, 0xBBC );
            AddTextEntry( 26, y + 20, 50, 20, 0, 210, questitem.Expiration.ToString() );

            y += 50;
            // add the Quest Objectives
            AddLabel( 28, y, 0x384, "Quest Objectives" );

            AddImageTiled( 26, y + 20, 252, 19, 0xBBC );
            AddTextEntry( 26, y + 20, 250, 19, 0, 200, questitem.Objective1 );

            AddImageTiled( 26, y + 40, 252, 19, 0xBBC );
            AddTextEntry( 26, y + 40, 250, 19, 0, 201, questitem.Objective2 );

            AddImageTiled( 26, y + 60, 252, 19, 0xBBC );
            AddTextEntry( 26, y + 60, 250, 19, 0, 202, questitem.Objective3 );

            AddImageTiled( 26, y + 80, 252, 19, 0xBBC );
            AddTextEntry( 26, y + 80, 250, 19, 0, 203, questitem.Objective4 );

            AddImageTiled( 26, y + 100, 252, 19, 0xBBC );
            AddTextEntry( 26, y + 100, 250, 19, 0, 204, questitem.Objective5 );

            // add the Quest Objectives
            AddLabel( 328, y, 0x384, "Objective Descriptions" );
            AddImageTiled( 306, y + 20, 252, 19, 0xBBC );
            AddTextEntry( 306, y + 20, 250, 19, 0, 205, questitem.Description1 );

            AddImageTiled( 306, y + 40, 252, 19, 0xBBC );
            AddTextEntry( 306, y + 40, 250, 19, 0, 206, questitem.Description2 );

            AddImageTiled( 306, y + 60, 252, 19, 0xBBC );
            AddTextEntry( 306, y + 60, 250, 19, 0, 207, questitem.Description3 );

            AddImageTiled( 306, y + 80, 252, 19, 0xBBC );
            AddTextEntry( 306, y + 80, 250, 19, 0, 208, questitem.Description4 );

            AddImageTiled( 306, y + 100, 252, 19, 0xBBC );
            AddTextEntry( 306, y + 100, 250, 19, 0, 209, questitem.Description5 );

            y += 130;
            // party enable toggle
            AddCheck( 25, y, 0xD2, 0xD3, questitem.PartyEnabled, 300);
            AddLabel( 48, y, 0x384, "PartyEnabled" );
//.........这里部分代码省略.........
开发者ID:Godkong,项目名称:RunUO,代码行数:101,代码来源:XmlPlayerQuestGump.cs


示例6: GiveQuestPoints

        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);
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:35,代码来源:XmlQuestPoints.cs


示例7: CheckKillObjective

		public static bool CheckKillObjective(IXmlQuest quest, Mobile m_killed, Mobile m_killer, string objectivestr, string statestr, out string newstatestr, out bool killstatus)
		{
			newstatestr = statestr;
			killstatus = false;
			if (objectivestr == null) return false;

			// format for the objective string will be KILL,mobtype[,count][,proptest] or KILLNAMED,mobname[,type][,count][,proptest]
			string[] arglist = BaseXmlSpawner.ParseString(objectivestr, 5, ",");
			int targetcount = 1;
			bool found = false;
			bool checkprop = true;
			string status_str = null;

			string typestr = null;

			CheckArgList(arglist, 2, m_killed, out typestr, out targetcount, out checkprop, out status_str);

			if (status_str != null) quest.Status = status_str;

			if (arglist.Length > 1)
			{
				// kill task objective
				if (arglist[0] == "KILL")
				{
					//Type targettype = SpawnerType.GetType( arglist[1] );

					// test the kill requirements against the the killed mobile
					if (m_killed != null && !m_killed.Deleted && BaseXmlSpawner.CheckType(m_killed, arglist[1])/*(m_killed.GetType() == targettype)*/ && checkprop)
					{
						// found a match
						found = true;
					}
				}
				else if (arglist[0] == "KILLNAMED")
				{
					if (m_killed != null && !m_killed.Deleted && (arglist[1] == m_killed.Name) && checkprop &&
					(typestr == null || BaseXmlSpawner.CheckType(m_killed, typestr))
					)
					{
						// found a match
						found = true;
					}
				}
			}
			// update the objective state
			if (found)
			{
				// get the current kill count and update it
				int current = 0;
				int.TryParse(statestr, out current);

				int killed = current + 1;
				newstatestr = String.Format("{0}", killed);

				if (killed >= targetcount)
				{
					// killtask completed
					killstatus = true; ;
				}
				return true;
			}
			else
				// not a kill task
				return false;
		}
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:65,代码来源:XmlQuest.cs


示例8: Give

		public static bool Give(Mobile from, Mobile to, Item target, IXmlQuest quest)
		{

			if (quest == null || !quest.IsValid) return false;

			bool found = false;

			// check to see what was dropped onto this
			if (target != null && !target.Deleted)
			{
				// check for party collection
				Party p = null;
				if (from != null && !from.Deleted && from is PlayerMobile)
				{
					p = Party.Get(from);
				}

				if (quest.PartyEnabled && p != null)
				{
					// go through all of the party members to find the equivalent quest items and apply the collected target item
					// make a randomized order list
					List<PartyMemberInfo> startlist = new List<PartyMemberInfo>();
					List<PartyMemberInfo> randlist = new List<PartyMemberInfo>();

					foreach (PartyMemberInfo mi in p.Members)
					{
						startlist.Add(mi);
					}

					while (randlist.Count < p.Members.Count)
					{
						// pick a random member from the start list
						// then take them off the list
						int randindex = Utility.Random(startlist.Count);

						randlist.Add(startlist[randindex]);

						startlist.RemoveAt(randindex);
					}

					foreach (PartyMemberInfo mi in randlist)
					{
						Mobile member = mi.Mobile;
						// see if the member is in range
						if (quest.PartyRange < 0 || Utility.InRange(from.Location, member.Location, quest.PartyRange))
						{
							// find the quest item in their packs
							Item questitem = BaseXmlSpawner.SearchMobileForItem(member, quest.Name, "IXmlQuest", false);

							if (questitem != null && !questitem.Deleted && questitem is IXmlQuest)
							{
								if (ApplyGiven(to, target, (IXmlQuest)questitem))
								{
									found = true;
								}
							}
						}
					}
				}
				else
				{
					found = ApplyGiven(to, target, quest);
				}
			}

			return found;
		}
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:67,代码来源:XmlQuest.cs


示例9: JournalEntryGump

            public JournalEntryGump(IXmlQuest questitem, string gumptitle, int X, int Y, bool solid)
                : base(X, Y)
            {
                if (questitem == null || questitem.Deleted)
                    return;

                m_questitem = questitem;
                m_gumptitle = gumptitle;
                m_X = X;
                m_Y = Y;
                m_solid = solid;

                AddPage(0);

                //AddBackground(0, 0, 260, 354, 5054);
                //AddAlphaRegion(20, 0, 220, 354);
                AddImage(0, 0, 0x24AE); // left top scroll
                AddImage(114, 0, 0x24AF); // middle top scroll
                AddImage(170, 0, 0x24B0); // right top scroll
                AddImageTiled(0, 140, 114, 100, 0x24B1); // left middle scroll
                AddImageTiled(114, 140, 114, 100, 0x24B2); // middle middle scroll
                AddImageTiled(170, 140, 114, 100, 0x24B3); // right middle scroll
                AddImage(0, 210, 0x24B4); // left bottom scroll
                AddImage(114, 210, 0x24B5); // middle bottom scroll
                AddImage(170, 210, 0x24B6); // right bottom scroll
                //AddImageTiled(23, 40, 214, 290, 0x52);
                //AddImageTiled(24, 41, 213, 281, 0xBBC);


                // OK button
                AddButton(25, 327, 0xFB7, 0xFB9, 1, GumpButtonType.Reply, 0);
                // Close button
                AddButton(230, 327, 0xFB1, 0xFB3, 0, GumpButtonType.Reply, 0);
                // Edit button
                //AddButton(100, 325, 0xEF, 0xEE, 2, GumpButtonType.Reply, 0);
                string str = null;

                int entrynumber = 0;
                if (questitem.Journal != null && questitem.Journal.Count > 0)
                {
                    entrynumber = questitem.Journal.Count;
                }
                string m_entryid = "Personal entry #" + entrynumber;

                // entryid text entry area
                //AddImageTiled(23, 0, 214, 23, 0x52);
                //AddImageTiled(24, 1, 213, 21, 0xBBC);
                AddTextEntry(35, 5, 200, 21, 0, 1, m_entryid);

                // main text entry area
                AddTextEntry(35, 40, 200, 271, 0, 0, str);

                // editing text entry areas
                // background for text entry area
                /*
                AddImageTiled(23, 275, 214, 23, 0x52);
                AddImageTiled(24, 276, 213, 21, 0xBBC);
                AddImageTiled(23, 300, 214, 23, 0x52);
                AddImageTiled(24, 301, 213, 21, 0xBBC);

                AddTextEntry(35, 275, 200, 21, 0, 1, null);
                AddTextEntry(35, 300, 200, 21, 0, 2, null);
                */
            }
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:64,代码来源:XmlQuestHolderGumps.cs


示例10: XmlQuestStatusGump

        public XmlQuestStatusGump(IXmlQuest questitem, string gumptitle, int X, int Y, bool solid, int screen)
            : base(X, Y)
        {
            Closable = true;
            Dragable = true;
            m_X = X;
            m_Y = Y;
            m_solid = solid;
            m_questitem = questitem;
            m_gumptitle = gumptitle;
            m_screen = screen;

            AddPage(0);

            if (!solid)
            {
                AddImageTiled(54, 33, 369, 400, 2624);
                AddAlphaRegion(54, 33, 369, 400);
            }
            else
            {
                AddBackground(54, 33, 369, 400, 5054);
            }

            AddImageTiled(416, 39, 44, 389, 203);

            //			AddButton( 338, 392, 2130, 2129, 3, GumpButtonType.Reply, 0 ); // Okay button

            AddHtmlLocalized(139, 59, 200, 30, 1046026, 0x7fff, false, false); // Quest Log
            AddImage(97, 49, 9005); // quest ribbon

            AddImageTiled(58, 39, 29, 390, 10460); // left hand border
            AddImageTiled(412, 37, 31, 389, 10460); // right hand border
            AddImage(430, 9, 10441);
            AddImageTiled(40, 38, 17, 391, 9263);
            AddImage(6, 25, 10421);
            AddImage(34, 12, 10420);
            AddImageTiled(94, 25, 342, 15, 10304); // top border
            AddImageTiled(40, 414, 415, 16, 10304); // bottom border
            AddImage(-10, 314, 10402);
            AddImage(56, 150, 10411);

            AddImage(136, 84, 96);
            AddImage(372, 57, 1417);
            AddImage(381, 66, 5576);

            // add the status and journal tabs
            AddImageTiled(90, 34, 322, 5, 0x145E); // top border
            int tab1 = 0x138F;
            int tab2 = 0x138E;
            if (screen == 1)
            {
                tab1 = 0x138E;
                tab2 = 0x138F;
            }
            AddButton(100, 18, tab1, tab2, 900, GumpButtonType.Reply, 0);
            AddLabel(115, 17, 0, "Status");
            AddButton(189, 18, tab2, tab1, 901, GumpButtonType.Reply, 0);
            AddLabel(205, 17, 0, "Journal");

            if (screen == 1)
            {
                // display the journal
                if (questitem.Journal != null && questitem.Journal.Count > 0)
                {
                    string journaltext = null;
                    for (int i = 0; i < questitem.Journal.Count; i++)
                    {
                        journaltext += "<u>";
                        journaltext += ((XmlQuest.JournalEntry)questitem.Journal[i]).EntryID;
                        journaltext += ":</u><br>";
                        journaltext += ((XmlQuest.JournalEntry)questitem.Journal[i]).EntryText;
                        journaltext += "<br><br>";
                    }
                    AddHtml(100, 90, 270, 300, journaltext, true, true);

                }

                // add the add journal entry button
                AddButton(300, 49, 0x99C, 0x99D, 952, GumpButtonType.Reply, 0);
                //AddButton(300, 49, 0x159E, 0x159D, 952, GumpButtonType.Reply, 0);
            }
            else
            {
                if (gumptitle != null && gumptitle.Length > 0)
                { // display the title if it is there
                    AddImage(146, 91, 2103); // bullet
                    AddHtml(164, 86, 200, 30, XmlSimpleGump.Color(gumptitle, "00FF42"), false, false);
                }

                if (questitem.NoteString != null && questitem.NoteString.Length > 0)
                { // display the note string if it is there
                    AddHtml(100, 106, 270, 80, questitem.NoteString, true, true);
                }

                DisplayQuestStatus(130, 192, questitem.Objective1, questitem.State1, questitem.Completed1, questitem.Description1);
                DisplayQuestStatus(130, 224, questitem.Objective2, questitem.State2, questitem.Completed2, questitem.Description2);
                DisplayQuestStatus(130, 256, questitem.Objective3, questitem.State3, questitem.Completed3, questitem.Description3);
                DisplayQuestStatus(130, 288, questitem.Objective4, questitem.State4, questitem.Completed4, questitem.Description4);
                DisplayQuestStatus(130, 320, questitem.Objective5, questitem.State5, questitem.Completed5, questitem.Description5);
//.........这里部分代码省略.........
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:101,代码来源:XmlQuestHolderGumps.cs


示例11: Collect

        public static void Collect(Mobile m, Item target, IXmlQuest quest)
        {
            if (quest == null || !quest.IsValid || m != quest.Owner) return;

            // check to see what was dropped onto this
            if (target != null && !target.Deleted)
            {
                // check for party collection
                Party p = null;
                if (m != null && !m.Deleted && m is PlayerMobile)
                {
                    p = Party.Get(m);
                }

                if (quest.PartyEnabled && p != null)
                {
                    // go through all of the party members to find the equivalent quest items and apply the collected target item
                    // make a randomized order list
                    ArrayList startlist = new ArrayList();
                    ArrayList randlist = new ArrayList();

                    foreach (PartyMemberInfo mi in p.Members)
                    {
                        startlist.Add(mi);
                    }

                    while (randlist.Count < p.Members.Count)
                    {
                        // pick a random member from the start list
                        // then take them off the list
                        int randindex = Utility.Random(startlist.Count);

                        randlist.Add(startlist[randindex]);

                        startlist.RemoveAt(randindex);
                    }

                    foreach (PartyMemberInfo mi in randlist)
                    {
                        Mobile member = mi.Mobile;

                        // see if the member is in range
                        if (quest.PartyRange < 0 || Utility.InRange(m.Location, member.Location, quest.PartyRange))
                        {
                            // find the quest item in their packs
                            Item questitem = BaseXmlSpawner.SearchMobileForItem(member, quest.Name, "IXmlQuest", false);

                            if (questitem != null && !questitem.Deleted && questitem is IXmlQuest)
                            {
                                ApplyCollected(target, (IXmlQuest)questitem);
                            }
                        }
                    }
                }
                else
                {
                    ApplyCollected(target, quest);
                }
            }
        }
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:60,代码来源:XmlQuest.cs


示例12: RewardTarget

 public RewardTarget(IXmlQuest questitem)
     : base(30, true, TargetFlags.None)
 {
     this.m_QuestItem = questitem;
 }
开发者ID:m309,项目名称:ForkUO,代码行数:5,代码来源:XmlPlayerQuestGump.cs


示例13: CheckCollectObjective

		public static bool CheckCollectObjective(IXmlQuest quest, Item item, string objectivestr, string statestr, out string newstatestr, out bool collectstatus)
		{
			// format for the objective string will be COLLECT,itemtype[,count][,proptest] or COLLECTNAMED,itemname[,itemtype][,count][,proptest]
			newstatestr = statestr;
			collectstatus = false;
			if (objectivestr == null) return false;

			string[] arglist = BaseXmlSpawner.ParseString(objectivestr, 5, ",");
			int targetcount = 1;
			bool found = false;
			bool checkprop = true;
			string status_str = null;

			string typestr = null;

			CheckArgList(arglist, 2, item, out typestr, out targetcount, out checkprop, out status_str);

			if (status_str != null) quest.Status = status_str;

			if (arglist.Length > 1)
			{
				// collect task objective
				if (arglist[0] == "COLLECT")
				{
					//Type targettype = SpawnerType.GetType( arglist[1] );
					// test the collect requirements against the the collected item
					if (item != null && !item.Deleted && BaseXmlSpawner.CheckType(item, arglist[1])/*(item.GetType() == targettype)*/ && checkprop)
					{
						// found a match
						found = true;
					}
				}
				else if (arglist[0] == "COLLECTNAMED")
				{
					if (item != null && !item.Deleted && (arglist[1] == item.Name) && checkprop &&
					(typestr == null || BaseXmlSpawner.CheckType(item, typestr))
					)
					{
						// found a match
						found = true;
					}
				}
			}
			// update the objective state
			if (found)
			{
				int current = 0;
				int.TryParse(statestr, out current);
				// get the current collect count and update it
				int added = 0;
				if (item.Stackable)
				{
					if (targetcount - current < item.Amount)
					{
						added = targetcount - current;

						if (quest != null && quest.PlayerMade)
						{
							Item newitem = Mobile.LiftItemDupe(item, item.Amount - added);
							//Item newitem = item.Dupe(added);
							//if(newitem != null)
							//newitem.Amount = added;
							ReturnCollected(quest, newitem);
						}
						else
						{
							item.Amount -= added;
							ReturnCollected(quest, item);
						}
					}
					else
					{
						added = item.Amount;
						// if it is a playermade quest then give the item to the creator, otherwise just delete it
						ReturnCollected(quest, item);
						//item.Delete();
					}
				}
				else
				{
					if (targetcount - current > 0)
					{
						added = 1;
						//item.Delete();
					}
					ReturnCollected(quest, item);
				}

				int collected = current + added;

				newstatestr = String.Format("{0}", collected);

				if (collected >= targetcount)
				{
					// collecttask completed
					collectstatus = true;
				}
				return true;
			}
			else
//.........这里部分代码省略.........
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:101,代码来源:XmlQuest.cs


示例14: ApplyGiven

		public static bool ApplyGiven(Mobile mob, Item target, IXmlQuest quest)
		{

			if (mob == null) return false;

			// check the quest objectives for special GIVE keywords
			string newstatestr;
			bool givestatus = false;
			bool found = false;

			if (!quest.Completed1 && CheckGiveObjective(quest, mob, target, quest.Objective1, quest.State1, out newstatestr, out givestatus))
			{
				quest.State1 = newstatestr;
				quest.Completed1 = givestatus;
				found = true;
			}
			else if (!quest.Completed2 && CheckGiveObjective(quest, mob, target, quest.Objective2, quest.State2, out newstatestr, out givestatus))
			{
				quest.State2 = newstatestr;
				quest.Completed2 = givestatus;
				found = true;
			}
			else if (!quest.Completed3 && CheckGiveObjective(quest, mob, target, quest.Objective3, quest.State3, out newstatestr, out givestatus))
			{
				quest.State3 = newstatestr;
				quest.Completed3 = givestatus;
				found = true;
			}
			else if (!quest.Completed4 && CheckGiveObjective(quest, mob, target, quest.Objective4, quest.State4, out newstatestr, out givestatus))
			{
				quest.State4 = newstatestr;
				quest.Completed4 = givestatus;
				found = true;
			}
			else if (!quest.Completed5 && CheckGiveObjective(quest, mob, target, quest.Objective5, quest.State5, out newstatestr, out givestatus))
			{
				quest.State5 = newstatestr;
				quest.Completed5 = givestatus;
				found = true;
			}

			/*
			if(found)
			{
				mob.Say("Thank you.");
			} else
			{
				mob.Say("I have no use for this.");
			}
			*/

			if (quest.Owner != null && found)
			{
				quest.Owner.SendMessage("Quest item accepted.");
			}

			if (!quest.Deleted && quest.Owner != null && givestatus)
			{
				quest.Owner.SendMessage("Quest objective completed.");
				// check to see if the quest has been completed and there is a reward to be automatically handed out
				quest.CheckAutoReward();
			}

			return found;
		}
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:65,代码来源:XmlQuest.cs


示例15: CheckEscortObjective

		public static bool CheckEscortObjective(IXmlQuest quest, Mobile m_escorted, Mobile m_escorter, string objectivestr, string statestr, out string newstatestr, out bool escortstatus)
		{
			newstatestr = statestr;
			escortstatus = false;
			if (objectivestr == null) return false;
			// format for the objective string will be ESCORT[,mobname][,proptest]
			string[] arglist = BaseXmlSpawner.ParseString(objectivestr, 3, ",");

			if (arglist.Length > 0)
			{
				// is it an escort task?
				if (arglist[0] != "ESCORT")
					return false;
			}
			else
			{
				return false;
			}

			bool found = false;

			int targetcount = 1;

			bool checkprop = true;
			string status_str = null;

			if (arglist.Length > 2)
			{
				checkprop = BaseXmlSpawner.CheckPropertyString(null, m_escorted, arglist[2], null, out status_str);
			}

			if (status_str != null) quest.Status = status_str;

			if (arglist.Length > 1)
			{
				// check the mobname, allow for empty names to match any escort

				if (m_escorted != null && !m_escorted.Deleted && (arglist[1] == m_escorted.Name || (arglist[1] == null || arglist[1] == String.Empty)) && checkprop)
				{
					// found a match
					found = true;
				}

			}
			else
			{
				// no mobname so any escort will do
				if (m_escorted != null && !m_escorted.Deleted && checkprop)
				{
					// found a match
					found = true;
				}
			}

			// update the objective state
			if (found)
			{
				// get the current escort count and update it
				int current = 0;
				int.TryParse(statestr, out current);

				int escorted = current + 1;

				newstatestr = String.Format("{0}", escorted);

				if (escorted >= targetcount)
				{
					// escort completed
					escortstatus = true; ;
				}
				return true;
			}
			else
				// not an escort task
				return false;
		}
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:76,代码来源:XmlQuest.cs


示例16: CheckGiveObjective

		public static bool CheckGiveObjective(IXmlQuest quest, Mobile mob, Item item, string objectivestr, string statestr, out string newstatestr, out bool givestatus)
		{
			// format for the objective string will be GIVE,mobname,itemtype[,count][,proptest] or GIVENAMED,mobname,itemname[,type][,count][,proptest]
			newstatestr = statestr;
			givestatus = false;
			if (objectivestr == null) return false;

			if (mob == null || mob.Name == null) return false;

			string[] arglist = BaseXmlSpawner.ParseString(objectivestr, 6, ",");
			int targetcount = 1;
			bool found = false;
			bool checkprop = true;
			string status_str = null;
			string typestr = null;

			CheckArgList(arglist, 3, item, out typestr, out targetcount, out checkprop, out status_str);

			if (status_str != null) quest.Status = status_str;

			if (arglist.Length > 1)
			{
				// the name of the mob must match the specified mobname
				if (mob.Name != arglist[1]) return false;
			}


			if (arglist.Length > 2)
			{
				// collect task objective
				if (arglist[0] == "GIVE")
				{
					//Type targettype = SpawnerType.GetType( arglist[2] );

					// test the requirements against the the given item
					if (item != null && !item.Deleted && BaseXmlSpawner.CheckType(item, arglist[2]) /*(item.GetType() == targettype)*/ && checkprop)
					{
						// found a match
						found = true;
					}
				}
				else if (arglist[0] == "GIVENAMED")
				{
					if (item != null && !item.Deleted && (arglist[2] == item.Name) && checkprop &&
					(typestr == null || BaseXmlSpawner.CheckType(item, typestr))
					)
					{
						// found a match
						found = true;
					}
				}
			}
			// update the objective state
			if (found)
			{

				int current = 0;
				int.TryParse(statestr, out current);

				// get the current given count and update it
				int added = 0;

				if (item.Stackable)
				{
					if (targetcount - current < item.Amount)
					{
						added = targetcount - current;

						if (quest != null && quest.PlayerMade)
						{
							//Item newitem = item.Dupe(added);
							Item newitem = Mobile.LiftItemDupe(item, added);
							//if(newitem != null)
							//newitem.Amount = added;
							TakeGiven(mob, quest, newitem);
						}
						else
						{
							item.Amount -= added;
						}
					}
					else
					{
						added = item.Amount;
						TakeGiven(mob, quest, item);
						//item.Delete();
					}
				}
				else
				{
					if (targetcount - current > 0)
					{
						added = 1;
						TakeGiven(mob, quest, item);
						//item.Delete();
					}
				}

				int collected = current + added;

//.........这里部分代码省略.........
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:101,代码来源:XmlQuest.cs


示例17: RegisterMove

		// Unused...was it meant to do anything?!
		/*public static Hashtable VisitSectorList = new Hashtable();

		public static void RegisterMove(PlayerMobile m_player)
		{

			if (m_player == null || m_player.Map == null) return;

			// check for any attachments that might support the OnMove method
			//XmlAttach.CheckOnMove(m_player);

			// check to see if the current sector that the player is in, is registered in the VISIT sector list
			Sector newSector = m_player.Map.GetSector(m_player.Location);

			if (VisitSectorList != null && VisitSectorList.Contains(newSector))
			{
				// check to see if the player has a quest with a VISIT type objective
				if (m_player.GetFlag(CarriedXmlQuestFlag))
				{
					CheckVisited(m_player);
				}
			}
		}*/

		public static bool CheckVisitObjective(IXmlQuest quest, PlayerMobile m_player, string objectivestr, string statestr, out string newstatestr, out bool visitstatus)
		{
			newstatestr = statestr;
			visitstatus = false;

			if (objectivestr == null) return false;

			// format for the objective string will be VISIT,x,y,range[,duration]
			string[] arglist = BaseXmlSpawner.ParseString(objectivestr, 5, ",");

			bool found = false;

			int targetcount = 1;

			string status_str = null;

			if (status_str != null) quest.Status = status_str;

			if (arglist.Length > 3)
			{
				// escort task objective
				if (arglist[0] == "VISIT")
				{

					double duration = 0; // duration in minutes

					// get the coords
					int x = 0;
					if(!int.TryParse(arglist[1], out x))
						status_str = "invalid VISIT x";

					int y = 0;
					if(!int.TryParse(arglist[2], out y))
						status_str = "invalid VISIT y";

					int range = 0;
					if(!int.TryParse(arglist[3], out range))
						status_str = "invalid VISIT range";

					if (arglist.Length > 4)
					{
						if(!double.TryParse(arglist[4], NumberStyles.Any, CultureInfo.InvariantCulture, out duration))
							status_str = "invalid VISIT duration";
					}

					// check them against the players current location

					if (m_player != null && m_player.InRange(new Point2D(x, y), range))
					{
						if (duration > 0)
						{
							// is there already a timer started on the quest object?
						}
						else
						{
							found = true;
						}
						// if it is in range, then start the timer
					}
				}
			}

			// update the objective state
			if (found)
			{
				// get the current visitation count and update it
				int current = 0;
				int.TryParse(statestr, out current);

				int visited = current + 1;

				newstatestr = String.Format("{0}", visited);

				if (visited >= targetcount)
				{
					// visitation completed
//.........这里部分代码省略.........
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:101,代码来源:XmlQuest.cs


示例18: ApplyKilled

		public static void ApplyKilled(Mobile m_killed, Mobile m_killer, IXmlQuest quest)
		{
			if (quest == null || !quest.IsValid) return;

			string newstatestr;
			bool killstatus = false;
			if (!quest.Completed1 && CheckKillObjective(quest, m_killed, m_killer, quest.Objective1, quest.State1, out newstatestr, out killstatus))
			{
				quest.State1 = newstatestr;
				quest.Completed1 = killstatus;
			}
			else if (!quest.Completed2 && CheckKillObjective(quest, m_killed, m_killer, quest.Objective2, quest.State2, out newstatestr, out killstatus))
			{
				quest.State2 = newstatestr;
				quest.Completed2 = killstatus;
			}
			else if (!quest.Completed3 && CheckKillObjective(quest, m_killed, m_killer, quest.Objective3, quest.State3, out newstatestr, out killstatus))
			{
				quest.State3 = newstatestr;
				quest.Completed3 = killstatus;
			}
			else if (!quest.Completed4 && CheckKillObjective(quest, m_killed, m_killer, quest.Objective4, quest.State4, out newstatestr, out killstatus))
			{
				quest.State4 = newstatestr;
				quest.Completed4 = killstatus;
			}
			else if (!quest.Completed5 && CheckKillObjective(quest, m_killed, m_killer, quest.Objective5, quest.State5, out newstatestr, out killstatus))
			{
				quest.State5 = newstatestr;
				quest.Completed5 = killstatus;
			}
			if (!quest.Deleted && quest.Owner != null && killstatus)
			{
				quest.Owner.SendMessage("Quest objective completed.");
				// check to see if the quest has been completed and there is a reward to be automatically handed out
				quest.CheckAutoReward();
			}
		}
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:38,代码来源:XmlQuest.cs


示例19: VerifyObjectives

		public static void VerifyObjectives(IXmlQuest quest)
		{
			string status_str;

			// go through each objective and test the args
			VerifyObjective(BaseXmlSpawner.ParseString(quest.Objective1, 6, ","), out status_str);
			if (status_str != null) quest.Status = status_str;
			VerifyObjective(BaseXmlSpawner.ParseString(quest.Objective2, 6, ","), out status_str);
			if (status_str != null) quest.Status = status_str;
			VerifyObjective(BaseXmlSpawner.ParseString(quest.Objective3, 6, ","), out status_str);
			if (status_str != null) quest.Status = status_str;
			VerifyObjective(BaseXmlSpawner.ParseString(quest.Objective4, 6, ","), out status_str);
			if (status_str != null) quest.Status = status_str;
			VerifyObjective(BaseXmlSpawner.ParseString(quest.Objective5, 6, ","), out status_str);
			if (status_str != null) quest.Status = status_str;

		}
开发者ID:jamison654321,项目名称:xmlspawner,代码行数:17,代码来源:XmlQuest.cs


示例20: AddQuestEntry

            public static void AddQuestEntry(Mobile m, IXmlQuest quest)
            {
                if(m == null || quest == null) return;

                // get the XmlQuestPoints attachment from the mobile
                XmlQuestPoints p = (XmlQuestPoints)XmlAttach.FindAttachment(m, typeof(XmlQuestPoints));

                if(p == null) return;

                // look through the list of quests and see if it is one that has already been done
                if(p.QuestList == null) p.QuestList = new ArrayList();

                bool found = false;
                foreach(QuestEntry e in p.QuestList)
                { 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IXmpMeta类代码示例发布时间:2022-05-24
下一篇:
C# IXmlNode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap