本文整理汇总了C#中GamePlayer.CanReceiveArtifact方法的典型用法代码示例。如果您正苦于以下问题:C# GamePlayer.CanReceiveArtifact方法的具体用法?C# GamePlayer.CanReceiveArtifact怎么用?C# GamePlayer.CanReceiveArtifact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GamePlayer
的用法示例。
在下文中一共展示了GamePlayer.CanReceiveArtifact方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckQuestQualification
/// <summary>
/// Check if player is eligible for this quest.
/// </summary>
/// <param name="player"></param>
/// <returns></returns>
public override bool CheckQuestQualification(GamePlayer player)
{
// Must have the encounter, must have the book; must not be on the quest
// and must not have the quest finished either.
Type encounterType = ArtifactMgr.GetEncounterType(ArtifactID);
if (encounterType == null)
{
m_reasonFailQualification = "It does not appear this encounter type is set up correctly.";
log.Warn("ArtifactQuest: EncounterType is null for ArtifactID " + ArtifactID);
return false;
}
if (player == null)
{
m_reasonFailQualification = "Player is null for quest, serious error!";
log.Warn("ArtifactQuest: Player is null for ArtifactID " + ArtifactID + " encounterType " + encounterType.FullName);
return false;
}
if (player.CanReceiveArtifact(ArtifactID) == false)
{
m_reasonFailQualification = "Your class is not eligible for this artifact.";
return false;
}
if (player.Level < Level)
{
m_reasonFailQualification = "You must be at least level " + Level + " in order to complete this quest.";
return false;
}
if (player.HasFinishedQuest(this.GetType()) != 0)
{
m_reasonFailQualification = "You've already completed the quest for this artifact.";
return false;
}
if (player.HasFinishedQuest(encounterType) <= 0)
{
m_reasonFailQualification = "You must first get the encounter credit for this artifact.";
return false;
}
if (!ArtifactMgr.HasBook(player, ArtifactID))
{
m_reasonFailQualification = "You are missing the correct book for this artifact.";
return false;
}
if (player.IsDoingQuest(this.GetType()) != null)
{
m_reasonFailQualification = "You've already started the quest for this artifact.";
return false;
}
return true;
}
示例2: GrantArtifactCredit
/// <summary>
/// Grant credit for an artifact.
/// </summary>
/// <param name="player"></param>
/// <param name="artifactID"></param>
/// <returns></returns>
public static bool GrantArtifactCredit(GamePlayer player, String artifactID)
{
if (player == null || artifactID == null)
return false;
if (!player.CanReceiveArtifact(artifactID))
return false;
Artifact artifact;
lock (m_artifacts)
{
if (!m_artifacts.ContainsKey(artifactID))
return false;
artifact = m_artifacts[artifactID];
}
if (artifact == null)
return false;
Type encounterType = GetQuestType(artifact.EncounterID);
if (encounterType == null)
return false;
Type artifactQuestType = GetQuestType(artifact.QuestID);
if (artifactQuestType == null)
return false;
if (player.HasFinishedQuest(encounterType) > 0 ||
player.HasFinishedQuest(artifactQuestType) > 0)
return false;
AbstractQuest quest = (AbstractQuest)(System.Activator.CreateInstance(encounterType,
new object[] { player }));
if (quest == null)
return false;
quest.FinishQuest();
return true;
}
示例3: Interact
/// <summary>
/// Interact with scholar.
/// </summary>
/// <param name="player"></param>
/// <returns></returns>
public override bool Interact(GamePlayer player)
{
if (!base.Interact(player))
return false;
IList quests = QuestListToGive;
int count = 0;
string artifacts = "";
if (quests.Count > 0)
{
lock (quests.SyncRoot)
{
int numQuests = quests.Count;
foreach (ArtifactQuest quest in quests)
{
// if continuing a quest and on a step that requires input then
// let the quest handle the interaction
ArtifactQuest playerQuest = (ArtifactQuest)player.IsDoingQuest(quest.GetType());
if (playerQuest != null)
{
if (playerQuest.Interact(this, player))
return true;
}
if (player.CanReceiveArtifact(quest.ArtifactID))
{
if (count > 0 && numQuests < quests.Count)
artifacts += (numQuests == 1) ? ", or " : ", ";
artifacts += String.Format("[{0}]", quest.ArtifactID);
++count;
}
--numQuests;
}
}
}
String intro = "";
if (count == 0)
{
intro = "I have no artifacts available for your class";
}
else
{
intro = String.Format("Which artifact may I assist you with, {0}? {1} {2}",
player.CharacterClass.Name,
"I study the lore and magic of the following artifacts:",
artifacts);
}
intro += ".";
SayTo(player, eChatLoc.CL_PopupWindow, intro);
intro = String.Format("{0}, did you find any of the stories that chronicle the powers of the {1} {2} ",
player.Name,
"artifacts? We can unlock the powers of these artifacts by studying the stories.",
"I can take the story and unlock the artifact's magic.");
SayTo(player, eChatLoc.CL_PopupWindow, intro);
return true;
}