private void UpdateStats() { if (InvokeRequired) { BeginInvoke(new ThreadStart(UpdateStats)); return; } if (mobile.Name != null) { name.Text = mobile.Name; } if (mobile.MaxHits > -1) { hits.Text = String.Format("{0}/{1}", mobile.Hits, mobile.MaxHits); healthBar.Hits = mobile.Hits; healthBar.MaxHits = mobile.MaxHits; healthBar.Poison = mobile.Poisoned; } Notoriety n = mobile.Notoriety; HueEntry notoh = DataFiles.Hues.Get(notorietyColors[(int)n]); ushort noto = notoh.Colors[12]; this.BackColor = Color.FromArgb(UOColorConverter.ToArgb(noto) | (0xFF << 24)); }
private void UpdateStats() { if (InvokeRequired) { BeginInvoke(new ThreadStart(UpdateStats)); return; } if (mobile.Name != null) { name.Text = mobile.Name; } //UO.Print("P: " + String.Format("{0}/{1}", mobile.Hits, mobile.MaxHits)); if (mobile.MaxHits > -1) { hits.Text = String.Format("{0}/{1}", mobile.Hits, mobile.MaxHits); healthBar.Hits = mobile.Hits; healthBar.MaxHits = mobile.MaxHits; healthBar.Poison = mobile.Poisoned; healthBar.Unknown = false; statusNeeded = false; if (this.StatusType == StatusType.Player) { } else { lastMaxHits = mobile.MaxHits; } } else { healthBar.Unknown = true; if (mobile.Serial == World.Player.Serial) { } else { if ((DateTime.Now - initTime).TotalSeconds > 20 && mobile.Hits <= 1) { WindowManager.GetDefaultManager().BeginInvoke(Close); return; } } } Notoriety n = mobile.Notoriety; if (mobile.Distance > 18) { n = Notoriety.Unknown; healthBar.Unknown = true; if (mobile.Serial == World.Player.Serial) { } } HueEntry notoh = DataFiles.Hues.Get(notorietyColors[(int)n]); ushort noto = notoh.Colors[12]; if (statDown) { noto = DataFiles.Hues.Get(0x01c0).Colors[12]; } else { if (this.StatusType == StatusType.Mob) { noto = DataFiles.Hues.Get(0x0035).Colors[12]; } if (this.StatusType == StatusType.Player && Game.IsHealOn) { noto = DataFiles.Hues.Get(0x0035).Colors[12]; if (CalebConfig.HealMoby && Game.CurrentGame.HasAliveAlie) { noto = DataFiles.Hues.Get(0x000d).Colors[12]; } } } //1c0 BackColor = Color.FromArgb(UOColorConverter.ToArgb(noto) | (0xFF << 24)); // Do we need status? if (healthBar.Unknown) { statusNeeded = true; } // Request if mob is visible if (statusNeeded && mobile.Distance < 19 && DateTime.Now - lastRequest < TimeSpan.FromSeconds(10)) { statusNeeded = false; lastRequest = DateTime.Now; mobile.RequestStatus(); } }
//--------------------------------------------------------------------------------------------- private void UpdateStats() { if (InvokeRequired) { BeginInvoke(new ThreadStart(UpdateStats)); return; } if (mobile.Name != null) { name.Text = mobile.Name; } bool isDmg = lastMaxHits > mobile.MaxHits && mobile.MaxHits > -1; if (mobile.MaxHits > -1) { hits.Text = String.Format("{0}/{1}", mobile.Hits, mobile.MaxHits); healthBar.Hits = mobile.Hits; healthBar.MaxHits = mobile.MaxHits; healthBar.Poison = mobile.Poisoned; healthBar.Unknown = false; statusNeeded = false; if (this.StatusType == StatusType.Player) { mana.Text = String.Format("{0}/{1}", mobile.Mana, mobile.MaxMana); manaBar.Mana = mobile.Mana; manaBar.MaxMana = mobile.MaxMana; manaBar.Unknown = false; stam.Text = String.Format("{0}/{1}", mobile.Stamina, mobile.MaxStamina); staminaBar.Stam = mobile.Stamina; staminaBar.MaxStam = mobile.MaxStamina; staminaBar.Unknown = false; ar.Text = String.Format("ar: {0}", World.Player.Armor); weight.Text = String.Format("w: {0}", World.Player.Weight); } else { UpdatePositionAndDirection(); lastMaxHits = mobile.MaxHits; } } else { healthBar.Unknown = true; if (this.StatusType == StatusType.Player) { staminaBar.Unknown = true; manaBar.Unknown = true; } else { if (this.chbxKeep.Checked) { UpdatePositionAndDirection(); } else { int limit = 8; if ((DateTime.Now - initTime).TotalSeconds > limit && mobile.Hits <= 1) { WindowManager.GetDefaultManager().BeginInvoke(Close); return; } } } } Notoriety n = mobile.Notoriety; if (mobile.Distance > 18) { n = Notoriety.Unknown; healthBar.Unknown = true; if (mobile.Serial == World.Player.Serial) { staminaBar.Unknown = true; manaBar.Unknown = true; } } HueEntry notoh = DataFiles.Hues.Get(notorietyColors[(int)n]); ushort noto = notoh.Colors[12]; if (statDown && this.chbxAlie.Checked) { noto = DataFiles.Hues.Get(0x01c0).Colors[12]; } else { if (this.StatusType == StatusType.Mob) { noto = DataFiles.Hues.Get(0x0035).Colors[12]; } if (this.StatusType == StatusType.Player && Game.IsHealOn) { noto = DataFiles.Hues.Get(0x0035).Colors[12]; } } if (!DefaultColor.HasValue || !MouseHovering) { if (this.StatusType == StatusType.Player) { BackColor = Color.Black; } else { BackColor = Color.FromArgb(UOColorConverter.ToArgb(noto) | (0xFF << 24)); } if (!DefaultColor.HasValue) { DefaultColor = CurrentColor = BackColor; } } if (healthBar.Unknown) { statusNeeded = true; } // Request if mob is visible if (statusNeeded && mobile.Distance < 22 && DateTime.Now - lastRequest < TimeSpan.FromSeconds(10)) { statusNeeded = false; lastRequest = DateTime.Now; mobile.RequestStatus(); } //if (this.currentWrapper != null) //{ // if ((DateTime.Now - initTime).TotalSeconds > 2 && (this.healthBar.Unknown || this.mobile.Hits <= 0 || this.mobile.Distance > 18)) // { // WindowManager.GetDefaultManager().BeginInvoke(Close); // return; // } // else // this.currentWrapper.UpdateLayout(); //} }