当前位置: 首页>>代码示例>>C#>>正文


C# Quest.GetProgress方法代码示例

本文整理汇总了C#中Aura.Channel.World.Quests.Quest.GetProgress方法的典型用法代码示例。如果您正苦于以下问题:C# Quest.GetProgress方法的具体用法?C# Quest.GetProgress怎么用?C# Quest.GetProgress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Aura.Channel.World.Quests.Quest的用法示例。


在下文中一共展示了Quest.GetProgress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Complete

		/// <summary>
		/// Completes quest and takes rewards from group and the result
		/// based on the progress on the current or last objective.
		/// Primarily used by PTJs.
		/// </summary>
		/// <param name="quest"></param>
		/// <param name="rewardGroup">Reward group to use.</param>
		/// <param name="owl">Show owl delivering the quest?</param>
		/// <returns></returns>
		public bool Complete(Quest quest, int rewardGroup, bool owl)
		{
			if (!this.Has(quest))
				throw new ArgumentException("Quest not found in this manager.");

			var success = this.EndQuest(quest, rewardGroup, owl);
			if (success)
			{
				quest.State = QuestState.Complete;

				// Remove quest item after the state was set, so the item
				// is removed, but not the quest.
				_creature.Inventory.Remove(quest.QuestItem);

				// Remove collected items for Collect objectives at the end
				// of the objectives. This way all items that were to be
				// collected are removed automatically, unless the last
				// objectives are different, like Talk, in which case the
				// NPC should control what happens.
				// Starts at the last objective and goes back until the first
				// one or a non-Collect objective is reached.
				for (var i = quest.Data.Objectives.Count - 1; i >= 0; --i)
				{
					var progress = quest.GetProgress(i);
					var objective = quest.Data.Objectives[progress.Ident];

					var collectObjective = objective as QuestObjectiveCollect;
					if (collectObjective == null)
						break;

					_creature.Inventory.Remove(collectObjective.ItemId, Math.Min(collectObjective.Amount, progress.Count));
				}

				ChannelServer.Instance.Events.OnPlayerCompletesQuest(_creature, quest.Id);

				// Complete event
				quest.Data.OnComplete(_creature);
			}
			return success;
		}
开发者ID:aura-project,项目名称:aura,代码行数:49,代码来源:CreatureQuests.cs

示例2: AddQuest

		public static void AddQuest(this Packet packet, Quest quest)
		{
			if (quest.Data == null)
				throw new Exception("AddQuest: Missing quest data for '" + quest.Id.ToString() + "'.");

			packet.PutLong(quest.UniqueId);
			packet.PutByte(0);

			packet.PutLong(quest.QuestItem.EntityId);

			packet.PutByte((byte)quest.Data.Type); // 0 = blue icon, 2 = normal, 4 = exploration, 7 = shadow (changes structure slightly)
			// Client values that might make sense:
			// Delivery: 1? (id == 506401?)
			// Event: 1? ((this + 80) == 18?)
			// Homework: 1? ((this + 80) >= 10000?)
			// Exploration: 4|5
			// Escort: 6
			// Shadow: 7|8
			// Bingo: 9
			// GameQuest: 2|4|5
			// GuildQuest: 0 (id >= 110001 < 120000?)
			// PartyQuest: 0 (id >= 100000 < 110000?), blue icon with party symbol, turns yellow if active

			packet.PutInt(quest.Id); // Range is important for the tabs.
			// 201000~201999 : event
			// 202000~209999 : normal
			// 210000~239999 : goddess
			// 240000~289999 : normal
			// 290000~290599 : alchemist
			// 290600~291999 : normal
			// 292000~292599 : alchemist
			// 292600~292999 : normal
			// 293000~293599 : alchemist
			// 293600~293999 : shakespear (default)
			// 294000~294599 : shakespear (hamlet)
			// 294600~294999 : shakespear (default)
			// 295000~295599 : shakespear (romeo and juliet)
			// 295600~295999 : shakespear (default)
			// 296000~296599 : shakespear (merchant)
			// 296600~296999 : shakespear (default)
			// 297000~297599 : shakespear (macbeth)
			// 297600~______ : normal

			packet.PutString(quest.Data.Name);
			packet.PutString(quest.Data.Description);
			packet.PutString(quest.Data.AdditionalInfo);

			packet.PutInt(1);
			packet.PutInt(quest.QuestItem.Info.Id);
			packet.PutByte(quest.Data.Cancelable);
			packet.PutByte(0);
			packet.PutByte(0); // 1 = blue icon
			packet.PutByte(0);

			// [180300, NA166 (18.09.2013)] ?
			{
				packet.PutByte(0);
				packet.PutByte(0);
				packet.PutByte(0);
			}

			// [190200, NA203 (22.04.2015)] ?
			{
				packet.PutByte(0);
			}

			packet.PutString(""); // data\gfx\image\gui_temporary_quest.dds
			packet.PutInt(0);     // 4, x y ?
			packet.PutInt(0);
			packet.PutString(""); // <xml soundset="4" npc="GUI_NPCportrait_Lanier"/>
			packet.PutString(quest.MetaData.ToString());

			switch (quest.Data.Type)
			{
				case QuestType.Deliver:
					packet.PutInt((int)quest.Data.PtjType);
					packet.PutInt(quest.Data.StartHour);
					packet.PutInt(quest.Data.ReportHour);
					packet.PutInt(quest.Data.DeadlineHour);
					packet.PutLong(quest.Deadline);
					break;

				default:
					packet.PutInt(0);
					packet.PutInt(0);
					break;
			}

			packet.PutInt(quest.Data.Objectives.Count);
			foreach (var objectiveData in quest.Data.Objectives)
			{
				var objective = objectiveData.Value;
				var progress = quest.GetProgress(objectiveData.Key);

				// Objective
				packet.PutByte((byte)objective.Type);
				packet.PutString(objective.Description);
				packet.PutString(objective.MetaData.ToString());

				// 3  - TARGECHAR:s:shamala;TARGETCOUNT:4:1; - Ask Shamala about collecting transformations
//.........这里部分代码省略.........
开发者ID:Rai,项目名称:aura,代码行数:101,代码来源:QuestHelper.cs

示例3: AddQuest

        private static void AddQuest(this Packet packet, Quest quest)
        {
            if (quest.Data == null)
                throw new Exception("AddQuest: Missing quest data for '" + quest.Id.ToString() + "'.");

            packet.PutLong(quest.UniqueId);
            packet.PutByte(0);

            packet.PutLong(quest.QuestItem.EntityId);

            packet.PutByte(2); // 0 = blue icon, 2 = normal, 4 = exploration, 7 = shadow (changes structure slightly)
            // Client values that might make sense:
            // Delivery: 1? (id == 506401?)
            // Event: 1? ((this + 80) == 18?)
            // Homework: 1? ((this + 80) >= 10000?)
            // Exploration: 4|5
            // Escort: 6
            // Shadow: 7|8
            // Bingo: 9
            // GameQuest: 2|4|5
            // GuildQuest: 0 (id >= 110001 < 120000?)
            // PartyQuest: 0 (id >= 100000 < 110000?)

            packet.PutInt(quest.Id); // Range is important for the tabs.
            // 201000~201999 : event
            // 202000~209999 : normal
            // 210000~239999 : goddess
            // 240000~289999 : normal
            // 290000~290599 : alchemist
            // 290600~291999 : normal
            // 292000~292599 : alchemist
            // 292600~292999 : normal
            // 293000~293599 : alchemist
            // 293600~293999 : shakespear (default)
            // 294000~294599 : shakespear (hamlet)
            // 294600~294999 : shakespear (default)
            // 295000~295599 : shakespear (romeo and juliet)
            // 295600~295999 : shakespear (default)
            // 296000~296599 : shakespear (merchant)
            // 296600~296999 : shakespear (default)
            // 297000~297599 : shakespear (macbeth)
            // 297600~______ : normal

            packet.PutString(quest.Data.Name);
            packet.PutString(quest.Data.Description);
            packet.PutString(""); // AdditionalInfo?

            packet.PutInt(1);
            packet.PutInt(quest.QuestItem.Info.Id);
            packet.PutByte(quest.Data.Cancelable); // Doesn't seem to work?
            packet.PutByte(0);
            packet.PutByte(0); // 1 = blue icon
            packet.PutByte(0);

            // [180300, NA166 (18.09.2013)] ?
            {
                packet.PutByte(0);
                packet.PutByte(0);
                packet.PutByte(0);
            }

            packet.PutString(""); // data\gfx\image\gui_temporary_quest.dds
            packet.PutInt(0);     // 4, x y ?
            packet.PutInt(0);
            packet.PutString(""); // <xml soundset="4" npc="GUI_NPCportrait_Lanier"/>
            packet.PutString("QMBEXP:f:1.000000;QMBGLD:f:1.000000;QMSMEXP:f:1.000000;QMSMGLD:f:1.000000;QMAMEXP:f:1.000000;QMAMGLD:f:1.000000;QMBHDCTADD:4:0;QMGNRB:f:1.000000;QMGNRB:f:1.000000;");

            packet.PutInt(0);
            packet.PutInt(0);
            // Alternative, PTJ
            //020 [........00000002] Int    : 2
            //021 [........0000000C] Int    : 12
            //022 [........00000010] Int    : 16
            //023 [........00000015] Int    : 21
            //024 [000039BF89671150] Long   : 63494806770000 // Timestamp

            packet.PutInt(quest.Data.Objectives.Count);
            foreach (var objectiveData in quest.Data.Objectives)
            {
                var objective = objectiveData.Value;
                var progress = quest.GetProgress(objectiveData.Key);

                // Objective
                packet.PutByte((byte)objective.Type);
                packet.PutString(objective.Description);
                packet.PutString(objective.MetaData.ToString());

                // 3  - TARGECHAR:s:shamala;TARGETCOUNT:4:1; - Ask Shamala about collecting transformations
                // 14 - TARGETITEM:4:40183;TARGETCOUNT:4:1; - Break a nearby tree
                // 1  - TGTSID:s:/brownphysisfoxkid/;TARGETCOUNT:4:10;TGTCLS:2:0; - Hunt 10 Young Brown Physis Foxes
                // 9  - TGTSKL:2:23002;TGTLVL:2:1;TARGETCOUNT:4:1; - Combat Mastery rank F reached
                // 19 - TGTCLS:2:3906;TARGETCOUNT:4:1; - Win at least one match in the preliminaries or the finals of the Jousting Tournament.
                // 18 - TGTCLS:2:3502;TARGETCOUNT:4:1; - Read the Author's Notebook.
                // 4  - TARGECHAR:s:duncan;TARGETITEM:4:75473;TARGETCOUNT:4:1; - Deliver the Author's Notebook to Duncan.
                // 15 - TGTLVL:2:15;TARGETCOUNT:4:1; - Reach Lv. 15
                // 2  - TARGETITEM:4:52027;TARGETCOUNT:4:10;QO_FLAG:4:1; - Harvest 10 Bundles of Wheat
                // 22 - TGTSID:s:/ski/start/;TARGETITEM:4:0;EXCNT:4:0;TGITM2:4:0;EXCNT2:4:0;TARGETCOUNT:4:1; - Click on the Start Flag.
                // 47 - TARGETCOUNT:4:1;TGTCLS:4:730205; - Clear the Monkey Mash Mission.
                // 52 - QO_FLAG:b:true;TARGETCOUNT:4:1; - Collect for the Transformation Diary
                // 50 - TARGETRACE:4:9;TARGETCOUNT:4:1; - Transform into a Kiwi.
//.........这里部分代码省略.........
开发者ID:pie3467,项目名称:aura,代码行数:101,代码来源:Send.Adds.cs


注:本文中的Aura.Channel.World.Quests.Quest.GetProgress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。