コード例 #1
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();
                    }
                }
            }
        }
コード例 #2
0
ファイル: Targeting.cs プロジェクト: zerodowned/CEasyUO
        private static void NewTarget(PacketReader p, PacketHandlerEventArgs args)
        {
            bool prevAllowGround  = m_AllowGround;
            uint prevID           = m_CurrentID;
            byte prevFlags        = m_CurFlags;
            bool prevClientTarget = m_ClientTarget;

            m_AllowGround = p.ReadBoolean(); // allow ground
            m_CurrentID   = p.ReadUInt32();  // target uid
            m_CurFlags    = p.ReadByte();    // flags
                                             // the rest of the packet is 0s
            //         if (m_CurrentID == LocalTargID)
            //             return;
            // check for a server cancel command
            if (!m_AllowGround && m_CurrentID == 0 && m_CurFlags == 3)
            {
                m_HasTarget    = false;
                m_ClientTarget = false;
                if (m_Intercept)
                {
                    EndIntercept();
                }
                return;
            }

            if (Spell.LastCastTime + TimeSpan.FromSeconds(3.0) > DateTime.UtcNow && Spell.LastCastTime + TimeSpan.FromSeconds(0.5) <= DateTime.UtcNow && m_SpellTargID == 0)
            {
                m_SpellTargID = m_CurrentID;
            }

            m_HasTarget    = true;
            m_ClientTarget = true;
            Console.WriteLine("Got target");
        }
コード例 #3
0
        private static void NewTarget(PacketReader p, PacketHandlerEventArgs args)
        {
            bool prevAllowGround  = m_AllowGround;
            uint prevID           = m_CurrentID;
            byte prevFlags        = m_CurFlags;
            bool prevClientTarget = m_ClientTarget;

            m_AllowGround = p.ReadBoolean(); // allow ground
            m_CurrentID   = p.ReadUInt32();  // target uid
            m_CurFlags    = p.ReadByte();    // flags
            // the rest of the packet is 0s

            // check for a server cancel command
            if (!m_AllowGround && m_CurrentID == 0 && m_CurFlags == 3)
            {
                m_HasTarget      = false;
                m_FromGrabHotKey = false;

                m_ClientTarget = false;
                if (m_Intercept)
                {
                    EndIntercept();
                    World.Player.SendMessage(MsgLevel.Error, LocString.OTTCancel);
                }

                return;
            }

            if (Spell.LastCastTime + TimeSpan.FromSeconds(3.0) > DateTime.UtcNow &&
                Spell.LastCastTime + TimeSpan.FromSeconds(0.5) <= DateTime.UtcNow && m_SpellTargID == 0)
            {
                m_SpellTargID = m_CurrentID;
            }

            m_HasTarget    = true;
            m_ClientTarget = false;

            if (m_QueueTarget == null && Macros.MacroManager.AcceptActions &&
                MacroManager.Action(new WaitForTargetAction()))
            {
                args.Block = true;
            }
            else if (m_QueueTarget != null && m_QueueTarget())
            {
                ClearQueue();
                args.Block = true;
            }

            if (args.Block)
            {
                if (prevClientTarget)
                {
                    m_AllowGround = prevAllowGround;
                    m_CurrentID   = prevID;
                    m_CurFlags    = prevFlags;

                    m_ClientTarget = true;

                    if (!m_Intercept)
                    {
                        CancelClientTarget();
                    }
                }
            }
            else
            {
                m_ClientTarget = true;

                if (m_Intercept)
                {
                    if (m_OnCancel != null)
                    {
                        m_OnCancel();
                    }
                    EndIntercept();
                    World.Player.SendMessage(MsgLevel.Error, LocString.OTTCancel);

                    m_FilterCancel.Add((uint)prevID);
                }
            }
        }
コード例 #4
0
 private static void ServerSetWarMode(PacketReader p)
 {
     World.Player.Warmode = p.ReadBoolean();
 }