本文整理汇总了C#中Aura.Channel.World.Entities.Creature.GiveExp方法的典型用法代码示例。如果您正苦于以下问题:C# Creature.GiveExp方法的具体用法?C# Creature.GiveExp怎么用?C# Creature.GiveExp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.Channel.World.Entities.Creature
的用法示例。
在下文中一共展示了Creature.GiveExp方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Kill
/// <summary>
/// Kills NPC, rewarding the killer.
/// </summary>
/// <param name="killer"></param>
public override void Kill(Creature killer)
{
base.Kill(killer);
this.DisappearTime = DateTime.Now.AddSeconds(20);
if (killer == null)
return;
// Exp
var exp = (long)(this.RaceData.Exp * ChannelServer.Instance.Conf.World.ExpRate);
killer.GiveExp(exp);
Send.CombatMessage(killer, "+{0} EXP", exp);
}
示例2: Reward
public override void Reward(Creature creature, Quest quest)
{
creature.GiveExp(this.Amount);
Send.AcquireInfo(creature, "exp", this.Amount);
}
示例3: Kill
/// <summary>
/// Kills NPC, rewarding the killer.
/// </summary>
/// <param name="killer"></param>
public override void Kill(Creature killer)
{
base.Kill(killer);
this.DisappearTime = DateTime.Now.AddSeconds(NPC.DisappearDelay);
if (killer == null)
return;
// Exp
var exp = (long)(this.RaceData.Exp * ChannelServer.Instance.Conf.World.ExpRate);
var expRule = killer.Party.ExpRule;
if (!killer.IsInParty || expRule == PartyExpSharing.AllToFinish)
{
killer.GiveExp(exp);
Send.CombatMessage(killer, "+{0} EXP", exp);
}
else
{
var members = killer.Party.GetMembers();
var eaExp = 0L;
var killerExp = 0L;
var killerPos = killer.GetPosition();
// Apply optional exp bonus
if (members.Length > 1)
{
var extra = members.Length - 1;
var bonus = ChannelServer.Instance.Conf.World.PartyExpBonus;
exp += (long)(exp * ((extra * bonus) / 100f));
}
// Official simply ALWAYS divides by party member total,
// even if they cannot recieve the experience.
if (expRule == PartyExpSharing.Equal)
{
eaExp = exp / members.Length;
killerExp = eaExp;
}
else if (expRule == PartyExpSharing.MoreToFinish)
{
exp /= 2;
eaExp = exp / members.Length;
killerExp = exp;
}
// Killer's exp
killer.GiveExp(killerExp);
Send.CombatMessage(killer, "+{0} EXP", killerExp);
// Exp for members in range of killer, the range is unofficial
foreach (var member in members.Where(a => a != killer && a.GetPosition().InRange(killerPos, 3000)))
{
member.GiveExp(eaExp);
Send.CombatMessage(member, "+{0} EXP", eaExp);
}
}
}
示例4: Burn
/// <summary>
/// Handles item burning, retruns whether it was successful.
/// </summary>
/// <param name="creature"></param>
/// <param name="item"></param>
/// <param name="campfire"></param>
/// <param name="enchantersBurn"></param>
public bool Burn(Creature creature, Item item, Prop campfire, bool enchantersBurn)
{
var skill = creature.Skills.Get(SkillId.Enchant);
var enchantBurnSuccess = false;
var powderBurnSuccess = false;
var exp = 0;
// Enchanter's Burn
if (enchantersBurn)
{
var rnd = RandomProvider.Get();
var isEquip = item.HasTag("/equip/");
var hasEnchantBurnItems = (creature.Inventory.Has(51102) && creature.Inventory.Has(63016)); // Mana Herb + Holy Water
// Enchant burning
if (!isEquip || !hasEnchantBurnItems)
{
// Unofficial
Send.SystemMessage(creature, Localization.Get("You don't the necessary items."));
return false;
}
// Get chances
// All unofficial
var rank = (skill == null ? 16 : (int)skill.Info.Rank);
var enchantChance = (skill == null ? 0 : skill.RankData.Var3);
// Campfire r8+ bonus
if (enchantChance > 0 && campfire.Temp.CampfireSkillRank.Rank >= SkillRank.R8)
enchantChance += (16 - rank);
// Powder = double enchant chance, based on the Wiki saying
// r1 doesn't guarantee getting the enchants, but it does
// guarantee getting powder.
var powderChance = enchantChance * 2;
// Debug
if (creature.Titles.SelectedTitle == TitleId.devCAT)
Send.ServerMessage(creature, "Debug: Chance for enchant: {0:0}, chance for powder: {1:0}", enchantChance, powderChance);
// Try prefix
if (item.OptionInfo.Prefix != 0 && rnd.Next(100) < enchantChance)
{
var enchant = Item.CreateEnchant(item.OptionInfo.Prefix);
creature.AcquireItem(enchant);
enchantBurnSuccess = true;
}
// Try suffix
if (item.OptionInfo.Suffix != 0 && rnd.Next(100) < enchantChance)
{
var enchant = Item.CreateEnchant(item.OptionInfo.Suffix);
creature.AcquireItem(enchant);
enchantBurnSuccess = true;
}
// Try suffix
if (item.OptionInfo.Prefix + item.OptionInfo.Suffix != 0 && rnd.Next(100) < powderChance)
{
var powder = new Item(62003); // Blessed Magic Powder
creature.AcquireItem(powder);
powderBurnSuccess = true;
}
// Reduce items
creature.Inventory.Remove(51102, 1); // Mana Herb
creature.Inventory.Remove(63016, 1); // Holy Water
// Training
this.BurnTraining(skill, enchantBurnSuccess, powderBurnSuccess);
// Success/Fail motion
Send.UseMotion(creature, 14, enchantBurnSuccess ? 0 : 3);
}
// Add exp based on item buying price (random+unofficial)
if (item.OptionInfo.Price > 0)
{
exp = 40 + (int)(item.OptionInfo.Price / (float)item.Data.StackMax / 100f * item.Info.Amount);
creature.GiveExp(exp);
}
// Remove item from cursor
creature.Inventory.Remove(item);
// Effect
Send.Effect(MabiId.Broadcast, creature, Effect.BurnItem, campfire.EntityId, enchantBurnSuccess);
Send.Notice(creature, NoticeType.MiddleSystem, Localization.Get("Burning EXP {0}"), exp);
return true;
}
示例5: Touch
/// <summary>
/// Applies random fountain effect to creature.
/// </summary>
/// <param name="creature"></param>
protected virtual void Touch(Creature creature)
{
var rnd = RandomProvider.Get();
// All notices are unofficial
switch (rnd.Next(15))
{
case 0: // Full Life
{
creature.FullLifeHeal();
Send.Notice(creature, Localization.Get("Full Life"));
break;
}
case 1: // 0 Injuries
{
creature.Injuries = 0;
Send.StatUpdateDefault(creature);
Send.Notice(creature, Localization.Get("No Injuries"));
break;
}
case 2: // Full Stamina
{
creature.Stamina = creature.StaminaMax;
Send.StatUpdateDefault(creature);
Send.Notice(creature, Localization.Get("Full Stamina"));
break;
}
case 3: // Full Mana
{
creature.Mana = creature.ManaMax;
Send.StatUpdateDefault(creature);
Send.Notice(creature, Localization.Get("Full Mana"));
break;
}
case 4: // No Hunger
{
creature.Hunger = 0;
Send.StatUpdateDefault(creature);
Send.Notice(creature, Localization.Get("No Hunger"));
break;
}
case 5: // Gold
{
creature.GiveItem(Item.CreateGold(rnd.Next(100, 200 + 1)));
Send.Notice(creature, Localization.Get("Gold"));
break;
}
case 6: // Exp
{
creature.GiveExp(1000);
Send.Notice(creature, Localization.Get("Exp"));
break;
}
case 7: // Bless All
{
var items = creature.Inventory.GetEquipment(a => a.IsBlessable);
creature.Bless(items);
Send.Notice(creature, Localization.Get("Blessed All"));
break;
}
case 8: // Bless One
{
var equip = creature.Inventory.GetEquipment(a => !a.IsBlessed && a.IsBlessable);
var count = equip.Count();
if (count == 0)
break;
var item = equip.ElementAt(rnd.Next(count));
creature.Bless(item);
Send.Notice(creature, Localization.Get("Blessed {0}"), item.Data.Name);
break;
}
case 9: // Repair One
{
var equip = creature.Inventory.GetEquipment(a => a.OptionInfo.Durability != a.OptionInfo.DurabilityMax);
var count = equip.Count();
if (count == 0)
break;
var item = equip.ElementAt(rnd.Next(count));
item.OptionInfo.Durability = item.OptionInfo.DurabilityMax;
Send.ItemDurabilityUpdate(creature, item);
//.........这里部分代码省略.........
示例6: Reward
public override void Reward(Creature creature, Quest quest)
{
var amount = this.Amount;
// Add global bonus
float bonusMultiplier;
string bonuses;
if (ChannelServer.Instance.GameEventManager.GlobalBonuses.GetBonusMultiplier(GlobalBonusStat.QuestExp, out bonusMultiplier, out bonuses))
amount = (int)(amount * bonusMultiplier);
// Friday: Increase in rewards for completing part-time jobs.
// (20% increase in EXP and Gold rewards)
if (quest.Data.Type == QuestType.Deliver && ErinnTime.Now.Month == ErinnMonth.AlbanElved)
amount = (int)(amount * 1.2f);
creature.GiveExp(amount);
Send.AcquireInfo(creature, "exp", amount);
}
示例7: Reward
public override void Reward(Creature creature, Quest quest)
{
var amount = this.Amount;
// Friday: Increase in rewards for completing part-time jobs.
// (20% increase in EXP and Gold rewards)
if (quest.Data.Type == QuestType.Deliver && ErinnTime.Now.Month == ErinnMonth.AlbanElved)
amount = (int)(amount * 1.2f);
creature.GiveExp(amount);
Send.AcquireInfo(creature, "exp", amount);
}