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!

RunUO Support for 7.0.16 patch

_Epila_

Sorceror
For those who do not know and/or want to use the new client 7.0.16, i've made this patch.
Since I use a modifyed core, i can not create a real .patch file, but i've wrote this simple tutorial

At your Server/Network/PacketHandlers.cs
Add this bold line
Rich (BB code):
            Register( 0xE1,  0, false, new OnPacketReceive( ClientType ) );
            Register( 0xEF,  21, false, new OnPacketReceive( LoginServerSeed ) );
            Register( 0xF8, 106, false, new OnPacketReceive(CreateCharacterNew) );

            Register6017( 0x08, 15, true, new OnPacketReceive( DropReq6017 ) );

and this one right after your last Packet method, or wherever you want

Rich (BB code):
public static void CreateCharacterNew(NetState state, PacketReader pvSrc)
        {
            int unk1 = pvSrc.ReadInt32(); //0xedededed
            int unk2 = pvSrc.ReadInt32(); //0xffffffff
            int unk3 = pvSrc.ReadByte();  //0x00
            string name = pvSrc.ReadString(30); //name

            pvSrc.Seek(2, SeekOrigin.Current); //unk0
            int flags = pvSrc.ReadInt32(); //clientflags
            pvSrc.Seek(8, SeekOrigin.Current); //unk1 + logincount
            int prof = pvSrc.ReadByte(); //profession
            pvSrc.Seek(15, SeekOrigin.Current); //unk2

            //bool female = pvSrc.ReadBoolean();

            int genderRace = pvSrc.ReadByte();

            int str = pvSrc.ReadByte();
            int dex = pvSrc.ReadByte();
            int intl = pvSrc.ReadByte();
            int is1 = pvSrc.ReadByte();
            int vs1 = pvSrc.ReadByte();
            int is2 = pvSrc.ReadByte();
            int vs2 = pvSrc.ReadByte();
            int is3 = pvSrc.ReadByte();
            int vs3 = pvSrc.ReadByte();
            int is4 = pvSrc.ReadByte();
            int vs4 = pvSrc.ReadByte();
            int hue = pvSrc.ReadUInt16();
            int hairVal = pvSrc.ReadInt16();
            int hairHue = pvSrc.ReadInt16();
            int hairValf = pvSrc.ReadInt16();
            int hairHuef = pvSrc.ReadInt16();
            pvSrc.ReadByte();
            int cityIndex = pvSrc.ReadByte();
            int charSlot = pvSrc.ReadInt32();
            int clientIP = pvSrc.ReadInt32();
            int shirtHue = pvSrc.ReadInt16();
            int pantsHue = pvSrc.ReadInt16();

            /*
            Pre-7.0.0.0:
            0x00, 0x01 -> Human Male, Human Female
            0x02, 0x03 -> Elf Male, Elf Female

            Post-7.0.0.0:
            0x00, 0x01
            0x02, 0x03 -> Human Male, Human Female
            0x04, 0x05 -> Elf Male, Elf Female
            0x05, 0x06 -> Gargoyle Male, Gargoyle Female
            */

            bool female = ((genderRace % 2) != 0);

            Race race = null;

            if (state.StygianAbyss)
            {
                byte raceID = (byte)(genderRace < 4 ? 0 : ((genderRace / 2) - 1));
                race = Race.Races[raceID];
            }
            else
            {
                race = Race.Races[(byte)(genderRace / 2)];
            }

            if (race == null)
                race = Race.DefaultRace;

            CityInfo[] info = state.CityInfo;
            IAccount a = state.Account;

            if (info == null || a == null || cityIndex < 0 || cityIndex >= info.Length)
            {
                state.Dispose();
            }
            else
            {
                // Check if anyone is using this account
                for (int i = 0; i < a.Length; ++i)
                {
                    Mobile check = a[ i ];

                    if (check != null && check.Map != Map.Internal)
                    {
                        Console.WriteLine("Login: {0}: Account in use", state);
                        state.Send(new PopupMessage(PMMessage.CharInWorld));
                        return;
                    }
                }

                state.Flags = (ClientFlags)flags;

                CharacterCreatedEventArgs args = new CharacterCreatedEventArgs(
                    state, a,
                    name, female, hue,
                    str, dex, intl,
                    info[cityIndex],
                    new SkillNameValue[4]
                    {
                        new SkillNameValue( (SkillName)is1, vs1 ),
                        new SkillNameValue( (SkillName)is2, vs2 ),
                        new SkillNameValue( (SkillName)is3, vs3 ),
                        new SkillNameValue( (SkillName)is4, vs4 ),
                    },
                    shirtHue, pantsHue,
                    hairVal, hairHue,
                    hairValf, hairHuef,
                    prof,
                    race
                    );

                state.Send(new ClientVersionReq());

                state.BlockAllPackets = true;

                EventSink.InvokeCharacterCreated(args);

                Mobile m = args.Mobile;

                if (m != null)
                {
                    state.Mobile = m;
                    m.NetState = state;
                    new LoginTimer(state, m).Start();
                }
                else
                {
                    state.BlockAllPackets = false;
                    state.Dispose();
                }
            }
        }

then at Server/Network/NetState.cs

Rich (BB code):
public ClientVersion Version {
            get {
                return m_Version;
            }
            set {
                m_Version = value;
                if (value >= m_Version70160)
                {
                    _ProtocolChanges = ProtocolChanges.Version70160;
                } else if ( value >= m_Version70130 ) {
                    _ProtocolChanges = ProtocolChanges.Version70130;
                } else if ( value >= m_Version7090 ) {
                    _ProtocolChanges = ProtocolChanges.Version7090;
                } else if ( value >= m_Version7000 ) {
                    _ProtocolChanges = ProtocolChanges.Version7000;
                } else if ( value >= m_Version60142 ) {

then
Rich (BB code):
        private static ClientVersion m_Version7090    = new ClientVersion( "7.0.9.0" );
        private static ClientVersion m_Version70130    = new ClientVersion( "7.0.13.0" );
        private static ClientVersion m_Version70160      = new ClientVersion( "7.0.16.0" );

Rich (BB code):
            StygianAbyss            = 0x00000080,
            HighSeas                = 0x00000100,
            SelectableStartingCity  = 0x00000200,
            NewCharacterCreation    = 0x00000400,

Rich (BB code):
            Version7090            = Version7000  | HighSeas,
            Version70130        = Version7090  | SelectableStartingCity,
            Version70160        = Version70130 | NewCharacterCreation

Rich (BB code):
        public bool HighSeas { get { return ((_ProtocolChanges & ProtocolChanges.HighSeas) != 0); } }
        public bool SelectableStartingCity { get { return ((_ProtocolChanges & ProtocolChanges.SelectableStartingCity) != 0); } }
        public bool NewCharacterCreation { get { return ((_ProtocolChanges & ProtocolChanges.NewCharacterCreation) != 0); } }

Scripts/Misc/CharacterCreation.cs
In this file, you will have to mod default methods

Rich (BB code):
private static void SetStats( Mobile m, int str, int dex, int intel , bool newclient )
        {
            int maxstat = newclient ? 60 : 50;
            int maxstats = newclient ? 90 : 80;

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

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

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

Rich (BB code):
private static void FixStats( ref int str, ref int dex, ref int intel , int maxstat )
        {
            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 == maxstat)
                return;

            double scalar = maxstat / (double)total;

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

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

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

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

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

Rich (BB code):
SetName( newChar, args.Name );

            AddBackpack( newChar );

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

            Race race = newChar.Race;

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

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

                total += skills.Value;

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

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

Obsidian Fire

Sorceror
I can't seem to figuar this error out...

Code:
Could Not Find D:\Servers\SVN 684\Server.exe
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.3053
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

Server\Network\PacketHandlers.cs(785,36): error CS0266: Cannot implicitly
        convert type 'Server.Accounting.IAccount' to 'Server.Mobile'. An
        explicit conversion exists (are you missing a cast?)
Press any key to continue . . .

the line in the script is...

Code:
Mobile check = a;

I also saw this, it just doesn't look right to me for some reason..

Code:
            int str = pvSrc.ReadByte();
            int dex = pvSrc.ReadByte();
            int intl = pvSrc.ReadByte();
            int is1 = pvSrc.ReadByte();
            int vs1 = pvSrc.ReadByte();
            int is2 = pvSrc.ReadByte();
            int vs2 = pvSrc.ReadByte();
            int is3 = pvSrc.ReadByte();
            int vs3 = pvSrc.ReadByte();
            int is4 = pvSrc.ReadByte();
            int vs4 = pvSrc.ReadByte();
            int hue = pvSrc.ReadUInt16();
            int hairVal = pvSrc.ReadInt16();
            int hairHue = pvSrc.ReadInt16();
            int hairValf = pvSrc.ReadInt16();
            int hairHuef = pvSrc.ReadInt16();

                                    [COLOR=#ff0000] pvSrc.ReadByte();[/COLOR]

            int cityIndex = pvSrc.ReadByte();
            int charSlot = pvSrc.ReadInt32();
            int clientIP = pvSrc.ReadInt32();
            int shirtHue = pvSrc.ReadInt16();
            int pantsHue = pvSrc.ReadInt16();
this entery doesn't seem to have a "int" value, Mind you Im not a very good coder.
Thanks guys.
 

_Epila_

Sorceror
The first error is an array sintax that is messing with the forum sintax, its just an "[ i ]" without spaces.
Code:
Mobile check = a[ i ];

the second, this is because the client send a useless value, but you have to read it, even its useless
 

KHzspeed

Sorceror
I apologize if i'm breaking any rules asking this, but how stable is 7.0.16 with RunUO 2.1?
any known bugs, or Unreadable Cliloc data?

I'm considering the upgrade, long as its not setting me back any.
 

_Epila_

Sorceror
The client is stable, but as you said, may have invalid clilocs since 7.0.16 version had some cliloc changes
 

Iraq-

Sorceror
I believe I followed this guide correctly, but I'm receiving this error:
Code:
Errors:
+ Misc/CharacterCreation.cs:
    CS0117: Line 676: 'Server.Network.NetState' does not contain a definition for 'NewCharacterCreation'

Here is my NetState file:
Code:
/***************************************************************************
*                                NetState.cs
*                            -------------------
*  begin                : May 1, 2002
*  copyright            : (C) The RunUO Software Team
*  email                : [email protected]
*
*  $Id: NetState.cs 521 2010-06-17 07:11:43Z mark $
*
***************************************************************************/

/***************************************************************************
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
***************************************************************************/

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Server;
using Server.Accounting;
using Server.Network;
using Server.Items;
using Server.Gumps;
using Server.Menus;
using Server.HuePickers;
using Server.Diagnostics;

namespace Server.Network {
    public interface IPacketEncoder {
        void EncodeOutgoingPacket( NetState to, ref byte[] buffer, ref int length );
        void DecodeIncomingPacket( NetState from, ref byte[] buffer, ref int length );
    }

    public delegate void NetStateCreatedCallback( NetState ns );

    public class NetState {
        private Socket m_Socket;
        private IPAddress m_Address;
        private ByteQueue m_Buffer;
        private byte[] m_RecvBuffer;
        private SendQueue m_SendQueue;
        private bool m_Seeded;
        private bool m_Running;
        private AsyncCallback m_OnReceive, m_OnSend;
        private MessagePump m_MessagePump;
        private ServerInfo[] m_ServerInfo;
        private IAccount m_Account;
        private Mobile m_Mobile;
        private CityInfo[] m_CityInfo;
        private List<Gump> m_Gumps;
        private List<HuePicker> m_HuePickers;
        private List<IMenu> m_Menus;
        private List<SecureTrade> m_Trades;
        private int m_Sequence;
        private bool m_CompressionEnabled;
        private string m_ToString;
        private ClientVersion m_Version;
        private bool m_SentFirstPacket;
        private bool m_BlockAllPackets;

        private DateTime m_ConnectedOn;

        public DateTime ConnectedOn {
            get {
                return m_ConnectedOn;
            }
        }

        public TimeSpan ConnectedFor {
            get {
                return ( DateTime.Now - m_ConnectedOn );
            }
        }

        internal int m_Seed;
        internal int m_AuthID;

        public IPAddress Address {
            get {
                return m_Address;
            }
        }

        private ClientFlags m_Flags;

        private static bool m_Paused;

        [Flags]
        private enum AsyncState {
            Pending = 0x01,
            Paused = 0x02
        }

        private AsyncState m_AsyncState;
        private object m_AsyncLock = new object();

        public static void Pause() {
            m_Paused = true;

            for ( int i = 0; i < m_Instances.Count; ++i ) {
                NetState ns = m_Instances[i];

                lock ( ns.m_AsyncLock ) {
                    ns.m_AsyncState |= AsyncState.Paused;
                }
            }
        }

        private void InternalBeginReceive() {
            m_AsyncState |= AsyncState.Pending;

            m_Socket.BeginReceive( m_RecvBuffer, 0, m_RecvBuffer.Length, SocketFlags.None, m_OnReceive, m_Socket );
        }

        public static void Resume() {
            m_Paused = false;

            for ( int i = 0; i < m_Instances.Count; ++i ) {
                NetState ns = m_Instances[i];

                if ( ns.m_Socket == null ) {
                    continue;
                }

                lock ( ns.m_AsyncLock ) {
                    ns.m_AsyncState &= ~AsyncState.Paused;

                    try {
                        if ( ( ns.m_AsyncState & AsyncState.Pending ) == 0 )
                            ns.InternalBeginReceive();
                    } catch ( Exception ex ) {
                        TraceException( ex );
                        ns.Dispose( false );
                    }
                }
            }
        }

        private IPacketEncoder m_Encoder = null;

        public IPacketEncoder PacketEncoder {
            get {
                return m_Encoder;
            }
            set {
                m_Encoder = value;
            }
        }

        private static NetStateCreatedCallback m_CreatedCallback;

        public static NetStateCreatedCallback CreatedCallback {
            get {
                return m_CreatedCallback;
            }
            set {
                m_CreatedCallback = value;
            }
        }

        public bool SentFirstPacket {
            get {
                return m_SentFirstPacket;
            }
            set {
                m_SentFirstPacket = value;
            }
        }

        public bool BlockAllPackets {
            get {
                return m_BlockAllPackets;
            }
            set {
                m_BlockAllPackets = value;
            }
        }

        public ClientFlags Flags {
            get {
                return m_Flags;
            }
            set {
                m_Flags = value;
            }
        }

        public ClientVersion Version {
            get {
                return m_Version;
            }
            set {
                m_Version = value;
 
                if ( value >= m_Version70160 ) {
                    _ProtocolChanges = ProtocolChanges.Version70160;
                        } else if ( value >= m_Version70130 ) {
                                _ProtocolChanges = ProtocolChanges.Version70130;
                        } else if ( value >= m_Version7090 ) {
                                _ProtocolChanges = ProtocolChanges.Version7090;
                        } else if ( value >= m_Version7000 ) {
                                _ProtocolChanges = ProtocolChanges.Version7000;
                } else if ( value >= m_Version60142 ) {
                    _ProtocolChanges = ProtocolChanges.Version60142;
                } else if ( value >= m_Version6017 ) {
                    _ProtocolChanges = ProtocolChanges.Version6017;
                } else if ( value >= m_Version6000 ) {
                    _ProtocolChanges = ProtocolChanges.Version6000;
                } else if ( value >= m_Version502b ) {
                    _ProtocolChanges = ProtocolChanges.Version502b;
                } else if ( value >= m_Version500a ) {
                    _ProtocolChanges = ProtocolChanges.Version500a;
                } else if ( value >= m_Version407a ) {
                    _ProtocolChanges = ProtocolChanges.Version407a;
                } else if ( value >= m_Version400a ) {
                    _ProtocolChanges = ProtocolChanges.Version400a;
                }
            }
        }

        private static ClientVersion m_Version400a    = new ClientVersion( "4.0.0a" );
        private static ClientVersion m_Version407a    = new ClientVersion( "4.0.7a" );
        private static ClientVersion m_Version500a    = new ClientVersion( "5.0.0a" );
        private static ClientVersion m_Version502b    = new ClientVersion( "5.0.2b" );
        private static ClientVersion m_Version6000    = new ClientVersion( "6.0.0.0" );
        private static ClientVersion m_Version6017    = new ClientVersion( "6.0.1.7" );
        private static ClientVersion m_Version60142    = new ClientVersion( "6.0.14.2" );
        private static ClientVersion m_Version7000    = new ClientVersion( "7.0.0.0" );
              private static ClientVersion m_Version7090        = new ClientVersion( "7.0.9.0" );
            private static ClientVersion m_Version70130        = new ClientVersion( "7.0.13.0" );
            private static ClientVersion m_Version70160    = new ClientVersion( "7.0.16.0" );

        private ProtocolChanges _ProtocolChanges;

        private enum ProtocolChanges {
            NewSpellbook                = 0x00000001,
            DamagePacket                = 0x00000002,
            Unpack                    = 0x00000004,
            BuffIcon                = 0x00000008,
            NewHaven                = 0x00000010,
            ContainerGridLines            = 0x00000020,
            ExtendedSupportedFeatures        = 0x00000040,
            StygianAbyss                = 0x00000080,
                    HighSeas                        = 0x00000100,
                    SelectableStartingCity          = 0x00000200,
                    NewCharacterCreation            = 0x00000400,

            Version400a                = NewSpellbook,
            Version407a                = Version400a | DamagePacket,
            Version500a                = Version407a | Unpack,
            Version502b                = Version500a | BuffIcon,
            Version6000                = Version502b | NewHaven,
            Version6017                = Version6000 | ContainerGridLines,
            Version60142                = Version6017 | ExtendedSupportedFeatures,
            Version7000                = Version60142 | StygianAbyss,
                    Version7090                      = Version7000  | HighSeas,
                    Version70130                    = Version7090  | SelectableStartingCity,
                    Version70160                    = Version70130 | NewCharacterCreation
        }

        public bool NewSpellbook { get { return ((_ProtocolChanges & ProtocolChanges.NewSpellbook) != 0); } }
        public bool DamagePacket { get { return ((_ProtocolChanges & ProtocolChanges.DamagePacket) != 0); } }
        public bool Unpack { get { return ((_ProtocolChanges & ProtocolChanges.Unpack) != 0); } }
        public bool BuffIcon { get { return ((_ProtocolChanges & ProtocolChanges.BuffIcon) != 0); } }
        public bool NewHaven { get { return ((_ProtocolChanges & ProtocolChanges.NewHaven) != 0); } }
        public bool ContainerGridLines { get { return ((_ProtocolChanges & ProtocolChanges.ContainerGridLines) != 0); } }
        public bool ExtendedSupportedFeatures { get { return ((_ProtocolChanges & ProtocolChanges.ExtendedSupportedFeatures) != 0); } }
        public bool StygianAbyss { get { return ((_ProtocolChanges & ProtocolChanges.StygianAbyss) != 0); } }
            public bool HighSeas { get { return ((_ProtocolChanges & ProtocolChanges.HighSeas) != 0); } }
            public bool SelectableStartingCity { get { return ((_ProtocolChanges & ProtocolChanges.SelectableStartingCity) != 0); } }
            public bool NewCharacterCreation { get { return ((_ProtocolChanges & ProtocolChanges.NewCharacterCreation) != 0); } }

        public bool IsUOTDClient {
            get {
                return ( (m_Flags & ClientFlags.UOTD) != 0 || m_Version.Type == ClientType.UOTD );
            }
        }

        public bool IsSAClient {
            get {
                return ( m_Version.Type == ClientType.SA );
            }
        }

        public List<SecureTrade> Trades {
            get {
                return m_Trades;
            }
        }

        public void ValidateAllTrades() {
            for ( int i = m_Trades.Count - 1; i >= 0; --i ) {
                if ( i >= m_Trades.Count ) {
                    continue;
                }

                SecureTrade trade = m_Trades[i];

                if ( trade.From.Mobile.Deleted || trade.To.Mobile.Deleted || !trade.From.Mobile.Alive || !trade.To.Mobile.Alive || !trade.From.Mobile.InRange( trade.To.Mobile, 2 ) || trade.From.Mobile.Map != trade.To.Mobile.Map ) {
                    trade.Cancel();
                }
            }
        }

        public void CancelAllTrades() {
            for ( int i = m_Trades.Count - 1; i >= 0; --i ) {
                if ( i < m_Trades.Count ) {
                    m_Trades[i].Cancel();
                }
            }
        }

        public void RemoveTrade( SecureTrade trade ) {
            m_Trades.Remove( trade );
        }

        public SecureTrade FindTrade( Mobile m ) {
            for ( int i = 0; i < m_Trades.Count; ++i ) {
                SecureTrade trade = m_Trades[i];

                if ( trade.From.Mobile == m || trade.To.Mobile == m ) {
                    return trade;
                }
            }

            return null;
        }

        public SecureTradeContainer FindTradeContainer( Mobile m ) {
            for ( int i = 0; i < m_Trades.Count; ++i ) {
                SecureTrade trade = m_Trades[i];

                SecureTradeInfo from = trade.From;
                SecureTradeInfo to = trade.To;

                if ( from.Mobile == m_Mobile && to.Mobile == m ) {
                    return from.Container;
                } else if ( from.Mobile == m && to.Mobile == m_Mobile ) {
                    return to.Container;
                }
            }

            return null;
        }

        public SecureTradeContainer AddTrade( NetState state ) {
            SecureTrade newTrade = new SecureTrade( m_Mobile, state.m_Mobile );

            m_Trades.Add( newTrade );
            state.m_Trades.Add( newTrade );

            return newTrade.From.Container;
        }

        public bool CompressionEnabled {
            get {
                return m_CompressionEnabled;
            }
            set {
                m_CompressionEnabled = value;
            }
        }

        public int Sequence {
            get {
                return m_Sequence;
            }
            set {
                m_Sequence = value;
            }
        }

        public IEnumerable<Gump> Gumps {
            get {
                return m_Gumps;
            }
        }

        public IEnumerable<HuePicker> HuePickers {
            get {
                return m_HuePickers;
            }
        }

        public IEnumerable<IMenu> Menus {
            get {
                return m_Menus;
            }
        }

        private static int m_GumpCap = 512, m_HuePickerCap = 512, m_MenuCap = 512;

        public static int GumpCap {
            get {
                return m_GumpCap;
            }
            set {
                m_GumpCap = value;
            }
        }

        public static int HuePickerCap {
            get {
                return m_HuePickerCap;
            }
            set {
                m_HuePickerCap = value;
            }
        }

        public static int MenuCap {
            get {
                return m_MenuCap;
            }
            set {
                m_MenuCap = value;
            }
        }

        public void WriteConsole( string text ) {
            Console.WriteLine( "Client: {0}: {1}", this, text );
        }

        public void WriteConsole( string format, params object[] args ) {
            WriteConsole( String.Format( format, args ) );
        }

        public void AddMenu( IMenu menu ) {
            if ( m_Menus == null ) {
                m_Menus = new List<IMenu>();
            }

            if ( m_Menus.Count < m_MenuCap ) {
                m_Menus.Add( menu );
            } else {
                WriteConsole( "Exceeded menu cap, disconnecting..." );
                Dispose();
            }
        }

        public void RemoveMenu( IMenu menu ) {
            if ( m_Menus != null ) {
                m_Menus.Remove( menu );
            }
        }

        public void RemoveMenu( int index ) {
            if ( m_Menus != null ) {
                m_Menus.RemoveAt( index );
            }
        }

        public void ClearMenus() {
            if ( m_Menus != null ) {
                m_Menus.Clear();
            }
        }

        public void AddHuePicker( HuePicker huePicker ) {
            if ( m_HuePickers == null ) {
                m_HuePickers = new List<HuePicker>();
            }

            if ( m_HuePickers.Count < m_HuePickerCap ) {
                m_HuePickers.Add( huePicker );
            } else {
                WriteConsole( "Exceeded hue picker cap, disconnecting..." );
                Dispose();
            }
        }

        public void RemoveHuePicker( HuePicker huePicker ) {
            if ( m_HuePickers != null ) {
                m_HuePickers.Remove( huePicker );
            }
        }

        public void RemoveHuePicker( int index ) {
            if ( m_HuePickers != null ) {
                m_HuePickers.RemoveAt( index );
            }
        }

        public void ClearHuePickers() {
            if ( m_HuePickers != null ) {
                m_HuePickers.Clear();
            }
        }

        public void AddGump( Gump gump ) {
            if ( m_Gumps == null ) {
                m_Gumps = new List<Gump>();
            }

            if ( m_Gumps.Count < m_GumpCap ) {
                m_Gumps.Add( gump );
            } else {
                WriteConsole( "Exceeded gump cap, disconnecting..." );
                Dispose();
            }
        }

        public void RemoveGump( Gump gump ) {
            if ( m_Gumps != null ) {
                m_Gumps.Remove( gump );
            }
        }

        public void RemoveGump( int index ) {
            if ( m_Gumps != null ) {
                m_Gumps.RemoveAt( index );
            }
        }

        public void ClearGumps() {
            if ( m_Gumps != null ) {
                m_Gumps.Clear();
            }
        }

        public CityInfo[] CityInfo {
            get {
                return m_CityInfo;
            }
            set {
                m_CityInfo = value;
            }
        }

        public Mobile Mobile {
            get {
                return m_Mobile;
            }
            set {
                m_Mobile = value;
            }
        }

        public ServerInfo[] ServerInfo {
            get {
                return m_ServerInfo;
            }
            set {
                m_ServerInfo = value;
            }
        }

        public IAccount Account {
            get {
                return m_Account;
            }
            set {
                m_Account = value;
            }
        }

        public override string ToString() {
            return m_ToString;
        }

        private static List<NetState> m_Instances = new List<NetState>();

        public static List<NetState> Instances {
            get {
                return m_Instances;
            }
        }

        private static BufferPool m_ReceiveBufferPool = new BufferPool( "Receive", 2048, 2048 );

        public NetState( Socket socket, MessagePump messagePump )
        {
            m_Socket = socket;
            m_Buffer = new ByteQueue();
            m_Seeded = false;
            m_Running = false;
            m_RecvBuffer = m_ReceiveBufferPool.AcquireBuffer();
            m_MessagePump = messagePump;
            m_Gumps = new List<Gump>();
            m_HuePickers = new List<HuePicker>();
            m_Menus = new List<IMenu>();
            m_Trades = new List<SecureTrade>();

            m_SendQueue = new SendQueue();

            m_NextCheckActivity = DateTime.Now + TimeSpan.FromMinutes( 0.5 );

            m_Instances.Add( this );

            try {
                m_Address = Utility.Intern( ( ( IPEndPoint ) m_Socket.RemoteEndPoint ).Address );
                m_ToString = m_Address.ToString();
            } catch ( Exception ex ) {
                TraceException( ex );
                m_Address = IPAddress.None;
                m_ToString = "(error)";
            }

            m_ConnectedOn = DateTime.Now;

            if ( m_CreatedCallback != null )
            {
                m_CreatedCallback( this );
            }
        }

        public PacketHandler GetHandler( int packetID )
        {
            if ( ContainerGridLines )
                return PacketHandlers.Get6017Handler( packetID );
            else
                return PacketHandlers.GetHandler( packetID );
        }

        public virtual void Send( Packet p ) {
            if ( m_Socket == null || m_BlockAllPackets ) {
                p.OnSend();
                return;
            }

            PacketSendProfile prof = PacketSendProfile.Acquire( p.GetType() );

            int length;
            byte[] buffer = p.Compile( m_CompressionEnabled, out length );

            if ( buffer != null ) {
                if ( buffer.Length <= 0 || length <= 0 ) {
                    p.OnSend();
                    return;
                }

                if ( prof != null ) {
                    prof.Start();
                }

                if ( m_Encoder != null ) {
                    m_Encoder.EncodeOutgoingPacket( this, ref buffer, ref length );
                }

                try {
                    SendQueue.Gram gram;

                    lock ( m_SendQueue ) {
                        gram = m_SendQueue.Enqueue( buffer, length );
                    }

                    if ( gram != null ) {
                        try {
                            m_Socket.BeginSend( gram.Buffer, 0, gram.Length, SocketFlags.None, m_OnSend, m_Socket );
                        } catch ( Exception ex ) {
                            TraceException( ex );
                            Dispose( false );
                        }
                    }
                } catch ( CapacityExceededException ) {
                    Console.WriteLine( "Client: {0}: Too much data pending, disconnecting...", this );
                    Dispose( false );
                }

                p.OnSend();

                if ( prof != null ) {
                    prof.Finish( length );
                }
            } else {
                Console.WriteLine( "Client: {0}: null buffer send, disconnecting...", this );
                using ( StreamWriter op = new StreamWriter( "null_send.log", true ) )
                {
                    op.WriteLine( "{0} Client: {1}: null buffer send, disconnecting...", DateTime.Now, this );
                    op.WriteLine( new System.Diagnostics.StackTrace() );
                }
                Dispose();
            }
        }

        public static void FlushAll() {
            for ( int i = 0; i < m_Instances.Count; ++i ) {
                NetState ns = m_Instances[i];

                ns.Flush();
            }
        }

        public bool Flush() {
            if ( m_Socket == null || !m_SendQueue.IsFlushReady ) {
                return false;
            }

            SendQueue.Gram gram;

            lock ( m_SendQueue ) {
                gram = m_SendQueue.CheckFlushReady();
            }

            if ( gram != null ) {
                try {
                    m_Socket.BeginSend( gram.Buffer, 0, gram.Length, SocketFlags.None, m_OnSend, m_Socket );
                    return true;
                } catch ( Exception ex ) {
                    TraceException( ex );
                    Dispose( false );
                }
            }

            return false;
        }

        private static int m_CoalesceSleep = -1;

        public static int CoalesceSleep {
            get {
                return m_CoalesceSleep;
            }
            set {
                m_CoalesceSleep = value;
            }
        }

        private void OnSend( IAsyncResult asyncResult ) {
            Socket s = (Socket)asyncResult.AsyncState;

            try {
                int bytes = s.EndSend( asyncResult );

                if ( bytes <= 0 ) {
                    Dispose( false );
                    return;
                }

                m_NextCheckActivity = DateTime.Now + TimeSpan.FromMinutes( 1.2 );

                if ( m_CoalesceSleep >= 0 ) {
                    Thread.Sleep( m_CoalesceSleep );
                }

                SendQueue.Gram gram;

                lock ( m_SendQueue ) {
                    gram = m_SendQueue.Dequeue();
                }

                if ( gram != null ) {
                    try {
                        s.BeginSend( gram.Buffer, 0, gram.Length, SocketFlags.None, m_OnSend, s );
                    } catch ( Exception ex ) {
                        TraceException( ex );
                        Dispose( false );
                    }
                }
            } catch ( Exception ){
                Dispose( false );
            }
        }

        public void Start() {
            m_OnReceive = new AsyncCallback( OnReceive );
            m_OnSend = new AsyncCallback( OnSend );

            m_Running = true;

            if ( m_Socket == null || m_Paused ) {
                return;
            }

            try {
                lock ( m_AsyncLock ) {
                    if ( ( m_AsyncState & ( AsyncState.Pending | AsyncState.Paused ) ) == 0 ) {
                        InternalBeginReceive();
                    }
                }
            } catch ( Exception ex ) {
                TraceException( ex );
                Dispose( false );
            }
        }

        public void LaunchBrowser( string url ) {
            Send( new MessageLocalized( Serial.MinusOne, -1, MessageType.Label, 0x35, 3, 501231, "", "" ) );
            Send( new LaunchBrowser( url ) );
        }

        private DateTime m_NextCheckActivity;

        public bool CheckAlive() {
            if ( m_Socket == null )
                return false;

            if ( DateTime.Now < m_NextCheckActivity ) {
                return true;
            }

            Console.WriteLine( "Client: {0}: Disconnecting due to inactivity...", this );

            Dispose();
            return false;
        }

        private void OnReceive( IAsyncResult asyncResult ) {
            Socket s = (Socket)asyncResult.AsyncState;

            try {
                int byteCount = s.EndReceive( asyncResult );

                if ( byteCount > 0 ) {
                    m_NextCheckActivity = DateTime.Now + TimeSpan.FromMinutes( 1.2 );

                    byte[] buffer = m_RecvBuffer;

                    if ( m_Encoder != null )
                        m_Encoder.DecodeIncomingPacket( this, ref buffer, ref byteCount );

                    lock ( m_Buffer )
                        m_Buffer.Enqueue( buffer, 0, byteCount );

                    m_MessagePump.OnReceive( this );

                    lock ( m_AsyncLock ) {
                        m_AsyncState &= ~AsyncState.Pending;

                        if ( ( m_AsyncState & AsyncState.Paused ) == 0 ) {
                            try {
                                InternalBeginReceive();
                            } catch ( Exception ex ) {
                                TraceException( ex );
                                Dispose( false );
                            }
                        }
                    }
                } else {
                    Dispose( false );
                }
            } catch {
                Dispose( false );
            }
        }

        public void Dispose() {
            Dispose( true );
        }

        public static void TraceException( Exception ex ) {
            try {
                using ( StreamWriter op = new StreamWriter( "network-errors.log", true ) ) {
                    op.WriteLine( "# {0}", DateTime.Now );

                    op.WriteLine( ex );

                    op.WriteLine();
                    op.WriteLine();
                }
            } catch {
            }

            try {
                Console.WriteLine( ex );
            } catch {
            }
        }

        private bool m_Disposing;

        public virtual void Dispose( bool flush ) {
            if ( m_Socket == null || m_Disposing ) {
                return;
            }

            m_Disposing = true;

            if ( flush )
                flush = Flush();

            try {
                m_Socket.Shutdown( SocketShutdown.Both );
            } catch ( SocketException ex ) {
                TraceException( ex );
            }

            try {
                m_Socket.Close();
            } catch ( SocketException ex ) {
                TraceException( ex );
            }

            if ( m_RecvBuffer != null )
                m_ReceiveBufferPool.ReleaseBuffer( m_RecvBuffer );

            m_Socket = null;

            m_Buffer = null;
            m_RecvBuffer = null;
            m_OnReceive = null;
            m_OnSend = null;
            m_Running = false;

            m_Disposed.Enqueue( this );

            if ( /*!flush &&*/ !m_SendQueue.IsEmpty ) {
                lock ( m_SendQueue )
                    m_SendQueue.Clear();
            }
        }

        public static void Initialize() {
            Timer.DelayCall( TimeSpan.FromMinutes( 1.0 ), TimeSpan.FromMinutes( 1.5 ), new TimerCallback( CheckAllAlive ) );
        }

        public static void CheckAllAlive() {
            try {
                for ( int i = 0; i < m_Instances.Count; ++i ) {
                    m_Instances[i].CheckAlive();
                }
            } catch ( Exception ex ) {
                TraceException( ex );
            }
        }

        private static Queue m_Disposed = Queue.Synchronized( new Queue() );

        public static void ProcessDisposedQueue() {
            int breakout = 0;

            while ( breakout < 200 && m_Disposed.Count > 0 ) {
                ++breakout;

                NetState ns = ( NetState ) m_Disposed.Dequeue();

                Mobile m = ns.m_Mobile;
                IAccount a = ns.m_Account;

                if ( m != null ) {
                    m.NetState = null;
                    ns.m_Mobile = null;
                }

                ns.m_Gumps.Clear();
                ns.m_Menus.Clear();
                ns.m_HuePickers.Clear();
                ns.m_Account = null;
                ns.m_ServerInfo = null;
                ns.m_CityInfo = null;

                m_Instances.Remove( ns );

                if ( a != null ) {
                    ns.WriteConsole( "Disconnected. [{0} Online] [{1}]", m_Instances.Count, a );
                } else {
                    ns.WriteConsole( "Disconnected. [{0} Online]", m_Instances.Count );
                }
            }
        }

        public bool Running {
            get {
                return m_Running;
            }
        }

        public bool Seeded {
            get {
                return m_Seeded;
            }
            set {
                m_Seeded = value;
            }
        }

        public Socket Socket {
            get {
                return m_Socket;
            }
        }

        public ByteQueue Buffer {
            get {
                return m_Buffer;
            }
        }

        public ExpansionInfo ExpansionInfo {
            get {
                for ( int i = ExpansionInfo.Table.Length - 1; i >= 0; i-- ) {
                    ExpansionInfo info = ExpansionInfo.Table[i];

                    if ( ( info.RequiredClient != null && this.Version >= info.RequiredClient ) || ( ( this.Flags & info.ClientFlags ) != 0 ) ) {
                        return info;
                    }
                }

                return ExpansionInfo.GetInfo( Expansion.None );
            }
        }

        public Expansion Expansion {
            get {
                return ( Expansion ) this.ExpansionInfo.ID;
            }
        }

        public bool SupportsExpansion( ExpansionInfo info, bool checkCoreExpansion ) {
            if ( info == null || ( checkCoreExpansion && ( int ) Core.Expansion < info.ID ) )
                return false;

            if ( info.RequiredClient != null )
                return ( this.Version >= info.RequiredClient );

            return ( ( this.Flags & info.ClientFlags ) != 0 );
        }

        public bool SupportsExpansion( Expansion ex, bool checkCoreExpansion ) {
            return SupportsExpansion( ExpansionInfo.GetInfo( ex ), checkCoreExpansion );
        }

        public bool SupportsExpansion( Expansion ex ) {
            return SupportsExpansion( ex, true );
        }

        public bool SupportsExpansion( ExpansionInfo info ) {
            return SupportsExpansion( info, true );
        }
    }
}

Perhaps you can spot what is wrong?
 

LdNS88i

Sorceror
Code:
Errors:
+ Misc/CharacterCreation.cs:
    CS0117: Line 676: 'Server.Network.NetState' does not contain a definition for 'NewCharacterCreation'

I'm having the same error
 

Iraq-

Sorceror
Yeah, thanks. It was telling me it couldn't find Ultima.dll, so I kept moving it all over the place, then I realized I needed 1 in the server folder, and one in the runuo directory. Now it's all working.

Great patch.
 

EvilPounder420

Sorceror
i am getting this error, i do not know what i have done wrong:

Code:
RunUO - [www.runuo.com] Version 2.1, Build 4224.42029
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 4 64-bit processors
Scripts: Compiling C# scripts...failed (1 errors, 2 warnings)
Warnings:
+ Items/Jewels/BaseJewel.cs:
    CS0162: Line 258: Unreachable code detected
+ Customs/Stygian Abyss/SA Customs/Facet Command/FacetGump.cs:
    CS0219: Line 18: The variable 'initialState' is assigned but its value is ne
ver used
Errors:
+ Misc/CharacterCreation.cs:
    CS0117: Line 924: 'System.Array' does not contain a definition for 'Value'
    CS0117: Line 924: 'System.Array' does not contain a definition for 'Value'
    CS0117: Line 927: 'System.Array' does not contain a definition for 'Value'
    CS0117: Line 931: 'System.Array' does not contain a definition for 'Name'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

This is my CharacterCreation.cs:

Code:
using System;
using Server;
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( 1000 ) ); // Starting gold can be customized here
            PackItem( new Candle() );

            if ( m.Race != Race.Gargoyle )
                PackItem( new Dagger() );
            else
                PackItem( new GargishDagger() );
        }

        private static Item MakeNewbie( Item item )
        {
            if ( !Core.AOS )
                item.LootType = LootType.Newbied;

            return item;
        }

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

        private static Item MakePotionKeg( PotionEffect type, int hue )
        {
            PotionKeg keg = new PotionKeg();

            keg.Held = 100;
            keg.Type = type;
            keg.Hue = hue;

            return MakeNewbie( keg );
        }

        private static void FillBankAOS( Mobile m )
        {
            BankBox bank = m.BankBox;

            // The new AOS bankboxes don't have powerscrolls, they are automatically 'applied':

            for ( int i = 0; i < PowerScroll.Skills.Count; ++i )
                m.Skills[PowerScroll.Skills[ i ]].Cap = 120.0;

            m.StatCap = 250;
 
            Container cont;
 
            // Begin box of money
            cont = new WoodenBox();
            cont.ItemID = 0xE7D;
            cont.Hue = 0x489;

            PlaceItemIn( cont, 16, 51, new BankCheck( 500000 ) );
            PlaceItemIn( cont, 28, 51, new BankCheck( 250000 ) );
            PlaceItemIn( cont, 40, 51, new BankCheck( 100000 ) );
            PlaceItemIn( cont, 52, 51, new BankCheck( 100000 ) );
            PlaceItemIn( cont, 64, 51, new BankCheck(  50000 ) );

            PlaceItemIn( cont, 16, 115, new Factions.Silver( 9000 ) );
            PlaceItemIn( cont, 34, 115, new Gold( 60000 ) );

            PlaceItemIn( bank, 18, 169, cont );
            // End box of money
 
            // Begin bag of potion kegs
            cont = new Backpack();
            cont.Name = "Various Potion Kegs";

            PlaceItemIn( cont,  45, 149, MakePotionKeg( PotionEffect.CureGreater, 0x2D ) );
            PlaceItemIn( cont,  69, 149, MakePotionKeg( PotionEffect.HealGreater, 0x499 ) );
            PlaceItemIn( cont,  93, 149, MakePotionKeg( PotionEffect.PoisonDeadly, 0x46 ) );
            PlaceItemIn( cont, 117, 149, MakePotionKeg( PotionEffect.RefreshTotal, 0x21 ) );
            PlaceItemIn( cont, 141, 149, MakePotionKeg( PotionEffect.ExplosionGreater, 0x74 ) );

            PlaceItemIn( cont, 93, 82, new Bottle( 1000 ) );

            PlaceItemIn( bank, 53, 169, cont );
            // End bag of potion kegs
 
            // Begin bag of tools
            cont = new Bag();
            cont.Name = "Tool Bag";

            PlaceItemIn( cont, 30,  35, new TinkerTools( 1000 ) );
            PlaceItemIn( cont, 60,  35, new HousePlacementTool() );
            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( cont, 36, 51, new RunicHammer( CraftResource.DullCopper, 1000 ) );
            PlaceItemIn( cont, 42, 51, new RunicHammer( CraftResource.ShadowIron, 1000 ) );
            PlaceItemIn( cont, 48, 51, new RunicHammer( CraftResource.Copper, 1000 ) );
            PlaceItemIn( cont, 54, 51, new RunicHammer( CraftResource.Bronze, 1000 ) );
            PlaceItemIn( cont, 61, 51, new RunicHammer( CraftResource.Gold, 1000 ) );
            PlaceItemIn( cont, 67, 51, new RunicHammer( CraftResource.Agapite, 1000 ) );
            PlaceItemIn( cont, 73, 51, new RunicHammer( CraftResource.Verite, 1000 ) );
            PlaceItemIn( cont, 79, 51, new RunicHammer( CraftResource.Valorite, 1000 ) );

            PlaceItemIn( cont, 36, 55, new RunicSewingKit( CraftResource.SpinedLeather, 1000 ) );
            PlaceItemIn( cont, 42, 55, new RunicSewingKit( CraftResource.HornedLeather, 1000 ) );
            PlaceItemIn( cont, 48, 55, new RunicSewingKit( CraftResource.BarbedLeather, 1000 ) );

            PlaceItemIn( bank, 118, 169, cont );
            // End bag of tools
 
            // Begin bag of archery ammo
            cont = new Bag();
            cont.Name = "Bag Of Archery Ammo";

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

            PlaceItemIn( bank, 118, 124, cont );
            // End bag of archery ammo
 
            // Begin bag of treasure maps
            cont = new Bag();
            cont.Name = "Bag Of Treasure Maps";

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

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

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

            PlaceItemIn( bank, 98, 124, cont );
            // End bag of treasure maps
 
            // Begin bag of raw materials
            cont = new Bag();
            cont.Hue = 0x835;
            cont.Name = "Raw Materials Bag";

            PlaceItemIn( cont, 92, 60, new BarbedLeather( 5000 ) );
            PlaceItemIn( cont, 92, 68, new HornedLeather( 5000 ) );
            PlaceItemIn( cont, 92, 76, new SpinedLeather( 5000 ) );
            PlaceItemIn( cont, 92, 84, new Leather( 5000 ) );

            PlaceItemIn( cont, 30, 118, new Cloth( 5000 ) );
            PlaceItemIn( cont, 30,  84, new Board( 5000 ) );
            PlaceItemIn( cont, 57,  80, new BlankScroll( 500 ) );

            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( cont, 30,  59, new RedScales( 5000 ) );
            PlaceItemIn( cont, 36,  59, new YellowScales( 5000 ) );
            PlaceItemIn( cont, 42,  59, new BlackScales( 5000 ) );
            PlaceItemIn( cont, 48,  59, new GreenScales( 5000 ) );
            PlaceItemIn( cont, 54,  59, new WhiteScales( 5000 ) );
            PlaceItemIn( cont, 60,  59, new BlueScales( 5000 ) );

            PlaceItemIn( bank, 98, 169, cont );
            // End bag of raw materials
 
            // Begin bag of spell casting stuff
            cont = new Backpack();
            cont.Hue = 0x480;
            cont.Name = "Spell Casting Stuff";

            PlaceItemIn( cont, 45, 105, new Spellbook( UInt64.MaxValue ) );
            PlaceItemIn( cont, 65, 105, new NecromancerSpellbook( (UInt64)0xFFFF ) );
            PlaceItemIn( cont, 85, 105, new BookOfChivalry( (UInt64)0x3FF ) );
            PlaceItemIn( cont, 105, 105, new BookOfBushido() );    //Default ctor = full
            PlaceItemIn( cont, 125, 105, new BookOfNinjitsu() ); //Default ctor = full

            Runebook runebook = new Runebook( 10 );
            runebook.CurCharges = runebook.MaxCharges;
            PlaceItemIn( cont, 145, 105, runebook );

            Item toHue = new BagOfReagents( 150 );
            toHue.Hue = 0x2D;
            PlaceItemIn( cont, 45, 150, toHue );

            toHue = new BagOfNecroReagents( 150 );
            toHue.Hue = 0x488;
            PlaceItemIn( cont, 65, 150, toHue );

            PlaceItemIn( cont, 140, 150, new BagOfAllReagents( 500 ) );

            for ( int i = 0; i < 9; ++i )
                PlaceItemIn( cont, 45 + (i * 10), 75, new RecallRune() );

            PlaceItemIn( cont, 141, 74, new FireHorn() );

            PlaceItemIn( bank, 78, 169, cont );
            // End bag of spell casting stuff
 
            // Begin bag of ethereals
            cont = new Backpack();
            cont.Hue = 0x490;
            cont.Name = "Bag Of Ethy's!";

            PlaceItemIn( cont, 45, 66, new EtherealHorse() );
            PlaceItemIn( cont, 69, 82, new EtherealOstard() );
            PlaceItemIn( cont, 93, 99, new EtherealLlama() );
            PlaceItemIn( cont, 117, 115, new EtherealKirin() );
            PlaceItemIn( cont, 45, 132, new EtherealUnicorn() );
            PlaceItemIn( cont, 69, 66, new EtherealRidgeback() );
            PlaceItemIn( cont, 93, 82, new EtherealSwampDragon() );
            PlaceItemIn( cont, 117, 99, new EtherealBeetle() );

            PlaceItemIn( bank, 38, 124, cont );
            // End bag of ethereals
 
            // Begin first bag of artifacts
            cont = new Backpack();
            cont.Hue = 0x48F;
            cont.Name = "Bag of Artifacts";

            PlaceItemIn( cont, 45, 66, new TitansHammer() );
            PlaceItemIn( cont, 69, 82, new InquisitorsResolution() );
            PlaceItemIn( cont, 93, 99, new BladeOfTheRighteous() );
            PlaceItemIn( cont, 117, 115, new ZyronicClaw() );

            PlaceItemIn( bank, 58, 124, cont );
            // End first bag of artifacts
 
            // Begin second bag of artifacts
            cont = new Backpack();
            cont.Hue = 0x48F;
            cont.Name = "Bag of Artifacts";

            PlaceItemIn( cont, 45, 66, new GauntletsOfNobility() );
            PlaceItemIn( cont, 69, 82, new MidnightBracers() );
            PlaceItemIn( cont, 93, 99, new VoiceOfTheFallenKing() );
            PlaceItemIn( cont, 117, 115, new OrnateCrownOfTheHarrower() );
            PlaceItemIn( cont, 45, 132, new HelmOfInsight() );
            PlaceItemIn( cont, 69, 66, new HolyKnightsBreastplate() );
            PlaceItemIn( cont, 93, 82, new ArmorOfFortune() );
            PlaceItemIn( cont, 117, 99, new TunicOfFire() );
            PlaceItemIn( cont, 45, 115, new LeggingsOfBane() );
            PlaceItemIn( cont, 69, 132, new ArcaneShield() );
            PlaceItemIn( cont, 93, 66, new Aegis() );
            PlaceItemIn( cont, 117, 82, new RingOfTheVile() );
            PlaceItemIn( cont, 45, 99, new BraceletOfHealth() );
            PlaceItemIn( cont, 69, 115, new RingOfTheElements() );
            PlaceItemIn( cont, 93, 132, new OrnamentOfTheMagician() );
            PlaceItemIn( cont, 117, 66, new DivineCountenance() );
            PlaceItemIn( cont, 45, 82, new JackalsCollar() );
            PlaceItemIn( cont, 69, 99, new HuntersHeaddress() );
            PlaceItemIn( cont, 93, 115, new HatOfTheMagi() );
            PlaceItemIn( cont, 117, 132, new ShadowDancerLeggings() );
            PlaceItemIn( cont, 45, 66, new SpiritOfTheTotem() );
            PlaceItemIn( cont, 69, 82, new BladeOfInsanity() );
            PlaceItemIn( cont, 93, 99, new AxeOfTheHeavens() );
            PlaceItemIn( cont, 117, 115, new TheBeserkersMaul() );
            PlaceItemIn( cont, 45, 132, new Frostbringer() );
            PlaceItemIn( cont, 69, 66, new BreathOfTheDead() );
            PlaceItemIn( cont, 93, 82, new TheDragonSlayer() );
            PlaceItemIn( cont, 117, 99, new BoneCrusher() );
            PlaceItemIn( cont, 45, 115, new StaffOfTheMagi() );
            PlaceItemIn( cont, 69, 132, new SerpentsFang() );
            PlaceItemIn( cont, 93, 66, new LegacyOfTheDreadLord() );
            PlaceItemIn( cont, 117, 82, new TheTaskmaster() );
            PlaceItemIn( cont, 45, 99, new TheDryadBow() );

            PlaceItemIn( bank, 78, 124, cont );
            // End second bag of artifacts

            // Begin bag of minor artifacts
            cont = new Backpack();
            cont.Hue = 0x48F;
            cont.Name = "Bag of Minor Artifacts";
 
            PlaceItemIn( cont, 45, 66, new LunaLance() );
            PlaceItemIn( cont, 69, 82, new VioletCourage() );
            PlaceItemIn( cont, 93, 99, new CavortingClub() );
            PlaceItemIn( cont, 117, 115, new CaptainQuacklebushsCutlass() );
            PlaceItemIn( cont, 45, 132, new NightsKiss() );
            PlaceItemIn( cont, 69, 66, new ShipModelOfTheHMSCape() );
            PlaceItemIn( cont, 93, 82, new AdmiralsHeartyRum() );
            PlaceItemIn( cont, 117, 99, new CandelabraOfSouls() );
            PlaceItemIn( cont, 45, 115, new IolosLute() );
            PlaceItemIn( cont, 69, 132, new GwennosHarp() );
            PlaceItemIn( cont, 93, 66, new ArcticDeathDealer() );
            PlaceItemIn( cont, 117, 82, new EnchantedTitanLegBone() );
            PlaceItemIn( cont, 45, 99, new NoxRangersHeavyCrossbow() );
            PlaceItemIn( cont, 69, 115, new BlazeOfDeath() );
            PlaceItemIn( cont, 93, 132, new DreadPirateHat() );
            PlaceItemIn( cont, 117, 66, new BurglarsBandana() );
            PlaceItemIn( cont, 45, 82, new GoldBricks() );
            PlaceItemIn( cont, 69, 99, new AlchemistsBauble() );
            PlaceItemIn( cont, 93, 115, new PhillipsWoodenSteed() );
            PlaceItemIn( cont, 117, 132, new PolarBearMask() );
            PlaceItemIn( cont, 45, 66, new BowOfTheJukaKing() );
            PlaceItemIn( cont, 69, 82, new GlovesOfThePugilist() );
            PlaceItemIn( cont, 93, 99, new OrcishVisage() );
            PlaceItemIn( cont, 117, 115, new StaffOfPower() );
            PlaceItemIn( cont, 45, 132, new ShieldOfInvulnerability() );
            PlaceItemIn( cont, 69, 66, new HeartOfTheLion() );
            PlaceItemIn( cont, 93, 82, new ColdBlood() );
            PlaceItemIn( cont, 117, 99, new GhostShipAnchor() );
            PlaceItemIn( cont, 45, 115, new SeahorseStatuette() );
            PlaceItemIn( cont, 69, 132, new WrathOfTheDryad() );
            PlaceItemIn( cont, 93, 66, new PixieSwatter() );

            for( int i = 0; i < 10; i++ )
                PlaceItemIn( cont, 117, 128, new MessageInABottle( Utility.RandomBool() ? Map.Trammel : Map.Felucca, 4 ) );

            PlaceItemIn( bank, 18, 124, cont );

            if( Core.SE )
            {
                cont = new Bag();
                cont.Hue = 0x501;
                cont.Name = "Tokuno Minor Artifacts";

                PlaceItemIn( cont, 42, 70, new Exiler() );
                PlaceItemIn( cont, 38, 53, new HanzosBow() );
                PlaceItemIn( cont, 45, 40, new TheDestroyer() );
                PlaceItemIn( cont, 92, 80, new DragonNunchaku() );
                PlaceItemIn( cont, 42, 56, new PeasantsBokuto() );
                PlaceItemIn( cont, 44, 71, new TomeOfEnlightenment() );
                PlaceItemIn( cont, 35, 35, new ChestOfHeirlooms() );
                PlaceItemIn( cont, 29,  0, new HonorableSwords() );
                PlaceItemIn( cont, 49, 85, new AncientUrn() );
                PlaceItemIn( cont, 51, 58, new FluteOfRenewal() );
                PlaceItemIn( cont, 70, 51, new PigmentsOfTokuno() );
                PlaceItemIn( cont, 40, 79, new AncientSamuraiDo() );
                PlaceItemIn( cont, 51, 61, new LegsOfStability() );
                PlaceItemIn( cont, 88, 78, new GlovesOfTheSun() );
                PlaceItemIn( cont, 55, 62, new AncientFarmersKasa() );
                PlaceItemIn( cont, 55, 83, new ArmsOfTacticalExcellence() );
                PlaceItemIn( cont, 50, 85, new DaimyosHelm() );
                PlaceItemIn( cont, 52, 78, new BlackLotusHood() );
                PlaceItemIn( cont, 52, 79, new DemonForks() );
                PlaceItemIn( cont, 33, 49, new PilferedDancerFans() );

                PlaceItemIn( bank, 58, 124, cont );
            }

            if( Core.SE )    //This bag came only after SE.
            {
                cont = new Bag();
                cont.Name = "Bag of Bows";

                PlaceItemIn( cont, 31, 84, new Bow() );
                PlaceItemIn( cont, 78, 74, new CompositeBow() );
                PlaceItemIn( cont, 53, 71, new Crossbow() );
                PlaceItemIn( cont, 56, 39, new HeavyCrossbow() );
                PlaceItemIn( cont, 82, 72, new RepeatingCrossbow() );
                PlaceItemIn( cont, 49, 45, new Yumi() );

                for( int i = 0; i < cont.Items.Count; i++ )
                {
                    BaseRanged bow = cont.Items[i] as BaseRanged;

                    if( bow != null )
                    {
                        bow.Attributes.WeaponSpeed = 35;
                        bow.Attributes.WeaponDamage = 35;
                    }
                }

                PlaceItemIn( bank, 108, 135, cont );
            }
        }

        private static void FillBankbox( Mobile m )
        {
            if ( Core.AOS )
            {
                FillBankAOS( m );
                return;
            }

            BankBox bank = m.BankBox;

            bank.DropItem( new BankCheck( 1000000 ) );

            // Full spellbook
            Spellbook book = new Spellbook();

            book.Content = ulong.MaxValue;

            bank.DropItem( book );

            Bag bag = new Bag();

            for ( int i = 0; i < 5; ++i )
                bag.DropItem( new Moonstone( MoonstoneType.Felucca ) );

            // Felucca moonstones
            bank.DropItem( bag );

            bag = new Bag();

            for ( int i = 0; i < 5; ++i )
                bag.DropItem( new Moonstone( MoonstoneType.Trammel ) );

            // Trammel moonstones
            bank.DropItem( bag );

            // Treasure maps
            bank.DropItem( new TreasureMap( 1, Map.Trammel ) );
            bank.DropItem( new TreasureMap( 2, Map.Trammel ) );
            bank.DropItem( new TreasureMap( 3, Map.Trammel ) );
            bank.DropItem( new TreasureMap( 4, Map.Trammel ) );
            bank.DropItem( new TreasureMap( 5, Map.Trammel ) );

            // Bag containing 50 of each reagent
            bank.DropItem( new BagOfReagents( 50 ) );

            // Craft tools
            bank.DropItem( MakeNewbie( new Scissors() ) );
            bank.DropItem( MakeNewbie( new SewingKit( 1000 ) ) );
            bank.DropItem( MakeNewbie( new SmithHammer( 1000 ) ) );
            bank.DropItem( MakeNewbie( new FletcherTools( 1000 ) ) );
            bank.DropItem( MakeNewbie( new DovetailSaw( 1000 ) ) );
            bank.DropItem( MakeNewbie( new MortarPestle( 1000 ) ) );
            bank.DropItem( MakeNewbie( new ScribesPen( 1000 ) ) );
            bank.DropItem( MakeNewbie( new TinkerTools( 1000 ) ) );

            // A few dye tubs
            bank.DropItem( new Dyes() );
            bank.DropItem( new DyeTub() );
            bank.DropItem( new DyeTub() );
            bank.DropItem( new BlackDyeTub() );

            DyeTub darkRedTub = new DyeTub();

            darkRedTub.DyedHue = 0x485;
            darkRedTub.Redyable = false;

            bank.DropItem( darkRedTub );

            // Some food
            bank.DropItem( MakeNewbie( new Apple( 1000 ) ) );

            // Resources
            bank.DropItem( MakeNewbie( new Feather( 1000 ) ) );
            bank.DropItem( MakeNewbie( new BoltOfCloth( 1000 ) ) );
            bank.DropItem( MakeNewbie( new BlankScroll( 1000 ) ) );
            bank.DropItem( MakeNewbie( new Hides( 1000 ) ) );
            bank.DropItem( MakeNewbie( new Bandage( 1000 ) ) );
            bank.DropItem( MakeNewbie( new Bottle( 1000 ) ) );
            bank.DropItem( MakeNewbie( new Log( 1000 ) ) );

            bank.DropItem( MakeNewbie( new IronIngot( 5000 ) ) );
            bank.DropItem( MakeNewbie( new DullCopperIngot( 5000 ) ) );
            bank.DropItem( MakeNewbie( new ShadowIronIngot( 5000 ) ) );
            bank.DropItem( MakeNewbie( new CopperIngot( 5000 ) ) );
            bank.DropItem( MakeNewbie( new BronzeIngot( 5000 ) ) );
            bank.DropItem( MakeNewbie( new GoldIngot( 5000 ) ) );
            bank.DropItem( MakeNewbie( new AgapiteIngot( 5000 ) ) );
            bank.DropItem( MakeNewbie( new VeriteIngot( 5000 ) ) );
            bank.DropItem( MakeNewbie( new ValoriteIngot( 5000 ) ) );

            // Reagents
            bank.DropItem( MakeNewbie( new BlackPearl( 1000 ) ) );
            bank.DropItem( MakeNewbie( new Bloodmoss( 1000 ) ) );
            bank.DropItem( MakeNewbie( new Garlic( 1000 ) ) );
            bank.DropItem( MakeNewbie( new Ginseng( 1000 ) ) );
            bank.DropItem( MakeNewbie( new MandrakeRoot( 1000 ) ) );
            bank.DropItem( MakeNewbie( new Nightshade( 1000 ) ) );
            bank.DropItem( MakeNewbie( new SulfurousAsh( 1000 ) ) );
            bank.DropItem( MakeNewbie( new SpidersSilk( 1000 ) ) );

            // Some extra starting gold
            bank.DropItem( MakeNewbie( new Gold( 9000 ) ) );

            // 5 blank recall runes
            for ( int i = 0; i < 5; ++i )
                bank.DropItem( MakeNewbie( new RecallRune() ) );

            AddPowerScrolls( bank );
        }

        private static void AddPowerScrolls( BankBox bank )
        {
            Bag bag = new Bag();

            for ( int i = 0; i < PowerScroll.Skills.Count; ++i )
                bag.DropItem( new PowerScroll( PowerScroll.Skills[i], 120.0 ) );

            bag.DropItem( new StatCapScroll( 250 ) );

            bank.DropItem( bag );
        }

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

            if ( m.Race == Race.Elf )
            {
                EquipItem( new ElvenShirt( hue ), true );
            }
            else if ( m.Race == Race.Human )
            {
                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;
                }
            }
            else if ( m.Race == Race.Gargoyle )
            {
                EquipItem( new GargishClothChest( hue ) );
            }
        }

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

            if ( m.Race == Race.Elf )
            {
                EquipItem( new ElvenPants( hue ), true );
            }
            else if ( m.Race == Race.Human )
            {
                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;
                    }
                }
            }
            else if ( m.Race == Race.Gargoyle )
            {
                EquipItem( new GargishClothKilt( hue ) );
            }
        }

        private static void AddShoes( Mobile m )
        {
            if( m.Race == Race.Elf )
                EquipItem( new ElvenBoots(), true );
            else if ( m.Race == Race.Human )
                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;

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

            if ( newChar == null )
            {
                Console.WriteLine( "Login: {0}: Character creation failed, account full", args.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;

            if( Core.Expansion >= args.Race.RequiredExpansion )
                newChar.Race = args.Race;    //Sets body
            else
                newChar.Race = Race.DefaultRace;

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

            newChar.Hunger = 20;

            bool young = false;

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

                pm.Profession = args.Profession;

                if ( pm.AccessLevel == AccessLevel.Player && ((Account)pm.Account).Young )
                    young = pm.Young = true;
            }

            SetName( newChar, args.Name );

            AddBackpack( newChar );

            SetStats( newChar, args.Str, args.Dex, args.Int , args.State.NewCharacterCreation );
            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 = 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})", args.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 < 4 )
                return true;
            else if ( Core.AOS && profession < 6 )
                return true;
            else if ( Core.SE && 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 readonly CityInfo m_NewHavenInfo = new CityInfo( "New Haven", "The Bountiful Harvest Inn", 3503, 2574, 14, Map.Trammel );

        private static CityInfo GetStartLocation( CharacterCreatedEventArgs args, bool isYoung )
        {
            if( Core.ML )
            {
                //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 4: //Necro
                {
                    if ( (flags & ClientFlags.Malas) != 0 )
                    {
                        return new CityInfo( "Umbra", "Mardoth's Tower", 2114, 1301, -50, Map.Malas );
                    }
                    else
                    {
                        useHaven = true;

                        new BadStartMessage( m, 1062205 );
                        /*
                        * Unfortunately you are playing on a *NON-Age-Of-Shadows* game
                        * installation and cannot be transported to Malas.
                        * You will not be able to take your new player quest in Malas
                        * without an AOS client.  You are now being taken to the city of
                        * Haven on the Trammel facet.
                        * */
                    }

                    break;
                }
                case 5:    //Paladin
                {
                    return m_NewHavenInfo;
                }
                case 6:    //Samurai
                {
                    if ( (flags & ClientFlags.Tokuno) != 0 )
                    {
                        return new CityInfo( "Samurai DE", "Haoti's Grounds", 368, 780, -1, Map.Malas );
                    }
                    else
                    {
                        useHaven = true;

                        new BadStartMessage( m, 1063487 );
                        /*
                        * Unfortunately you are playing on a *NON-Samurai-Empire* game
                        * installation and cannot be transported to Tokuno.
                        * You will not be able to take your new player quest in Tokuno
                        * without an SE client. You are now being taken to the city of
                        * Haven on the Trammel facet.
                        * */
                    }

                    break;
                }
                case 7:    //Ninja
                {
                    if ( (flags & ClientFlags.Tokuno) != 0 )
                    {
                        return new CityInfo( "Ninja DE", "Enimo's Residence", 414,    823, -1, Map.Malas );
                    }
                    else
                    {
                        useHaven = true;

                        new BadStartMessage( m, 1063487 );
                        /*
                        * Unfortunately you are playing on a *NON-Samurai-Empire* game
                        * installation and cannot be transported to Tokuno.
                        * You will not be able to take your new player quest in Tokuno
                        * without an SE client. You are now being taken to the city of
                        * Haven on the Trammel facet.
                        * */
                    }

                    break;
                }
            }

            if( useHaven )
                return m_NewHavenInfo;
            else
                return args.City;
        }

private static void FixStats( ref int str, ref int dex, ref int intel , int maxstat )
        {
            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 == maxstat)
                return;

            double scalar = maxstat / (double)total;

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

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

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

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

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

private static void SetStats( Mobile m, int str, int dex, int intel , bool newclient )
        {
            int maxstat = newclient ? 60 : 50;
            int maxstats = newclient ? 90 : 80;

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

            if (str < 10 || str > maxstat || dex < 10 || dex > maxstat || intel < 10 || intel > maxstat || (str + dex + intel) != maxstats)
            {
                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.Value < 0 || skills.Value > 50 )
                    return false;

                total += skills.Value;

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

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

        private static Mobile m_Mobile;

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

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

                    break;
                }
                case 3: // Blacksmith
                {
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.Mining, 30 ),
                            new SkillNameValue( SkillName.ArmsLore, 30 ),
                            new SkillNameValue( SkillName.Blacksmith, 50 ),
                            new SkillNameValue( SkillName.Tinkering, 50 )
                        };

                    break;
                }
                case 4: // Necromancer
                {
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.Necromancy, 50 ),
                            new SkillNameValue( SkillName.Focus, 30 ),
                            new SkillNameValue( SkillName.SpiritSpeak, 30 ),
                            new SkillNameValue( SkillName.Swords, 30 ),
                            new SkillNameValue( SkillName.Tactics, 20 )
                        };

                    break;
                }
                case 5: // Paladin
                {
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.Chivalry, 51 ),
                            new SkillNameValue( SkillName.Swords, 49 ),
                            new SkillNameValue( SkillName.Focus, 30 ),
                            new SkillNameValue( SkillName.Tactics, 30 )
                        };

                    break;
                }
                case 6:    //Samurai
                {
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.Bushido, 50 ),
                            new SkillNameValue( SkillName.Swords, 50 ),
                            new SkillNameValue( SkillName.Anatomy, 30 ),
                            new SkillNameValue( SkillName.Healing, 30 )
                    };
                    break;
                }
                case 7:    //Ninja
                {
                    skills = new SkillNameValue[]
                        {
                            new SkillNameValue( SkillName.Ninjitsu, 50 ),
                            new SkillNameValue( SkillName.Hiding, 50 ),
                            new SkillNameValue( SkillName.Fencing, 30 ),
                            new SkillNameValue( SkillName.Stealth, 30 )
                        };
                    break;
                }
                default:
                {
                    if ( !ValidSkills( skills ) )
                        return;

                    break;
                }
            }

            bool addSkillItems = true;
            bool elf = (m.Race == Race.Elf);
            bool human = (m.Race == Race.Human);
            bool gargoyle = (m.Race == Race.Gargoyle);

            switch ( prof )
            {
                case 1: // Warrior
                {
                    if ( elf )
                        EquipItem( new LeafChest() );
                    else if ( human )
                        EquipItem( new LeatherChest() );
                    else if ( gargoyle )
                    {
                        EquipItem( new GargishLeatherChest() );
                    }

                    break;
                }
                case 4: // Necromancer
                {
                    Container regs = new BagOfNecroReagents( 50 );

                    if ( !Core.AOS )
                    {
                        foreach ( Item item in regs.Items )
                            item.LootType = LootType.Newbied;
                    }

                    PackItem( regs );
                    regs.LootType = LootType.Regular;

                    if ( elf || human )
                    EquipItem( new BoneHelm() );

                    if ( elf )
                    {
                        EquipItem( new ElvenMachete() );
                        EquipItem( NecroHue( new LeafChest() ) );
                        EquipItem( NecroHue( new LeafArms() ) );
                        EquipItem( NecroHue( new LeafGloves() ) );
                        EquipItem( NecroHue( new LeafGorget() ) );
                        EquipItem( NecroHue( new LeafGorget() ) );
                        EquipItem( NecroHue( new ElvenPants() ) );    //TODO: Verify the pants
                        EquipItem( new ElvenBoots() );
                    }
                    else if ( human )
                    {
                        EquipItem( new BoneHarvester() );
                        EquipItem( NecroHue( new LeatherChest() ) );
                        EquipItem( NecroHue( new LeatherArms() ) );
                        EquipItem( NecroHue( new LeatherGloves() ) );
                        EquipItem( NecroHue( new LeatherGorget() ) );
                        EquipItem( NecroHue( new LeatherLegs() ) );
                        EquipItem( NecroHue( new Skirt() ) );
                        EquipItem( new Sandals( 0x8FD ) );
                    }
                    else if ( gargoyle )
                    {
                        EquipItem( new GlassSword() );
                        EquipItem( NecroHue( new GargishLeatherChest() ) );
                        EquipItem( NecroHue( new GargishLeatherArms() ) );
                        EquipItem( NecroHue( new GargishLeatherLegs() ) );
                        EquipItem( NecroHue( new GargishLeatherKilt() ) );
                    }

                    Spellbook book = new NecromancerSpellbook( (ulong)0x8981 ); // animate dead, evil omen, pain spike, summon familiar, wraith form

                    PackItem( book );

                    book.LootType = LootType.Blessed;

                    addSkillItems = false;
                    break;
                }
                case 5: // Paladin
                {
                    if ( elf )
                    {
                        EquipItem( new ElvenMachete() );
                        EquipItem( new WingedHelm() );
                        EquipItem( new LeafGorget() );
                        EquipItem( new LeafArms() );
                        EquipItem( new LeafChest() );
                        EquipItem( new LeafLegs() );
                        EquipItem( new ElvenBoots() );    //Verify hue
                    }
                    else if ( human )
                    {
                        EquipItem( new Broadsword() );
                        EquipItem( new Helmet() );
                        EquipItem( new PlateGorget() );
                        EquipItem( new RingmailArms() );
                        EquipItem( new RingmailChest() );
                        EquipItem( new RingmailLegs() );
                        EquipItem( new ThighBoots( 0x748 ) );
                        EquipItem( new Cloak( 0xCF ) );
                        EquipItem( new BodySash( 0xCF ) );
                    }
                    else if ( gargoyle )
                    {
                        EquipItem( new DreadSword() );
                        EquipItem( new GargishPlateChest() );
                        EquipItem( new GargishPlateArms() );
                        EquipItem( new GargishPlateLegs() );
                        EquipItem( new GargishPlateKilt() );
                    }

                    Spellbook book = new BookOfChivalry( (ulong)0x3FF );
                    book.LootType = LootType.Blessed;
                    PackItem( book );

                    addSkillItems = false;
                    break;
                }

                case 6: // Samurai
                {
                    if ( elf || human )
                    {
                    EquipItem( new HakamaShita( 0x2C3 ) );
                    EquipItem( new Hakama( 0x2C3 ) );
                    EquipItem( new SamuraiTabi( 0x2C3 ) );
                    EquipItem( new TattsukeHakama( 0x22D ) );
                    EquipItem( new Bokuto() );

                    if ( elf )
                        EquipItem( new RavenHelm() );
                    else
                        EquipItem( new LeatherJingasa() );
                    }
                    else if ( gargoyle )
                    {
                        EquipItem( new GlassSword() );
                        EquipItem( new GargishPlateChest() );
                        EquipItem( new GargishPlateArms() );
                        EquipItem( new GargishPlateLegs() );
                        EquipItem( new GargishPlateKilt() );
                    }

                    PackItem( new Scissors() );
                    PackItem( new Bandage( 50 ) );

                    Spellbook book = new BookOfBushido();
                    PackItem( book );

                    addSkillItems = false;
                    break;
                }
                case 7: // Ninja
                {
                    int[] hues = new int[] { 0x1A8, 0xEC, 0x99, 0x90, 0xB5, 0x336, 0x89    };
                    //TODO: Verify that's ALL the hues for that above.

                    if ( elf || human )
                    {
                        EquipItem( new Kasa() );
                    EquipItem( new TattsukeHakama( hues[Utility.Random(hues.Length)] ) );
                    EquipItem( new HakamaShita( 0x2C3 ) );
                    EquipItem( new NinjaTabi( 0x2C3 ) );

                    if ( elf )
                        EquipItem( new AssassinSpike() );
                    else
                        EquipItem( new Tekagi() );
                    }
                    else if ( gargoyle )
                    {
                        EquipItem( new GargishDagger() );

                        int hue = hues[Utility.Random(hues.Length)];

                        EquipItem( new GargishClothChest( hue ) );
                        EquipItem( new GargishClothArms( hue ) );
                        EquipItem( new GargishClothLegs( hue ) );
                        EquipItem( new GargishClothKilt( hue ) );
                    }

                    PackItem( new SmokeBomb() );

                    Spellbook book = new BookOfNinjitsu();
                    PackItem( book );

                    addSkillItems = false;
                    break;
                }
            }

            if ( addSkillItems )
            {
            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 && snv.Name != SkillName.Spellweaving )
                {
                    Skill skill = m.Skills[snv.Name];

                    if ( skill != null )
                    {
                        skill.BaseFixedPoint = snv.Value * 10;
                            AddSkillItems( snv.Name, m );
                    }
                }
            }
        }
        }

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

        private static void EquipItem( Item item, bool mustEquip )
        {
            if ( !Core.AOS )
                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 )
        {
            if ( !Core.AOS )
                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 * 8) )
            {
                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 Item NecroHue( Item item )
        {
            item.Hue = 0x2C3;

            return item;
        }

        private static void    AddSkillItems( SkillName skill, Mobile m )
        {
            bool elf = (m.Race == Race.Elf);
            bool human = (m.Race == Race.Human);
            bool gargoyle = (m.Race == Race.Gargoyle);

            switch ( skill )
            {
                case SkillName.Alchemy:
                {
                    PackItem( new Bottle( 4 ) );
                    PackItem( new MortarPestle() );

                    int hue = Utility.RandomPinkHue();

                    if ( elf )
                    {
                        if ( m.Female )
                            EquipItem( new FemaleElvenRobe( hue ) );
                        else
                            EquipItem( new MaleElvenRobe( hue ) );
                    }
                    else
                    {
                        EquipItem( new Robe( Utility.RandomPinkHue() ) );
                    }
                    break;
                }
                case SkillName.Anatomy:
                {
                    PackItem( new Bandage( 3 ) );

                    int hue = Utility.RandomYellowHue();

                    if ( elf )
                    {
                        if ( m.Female )
                            EquipItem( new FemaleElvenRobe( hue ) );
                        else
                            EquipItem( new MaleElvenRobe( hue ) );
                    }
                    else
                    {
                        EquipItem( new Robe( Utility.RandomPinkHue() ) );
                    }
                    break;
                }
                case SkillName.AnimalLore:
                {
                    int hue = Utility.RandomBlueHue();

                    if ( elf )
                    {
                        EquipItem( new WildStaff() );

                        if ( m.Female )
                            EquipItem( new FemaleElvenRobe( hue ) );
                        else
                            EquipItem( new MaleElvenRobe( hue ) );
                    }
                    else
                    {
                        EquipItem( new ShepherdsCrook() );
                        EquipItem( new Robe( hue ) );
                    }
                    break;
                }
                case SkillName.Archery:
                {
                    // It seems like Gargoyles cannot use archery at all

                    PackItem( new Arrow( 25 ) );

                    if ( elf )
                        EquipItem( new ElvenCompositeLongbow() );
                    else if ( human )
                        EquipItem( new Bow() );

                    break;
                }
                case SkillName.ArmsLore:
                {
                    if ( elf )
                    {
                        switch ( Utility.Random( 3 ) )
                        {
                            case 0: EquipItem( new Leafblade() ); break;
                            case 1: EquipItem( new RuneBlade() ); break;
                            case 2: EquipItem( new DiamondMace() ); break;
                        }
                    }
                    else if ( human )
                    {
                        switch ( Utility.Random( 3 ) )
                        {
                            case 0: EquipItem( new Kryss() ); break;
                            case 1: EquipItem( new Katana() ); break;
                            case 2: EquipItem( new Club() ); break;
                        }
                    }
                    else if ( gargoyle )
                    {
                        switch( Utility.Random( 3 ) )
                        {
                            case 0: EquipItem( new BloodBlade() ); break;
                            case 1: EquipItem( new GlassSword() ); break;
                            case 2: EquipItem( new DiscMace() ); break;
                        }
                    }

                    break;
                }
                case SkillName.Begging:
                {
                    if ( elf )
                        EquipItem( new WildStaff() );
                    else if ( human )
                        EquipItem( new GnarledStaff() );
                    else if ( gargoyle )
                        EquipItem( new SerpentStoneStaff() );

                    break;
                }
                case SkillName.Blacksmith:
                {
                    PackItem( new Tongs() );
                    PackItem( new Pickaxe() );
                    PackItem( new Pickaxe() );
                    PackItem( new IronIngot( 50 ) );

                    if ( human || elf )
                    {
                    EquipItem( new HalfApron( Utility.RandomYellowHue() ) );
                    }

                    break;
                }
                case SkillName.Bushido:
                {
                    if ( human || elf )
                    {
                    EquipItem( new Hakama() );
                    EquipItem( new Kasa() );
                    }

                    EquipItem( new BookOfBushido() );
                    break;
                }
                case SkillName.Fletching:
                {
                    PackItem( new Board( 14 ) );
                    PackItem( new Feather( 5 ) );
                    PackItem( new Shaft( 5 ) );
                    break;
                }
                case SkillName.Camping:
                {
                    PackItem( new Bedroll() );
                    PackItem( new Kindling( 5 ) );
                    break;
                }
                case SkillName.Carpentry:
                {
                    PackItem( new Board( 10 ) );
                    PackItem( new Saw() );

                    if ( human || elf )
                    {
                    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:
                {
                    if( Core.ML )
                        PackItem( new BookOfChivalry( (ulong)0x3FF ) );

                    break;
                }
                case SkillName.DetectHidden:
                {
                    if ( human || elf )
                    EquipItem( new Cloak( 0x455 ) );

                    break;
                }
                case SkillName.Discordance:
                {
                    PackInstrument();
                    break;
                }
                case SkillName.Fencing:
                {
                    if ( elf )
                        EquipItem( new Leafblade() );
                    else if ( human )
                        EquipItem( new Kryss() );
                    else if ( gargoyle )
                        EquipItem( new BloodBlade() );

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

                    int hue = Utility.RandomYellowHue();

                    if ( elf )
                    {
                        Item i = new Circlet();
                        i.Hue = hue;
                        EquipItem( i );
                    }
                    else if ( human )
                    {
                        EquipItem( new FloppyHat( Utility.RandomYellowHue() ) );
                    }

                    break;
                }
                case SkillName.Healing:
                {
                    PackItem( new Bandage( 50 ) );
                    PackItem( new Scissors() );
                    break;
                }
                case SkillName.Herding:
                {
                    if ( elf )
                        EquipItem( new WildStaff() );
                    else
                        EquipItem( new ShepherdsCrook() );

                    break;
                }
                case SkillName.Hiding:
                {
                    if ( human || elf )
                    EquipItem( new Cloak( 0x455 ) );

                    break;
                }
                case SkillName.Inscribe:
                {
                    PackItem( new BlankScroll( 2 ) );
                    PackItem( new BlueBook() );
                    break;
                }
                case SkillName.ItemID:
                {
                    if ( elf )
                        EquipItem( new WildStaff() );
                    else if ( human )
                        EquipItem( new GnarledStaff() );
                    else if ( gargoyle )
                        EquipItem( new SerpentStoneStaff() );

                    break;
                }
                case SkillName.Lockpicking:
                {
                    PackItem( new Lockpick( 20 ) );
                    break;
                }
                case SkillName.Lumberjacking:
                {
                    if ( human || elf )
                    EquipItem( new Hatchet() );
                    else if ( gargoyle )
                        EquipItem( new DualShortAxes() );

                    break;
                }
                case SkillName.Macing:
                {
                    if ( elf )
                        EquipItem( new DiamondMace() );
                    else if ( human )
                        EquipItem( new Club() );
                    else if ( gargoyle )
                        EquipItem( new DiscMace() );

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

                    if ( !Core.AOS )
                    {
                        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 );
                    book.LootType = LootType.Blessed;
                    EquipItem( book );

                    if ( elf )
                    {
                        EquipItem( new Circlet() );

                        if( m.Female )
                            EquipItem( new FemaleElvenRobe( Utility.RandomBlueHue() ) );
                        else
                            EquipItem( new MaleElvenRobe( Utility.RandomBlueHue() ) );
                    }
                    else
                    {
                        if ( human )
                        EquipItem( new WizardsHat() );

                        EquipItem( new Robe( Utility.RandomBlueHue() ) );
                    }

                    break;
                }
                case SkillName.Mining:
                {
                    PackItem( new Pickaxe() );
                    break;
                }
                case SkillName.Musicianship:
                {
                    PackInstrument();
                    break;
                }
                case SkillName.Necromancy:
                {
                    if( Core.ML )
                    {
                        Container regs = new BagOfNecroReagents( 50 );
                        PackItem( regs );
                        regs.LootType = LootType.Regular;
                    }

                    // RunUO fix
                    Spellbook book = new NecromancerSpellbook( (ulong)0x8981 ); // animate dead, evil omen, pain spike, summon familiar, wraith form
                    book.LootType = LootType.Blessed;
                    PackItem( book );

                    break;
                }
                case SkillName.Ninjitsu:
                {
                    if ( human || elf )
                    {
                    EquipItem( new Hakama( 0x2C3 ) );    //Only ninjas get the hued one.
                    EquipItem( new Kasa() );
                    }

                    EquipItem( new BookOfNinjitsu() );
                    break;
                }
                case SkillName.Parry:
                {
                    if ( human || elf )
                    EquipItem( new WoodenShield() );
                    else if ( gargoyle )
                        EquipItem( new GargishWoodenShield() );

                    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( 20 ) );
                    break;
                }
                case SkillName.SpiritSpeak:
                {
                    if ( human || elf )
                    {
                    EquipItem( new Cloak( 0x455 ) );
                    }

                    break;
                }
                case SkillName.Stealing:
                {
                    PackItem( new Lockpick( 20 ) );
                    break;
                }
                case SkillName.Swords:
                {
                    if ( elf )
                        EquipItem( new RuneBlade() );
                    else if ( human )
                        EquipItem( new Katana() );
                    else if ( gargoyle )
                        EquipItem( new GlassSword() );

                    break;
                }
                case SkillName.Tactics:
                {
                    if ( elf )
                        EquipItem( new RuneBlade() );
                    else if ( human )
                        EquipItem( new Katana() );
                    else if ( gargoyle )
                        EquipItem( new GlassSword() );

                    break;
                }
                case SkillName.Tailoring:
                {
                    PackItem( new BoltOfCloth() );
                    PackItem( new SewingKit() );
                    break;
                }
                case SkillName.Tracking:
                {
                    if ( human || elf )
                    {
                    if ( m_Mobile != null )
                    {
                        Item shoes = m_Mobile.FindItemOnLayer( Layer.Shoes );

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

                    int hue = Utility.RandomYellowHue();

                    if ( elf )
                        EquipItem( new ElvenBoots( hue ) );
                    else
                        EquipItem( new Boots( hue ) );

                    EquipItem( new SkinningKnife() );
                    }
                    else if ( gargoyle )
                        PackItem( new SkinningKnife() );

                    break;
                }
                case SkillName.Veterinary:
                {
                    PackItem( new Bandage( 5 ) );
                    PackItem( new Scissors() );
                    break;
                }
                case SkillName.Wrestling:
                {
                    if ( elf )
                        EquipItem( new LeafGloves() );
                    else if ( human )
                        EquipItem( new LeatherGloves() );
                    else if ( gargoyle )
                    {
                        // Why not give them arm armor?
                        EquipItem( new GargishLeatherArms() );
                    }

                    break;
                }
                case SkillName.Throwing:
                {
                    if ( gargoyle )
                        EquipItem( new Boomerang() );

                    break;
                }
            }
        }
    }
}
 

aberent

Page
Thanks I am going to try this tonight see what results I get.

I am assuming my players will still be able to use older clients after this patch?
 

robynuo

Sorceror
He missed some 'i' in there, else It seems fine :)
Code:
        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 == 120 ) || ( total == 100 );
        }
 

EvilPounder420

Sorceror
Ok, i know everything is right script-wise as far as this tutorial goes, but when i load the server it loads, runs, and seems stable.
But when i go to log on this is what i get...

Code:
Core: Using dual save strategy
World: Saving...done in 0.01 seconds.
System.Net.Sockets.SocketException: An existing connection was forcibly closed b
y the remote host
  at System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags, AsyncCallback callback, Object state)
  at Server.Network.NetState.InternalBeginReceive() in c:\Users\D-Roc\Desktop\`
RunUO 2.0 SVN 526 + ML Latest + SA 1.5\RunUO 2.0 SVN 526 + ML Latest + SA 1.5\Se
rver\Network\NetState.cs:line 121
  at Server.Network.NetState.Start() in c:\Users\D-Roc\Desktop\`RunUO 2.0 SVN 5
26 + ML Latest + SA 1.5\RunUO 2.0 SVN 526 + ML Latest + SA 1.5\Server\Network\Ne
tState.cs:line 766
Client: 192.168.1.68: Disconnected. [0 Online]
System.Net.Sockets.SocketException: An existing connection was forcibly closed b
y the remote host
  at System.Net.Sockets.Socket.EndAccept(Byte[]& buffer, Int32& bytesTransferre
d, IAsyncResult asyncResult)
  at System.Net.Sockets.Socket.EndAccept(IAsyncResult asyncResult)
  at Server.Network.Listener.OnAccept(IAsyncResult asyncResult) in c:\Users\D-R
oc\Desktop\`RunUO 2.0 SVN 526 + ML Latest + SA 1.5\RunUO 2.0 SVN 526 + ML Latest
+ SA 1.5\Server\Network\Listener.cs:line 132
System.Net.Sockets.SocketException: An existing connection was forcibly closed b
y the remote host
  at System.Net.Sockets.Socket.EndAccept(Byte[]& buffer, Int32& bytesTransferre
d, IAsyncResult asyncResult)
  at System.Net.Sockets.Socket.EndAccept(IAsyncResult asyncResult)
  at Server.Network.Listener.OnAccept(IAsyncResult asyncResult) in c:\Users\D-R
oc\Desktop\`RunUO 2.0 SVN 526 + ML Latest + SA 1.5\RunUO 2.0 SVN 526 + ML Latest
+ SA 1.5\Server\Network\Listener.cs:line 132

It seems to repeat itself until i close the client.
Any suggestions or am i doing something wrong?
 
Top