private static List <Serial> GetCurrentChars(StatusFormWrapperType type) { lock (SyncRoot) { return(World.Characters.Where(ch => type == StatusWrapper.GetWrapperType(ch.Serial) && ch.Serial != World.Player.Serial).OrderBy(ch => ch.GetDistance()).Select(ch => ch.Serial).ToList()); } }
//--------------------------------------------------------------------------------------------- public static void ShowWrapper(StatusFormWrapperType type) { if (GetCurrentWrapper(type) == null) { WindowManager.GetDefaultManager().CreateWindow(delegate() { var f = new StatusFormWrapper(type); return(f); }); } }
//--------------------------------------------------------------------------------------------- public static bool IsType(Serial serial, StatusFormWrapperType type) { UOCharacter mobile = new UOCharacter(serial); if (type == StatusFormWrapperType.Mob) { return(Game.IsMob(mobile)); } else if (type == StatusFormWrapperType.Other) { return(Game.CurrentGame.IsAlie(serial) || mobile.Notoriety == Notoriety.Innocent || mobile.Notoriety == Notoriety.Guild); } else if (type == StatusFormWrapperType.Enemy) { return(!IsType(serial, StatusFormWrapperType.Mob) && !IsType(serial, StatusFormWrapperType.Other)); } return(false); }
/// <summary> /// Initializes a new instance of the <see cref="T:SuppliesForm"/> class. /// </summary> public StatusFormWrapper(StatusFormWrapperType wrapperType) { MouseEnter += StatusForm_MouseEnter; MouseLeave += StatusForm_MouseLeave; this.WrapperType = wrapperType; this.registeredSerials = new List <Serial>(); if (this.WrapperType == StatusFormWrapperType.Enemy) { this.auto = true; this.BackColor = Color.Firebrick; } else if (this.WrapperType == StatusFormWrapperType.Mob) { this.BackColor = Color.Gold; } else if (this.WrapperType == StatusFormWrapperType.Free) { this.BackColor = Color.Goldenrod; } else { this.BackColor = Color.RoyalBlue; } this.DefaultColor = this.BackColor; this.InitializeComponent(); if (t == null) { t = new Thread(new ThreadStart(Main)); t.Start(); } StatusBar.OnStatusShow += StatusBar_OnStatusShow; //World.Player.Changed += Player_Changed; World.CharacterAppeared += World_CharacterAppeared; }
//--------------------------------------------------------------------------------------------- //TODO vyresit //public static StatusFormWrapper GetCurrentHoveringWrapper(Point location) //{ // foreach (StatusFormWrapper wrapper in GetAllWrappers()) // { // if (wrapper.Location.X < location.X && location.X < (wrapper.Location.X + wrapper.Width) && wrapper.Location.Y < location.Y && location.Y < (wrapper.Location.Y + wrapper.Height)) // return wrapper; // } // return null; //} //--------------------------------------------------------------------------------------------- public static StatusFormWrapper GetCurrentWrapper(StatusFormWrapperType type) { StatusFormWrapper form = WindowManager.GetDefaultManager().OwnedWindows.OfType <StatusFormWrapper>().Where(i => i.WrapperType == type).FirstOrDefault() as StatusFormWrapper; return(form); }