ImaNewb

Member
ServUO Version
Publish Unknown
Ultima Expansion
The Second Age
Hey all,

I have a weird thing happening. Firstly I am running RunUO 2.3. But here's the issue I am having. I have set up custom professions as starting templates. All is fine except when I select the warrior template. He starts naked if a doublet or shirt is generated on him but not if a fancy shirt is generated. I think the conflict is with the leather chest I have equipped as part of the starting equipment. If I don't generate a LeatherChest for him OR generate it as a PackItem instead of EquipItem all the equipment shows and is visible. Additionally this seems to be happening ONLY on the owner or staff account. If I create a regular player account all equipment is visible and works just fine. The equipment is also equipped because if I use [ViewEquip I can see it all. Additionally if I props the items and change their visibility to not visible and back they then appear on the body. (I'm assuming they are refreshing) This does not happen on any other professions that are available that I have seen so far. Mage, Ranger, Animal Tamer etc. Any ideas why this could be happening?

1654274356003.png
 
Last edited:
Any chance you can post the script? This sounds like it could be a few things but having the script to reference helps narrow it down.
 
Any chance you can post the script? This sounds like it could be a few things but having the script to reference helps narrow it down.
I'm assuming you are referring to the CharacterCreation script?

C#:
using System;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.Accounting;

namespace Server.Misc
{
    public class CharacterCreation
    {
        public static void Initialize()
        {
            // Register our event handler
            EventSink.CharacterCreated += new CharacterCreatedEventHandler( EventSink_CharacterCreated );
        }

        private static void AddBackpack( Mobile m )
        {
            Container pack = m.Backpack;

            if ( pack == null )
            {
                pack = new Backpack();
                pack.Movable = false;

                m.AddItem( pack );
            }

            PackItem( new RedBook( "a book", m.Name, 20, true ) );
            PackItem( new Gold( 100 ) ); // Starting gold can be customized here
            PackItem( new Dagger() );
            PackItem( new Candle() );
        }

        private static Item MakeNewbie( Item item )
        {
            return item;
        }
       
        private static void PlaceItemIn( Container parent, int x, int y, Item item )
        {
            parent.AddItem( item );
            item.Location = new Point3D( x, y, 0 );
        }

        //Start Bankbox Fill No Expansion Test Center
        //For Bag Spacing and alighnment inside the bankbox roughly evenly... vertical spacing 3 rows Y axis 146,132,118 horizontal x axis 8 columns per row 18,30,42,54,66,78,90,102
        private static void FillBankbox( Mobile m )
        {
            m.StatCap = 225;
           
            BankBox bank = m.BankBox;
            Container cont;

            Bag bag = new Bag();
           
            // Begin bag of tools
            cont = new Bag();
            cont.ItemID = 0xE76;
            cont.Hue = Utility.RandomList(Utility.RandomMinMax(1, 1058));
            cont.Name = "Bag Of Tools";
           
            PlaceItemIn( cont, 30,  35, new TinkerTools( 1000 ) );
            PlaceItemIn( cont, 90,  35, new DovetailSaw( 1000 ) );
            PlaceItemIn( cont, 30,  68, new Scissors() );
            PlaceItemIn( cont, 45,  68, new MortarPestle( 1000 ) );
            PlaceItemIn( cont, 75,  68, new ScribesPen( 1000 ) );
            PlaceItemIn( cont, 90,  68, new SmithHammer( 1000 ) );
            PlaceItemIn( cont, 30, 118, new TwoHandedAxe() );
            PlaceItemIn( cont, 60, 118, new FletcherTools( 1000 ) );
            PlaceItemIn( cont, 90, 118, new SewingKit( 1000 ) );

            PlaceItemIn( bank, 18, 132, cont );
            // End bag of tools

            // A few dye tubs
            cont = new Bag();
            cont.ItemID = 0xE76;
            cont.Hue = Utility.RandomList(Utility.RandomMinMax(1, 1058));
            cont.Name = "Bag Of Dye Tubs";
           
            PlaceItemIn( cont, 30,  35, new Dyes() );
            PlaceItemIn( cont, 90,  35, new DyeTub() );
            PlaceItemIn( cont, 30,  68, new BlackDyeTub() );
           
            DyeTub darkRedTub = new DyeTub();

            darkRedTub.DyedHue = 0x485;
            darkRedTub.Redyable = false;
            PlaceItemIn( cont, 45, 68, darkRedTub );
           
            PlaceItemIn( bank, 30, 132, cont );
           
            // Beginning Bag of Food
            cont = new Bag();
            cont.ItemID = 0xE76;
            cont.Hue = Utility.RandomList(Utility.RandomMinMax(1, 1058));
            cont.Name = "Bag Of Food";
           
            PlaceItemIn( cont, 30,  35, new Apple( 1000 ) );
            PlaceItemIn( cont, 90,  35, new Pear( 1000 ) );
            PlaceItemIn( cont, 30,  68, new RawRibs( 1000 ) );
            PlaceItemIn( cont, 45,  68, new RawFishSteak( 1000 ) );
            PlaceItemIn( cont, 75,  68, new RawLambLeg( 1000 ) );
            PlaceItemIn( cont, 90,  68, new Carrot( 1000 ) );
            PlaceItemIn( cont, 30, 118, new RawBird( 1000 ) );
            PlaceItemIn( cont, 60, 118, new FrenchBread( 1000 ) );
            PlaceItemIn( cont, 90, 118, new Onion( 1000 ) );
           
            PlaceItemIn( bank, 42, 132, cont );
            //End of Bag of Food
           
            //Begin Bag of Resources
            cont = new Bag();
            cont.ItemID = 0xE76;
            cont.Hue = Utility.RandomList(Utility.RandomMinMax(1, 1058));
            cont.Name = "Bag Of Resources";
           
            // Resources
            PlaceItemIn( cont, 30,  35, new Feather( 1000 ) );
            PlaceItemIn( cont, 90,  35, new BoltOfCloth( 1000 ) );
            PlaceItemIn( cont, 30,  68, new Hides( 1000 ) );
            PlaceItemIn( cont, 45,  68, new Bandage( 1000 ) );
            PlaceItemIn( cont, 75,  68, new Bottle( 1000 ) );
            PlaceItemIn( cont, 90,  68, new Log( 1000 ) );
            PlaceItemIn( cont, 30,  35, new DullCopperIngot( 5000 ) );
            PlaceItemIn( cont, 37,  35, new ShadowIronIngot( 5000 ) );
            PlaceItemIn( cont, 44,  35, new CopperIngot( 5000 ) );
            PlaceItemIn( cont, 51,  35, new BronzeIngot( 5000 ) );
            PlaceItemIn( cont, 58,  35, new GoldIngot( 5000 ) );
            PlaceItemIn( cont, 65,  35, new AgapiteIngot( 5000 ) );
            PlaceItemIn( cont, 72,  35, new VeriteIngot( 5000 ) );
            PlaceItemIn( cont, 79,  35, new ValoriteIngot( 5000 ) );
            PlaceItemIn( cont, 86,  35, new IronIngot( 5000 ) );

            PlaceItemIn( bank, 54, 132, cont );
            //End Bag of Resources
           
            //Begin Bag of Reagents
            cont = new Bag();
            cont.ItemID = 0xE76;
            cont.Hue = Utility.RandomList(Utility.RandomMinMax(1, 1058));
            cont.Name = "Bag Of Reagents";
           
            PlaceItemIn( cont, 30,  35, new BlackPearl( 1000 ) );
            PlaceItemIn( cont, 90,  35, new Bloodmoss( 1000 ) );
            PlaceItemIn( cont, 30,  68, new Garlic( 1000 ) );
            PlaceItemIn( cont, 45,  68, new Ginseng( 1000 ) );
            PlaceItemIn( cont, 75,  68, new MandrakeRoot( 1000 ) );
            PlaceItemIn( cont, 90,  68, new Nightshade( 1000 ) );
            PlaceItemIn( cont, 30, 118, new SulfurousAsh( 1000 ) );
            PlaceItemIn( cont, 60, 118, new SpidersSilk( 1000 ) );
            PlaceItemIn( cont, 65, 48, new Spellbook( ulong.MaxValue ) );
           
            PlaceItemIn( bank, 66, 132, cont );
            //End Bag of Reagents
           
            // Begin bag of treasure maps
            cont = new Bag();
            cont.ItemID = 0xE76;
            cont.Hue = Utility.RandomList(Utility.RandomMinMax(1, 1058));
            cont.Name = "Bag Of Treasure Maps";

            PlaceItemIn( cont, 30, 35, new TreasureMap( 1, Map.Felucca ) );
            PlaceItemIn( cont, 45, 35, new TreasureMap( 2, Map.Felucca ) );
            PlaceItemIn( cont, 60, 35, new TreasureMap( 3, Map.Felucca ) );
            PlaceItemIn( cont, 75, 35, new TreasureMap( 4, Map.Felucca ) );
            PlaceItemIn( cont, 90, 35, new TreasureMap( 5, Map.Felucca ) );
            PlaceItemIn( cont, 105, 35, new TreasureMap( 6, Map.Felucca ) );
                                                             
            PlaceItemIn( cont, 30, 50, new TreasureMap( 1, Map.Felucca ) );
            PlaceItemIn( cont, 45, 50, new TreasureMap( 2, Map.Felucca ) );
            PlaceItemIn( cont, 60, 50, new TreasureMap( 3, Map.Felucca ) );
            PlaceItemIn( cont, 75, 50, new TreasureMap( 4, Map.Felucca ) );
            PlaceItemIn( cont, 90, 50, new TreasureMap( 5, Map.Felucca ) );
            PlaceItemIn( cont, 105, 50, new TreasureMap( 6, Map.Felucca ) );

            PlaceItemIn( cont, 55, 100, new Lockpick( 1000 ) );
            PlaceItemIn(bag, 60, 100, new Pickaxe());

            PlaceItemIn( bank, 78, 132, cont );
            // End bag of treasure maps
           
            // Begin box of money
            cont = new Bag();
            cont.ItemID = 0xE76;
            cont.Hue = Utility.RandomList(Utility.RandomMinMax(1, 1058));
            cont.Name = "Bag Of Gold Coin";
           
            //1 Million Gold
            cont.DropItem( new Gold( 9000 ) );
            cont.DropItem( new Silver( 9000 ) );
            /* cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 65000 ) );
            cont.DropItem( new Gold( 25000 ) ); */
           
            PlaceItemIn( bank, 90, 132, cont );
            // End box of money
           
            // Beginning Recall Runes
            cont = new Bag();
            cont.ItemID = 0xE76;
            cont.Hue = Utility.RandomList(Utility.RandomMinMax(1, 1058));
            cont.Name = "Bag Of Recall Runes";
           
            PlaceItemIn( cont, 30,  35, new RecallRune() );
            PlaceItemIn( cont, 90,  35, new RecallRune() );
            PlaceItemIn( cont, 30,  68, new RecallRune() );
            PlaceItemIn( cont, 45,  68, new RecallRune() );
            PlaceItemIn( cont, 75,  68, new RecallRune() );
       
            PlaceItemIn( bank, 102, 132, cont );
            // End Recall Runes
           
            // Begin bag of archery ammo
            cont = new Bag();
            cont.ItemID = 0xE76;
            cont.Hue = Utility.RandomList(Utility.RandomMinMax(1, 1058));
            cont.Name = "Bag Of Archery Ammo";

            PlaceItemIn( cont, 48, 76, new Arrow( 5000 ) );
            PlaceItemIn( cont, 72, 76, new Bolt( 5000 ) );

            PlaceItemIn( bank, 115, 132, cont );
            // End bag of archery ammo
        }

        private static void AddShirt( Mobile m, int shirtHue )
        {
            int hue = Utility.ClipDyedHue( shirtHue & 0x3FFF );

            switch ( Utility.Random( 3 ) )
            {
                case 0: EquipItem( new Shirt( hue ), true ); break;
                case 1: EquipItem( new FancyShirt( hue ), true ); break;
                case 2: EquipItem( new Doublet( hue ), true ); break;
            }
        }

        private static void AddPants( Mobile m, int pantsHue )
        {
            int hue = Utility.ClipDyedHue( pantsHue & 0x3FFF );

            if ( m.Female )
            {
                switch ( Utility.Random( 2 ) )
                {
                    case 0: EquipItem( new Skirt( hue ), true ); break;
                    case 1: EquipItem( new Kilt( hue ), true ); break;
                }
            }
            else
            {
                switch ( Utility.Random( 2 ) )
                {
                    case 0: EquipItem( new LongPants( hue ), true ); break;
                    case 1: EquipItem( new ShortPants( hue ), true ); break;
                }
            }
        }

        private static void AddShoes( Mobile m )
        {
            EquipItem( new Shoes( Utility.RandomYellowHue() ), true );
        }

        private static Mobile CreateMobile( Account a )
        {
            if ( a.Count >= a.Limit )
                return null;

            for ( int i = 0; i < a.Length; ++i )
            {
                if ( a[i] == null )
                    return a[i] = new PlayerMobile();
            }

            return null;
        }

        private static void EventSink_CharacterCreated( CharacterCreatedEventArgs args )
        {
            if ( !VerifyProfession( args.Profession ) )
                args.Profession = 0;

            NetState state = args.State;

            if ( state == null )
                return;

            Mobile newChar = CreateMobile( args.Account as Account );

            if ( newChar == null )
            {
                Console.WriteLine( "Login: {0}: Character creation failed, account full", state );
                return;
            }

            args.Mobile = newChar;
            m_Mobile = newChar;

            newChar.Player = true;
            newChar.AccessLevel = args.Account.AccessLevel;
            newChar.Female = args.Female;
            //newChar.Body = newChar.Female ? 0x191 : 0x190;

            newChar.Race = Race.DefaultRace;

            //newChar.Hue = Utility.ClipSkinHue( args.Hue & 0x3FFF ) | 0x8000;
            newChar.Hue = newChar.Race.ClipSkinHue( args.Hue & 0x3FFF ) | 0x8000;

            newChar.Hunger = 20;
           
            newChar.FollowersMax = 5;//Followers Allowed
            newChar.Skills.Cap = 7000;//SkillCap
            newChar.StatCap = 225;//Stat Cap
            //Individual Skill Caps
            newChar.Skills[SkillName.Alchemy].Cap = 100;
            newChar.Skills[SkillName.Anatomy].Cap = 100;
            newChar.Skills[SkillName.AnimalLore].Cap = 100;
            newChar.Skills[SkillName.AnimalTaming].Cap = 100;
            newChar.Skills[SkillName.Archery].Cap = 100;
            newChar.Skills[SkillName.ArmsLore].Cap = 100;
            newChar.Skills[SkillName.Begging].Cap = 100;
            newChar.Skills[SkillName.Blacksmith].Cap = 100;
            newChar.Skills[SkillName.Fletching].Cap = 100;
            newChar.Skills[SkillName.Camping].Cap = 100;
            newChar.Skills[SkillName.Carpentry].Cap = 100;
            newChar.Skills[SkillName.Cartography].Cap = 100;
            newChar.Skills[SkillName.Cooking].Cap = 100;
            newChar.Skills[SkillName.DetectHidden].Cap = 100;
            newChar.Skills[SkillName.Discordance].Cap = 100;
            newChar.Skills[SkillName.EvalInt].Cap = 100;
            newChar.Skills[SkillName.Fencing].Cap = 100;
            newChar.Skills[SkillName.Fishing].Cap = 100;
            //newChar.Skills[SkillName.Focus].Cap = 100;
            newChar.Skills[SkillName.Forensics].Cap = 100;
            newChar.Skills[SkillName.Healing].Cap = 100;
            newChar.Skills[SkillName.Herding].Cap = 100;
            newChar.Skills[SkillName.Hiding].Cap = 100;
            newChar.Skills[SkillName.Inscribe].Cap = 100;
            newChar.Skills[SkillName.ItemID].Cap = 100;
            newChar.Skills[SkillName.Lockpicking].Cap = 100;
            newChar.Skills[SkillName.Lumberjacking].Cap = 100;
            newChar.Skills[SkillName.Macing].Cap = 100;
            newChar.Skills[SkillName.Magery].Cap = 100;
            newChar.Skills[SkillName.Meditation].Cap = 100;
            newChar.Skills[SkillName.Mining].Cap = 100;
            newChar.Skills[SkillName.Musicianship].Cap = 100;
            newChar.Skills[SkillName.Parry].Cap = 100;
            newChar.Skills[SkillName.Peacemaking].Cap = 100;
            newChar.Skills[SkillName.Poisoning].Cap = 100;
            newChar.Skills[SkillName.Provocation].Cap = 100;
            newChar.Skills[SkillName.RemoveTrap].Cap = 100;
            newChar.Skills[SkillName.MagicResist].Cap = 100;
            newChar.Skills[SkillName.Snooping].Cap = 100;
            newChar.Skills[SkillName.SpiritSpeak].Cap = 100;
            newChar.Skills[SkillName.Stealing].Cap = 100;
            newChar.Skills[SkillName.Stealth].Cap = 100;
            newChar.Skills[SkillName.Swords].Cap = 100;
            newChar.Skills[SkillName.Tactics].Cap = 100;
            newChar.Skills[SkillName.Tailoring].Cap = 100;
            newChar.Skills[SkillName.TasteID].Cap = 100;
            newChar.Skills[SkillName.Tinkering].Cap = 100;
            newChar.Skills[SkillName.Tracking].Cap = 100;
            newChar.Skills[SkillName.Veterinary].Cap = 100;
            newChar.Skills[SkillName.Wrestling].Cap = 100;

            bool young = false;

            if ( newChar is PlayerMobile )
            {
                PlayerMobile pm = (PlayerMobile) newChar;

                pm.Profession = args.Profession;
            }

            SetName( newChar, args.Name );

            AddBackpack( newChar );

            SetStats( newChar, state, args.Str, args.Dex, args.Int );
            SetSkills( newChar, args.Skills, args.Profession );

            Race race = newChar.Race;

            if( race.ValidateHair( newChar, args.HairID ) )
            {
                newChar.HairItemID = args.HairID;
                newChar.HairHue = race.ClipHairHue( args.HairHue & 0x3FFF );
            }

            if( race.ValidateFacialHair( newChar, args.BeardID ) )
            {
                newChar.FacialHairItemID = args.BeardID;
                newChar.FacialHairHue = race.ClipHairHue( args.BeardHue & 0x3FFF );
            }

            if ( args.Profession <= 3 )
            {
                AddShirt( newChar, args.ShirtHue );
                AddPants( newChar, args.PantsHue );
                AddShoes( newChar );
            }

            if( TestCenter.Enabled )
                FillBankbox( newChar );

            if ( young )
            {
                NewPlayerTicket ticket = new NewPlayerTicket();
                ticket.Owner = newChar;
                newChar.BankBox.DropItem( ticket );
            }

            //CityInfo city = GetStartLocation( args, young );
            //CityInfo city = args.City; // Allows user to choose start city (unless template)
            CityInfo city = new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );

            newChar.MoveToWorld( city.Location, city.Map );

            Console.WriteLine( "Login: {0}: New character being created (account={1})", state, args.Account.Username );
            Console.WriteLine( " - Character: {0} (serial={1})", newChar.Name, newChar.Serial );
            Console.WriteLine( " - Started: {0} {1} in {2}", city.City, city.Location, city.Map.ToString() );

            new WelcomeTimer( newChar ).Start();
        }

        public static bool VerifyProfession( int profession )
        {
            if ( profession < 0 )
                return false;
            //else if ( profession < 7 )
                else if ( profession < 8 )
                return true;
            else
                return false;
        }

        private class BadStartMessage : Timer
        {
            Mobile m_Mobile;
            int m_Message;
            public BadStartMessage( Mobile m, int message ) : base( TimeSpan.FromSeconds ( 3.5 ) )
            {
                m_Mobile = m;
                m_Message = message;
                this.Start();
            }

            protected override void OnTick()
            {
                m_Mobile.SendLocalizedMessage( m_Message );
            }
        }

        private static CityInfo GetStartLocation( CharacterCreatedEventArgs args, bool isYoung )
        {
           
                return new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );
                /* if( args.State != null && args.State.NewHaven )
                //return m_NewHavenInfo;    //We don't get the client Version until AFTER Character creation
                {
                 
                  return args.City;  //TODO: Uncomment when the old quest system is actually phased out
                 
                } */

            bool useHaven = isYoung;

            ClientFlags flags = args.State == null ? ClientFlags.None : args.State.Flags;
            Mobile m = args.Mobile;

            switch ( args.Profession )
            {
                case 0:    //Advanced(Choose Location)
                {
                    //(m as PlayerMobile).Young = ((Account)m.Account).Young = false; //Account will start with player not young and can choose location to start
                    //return args.City;
                    return new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );
                }
                case 1:    //Warrior
                {
                    return new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );
                }
                case 2: //Mage
                {
                    return new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );
                }
                case 3:    //Blacksmith
                {
                    return new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );
                }
                case 4:    //Ranger
                {
                    return new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );
                }
                case 5:    //Animal Tamer
                {
                    return new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );
                }
                case 6:    //Bard
                {
                    return new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );
                }
                case 7:    //Lumberjack
                {
                    return new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );
                }
               
            }

            //return args.City;
            return new CityInfo( "Britain", "Sweet Dreams Inn", 1496, 1628, 10, Map.Felucca );
        }

        private static void FixStats( ref int str, ref int dex, ref int intel, int max )
        {
            int vMax = max - 30;

            int vStr = str - 10;
            int vDex = dex - 10;
            int vInt = intel - 10;

            if ( vStr < 0 )
                vStr = 0;

            if ( vDex < 0 )
                vDex = 0;

            if ( vInt < 0 )
                vInt = 0;

            int total = vStr + vDex + vInt;

            if ( total == 0 || total == vMax )
                return;

            double scalar = vMax / (double)total;

            vStr = (int)(vStr * scalar);
            vDex = (int)(vDex * scalar);
            vInt = (int)(vInt * scalar);

            FixStat( ref vStr, vStr + vDex + vInt - vMax, vMax );
            FixStat( ref vDex, vStr + vDex + vInt - vMax, vMax );
            FixStat( ref vInt, vStr + vDex + vInt - vMax, vMax );

            str = vStr + 10;
            dex = vDex + 10;
            intel = vInt + 10;
        }

        private static void FixStat( ref int stat, int diff, int max )
        {
            stat += diff;

            if ( stat < 0 )
                stat = 0;
            else if ( stat > max )
                stat = max;
        }

        private static void SetStats( Mobile m, NetState state, int str, int dex, int intel )
        {
            int max = state.NewCharacterCreation ? 90 : 80;

            FixStats( ref str, ref dex, ref intel, max );

            if ( str < 10 || str > 60 || dex < 10 || dex > 60 || intel < 10 || intel > 60 || str + dex + intel != max )
            {
                str = 10;
                dex = 10;
                intel = 10;
            }

            m.InitStats( str, dex, intel );
        }

        private static void SetName( Mobile m, string name )
        {
            name = name.Trim();

            if ( !NameVerification.Validate( name, 2, 16, true, false, true, 1, NameVerification.SpaceDashPeriodQuote ) )
                name = "Generic Player";

            m.Name = name;
        }

        private static bool ValidSkills( SkillNameValue[] skills )
        {
            int total = 0;

            for ( int i = 0; i < skills.Length; ++i )
            {
                if ( skills[i].Value < 0 || skills[i].Value > 50 )
                    return false;

                total += skills[i].Value;

                for ( int j = i + 1; j < skills.Length; ++j )
                {
                    if ( skills[j].Value > 0 && skills[j].Name == skills[i].Name )
                        return false;
                }
            }

            return total == 100 || total == 120;
        }

        private static Mobile m_Mobile;

        private static void SetSkills( Mobile m, SkillNameValue[] skills, int prof )
        {
            switch ( prof )
            {
                case 1: // Warrior
                {
                    m.InitStats( 50, 20, 10 );
                   
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.Anatomy, 40 ),
                            new SkillNameValue( SkillName.Healing, 40 ),
                            new SkillNameValue( SkillName.Swords, 50 ),
                            new SkillNameValue( SkillName.Tactics, 40 )
                           
                         
                        };

                    break;
                }
                case 2: // Magician
                {
                    m.InitStats( 35, 10, 35 );
                   
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.EvalInt, 40 ),
                            new SkillNameValue( SkillName.Wrestling, 40),
                            new SkillNameValue( SkillName.Magery, 50 ),
                            new SkillNameValue( SkillName.Meditation, 40 )
                        };

                    break;
                }
                case 3: // Blacksmith
                {
                   
                    m.InitStats( 60, 10, 10 );
                   
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.Mining, 40 ),
                            new SkillNameValue( SkillName.Macing, 40 ),
                            new SkillNameValue( SkillName.Blacksmith, 50 ),
                            new SkillNameValue( SkillName.Tinkering, 40 )
                        };

                    break;
                }
                case 4: // Ranger
                {
                   
                    m.InitStats( 50, 20, 10 );
                   
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.Archery, 40 ),
                            new SkillNameValue( SkillName.Fletching, 40 ),
                            new SkillNameValue( SkillName.Tracking, 50 ),
                            new SkillNameValue( SkillName.Tactics, 40 )
                           
                        };

                    break;
                }
                case 5: //Tamer
                {
                    m.InitStats( 40, 10, 30 );
                   
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.AnimalTaming, 50 ),
                            new SkillNameValue( SkillName.Veterinary, 40 ),
                            new SkillNameValue( SkillName.AnimalLore, 40 ),
                            new SkillNameValue( SkillName.Magery, 40 )
                        };

                    break;
                }
                case 6:    //Bard
                {
                    m.InitStats( 60, 10, 10 );
                   
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.Musicianship, 50 ),
                            new SkillNameValue( SkillName.Magery, 40 ),
                            new SkillNameValue( SkillName.Discordance, 40 ),
                            new SkillNameValue( SkillName.Provocation, 40 )
                    };
                    break;
                }
                case 7:    //Lumberjack
                {
                    m.InitStats( 50, 20, 10 );
                   
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.Lumberjacking, 50 ),
                            new SkillNameValue( SkillName.Carpentry, 40 ),
                            new SkillNameValue( SkillName.Swords, 40 ),
                            new SkillNameValue( SkillName.Tinkering, 40 )
                           
                        };
                       
                    break;
                }
                default:
                {
                    if ( !ValidSkills( skills ) )
                        return;

                    break;
                }
            }

            bool addSkillItems = true;
            //bool elf = m.Race == Race.Elf;

            switch ( prof )
            {
                case 1: // Warrior
                {
                    EquipItem( new PracticeLongsword() );
                    EquipItem( new LeatherChest() );
                    EquipItem( new LeatherArms() );
                    EquipItem( new LeatherGloves() );
                    EquipItem( new LeatherGorget() );
                    EquipItem( new LeatherLegs() );
                    EquipItem( new Boots() );

                    addSkillItems = true;

                    break;
                }
                case 2: // Mage
                {
                    EquipItem( new LeatherChest() );
                    EquipItem( new LeatherGloves() );
                    EquipItem( new Boots() );
                   
                    addSkillItems = true;

                    break;
                }
                case 3: // Blacksmith
                {
                    EquipItem( new ChainChest() );
                    EquipItem( new Boots() );
                   
                    addSkillItems = true;

                    break;
                }
                case 4: // Ranger
                {

                    PackItem( new Arrow( 50 ) );
                    EquipItem( new PracticeBow() );
                    EquipItem( new LeatherChest() );
                    EquipItem( new LeatherArms() );
                    EquipItem( new LeatherGloves() );
                    EquipItem( new LeatherGorget() );
                    EquipItem( new LeatherLegs() );
                    EquipItem( new Boots() );

                    addSkillItems = true;

                    break;
                }
                case 5: // Tamer
                {
                        EquipItem( new Bandage(25) );
                        EquipItem( new LongPants( Utility.RandomRedHue() ) );
                        EquipItem( new LeatherGloves() );
                        EquipItem( new ThighBoots( Utility.RandomYellowHue() ) );
                        EquipItem( new Cloak( Utility.RandomRedHue() ) );

                        addSkillItems = true;

                    break;
                }

                case 6: // Bard
                {
                    EquipItem( new BodySash( Utility.RandomYellowHue() ) );
                    EquipItem( new FancyShirt( Utility.RandomBlueHue() ) );
                    EquipItem( new LongPants( Utility.RandomGreenHue() ) );
                    EquipItem( new Cloak( Utility.RandomRedHue() ) );
                    EquipItem( new Boots( Utility.RandomYellowHue() ) );
                   
                    addSkillItems = true;

                    break;
                }
                case 7: // Lumberjack
                {
                    EquipItem( new LeatherArms() );
                    EquipItem( new LeatherGloves() );
                    EquipItem( new LeatherLegs() );
                    EquipItem( new Boots() );
                   
                    addSkillItems = true;
                   
                    /* PackItem( new Hammer() );
                    PackItem( new TinkerTools() ); */
                   
                    break;
                }
            }

            for ( int i = 0; i < skills.Length; ++i )
            {
                SkillNameValue snv = skills[i];

                if ( snv.Value > 0 && ( snv.Name != SkillName.Stealth || prof == 7 ) && snv.Name != SkillName.RemoveTrap )
                {
                    Skill skill = m.Skills[snv.Name];

                    if ( skill != null )
                    {
                        skill.BaseFixedPoint = snv.Value * 10;

                        if ( addSkillItems )
                            AddSkillItems( snv.Name, m );
                    }
                }
            }
        }

        private static void EquipItem( Item item )
        {
            EquipItem( item, false );
        }

        private static void EquipItem( Item item, bool mustEquip )
        {
            item.LootType = LootType.Newbied;

            if ( m_Mobile != null && m_Mobile.EquipItem( item ) )
                return;

            Container pack = m_Mobile.Backpack;

            if ( !mustEquip && pack != null )
                pack.DropItem( item );
            else
                item.Delete();
        }

        private static void PackItem( Item item )
        {
            item.LootType = LootType.Newbied;

            Container pack = m_Mobile.Backpack;

            if ( pack != null )
                pack.DropItem( item );
            else
                item.Delete();
        }

        private static void PackInstrument()
        {
            switch ( Utility.Random( 6 ) )
            {
                case 0: PackItem( new Drums() ); break;
                case 1: PackItem( new Harp() ); break;
                case 2: PackItem( new LapHarp() ); break;
                case 3: PackItem( new Lute() ); break;
                case 4: PackItem( new Tambourine() ); break;
                case 5: PackItem( new TambourineTassel() ); break;
            }
        }

        private static void PackScroll( int circle )
        {
            switch ( Utility.Random( 8 ) * ( circle + 1 ) )
            {
                case  0: PackItem( new ClumsyScroll() ); break;
                case  1: PackItem( new CreateFoodScroll() ); break;
                case  2: PackItem( new FeeblemindScroll() ); break;
                case  3: PackItem( new HealScroll() ); break;
                case  4: PackItem( new MagicArrowScroll() ); break;
                case  5: PackItem( new NightSightScroll() ); break;
                case  6: PackItem( new ReactiveArmorScroll() ); break;
                case  7: PackItem( new WeakenScroll() ); break;
                case  8: PackItem( new AgilityScroll() ); break;
                case  9: PackItem( new CunningScroll() ); break;
                case 10: PackItem( new CureScroll() ); break;
                case 11: PackItem( new HarmScroll() ); break;
                case 12: PackItem( new MagicTrapScroll() ); break;
                case 13: PackItem( new MagicUnTrapScroll() ); break;
                case 14: PackItem( new ProtectionScroll() ); break;
                case 15: PackItem( new StrengthScroll() ); break;
                case 16: PackItem( new BlessScroll() ); break;
                case 17: PackItem( new FireballScroll() ); break;
                case 18: PackItem( new MagicLockScroll() ); break;
                case 19: PackItem( new PoisonScroll() ); break;
                case 20: PackItem( new TelekinisisScroll() ); break;
                case 21: PackItem( new TeleportScroll() ); break;
                case 22: PackItem( new UnlockScroll() ); break;
                case 23: PackItem( new WallOfStoneScroll() ); break;
            }
        }
       
        private static void PackPot()
        {
            switch ( Utility.Random( 6 ) )
            {
                case 0: PackItem( new AgilityPotion() ); break;
                case 1: PackItem( new LesserCurePotion() ); break;
                case 2: PackItem( new LesserHealPotion() ); break;
                case 3: PackItem( new LesserPoisonPotion() ); break;
                case 4: PackItem( new RefreshPotion() ); break;
                case 5: PackItem( new StrengthPotion() ); break;
            }
        }

        private static Item NecroHue( Item item )
        {
            item.Hue = 0x2C3;

            return item;
        }

        private static void AddSkillItems( SkillName skill, Mobile m )
        {
            //bool elf = m.Race == Race.Elf;

            switch ( skill )
            {
                case SkillName.Alchemy:
                {
                    PackItem( new Bottle( 4 ) );
                    PackItem( new MortarPestle() );
                   
                    switch ( Utility.Random( 8 ) )
                    {
                        case 0: PackItem( new Bloodmoss(4) ); break;
                        case 1: PackItem( new BlackPearl(4) ); break;
                        case 2: PackItem( new MandrakeRoot(4) ); break;
                        case 3: PackItem( new Ginseng(4) ); break;
                        case 4: PackItem( new SpidersSilk(4) ); break;
                        case 5: PackItem( new SulfurousAsh(4) ); break;
                        case 6: PackItem( new Garlic(4) ); break;
                        case 7: PackItem( new Nightshade(4) ); break;
                    }

                    EquipItem( new Robe( Utility.RandomRedHue() ) );

                    break;
                }
                case SkillName.Anatomy:
                {
                    PackItem( new Bandage( 3 ) );

                    EquipItem( new Robe( Utility.RandomYellowHue() ) );

                    break;
                }
                case SkillName.AnimalLore:
                {
                    int hue = Utility.RandomGreenHue();

                    EquipItem( new PracticeShepherdsCrook() );
                    EquipItem( new Robe( hue ) );

                    break;
                }
                case SkillName.AnimalTaming:
                {

                    EquipItem( new PracticeShepherdsCrook() );
                   
                    break;
                }
                case SkillName.Archery:
                {
                    PackItem( new Arrow( 25 ) );

                    EquipItem( new PracticeBow() );
                   
                    break;
                }
                case SkillName.ArmsLore:
                {
                    switch ( Utility.Random( 5 ) )
                    {
                        case 0: EquipItem( new PracticeKryss() ); break;
                        case 1: EquipItem( new PracticeLongsword() ); break;
                        case 2: EquipItem( new PracticeMace() ); break;
                        case 3: EquipItem( new PracticeBow() ); break;
                        case 4: EquipItem( new PracticeShepherdsCrook() ); break;
                    }

                    break;
                }
                case SkillName.Begging:
                {
                    EquipItem( new PracticeGnarledStaff() );

                    break;
                }
                case SkillName.Blacksmith:
                {
                   
                    switch ( Utility.Random( 3 ) )
                    {
                        case 0: PackItem( new Tongs(50) ); break;
                        case 1: PackItem( new SmithHammer(50) ); break;
                        case 2: PackItem( new SledgeHammer(50) ); break;
                    }
                   
                    /* PackItem( new Pickaxe() );
                    PackItem( new Pickaxe() ); */
                    PackItem( new IronIngot( 10 ) );
                    EquipItem( new HalfApron( Utility.RandomYellowHue() ) );
                    break;
                }
                /* case SkillName.Bushido:
                {
                    break;
                } */
                case SkillName.Fletching:
                {
                    PackItem( new Board( 14 ) );
                    PackItem( new Feather( 5 ) );
                    PackItem( new Shaft( 5 ) );
                    PackItem( new FletcherTools() );
                    break;
                }
                case SkillName.Camping:
                {
                    PackItem( new Bedroll() );
                    PackItem( new Kindling( 5 ) );
                    break;
                }
                case SkillName.Carpentry:
                {
                    switch ( Utility.Random( 10 ) )
                    {
                        case 0: PackItem( new Saw() ); break;
                        case 1: PackItem( new Hammer() ); break;
                        case 2: PackItem( new DovetailSaw() ); break;
                        case 3: PackItem( new JointingPlane() ); break;
                        case 4: PackItem( new MouldingPlane() ); break;
                        case 5: PackItem( new SmoothingPlane() ); break;
                        case 6: PackItem( new Scorp() ); break;
                        case 7: PackItem( new DrawKnife() ); break;
                        case 8: PackItem( new Inshave() ); break;
                        case 9: PackItem( new Nails() ); break;
                    }
                   
                    PackItem( new Board( 10 ) );
                    //PackItem( new Saw() );
                    EquipItem( new HalfApron( Utility.RandomYellowHue() ) );
                    break;
                }
                case SkillName.Cartography:
                {
                    PackItem( new BlankMap() );
                    PackItem( new BlankMap() );
                    PackItem( new BlankMap() );
                    PackItem( new BlankMap() );
                    PackItem( new Sextant() );
                    break;
                }
                case SkillName.Cooking:
                {
                    PackItem( new Kindling( 2 ) );
                    PackItem( new RawLambLeg() );
                    PackItem( new RawChickenLeg() );
                    PackItem( new RawFishSteak() );
                    PackItem( new SackFlour() );
                    PackItem( new Pitcher( BeverageType.Water ) );
                    break;
                }
                /* case SkillName.Chivalry:
                {
                    break;
                } */
                case SkillName.DetectHidden:
                {
                    EquipItem( new Cloak( 0x455 ) );
                    break;
                }
                case SkillName.Discordance:
                {
                    PackInstrument();
                    break;
                }
                case SkillName.Fencing:
                {
                    EquipItem( new PracticeSpear() );

                    break;
                }
                case SkillName.Fishing:
                {
                    EquipItem( new FishingPole() );

                    int hue = Utility.RandomYellowHue();

                    EquipItem( new FloppyHat( hue ) );

                    break;
                }
                case SkillName.Healing:
                {
                    PackItem( new Bandage( 50 ) );
                    PackItem( new Scissors() );
                    break;
                }
                case SkillName.Herding:
                {
                    EquipItem( new PracticeShepherdsCrook() );

                    break;
                }
                case SkillName.Hiding:
                {
                    EquipItem( new Cloak( 0x455 ) );
                    break;
                }
                case SkillName.Inscribe:
                {
                    PackItem( new BlankScroll( 2 ) );
                    PackItem( new BlueBook() );
                    break;
                }
                case SkillName.ItemID:
                {
                    EquipItem( new PracticeGnarledStaff() );

                    break;
                }
                case SkillName.Lockpicking:
                {
                    PackItem( new Lockpick( 5 ) );
                    break;
                }
                case SkillName.Lumberjacking:
                {
                    EquipItem( new PracticeHatchet() );
                    break;
                }
                case SkillName.Macing:
                {
                    EquipItem( new PracticeMace() );

                    break;
                }
                case SkillName.Magery:
                {
                    BagOfReagents regs = new BagOfReagents( 30 );

                    foreach ( Item item in regs.Items )
                        item.LootType = LootType.Newbied;

                    PackItem( regs );

                    regs.LootType = LootType.Regular;

                    PackScroll( 0 );
                    PackScroll( 1 );
                    PackScroll( 2 );

                    Spellbook book = new Spellbook( (ulong)0x382A8C38 );

                    EquipItem( book );

                    book.LootType = LootType.Blessed;

                    EquipItem( new WizardsHat( Utility.RandomBlueHue() ) );
                    EquipItem( new Robe( Utility.RandomRedHue() ) );

                    break;
                }
                case SkillName.Mining:
                {
                    PackItem( new PracticePickaxe() );
                    PackItem( new Shovel() );
                    break;
                }
                case SkillName.Musicianship:
                {
                    PackInstrument();
                    break;
                }
                case SkillName.Parry:
                {
                    EquipItem( new WoodenShield() );
                    break;
                }
                case SkillName.Peacemaking:
                {
                    PackInstrument();
                    break;
                }
                case SkillName.Poisoning:
                {
                    PackItem( new LesserPoisonPotion() );
                    PackItem( new LesserPoisonPotion() );
                    break;
                }
                case SkillName.Provocation:
                {
                    PackInstrument();
                    break;
                }
                case SkillName.Snooping:
                {
                    PackItem( new Lockpick( 4 ) );
                    break;
                }
                case SkillName.SpiritSpeak:
                {
                    EquipItem( new Cloak( 0x455 ) );
                    break;
                }
                case SkillName.Stealing:
                {
                    PackItem( new Lockpick( 4 ) );
                    break;
                }
                case SkillName.Swords:
                {
               
                    EquipItem( new PracticeLongsword() );

                    break;
                }
                case SkillName.Tactics:
                {
                    //EquipItem( new PracticeLongsword() );

                    break;
                }
                case SkillName.Tailoring:
                {
                    PackItem( new BoltOfCloth() );
                    PackItem( new SewingKit() );
                    break;
                }
                case SkillName.TasteID:
                {
                    PackPot();
                    PackPot();
                    PackPot();
                   
                    break;
           
                }
                case SkillName.Tinkering:
                {
                    PackItem( new ClockParts() );
                    PackItem( new ClockFrame() );
                    PackItem( new TinkerTools() );
                    EquipItem( new FullApron( Utility.RandomYellowHue() ) );
                    EquipItem( new Shirt( Utility.RandomOrangeHue() ) );
                   
                    break;
           
                }
                case SkillName.Tracking:
                {
                    if ( m_Mobile != null )
                    {
                        Item shoes = m_Mobile.FindItemOnLayer( Layer.Shoes );

                        if ( shoes != null )
                            shoes.Delete();
                    }

                    int hue = Utility.RandomYellowHue();

                    EquipItem( new Boots( hue ) );

                    EquipItem( new PracticeSkinningKnife() );
                    break;
                }
                case SkillName.Veterinary:
                {
                    PackItem( new Bandage( 5 ) );
                    PackItem( new Scissors() );
                    break;
                }
                case SkillName.Wrestling:
                {
                    EquipItem( new LeatherGloves() );

                    break;
                }
            }
        }
    }
}
 
Are you using original UO client or ClassicUO ?
ClassicUO client but client 5.0.9.1 are the mul files I'm using. It's just strange because it works on the other templates even if they are equipped with a leather chest.
 
I did not find any obvious problems in the code. Most likely there are some bugs in the ClassicUO code. You can contact the ClassicUO developers and report a problem. Or just use a hook: updating the state of things after putting on.
 
I did not find any obvious problems in the code. Most likely there are some bugs in the ClassicUO code. You can contact the ClassicUO developers and report a problem. Or just use a hook: updating the state of things after putting on.
OK I'll give that a go. Thank you!
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back