Ejemplo n.º 1
0
        internal void MoveReq(Direction dir, byte seq)
        {
            m_OutstandingMoves++;
            FastWalkKey++;

            MoveEntry e = new MoveEntry();

            if (!m_MoveInfo.ContainsKey(seq))
            {
                m_MoveInfo.TryAdd(seq, e);
            }
            else
            {
                m_MoveInfo[seq] = e;
            }

            e.IsStep = (dir & Direction.Mask) == (Direction & Direction.Mask);
            e.Dir    = dir;

            ProcessMove(dir);

            e.Position = Position;

            if (Body != 0x03DB && !IsGhost && ((int)(e.Dir & Direction.Mask)) % 2 == 0 && Engine.MainWindow.AutoOpenDoors.Checked && CheckHiddedOpenDoor())
            {
                int x = Position.X, y = Position.Y;
                Utility.Offset(e.Dir, ref x, ref y);

                int z = CalcZ;

                foreach (Item i in World.Items.Values)
                {
                    if (i.Position.X == x && i.Position.Y == y)
                    {
                        if (i.IsDoor)
                        {
                            if (i.Position.Z - 15 <= z && i.Position.Z + 15 >= z)
                            {
                                if (m_LastDoor != i.Serial || m_LastDoorTime + TimeSpan.FromSeconds(1) < DateTime.Now)
                                {
                                    m_LastDoor     = i.Serial;
                                    m_LastDoorTime = DateTime.Now;
                                    m_OpenDoorReq.Start();
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            e.FilterAck = false;

            m_WalkSeq = (byte)(seq >= 255 ? 1 : seq + 1);
        }
Ejemplo n.º 2
0
        public void MoveReq(Direction dir, byte seq)
        {
            m_OutstandingMoves++;
            FastWalkKey++;

            MoveEntry e = new MoveEntry();

            m_MoveInfo[seq] = e;

            e.IsStep = (dir & Direction.Mask) == (Direction & Direction.Mask);
            e.Dir    = dir;

            ProcessMove(dir);               // shouldnt this be in MoveAck?!?

            e.Position = Position;

            if (Body != 0x03DB && !IsGhost && ((int)(e.Dir & Direction.Mask)) % 2 == 0 && Config.GetBool("AutoOpenDoors") && ClientCommunication.AllowBit(FeatureBit.AutoOpenDoors))
            {
                int x = Position.X, y = Position.Y;
                Utility.Offset(e.Dir, ref x, ref y);

                int z = CalcZ;

                foreach (Item i in World.Items.Values)
                {
                    if (i.Position.X == x && i.Position.Y == y && i.IsDoor && i.Position.Z - 15 <= z && i.Position.Z + 15 >= z && (m_LastDoor != i.Serial || m_LastDoorTime + TimeSpan.FromSeconds(1) < DateTime.UtcNow))
                    {
                        m_LastDoor     = i.Serial;
                        m_LastDoorTime = DateTime.UtcNow;
                        m_OpenDoorReq.Start();
                        break;
                    }
                }
            }

            /*if ( m_OutstandingMoves < 5 && !Macros.WalkAction.IsMacroWalk( seq ) && Config.GetBool( "SmoothWalk" ) )
             * {
             *      e.FilterAck = true;
             *      ClientCommunication.SendToClient( new MoveAcknowledge( seq, Notoriety ) );
             * }
             * else
             * {
             *      e.FilterAck = false;
             * }*/

            e.FilterAck = false;

            m_WalkSeq = (byte)(seq >= 255 ? 1 : seq + 1);
        }
Ejemplo n.º 3
0
        internal void ProcessMove(Direction dir)
        {
            if ((dir & Direction.Mask) == (this.Direction & Direction.Mask))
            {
                int x = Position.X, y = Position.Y;

                Utility.Offset(dir & Direction.Mask, ref x, ref y);

                int newZ = Position.Z;
                try { newZ = Assistant.Facet.ZTop(Map, x, y, newZ); }
                catch { }
                Position = new Point3D(x, y, newZ);
            }
            Direction = dir;
        }
Ejemplo n.º 4
0
        private void AutoOpenDoors()
        {
            if (Body != 0x03DB &&
                !IsGhost &&
                ((int)(Direction & Direction.Mask)) % 2 == 0 &&
                Config.GetBool("AutoOpenDoors") &&
                Client.Instance.AllowBit(FeatureBit.AutoOpenDoors))
            {
                int x = Position.X, y = Position.Y, z = Position.Z;

                /* Check if one more tile in the direction we just moved is a door */
                Utility.Offset(Direction, ref x, ref y);

                if (World.Items.Values.Any(s => s.IsDoor && s.Position.X == x && s.Position.Y == y && s.Position.Z - 15 <= z && s.Position.Z + 15 >= z))
                {
                    Client.Instance.SendToServer(new OpenDoorMacro());
                }
            }
        }
Ejemplo n.º 5
0
        private void AutoOpenDoors(bool onDirChange)
        {
            if (!Visible && !Config.GetBool("AutoOpenDoorWhenHidden"))
            {
                return;
            }

            if (Body != 0x03DB && !IsGhost && ((int)(Direction & Direction.Mask)) % 2 == 0 &&
                Config.GetBool("AutoOpenDoors") &&
                Client.Instance.AllowBit(FeatureBit.AutoOpenDoors))
            {
                int x = Position.X, y = Position.Y, z = Position.Z;

                /* Check if one more tile in the direction we just moved is a door */
                Utility.Offset(Direction, ref x, ref y);

                if (World.Items.Values.Any(s =>
                                           s.IsDoor && s.Position.X == x && s.Position.Y == y && s.Position.Z - 15 <= z &&
                                           s.Position.Z + 15 >= z))
                {
                    if (Client.IsOSI)
                    {
                        Client.Instance.SendToServer(new OpenDoorMacro());
                    }
                    else
                    {
                        // ClassicUO requires a slight pause before attempting to
                        // open a door after a direction change
                        if (onDirChange)
                        {
                            _doorTimer.Start();
                        }
                        else
                        {
                            Client.Instance.SendToServer(new OpenDoorMacro());
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void AutoOpenDoors()
        {
            if (Body != 0x03DB &&
                !IsGhost &&
                ((int)(Direction & Direction.Mask)) % 2 == 0 &&
                Config.GetBool("AutoOpenDoors"))
            {
                int x = Position.X, y = Position.Y, z = Position.Z;

                /* Check if one more tile in the direction we just moved is a door */
                Utility.Offset(Direction, ref x, ref y);

                foreach (Item i in World.Items.Values)
                {
                    if (i.IsDoor && i.Position.X == x && i.Position.Y == y && i.Position.Z - 15 <= z && i.Position.Z + 15 >= z)
                    {
                        ClientCommunication.SendToServer(new OpenDoorMacro());
                        break;
                    }
                }
            }
        }