本文整理汇总了C#中Aura.Channel.World.Quests.Quest类的典型用法代码示例。如果您正苦于以下问题:C# Quest类的具体用法?C# Quest怎么用?C# Quest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Quest类属于Aura.Channel.World.Quests命名空间,在下文中一共展示了Quest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例8: Reward
public override void Reward(Creature creature, Quest quest)
{
creature.Inventory.Add(this.ItemId, this.Amount);
Send.AcquireItemInfo(creature, this.ItemId, this.Amount);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例14: Reward
public override void Reward(Creature creature, Quest quest)
{
creature.Inventory.AddGold(this.Amount);
Send.AcquireInfo(creature, "gold", this.Amount);
}
示例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);
}