Ejemplo n.º 1
0
        public static void OnReceive( GameClient state, PacketReader pvSrc )
        {
            if ( pvSrc.ReadByte() == 0xFF )
                state.Send( new UOGInfo( String.Format( ", Name={0}, Age={1}, Clients={2}, Items={3}, Chars={4}, Mem={5}K", Environment.Config.ServerName, (int) ( DateTime.Now - Server.Items.Clock.ServerStart ).TotalHours, GameServer.Instance.ClientCount, World.Instance.ItemCount, World.Instance.MobileCount, (int) ( System.GC.GetTotalMemory( false ) / 1024 ) ) ) );

            state.Dispose();
        }
Ejemplo n.º 2
0
        public override void SendInfoTo( GameClient state )
        {
            Mobile mob = state.Mobile;

            if ( mob != null && mob.AccessLevel >= AccessLevel.GameMaster )
            {
                state.Send( new GMItemPacket( this ) );
            }
            else
            {
                state.Send( GetWorldPacketFor( state ) );
            }

            if ( ObjectPropertyListPacket.Enabled )
            {
                state.Send( OPLPacket );
            }
        }
Ejemplo n.º 3
0
        public static void SendEverything(this Mobile from)
        {
            GameClient ns = from.Client;

            if (from.Map != null && ns != null)
            {
                foreach (object o in from.Map.GetObjectsInRange(from.Location, Mobile.GlobalMaxUpdateRange))
                {
                    if (o is Item)
                    {
                        Item item = (Item)o;

                        if (from.CanSee(item) && from.InRange(item.Location, item.GetUpdateRange(from)))
                        {
                            item.SendInfoTo(ns);
                        }
                    }
                    else if (o is Mobile)
                    {
                        Mobile m = (Mobile)o;

                        if (from.CanSee(m) && from.InUpdateRange(m))
                        {
                            ns.Send(new MobileIncoming(from, m));

                            if (m.IsDeadBondedPet)
                            {
                                ns.Send(new BondedStatus(0, m.Serial, 1));
                            }

                            if (ObjectPropertyListPacket.Enabled)
                            {
                                ns.Send(m.OPLPacket);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private static void Mobile_Damaged(Mobile m, DamagedEventArgs args)
        {
            int    amount = args.Amount;
            Mobile from   = args.From;

            GameClient ourState = m.Client, theirState = (from == null ? null : from.Client);

            if (ourState == null)
            {
                Mobile master = m.GetDamageMaster(from);

                if (master != null)
                {
                    ourState = master.Client;
                }
            }

            if (theirState == null && from != null)
            {
                Mobile master = from.GetDamageMaster(m);

                if (master != null)
                {
                    theirState = master.Client;
                }
            }

            if (amount > 0 && (ourState != null || theirState != null))
            {
                Packet p = Packet.Acquire(new DamagePacket(m, amount));

                if (ourState != null)
                {
                    ourState.Send(p);
                }

                if (theirState != null && theirState != ourState)
                {
                    theirState.Send(p);
                }

                Packet.Release(p);
            }
        }
Ejemplo n.º 5
0
 public void LogoutReq( GameClient state, PacketReader pvSrc )
 {
     state.Send( LogoutAck.Instance );
 }
Ejemplo n.º 6
0
        public void MovementReq( GameClient state, PacketReader pvSrc )
        {
            Direction dir = (Direction) pvSrc.ReadByte();
            int seq = pvSrc.ReadByte();
            /*int key = */
            pvSrc.ReadInt32();

            Mobile m = state.Mobile;

            if ( ( state.Sequence == 0 && seq != 0 ) || !m.Move( dir ) )
            {
                state.Send( new MovementRej( seq, m ) );
                state.Sequence = 0;

                m.ClearFastwalkStack();
            }
            else
            {
                ++seq;

                if ( seq == 256 )
                    seq = 1;

                state.Sequence = seq;
            }
        }
Ejemplo n.º 7
0
 public void SendTo( GameClient state )
 {
     state.Send( new DisplayHuePicker( this ) );
     state.AddHuePicker( this );
 }
Ejemplo n.º 8
0
 public void SendTo( GameClient state )
 {
     state.AddGump( this );
     state.Send( Compile() );
 }
Ejemplo n.º 9
0
        public override void SendInfoTo( GameClient state )
        {
            base.SendInfoTo( state );

            if ( ItemID == 0x2006 || GetFlag( CorpseFlag.Instanced ) )
            {
                state.Send( new CorpseContent( state.Mobile, this ) );
                state.Send( new CorpseEquip( state.Mobile, this ) );
            }
        }
Ejemplo n.º 10
0
 public void SendDetailedInfoTo( GameClient state )
 {
     if ( state != null )
     {
         lock ( this )
         {
             if ( m_PacketCache == null )
                 DesignStateDetailed.SendDetails( state, m_Foundation, this );
             else
                 state.Send( m_PacketCache );
         }
     }
 }
Ejemplo n.º 11
0
        public void AccountLogin_ReplyAck( GameClient state )
        {
            ServerListEventArgs e = new ServerListEventArgs( state, state.Account );

            try
            {
                EventSink.Instance.InvokeServerList( e );
            }
            catch ( Exception ex )
            {
                Logger.Error( "Exception disarmed in ServerList: {0}", ex );
                e.Rejected = true;
            }

            if ( e.Rejected )
            {
                state.Account = null;
                state.Send( new AccountLoginRej( ALRReason.BadComm ) );
                state.Dispose();
            }
            else
            {
                ServerInfo[] info = e.Servers.ToArray();

                state.ServerInfo = info;

                state.Send( new AccountLoginAck( info ) );
            }
        }
Ejemplo n.º 12
0
 public void SetUpdateRange( GameClient state, PacketReader pvSrc )
 {
     state.Send( ChangeUpdateRange.Instantiate( 18 ) );
 }
Ejemplo n.º 13
0
        public void Resynchronize( GameClient state, PacketReader pvSrc )
        {
            Mobile m = state.Mobile;

            state.Send( new MobileUpdate( m ) );
            state.Send( new MobileIncoming( m, m ) );

            m.SendEverything();

            state.Sequence = 0;

            m.ClearFastwalkStack();
        }
Ejemplo n.º 14
0
        public void PlayServer( GameClient state, PacketReader pvSrc )
        {
            int index = pvSrc.ReadInt16();

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

            if ( info == null || a == null || index < 0 || index >= info.Length )
            {
                state.Dispose();
            }
            else
            {
                ServerInfo si = info[index];

                state.m_AuthID = PlayServerAck.m_AuthID = GenerateAuthID( state );

                state.SentFirstPacket = false;
                state.Send( new PlayServerAck( si ) );

                // Close the connection, since they will be redirected to the game server.
                state.Dispose();
            }
        }
Ejemplo n.º 15
0
        public void PlayCharacter( GameClient state, PacketReader pvSrc )
        {
            pvSrc.ReadInt32(); // 0xEDEDEDED

            /*string name = */
            pvSrc.ReadString( 30 );

            pvSrc.Seek( 2, SeekOrigin.Current );
            int flags = pvSrc.ReadInt32();
            pvSrc.Seek( 24, SeekOrigin.Current );

            int charSlot = pvSrc.ReadInt32();
            uint clientIP = pvSrc.ReadUInt32();

            clientIP = (uint) IPAddress.NetworkToHostOrder( (int) clientIP );
            state.ClientAddress = new IPAddress( (long) clientIP );

            IAccount a = state.Account;

            if ( Utility.IsUsingMulticlient( state, Environment.Config.Login.MaxLoginsPerPC ) )
            {
                Console.WriteLine( "Login: {0}: Multiclient detected, disconnecting...", state );
                state.Send( new PopupMessage( PMMessage.LoginSyncError ) );
                state.Dispose();
                return;
            }

            if ( a == null || charSlot < 0 || charSlot >= a.Length )
            {
                state.Dispose();
            }
            else
            {
                Mobile m = a[charSlot];

                // 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 && check != m )
                    {
                        Console.WriteLine( "Login: {0}: Account in use", state );
                        state.Send( new PopupMessage( PMMessage.CharInWorld ) );
                        return;
                    }
                }

                if ( m == null )
                {
                    state.Dispose();
                }
                else
                {
                    if ( m.Client != null )
                        m.Client.Dispose();

                    GameServer.Instance.ProcessDisposedQueue();

                    state.BlockAllPackets = true;

                    state.Flags = flags;

                    state.Mobile = m;
                    m.Client = state;

                    state.BlockAllPackets = false;
                    DoLogin( state, m );
                }
            }
        }
Ejemplo n.º 16
0
 public void PingReq( GameClient state, PacketReader pvSrc )
 {
     state.Send( PingAck.Instantiate( pvSrc.ReadByte() ) );
 }
Ejemplo n.º 17
0
        private static void Mobile_LocationChanged(Mobile from, LocationChangedEventArgs args)
        {
            Point3D oldLocation = args.OldLocation;
            Point3D newLocation = args.NewLocation;
            bool    isTeleport  = args.IsTeleport;

            Map map = from.Map;

            if (map != null)
            {
                // First, send a remove message to everyone who can no longer see us. (inOldRange && !inNewRange)
                Packet removeThis = null;

                foreach (GameClient ns in map.GetClientsInRange(oldLocation))
                {
                    if (ns != from.Client && !ns.Mobile.InUpdateRange(newLocation))
                    {
                        if (removeThis == null)
                        {
                            removeThis = from.RemovePacket;
                        }

                        ns.Send(removeThis);
                    }
                }

                GameClient ourState = from.Client;

                // Check to see if we are attached to a client
                if (ourState != null)
                {
                    // We are attached to a client, so it's a bit more complex. We need to send new items and people to ourself, and ourself to other clients
                    foreach (object o in map.GetObjectsInRange(newLocation, Mobile.GlobalMaxUpdateRange))
                    {
                        if (o is Item)
                        {
                            Item item = (Item)o;

                            if (!item.InUpdateRange(oldLocation) && item.InUpdateRange(newLocation) && from.CanSee(item))
                            {
                                item.SendInfoTo(ourState);
                            }
                        }
                        else if (o != from && o is Mobile)
                        {
                            Mobile m = (Mobile)o;

                            if (!m.InUpdateRange(newLocation))
                            {
                                continue;
                            }

                            bool inOldRange = m.InUpdateRange(oldLocation);

                            if ((isTeleport || !inOldRange) && m.Client != null && m.CanSee(from))
                            {
                                m.Client.Send(new MobileIncoming(m, from));

                                if (from.IsDeadBondedPet)
                                {
                                    m.Client.Send(new BondedStatus(0, from.Serial, 1));
                                }

                                if (ObjectPropertyListPacket.Enabled)
                                {
                                    m.Client.Send(from.OPLPacket);
                                }
                            }

                            if (!inOldRange && from.CanSee(m))
                            {
                                ourState.Send(new MobileIncoming(from, m));

                                if (m.IsDeadBondedPet)
                                {
                                    ourState.Send(new BondedStatus(0, m.Serial, 1));
                                }

                                if (ObjectPropertyListPacket.Enabled)
                                {
                                    ourState.Send(m.OPLPacket);
                                }
                            }
                        }
                    }
                }
                else
                {
                    // We're not attached to a client, so simply send an Incoming
                    foreach (GameClient ns in map.GetClientsInRange(newLocation))
                    {
                        if ((isTeleport || !ns.Mobile.InUpdateRange(oldLocation)) && ns.Mobile.CanSee(from))
                        {
                            ns.Send(new MobileIncoming(ns.Mobile, from));

                            if (from.IsDeadBondedPet)
                            {
                                ns.Send(new BondedStatus(0, from.Serial, 1));
                            }

                            if (ObjectPropertyListPacket.Enabled)
                            {
                                ns.Send(from.OPLPacket);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 18
0
        public void UTripTime( GameClient state, PacketReader pvSrc )
        {
            int unk1 = pvSrc.ReadByte();
            /*int unk2 = */
            pvSrc.ReadInt32();

            state.Send( new UTripTimeResponse( unk1 ) );
        }
Ejemplo n.º 19
0
        public void VendorBuyReply( GameClient state, PacketReader pvSrc )
        {
            pvSrc.Seek( 1, SeekOrigin.Begin );

            int msgSize = pvSrc.ReadUInt16();
            Mobile vendor = World.Instance.FindMobile( pvSrc.ReadInt32() );
            byte flag = pvSrc.ReadByte();

            if ( vendor == null )
            {
                return;
            }
            else if ( vendor.Deleted || !Utility.RangeCheck( vendor.Location, state.Mobile.Location, 10 ) )
            {
                state.Send( new EndVendorBuy( vendor ) );
                return;
            }

            if ( flag == 0x02 )
            {
                msgSize -= 1 + 2 + 4 + 1;

                if ( ( msgSize / 7 ) > 100 )
                    return;

                List<BuyItemResponse> buyList = new List<BuyItemResponse>( msgSize / 7 );
                for ( ; msgSize > 0; msgSize -= 7 )
                {
                    /*byte layer = */
                    pvSrc.ReadByte();
                    Serial serial = pvSrc.ReadInt32();
                    int amount = pvSrc.ReadInt16();

                    buyList.Add( new BuyItemResponse( serial, amount ) );
                }

                if ( buyList.Count > 0 )
                {
                    IVendor v = vendor as IVendor;

                    if ( v != null && v.OnBuyItems( state.Mobile, buyList ) )
                        state.Send( new EndVendorBuy( vendor ) );
                }
            }
            else
            {
                state.Send( new EndVendorBuy( vendor ) );
            }
        }
Ejemplo n.º 20
0
 public void SendTo( GameClient state )
 {
     state.AddMenu( this );
     state.Send( new DisplayQuestionMenu( this ) );
 }
Ejemplo n.º 21
0
        public void VendorSellReply( GameClient state, PacketReader pvSrc )
        {
            Serial serial = pvSrc.ReadInt32();
            Mobile vendor = World.Instance.FindMobile( serial );

            if ( vendor == null )
            {
                return;
            }
            else if ( vendor.Deleted || !Utility.RangeCheck( vendor.Location, state.Mobile.Location, 10 ) )
            {
                state.Send( new EndVendorSell( vendor ) );
                return;
            }

            int count = pvSrc.ReadUInt16();
            if ( count < 100 && pvSrc.Size == ( 1 + 2 + 4 + 2 + ( count * 6 ) ) )
            {
                List<SellItemResponse> sellList = new List<SellItemResponse>( count );

                for ( int i = 0; i < count; i++ )
                {
                    Item item = World.Instance.FindItem( pvSrc.ReadInt32() );
                    int Amount = pvSrc.ReadInt16();

                    if ( item != null && Amount > 0 )
                        sellList.Add( new SellItemResponse( item, Amount ) );
                }

                if ( sellList.Count > 0 )
                {
                    IVendor v = vendor as IVendor;

                    if ( v != null && v.OnSellItems( state.Mobile, sellList ) )
                        state.Send( new EndVendorSell( vendor ) );
                }
            }
        }
Ejemplo n.º 22
0
 public void SendGeneralInfoTo( GameClient state )
 {
     if ( state != null )
         state.Send( new DesignStateGeneral( m_Foundation, this ) );
 }
Ejemplo n.º 23
0
 public void AccountLogin_ReplyRej( GameClient state, ALRReason reason )
 {
     state.Send( new AccountLoginRej( reason ) );
     state.Dispose();
 }
Ejemplo n.º 24
0
 public void SendTo( GameClient state )
 {
     state.AddMenu( this );
     state.Send( new DisplayItemListMenu( this ) );
 }
Ejemplo n.º 25
0
        public virtual void SendInfoTo( GameClient state )
        {
            state.Send( GetWorldPacketFor( state ) );

            if ( SendOplPacket )
                state.Send( OPLPacket );
        }
Ejemplo n.º 26
0
        public static void QueryPartyLocations( GameClient state, PacketReader pvSrc )
        {
            Mobile from = state.Mobile;
            Party party = Party.Get( from );

            if ( party != null )
            {
                AckPartyLocations ack = new AckPartyLocations( from, party );

                if ( ack.Stream.Length > 8 )
                    state.Send( ack );
            }
        }
Ejemplo n.º 27
0
        public void PrivateOverheadMessage( MessageType type, int hue, int number, string args, GameClient state )
        {
            if ( state == null )
                return;

            state.Send( new MessageLocalized( this.Serial, Body, type, hue, 3, number, Name, args ) );
        }
Ejemplo n.º 28
0
        public void CreateCharacterEnhanced( GameClient state, PacketReader pvSrc )
        {
            pvSrc.ReadInt32(); // 0xEDEDEDED

            /*int charSlot = */
            pvSrc.ReadInt32();

            string name = pvSrc.ReadString( 30 );

            pvSrc.Seek( 30, SeekOrigin.Current );

            int prof = pvSrc.ReadByte();
            int cityIndex = pvSrc.ReadByte();
            int genderId = pvSrc.ReadByte();
            int raceId = pvSrc.ReadByte();

            int str = pvSrc.ReadByte();
            int dex = pvSrc.ReadByte();
            int intl = pvSrc.ReadByte();

            int hue = pvSrc.ReadUInt16();

            pvSrc.Seek( 8, SeekOrigin.Current );

            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();

            pvSrc.Seek( 25, SeekOrigin.Current );

            pvSrc.ReadByte(); // 0x0B
            int hairHue = pvSrc.ReadInt16();
            int hairVal = pvSrc.ReadInt16();

            pvSrc.ReadByte(); // 0x0C
            int pantsHue = pvSrc.ReadInt16();
            /*int pantsVal = */
            pvSrc.ReadInt16();

            pvSrc.ReadByte(); // 0x0D
            int shirtHue = pvSrc.ReadInt16();
            /*int shirtVal = */
            pvSrc.ReadInt16();

            pvSrc.ReadByte(); // 0x0F
            /*int faceHue = */
            pvSrc.ReadInt16();
            /*int faceVal = */
            pvSrc.ReadInt16();

            pvSrc.ReadByte(); // 0x10
            int hairValf = pvSrc.ReadInt16();
            int hairHuef = pvSrc.ReadInt16();

            // male=0, female=1
            bool female = ( genderId == 1 );

            // human=0, elf=1, gargoyle=2
            raceId = raceId - 1; // convert to zero-based
            if ( raceId < 0 )
                raceId = 0;
            if ( raceId >= Race.Races.Length )
                raceId = Race.Races.Length;

            Race race = Race.Races[raceId];
            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;
                    }
                }

                CreateCharRequestEventArgs args = new CreateCharRequestEventArgs(
                    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.BlockAllPackets = true;

                try
                {
                    EventSink.Instance.InvokeCreateCharRequest( args );
                }
                catch ( Exception ex )
                {
                    Logger.Error( "Exception disarmed in CreateCharRequest {0}: {1}", name, ex );
                }

                Mobile m = args.Mobile;

                if ( m != null )
                {
                    state.Mobile = m;
                    m.Client = state;

                    state.BlockAllPackets = false;

                    try
                    {
                        EventSink.Instance.InvokeCharacterCreated( new CharacterCreatedEventArgs( m ) );
                    }
                    catch ( Exception ex )
                    {
                        Logger.Error( "Exception disarmed in CharacterCreated {0}: {1}", m, ex );
                    }

                    DoLogin( state, m );
                }
                else
                {
                    state.BlockAllPackets = false;
                    state.Dispose();
                }
            }
        }
Ejemplo n.º 29
0
        public void MobileNameRequest( GameClient state, PacketReader pvSrc )
        {
            Mobile m = World.Instance.FindMobile( pvSrc.ReadInt32() );

            if ( m != null && state.Mobile.InUpdateRange( m ) && state.Mobile.CanSee( m ) )
                state.Send( new MobileName( m ) );
        }
Ejemplo n.º 30
0
        public void PrivateOverheadMessage( MessageType type, int hue, bool ascii, string text, GameClient state )
        {
            if ( state == null )
                return;

            if ( ascii )
                state.Send( new AsciiMessage( this.Serial, Body, type, hue, 3, Name, text ) );
            else
                state.Send( new UnicodeMessage( this.Serial, Body, type, hue, 3, m_Language, Name, text ) );
        }
Ejemplo n.º 31
0
        public void CreateCharacterNew( GameClient state, PacketReader pvSrc )
        {
            /*int unk1 = */
            pvSrc.ReadInt32();
            /*int unk2 = */
            pvSrc.ReadInt32();
            /*int unk3 = */
            pvSrc.ReadByte();
            string name = pvSrc.ReadString( 30 );

            pvSrc.Seek( 2, SeekOrigin.Current );
            int flags = pvSrc.ReadInt32();
            pvSrc.Seek( 8, SeekOrigin.Current );
            int prof = pvSrc.ReadByte();
            pvSrc.Seek( 15, SeekOrigin.Current );

            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();
            uint clientIP = pvSrc.ReadUInt32();
            int shirtHue = pvSrc.ReadInt16();
            int pantsHue = pvSrc.ReadInt16();

            /*
            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;

            byte raceId = (byte) ( genderRace < 4 ? 0 : ( ( genderRace / 2 ) - 1 ) );
            race = Race.Races[raceId];

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

            clientIP = (uint) IPAddress.NetworkToHostOrder( (int) clientIP );

            state.ClientAddress = new IPAddress( (long) clientIP );

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

            if ( Utility.IsUsingMulticlient( state, Environment.Config.Login.MaxLoginsPerPC ) )
            {
                Console.WriteLine( "Login: {0}: Multiclient detected, disconnecting...", state );
                state.Send( new PopupMessage( PMMessage.LoginSyncError ) );
                state.Dispose();
                return;
            }

            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 = flags;

                CreateCharRequestEventArgs args = new CreateCharRequestEventArgs(
                    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.BlockAllPackets = true;

                try
                {
                    EventSink.Instance.InvokeCreateCharRequest( args );
                }
                catch ( Exception ex )
                {
                    Logger.Error( "Exception disarmed in CreateCharRequest {0}: {1}", name, ex );
                }

                Mobile m = args.Mobile;

                if ( m != null )
                {
                    state.Mobile = m;
                    m.Client = state;

                    state.BlockAllPackets = false;

                    try
                    {
                        EventSink.Instance.InvokeCharacterCreated( new CharacterCreatedEventArgs( m ) );
                    }
                    catch ( Exception ex )
                    {
                        Logger.Error( "Exception disarmed in CharacterCreated {0}: {1}", m, ex );
                    }

                    DoLogin( state, m );
                }
                else
                {
                    state.BlockAllPackets = false;
                    state.Dispose();
                }
            }
        }
Ejemplo n.º 32
0
            public override void OnResponse( GameClient sender, RelayInfo info )
            {
                switch ( info.ButtonID )
                {
                    case 1: // Go to shard website
                        {
                            sender.LaunchBrowser( Environment.Config.Website );
                            break;
                        }
                    case 2: // List of skills
                        {
                            string[] strings = Enum.GetNames( typeof( SkillName ) );

                            Array.Sort( strings );

                            StringBuilder sb = new StringBuilder();

                            if ( strings.Length > 0 )
                            {
                                sb.Append( strings[0] );
                            }

                            for ( int i = 1; i < strings.Length; ++i )
                            {
                                string v = strings[i];

                                if ( ( sb.Length + 1 + v.Length ) >= 256 )
                                {
                                    sender.Send( new AsciiMessage( Server.Serial.MinusOne, -1, MessageType.Label, 0x35, 3, "System", sb.ToString() ) );
                                    sb = new StringBuilder();
                                    sb.Append( v );
                                }
                                else
                                {
                                    sb.Append( ' ' );
                                    sb.Append( v );
                                }
                            }

                            if ( sb.Length > 0 )
                            {
                                sender.Send( new AsciiMessage( Server.Serial.MinusOne, -1, MessageType.Label, 0x35, 3, "System", sb.ToString() ) );
                            }

                            break;
                        }
                    case 3: // Command list
                        {
                            sender.Mobile.SendAsciiMessage( 0x482, "The command prefix is \"{0}\"", Server.CommandSystem.CommandPrefix );
                            Server.Scripts.Commands.CommandHandlers.Help_OnCommand( new CommandEventArgs( sender.Mobile, "help", "", new string[0] ) );

                            break;
                        }
                }
            }
Ejemplo n.º 33
0
 public void GodModeRequest( GameClient state, PacketReader pvSrc )
 {
     if ( VerifyGC( state ) )
         state.Send( new GodModeReply( pvSrc.ReadBoolean() ) );
 }