本文整理汇总了C#中Aura.World.World.MabiCreature.GiveExp方法的典型用法代码示例。如果您正苦于以下问题:C# MabiCreature.GiveExp方法的具体用法?C# MabiCreature.GiveExp怎么用?C# MabiCreature.GiveExp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.World.World.MabiCreature
的用法示例。
在下文中一共展示了MabiCreature.GiveExp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleCreatureKill
public void HandleCreatureKill(MabiCreature creature, MabiCreature killer, MabiVertex position, SkillConst skillId)
{
if (killer != null)
{
// Shadow Bunshin soul counter
if (skillId != SkillConst.ShadowBunshin)
killer.SoulCount++;
// Exp
if (killer.LevelingEnabled)
{
// Give exp
var exp = creature.BattleExp * WorldConf.ExpRate;
killer.GiveExp((ulong)exp);
Send.CombatMessage(killer.Client, killer, "+{0} EXP", exp);
EventManager.CreatureEvents.OnCreatureKilled(creature, killer);
if (killer is MabiPC)
EventManager.PlayerEvents.OnKilledByPlayer(creature, killer);
}
}
var npc = creature as MabiNPC;
if (npc != null)
{
var rnd = RandomProvider.Get();
// Gold
if (rnd.NextDouble() < WorldConf.GoldDropRate)
{
var amount = rnd.Next(npc.GoldMin, npc.GoldMax + 1);
if (amount > 0)
{
var gold = new MabiItem(2000);
gold.Info.Amount = (ushort)amount;
gold.Info.Region = npc.Region;
gold.Info.X = (uint)(position.X + rnd.Next(-50, 51));
gold.Info.Y = (uint)(position.Y + rnd.Next(-50, 51));
gold.DisappearTime = DateTime.Now.AddSeconds(60);
this.AddItem(gold);
}
}
// Drops
foreach (var drop in npc.Drops)
{
if (rnd.NextDouble() < drop.Chance * WorldConf.DropRate)
{
var item = new MabiItem(drop.ItemId);
item.Info.Amount = 1;
item.Info.Region = npc.Region;
item.Info.X = (uint)(position.X + rnd.Next(-50, 51));
item.Info.Y = (uint)(position.Y + rnd.Next(-50, 51));
item.DisappearTime = DateTime.Now.AddSeconds(60);
this.AddItem(item);
}
}
}
// Set finisher?
WorldManager.Instance.Broadcast(new MabiPacket(Op.CombatSetFinisher, creature.Id).PutLong(killer.Id), SendTargets.Range, creature);
// Clear target
Send.CombatTargetSet(killer, null);
// Finish this finisher part?
WorldManager.Instance.Broadcast(new MabiPacket(Op.CombatSetFinisher2, creature.Id), SendTargets.Range, creature);
// TODO: There appears to be something missing to let it lay there for finish, if we don't kill it with the following packets.
// TODO: Check for finishing.
// Make it dead
WorldManager.Instance.Broadcast(new MabiPacket(Op.IsNowDead, creature.Id), SendTargets.Range, creature);
// Remove finisher?
WorldManager.Instance.Broadcast(new MabiPacket(Op.CombatSetFinisher, creature.Id).PutLong(0), SendTargets.Range, creature);
if (creature.ActiveSkillId != SkillConst.None)
creature.CancelSkill();
if (creature.Owner != null)
{
Send.DeadFeather(creature, DeadMenuOptions.Here | DeadMenuOptions.FeatherUp);
// TODO: Unmount.
}
creature.CauseOfDeath = DeathCauses.None;
if (creature.ArenaPvPManager != null && creature.ArenaPvPManager == killer.ArenaPvPManager && creature.ArenaPvPManager.IsAttackableBy(creature, killer))
{
creature.ArenaPvPManager.CreatureKilled(creature, killer);
creature.CauseOfDeath = DeathCauses.Arena;
}
// TODO: Trans PvP
if (creature.CauseOfDeath == DeathCauses.None && creature.EvGEnabled && killer.EvGEnabled)
//.........这里部分代码省略.........
示例2: 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));
}