Fixed AbstractServerRules.cs for Crossrealm Items

Share files with other Dawn of Light users

Moderator: Support Team

Fixed AbstractServerRules.cs for Crossrealm Items

Postby dargon » Wed Dec 04, 2013 4:29 pm

Per deathwishes old fix

Replaced
Code: Select all
  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:
               otherCheck = new string[] { Abilities.Weapon_RecurvedBows, Abilities.Weapon_Archery };
               break;
            case eObjectType.Blades: abilityCheck = Abilities.Weapon_Blades; break;
            case eObjectType.Blunt: abilityCheck = Abilities.Weapon_Blunt; break;
            case eObjectType.Piercing: abilityCheck = Abilities.Weapon_Piercing; break;
            case eObjectType.LargeWeapons: abilityCheck = Abilities.Weapon_LargeWeapons; break;
            case eObjectType.CelticSpear: abilityCheck = Abilities.Weapon_CelticSpear; break;
            case eObjectType.Scythe: abilityCheck = Abilities.Weapon_Scythe; break;

            //misc
            case eObjectType.Magical: return true;
            case eObjectType.Shield: return living.GetAbilityLevel(Abilities.Shield) >= item.Type_Damage;
            case eObjectType.Bolt: abilityCheck = Abilities.Weapon_Crossbow; break;
            case eObjectType.Arrow: otherCheck = new string[] { Abilities.Weapon_CompositeBows, Abilities.Weapon_Longbows, Abilities.Weapon_RecurvedBows, Abilities.Weapon_Shortbows }; break;
            case eObjectType.Poison: return living.GetModifiedSpecLevel(Specs.Envenom) > 0;
            case eObjectType.Instrument: return living.HasAbility(Abilities.Weapon_Instruments);
            //TODO: different shield sizes
         }

         if(abilityCheck != null && living.HasAbility(abilityCheck))
            return true;

         foreach (string str in otherCheck)
            if (living.HasAbility(str))
               return true;

         return false;
      }

      /// <summary>
      /// Get object specialization level based on server type
      /// </summary>
      /// <param name="player">player whom specializations are checked</param>
      /// <param name="objectType">object type</param>
      /// <returns>specialization in object or 0</returns>
      public virtual int GetObjectSpecLevel(GamePlayer player, eObjectType objectType)
      {
         int res = 0;

         foreach (eObjectType obj in GetCompatibleObjectTypes(objectType))
         {
            int spec = player.GetModifiedSpecLevel(SkillBase.ObjectTypeToSpec(obj));
            if (res < spec)
               res = spec;
         }
         return res;
      }

      /// <summary>
      /// Get object specialization level based on server type
      /// </summary>
      /// <param name="player">player whom specializations are checked</param>
      /// <param name="objectType">object type</param>
      /// <returns>specialization in object or 0</returns>
      public virtual int GetBaseObjectSpecLevel(GamePlayer player, eObjectType objectType)
      {
         int res = 0;

         foreach (eObjectType obj in GetCompatibleObjectTypes(objectType))
         {
            int spec = player.GetBaseSpecLevel(SkillBase.ObjectTypeToSpec(obj));
            if (res < spec)
               res = spec;
         }
         return res;
      }

      /// <summary>
      /// Checks whether one object type is equal to another
      /// based on server type
      /// </summary>
      /// <param name="type1"></param>
      /// <param name="type2"></param>
      /// <returns>true if equals</returns>
      public virtual bool IsObjectTypesEqual(eObjectType type1, eObjectType type2)
      {
         foreach (eObjectType obj in GetCompatibleObjectTypes(type1))
         {
            if (obj == type2)
               return true;
         }
         return false;
      }

      #region GetCompatibleObjectTypes

      /// <summary>
      /// Holds arrays of compatible object types
      /// </summary>
      protected Hashtable m_compatibleObjectTypes = null;

      /// <summary>
      /// Translates object type to compatible object types based on server type
      /// </summary>
      /// <param name="objectType">The object type</param>
      /// <returns>An array of compatible object types</returns>
      protected virtual eObjectType[] GetCompatibleObjectTypes(eObjectType objectType)
      {
         if (m_compatibleObjectTypes == null)
         {
            m_compatibleObjectTypes = new Hashtable();
            m_compatibleObjectTypes[(int)eObjectType.Staff] = new eObjectType[] { eObjectType.Staff };
            m_compatibleObjectTypes[(int)eObjectType.Fired] = new eObjectType[] { eObjectType.Fired };

            m_compatibleObjectTypes[(int)eObjectType.FistWraps] = new eObjectType[] { eObjectType.FistWraps };
            m_compatibleObjectTypes[(int)eObjectType.MaulerStaff] = new eObjectType[] { eObjectType.MaulerStaff };

            //alb
            m_compatibleObjectTypes[(int)eObjectType.CrushingWeapon] = new eObjectType[] { eObjectType.CrushingWeapon, eObjectType.Blunt, eObjectType.Hammer };
            m_compatibleObjectTypes[(int)eObjectType.SlashingWeapon] = new eObjectType[] { eObjectType.SlashingWeapon, eObjectType.Blades, eObjectType.Sword, eObjectType.Axe };
            m_compatibleObjectTypes[(int)eObjectType.ThrustWeapon] = new eObjectType[] { eObjectType.ThrustWeapon, eObjectType.Piercing };
            m_compatibleObjectTypes[(int)eObjectType.TwoHandedWeapon] = new eObjectType[] { eObjectType.TwoHandedWeapon, eObjectType.LargeWeapons };
            m_compatibleObjectTypes[(int)eObjectType.PolearmWeapon] = new eObjectType[] { eObjectType.PolearmWeapon, eObjectType.CelticSpear, eObjectType.Spear };
            m_compatibleObjectTypes[(int)eObjectType.Flexible] = new eObjectType[] { eObjectType.Flexible };
            m_compatibleObjectTypes[(int)eObjectType.Longbow] = new eObjectType[] { eObjectType.Longbow };
            m_compatibleObjectTypes[(int)eObjectType.Crossbow] = new eObjectType[] { eObjectType.Crossbow };
            //TODO: case 5: abilityCheck = Abilities.Weapon_Thrown; break;

            //mid
            m_compatibleObjectTypes[(int)eObjectType.Hammer] = new eObjectType[] { eObjectType.Hammer, eObjectType.CrushingWeapon, eObjectType.Blunt };
            m_compatibleObjectTypes[(int)eObjectType.Sword] = new eObjectType[] { eObjectType.Sword, eObjectType.SlashingWeapon, eObjectType.Blades };
            m_compatibleObjectTypes[(int)eObjectType.LeftAxe] = new eObjectType[] { eObjectType.LeftAxe };
            m_compatibleObjectTypes[(int)eObjectType.Axe] = new eObjectType[] { eObjectType.Axe, eObjectType.SlashingWeapon, eObjectType.Blades, eObjectType.LeftAxe };
            m_compatibleObjectTypes[(int)eObjectType.HandToHand] = new eObjectType[] { eObjectType.HandToHand };
            m_compatibleObjectTypes[(int)eObjectType.Spear] = new eObjectType[] { eObjectType.Spear, eObjectType.CelticSpear, eObjectType.PolearmWeapon };
            m_compatibleObjectTypes[(int)eObjectType.CompositeBow] = new eObjectType[] { eObjectType.CompositeBow };
            m_compatibleObjectTypes[(int)eObjectType.Thrown] = new eObjectType[] { eObjectType.Thrown };

            //hib
            m_compatibleObjectTypes[(int)eObjectType.Blunt] = new eObjectType[] { eObjectType.Blunt, eObjectType.CrushingWeapon, eObjectType.Hammer };
            m_compatibleObjectTypes[(int)eObjectType.Blades] = new eObjectType[] { eObjectType.Blades, eObjectType.SlashingWeapon, eObjectType.Sword, eObjectType.Axe };
            m_compatibleObjectTypes[(int)eObjectType.Piercing] = new eObjectType[] { eObjectType.Piercing, eObjectType.ThrustWeapon };
            m_compatibleObjectTypes[(int)eObjectType.LargeWeapons] = new eObjectType[] { eObjectType.LargeWeapons, eObjectType.TwoHandedWeapon };
            m_compatibleObjectTypes[(int)eObjectType.CelticSpear] = new eObjectType[] { eObjectType.CelticSpear, eObjectType.Spear, eObjectType.PolearmWeapon };
            m_compatibleObjectTypes[(int)eObjectType.Scythe] = new eObjectType[] { eObjectType.Scythe };
            m_compatibleObjectTypes[(int)eObjectType.RecurvedBow] = new eObjectType[] { eObjectType.RecurvedBow };

            m_compatibleObjectTypes[(int)eObjectType.Shield] = new eObjectType[] { eObjectType.Shield };
            m_compatibleObjectTypes[(int)eObjectType.Poison] = new eObjectType[] { eObjectType.Poison };
            //TODO: case 45: abilityCheck = Abilities.instruments; break;
         }

         eObjectType[] res = (eObjectType[])m_compatibleObjectTypes[(int)objectType];
         if (res == null)
            return new eObjectType[0];
         return res;
      }

      #endregion


with
Code: Select all
    public virtual bool CheckAbilityToUseItem(GameLiving living, ItemTemplate item)
        {
            if (living == null || item == null)
                return false;

            //armor
            if (item.Object_Type >= (int)eObjectType._FirstArmor && item.Object_Type <= (int)eObjectType._LastArmor)
            {
                int bestLevel = -1;
                bestLevel = Math.Max(bestLevel, living.GetAbilityLevel(Abilities.AlbArmor));
                bestLevel = Math.Max(bestLevel, living.GetAbilityLevel(Abilities.HibArmor));
                bestLevel = Math.Max(bestLevel, living.GetAbilityLevel(Abilities.MidArmor));

                switch ((eObjectType)item.Object_Type)
                {
                    case eObjectType.Cloth: return bestLevel >= 1;
                    case eObjectType.Leather: return bestLevel >= 2;
                    case eObjectType.Reinforced:
                    case eObjectType.Studded: return bestLevel >= 3;
                    case eObjectType.Scale:
                    case eObjectType.Chain: return bestLevel >= 4;
                    case eObjectType.Plate: return bestLevel >= 5;
                    default: return false;
                }
            }

            string[] oneHandCheck = new string[0];
            string[] twoHandCheck = new string[0];
            string[] otherCheck = new string[0];

            //http://dol.kitchenhost.de/files/dol/Info/itemtable.txt
            //http://support.darkageofcamelot.com/cgi-bin/support.cfg/php/enduser/std_adp.php?p_sid=frxnPUjg&p_lva=&p_refno=020709-000000&p_created=1026248996&p_sp=cF9ncmlkc29ydD0mcF9yb3dfY250PTE0JnBfc2VhcmNoX3RleHQ9JnBfc2VhcmNoX3R5cGU9MyZwX2NhdF9sdmwxPTI2JnBfY2F0X2x2bDI9fmFueX4mcF9zb3J0X2J5PWRmbHQmcF9wYWdlPTE*&p_li
            switch ((eObjectType)item.Object_Type)
            {
                case eObjectType.GenericItem: return true;
                case eObjectType.GenericArmor: return true;
                case eObjectType.GenericWeapon: return true;
                case eObjectType.Staff: twoHandCheck = new string[] { Abilities.Weapon_Staves }; break;
                case eObjectType.Fired: otherCheck = new string[] { Abilities.Weapon_Shortbows }; break;

                //generic
                case eObjectType.FistWraps: oneHandCheck = new string[] { Abilities.Weapon_FistWraps }; break;
                case eObjectType.MaulerStaff: twoHandCheck = new string[] { Abilities.Weapon_MaulerStaff }; break;

                //alb
                case eObjectType.CrushingWeapon: oneHandCheck = new string[] { Abilities.Weapon_Crushing, Abilities.Weapon_Blunt, Abilities.Weapon_Hammers }; break;
                case eObjectType.SlashingWeapon: oneHandCheck = new string[] { Abilities.Weapon_Slashing, Abilities.Weapon_Blades, Abilities.Weapon_Swords, Abilities.Weapon_Axes }; break;
                case eObjectType.ThrustWeapon: oneHandCheck = new string[] { Abilities.Weapon_Thrusting, Abilities.Weapon_Piercing }; break;
                case eObjectType.Flexible: oneHandCheck = new string[] { Abilities.Weapon_Flexible }; break;
                case eObjectType.TwoHandedWeapon: twoHandCheck = new string[] { Abilities.Weapon_TwoHanded, Abilities.Weapon_LargeWeapons }; break;
                case eObjectType.PolearmWeapon: twoHandCheck = new string[] { Abilities.Weapon_Polearms, Abilities.Weapon_CelticSpear, Abilities.Weapon_Spears }; break;
                case eObjectType.Longbow: otherCheck = new string[] { Abilities.Weapon_Longbows, Abilities.Weapon_Archery }; break;
                case eObjectType.Crossbow: otherCheck = new string[] { Abilities.Weapon_Crossbow }; break;

                //mid
                case eObjectType.Sword: oneHandCheck = new string[] { Abilities.Weapon_Swords, Abilities.Weapon_Slashing, Abilities.Weapon_Blades }; twoHandCheck = new string[] { Abilities.Weapon_Swords }; break;
                case eObjectType.Hammer: oneHandCheck = new string[] { Abilities.Weapon_Hammers, Abilities.Weapon_Crushing, Abilities.Weapon_Blunt }; twoHandCheck = new string[] { Abilities.Weapon_Hammers }; break;
                case eObjectType.LeftAxe:
                case eObjectType.Axe: oneHandCheck = new string[] { Abilities.Weapon_Axes, Abilities.Weapon_Slashing, Abilities.Weapon_Blades }; twoHandCheck = new string[] { Abilities.Weapon_Axes }; break;
                case eObjectType.HandToHand: oneHandCheck = new string[] { Abilities.Weapon_HandToHand }; break;
                case eObjectType.Spear: twoHandCheck = new string[] { Abilities.Weapon_Spears, Abilities.Weapon_CelticSpear, Abilities.Weapon_Polearms }; break;
                case eObjectType.CompositeBow: otherCheck = new string[] { Abilities.Weapon_CompositeBows, Abilities.Weapon_Archery }; break;
                case eObjectType.Thrown: otherCheck = new string[] { Abilities.Weapon_Thrown }; break;

                //hib
                case eObjectType.Blades: oneHandCheck = new string[] { Abilities.Weapon_Blades, Abilities.Weapon_Slashing, Abilities.Weapon_Swords, Abilities.Weapon_Axes }; break;
                case eObjectType.Blunt: oneHandCheck = new string[] { Abilities.Weapon_Blunt, Abilities.Weapon_Crushing, Abilities.Weapon_Hammers }; break;
                case eObjectType.Piercing: oneHandCheck = new string[] { Abilities.Weapon_Piercing, Abilities.Weapon_Thrusting }; break;
                case eObjectType.LargeWeapons: twoHandCheck = new string[] { Abilities.Weapon_LargeWeapons, Abilities.Weapon_TwoHanded }; break;
                case eObjectType.CelticSpear: twoHandCheck = new string[] { Abilities.Weapon_CelticSpear, Abilities.Weapon_Spears, Abilities.Weapon_Polearms }; break;
                case eObjectType.Scythe: twoHandCheck = new string[] { Abilities.Weapon_Scythe }; break;
                case eObjectType.RecurvedBow: otherCheck = new string[] { Abilities.Weapon_RecurvedBows, Abilities.Weapon_Archery }; break;

                //misc
                case eObjectType.Magical: return true;
                case eObjectType.Shield: return living.GetAbilityLevel(Abilities.Shield) >= item.Type_Damage;
                case eObjectType.Arrow: otherCheck = new string[] { Abilities.Weapon_CompositeBows, Abilities.Weapon_Longbows, Abilities.Weapon_RecurvedBows, Abilities.Weapon_Shortbows, Abilities.Weapon_Archery }; break;
                case eObjectType.Bolt: otherCheck = new string[] { Abilities.Weapon_Crossbow }; break;
                case eObjectType.Poison: return living.GetModifiedSpecLevel(Specs.Envenom) > 0;
                case eObjectType.Instrument: return living.HasAbility(Abilities.Weapon_Instruments);

                //housing
                case eObjectType.GardenObject: return true;
                case eObjectType.HouseWallObject: return true;
                case eObjectType.HouseFloorObject: return true;
                //TODO: different shield sizes
            }

            if (item.Item_Type == Slot.RIGHTHAND || item.Item_Type == Slot.LEFTHAND)
            {
                foreach (string check in oneHandCheck)
                {
                    if (living.HasAbility(check))
                        return true;
                }
            }
            else if (item.Item_Type == Slot.TWOHAND)
            {
                foreach (string check in twoHandCheck)
                {
                    if (living.HasAbility(check))
                        return true;
                }
            }

            foreach (string check in otherCheck)
            {
                if (living.HasAbility(check))
                    return true;
            }

            return false;
        }

        /// <summary>
        /// Get object specialization level based on server type
        /// </summary>
        /// <param name="player">player whom specializations are checked</param>
        /// <param name="objectType">object type</param>
        /// <returns>specialization in object or 0</returns>
        public virtual int GetObjectSpecLevel(GamePlayer player, eObjectType objectType)
        {
            int res = 0;

            foreach (eObjectType obj in GetCompatibleObjectTypes(objectType))
            {
                int spec = player.GetModifiedSpecLevel(SkillBase.ObjectTypeToSpec(obj));
                if (res < spec)
                    res = spec;
            }
            return res;
        }

        /// <summary>
        /// Get object specialization level based on server type
        /// </summary>
        /// <param name="player">player whom specializations are checked</param>
        /// <param name="objectType">object type</param>
        /// <returns>specialization in object or 0</returns>
        public virtual int GetBaseObjectSpecLevel(GamePlayer player, eObjectType objectType)
        {
            int res = 0;

            foreach (eObjectType obj in GetCompatibleObjectTypes(objectType))
            {
                int spec = player.GetBaseSpecLevel(SkillBase.ObjectTypeToSpec(obj));
                if (res < spec)
                    res = spec;
            }
            return res;
        }

        /// <summary>
        /// Checks whether one object type is equal to another
        /// based on server type
        /// </summary>
        /// <param name="type1"></param>
        /// <param name="type2"></param>
        /// <returns>true if equals</returns>
        public virtual bool IsObjectTypesEqual(eObjectType type1, eObjectType type2)
        {
            foreach (eObjectType obj in GetCompatibleObjectTypes(type1))
            {
                if (obj == type2)
                    return true;
            }
            return false;
        }

        #region GetCompatibleObjectTypes

        /// <summary>
        /// Holds arrays of compatible object types
        /// </summary>
        protected Hashtable m_compatibleObjectTypes = null;

        /// <summary>
        /// Translates object type to compatible object types based on server type
        /// </summary>
        /// <param name="objectType">The object type</param>
        /// <returns>An array of compatible object types</returns>
        protected virtual eObjectType[] GetCompatibleObjectTypes(eObjectType objectType)
        {
            if (m_compatibleObjectTypes == null)
            {
                m_compatibleObjectTypes = new Hashtable();
                m_compatibleObjectTypes[(int)eObjectType.Staff] = new eObjectType[] { eObjectType.Staff };
                m_compatibleObjectTypes[(int)eObjectType.Fired] = new eObjectType[] { eObjectType.Fired };

                m_compatibleObjectTypes[(int)eObjectType.FistWraps] = new eObjectType[] { eObjectType.FistWraps };
                m_compatibleObjectTypes[(int)eObjectType.MaulerStaff] = new eObjectType[] { eObjectType.MaulerStaff };

                //alb
                m_compatibleObjectTypes[(int)eObjectType.CrushingWeapon] = new eObjectType[] { eObjectType.CrushingWeapon, eObjectType.Blunt, eObjectType.Hammer };
                m_compatibleObjectTypes[(int)eObjectType.SlashingWeapon] = new eObjectType[] { eObjectType.SlashingWeapon, eObjectType.Blades, eObjectType.Sword, eObjectType.Axe };
                m_compatibleObjectTypes[(int)eObjectType.ThrustWeapon] = new eObjectType[] { eObjectType.ThrustWeapon, eObjectType.Piercing };
                m_compatibleObjectTypes[(int)eObjectType.TwoHandedWeapon] = new eObjectType[] { eObjectType.TwoHandedWeapon, eObjectType.LargeWeapons };
                m_compatibleObjectTypes[(int)eObjectType.PolearmWeapon] = new eObjectType[] { eObjectType.PolearmWeapon, eObjectType.CelticSpear, eObjectType.Spear };
                m_compatibleObjectTypes[(int)eObjectType.Flexible] = new eObjectType[] { eObjectType.Flexible };
                m_compatibleObjectTypes[(int)eObjectType.Longbow] = new eObjectType[] { eObjectType.Longbow };
                m_compatibleObjectTypes[(int)eObjectType.Crossbow] = new eObjectType[] { eObjectType.Crossbow };
                //TODO: case 5: abilityCheck = Abilities.Weapon_Thrown; break;

                //mid
                m_compatibleObjectTypes[(int)eObjectType.Hammer] = new eObjectType[] { eObjectType.Hammer, eObjectType.CrushingWeapon, eObjectType.Blunt };
                m_compatibleObjectTypes[(int)eObjectType.Sword] = new eObjectType[] { eObjectType.Sword, eObjectType.SlashingWeapon, eObjectType.Blades };
                m_compatibleObjectTypes[(int)eObjectType.LeftAxe] = new eObjectType[] { eObjectType.LeftAxe };
                m_compatibleObjectTypes[(int)eObjectType.Axe] = new eObjectType[] { eObjectType.Axe, eObjectType.SlashingWeapon, eObjectType.Blades, eObjectType.LeftAxe };
                m_compatibleObjectTypes[(int)eObjectType.HandToHand] = new eObjectType[] { eObjectType.HandToHand };
                m_compatibleObjectTypes[(int)eObjectType.Spear] = new eObjectType[] { eObjectType.Spear, eObjectType.CelticSpear, eObjectType.PolearmWeapon };
                m_compatibleObjectTypes[(int)eObjectType.CompositeBow] = new eObjectType[] { eObjectType.CompositeBow };
                m_compatibleObjectTypes[(int)eObjectType.Thrown] = new eObjectType[] { eObjectType.Thrown };

                //hib
                m_compatibleObjectTypes[(int)eObjectType.Blunt] = new eObjectType[] { eObjectType.Blunt, eObjectType.CrushingWeapon, eObjectType.Hammer };
                m_compatibleObjectTypes[(int)eObjectType.Blades] = new eObjectType[] { eObjectType.Blades, eObjectType.SlashingWeapon, eObjectType.Sword, eObjectType.Axe };
                m_compatibleObjectTypes[(int)eObjectType.Piercing] = new eObjectType[] { eObjectType.Piercing, eObjectType.ThrustWeapon };
                m_compatibleObjectTypes[(int)eObjectType.LargeWeapons] = new eObjectType[] { eObjectType.LargeWeapons, eObjectType.TwoHandedWeapon };
                m_compatibleObjectTypes[(int)eObjectType.CelticSpear] = new eObjectType[] { eObjectType.CelticSpear, eObjectType.Spear, eObjectType.PolearmWeapon };
                m_compatibleObjectTypes[(int)eObjectType.Scythe] = new eObjectType[] { eObjectType.Scythe };
                m_compatibleObjectTypes[(int)eObjectType.RecurvedBow] = new eObjectType[] { eObjectType.RecurvedBow };

                m_compatibleObjectTypes[(int)eObjectType.Shield] = new eObjectType[] { eObjectType.Shield };
                m_compatibleObjectTypes[(int)eObjectType.Poison] = new eObjectType[] { eObjectType.Poison };
                //TODO: case 45: abilityCheck = Abilities.instruments; break;
            }

            eObjectType[] res = (eObjectType[])m_compatibleObjectTypes[(int)objectType];
            if (res == null)
                return new eObjectType[0];
            return res;
        }

        #endregion



Just replace your abstractserverrules and rebuild. I havnt seen an issue yet
Attachments
AbstractServerRules.cs
(82.53 KiB) Downloaded 180 times
Last edited by dargon on Wed Dec 04, 2013 9:14 pm, edited 1 time in total.
Mannik: Admin of Forsaken Worlds Reborn
dargon
DOL Follower
 
Posts: 425
Joined: Sun Apr 15, 2007 6:55 pm

Re: Fixed AbstractServerRules.cs for Crossrealm Items

Postby Leodagan » Wed Dec 04, 2013 5:05 pm

Hello !

Thanks for providing your code improvements !

Could you make a "Patch" out of it ? If you're using TortoiseSVN right click on the updated file and Select "Create Patch"

This will build a difference file showing only the lines you edited (pretty easier to review and understand what you did !)
User avatar
Leodagan
Developer
 
Posts: 1343
Joined: Tue May 01, 2012 9:30 am
Location: Lyon

Re: Fixed AbstractServerRules.cs for Crossrealm Items

Postby dargon » Wed Dec 04, 2013 6:52 pm

Done :) also here is where i found the fix again Thanks to Deathwish: viewtopic.php?f=6&t=18684&hilit=crossrealm+item&start=15
Attachments
AbstractServerRules.cs.patch
(162.45 KiB) Downloaded 28 times
Mannik: Admin of Forsaken Worlds Reborn
dargon
DOL Follower
 
Posts: 425
Joined: Sun Apr 15, 2007 6:55 pm

Re: Fixed AbstractServerRules.cs for Crossrealm Items

Postby dargon » Wed Dec 04, 2013 6:54 pm

tried to read the patch, didnt understand a damn thing on the color coding or what it was showing lol
Mannik: Admin of Forsaken Worlds Reborn
dargon
DOL Follower
 
Posts: 425
Joined: Sun Apr 15, 2007 6:55 pm

Re: Fixed AbstractServerRules.cs for Crossrealm Items

Postby Tolakram » Wed Dec 04, 2013 7:17 pm

Something is not right with the patch, it replaces huge chunks of code that look the same. Perhaps a tab, space, or line delimiter issue.
- Mark
User avatar
Tolakram
Storm / Storm-D2 Admin
 
Posts: 9183
Joined: Tue Jun 13, 2006 1:49 am
Location: Kentucky, USA

Re: Fixed AbstractServerRules.cs for Crossrealm Items

Postby dargon » Wed Dec 04, 2013 9:06 pm

most likely.. i fatfinger alot. ill make a new version before i go to work
Mannik: Admin of Forsaken Worlds Reborn
dargon
DOL Follower
 
Posts: 425
Joined: Sun Apr 15, 2007 6:55 pm

Re: Fixed AbstractServerRules.cs for Crossrealm Items

Postby dargon » Wed Dec 04, 2013 9:15 pm

Here is a new patch hopfully this one is better

Also swiched the .cs up above
Attachments
AbstractServerRules.cs.patch
(27.27 KiB) Downloaded 47 times
Mannik: Admin of Forsaken Worlds Reborn
dargon
DOL Follower
 
Posts: 425
Joined: Sun Apr 15, 2007 6:55 pm


Return to User Files

Who is online

Users browsing this forum: No registered users and 1 guest