当前位置: 首页>>代码示例>>C#>>正文


C# GameLiving.GetAbilityLevel方法代码示例

本文整理汇总了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:
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:AbstractServerRules.cs


注:本文中的GameLiving.GetAbilityLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。