本文整理汇总了C#中GameLiving.GetAbilityLevel方法的典型用法代码示例。如果您正苦于以下问题:C# GameLiving.GetAbilityLevel方法的具体用法?C# GameLiving.GetAbilityLevel怎么用?C# GameLiving.GetAbilityLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameLiving
的用法示例。
在下文中一共展示了GameLiving.GetAbilityLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckAbilityToUseItem
public virtual bool CheckAbilityToUseItem(GameLiving living, ItemTemplate item)
{
if (living == null || item == null)
return false;
GamePlayer player = living as GamePlayer;
// GMs can equip everything
if (player != null && player.Client.Account.PrivLevel > (uint) ePrivLevel.Player)
return true;
// allow usage of all house items
if ((item.Object_Type == 0 || item.Object_Type >= (int)eObjectType._FirstHouse) && item.Object_Type <= (int)eObjectType._LastHouse)
return true;
// on some servers we may wish for dropped items to be used by all realms regardless of what is set in the db
if (!ServerProperties.Properties.ALLOW_CROSS_REALM_ITEMS)
{
if (item.Realm != 0 && item.Realm != (int)living.Realm)
return false;
}
// classes restriction. 0 means every class
if (player != null && !Util.IsEmpty(item.AllowedClasses, true))
{
if (!item.AllowedClasses.SplitCSV(true).Contains(player.CharacterClass.ID.ToString()))
return false;
}
//armor
if (item.Object_Type >= (int)eObjectType._FirstArmor && item.Object_Type <= (int)eObjectType._LastArmor)
{
int armorAbility = -1;
switch ((eRealm)item.Realm)
{
case eRealm.Albion: armorAbility = living.GetAbilityLevel(Abilities.AlbArmor); break;
case eRealm.Hibernia: armorAbility = living.GetAbilityLevel(Abilities.HibArmor); break;
case eRealm.Midgard: armorAbility = living.GetAbilityLevel(Abilities.MidArmor); break;
default: // use old system
armorAbility = Math.Max(armorAbility, living.GetAbilityLevel(Abilities.AlbArmor));
armorAbility = Math.Max(armorAbility, living.GetAbilityLevel(Abilities.HibArmor));
armorAbility = Math.Max(armorAbility, living.GetAbilityLevel(Abilities.MidArmor));
break;
}
switch ((eObjectType)item.Object_Type)
{
case eObjectType.GenericArmor: return armorAbility >= ArmorLevel.GenericArmor;
case eObjectType.Cloth: return armorAbility >= ArmorLevel.Cloth;
case eObjectType.Leather: return armorAbility >= ArmorLevel.Leather;
case eObjectType.Reinforced:
case eObjectType.Studded: return armorAbility >= ArmorLevel.Studded;
case eObjectType.Scale:
case eObjectType.Chain: return armorAbility >= ArmorLevel.Chain;
case eObjectType.Plate: return armorAbility >= ArmorLevel.Plate;
default: return false;
}
}
// non-armors
string abilityCheck = null;
string[] otherCheck = new string[0];
//http://dol.kitchenhost.de/files/dol/Info/itemtable.txt
switch ((eObjectType)item.Object_Type)
{
case eObjectType.GenericItem: return true;
case eObjectType.GenericArmor: return true;
case eObjectType.GenericWeapon: return true;
case eObjectType.Staff: abilityCheck = Abilities.Weapon_Staves; break;
case eObjectType.Fired: abilityCheck = Abilities.Weapon_Shortbows; break;
case eObjectType.FistWraps: abilityCheck = Abilities.Weapon_FistWraps; break;
case eObjectType.MaulerStaff: abilityCheck = Abilities.Weapon_MaulerStaff; break;
//alb
case eObjectType.CrushingWeapon: abilityCheck = Abilities.Weapon_Crushing; break;
case eObjectType.SlashingWeapon: abilityCheck = Abilities.Weapon_Slashing; break;
case eObjectType.ThrustWeapon: abilityCheck = Abilities.Weapon_Thrusting; break;
case eObjectType.TwoHandedWeapon: abilityCheck = Abilities.Weapon_TwoHanded; break;
case eObjectType.PolearmWeapon: abilityCheck = Abilities.Weapon_Polearms; break;
case eObjectType.Longbow:
otherCheck = new string[] { Abilities.Weapon_Longbows, Abilities.Weapon_Archery };
break;
case eObjectType.Crossbow: abilityCheck = Abilities.Weapon_Crossbow; break;
case eObjectType.Flexible: abilityCheck = Abilities.Weapon_Flexible; break;
//TODO: case 5: abilityCheck = Abilities.Weapon_Thrown; break;
//mid
case eObjectType.Sword: abilityCheck = Abilities.Weapon_Swords; break;
case eObjectType.Hammer: abilityCheck = Abilities.Weapon_Hammers; break;
case eObjectType.LeftAxe:
case eObjectType.Axe: abilityCheck = Abilities.Weapon_Axes; break;
case eObjectType.Spear: abilityCheck = Abilities.Weapon_Spears; break;
case eObjectType.CompositeBow:
otherCheck = new string[] { Abilities.Weapon_CompositeBows, Abilities.Weapon_Archery };
break;
case eObjectType.Thrown: abilityCheck = Abilities.Weapon_Thrown; break;
case eObjectType.HandToHand: abilityCheck = Abilities.Weapon_HandToHand; break;
//hib
case eObjectType.RecurvedBow:
//.........这里部分代码省略.........