RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

issues with owltr

rathraven

Traveler
We are using daat99's latest owltr system. We are having a few issues.

When you have tool storage for your master storage it will still pull up runics. Also it pulls up any form of a axe like a bardiche. Problem with this is if a player crafts a bardiche, the storage pulls it in. When you pull the bardiche out it has lost all its bonus crafted props.

Code:
/*
created by:
    /\            888                  888    .d8888b.  .d8888b.
____/_ \____      888                  888    d88P  Y88b d88P  Y88b
\  ___\ \  /      888                  888    888    888 888    888
\/ /  \/ /    .d88888  8888b.  8888b.  888888 Y88b. d888 Y88b. d888
/ /\__/_/\  d88" 888    "88b    "88b 888    "Y888P888  "Y888P888
/__\ \_____\  888  888 .d888888 .d888888 888          888        888
    \  /      Y88b 888 888  888 888  888 Y88b.  Y88b  d88P Y88b  d88P
    \/        "Y88888 "Y888888 "Y888888  "Y888  "Y8888P"  "Y8888P"
*/
using System;
using Server;
using Server.Items;
 
namespace daat99
{
    public class ToolStorage : BaseStorage
    {
        public ToolStorage() : base() { }
        public ToolStorage(GenericReader reader) : base(reader) { }
        public override string Name { get { return "Tool Storage"; } }
        private static Type[] defaultStoredTypes = new Type[] { typeof(IUsesRemaining) };
        public override Type[] DefaultStoredTypes { get { return ToolStorage.defaultStoredTypes; } }
        protected static new BaseStorage singleton;
        public static new BaseStorage Storage { get { if (singleton == null) singleton = new ToolStorage(); return singleton; } }
        public override BaseStorage GetStorage() { return ToolStorage.Storage; }
 
        public override bool IsTypeStorable(Type typeToCheck)
        {
            return isValid(typeToCheck) && base.IsTypeStorable(typeToCheck);
        }
        public override bool IsTypeStorable(Type typeToCheck, bool canBeEqual)
        {
            return isValid(typeToCheck) && base.IsTypeStorable(typeToCheck, canBeEqual);
        }
        //allow only IUsesRemaining items that aren't runic tools
        private bool isValid(Type typeToCheck)
        {
            return typeToCheck != typeof(BaseRunicTool);// && typeToCheck.GetInterface("IUsesRemaining") != null;
        }
    }
    public class ToolStorageDeed : BaseStorageDeed
    {
        [Constructable]
        public ToolStorageDeed() : base(new ToolStorage()) { }
        public ToolStorageDeed(Serial serial) : base(serial) { }
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0);
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }
    }
}

Also we can't seem to get stone mining to work. Have tried both shovel and pickaxe. Stone mining is set to true on my gm, and tool set to ore and stone.

Code:
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
using daat99;
 
namespace Server.Engines.Harvest
{
    public class Mining : HarvestSystem
    {
        private static Mining m_System;
 
        public static Mining System
        {
            get
            {
                if ( m_System == null )
                    m_System = new Mining();
 
                return m_System;
            }
        }
 
        private HarvestDefinition m_OreAndStone, m_Sand;
 
        public HarvestDefinition OreAndStone
        {
            get{ return m_OreAndStone; }
        }
 
        public HarvestDefinition Sand
        {
            get{ return m_Sand; }
        }
 
        private Mining()
        {
            HarvestResource[] res;
            HarvestVein[] veins;
 
            #region Mining for ore and stone
            HarvestDefinition oreAndStone = m_OreAndStone = new HarvestDefinition();
 
            // Resource banks are every 8x8 tiles
            oreAndStone.BankWidth = 8;
            oreAndStone.BankHeight = 8;
 
            // Every bank holds from 10 to 34 ore
            oreAndStone.MinTotal = 10;
            oreAndStone.MaxTotal = 34;
 
            // A resource bank will respawn its content every 10 to 20 minutes
            oreAndStone.MinRespawn = TimeSpan.FromMinutes( 10.0 );
            oreAndStone.MaxRespawn = TimeSpan.FromMinutes( 20.0 );
 
            // Skill checking is done on the Mining skill
            oreAndStone.Skill = SkillName.Mining;
 
            // Set the list of harvestable tiles
            oreAndStone.Tiles = m_MountainAndCaveTiles;
 
            // Players must be within 2 tiles to harvest
            oreAndStone.MaxRange = 2;
 
            // One ore per harvest action
            oreAndStone.ConsumedPerHarvest = 1;
            oreAndStone.ConsumedPerFeluccaHarvest = 2;
 
            // The digging effect
            oreAndStone.EffectActions = new int[]{ 11 };
            oreAndStone.EffectSounds = new int[]{ 0x125, 0x126 };
            oreAndStone.EffectCounts = new int[]{ 1 };
            oreAndStone.EffectDelay = TimeSpan.FromSeconds( 1.6 );
            oreAndStone.EffectSoundDelay = TimeSpan.FromSeconds( 0.9 );
 
            oreAndStone.NoResourcesMessage = 503040; // There is no metal here to mine.
            oreAndStone.DoubleHarvestMessage = 503042; // Someone has gotten to the metal before you.
            oreAndStone.TimedOutOfRangeMessage = 503041; // You have moved too far away to continue mining.
            oreAndStone.OutOfRangeMessage = 500446; // That is too far away.
            oreAndStone.FailMessage = 503043; // You loosen some rocks but fail to find any useable ore.
            oreAndStone.PackFullMessage = 1010481; // Your backpack is full, so the ore you mined is lost.
            oreAndStone.ToolBrokeMessage = 1044038; // You have worn out your tool!
 
            res = new HarvestResource[]
                {
                    //daat99 OWLTR start - custom ores
                    new HarvestResource( 00.0, 00.0, 95.0, "You put some Iron ore in your backpack",            typeof( IronOre ),                typeof( Granite ) ),
                    new HarvestResource( 60.0, 20.0, 100.0, "You put some Dull Copper ore in your backpack",    typeof( DullCopperOre ),        typeof( DullCopperGranite ),    typeof( DullCopperOreElemental ) ),
                    new HarvestResource( 65.0, 25.0, 105.0, "You put some Shadow Iron ore in your backpack",    typeof( ShadowIronOre ),        typeof( ShadowIronGranite ),    typeof( ShadowIronOreElemental ) ),
                    new HarvestResource( 70.0, 30.0, 110.0, "You put some Copper ore in your backpack",            typeof( CopperOre ),            typeof( CopperGranite ),        typeof( CopperOreElemental ) ),
                    new HarvestResource( 75.0, 35.0, 115.0, "You put some Bronze ore in your backpack",            typeof( BronzeOre ),            typeof( BronzeGranite ),        typeof( BronzeOreElemental ) ),
                    new HarvestResource( 80.0, 40.0, 120.0, "You put some Gold ore in your backpack",            typeof( GoldOre ),                typeof( GoldGranite ),            typeof( GoldenOreElemental ) ),
                    new HarvestResource( 85.0, 45.0, 125.0, "You put some Agapite ore in your backpack",        typeof( AgapiteOre ),            typeof( AgapiteGranite ),        typeof( AgapiteOreElemental ) ),
                    new HarvestResource( 90.0, 50.0, 130.0, "You put some Verite ore in your backpack",            typeof( VeriteOre ),            typeof( VeriteGranite ),        typeof( VeriteOreElemental ) ),
                    new HarvestResource( 95.0, 55.0, 135.0, "You put some Valorite ore in your backpack",        typeof( ValoriteOre ),            typeof( ValoriteGranite ),        typeof( ValoriteOreElemental ) ),
                    new HarvestResource( 100.0, 60.0, 140.0, "You put some Blaze ore in your backpack",            typeof( BlazeOre ),                typeof( BlazeGranite ),            typeof( BlazeOreElemental ) ),
                    new HarvestResource( 105.0, 65.0, 145.0, "You put some Ice ore in your backpack",            typeof( IceOre ),                typeof( IceGranite ),            typeof( IceOreElemental ) ),
                    new HarvestResource( 110.0, 70.0, 150.0, "You put some Toxic ore in your backpack",            typeof( ToxicOre ),                typeof( ToxicGranite ),            typeof( ToxicOreElemental ) ),
                    new HarvestResource( 115.0, 75.0, 155.0, "You put some Electrum ore in your backpack",        typeof( ElectrumOre ),            typeof( ElectrumGranite ),        typeof( ElectrumOreElemental ) ),
                    new HarvestResource( 119.0, 79.0, 159.0, "You put some Platinum ore in your backpack",        typeof( PlatinumOre ),            typeof( PlatinumGranite ),        typeof( PlatinumOreElemental ) )
                    //daat99 OWLTR end - custom ores
                };
 
            veins = new HarvestVein[]
                {
                    //daat99 OWLTR start - custom ores
                    new HarvestVein( 48.0, 0.0, res[0], null  ), // Iron
                    new HarvestVein( 07.0, 0.5, res[1], res[0] ), // Dull Copper
                    new HarvestVein( 06.5, 0.5, res[2], res[0] ), // Shadow Iron
                    new HarvestVein( 06.0, 0.5, res[3], res[0] ), // Copper
                    new HarvestVein( 05.5, 0.5, res[4], res[0] ), // Bronze
                    new HarvestVein( 05.0, 0.5, res[5], res[0] ), // Gold
                    new HarvestVein( 04.5, 0.5, res[6], res[0] ), // Agapite
                    new HarvestVein( 04.0, 0.5, res[7], res[0] ), // Verite
                    new HarvestVein( 03.5, 0.5, res[8], res[0] ),  // Valorite
                    new HarvestVein( 03.0, 0.5, res[9], res[0] ), // Blaze
                    new HarvestVein( 02.5, 0.5, res[10], res[0] ), // Ice
                    new HarvestVein( 02.0, 0.5, res[11], res[0] ), // Toxic
                    new HarvestVein( 01.5, 0.5, res[12], res[0] ), // Electrum
                    new HarvestVein( 01.0, 0.5, res[13], res[0] ) // Platinum
                    //daat99 OWLTR end - custom ores
                };
 
            oreAndStone.Resources = res;
            oreAndStone.Veins = veins;
 
            if ( Core.ML )
            {
                oreAndStone.BonusResources = new BonusHarvestResource[]
                {
                    new BonusHarvestResource( 0, 99.4, null, null ),    //Nothing
                    new BonusHarvestResource( 100, .1, 1072562, typeof( BlueDiamond ) ),
                    new BonusHarvestResource( 100, .1, 1072567, typeof( DarkSapphire ) ),
                    new BonusHarvestResource( 100, .1, 1072570, typeof( EcruCitrine ) ),
                    new BonusHarvestResource( 100, .1, 1072564, typeof( FireRuby ) ),
                    new BonusHarvestResource( 100, .1, 1072566, typeof( PerfectEmerald ) ),
                    new BonusHarvestResource( 100, .1, 1072568, typeof( Turquoise ) )
                };
            }
 
            oreAndStone.RaceBonus = Core.ML;
            oreAndStone.RandomizeVeins = Core.ML;
 
            Definitions.Add( oreAndStone );
            #endregion
 
            #region Mining for sand
            HarvestDefinition sand = m_Sand = new HarvestDefinition();
 
            // Resource banks are every 8x8 tiles
            sand.BankWidth = 8;
            sand.BankHeight = 8;
 
            // Every bank holds from 6 to 12 sand
            sand.MinTotal = 6;
            sand.MaxTotal = 12;
 
            // A resource bank will respawn its content every 10 to 20 minutes
            sand.MinRespawn = TimeSpan.FromMinutes( 10.0 );
            sand.MaxRespawn = TimeSpan.FromMinutes( 20.0 );
 
            // Skill checking is done on the Mining skill
            sand.Skill = SkillName.Mining;
 
            // Set the list of harvestable tiles
            sand.Tiles = m_SandTiles;
 
            // Players must be within 2 tiles to harvest
            sand.MaxRange = 2;
 
            // One sand per harvest action
            sand.ConsumedPerHarvest = 1;
            sand.ConsumedPerFeluccaHarvest = 1;
 
            // The digging effect
            sand.EffectActions = new int[]{ 11 };
            sand.EffectSounds = new int[]{ 0x125, 0x126 };
            sand.EffectCounts = new int[]{ 6 };
            sand.EffectDelay = TimeSpan.FromSeconds( 1.6 );
            sand.EffectSoundDelay = TimeSpan.FromSeconds( 0.9 );
 
            sand.NoResourcesMessage = 1044629; // There is no sand here to mine.
            sand.DoubleHarvestMessage = 1044629; // There is no sand here to mine.
            sand.TimedOutOfRangeMessage = 503041; // You have moved too far away to continue mining.
            sand.OutOfRangeMessage = 500446; // That is too far away.
            sand.FailMessage = 1044630; // You dig for a while but fail to find any of sufficient quality for glassblowing.
            sand.PackFullMessage = 1044632; // Your backpack can't hold the sand, and it is lost!
            sand.ToolBrokeMessage = 1044038; // You have worn out your tool!
 
            res = new HarvestResource[]
                {
                    new HarvestResource( 100.0, 70.0, 400.0, 1044631, typeof( Sand ) )
                };
 
            veins = new HarvestVein[]
                {
                    new HarvestVein( 100.0, 0.0, res[0], null )
                };
 
            sand.Resources = res;
            sand.Veins = veins;
 
            Definitions.Add( sand );
            #endregion
        }
 
        public override Type GetResourceType( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, HarvestResource resource )
        {
            if ( def == m_OreAndStone )
            {
                PlayerMobile pm = from as PlayerMobile;
                if ( pm != null && pm.StoneMining && pm.ToggleMiningStone && from.Skills[SkillName.Mining].Base >= 100.0 && 10.0 > Utility.RandomDouble() )
                    return resource.Types[1];
 
                return resource.Types[0];
            }
 
            return base.GetResourceType( from, tool, def, map, loc, resource );
        }
 
        public override bool CheckHarvest( Mobile from, Item tool )
        {
            if ( !base.CheckHarvest( from, tool ) )
                return false;
 
            if ( from.Mounted )
            {
                from.SendLocalizedMessage( 501864 ); // You can't mine while riding.
                return false;
            }
            else if ( from.IsBodyMod && !from.Body.IsHuman )
            {
                from.SendLocalizedMessage( 501865 ); // You can't mine while polymorphed.
                return false;
            }
 
            return true;
        }
 
        public override void SendSuccessTo( Mobile from, Item item, HarvestResource resource )
        {
            if ( item is BaseGranite )
                from.SendLocalizedMessage( 1044606 ); // You carefully extract some workable stone from the ore vein!
            else
                base.SendSuccessTo( from, item, resource );
        }
 
        public override bool CheckHarvest( Mobile from, Item tool, HarvestDefinition def, object toHarvest )
        {
            if ( !base.CheckHarvest( from, tool, def, toHarvest ) )
                return false;
 
            if ( def == m_Sand && !(from is PlayerMobile && from.Skills[SkillName.Mining].Base >= 100.0 && ((PlayerMobile)from).SandMining) )
            {
                OnBadHarvestTarget( from, tool, toHarvest );
                return false;
            }
            else if ( from.Mounted )
            {
                from.SendLocalizedMessage( 501864 ); // You can't mine while riding.
                return false;
            }
            else if ( from.IsBodyMod && !from.Body.IsHuman )
            {
                from.SendLocalizedMessage( 501865 ); // You can't mine while polymorphed.
                return false;
            }
 
            return true;
        }
 
        public override HarvestVein MutateVein( Mobile from, Item tool, HarvestDefinition def, HarvestBank bank, object toHarvest, HarvestVein vein )
        {
            if ( tool is GargoylesPickaxe && def == m_OreAndStone )
            {
                int veinIndex = Array.IndexOf( def.Veins, vein );
 
                if ( veinIndex >= 0 && veinIndex < (def.Veins.Length - 1) )
                    return def.Veins[veinIndex + 1];
            }
 
            return base.MutateVein( from, tool, def, bank, toHarvest, vein );
        }
 
        private static int[] m_Offsets = new int[]
            {
                -1, -1,
                -1,  0,
                -1,  1,
                0, -1,
                0,  1,
                1, -1,
                1,  0,
                1,  1
            };
 
        public override void OnHarvestFinished( Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested, Type type )
        {
            if ( tool is GargoylesPickaxe && def == m_OreAndStone && 0.3 > Utility.RandomDouble() )
            {
                HarvestResource res = vein.PrimaryResource;
                if ( res == resource && res.Types.Length >= 3 )
                {
                    try
                    {
                        Map map = from.Map;
 
                        if ( map == null )
                            return;
                        //daat99 OWLTR start - gargoyle spawn
                        BaseCreature spawned = null;
                        try
                        {
                            int i_Level = CraftResources.GetIndex(CraftResources.GetFromType(type)) + 1;
                            if (i_Level > 1)
                                spawned = new Elementals(i_Level);
                        } catch {}
                        if ( spawned == null )
                        //daat99 OWLTR end - gargoyle spawn
                        spawned = Activator.CreateInstance( res.Types[2], new object[]{ 25 } ) as BaseCreature;;
 
                        if ( spawned != null )
                        {
                            int offset = Utility.Random( 8 ) * 2;
 
                            for ( int i = 0; i < m_Offsets.Length; i += 2 )
                            {
                                int x = from.X + m_Offsets[(offset + i) % m_Offsets.Length];
                                int y = from.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
 
                                if ( map.CanSpawnMobile( x, y, from.Z ) )
                                {
                                    spawned.OnBeforeSpawn( new Point3D( x, y, from.Z ), map );
                                    spawned.MoveToWorld( new Point3D( x, y, from.Z ), map );
                                    spawned.Combatant = from;
                                    return;
                                }
                                else
                                {
                                    int z = map.GetAverageZ( x, y );
 
                                    if ( map.CanSpawnMobile( x, y, z ) )
                                    {
                                        spawned.OnBeforeSpawn( new Point3D( x, y, z ), map );
                                        spawned.MoveToWorld( new Point3D( x, y, z ), map );
                                        spawned.Combatant = from;
                                        return;
                                    }
                                }
                            }
                            spawned.OnBeforeSpawn( from.Location, from.Map );
                            spawned.MoveToWorld( from.Location, from.Map );
                            spawned.Combatant = from;
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
 
        public override bool BeginHarvesting( Mobile from, Item tool )
        {
            if ( !base.BeginHarvesting( from, tool ) )
                return false;
 
            from.SendLocalizedMessage( 503033 ); // Where do you wish to dig?
            return true;
        }
 
        public override void OnHarvestStarted( Mobile from, Item tool, HarvestDefinition def, object toHarvest )
        {
            base.OnHarvestStarted( from, tool, def, toHarvest );
 
            if ( Core.ML )
                from.RevealingAction();
        }
 
        public override void OnBadHarvestTarget( Mobile from, Item tool, object toHarvest )
        {
            if ( toHarvest is LandTarget )
                from.SendLocalizedMessage( 501862 ); // You can't mine there.
            else
                from.SendLocalizedMessage( 501863 ); // You can't mine that.
        }
 
        #region Tile lists
        private static int[] m_MountainAndCaveTiles = new int[]
            {
                220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
                230, 231, 236, 237, 238, 239, 240, 241, 242, 243,
                244, 245, 246, 247, 252, 253, 254, 255, 256, 257,
                258, 259, 260, 261, 262, 263, 268, 269, 270, 271,
                272, 273, 274, 275, 276, 277, 278, 279, 286, 287,
                288, 289, 290, 291, 292, 293, 294, 296, 296, 297,
                321, 322, 323, 324, 467, 468, 469, 470, 471, 472,
                473, 474, 476, 477, 478, 479, 480, 481, 482, 483,
                484, 485, 486, 487, 492, 493, 494, 495, 543, 544,
                545, 546, 547, 548, 549, 550, 551, 552, 553, 554,
                555, 556, 557, 558, 559, 560, 561, 562, 563, 564,
                565, 566, 567, 568, 569, 570, 571, 572, 573, 574,
                575, 576, 577, 578, 579, 581, 582, 583, 584, 585,
                586, 587, 588, 589, 590, 591, 592, 593, 594, 595,
                596, 597, 598, 599, 600, 601, 610, 611, 612, 613,
 
                1010, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749,
                1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1771, 1772,
                1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782,
                1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1801, 1802,
                1803, 1804, 1805, 1806, 1807, 1808, 1809, 1811, 1812, 1813,
                1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823,
                1824, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839,
                1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849,
                1850, 1851, 1852, 1853, 1854, 1861, 1862, 1863, 1864, 1865,
                1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875,
                1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1981,
                1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991,
                1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
                2002, 2003, 2004, 2028, 2029, 2030, 2031, 2032, 2033, 2100,
                2101, 2102, 2103, 2104, 2105,
 
                0x453B, 0x453C, 0x453D, 0x453E, 0x453F, 0x4540, 0x4541,
                0x4542, 0x4543, 0x4544,    0x4545, 0x4546, 0x4547, 0x4548,
                0x4549, 0x454A, 0x454B, 0x454C, 0x454D, 0x454E,    0x454F
            };
 
        private static int[] m_SandTiles = new int[]
            {
                22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
                32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
                42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
                52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
                62, 68, 69, 70, 71, 72, 73, 74, 75,
 
                286, 287, 288, 289, 290, 291, 292, 293, 294, 295,
                296, 297, 298, 299, 300, 301, 402, 424, 425, 426,
                427, 441, 442, 443, 444, 445, 446, 447, 448, 449,
                450, 451, 452, 453, 454, 455, 456, 457, 458, 459,
                460, 461, 462, 463, 464, 465, 642, 643, 644, 645,
                650, 651, 652, 653, 654, 655, 656, 657, 821, 822,
                823, 824, 825, 826, 827, 828, 833, 834, 835, 836,
                845, 846, 847, 848, 849, 850, 851, 852, 857, 858,
                859, 860, 951, 952, 953, 954, 955, 956, 957, 958,
                967, 968, 969, 970,
 
                1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455,
                1456, 1457, 1458, 1611, 1612, 1613, 1614, 1615, 1616,
                1617, 1618, 1623, 1624, 1625, 1626, 1635, 1636, 1637,
                1638, 1639, 1640, 1641, 1642, 1647, 1648, 1649, 1650
            };
        #endregion
    }
}
 

Hammerhand

Knight
For the granite mining, go to the Resource Helper.cs. Add the following code to GetDaat99HarvestedType method in ResourceHelper (before the current return code): Should be line 68.
if (originalType.IsSubclassOf(typeof(BaseGranite)) && info.ResourceTypes.Length > 2)
return info.ResourceTypes[2];
As for the Tool Storage, we'll have to look into that.
 

rathraven

Traveler
Tool storage so far ive fixed polearm weapons like halbard and bardiche. You have to remove the uses from the basepolearm script.

basepolearm.cs
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Engines.Harvest;
using Server.ContextMenus;
 
namespace Server.Items
{
    public abstract class BasePoleArm : BaseMeleeWeapon//, IUsesRemaining
    {
        public override int DefHitSound{ get{ return 0x237; } }
        public override int DefMissSound{ get{ return 0x238; } }
 
        public override SkillName DefSkill{ get{ return SkillName.Swords; } }
        public override WeaponType DefType{ get{ return WeaponType.Polearm; } }
        public override WeaponAnimation DefAnimation{ get{ return WeaponAnimation.Slash2H; } }
 
        public virtual HarvestSystem HarvestSystem{ get{ return Lumberjacking.System; } }
/*
        private int m_UsesRemaining;
        private bool m_ShowUsesRemaining;
 
        [CommandProperty( AccessLevel.GameMaster )]
        public int UsesRemaining
        {
            get { return m_UsesRemaining; }
            set { m_UsesRemaining = value; InvalidateProperties(); }
        }
 
        [CommandProperty( AccessLevel.GameMaster )]
        public bool ShowUsesRemaining
        {
            get { return m_ShowUsesRemaining; }
            set { m_ShowUsesRemaining = value; InvalidateProperties(); }
        }*/
 
        public BasePoleArm( int itemID ) : base( itemID )
        {
            //m_UsesRemaining = 150;
        }
 
        public BasePoleArm( Serial serial ) : base( serial )
        {
        }
 
        public override void OnDoubleClick( Mobile from )
        {
        /*    if ( HarvestSystem == null )
                return;
 
            if ( IsChildOf( from.Backpack ) || Parent == from )
                HarvestSystem.BeginHarvesting( from, this );
            else
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.*/
        }
 
        public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
        {
            base.GetContextMenuEntries( from, list );
 
        /*    if ( HarvestSystem != null )
                BaseHarvestTool.AddContextMenuEntries( from, this, list, HarvestSystem );*/
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 2 ); // version
 
/*            writer.Write( (bool) m_ShowUsesRemaining );
 
            writer.Write( (int) m_UsesRemaining );*/
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
 
            /*switch ( version )
            {
                case 2:
                {
                    m_ShowUsesRemaining = reader.ReadBool();
                    goto case 1;
                }
                case 1:
                {
                    m_UsesRemaining = reader.ReadInt();
                    goto case 0;
                }
                case 0:
                {
                    if ( m_UsesRemaining < 1 )
                        m_UsesRemaining = 150;
 
                    break;
                }
            }*/
        }
 
        public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
        {
            base.OnHit( attacker, defender, damageBonus );
 
            if ( !Core.AOS && (attacker.Player || attacker.Body.IsHuman) && Layer == Layer.TwoHanded && (attacker.Skills[SkillName.Anatomy].Value / 400.0) >= Utility.RandomDouble() && Engines.ConPVP.DuelContext.AllowSpecialAbility( attacker, "Concussion Blow", false ) )
            {
                StatMod mod = defender.GetStatMod( "Concussion" );
 
                if ( mod == null )
                {
                    defender.SendMessage( "You receive a concussion blow!" );
                    defender.AddStatMod( new StatMod( StatType.Int, "Concussion", -(defender.RawInt / 2), TimeSpan.FromSeconds( 30.0 ) ) );
 
                    attacker.SendMessage( "You deliver a concussion blow!" );
                    attacker.PlaySound( 0x11C );
                }
            }
        }
    }
}
This will keep the polearm from being used for lumberjacking also.
The tool storage goes off the iusesremaing to determine if its storable.

If you still want to be able to use polearms for lumberjacking then change the following code...but it will have unlimited uses.

Code:
 public override void OnDoubleClick( Mobile from )
        {
           if ( HarvestSystem == null )
                return;
 
            if ( IsChildOf( from.Backpack ) || Parent == from )
                HarvestSystem.BeginHarvesting( from, this );
            else
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
        }
 

Hammerhand

Knight
But by doing that, you're giving the players unlimited uses when those are used for Lumberjacking. You'd need to comment out the HarvestSystem instance as well.
 

daat99

Moderator
Staff member
The only thing you need to change is the ToolStorage.cs file, nothing else.
Take a look at this:
Code:
        //allow only IUsesRemaining items that aren't runic tools
        private bool isValid(Type typeToCheck)
        {
            return typeToCheck != typeof(BaseRunicTool);// && typeToCheck.GetInterface("IUsesRemaining") != null;
        }

Can you post your runic script inside code tags please?
 

rathraven

Traveler
BaseRunicTool.cs
Code:
using System;
using System.Collections;
 
namespace Server.Items
{
    public abstract class BaseRunicTool : BaseTool
    {
        private CraftResource m_Resource;
 
        [CommandProperty( AccessLevel.GameMaster )]
        public CraftResource Resource
        {
            get{ return m_Resource; }
            set{ m_Resource = value; Hue = CraftResources.GetHue( m_Resource ); InvalidateProperties(); }
        }
 
        public BaseRunicTool( CraftResource resource, int itemID ) : base( itemID )
        {
            m_Resource = resource;
        }
 
        public BaseRunicTool( CraftResource resource, int uses, int itemID ) : base( uses, itemID )
        {
            m_Resource = resource;
        }
 
        public BaseRunicTool( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
            writer.Write( (int) m_Resource );
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
 
            switch ( version )
            {
                case 0:
                {
                    m_Resource = (CraftResource)reader.ReadInt();
                    break;
                }
            }
        }
 
        private static bool m_IsRunicTool;
        private static int m_LuckChance;
 
        private static int Scale( int min, int max, int low, int high )
        {
            int percent;
 
            if ( m_IsRunicTool )
            {
                percent = Utility.RandomMinMax( min, max );
            }
            else
            {
                // Behold, the worst system ever!
                int v = Utility.RandomMinMax( 0, 10000 );
 
                v = (int) Math.Sqrt( v );
                v = 100 - v;
 
                if ( LootPack.CheckLuck( m_LuckChance ) )
                    v += 10;
 
                if ( v < min )
                    v = min;
                else if ( v > max )
                    v = max;
 
                percent = v;
            }
 
            int scaledBy = Math.Abs( high - low ) + 1;
 
            if ( scaledBy != 0 )
                scaledBy = 10000 / scaledBy;
 
            percent *= (10000 + scaledBy);
 
            return low + (((high - low) * percent) / 1000001);
        }
 
        private static void ApplyAttribute( AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high )
        {
            ApplyAttribute( attrs, min, max, attr, low, high, 1 );
        }
 
        private static void ApplyAttribute( AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high, int scale )
        {
            if ( attr == AosAttribute.CastSpeed )
                attrs[attr] += Scale( min, max, low / scale, high / scale ) * scale;
            else
                attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale;
 
            if ( attr == AosAttribute.SpellChanneling )
                attrs[AosAttribute.CastSpeed] -= 1;
        }
 
        private static void ApplyAttribute( AosArmorAttributes attrs, int min, int max, AosArmorAttribute attr, int low, int high )
        {
            attrs[attr] = Scale( min, max, low, high );
        }
 
        private static void ApplyAttribute( AosArmorAttributes attrs, int min, int max, AosArmorAttribute attr, int low, int high, int scale )
        {
            attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale;
        }
 
        private static void ApplyAttribute( AosWeaponAttributes attrs, int min, int max, AosWeaponAttribute attr, int low, int high )
        {
            attrs[attr] = Scale( min, max, low, high );
        }
 
        private static void ApplyAttribute( AosWeaponAttributes attrs, int min, int max, AosWeaponAttribute attr, int low, int high, int scale )
        {
            attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale;
        }
 
        private static void ApplyAttribute( AosElementAttributes attrs, int min, int max, AosElementAttribute attr, int low, int high )
        {
            attrs[attr] = Scale( min, max, low, high );
        }
 
        private static void ApplyAttribute( AosElementAttributes attrs, int min, int max, AosElementAttribute attr, int low, int high, int scale )
        {
            attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale;
        }
 
        private static SkillName[] m_PossibleBonusSkills = new SkillName[]
            {
                SkillName.Swords,
                SkillName.Fencing,
                SkillName.Macing,
                SkillName.Archery,
                SkillName.Wrestling,
                SkillName.Parry,
                SkillName.Tactics,
                SkillName.Anatomy,
                SkillName.Healing,
                SkillName.Magery,
                SkillName.Meditation,
                SkillName.EvalInt,
                SkillName.MagicResist,
                SkillName.AnimalTaming,
                SkillName.AnimalLore,
                SkillName.Veterinary,
                SkillName.Musicianship,
                SkillName.Provocation,
                SkillName.Discordance,
                SkillName.Peacemaking,
                SkillName.Chivalry,
                SkillName.Focus,
                SkillName.Necromancy,
                SkillName.Stealing,
                SkillName.Stealth,
                SkillName.SpiritSpeak,
                SkillName.Bushido,
                SkillName.Ninjitsu
            };
 
        private static SkillName[] m_PossibleSpellbookSkills = new SkillName[]
            {
                SkillName.Magery,
                SkillName.Meditation,
                SkillName.EvalInt,
                SkillName.MagicResist
            };
 
        private static void ApplySkillBonus( AosSkillBonuses attrs, int min, int max, int index, int low, int high )
        {
            SkillName[] possibleSkills = ( attrs.Owner is Spellbook ? m_PossibleSpellbookSkills : m_PossibleBonusSkills );
            int count = ( Core.SE ? possibleSkills.Length : possibleSkills.Length - 2 );
 
            SkillName sk, check;
            double bonus;
            bool found;
 
            do
            {
                found = false;
                sk = possibleSkills[Utility.Random( count )];
 
                for ( int i = 0; !found && i < 5; ++i )
                    found = ( attrs.GetValues( i, out check, out bonus ) && check == sk );
            } while ( found );
 
            attrs.SetValues( index, sk, Scale( min, max, low, high ) );
        }
 
        private static void ApplyResistance( BaseArmor ar, int min, int max, ResistanceType res, int low, int high )
        {
            switch ( res )
            {
                case ResistanceType.Physical: ar.PhysicalBonus += Scale( min, max, low, high ); break;
                case ResistanceType.Fire: ar.FireBonus += Scale( min, max, low, high ); break;
                case ResistanceType.Cold: ar.ColdBonus += Scale( min, max, low, high ); break;
                case ResistanceType.Poison: ar.PoisonBonus += Scale( min, max, low, high ); break;
                case ResistanceType.Energy: ar.EnergyBonus += Scale( min, max, low, high ); break;
            }
        }
 
        private const int MaxProperties = 32;
        private static BitArray m_Props = new BitArray( MaxProperties );
        private static int[] m_Possible = new int[MaxProperties];
 
        public static int GetUniqueRandom( int count )
        {
            int avail = 0;
 
            for ( int i = 0; i < count; ++i )
            {
                if ( !m_Props[i] )
                    m_Possible[avail++] = i;
            }
 
            if ( avail == 0 )
                return -1;
 
            int v = m_Possible[Utility.Random( avail )];
 
            m_Props.Set( v, true );
 
            return v;
        }
 
        public void ApplyAttributesTo( BaseWeapon weapon )
        {
            CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource );
 
            if ( resInfo == null )
                return;
 
            CraftAttributeInfo attrs = resInfo.AttributeInfo;
 
            if ( attrs == null )
                return;
 
            int attributeCount = Utility.RandomMinMax( attrs.RunicMinAttributes, attrs.RunicMaxAttributes );
            int min = attrs.RunicMinIntensity;
            int max = attrs.RunicMaxIntensity;
 
            ApplyAttributesTo( weapon, true, 0, attributeCount, min, max );
        }
 
        public static void ApplyAttributesTo( BaseWeapon weapon, int attributeCount, int min, int max )
        {
            ApplyAttributesTo( weapon, false, 0, attributeCount, min, max );
        }
 
        public static void ApplyAttributesTo( BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, int min, int max )
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance = luckChance;
 
            AosAttributes primary = weapon.Attributes;
            AosWeaponAttributes secondary = weapon.WeaponAttributes;
 
            m_Props.SetAll( false );
 
            if ( weapon is BaseRanged )
                m_Props.Set( 2, true ); // ranged weapons cannot be ubws or mageweapon
 
            for ( int i = 0; i < attributeCount; ++i )
            {
                int random = GetUniqueRandom( 25 );
 
                if ( random == -1 )
                    break;
 
                switch ( random )
                {
                    case 0:
                    {
                        switch ( Utility.Random( 5 ) )
                        {
                            case 0: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitPhysicalArea,2, 50, 2 ); break;
                            case 1: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitFireArea,    2, 50, 2 ); break;
                            case 2: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitColdArea,    2, 50, 2 ); break;
                            case 3: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitPoisonArea,    2, 50, 2 ); break;
                            case 4: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitEnergyArea,    2, 50, 2 ); break;
                        }
 
                        break;
                    }
                    case 1:
                    {
                        switch ( Utility.Random( 4 ) )
                        {
                            case 0: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitMagicArrow,    2, 50, 2 ); break;
                            case 1: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitHarm,        2, 50, 2 ); break;
                            case 2: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitFireball,    2, 50, 2 ); break;
                            case 3: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitLightning,    2, 50, 2 ); break;
                        }
 
                        break;
                    }
                    case 2:
                    {
                        switch ( Utility.Random( 2 ) )
                        {
                            case 0: ApplyAttribute( secondary, min, max, AosWeaponAttribute.UseBestSkill,    1, 1 ); break;
                            case 1: ApplyAttribute( secondary, min, max, AosWeaponAttribute.MageWeapon,        1, 10 ); break;
                        }
 
                        break;
                    }
                    case  3: ApplyAttribute( primary,    min, max, AosAttribute.WeaponDamage,                1, 50 ); break;
                    case  4: ApplyAttribute( primary,    min, max, AosAttribute.DefendChance,                1, 15 ); break;
                    case  5: ApplyAttribute( primary,    min, max, AosAttribute.CastSpeed,                    1, 1 ); break;
                    case  6: ApplyAttribute( primary,    min, max, AosAttribute.AttackChance,                1, 15 ); break;
                    case  7: ApplyAttribute( primary,    min, max, AosAttribute.Luck,                        1, 100 ); break;
                    case  8: ApplyAttribute( primary,    min, max, AosAttribute.WeaponSpeed,                    5, 30, 5 ); break;
                    case  9: ApplyAttribute( primary,    min, max, AosAttribute.SpellChanneling,                1, 1 ); break;
                    case 10: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitDispel,                2, 50, 2 ); break;
                    case 11: ApplyAttribute( secondary,    min, max, AosWeaponAttribute.HitLeechHits,            2, 50, 2 ); break;
                    case 12: ApplyAttribute( secondary,    min, max, AosWeaponAttribute.HitLowerAttack,        2, 50, 2 ); break;
                    case 13: ApplyAttribute( secondary,    min, max, AosWeaponAttribute.HitLowerDefend,        2, 50, 2 ); break;
                    case 14: ApplyAttribute( secondary,    min, max, AosWeaponAttribute.HitLeechMana,            2, 50, 2 ); break;
                    case 15: ApplyAttribute( secondary,    min, max, AosWeaponAttribute.HitLeechStam,            2, 50, 2 ); break;
                    case 16: ApplyAttribute( secondary,    min, max, AosWeaponAttribute.LowerStatReq,            10, 100, 10 ); break;
                    case 17: ApplyAttribute( secondary,    min, max, AosWeaponAttribute.ResistPhysicalBonus,    1, 15 ); break;
                    case 18: ApplyAttribute( secondary,    min, max, AosWeaponAttribute.ResistFireBonus,        1, 15 ); break;
                    case 19: ApplyAttribute( secondary,    min, max, AosWeaponAttribute.ResistColdBonus,        1, 15 ); break;
                    case 20: ApplyAttribute( secondary,    min, max, AosWeaponAttribute.ResistPoisonBonus,        1, 15 ); break;
                    case 21: ApplyAttribute( secondary,    min, max, AosWeaponAttribute.ResistEnergyBonus,        1, 15 ); break;
                    case 22: ApplyAttribute( secondary, min, max, AosWeaponAttribute.DurabilityBonus,        10, 100, 10 ); break;
                    case 23: weapon.Slayer = GetRandomSlayer(); break;
                    case 24: GetElementalDamages( weapon ); break;
                }
            }
        }
 
        public static void GetElementalDamages( BaseWeapon weapon )
        {
            GetElementalDamages( weapon, true );
        }
 
        public static void GetElementalDamages( BaseWeapon weapon, bool randomizeOrder )
        {
            int fire, phys, cold, nrgy, pois, chaos, direct;
 
            weapon.GetDamageTypes( null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct );
 
            int totalDamage = phys;
 
            AosElementAttribute[] attrs = new AosElementAttribute[]
            {
                AosElementAttribute.Cold,
                AosElementAttribute.Energy,
                AosElementAttribute.Fire,
                AosElementAttribute.Poison
            };
 
            if( randomizeOrder )
            {
                for( int i = 0; i < attrs.Length; i++ )
                {
                    int rand = Utility.Random( attrs.Length );
                    AosElementAttribute temp = attrs[i];
 
                    attrs[i] = attrs[rand];
                    attrs[rand] = temp;
                }
            }
 
 
            /*
            totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Cold,        totalDamage );
            totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Energy,    totalDamage );
            totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Fire,        totalDamage );
            totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Poison,    totalDamage );
 
            weapon.AosElementDamages[AosElementAttribute.Physical] = 100 - totalDamage;
            * */
 
            for( int i = 0; i < attrs.Length; i++ )
                totalDamage = AssignElementalDamage( weapon, attrs[i], totalDamage );
 
 
            //Order is Cold, Energy, Fire, Poison -> Physical left
            //Cannot be looped, AoselementAttribute is 'out of order'
 
            weapon.Hue = weapon.GetElementalDamageHue();
        }
 
        private static int AssignElementalDamage( BaseWeapon weapon, AosElementAttribute attr, int totalDamage )
        {
            if( totalDamage <= 0 )
                return 0;
 
            int random = Utility.Random( (int)(totalDamage/10) + 1 ) * 10;
            weapon.AosElementDamages[attr] = random;
 
            return (totalDamage - random);
        }
 
        public static SlayerName GetRandomSlayer()
        {
            // TODO: Check random algorithm on OSI
 
            SlayerGroup[] groups = SlayerGroup.Groups;
 
            if ( groups.Length == 0 )
                return SlayerName.None;
 
            SlayerGroup group = groups[Utility.Random( groups.Length -1 )]; //-1 To Exclude the Fey Slayer which appears ONLY on a certain artifact.
            SlayerEntry entry;
 
            if ( 10 > Utility.Random( 100 ) ) // 10% chance to do super slayer
            {
                entry = group.Super;
            }
            else
            {
                SlayerEntry[] entries = group.Entries;
 
                if ( entries.Length == 0 )
                    return SlayerName.None;
 
                entry = entries[Utility.Random( entries.Length )];
            }
 
            return entry.Name;
        }
 
        public void ApplyAttributesTo( BaseArmor armor )
        {
            CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource );
 
            if ( resInfo == null )
                return;
 
            CraftAttributeInfo attrs = resInfo.AttributeInfo;
 
            if ( attrs == null )
                return;
 
            int attributeCount = Utility.RandomMinMax( attrs.RunicMinAttributes, attrs.RunicMaxAttributes );
            int min = attrs.RunicMinIntensity;
            int max = attrs.RunicMaxIntensity;
 
            ApplyAttributesTo( armor, true, 0, attributeCount, min, max );
        }
 
        public static void ApplyAttributesTo( BaseArmor armor, int attributeCount, int min, int max )
        {
            ApplyAttributesTo( armor, false, 0, attributeCount, min, max );
        }
 
        public static void ApplyAttributesTo( BaseArmor armor, bool isRunicTool, int luckChance, int attributeCount, int min, int max )
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance = luckChance;
 
            AosAttributes primary = armor.Attributes;
            AosArmorAttributes secondary = armor.ArmorAttributes;
 
            m_Props.SetAll( false );
 
            bool isShield = ( armor is BaseShield );
            int baseCount = ( isShield ? 7 : 20 );
            int baseOffset = ( isShield ? 0 : 4 );
 
            if ( !isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All )
                m_Props.Set( 3, true ); // remove mage armor from possible properties
            if ( armor.Resource >= CraftResource.RegularLeather && armor.Resource <= CraftResource.BarbedLeather )
            {
                m_Props.Set( 0, true ); // remove lower requirements from possible properties for leather armor
                m_Props.Set( 2, true ); // remove durability bonus from possible properties
            }
            if ( armor.RequiredRace == Race.Elf )
                m_Props.Set( 7, true ); // elves inherently have night sight and elf only armor doesn't get night sight as a mod
 
            for ( int i = 0; i < attributeCount; ++i )
            {
                int random = GetUniqueRandom( baseCount );
 
                if ( random == -1 )
                    break;
 
                random += baseOffset;
 
                switch ( random )
                {
                        /* Begin Sheilds */
                    case  0: ApplyAttribute( primary,    min, max, AosAttribute.SpellChanneling,            1, 1 ); break;
                    case  1: ApplyAttribute( primary,    min, max, AosAttribute.DefendChance,            1, 15 ); break;
                    case  2:
                        if (Core.ML) {
                            ApplyAttribute( primary,    min, max, AosAttribute.ReflectPhysical,                1, 15 );
                            } else {
                            ApplyAttribute( primary,    min, max, AosAttribute.AttackChance,                    1, 15 );
                            }
                        break;
                    case  3: ApplyAttribute( primary,    min, max, AosAttribute.CastSpeed,                1, 1 ); break;
                        /* Begin Armor */
                    case  4: ApplyAttribute( secondary,    min, max, AosArmorAttribute.LowerStatReq,        10, 100, 10 ); break;
                    case  5: ApplyAttribute( secondary,    min, max, AosArmorAttribute.SelfRepair,            1, 5 ); break;
                    case  6: ApplyAttribute( secondary,    min, max, AosArmorAttribute.DurabilityBonus,    10, 100, 10 ); break;
                        /* End Shields */
                    case  7: ApplyAttribute( secondary,    min, max, AosArmorAttribute.MageArmor,            1, 1 ); break;
                    case  8: ApplyAttribute( primary,    min, max, AosAttribute.RegenHits,                1, 2 ); break;
                    case  9: ApplyAttribute( primary,    min, max, AosAttribute.RegenStam,                1, 3 ); break;
                    case 10: ApplyAttribute( primary,    min, max, AosAttribute.RegenMana,                1, 2 ); break;
                    case 11: ApplyAttribute( primary,    min, max, AosAttribute.NightSight,                1, 1 ); break;
                    case 12: ApplyAttribute( primary,    min, max, AosAttribute.BonusHits,                1, 5 ); break;
                    case 13: ApplyAttribute( primary,    min, max, AosAttribute.BonusStam,                1, 8 ); break;
                    case 14: ApplyAttribute( primary,    min, max, AosAttribute.BonusMana,                1, 8 ); break;
                    case 15: ApplyAttribute( primary,    min, max, AosAttribute.LowerManaCost,            1, 8 ); break;
                    case 16: ApplyAttribute( primary,    min, max, AosAttribute.LowerRegCost,            1, 20 ); break;
                    case 17: ApplyAttribute( primary,    min, max, AosAttribute.Luck,                    1, 100 ); break;
                    case 18: ApplyAttribute( primary,    min, max, AosAttribute.ReflectPhysical,            1, 15 ); break;
                    case 19: ApplyResistance( armor,    min, max, ResistanceType.Physical,                1, 15 ); break;
                    case 20: ApplyResistance( armor,    min, max, ResistanceType.Fire,                    1, 15 ); break;
                    case 21: ApplyResistance( armor,    min, max, ResistanceType.Cold,                    1, 15 ); break;
                    case 22: ApplyResistance( armor,    min, max, ResistanceType.Poison,                1, 15 ); break;
                    case 23: ApplyResistance( armor,    min, max, ResistanceType.Energy,                1, 15 ); break;
                    /* End Armor */
                }
            }
        }
 
        public static void ApplyAttributesTo( BaseHat hat, int attributeCount, int min, int max )
        {
            ApplyAttributesTo( hat, false, 0, attributeCount, min, max );
        }
 
        public static void ApplyAttributesTo( BaseHat hat, bool isRunicTool, int luckChance, int attributeCount, int min, int max )
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance = luckChance;
 
            AosAttributes primary = hat.Attributes;
            AosArmorAttributes secondary = hat.ClothingAttributes;
            AosElementAttributes resists = hat.Resistances;
 
            m_Props.SetAll( false );
 
            for ( int i = 0; i < attributeCount; ++i )
            {
                int random = GetUniqueRandom( 19 );
 
                if ( random == -1 )
                    break;
 
                switch ( random )
                {
                    case  0: ApplyAttribute( primary,    min, max, AosAttribute.ReflectPhysical,            1, 15 ); break;
                    case  1: ApplyAttribute( primary,    min, max, AosAttribute.RegenHits,                1, 2 ); break;
                    case  2: ApplyAttribute( primary,    min, max, AosAttribute.RegenStam,                1, 3 ); break;
                    case  3: ApplyAttribute( primary,    min, max, AosAttribute.RegenMana,                1, 2 ); break;
                    case  4: ApplyAttribute( primary,    min, max, AosAttribute.NightSight,                1, 1 ); break;
                    case  5: ApplyAttribute( primary,    min, max, AosAttribute.BonusHits,                1, 5 ); break;
                    case  6: ApplyAttribute( primary,    min, max, AosAttribute.BonusStam,                1, 8 ); break;
                    case  7: ApplyAttribute( primary,    min, max, AosAttribute.BonusMana,                1, 8 ); break;
                    case  8: ApplyAttribute( primary,    min, max, AosAttribute.LowerManaCost,            1, 8 ); break;
                    case  9: ApplyAttribute( primary,    min, max, AosAttribute.LowerRegCost,            1, 20 ); break;
                    case 10: ApplyAttribute( primary,    min, max, AosAttribute.Luck,                    1, 100 ); break;
                    case 11: ApplyAttribute( secondary,    min, max, AosArmorAttribute.LowerStatReq,        10, 100, 10 ); break;
                    case 12: ApplyAttribute( secondary,    min, max, AosArmorAttribute.SelfRepair,            1, 5 ); break;
                    case 13: ApplyAttribute( secondary,    min, max, AosArmorAttribute.DurabilityBonus,    10, 100, 10 ); break;
                    case 14: ApplyAttribute( resists,    min, max, AosElementAttribute.Physical,            1, 15 ); break;
                    case 15: ApplyAttribute( resists,    min, max, AosElementAttribute.Fire,                1, 15 ); break;
                    case 16: ApplyAttribute( resists,    min, max, AosElementAttribute.Cold,                1, 15 ); break;
                    case 17: ApplyAttribute( resists,    min, max, AosElementAttribute.Poison,            1, 15 ); break;
                    case 18: ApplyAttribute( resists,    min, max, AosElementAttribute.Energy,            1, 15 ); break;
                }
            }
        }
       
        //daat99 OWLTR start - Jewlery resources
        public void ApplyAttributesTo( BaseJewel jewelry )
        {
            CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource );
 
            if ( resInfo == null )
                return;
 
            CraftAttributeInfo attrs = resInfo.AttributeInfo;
 
            if ( attrs == null )
                return;
 
            int attributeCount = Utility.RandomMinMax( attrs.RunicMinAttributes, attrs.RunicMaxAttributes );
            int min = attrs.RunicMinIntensity;
            int max = attrs.RunicMaxIntensity;
 
            ApplyAttributesTo( jewelry, true, 0, attributeCount, min, max );
        }
        //daat99 OWLTR end - Jewlery resources
       
        public static void ApplyAttributesTo( BaseJewel jewelry, int attributeCount, int min, int max )
        {
            ApplyAttributesTo( jewelry, false, 0, attributeCount, min, max );
        }
 
        public static void ApplyAttributesTo( BaseJewel jewelry, bool isRunicTool, int luckChance, int attributeCount, int min, int max )
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance = luckChance;
 
            AosAttributes primary = jewelry.Attributes;
            AosElementAttributes resists = jewelry.Resistances;
            AosSkillBonuses skills = jewelry.SkillBonuses;
 
            m_Props.SetAll( false );
 
            for ( int i = 0; i < attributeCount; ++i )
            {
                int random = GetUniqueRandom( 24 );
 
                if ( random == -1 )
                    break;
 
                switch ( random )
                {
                    case  0: ApplyAttribute( resists,    min, max, AosElementAttribute.Physical,            1, 15 ); break;
                    case  1: ApplyAttribute( resists,    min, max, AosElementAttribute.Fire,                1, 15 ); break;
                    case  2: ApplyAttribute( resists,    min, max, AosElementAttribute.Cold,                1, 15 ); break;
                    case  3: ApplyAttribute( resists,    min, max, AosElementAttribute.Poison,            1, 15 ); break;
                    case  4: ApplyAttribute( resists,    min, max, AosElementAttribute.Energy,            1, 15 ); break;
                    case  5: ApplyAttribute( primary,    min, max, AosAttribute.WeaponDamage,            1, 25 ); break;
                    case  6: ApplyAttribute( primary,    min, max, AosAttribute.DefendChance,            1, 15 ); break;
                    case  7: ApplyAttribute( primary,    min, max, AosAttribute.AttackChance,            1, 15 ); break;
                    case  8: ApplyAttribute( primary,    min, max, AosAttribute.BonusStr,                1, 8 ); break;
                    case  9: ApplyAttribute( primary,    min, max, AosAttribute.BonusDex,                1, 8 ); break;
                    case 10: ApplyAttribute( primary,    min, max, AosAttribute.BonusInt,                1, 8 ); break;
                    case 11: ApplyAttribute( primary,    min, max, AosAttribute.EnhancePotions,            5, 25, 5 ); break;
                    case 12: ApplyAttribute( primary,    min, max, AosAttribute.CastSpeed,                1, 1 ); break;
                    case 13: ApplyAttribute( primary,    min, max, AosAttribute.CastRecovery,            1, 3 ); break;
                    case 14: ApplyAttribute( primary,    min, max, AosAttribute.LowerManaCost,            1, 8 ); break;
                    case 15: ApplyAttribute( primary,    min, max, AosAttribute.LowerRegCost,            1, 20 ); break;
                    case 16: ApplyAttribute( primary,    min, max, AosAttribute.Luck,                    1, 100 ); break;
                    case 17: ApplyAttribute( primary,    min, max, AosAttribute.SpellDamage,                1, 12 ); break;
                    case 18: ApplyAttribute( primary,    min, max, AosAttribute.NightSight,                1, 1 ); break;
                    case 19: ApplySkillBonus( skills,    min, max, 0,                                    1, 15 ); break;
                    case 20: ApplySkillBonus( skills,    min, max, 1,                                    1, 15 ); break;
                    case 21: ApplySkillBonus( skills,    min, max, 2,                                    1, 15 ); break;
                    case 22: ApplySkillBonus( skills,    min, max, 3,                                    1, 15 ); break;
                    case 23: ApplySkillBonus( skills,    min, max, 4,                                    1, 15 ); break;
                }
            }
        }
 
        public static void ApplyAttributesTo( Spellbook spellbook, int attributeCount, int min, int max )
        {
            ApplyAttributesTo( spellbook, false, 0, attributeCount, min, max );
        }
 
        public static void ApplyAttributesTo(Spellbook spellbook, bool isRunicTool, int luckChance, int attributeCount, int min, int max)
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance = luckChance;
 
            AosAttributes primary = spellbook.Attributes;
            AosSkillBonuses skills = spellbook.SkillBonuses;
 
            m_Props.SetAll(false);
 
            for (int i = 0; i < attributeCount; ++i)
            {
                int random = GetUniqueRandom(16);
 
                if (random == -1)
                    break;
 
                switch (random)
                {
                    case 0:
                    case 1:
                    case 2:
                    case 3:
                        {
                            ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8);
 
                            for (int j = 0; j < 4; ++j)
                                m_Props.Set(j, true);
 
                            break;
                        }
                    case 4: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break;
                    case 5: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break;
                    case 6: ApplyAttribute(primary, min, max, AosAttribute.CastRecovery, 1, 3); break;
                    case 7: ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); break;
                    case 8: ApplySkillBonus(skills, min, max, 0, 1, 15); break;
                    case 9: ApplySkillBonus(skills, min, max, 1, 1, 15); break;
                    case 10: ApplySkillBonus(skills, min, max, 2, 1, 15); break;
                    case 11: ApplySkillBonus(skills, min, max, 3, 1, 15); break;
                    case 12: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break;
                    case 13: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break;
                    case 14: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break;
                    case 15: spellbook.Slayer = GetRandomSlayer(); break;
                }
            }
        }
        //daat99 OWTLR start - runic storage
        public virtual Type GetCraftableType()
        {
            return null;
        }
        //daat99 OWTLR end - runic storage
    }
}
 

rathraven

Traveler
Here is RunicTinkerTools.cs
Code:
/*
created by:
    /\            888                  888    .d8888b.  .d8888b. 
____/_ \____      888                  888    d88P  Y88b d88P  Y88b
\  ___\ \  /      888                  888    888    888 888    888
\/ /  \/ /    .d88888  8888b.  8888b.  888888 Y88b. d888 Y88b. d888
/ /\__/_/\  d88" 888    "88b    "88b 888    "Y888P888  "Y888P888
/__\ \_____\  888  888 .d888888 .d888888 888          888        888
    \  /      Y88b 888 888  888 888  888 Y88b.  Y88b  d88P Y88b  d88P
    \/        "Y88888 "Y888888 "Y888888  "Y888  "Y8888P"  "Y8888P" 
*/
using System;
using Server.Engines.Craft;
 
namespace Server.Items
{
    [Flipable( 0x1EB8, 0x1EB9 )]
    public class RunicTinkerTools : BaseRunicTool
    {
        public override CraftSystem CraftSystem{ get{ return DefTinkering.CraftSystem; } }
 
        public override int LabelNumber { get { return 1044164; } }
 
        public override void AddNameProperties( ObjectPropertyList list )
        {
            base.AddNameProperties( list );
 
            if ( !CraftResources.IsStandard( Resource ) )
                list.Add( 1060662, "{0}\t{1}", "Resource"    , CraftResources.GetName( Resource ) );
        }
 
        [Constructable]
        public RunicTinkerTools( CraftResource resource ) : this( resource, 50 )
        {
        }
 
        [Constructable]
        public RunicTinkerTools( CraftResource resource, int uses ) : base( resource, uses, 0x1EB8 )
        {
            Name = "Runic Tinker's Tools";
            Weight = 1.0;
            Hue = CraftResources.GetHue( resource );
        }
 
        public RunicTinkerTools( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
 
            writer.Write( (int) 0 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
 
            int version = reader.ReadInt();
        }
 
        public override Type GetCraftableType()
        {
            switch (Resource)
            {
                case CraftResource.DullCopper:
                    return typeof(DullCopperRunicTinkerTools);
                case CraftResource.ShadowIron:
                    return typeof(ShadowIronRunicTinkerTools);
                case CraftResource.Copper:
                    return typeof(CopperRunicTinkerTools);
                case CraftResource.Bronze:
                    return typeof(BronzeRunicTinkerTools);
                case CraftResource.Gold:
                    return typeof(GoldRunicTinkerTools);
                case CraftResource.Agapite:
                    return typeof(AgapiteRunicTinkerTools);
                case CraftResource.Verite:
                    return typeof(VeriteRunicTinkerTools);
                case CraftResource.Valorite:
                    return typeof(ValoriteRunicTinkerTools);
                case CraftResource.Blaze:
                    return typeof(BlazeRunicTinkerTools);
                case CraftResource.Ice:
                    return typeof(IceRunicTinkerTools);
                case CraftResource.Toxic:
                    return typeof(ToxicRunicTinkerTools);
                case CraftResource.Electrum:
                    return typeof(ElectrumRunicTinkerTools);
                case CraftResource.Platinum:
                    return typeof(PlatinumRunicTinkerTools);
                default:
                    return null;
            }
        }
    }
}
 

daat99

Moderator
Staff member
What happens in the console when you add this line as the first line of the Valid method in the tool storage and add a runic tool to your storage?
Code:
Console.WriteLine("Tool type: {0}, result: {1}", typeToCheck, typeToCheck != typeof(BaseRunicTool));
 

Hammerhand

Knight
I thought we had gotten this one taken care of, but I guess not. Its happening on mine as well with 3.01.00
No runics showing up in runic storage, but showing in tool storage.. Adding the write line code shows this when I click on Inventory with both Tool & Runic storage deeds used. This is with runics in pack & clicking on Fill From Stock.
Tool type: Server.Items.Pickaxe, result: True
Tool type: Server.Items.GargoylesAxe, result: True
Tool type: Server.Items.GargoylesAxe, result: True
Tool type: Server.Items.Pickaxe, result: True

It doesnt change when clicking on Runic storage, but when clicking on Tool storage, you get this.

Tool type: Server.Items.EtherealRunicSewingKit, result: True
Tool type: Server.Items.Pickaxe, result: True
Tool type: Server.Items.GargoylesAxe, result: True
Tool type: Server.Items.BlazeRunicHammer, result: True
Tool type: Server.Items.BloodwoodRunicFletcherTools, result: True
Tool type: Server.Items.AgapiteRunicHammer, result: True

The same thing happens when using Refill while viewing Inventory.
 

daat99

Moderator
Staff member
Can you try this line please?
Code:
Console.WriteLine("Tool type: {0}, result: {1}, runic type: {2}, 2nd check: {3}", typeToCheck, typeToCheck != typeof(BaseRunicTool),typeof(BaseRunicTool), typeToCheck.IsAssignableFrom(typeof(BaseRunicTool)));
 

Hammerhand

Knight
When clicking on Fill From Stock using new coding.

Tool type: Server.Items.Pickaxe, result: True, runic type: Server.Items.BaseRuni
cTool, 2nd check: False
Tool type: Server.Items.GargoylesAxe, result: True, runic type: Server.Items.Bas
eRunicTool, 2nd check: False
Tool type: Server.Items.GargoylesAxe, result: True, runic type: Server.Items.Bas
eRunicTool, 2nd check: False
Tool type: Server.Items.Pickaxe, result: True, runic type: Server.Items.BaseRuni
cTool, 2nd check: False

When clicking on ToolStorage while viewing Inventory.

Tool type: Server.Items.EtherealRunicSewingKit, result: True, runic type: Server
.Items.BaseRunicTool, 2nd check: False
Tool type: Server.Items.Pickaxe, result: True, runic type: Server.Items.BaseRuni
cTool, 2nd check: False
Tool type: Server.Items.GargoylesAxe, result: True, runic type: Server.Items.Bas
eRunicTool, 2nd check: False
Tool type: Server.Items.BlazeRunicHammer, result: True, runic type: Server.Items
.BaseRunicTool, 2nd check: False
Tool type: Server.Items.BloodwoodRunicFletcherTools, result: True, runic type: S
erver.Items.BaseRunicTool, 2nd check: False
Tool type: Server.Items.AgapiteRunicHammer, result: True, runic type: Server.Ite
ms.BaseRunicTool, 2nd check: False

No runics are appearing in runic storage, just tool storage.
 

daat99

Moderator
Staff member
1. When you have both runic storage and tool storage: Do you see the runics in the tool storage page only? yes/no
2. When you have just tool storage without runic storage: Can you add runic tools? yes/no
3. When you have just runic storage without tool storage: Can you see the runics in the runic tools list? yes/no
 

Hammerhand

Knight
1. When you have both runic storage and tool storage: Do you see the runics in the tool storage page only? Yes. They show in Inventory, but when clicking on tool storage, they show there, but not runic storage.
2. When you have just tool storage without runic storage: Can you add runic tools? yes
3. When you have just runic storage without tool storage: Can you see the runics in the runic tools list? No. Only in Inventory. Clicking on Runic Storage blanks it out & runics vanish.
 
Top