Beispiel #1
0
        private static void MobileUpdate(PacketReader p)
        {
            if (World.Player == null)
            {
                return;
            }

            Serial serial = p.ReadUInt32();
            Mobile m      = World.FindMobile(serial);

            if (m == null)
            {
                World.AddMobile(m = new Mobile(serial));
            }
            m.Body = (ushort)(p.ReadUInt16() + p.ReadSByte());
            m.Hue  = p.ReadUInt16();
            bool wasPoisoned = m.Poisoned;

            m.ProcessPacketFlags(p.ReadByte());

            ushort x = p.ReadUInt16();
            ushort y = p.ReadUInt16();

            p.ReadUInt16();             //always 0?
            m.Direction = (Direction)p.ReadByte();
            m.Position  = new Point3D(x, y, p.ReadSByte());

            Item.UpdateContainers();
        }
Beispiel #2
0
        private static void MobileStatus(PacketReader p)
        {
            Serial serial = p.ReadUInt32();
            Mobile m      = World.FindMobile(serial);

            if (m == null)
            {
                World.AddMobile(m = new Mobile(serial));
            }

            m.Name = p.ReadString(30);

            m.Hits    = p.ReadUInt16();
            m.HitsMax = p.ReadUInt16();

            p.ReadBoolean();            //CanBeRenamed

            byte type = p.ReadByte();

            if (m == World.Player && type != 0x00)
            {
                PlayerData player = (PlayerData)m;

                player.Female = p.ReadBoolean();

                player.Str = p.ReadUInt16();
                player.Dex = p.ReadUInt16();
                player.Int = p.ReadUInt16();

                player.Stam    = p.ReadUInt16();
                player.StamMax = p.ReadUInt16();
                player.Mana    = p.ReadUInt16();
                player.ManaMax = p.ReadUInt16();

                player.Gold   = p.ReadUInt32();
                player.AR     = p.ReadUInt16();             // ar / physical resist
                player.Weight = p.ReadUInt16();

                if (type == 0x03 || type == 0x04)
                {
                    player.StatCap      = p.ReadUInt16();
                    player.Followers    = p.ReadByte();
                    player.FollowersMax = p.ReadByte();

                    if (type == 0x04)
                    {
                        /*m_Stream.Write( (short) beheld.FireResistance ); // Fire
                         * m_Stream.Write( (short) beheld.ColdResistance ); // Cold
                         * m_Stream.Write( (short) beheld.PoisonResistance ); // Poison
                         * m_Stream.Write( (short) beheld.EnergyResistance ); // Energy
                         * m_Stream.Write( (short) 0 ); // Luck
                         * m_Stream.Write( (short) 0 ); // Damage min
                         * m_Stream.Write( (short) 0 ); // Damage max*/
                        p.Seek(14, SeekOrigin.Current);
                        player.Tithe = p.ReadInt32();
                    }
                }
            }
        }
Beispiel #3
0
        private static void EndPlayback()
        {
            m_PlayTimer = null;

            m_Playing = false;
            ClientCommunication.SetAllowDisconn(true);
            //ClientCommunication.SetDeathMsg( "You are dead." );

            PlayerData player;

            using (BinaryReader reader = new BinaryReader(m_TempWriter.BaseStream))
            {
                reader.BaseStream.Seek(0, SeekOrigin.Begin);
                player = World.Player = new PlayerData(reader, PlayerVersion);
            }
            m_TempWriter.Close();

            player.Contains.Clear();
            World.AddMobile(player);

            DoLogin(player);

            tbPos.Enabled = btnClose.Enabled = btnPlay.Enabled = btnStop.Enabled = btnRec.Enabled = true;
            tbPos.Value   = tbPos.Minimum;

            m_Elapsed = TimeSpan.Zero;
            UpdateTimeText();

            ClientCommunication.SendToClient(new MoveReject(World.Player.WalkSequence, World.Player));
            ClientCommunication.SendToServer(new ResyncReq());
            World.Player.Resync();
            ClientCommunication.RequestTitlebarUpdate();

            if (ClientCommunication.AllowBit(FeatureBit.LightFilter) && World.Player != null)
            {
                World.Player.LocalLightLevel = 0;

                ClientCommunication.SendToClient(new GlobalLightLevel(0));
                ClientCommunication.SendToClient(new PersonalLightLevel(World.Player));
            }
        }
Beispiel #4
0
        private static void LoadWorldState()
        {
            int end = m_GZIn.Compressed.ReadInt32();

            end += (int)m_GZIn.Position;

            try
            {
                World.AddMobile(World.Player = new PlayerData(m_GZIn.Compressed, m_Version));
                while (m_GZIn.Position < end)
                {
                    byte type = m_GZIn.Compressed.ReadByte();
                    if (type == 1)
                    {
                        World.AddMobile(new Mobile(m_GZIn.Compressed, m_Version));
                    }
                    else if (type == 0)
                    {
                        World.AddItem(new Item(m_GZIn.Compressed, m_Version));
                    }
                }
            }
            catch (Exception e)
            {
                new MessageDialog("Error Reading PacketVideo", true, e.ToString()).ShowDialog(Engine.ActiveWindow);
            }

            foreach (Mobile m in World.Mobiles.Values)
            {
                m.AfterLoad();
            }

            foreach (Item i in World.Items.Values)
            {
                i.AfterLoad();
            }
        }
Beispiel #5
0
        private static void MobileIncoming(PacketReader p)
        {
            Serial  serial   = p.ReadUInt32();
            ushort  body     = p.ReadUInt16();
            Point3D position = new Point3D(p.ReadUInt16(), p.ReadUInt16(), p.ReadSByte());

            if (Utility.Distance(World.Player.Position, position) > 18)
            {
                return;
            }

            Mobile m = World.FindMobile(serial);

            if (m == null)
            {
                World.AddMobile(m = new Mobile(serial));
            }

            bool wasHidden = !m.Visible;

            m.Body      = body;
            m.Position  = position;
            m.Direction = (Direction)p.ReadByte();
            m.Hue       = p.ReadUInt16();
            bool wasPoisoned = m.Poisoned;

            m.ProcessPacketFlags(p.ReadByte());
            byte oldNoto = m.Notoriety;

            m.Notoriety = p.ReadByte();

            while (true)
            {
                serial = p.ReadUInt32();
                if (!serial.IsItem)
                {
                    break;
                }

                Item item = World.FindItem(serial);
                if (item == null)
                {
                    World.AddItem(item = new Item(serial));
                }

                if (World.Player.Holding == item)
                {
                    World.Player.Holding = null;
                }

                ushort id = p.ReadUInt16();
                item.ItemID = (ushort)(id & 0x3FFF);
                item.Layer  = p.ReadByte();

                if ((id & 0x8000) != 0)
                {
                    item.Hue = p.ReadUInt16();
                }
                else
                {
                    item.Hue = 0;
                }

                item.Container = m;
            }
            Item.UpdateContainers();
        }