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

C# Quests.Quest类代码示例

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

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



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

示例1: QuestUpdate

		/// <summary>
		/// Broadcasts QuestUpdate in party.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="quest"></param>
		public static void QuestUpdate(Party party, Quest quest)
		{
			var packet = new Packet(Op.QuestUpdate, 0);
			packet.AddQuestUpdate(quest);

			party.Broadcast(packet, true);
		}
开发者ID:Rai,项目名称:aura,代码行数:12,代码来源:Send.Quests.cs


示例2: Add

		/// <summary>
		/// Adds quest to manager and informs the client about it.
		/// </summary>
		/// <param name="quest"></param>
		public void Add(Quest quest)
		{
			// Check quest item
			if (quest.QuestItem == null)
				throw new InvalidOperationException("Quest item can't be null.");

			if (!_creature.Inventory.Has(quest.QuestItem))
				throw new InvalidOperationException("The quest item needs to be in the creature's inventory first.");

			this.AddSilent(quest);

			// Quest info
			Send.NewQuest(_creature, quest);

			// Start PTJ clock
			if (quest.Data.Type == QuestType.Deliver)
				Send.QuestStartPtj(_creature, quest.UniqueId);

			// Initial objective check, for things like collect and reach rank,
			// that may be done already.
			quest.Data.CheckCurrentObjective(_creature);

			// Give item to deliver for first deliver objective
			var deliverObjective = quest.Data.Objectives[quest.CurrentObjectiveOrLast.Ident] as QuestObjectiveDeliver;
			if (deliverObjective != null)
			{
				var item = new Item(deliverObjective.ItemId);
				item.Amount = Math.Min(1, deliverObjective.Amount);

				_creature.Inventory.Add(item, true);
			}
		}
开发者ID:hzdlive,项目名称:aura-1,代码行数:36,代码来源:CreatureQuests.cs


示例3: Complete

        /// <summary>
        /// Completes and removes quest, if it exists.
        /// </summary>
        /// <param name="questId"></param>
        public bool Complete(Quest quest)
        {
            var success = this.Complete(quest, true);
            if (success)
            {
                quest.State = QuestState.Complete;

                ChannelServer.Instance.Events.OnPlayerCompletesQuest(_creature, quest.Id);
            }
            return success;
        }
开发者ID:Kuukrow,项目名称:aura,代码行数:15,代码来源:CreatureQuests.cs


示例4: Add

		/// <summary>
		/// Adds quest to manager and informs the client about it.
		/// </summary>
		/// <param name="quest"></param>
		public void Add(Quest quest)
		{
			// Check quest item
			if (quest.QuestItem == null)
				throw new InvalidOperationException("Quest item can't be null.");

			if (!_creature.Inventory.Has(quest.QuestItem))
				throw new InvalidOperationException("The quest item needs to be in the creature's inventory first.");

			this.AddSilent(quest);

			// Quest info
			Send.NewQuest(_creature, quest);

			// Start PTJ clock
			if (quest.Data.Type == QuestType.Deliver)
				Send.QuestStartPtj(_creature, quest.UniqueId);

			// Initial objective check, for things like collect and reach rank,
			// that may be done already.
			quest.Data.CheckCurrentObjective(_creature);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:26,代码来源:CreatureQuests.cs


示例5: Add

		/// <summary>
		/// Adds quest to manager and informs the client about it.
		/// </summary>
		/// <param name="quest"></param>
		public void Add(Quest quest)
		{
			// Check quest item
			if (quest.QuestItem == null)
				throw new InvalidOperationException("Quest item can't be null.");

			if (!_creature.Inventory.Has(quest.QuestItem))
				throw new InvalidOperationException("The quest item needs to be in the creature's inventory first.");

			this.AddSilent(quest);

			// Quest info
			Send.NewQuest(_creature, quest);

			// Start PTJ clock
			if (quest.Data.Type == QuestType.Deliver)
				Send.QuestStartPtj(_creature, quest.UniqueId);

			// Initial objective check, for things like collect and reach rank,
			// that may be done already.
			quest.Data.CheckCurrentObjective(_creature);

			// Give item to deliver for first deliver objective
			var deliverObjective = quest.Data.Objectives[quest.CurrentObjectiveOrLast.Ident] as QuestObjectiveDeliver;
			if (deliverObjective != null)
			{
				var item = new Item(deliverObjective.ItemId);
				item.Amount = Math.Min(1, deliverObjective.Amount);

				_creature.Inventory.Add(item, true);
			}

			// Receive event
			// XXX: Could be used for the deliver objectives above as well?
			//   It would make more sense to always give delvier items
			//   automatically though, not only on start.
			quest.Data.OnReceive(_creature);
		}
开发者ID:aura-project,项目名称:aura,代码行数:42,代码来源:CreatureQuests.cs


示例6: QuestUpdate

		/// <summary>
		/// Sends QuestUpdate to creature's client.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="quest"></param>
		public static void QuestUpdate(Creature creature, Quest quest)
		{
			var progress = quest.GetList();

			var packet = new Packet(Op.QuestUpdate, creature.EntityId);
			packet.PutLong(quest.UniqueId);
			packet.PutByte(1);
			packet.PutInt(progress.Count);
			foreach (var p in progress)
			{
				packet.PutInt(p.Count);
				// [180600, NA187 (25.06.2014)] ?
				{
					packet.PutFloat(0);
				}
				packet.PutByte(p.Done);
				packet.PutByte(p.Unlocked);
			}
			packet.PutByte(0);
			packet.PutByte(0);

			creature.Client.Send(packet);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:28,代码来源:Send.Quests.cs


示例7: CreateQuestScroll

		/// <summary>
		/// Creates quest scroll for the given quest id.
		/// </summary>
		/// <remarks>
		/// During the creation, a quest is created and included with the item.
		/// </remarks>
		/// <param name="questId"></param>
		/// <returns></returns>
		public static Item CreateQuestScroll(int questId)
		{
			// Get quest information
			var questScript = ChannelServer.Instance.ScriptManager.QuestScripts.Get(questId);
			if (questScript == null)
				throw new ArgumentException("Quest '" + questId + "' not found.");

			var quest = new Quest(questId);

			var item = new Item(questScript.ScrollId);
			item.MetaData1.Parse(quest.Data.MetaData.ToString());

			item.Quest = quest;
			quest.QuestItem = item;

			return item;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:25,代码来源:Item.cs


示例8: Reward

		public override void Reward(Creature creature, Quest quest)
		{
			creature.Inventory.Add(this.ItemId, this.Amount);
			Send.AcquireItemInfo(creature, this.ItemId, this.Amount);
		}
开发者ID:xKamuna,项目名称:aura,代码行数:5,代码来源:Rewards.cs


示例9: GiveUp

		/// <summary>
		/// Completes and removes quest without rewards, if it exists.
		/// </summary>
		/// <param name="quest"></param>
		/// <returns></returns>
		public bool GiveUp(Quest quest)
		{
			if (!this.Has(quest))
				throw new ArgumentException("Quest not found in this manager.");

			var success = this.EndQuest(quest, -1, false);

			// Remove quest item on success, which will also remove the
			// quest from the manager.
			if (success)
				_creature.Inventory.Remove(quest.QuestItem);

			return success;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:19,代码来源:CreatureQuests.cs


示例10: SetPartyQuest

		/// <summary>
		/// Sets party quest, removing previous ones and updating all members.
		/// </summary>
		/// <param name="quest"></param>
		public void SetPartyQuest(Quest quest)
		{
			if (this.Quest != null)
				this.UnsetPartyQuest();

			this.Quest = quest;

			// Give quest to other members
			lock (_sync)
			{
				foreach (var member in _members.Where(a => a != this.Leader))
				{
					member.Quests.AddSilent(quest);
					Send.NewQuest(member, quest);
				}
			}

			Send.PartySetActiveQuest(this, quest.UniqueId);
		}
开发者ID:Rai,项目名称:aura,代码行数:23,代码来源:Party.cs


示例11: UnsetPartyQuest

		/// <summary>
		/// Unsets party quest, removes it from all normal member's managers,
		/// and updates the clients. Returns false if no party quest was set.
		/// </summary>
		/// <param name="quest"></param>
		public bool UnsetPartyQuest()
		{
			var quest = this.Quest;
			if (quest == null)
				return false;

			this.Quest = null;

			// Remove quest from other members
			lock (_sync)
			{
				foreach (var member in _members.Where(a => a != this.Leader))
					member.Quests.Remove(quest);
			}

			Send.PartyUnsetActiveQuest(this, quest.UniqueId);
			return true;
		}
开发者ID:Rai,项目名称:aura,代码行数:23,代码来源:Party.cs


示例12: EndQuest

		/// <summary>
		/// Completes and removes quest, if it exists, giving the rewards
		/// in the process, if warranted.
		/// </summary>
		/// <param name="quest"></param>
		/// <param name="rewardGroup">Reward group to use, set to -1 for no rewards.</param>
		/// <param name="owl">Show owl delivering the rewards?</param>
		/// <returns></returns>
		private bool EndQuest(Quest quest, int rewardGroup, bool owl)
		{
			var result = quest.GetResult();

			// Increase PTJ done/success
			if (quest.Data.Type == QuestType.Deliver)
				this.ModifyPtjTrackRecord(quest.Data.PtjType, +1, (result == QuestResult.Perfect ? +1 : 0));

			// Rewards
			if (rewardGroup != -1)
			{
				var rewards = quest.Data.GetRewards(rewardGroup, result);
				if (rewards.Count == 0)
					Log.Warning("CreatureQuests.EndQuest: No rewards for group '{0}' at result '{1}' in quest '{2}'.", rewardGroup, result, quest.Id);
				else
					this.GiveRewards(quest, rewards, owl);
			}

			// Remove from quest log.
			Send.QuestClear(_creature, quest.UniqueId);

			// Update PTJ stuff and stop clock
			if (quest.Data.Type == QuestType.Deliver)
			{
				var record = this.GetPtjTrackRecord(quest.Data.PtjType);

				Send.QuestUpdatePtj(_creature, quest.Data.PtjType, record.Done, record.Success);
				Send.QuestEndPtj(_creature);
			}

			return true;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:40,代码来源:CreatureQuests.cs


示例13: AddQuestUpdate

		public static void AddQuestUpdate(this Packet packet, Quest quest)
		{
			var progress = quest.GetList();

			packet.PutLong(quest.UniqueId);
			packet.PutByte(1);
			packet.PutInt(progress.Count);
			foreach (var p in progress)
			{
				packet.PutInt(p.Count);
				// [180600, NA187 (25.06.2014)] ?
				{
					packet.PutFloat(0);
				}
				packet.PutByte(p.Done);
				packet.PutByte(p.Unlocked);
			}
			packet.PutByte(0);
			packet.PutByte(0);
		}
开发者ID:Rai,项目名称:aura,代码行数:20,代码来源:QuestHelper.cs


示例14: Reward

		public override void Reward(Creature creature, Quest quest)
		{
			creature.Inventory.AddGold(this.Amount);
			Send.AcquireInfo(creature, "gold", this.Amount);
		}
开发者ID:evelive3,项目名称:aura,代码行数:5,代码来源:Rewards.cs


示例15: Has

		/// <summary>
		/// Returns true if creature has the given quest.
		/// </summary>
		/// <param name="quest"></param>
		/// <returns></returns>
		public bool Has(Quest quest)
		{
			lock (_quests)
				return _quests.Contains(quest);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:10,代码来源:CreatureQuests.cs


示例16: GiveRewards

		/// <summary>
		/// Gives quest rewards to creature.
		/// </summary>
		/// <param name="quest">Quest the rewards come from.</param>
		/// <param name="rewards">Rewards to give to the creature.</param>
		/// <param name="owl">Show owl delivering the rewards?</param>
		private void GiveRewards(Quest quest, ICollection<QuestReward> rewards, bool owl)
		{
			if (rewards.Count == 0)
				return;

			if (owl)
				Send.QuestOwlComplete(_creature, quest.UniqueId);

			foreach (var reward in rewards)
			{
				try
				{
					reward.Reward(_creature, quest);
				}
				catch (NotImplementedException)
				{
					Log.Unimplemented("Quest.Complete: Reward '{0}'.", reward.Type);
				}
			}
		}
开发者ID:tkiapril,项目名称:aura,代码行数:26,代码来源:CreatureQuests.cs


示例17: AddSilent

		/// <summary>
		/// Adds quest to manager, does not update client, send owl,
		/// or anything else.
		/// </summary>
		/// <remarks>
		/// This method is for initialization, use Give during run-time.
		/// </remarks>
		/// <param name="quest"></param>
		public void AddSilent(Quest quest)
		{
			lock (_quests)
				_quests.Add(quest);
		}
开发者ID:tkiapril,项目名称:aura,代码行数:13,代码来源:CreatureQuests.cs


示例18: StartPtj

		/// <summary>
		/// Starts PTJ quest.
		/// </summary>
		/// <param name="questId"></param>
		public void StartPtj(int questId)
		{
			try
			{
				var quest = new Quest(questId);

				quest.MetaData.SetByte("QMRTCT", (byte)quest.Data.RewardGroups.Count);
				quest.MetaData.SetInt("QMRTBF", 0x4321); // (specifies which groups to display at which position, 1 group per hex char)
				quest.MetaData.SetString("QRQSTR", this.NPC.Name);
				quest.MetaData.SetBool("QMMABF", false);

				// Calculate deadline, based on current time and quest data
				var now = ErinnTime.Now;
				var diffHours = Math.Max(0, quest.Data.DeadlineHour - now.Hour - 1);
				var diffMins = Math.Max(0, 60 - now.Minute);
				var deadline = DateTime.Now.AddTicks(diffHours * ErinnTime.TicksPerHour + diffMins * ErinnTime.TicksPerMinute);
				quest.Deadline = deadline;

				this.Player.Quests.Start(quest, false);
			}
			catch (Exception ex)
			{
				Log.Exception(ex, "NpcScript.StartPtj: Quest '{0}'", questId);
				this.Msg("(Error)");
			}
		}
开发者ID:ripxfrostbite,项目名称:aura,代码行数:30,代码来源:NpcScript.cs


示例19: UpdateQuest

		/// <summary>
		/// Updates quest on client(s), depending on its type.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="quest"></param>
		private void UpdateQuest(Creature creature, Quest quest)
		{
			if (!this.IsPartyQuest)
				Send.QuestUpdate(creature, quest);
			else
				Send.QuestUpdate(creature.Party, quest);
		}
开发者ID:aura-project,项目名称:aura,代码行数:12,代码来源:QuestScript.cs


示例20: CanMakeProgress

		/// <summary>
		/// Returns true if creature can make progress on this quest.
		/// </summary>
		/// <remarks>
		/// Used from objective event handlers, to see if the quest should
		/// receive the progress.
		/// </remarks>
		/// <param name="creature"></param>
		/// <param name="quest"></param>
		/// <returns></returns>
		private bool CanMakeProgress(Creature creature, Quest quest)
		{
			// Party quests can only make progress if they're active
			if (this.IsPartyQuest)
				return (creature.IsInParty && creature.Party.Quest == quest);

			// TODO: Guild quests, outside, delay

			return true;
		}
开发者ID:aura-project,项目名称:aura,代码行数:20,代码来源:QuestScript.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Network.Packet类代码示例发布时间:2022-05-24
下一篇:
C# Entities.Creature类代码示例发布时间: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