Example #1
0
        private static void LoginConfirm( PacketReader p, PacketHandlerEventArgs args )
        {
            World.Items.Clear();
            World.Mobiles.Clear();

            UseNewStatus = false;

            Serial serial = p.ReadUInt32();

            PlayerData m = new PlayerData( serial );
            m.Name = World.OrigPlayerName;

            Mobile test = World.FindMobile( serial );
            if ( test != null )
                test.Remove();

            World.AddMobile( World.Player = m );
            Config.LoadProfileFor( World.Player );

            PlayerData.ExternalZ = false;

            p.ReadUInt32(); // always 0?
            m.Body = p.ReadUInt16();
            m.Position = new Point3D( p.ReadUInt16(), p.ReadUInt16(), p.ReadInt16() );
            m.Direction = (Direction)p.ReadByte();
            m.Resync();

            //ClientCommunication.SendToServer( new SkillsQuery( m ) );
            //ClientCommunication.SendToServer( new StatusQuery( m ) );

            ClientCommunication.RequestTitlebarUpdate();
            ClientCommunication.PostLogin( (int)serial.Value );
            Engine.MainWindow.UpdateTitle(); // update player name & shard name
            /*
            //the rest of the packet: (total length: 37)
            m_Stream.Write( (byte) 0 );
            m_Stream.Write( (int) -1 );

            m_Stream.Write( (short) 0 );
            m_Stream.Write( (short) 0 );
            m_Stream.Write( (short) (map==null?6144:map.Width) );
            m_Stream.Write( (short) (map==null?4096:map.Height) );

            Stream.Fill();
            */

            ClientCommunication.BeginCalibratePosition();
        }
Example #2
0
        private static void DoLogin( PlayerData player )
        {
            PlayerData.ExternalZ = false;

            ClientCommunication.ForceSendToClient( new LoginConfirm( player ) );
            ClientCommunication.ForceSendToClient( new MapChange( player.Map ) );
            ClientCommunication.ForceSendToClient( new MapPatches( player.MapPatches ) );
            ClientCommunication.ForceSendToClient( new SeasonChange( player.Season, true ) );
            ClientCommunication.ForceSendToClient( new SupportedFeatures( player.Features ) );
            ClientCommunication.ForceSendToClient( new MobileUpdate( player ) );
            ClientCommunication.ForceSendToClient( new MobileUpdate( player ) );

            ClientCommunication.ForceSendToClient( new GlobalLightLevel( player.GlobalLightLevel ) );
            ClientCommunication.ForceSendToClient( new PersonalLightLevel( player ) );

            ClientCommunication.ForceSendToClient( new MobileUpdate( player ) );
            ClientCommunication.ForceSendToClient( new MobileIncoming( player ) );
            ClientCommunication.ForceSendToClient( new MobileAttributes( player ) );
            ClientCommunication.ForceSendToClient( new SetWarMode( player.Warmode ) );

            foreach ( Item i in World.Items.Values )
            {
                if ( i.Container == null )
                {
                    ClientCommunication.ForceSendToClient( new WorldItem( i ) );
                    if ( i.HouseRevision != 0 )
                        ClientCommunication.ForceSendToClient( new DesignStateGeneral( i ) );
                }
            }

            foreach ( Mobile m in World.Mobiles.Values )
                ClientCommunication.ForceSendToClient( new MobileIncoming( m ) );

            ClientCommunication.ForceSendToClient( new SupportedFeatures( player.Features ) );

            ClientCommunication.ForceSendToClient( new MobileUpdate( player ) );
            ClientCommunication.ForceSendToClient( new MobileIncoming( player ) );
            ClientCommunication.ForceSendToClient( new MobileAttributes( player ) );
            ClientCommunication.ForceSendToClient( new SetWarMode( player.Warmode ) );
            ClientCommunication.ForceSendToClient( new MobileIncoming( player ) );

            ClientCommunication.ForceSendToClient( new LoginComplete() );
            ClientCommunication.ForceSendToClient( new CurrentTime() );

            ClientCommunication.ForceSendToClient( new SeasonChange( player.Season, true ) );
            ClientCommunication.ForceSendToClient( new MapChange( player.Map ) );
            ClientCommunication.ForceSendToClient( new MobileUpdate( player ) );
            ClientCommunication.ForceSendToClient( new MobileIncoming( player ) );

            PacketHandlers.PlayCharTime = DateTime.Now;

            ClientCommunication.BeginCalibratePosition();
        }
Example #3
0
 public PersonalLightLevel( PlayerData m )
     : base(0x4E, 6)
 {
     Write( (int) m.Serial );
     Write( (sbyte) m.LocalLightLevel );
 }
Example #4
0
        public StatLockInfo( PlayerData m )
            : base(0xBF)
        {
            this.EnsureCapacity( 12 );

            Write( (short) 0x19 );
            Write( (byte) 2 );
            Write( (int) m.Serial );
            Write( (byte) 0 );

            int lockBits = 0;

            lockBits |= (int)m.StrLock << 4;
            lockBits |= (int)m.DexLock << 2;
            lockBits |= (int)m.IntLock;

            Write( (byte) lockBits );
        }
Example #5
0
        public MobileAttributes( PlayerData m )
            : base(0x2D, 17)
        {
            Write( m.Serial );

            Write( (short) m.HitsMax );
            Write( (short) m.Hits );

            Write( (short) m.ManaMax );
            Write( (short) m.Mana );

            Write( (short) m.StamMax );
            Write( (short) m.Stam );
        }
Example #6
0
        public MobileStatusExtended( PlayerData m )
            : base(0x11)
        {
            string name = m.Name;
            if ( name == null ) name = "";

            this.EnsureCapacity( 88 );

            Write( (uint) m.Serial );
            WriteAsciiFixed( name, 30 );

            Write( (short) m.Hits );
            Write( (short) m.HitsMax );

            Write( false ); // cannot edit name

            Write( (byte) 0x03 ); // no aos info

            Write( m.Female );

            Write( (short) m.Str );
            Write( (short) m.Dex );
            Write( (short) m.Int );

            Write( (short) m.Stam );
            Write( (short) m.StamMax );

            Write( (short) m.Mana );
            Write( (short) m.ManaMax );

            Write( (int) m.Gold );
            Write( (short) m.AR );
            Write( (short) m.Weight );
            Write( (short) m.StatCap );
            Write( (byte) m.Followers );
            Write( (byte) m.FollowersMax );
        }
Example #7
0
 public CriminalTimer( PlayerData player )
     : base(TimeSpan.FromSeconds( 1 ), TimeSpan.FromSeconds( 1 ))
 {
     m_Player = player;
 }
Example #8
0
 public static void SetProfileFor( PlayerData player )
 {
     if ( m_Current != null )
         m_Chars[player.Serial] = m_Current.Name;
 }
Example #9
0
        public static void LoadProfileFor( PlayerData player )
        {
            if ( m_Chars == null )
                m_Chars = new Hashtable();
            string prof = m_Chars[player.Serial] as string;
            if ( m_Current != null && prof != null && ( m_Current.Name == prof || m_Current.Name.Trim() == prof.Trim() ) )
                return;

            if ( prof != null )
            {
                Save();

                if ( !LoadProfile( prof ) )
                {
                    if ( prof != "default" )
                    {
                        if ( !LoadProfile( "default" ) )
                            m_Current.MakeDefault();
                    }
                    else
                    {
                        m_Current.MakeDefault();
                    }
                }

                Engine.MainWindow.InitConfig();
            }
            else
            {
                m_Chars.Add( player.Serial, m_Current != null ? m_Current.Name : "default" );
            }
            Engine.MainWindow.SelectProfile( m_Current == null ? "default" : m_Current.Name );
        }
Example #10
0
 public CriminalTimer(PlayerData player) : base(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1))
 {
     m_Player = player;
 }
Example #11
0
        internal bool UpdateContainer()
        {
            if (!(m_Parent is Serial) || Deleted)
            {
                return(true);
            }

            object o       = null;
            Serial contSer = (Serial)m_Parent;

            if (contSer.IsItem)
            {
                o = World.FindItem(contSer);
            }
            else if (contSer.IsMobile)
            {
                o = World.FindMobile(contSer);
            }

            if (o == null)
            {
                return(false);
            }

            m_Parent = o;

            if (m_Parent is Item)
            {
                ((Item)m_Parent).AddItem(this);
            }
            else if (m_Parent is Mobile)
            {
                ((Mobile)m_Parent).AddItem(this);
            }

            if (World.Player != null && (IsChildOf(World.Player.Backpack) || IsChildOf(World.Player.Quiver)))
            {
                if (m_IsNew)
                {
                    if (m_AutoStack)
                    {
                        AutoStackResource();
                    }

                    if (IsContainer && (!IsPouch || !RazorEnhanced.Settings.General.ReadBool("NoSearchPouches")) && RazorEnhanced.Settings.General.ReadBool("AutoSearch"))
                    {
                        PacketHandlers.IgnoreGumps.Add(this);
                        PlayerData.DoubleClick(this);

                        for (int c = 0; c < Contains.Count; c++)
                        {
                            Item icheck = (Item)Contains[c];
                            if (icheck.IsContainer && (!icheck.IsPouch || !RazorEnhanced.Settings.General.ReadBool("NoSearchPouches")))
                            {
                                PacketHandlers.IgnoreGumps.Add(icheck);
                                PlayerData.DoubleClick(icheck);
                            }
                        }
                    }
                }
            }
            m_AutoStack = m_IsNew = false;

            return(true);
        }