public void RefreshPlayer() { foreach (Control c in extraControls) { this.Controls.Remove(c); } extraControls.Clear(); mainImage.Image = player.GetImage(); nameLabel.Text = player.name.ToTitle(); levelLabel.Text = String.Format("Level {0}", player.level); hpLabel.Text = String.Format("{0} Life", player.MaxLife().ToString("N0")); manaLabel.Text = String.Format("{0} Mana", player.MaxMana().ToString("N0")); capLabel.Text = String.Format("{0} Cap", player.Capacity()); sharedLabel.Text = String.Format("Shared Range\n{0} - {1}", player.SharedLevelMin(), player.SharedLevelMax()); vocationLabel.Text = player.GetVocation(); Font f = StyleManager.FontList[0]; Font prevFont = f; for (int i = 0; i < StyleManager.FontList.Count; i++) { Font font = StyleManager.FontList[i]; int width = TextRenderer.MeasureText(this.nameLabel.Text, font).Width; if (width < this.mainImage.Size.Width) { f = prevFont; } else { break; } prevFont = font; } nameLabel.Font = f; accountLabel.Visible = player.additionalInfo; houseLabel.Visible = player.additionalInfo; guildLabel.Visible = player.additionalInfo; marriageLabel.Visible = player.additionalInfo; worldLabel.Visible = player.additionalInfo; if (player.additionalInfo) { accountLabel.Text = player.premium ? "Premium Account" : "Free Account"; accountLabel.ForeColor = player.premium ? StyleManager.HealthHealthy : StyleManager.ElementFireColor; if (player.house != null) { houseLabel.Text = String.Format("House: {0}", player.house); } else { houseLabel.Visible = false; } if (player.guild != null) { guildLabel.Text = String.Format("Guild: {0}", player.guild); } else { guildLabel.Visible = false; } if (player.marriage != null) { marriageLabel.Text = String.Format("Marriage: {0}", player.marriage); } else { marriageLabel.Visible = false; } worldLabel.Text = String.Format("World: {0}", player.world); int i = 0; foreach (string death in player.recentDeaths) { Label label = new Label(); label.Text = death; label.Font = hpLabel.Font; label.BackColor = Color.Transparent; label.ForeColor = StyleManager.ElementFireColor; label.BorderStyle = BorderStyle.FixedSingle; label.AutoSize = false; int height = label.Text.Length < 50 ? 17 : 35; label.Size = new Size(262, height); label.Location = new Point(110, 106 + i); this.Controls.Add(label); extraControls.Add(label); i += height; if (i + 35 > 500) { break; } } this.Size = new Size(378, Math.Max(220, 106 + i + 10)); } else { this.Size = new Size(200, 220); } }
public static List <TabStructure> FindTabStructures(Process p, Player player) { bool firstScan = ReadMemoryManager.TabStructureCount() == 0; List <TabStructure> structs = new List <TabStructure>(); /*int statsValue = -1, expValue = -1; * if (MemoryReader.MemorySettings.ContainsKey("tibia11statsvalue")) { * int.TryParse(MemoryReader.MemorySettings["tibia11statsvalue"], out statsValue); * } * if (MemoryReader.MemorySettings.ContainsKey("tibia11expvalue")) { * int.TryParse(MemoryReader.MemorySettings["tibia11expvalue"], out expValue); * }*/ int playerMaxLife = -1, playerMaxMana = -1, playerLevel = -1; long playerMinExperience = -1, playerMaxExperience = -1; if (player != null) { playerMaxLife = player.MaxLife(); playerMaxMana = player.MaxMana(); playerMinExperience = ExperienceBar.GetExperience(player.level - 1); playerMaxExperience = ExperienceBar.GetExperience(player.level); playerLevel = player.level; } foreach (var tpl in ReadMemoryManager.ScanProcess(p)) { int length = tpl.Item1.RegionSize; int baseAddress = tpl.Item1.BaseAddress; byte[] bytes = tpl.Item2; for (int i = 0; i < length - 20; i += 4) { int value = BitConverter.ToInt32(bytes, i); if (value > 0x40000 && value != baseAddress + i) { int messageptr = BitConverter.ToInt32(bytes, i + 4); int maxsize = BitConverter.ToInt32(bytes, i + 8); int size = BitConverter.ToInt32(bytes, i + 16); if (messageptr > 0x40000 && IsPowerOfTwo(maxsize) && size < maxsize && maxsize < 10000 && size >= 0 && maxsize > 0) { if ((baseAddress + i) == MemoryReader.ReadInt32(value)) { structs.Add(new TabStructure((uint)(baseAddress + i))); } } } if (player != null) { int maxhealth = BitConverter.ToInt32(bytes, i + 0x4); int maxmana = BitConverter.ToInt32(bytes, i + 0xC); if (maxhealth == playerMaxLife && maxmana == playerMaxMana) { int health = BitConverter.ToInt32(bytes, i); int mana = BitConverter.ToInt32(bytes, i + 0x8); if (health <= maxhealth && health >= 0 && mana <= maxmana && mana >= 0) { MemoryReader.SetStatsAddress((uint)(baseAddress + i - 0x24)); } } else { int bla = BitConverter.ToInt32(bytes, i); long experience = BitConverter.ToInt64(bytes, i + 0x4); if (bla == 0 && experience > playerMinExperience && experience < playerMaxExperience) { short level = BitConverter.ToInt16(bytes, i + 0xC); if (level == playerLevel) { double percentage = BitConverter.ToInt32(bytes, i + 0xE) / 100.0; long diff = playerMaxExperience - playerMinExperience; if (percentage >= 0 && percentage <= 1 && experience > playerMinExperience + diff * (percentage - 1) && experience < playerMinExperience + diff * (percentage + 1)) { MemoryReader.SetExpAddress((uint)(baseAddress + i - 0x14)); } } } } } } if (!firstScan) { System.Threading.Thread.Sleep(10); } } return(structs); }