Esempio n. 1
0
            protected override void OnTick()
            {
                ArrayList requeue = null;

                m_LastTick = DateTime.UtcNow;

                if (m_Queue != null && m_Queue.Count > 0)
                {
                    this.Interval = TimeSpan.FromMilliseconds(Config.GetBool("ObjectDelayEnabled") ? Config.GetInt("ObjectDelay") : 0);

                    //this.Interval = TimeSpan.FromMilliseconds( Config.GetInt( "ObjectDelay" ) );

                    while (m_Queue.Count > 0)
                    {
                        Serial s = (Serial)m_Queue.Peek();
                        if (s == Serial.Zero)                           // dragdrop action
                        {
                            DragDropManager.ProcStatus status = DragDropManager.ProcessNext(m_Queue.Count - 1);
                            if (status != DragDropManager.ProcStatus.KeepWaiting)
                            {
                                m_Queue.Dequeue();                                 // if not waiting then dequeue it

                                if (status == DragDropManager.ProcStatus.ReQueue)
                                {
                                    m_Queue.Enqueue(s);
                                }
                            }

                            if (status == DragDropManager.ProcStatus.KeepWaiting || status == DragDropManager.ProcStatus.Success)
                            {
                                break;                                 // don't process more if we're waiting or we just processed something
                            }
                        }
                        else
                        {
                            m_Queue.Dequeue();
                            Client.Instance.SendToServer(new DoubleClick(s));
                            break;
                        }
                    }

                    if (requeue != null)
                    {
                        for (int i = 0; i < requeue.Count; i++)
                        {
                            m_Queue.Enqueue(requeue[i]);
                        }
                    }
                }
                else
                {
                    Stop();

                    if (m_Total > 1 && World.Player != null)
                    {
                        World.Player.SendMessage(LocString.QueueFinished, m_Total, ((DateTime.UtcNow - m_StartTime) - this.Interval).TotalSeconds);
                    }

                    m_Last  = Serial.Zero;
                    m_Total = 0;
                }
            }
Esempio n. 2
0
 internal void Say(string msg)
 {
     Say(Config.GetInt("SpeechHue"), msg);
 }
Esempio n. 3
0
        public static bool DoLastTarget()
        {
            TargetInfo targ;

            if (IsSmartTargetingEnabled())
            {
                if (m_AllowGround && m_LastGroundTarg != null)
                {
                    targ = m_LastGroundTarg;
                }
                else if (m_CurFlags == 1)
                {
                    targ = m_LastHarmTarg;
                }
                else if (m_CurFlags == 2)
                {
                    targ = m_LastBeneTarg;
                }
                else
                {
                    targ = m_LastTarget;
                }

                if (targ == null)
                {
                    targ = m_LastTarget;
                }
            }
            else
            {
                if (m_AllowGround && m_LastGroundTarg != null)
                {
                    targ = m_LastGroundTarg;
                }
                else
                {
                    targ = m_LastTarget;
                }
            }

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

            Point3D pos = Point3D.Zero;

            if (targ.Serial.IsMobile)
            {
                Mobile m = World.FindMobile(targ.Serial);
                if (m != null)
                {
                    pos = m.Position;

                    targ.X = pos.X;
                    targ.Y = pos.Y;
                    targ.Z = pos.Z;
                }
                else
                {
                    pos = Point3D.Zero;
                }
            }
            else if (targ.Serial.IsItem)
            {
                Item i = World.FindItem(targ.Serial);
                if (i != null)
                {
                    pos = i.GetWorldPosition();

                    targ.X = i.Position.X;
                    targ.Y = i.Position.Y;
                    targ.Z = i.Position.Z;
                }
                else
                {
                    pos    = Point3D.Zero;
                    targ.X = targ.Y = targ.Z = 0;
                }
            }
            else
            {
                if (!m_AllowGround && (targ.Serial == Serial.Zero || targ.Serial >= 0x80000000))
                {
                    World.Player.SendMessage(MsgLevel.Warning, LocString.LTGround);
                    return(false);
                }
                else
                {
                    pos = new Point3D(targ.X, targ.Y, targ.Z);
                }
            }

            if (Config.GetBool("RangeCheckLT") && Client.Instance.AllowBit(FeatureBit.RangeCheckLT) &&
                (pos == Point3D.Zero || !Utility.InRange(World.Player.Position, pos, Config.GetInt("LTRange"))))
            {
                if (Config.GetBool("QueueTargets"))
                {
                    m_QueueTarget = LastTargetAction;
                }
                World.Player.SendMessage(MsgLevel.Warning, LocString.LTOutOfRange);
                return(false);
            }

            if (CheckHealPoisonTarg(m_CurrentID, targ.Serial))
            {
                return(false);
            }

            CancelClientTarget();
            m_HasTarget = false;

            targ.TargID = m_CurrentID;

            if (m_Intercept)
            {
                OneTimeResponse(targ);
            }
            else
            {
                Client.Instance.SendToServer(new TargetResponse(targ));
            }
            return(true);
        }