本文整理汇总了C#中Aura.World.World.MabiCreature.GiveItem方法的典型用法代码示例。如果您正苦于以下问题:C# MabiCreature.GiveItem方法的具体用法?C# MabiCreature.GiveItem怎么用?C# MabiCreature.GiveItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.World.World.MabiCreature
的用法示例。
在下文中一共展示了MabiCreature.GiveItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatureCompletesQuest
public void CreatureCompletesQuest(MabiCreature creature, MabiQuest quest, bool rewards)
{
if (rewards)
{
// Owl
WorldManager.Instance.Broadcast(new MabiPacket(Op.QuestOwlComplete, creature.Id).PutLong(quest.Id), SendTargets.Range, creature);
// Rewards
foreach (var reward in quest.Info.Rewards)
{
switch (reward.Type)
{
case RewardType.Exp:
creature.GiveExp(reward.Amount);
creature.Client.Send(PacketCreator.AcquireExp(creature, reward.Amount));
this.CreatureStatsUpdate(creature);
break;
case RewardType.Gold:
creature.GiveItem(2000, reward.Amount);
creature.Client.Send(PacketCreator.AcquireItem(creature, reward.Id, reward.Amount));
break;
case RewardType.Item:
creature.GiveItem(reward.Id, reward.Amount);
creature.Client.Send(PacketCreator.AcquireItem(creature, reward.Id, reward.Amount));
break;
case RewardType.Skill:
var id = (SkillConst)reward.Id;
var rank = (SkillRank)reward.Amount;
// Only give skill if char doesn't have it or rank is lower.
var skill = creature.Skills.Get(id);
if (skill == null || skill.Rank < rank)
{
creature.Skills.Give(id, rank);
WorldManager.Instance.CreatureStatsUpdate(creature);
}
break;
default:
Logger.Warning("Unsupported reward type '{0}'.", reward.Type);
break;
}
}
// Only call this if there were rewards, we're using this
// method to clear quests as well.
var script = ScriptManager.Instance.GetQuestScript(quest.Info.Id);
if (script != null)
script.OnCompleted(creature.Client as WorldClient, quest);
}
Send.ItemInfo(creature.Client, creature, quest.QuestItem);
// Remove from quest log.
creature.Client.Send(new MabiPacket(Op.QuestClear, creature.Id).PutLong(quest.Id));
}