本文整理匯總了C#中WCell.RealmServer.Entities.Character.MayCarry方法的典型用法代碼示例。如果您正苦於以下問題:C# Character.MayCarry方法的具體用法?C# Character.MayCarry怎麽用?C# Character.MayCarry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WCell.RealmServer.Entities.Character
的用法示例。
在下文中一共展示了Character.MayCarry方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CheckEquip
/// <summary>
/// Returns what went wrong (if anything) when the given unit tries to equip or use Items of this Template.
/// </summary>
public InventoryError CheckEquip(Character chr)
{
if (chr.GodMode)
{
return InventoryError.OK;
}
// level
if (chr.Level < RequiredLevel)
{
return InventoryError.YOU_MUST_REACH_LEVEL_N;
}
// class
if (RequiredClassMask != 0 && !RequiredClassMask.HasAnyFlag(chr.ClassMask))
{
return InventoryError.YOU_CAN_NEVER_USE_THAT_ITEM;
}
// race
if (RequiredRaceMask != 0 && !RequiredRaceMask.HasAnyFlag(chr.RaceMask))
{
return InventoryError.YOU_CAN_NEVER_USE_THAT_ITEM2;
}
// faction
if (RequiredFaction != null)
{
if (chr.Faction != RequiredFaction)
{
return InventoryError.YOU_CAN_NEVER_USE_THAT_ITEM2;
}
if (RequiredFactionStanding != StandingLevel.Hated &&
chr.Reputations.GetStandingLevel(RequiredFaction.ReputationIndex) >= RequiredFactionStanding)
{
return InventoryError.ITEM_REPUTATION_NOT_ENOUGH;
}
}
// skill
if (RequiredSkill != null)
{
if (!chr.Skills.CheckSkill(RequiredSkill.Id, (int)RequiredSkillValue))
{
return InventoryError.SKILL_ISNT_HIGH_ENOUGH;
}
}
// ability
if (RequiredProfession != null)
{
if (!chr.Spells.Contains(RequiredProfessionId))
{
return InventoryError.NO_REQUIRED_PROFICIENCY;
}
}
// set
if (Set != null)
{
if (Set.RequiredSkill != null)
{
if (!chr.Skills.CheckSkill(Set.RequiredSkill.Id, (int)Set.RequiredSkillValue))
{
return InventoryError.SKILL_ISNT_HIGH_ENOUGH;
}
}
}
// profession
if (ItemProfession != SkillId.None)
{
if (!chr.Skills.Contains(ItemProfession))
{
return InventoryError.NO_REQUIRED_PROFICIENCY;
}
}
// Disarmed
if (IsWeapon && !chr.MayCarry(InventorySlotMask))
{
return InventoryError.CANT_DO_WHILE_DISARMED;
}
// TODO: Add missing restrictions
// if (template.RequiredLockpickSkill
// if (template.RequiredPvPRank
// if (RequiredArenaRanking
return InventoryError.OK;
}