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


C# GamePlayer.AddQuest方法代码示例

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


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

示例1: GiveQuest

		/// <summary>
		/// Give a quest a to specific player
		/// used for scripted quests
		/// </summary>
		/// <param name="questType">The quest type</param>
		/// <param name="player">The player that gets the quest</param>
		/// <param name="startStep">The starting quest step</param>
		/// <returns>true if added, false if the player do already the quest!</returns>
		public bool GiveQuest(Type questType, GamePlayer player, int startStep)
		{
			AbstractQuest quest = HasQuest(questType);
			if (quest != null)
			{
				AbstractQuest newQuest = (AbstractQuest)Activator.CreateInstance(questType, new object[] { player, startStep });
				if (newQuest != null && player.AddQuest(newQuest))
				{
					player.Out.SendNPCsQuestEffect(this, GetQuestIndicator(player));
					return true;
				}
			}
			return false;
		}
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:22,代码来源:GameNPC.cs

示例2: CheckOfferQuest

		/// <summary>
		/// A player has interacted with an object that has a DataQuest.
		/// Check to see if we can offer this quest to the player and display the text
		/// </summary>
		/// <param name="player"></param>
		/// <param name="obj"></param>
		protected virtual void CheckOfferQuest(GamePlayer player, GameObject obj)
		{
			// Can we offer this quest to the player?
			if (CheckQuestQualification(player))
			{
				if (StartType == eStartType.InteractComplete)
				{
					// This quest finishes with the interaction

					CharacterXDataQuest charQuest = GetCharacterQuest(player, ID, true);

					if (charQuest.Count < MaxQuestCount)
					{
						if (ExecuteCustomQuestStep(player, 0, eStepCheckType.Finish))
						{
							if (Description.Trim() != "")
							{
								SendMessage(player, Description, 0, eChatType.CT_System, eChatLoc.CL_PopupWindow);
							}

							if (m_finalRewards.Count > 0)
							{
								lock (player.Inventory)
								{
									if (player.Inventory.IsSlotsFree(m_finalRewards.Count, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack))
									{
										foreach (ItemTemplate item in m_finalRewards)
										{
											if (item != null)
											{
												GiveItem((obj is GameLiving ? obj as GameLiving : null), player, item, false);
											}
										}
									}
									else
									{
										SendMessage(player, "Your inventory does not have enough space to finish this quest!", 0, eChatType.CT_System, eChatLoc.CL_PopupWindow);
										return;
									}
								}
							}

							if (m_rewardXPs.Count > 0 && m_rewardXPs[0] > 0)
							{
								player.GainExperience(GameLiving.eXPSource.Quest, m_rewardXPs[0]);
							}

							if (m_rewardMoneys.Count > 0 && m_rewardMoneys[0] > 0)
							{
								player.AddMoney(m_rewardMoneys[0], "You are awarded {0}!");
                                InventoryLogging.LogInventoryAction("(QUEST;" + Name + ")", player, eInventoryActionType.Quest, m_rewardMoneys[0]);
							}

							charQuest.Count++;
							GameServer.Database.SaveObject(charQuest);

							bool add = true;
							lock (player.QuestListFinished)
							{
								foreach (AbstractQuest q in player.QuestListFinished)
								{
									if (q is DataQuest && (q as DataQuest).ID == ID)
									{
										add = false;
										break;
									}
								}
							}

							if (add)
							{
								player.QuestListFinished.Add(this);
							}

							player.Out.SendQuestListUpdate();

							player.Out.SendMessage(String.Format(LanguageMgr.GetTranslation(player.Client, "AbstractQuest.FinishQuest.Completed", Name)), eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
							player.Out.SendMessage(String.Format(LanguageMgr.GetTranslation(player.Client, "AbstractQuest.FinishQuest.Completed", Name)), eChatType.CT_Important, eChatLoc.CL_SystemWindow);
						}
					}
					return;
				}

				if (StartType == eStartType.AutoStart)
				{
					CharacterXDataQuest charQuest = GetCharacterQuest(player, ID, true);
					DataQuest dq = new DataQuest(player, obj, DBDataQuest, charQuest);
					dq.Step = 1;
					player.AddQuest(dq);
					if (m_sourceTexts.Count > 0)
					{
						if (string.IsNullOrEmpty(m_sourceTexts[0]) == false)
						{
							SendMessage(player, m_sourceTexts[0], 0, eChatType.CT_System, eChatLoc.CL_PopupWindow);
//.........这里部分代码省略.........
开发者ID:boscorillium,项目名称:dol,代码行数:101,代码来源:DataQuest.cs

示例3: CheckOfferedQuestWhisper

		/// <summary>
		/// Check offered quests to see if whisper should be processed
		/// </summary>
		/// <param name="player"></param>
		/// <param name="living"></param>
		/// <param name="text"></param>
		protected virtual void CheckOfferedQuestWhisper(GamePlayer player, GameLiving living, string text)
		{
			//log.DebugFormat("Checking accept quest: '{0}' ID: {1} of type '{2}', key word '{3}', is qualified {4}", Name, ID, (eStartType)DBDataQuest.StartType, DBDataQuest.AcceptText, CheckQuestQualification(player));

			if (CheckQuestQualification(player) && DBDataQuest.StartType == (byte)eStartType.Standard && DBDataQuest.AcceptText == text)
			{
				//log.DebugFormat("Adding quest {0} to player {1}", Name, player.Name);
				CharacterXDataQuest charQuest = GetCharacterQuest(player, ID, true);
				DataQuest dq = new DataQuest(player, living, DBDataQuest, charQuest);
				dq.Step = 1;
				player.AddQuest(dq);
				if (m_sourceTexts.Count > 0)
				{
					SendMessage(player, m_sourceTexts[0], 0, eChatType.CT_System, eChatLoc.CL_PopupWindow);
				}
				else
				{
					ChatUtil.SendDebugMessage(player, "Source Text missing on accept quest.");
				}
				if (living is GameNPC)
				{
					UpdateQuestIndicator(living as GameNPC, player);
				}
			}
		}
开发者ID:boscorillium,项目名称:dol,代码行数:31,代码来源:DataQuest.cs

示例4: GiveArtifactQuest

		/// <summary>
		/// Give the artifact quest to the player.
		/// </summary>
		/// <param name="player"></param>
		/// <param name="questType"></param>
		private void GiveArtifactQuest(GamePlayer player, Type questType)
		{
			if (player == null || questType == null)
				return;

			ArtifactQuest quest = (ArtifactQuest)Activator.CreateInstance(questType,
				new object[] { player });

			if (quest == null)
				return;

			player.AddQuest(quest);
			quest.WhisperReceive(player, this, quest.ArtifactID);
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:19,代码来源:Scholar.cs


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