本文整理汇总了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;
}
示例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);
//.........这里部分代码省略.........
示例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);
}
}
}
示例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);
}