Exemple #1
0
        private void OnLogout(bool fake)
        {
            if (!fake)
            {
                PacketHandlers.Party.Clear();

                SetTitleStr("");
                Engine.MainWindow.UpdateTitle();
                UOAssist.PostLogout();
                m_ConnStart = DateTime.MinValue;
            }

            World.Player = null;
            World.Items.Clear();
            World.Mobiles.Clear();
            Macros.MacroManager.Stop();
            ActionQueue.Stop();
            Counter.Reset();
            GoldPerHourTimer.Stop();
            DamageTracker.Stop();
            BandageTimer.Stop();
            GateTimer.Stop();
            BuffsTimer.Stop();
            StealthSteps.Unhide();
            Engine.MainWindow.OnLogout();
            if (Engine.MainWindow.MapWindow != null)
            {
                Engine.MainWindow.MapWindow.Close();
            }
            PacketHandlers.Party.Clear();
            PacketHandlers.IgnoreGumps.Clear();
            Config.Save();

            //TranslateEnabled = false;
        }
Exemple #2
0
        private void OnDisconnected()
        {
            PacketHandlers.Party.Clear();
            //TODO reset window title
            Engine.MainWindow.UpdateTitle();
            UOAssist.PostLogout();

            World.Player = null;
            World.Items.Clear();
            World.Mobiles.Clear();
            Macros.MacroManager.Stop();
            ActionQueue.Stop();
            Counter.Reset();
            GoldPerHourTimer.Stop();
            BandageTimer.Stop();
            GateTimer.Stop();
            BuffsTimer.Stop();
            StealthSteps.Unhide();
            Engine.MainWindow.OnLogout();
            if (Engine.MainWindow.MapWindow != null)
            {
                Engine.MainWindow.MapWindow.Close();
            }
            PacketHandlers.Party.Clear();
            PacketHandlers.IgnoreGumps.Clear();
            Config.Save();
        }
Exemple #3
0
        public override void OnMapChange(byte old, byte cur)
        {
            List <Mobile> list = new List <Mobile>(World.Mobiles.Values);

            for (int i = 0; i < list.Count; i++)
            {
                Mobile m = list[i];
                if (m != this && m.Map != cur)
                {
                    m.Remove();
                }
            }

            list = null;

            World.Items.Clear();
            Counter.Reset();
            for (int i = 0; i < Contains.Count; i++)
            {
                Item item = (Item)Contains[i];
                World.AddItem(item);
                item.Contains.Clear();
            }

            if (Config.GetBool("AutoSearch") && Backpack != null)
            {
                PlayerData.DoubleClick(Backpack);
            }

            UOAssist.PostMapChange(cur);

            if (Engine.MainWindow != null && Engine.MainWindow.MapWindow != null)
            {
                Engine.MainWindow.SafeAction(s => s.MapWindow.PlayerMoved());
            }
        }
Exemple #4
0
        private void Cast()
        {
            if (Config.GetBool("SpellUnequip") && Client.Instance.AllowBit(FeatureBit.UnequipBeforeCast))
            {
                Item pack = World.Player.Backpack;
                if (pack != null)
                {
                    // dont worry about uneqipping RuneBooks or SpellBooks
                    Item item = World.Player.GetItemOnLayer(Layer.RightHand);
#if DEBUG
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA &&
                        !item.IsVirtueShield)
#else
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA)
#endif
                    {
                        DragDropManager.Drag(item, item.Amount);
                        DragDropManager.Drop(item, pack);
                    }

                    item = World.Player.GetItemOnLayer(Layer.LeftHand);
#if DEBUG
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA &&
                        !item.IsVirtueShield)
#else
                    if (item != null && item.ItemID != 0x22C5 && item.ItemID != 0xE3B && item.ItemID != 0xEFA)
#endif
                    {
                        DragDropManager.Drag(item, item.Amount);
                        DragDropManager.Drop(item, pack);
                    }
                }
            }

            for (int i = 0; i < Counter.List.Count; i++)
            {
                ((Counter)Counter.List[i]).Flag = false;
            }

            if (Config.GetBool("HighlightReagents"))
            {
                for (int r = 0; r < Reagents.Length; r++)
                {
                    for (int i = 0; i < Counter.List.Count; i++)
                    {
                        Counter c = (Counter)Counter.List[i];
                        if (c.Enabled && c.Format.ToLower() == Reagents[r])
                        {
                            c.Flag = true;
                            break;
                        }
                    }
                }

                if (m_UnflagTimer != null)
                {
                    m_UnflagTimer.Stop();
                }
                else
                {
                    m_UnflagTimer = new UnflagTimer();
                }
                m_UnflagTimer.Start();
            }

            Client.Instance.RequestTitlebarUpdate();
            UOAssist.PostSpellCast(this.Number);

            if (World.Player != null)
            {
                World.Player.LastSpell  = GetID();
                LastCastTime            = DateTime.UtcNow;
                Targeting.SpellTargetID = 0;
            }
        }
Exemple #5
0
        private void OnUpdate()
        {
            var newValue = (int)m_PackCounter.GetValue(CounterID);

            if (m_Count != newValue)
            {
                if (m_Enabled)
                {
                    if (!SupressWarnings && m_LastWarning + TimeSpan.FromSeconds(1.0) < DateTime.UtcNow &&
                        World.Player != null && newValue < m_Count && Config.GetBool("CounterWarn") &&
                        newValue < Config.GetInt("CounterWarnAmount"))
                    {
                        World.Player.SendMessage(MsgLevel.Warning, LocString.CountLow, Name, newValue);
                        m_LastWarning = DateTime.UtcNow;
                    }

                    if (UOAssist.NotificationCount > 0)
                    {
                        int wp = 0;
                        if (Format == "bm")
                        {
                            wp = 1;
                        }
                        else if (Format == "bp")
                        {
                            wp = 2;
                        }
                        else if (Format == "gl")
                        {
                            wp = 3;
                        }
                        else if (Format == "gs")
                        {
                            wp = 4;
                        }
                        else if (Format == "mr")
                        {
                            wp = 5;
                        }
                        else if (Format == "ns")
                        {
                            wp = 6;
                        }
                        else if (Format == "sa")
                        {
                            wp = 7;
                        }
                        else if (Format == "ss")
                        {
                            wp = 8;
                        }
                        else if (Format == "bw")
                        {
                            wp = 100;
                        }
                        else if (Format == "db")
                        {
                            wp = 101;
                        }
                        else if (Format == "gd")
                        {
                            wp = 102;
                        }
                        else if (Format == "nc")
                        {
                            wp = 103;
                        }
                        else if (Format == "pi")
                        {
                            wp = 104;
                        }

                        if (wp != 0)
                        {
                            UOAssist.PostCounterUpdate(wp, newValue);
                        }
                    }

                    m_Count = newValue;
                    if (m_Count < 0)
                    {
                        m_Count = 0;
                    }

                    //Engine.MainWindow.RefreshCounters();
                    Client.Instance.RequestTitlebarUpdate();
                }

                m_LVI.SubItems[1].Text = m_Count.ToString();
            }
        }