public static void DrawInfo(this SpriteBatch sb) { string players = Game1.settings.PlayersEnabled ? Game1.scanner.Players.Count.ToString() : "Disabled"; string npcs = Game1.settings.NpcEnabled ? Game1.scanner.Npcs.Count.ToString() : "Disabled"; string objects = Game1.settings.ObjectsEnabled ? Game1.scanner.Objects.Count.ToString() : "Disabled"; string currZone = Game1.scanner.CurrentZoneName; string XPos = Math.Round(Game1.scanner.MyPlayer.XPos, 2).ToString(); string YPos = Math.Round(Game1.scanner.MyPlayer.YPos, 2).ToString(); string ZPos = Math.Round(Game1.scanner.MyPlayer.ZPos, 2).ToString(); string targetGuid = ""; string npcTargetID = ""; if (Game1.scanner.Target != null) { if (Game1.scanner.Target is Radar.PlayerObject) { Radar.PlayerObject pl = Game1.scanner.Target as Radar.PlayerObject; targetGuid = pl.Guid.ToString(); npcTargetID = "Player Selected!"; } else if (Game1.scanner.Target is Radar.NpcObject) { Radar.NpcObject npc = Game1.scanner.Target as Radar.NpcObject; targetGuid = npc.Guid.ToString(); npcTargetID = npc.NpcID.ToString(); } } sb.DrawTextForInfo("Ping Time: " + Tools.MsFromTicks(Game1.PingTime) + " ms", new Vector2(8, 32), 14.0f); sb.DrawTextForInfo("DbUpdate Time: " + Tools.MsFromTicks(Game1.DbUpdateTime) + " ms", new Vector2(8, 48), 14.0f); sb.DrawTextForInfo("-", new Vector2(8, 64), 14.0f); sb.DrawTextForInfo("TotalObjects: " + Game1.scanner.TotalWowObjects, new Vector2(8, 80), 14.0f); sb.DrawTextForInfo("ReadedObjects: " + Game1.scanner.ReadedWowObjects, new Vector2(8, 96), 14.0f); sb.DrawTextForInfo("-", new Vector2(8, 112), 14.0f); sb.DrawTextForInfo("Players: " + Game1.scanner.Players.Count, new Vector2(8, 128), 14.0f); sb.DrawTextForInfo("Npcs: " + npcs, new Vector2(8, 144), 14.0f); sb.DrawTextForInfo("Objects: " + objects, new Vector2(8, 160), 14.0f); sb.DrawTextForInfo("-", new Vector2(8, 176), 14.0f); sb.DrawTextForInfo("My GUID: " + Game1.scanner.MyPlayer.Guid, new Vector2(8, 192), 14.0f); sb.DrawTextForInfo("XPos: " + XPos, new Vector2(8, 208), 14.0f); sb.DrawTextForInfo("YPos: " + YPos, new Vector2(8, 224), 14.0f); sb.DrawTextForInfo("ZPos: " + ZPos, new Vector2(8, 240), 14.0f); sb.DrawTextForInfo("Current Zone: " + currZone, new Vector2(8, 256), 14.0f); sb.DrawTextForInfo("Target GUID: " + targetGuid, new Vector2(8, 270), 14.0f); sb.DrawTextForInfo("Target Npc ID: " + npcTargetID, new Vector2(8, 284), 14.0f); }
protected override void Draw(GameTime gameTime) { float RadarZoom = settings.RadarZoom; Stopwatch drawTime = Stopwatch.StartNew(); GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); //Рисуем миникарту //spriteBatch.DrawMinimapOverlay(scanner.MyPlayer); //Отрисовываем гуи если в мире и мышка под меню if (!GUI.MouseOver | !(HasConnected & HasInWorld)) { if (HasConnected) { if (HasInWorld) { //Реинициализируем адресса, если что-то пошло не так { if (LastGameState != 3) { scanner.InitAddresses(); } LastGameState = 3; } #region Отрисовка руд, трав и объектов из базы данных!! { #region Отрисовка руды из бд { if (settings.ores.Find) //Если ищем с бд { if (DB.database.Ores.ZoneExist(scanner.CurrentZoneID)) //Если есть хоть что-то в этой зоне { for (int i = 0; i < DB.database.Ores.OresDict[scanner.CurrentZoneID].Count; i++) { //Бережно берем из списка DataBase.cOres.Ore ore; try { ore = DB.database.Ores.OresDict[scanner.CurrentZoneID][i] as DataBase.cOres.Ore; } catch { continue; } //Если руда в радиусе прорисовки Vector2 orePos = new Vector2(ore.Position.X, ore.Position.Y); Vector2 imPos = new Vector2(scanner.MyPlayer.XPos, scanner.MyPlayer.YPos); if (Tools.Vec.InRadius(orePos, imPos, (DB.database.Ores.MaxSeeDistance * 2))) { bool breaked = false; foreach (Radar.OtherObject obj in scanner.Objects) { if (Enums.ObjDB.HasOre(obj.ObjectId)) { if (Tools.Vec.InRadius(orePos, new Vector2(obj.XPos, obj.YPos), settings.nodes.RadiusCheck)) { breaked = true; break; } } } if (!breaked) { int XPos = (int)((imPos.X - orePos.X) * RadarZoom + RadarWidth / 2); int YPos = (int)((imPos.Y - orePos.Y) * RadarZoom + RadarHeight / 2); float DistanceToOre = Vector2.Distance(orePos, imPos); if (DistanceToOre < (ore.MaxSeeDistance / 1.5f)) { float Zoom = RadarZoom / 4; float divide_factor = settings.nodes.NotExist_DivideFactor; int NodeSize = (int)((settings.nodes.Size * Zoom) / divide_factor); Color textureColor = Tools.GetOpacity(Color.Red, 96); Color textColor = Tools.GetOpacity(Color.Red, 200); Rectangle TextureDest = new Rectangle(XPos, YPos, NodeSize, NodeSize); spriteBatch.DrawTexture("other_notexist_node", TextureDest, textureColor); spriteBatch.DrawText(ore.Name, new Vector2(XPos, YPos + NodeSize), (settings.ores.FontSize / divide_factor), textColor); } else { float Zoom = RadarZoom / 4; int NodeSize = (int)(settings.nodes.Size * Zoom); Rectangle TextureDest = new Rectangle(XPos, YPos, NodeSize, NodeSize); spriteBatch.DrawTexture("other_notsee_node", TextureDest, Color.DarkRed); spriteBatch.DrawText(ore.Name, new Vector2(XPos, YPos + NodeSize), settings.ores.FontSize, Color.DarkRed); } } } } } } } #endregion #region Отрисовка травы из бд { if (settings.herbs.Find) //Если ищем с бд { if (DB.database.Herbs.ZoneExist(scanner.CurrentZoneID)) //Если есть хоть что-то в этой зоне { for (int i = 0; i < DB.database.Herbs.HerbDict[scanner.CurrentZoneID].Count; i++) { //Бережно берем из списка DataBase.cHerbs.Herb herb; try { herb = DB.database.Herbs.HerbDict[scanner.CurrentZoneID][i] as DataBase.cHerbs.Herb; } catch { continue; } //Если трава в радиусе прорисовки Vector2 herbPos = new Vector2(herb.Position.X, herb.Position.Y); Vector2 imPos = new Vector2(scanner.MyPlayer.XPos, scanner.MyPlayer.YPos); if (Tools.Vec.InRadius(herbPos, imPos, (DB.database.Herbs.MaxSeeDistance * 2))) { bool breaked = false; foreach (Radar.OtherObject obj in scanner.Objects) { if (Enums.ObjDB.HasHerb(obj.ObjectId)) { if (Tools.Vec.InRadius(herbPos, new Vector2(obj.XPos, obj.YPos), settings.nodes.RadiusCheck)) { breaked = true; break; } } } if (!breaked) { int XPos = (int)((imPos.X - herbPos.X) * RadarZoom + RadarWidth / 2); int YPos = (int)((imPos.Y - herbPos.Y) * RadarZoom + RadarHeight / 2); float DistanceToHerb = Vector2.Distance(herbPos, imPos); if (DistanceToHerb < 5) { } if (DistanceToHerb < (herb.MaxSeeDistance / 1.5f)) { float Zoom = RadarZoom / 4; float divide_factor = settings.nodes.NotExist_DivideFactor; int NodeSize = (int)((settings.nodes.Size * Zoom) / divide_factor); Color textureColor = Tools.GetOpacity(Color.Red, 96); Color textColor = Tools.GetOpacity(Color.Red, 200); Rectangle TextureDest = new Rectangle(XPos, YPos, NodeSize, NodeSize); spriteBatch.DrawTexture("other_notexist_node", TextureDest, textureColor); spriteBatch.DrawText(herb.Name, new Vector2(XPos, YPos + NodeSize), (settings.herbs.FontSize / divide_factor), textColor); } else { float Zoom = RadarZoom / 4; int NodeSize = (int)(settings.nodes.Size * Zoom); Rectangle TextureDest = new Rectangle(XPos, YPos, NodeSize, NodeSize); spriteBatch.DrawTexture("other_notsee_node", TextureDest, Color.DarkRed); spriteBatch.DrawText(herb.Name, new Vector2(XPos, YPos + NodeSize), settings.herbs.FontSize, Color.DarkRed); } } } } } } } #endregion #region Отрисовка редких объектов из бд { if (settings.rareobjects.Find | settings.otherobjects.Draw) //Если ищем с бд { if (DB.database.Objects.ZoneExist(scanner.CurrentZoneID)) ////Если есть хоть что-то в этой зоне { for (int i = 0; i < DB.database.Objects.ObjectsDict[scanner.CurrentZoneID].Count; i++) { //Бережно берем из списка DataBase.cObjects.Object abject; try { abject = DB.database.Objects.ObjectsDict[scanner.CurrentZoneID][i] as DataBase.cObjects.Object; } catch { continue; } //Если трава в радиусе прорисовки Vector2 objPos = new Vector2(abject.Position.X, abject.Position.Y); Vector2 imPos = new Vector2(scanner.MyPlayer.XPos, scanner.MyPlayer.YPos); if (Tools.Vec.InRadius(objPos, imPos, (DB.database.Herbs.MaxSeeDistance * 2))) { bool breaked = false; foreach (Radar.OtherObject obj in scanner.Objects) { if (Enums.ObjDB.HasRareObject(obj.ObjectId)) { if (Tools.Vec.InRadius(objPos, new Vector2(obj.XPos, obj.YPos), settings.nodes.RadiusCheck)) { breaked = true; break; } } else { bool hasOre = Enums.ObjDB.HasOre(obj.ObjectId); bool hasHerb = Enums.ObjDB.HasHerb(obj.ObjectId); bool hasRare = Enums.ObjDB.HasRareObject(obj.ObjectId); bool hasBlacklist = Enums.ObjDB.HasInBlackList(obj.ObjectId); if (!hasOre & !hasHerb & !hasRare & !hasBlacklist) //Если это обычный объект { breaked = true; break; } } } if (!breaked) { Enums.Name_And_TextureName finded = new Enums.Name_And_TextureName(); //Если отрисовываемый объект не обычный, а редкий if (Enums.ObjDB.GetRareObject(abject.ID, ref finded)) { int XPos = (int)((imPos.X - objPos.X) * RadarZoom + RadarWidth / 2); int YPos = (int)((imPos.Y - objPos.Y) * RadarZoom + RadarHeight / 2); float DistanceToObject = Vector2.Distance(objPos, imPos); Color randomColor = Tools.GetRandomColor(random); if (DistanceToObject < (abject.MaxSeeDistance / 1.5f)) { float Zoom = RadarZoom / 4; float divide_factor = settings.nodes.NotExist_DivideFactor; int NodeSize = (int)((settings.nodes.Size * Zoom) / divide_factor); Color textureColor = Tools.GetOpacity(Color.Red, 96); Color textColor = Tools.GetOpacity(Color.Red, 200); Rectangle TextureDest = new Rectangle(XPos, YPos, NodeSize, NodeSize); spriteBatch.DrawTexture("other_notexist_node", TextureDest, textureColor); spriteBatch.DrawText(finded.name, new Vector2(XPos, YPos + NodeSize), (settings.rareobjects.FontSize / divide_factor), textColor); } else { float Zoom = RadarZoom / 4; int NodeSize = (int)(settings.nodes.Size * Zoom); Rectangle TextureDest = new Rectangle(XPos, YPos, NodeSize, NodeSize); spriteBatch.DrawTexture("other_notsee_node", TextureDest, randomColor); spriteBatch.DrawText(finded.name, new Vector2(XPos, YPos + NodeSize), settings.rareobjects.FontSize, randomColor); } } else //Для обычных объектов { if (settings.otherobjects.Draw) { int XPos = (int)((imPos.X - objPos.X) * RadarZoom + RadarWidth / 2); int YPos = (int)((imPos.Y - objPos.Y) * RadarZoom + RadarHeight / 2); float DistanceToObject = Vector2.Distance(objPos, imPos); string id = abject.ID.ToString(); if (DistanceToObject < (abject.MaxSeeDistance / 1.5f)) { float Zoom = RadarZoom / 4; float divide_factor = settings.nodes.NotExist_DivideFactor; int NodeSize = (int)((settings.nodes.Size * Zoom) / divide_factor); Color textureColor = Tools.GetOpacity(settings.otherobjects.Color, 96); Color textColor = Tools.GetOpacity(settings.otherobjects.Color, 200); Rectangle TextureDest = new Rectangle(XPos, YPos, NodeSize, NodeSize); spriteBatch.DrawTexture("other_notexist_node", TextureDest, textureColor); spriteBatch.DrawText(id, new Vector2(XPos, YPos + NodeSize), (settings.otherobjects.FontSize / divide_factor), textColor); } else { float Zoom = RadarZoom / 4; int NodeSize = (int)(settings.nodes.Size * Zoom); Rectangle TextureDest = new Rectangle(XPos, YPos, NodeSize, NodeSize); spriteBatch.DrawTexture("other_notsee_node", TextureDest, Color.DarkRed); spriteBatch.DrawText(id, new Vector2(XPos, YPos + NodeSize), settings.otherobjects.FontSize, Color.DarkRed); } } } } } } } } } #endregion } #endregion #region Отрисовка объектов которые видим foreach (Radar.OtherObject obj in scanner.Objects) { Enums.Name_And_TextureName finded = new Enums.Name_And_TextureName(); if (Enums.ObjDB.GetHerb(obj.ObjectId, ref finded)) //Если это травка { if (settings.herbs.Draw) //Если отрисовываем травы, то рисуем уже { float XPos = (scanner.MyPlayer.XPos - obj.XPos) * RadarZoom + RadarWidth / 2; float YPos = (scanner.MyPlayer.YPos - obj.YPos) * RadarZoom + RadarHeight / 2; int Size = settings.herbs.Size; Rectangle TextureDest = new Rectangle((int)XPos, (int)YPos, Size, Size); spriteBatch.DrawTexture(finded.textureName, TextureDest); spriteBatch.DrawText(finded.name, new Vector2(XPos, YPos + Size), settings.herbs.FontSize, settings.herbs.Color); } } else if (Enums.ObjDB.GetOre(obj.ObjectId, ref finded)) //Если это руда { if (settings.ores.Draw) //Если отрисовываем травы, то рисуем уже { float XPos = (scanner.MyPlayer.XPos - obj.XPos) * RadarZoom + RadarWidth / 2; float YPos = (scanner.MyPlayer.YPos - obj.YPos) * RadarZoom + RadarHeight / 2; int Size = settings.ores.Size; Rectangle TextureDest = new Rectangle((int)XPos, (int)YPos, Size, Size); spriteBatch.DrawTexture(finded.textureName, TextureDest); spriteBatch.DrawText(finded.name, new Vector2(XPos, YPos + Size), settings.ores.FontSize, settings.ores.Color); } } else if (Enums.ObjDB.GetRareObject(obj.ObjectId, ref finded)) //Если это редкий объект { if (settings.rareobjects.Draw) //Если отрисовываем редкие объекты, то рисуем уже { float XPos = (scanner.MyPlayer.XPos - obj.XPos) * RadarZoom + RadarWidth / 2; float YPos = (scanner.MyPlayer.YPos - obj.YPos) * RadarZoom + RadarHeight / 2; int Size = settings.rareobjects.Size; Rectangle TextureDest = new Rectangle((int)XPos, (int)YPos, Size, Size); Color randomColor = Tools.GetRandomColor(random); spriteBatch.DrawLine(new Vector2(XPos, YPos), new Vector2(Drawing.RadarCenterXPos, Drawing.RadarCenterYPos), randomColor, 2); spriteBatch.DrawTexture(finded.textureName, TextureDest, GlobalRotating); spriteBatch.DrawText(finded.name, new Vector2(XPos, YPos + Size), settings.rareobjects.FontSize, randomColor); } } else //Просто объекты { if (settings.otherobjects.Draw) //Если отрисовываем обычные объекты, то рисуем уже { float XPos = (scanner.MyPlayer.XPos - obj.XPos) * RadarZoom + RadarWidth / 2; float YPos = (scanner.MyPlayer.YPos - obj.YPos) * RadarZoom + RadarHeight / 2; if (settings.otherobjects.DrawLines) { if (!Enums.ObjDB.HasInBlackList(obj.ObjectId)) { Vector2 radarCenter = new Vector2(Drawing.RadarCenterXPos, Drawing.RadarCenterYPos); Vector2 objPos = new Vector2(XPos, YPos); spriteBatch.DrawLine(radarCenter, objPos, Color.AliceBlue, 1); } } int Size = settings.otherobjects.Size; Rectangle TextureDest = new Rectangle((int)XPos, (int)YPos, Size, Size); spriteBatch.DrawTexture("other_object", TextureDest); spriteBatch.DrawText(obj.ObjectId.ToString(), new Vector2(XPos, YPos + Size), settings.rareobjects.FontSize, settings.otherobjects.Color); } } } #endregion //Отрисовываем игроков foreach (Radar.PlayerObject player in scanner.Players) { spriteBatch.DrawPlayer(player, scanner.MyPlayer); } //Ищем объект? //foreach (object obj in scanner.All) //{ // if (obj is Radar.OtherObject) // { // Radar.OtherObject otherObj = obj as Radar.OtherObject; // } // else if (obj is Radar.NpcObject) // { // Radar.NpcObject npc = obj as Radar.NpcObject; // } // else if (obj is Radar.PlayerObject) // { // Radar.PlayerObject player = obj as Radar.PlayerObject; // } //} //Отрисовываем цель if (scanner.Target != null) { float result = Tools.Oscillate(0.32f, 1.5f, (float)(gameTime.TotalGameTime.TotalMilliseconds / 1000.0f)); Texture2D target_tex = Textures.GetTexture("other_target"); if (scanner.Target is Radar.PlayerObject) { Radar.PlayerObject player = scanner.Target as Radar.PlayerObject; float XPos = (scanner.MyPlayer.XPos - player.XPos) * RadarZoom + RadarWidth / 2; float YPos = (scanner.MyPlayer.YPos - player.YPos) * RadarZoom + RadarHeight / 2; spriteBatch.DrawLine(new Vector2(Drawing.RadarCenterXPos, Drawing.RadarCenterYPos), new Vector2(XPos, YPos), Color.SlateBlue, 4); spriteBatch.DrawTexture(target_tex, new Rectangle((int)XPos, (int)YPos, (int)(target_tex.Width * result), (int)(target_tex.Height * result)), GlobalRotating / 8, Color.Gold); } else if (scanner.Target is Radar.NpcObject) { Radar.NpcObject npc = scanner.Target as Radar.NpcObject; float XPos = (scanner.MyPlayer.XPos - npc.XPos) * RadarZoom + RadarWidth / 2; float YPos = (scanner.MyPlayer.YPos - npc.YPos) * RadarZoom + RadarHeight / 2; spriteBatch.DrawLine(new Vector2(Drawing.RadarCenterXPos, Drawing.RadarCenterYPos), new Vector2(XPos, YPos), Color.SlateBlue, 4); spriteBatch.DrawTexture(target_tex, new Rectangle((int)XPos, (int)YPos, (int)(target_tex.Width * result), (int)(target_tex.Height * result)), GlobalRotating / 8, Color.Gold); spriteBatch.DrawText(npc.Name, new Vector2(XPos, YPos + target_tex.Height), 14.0f, Color.Gold); } } //Рисуем себя по центру spriteBatch.DrawMeAtCenter(scanner.MyPlayer); } else { Texture2D not_in_world_tex = Textures.GetTexture("other_not_in_world"); spriteBatch.DrawTextureFromLeft(not_in_world_tex, new Rectangle(0, 0, RadarWidth, RadarHeight)); LastGameState = 2; } } else { GraphicsDevice.Clear(Color.White); spriteBatch.DrawText("Not connected!", new Vector2(RadarHeight / 2, RadarWidth / 2), 25.0f, Color.Black); LastGameState = 1; } } else //Иначе рисуем инфу { GraphicsDevice.Clear(Color.AntiqueWhite); spriteBatch.DrawInfo(); } spriteBatch.End(); drawTime.Stop(); //Устанавливаем таймер и обновляем значение DrawTime = drawTime.ElapsedTicks; base.Draw(gameTime); }
public void Ping(bool NpcEnabled, bool PlayersEnabled, bool FriendlyPlayersEnabled, bool ObjectsEnabled) { //Обнуляем и обнуляем все bool MyPlayersFinded = false; TotalWowObjects = 0; ReadedWowObjects = 0; All.Clear(); Players.Clear(); Npcs.Clear(); Objects.Clear(); //Устанавливаем базовый адресс текущего объекта как адресс первого объекта в менеджере объектов UIntPtr CurrObject_BaseAddress = FirstObject; //Получаем гуид последнего выбранного юнита LastTargetGuid = WowReader.ReadULong((UIntPtr)Offsets.Client.StaticLastTargetGUID); //Получаем текущую зону CurrentZoneID = GetCurrZoneID(); CurrentZoneName = Enums.ZonesDB.GetTextOfZone(CurrentZoneID); //Читаем нашего игрока ReadMyPlayer(); //ПОЛУЧАЕМ ТЕКУЩУЮ ЦЕЛЬ { ulong Guid = WowReader.ReadUInt64((UIntPtr)Offsets.Client.StaticLocalTargetGUID); if (Guid != 0) { UIntPtr BaseAddress = GetObjectBaseByGuid(Guid); UIntPtr UnitFieldsAddress = WowReader.ReadPointer(BaseAddress + Offsets.Object.UnitFields); short Type = (short)WowReader.ReadUInt32(BaseAddress + Offsets.Object.Type); if (Type == (int)Defines.ObjectType.PLAYER) //PLAYER { float XPos = WowReader.ReadFloat(BaseAddress + Offsets.Unit.Pos_X); float YPos = WowReader.ReadFloat(BaseAddress + Offsets.Unit.Pos_Y); float ZPos = WowReader.ReadFloat(BaseAddress + Offsets.Unit.Pos_Z); float Rotation = WowReader.ReadFloat(BaseAddress + Offsets.Object.Rot); uint CurrentHealth = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Health); uint CurrentEnergy = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Energy); uint MaxHealth = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.MaxHealth); uint Level = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Level); uint MaxEnergy = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.MaxEnergy); string Name = PlayerNameFromGuid(Guid); byte Race = WowReader.ReadByte(UnitFieldsAddress + Offsets.Unit.Race); byte Class = WowReader.ReadByte(UnitFieldsAddress + Offsets.Unit.Class); byte Gender = WowReader.ReadByte(UnitFieldsAddress + Offsets.Unit.Gender); Target = new PlayerObject(Guid, XPos, YPos, ZPos, Rotation, CurrObject_BaseAddress, UnitFieldsAddress, Type, Name, Race, Class, Gender, CurrentHealth, MaxHealth, CurrentEnergy, MaxEnergy, Level); } else if (Type == (int)Defines.ObjectType.UNIT) //NPC { uint NpcID = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.NpcID); float XPos = WowReader.ReadFloat(BaseAddress + Offsets.Unit.Pos_X); float YPos = WowReader.ReadFloat(BaseAddress + Offsets.Unit.Pos_Y); float ZPos = WowReader.ReadFloat(BaseAddress + Offsets.Unit.Pos_Z); float Rotation = WowReader.ReadFloat(BaseAddress + Offsets.Object.Rot); uint CurrentHealth = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Health); uint CurrentEnergy = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Energy); uint MaxHealth = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.MaxHealth); uint Level = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Level); uint MaxEnergy = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.MaxEnergy); string Name = MobNameFromGuid(Guid, NpcID); ulong SummonedBy = WowReader.ReadUInt64(UnitFieldsAddress + Offsets.Unit.SummonedBy); Target = new NpcObject(Guid, NpcID, XPos, YPos, ZPos, Rotation, CurrObject_BaseAddress, UnitFieldsAddress, Type, Name, CurrentHealth, MaxHealth, CurrentEnergy, MaxEnergy, Level); } } else { Target = null; } } //Прочитываем объектный менеджер из первого объекта по последний. while (CurrObject_BaseAddress != UIntPtr.Zero && (uint)CurrObject_BaseAddress % 2 == 0) { TotalWowObjects++; //Получаем тип объекта и пропускаем если это неизвестный объект short Type = WowReader.ReadShort(CurrObject_BaseAddress + Offsets.Object.Type); if (Type != 3 & Type != 4 & Type != 5) { goto Skip; } //Скипаем если тип объекта неизвестен //Получаем указатель на поле значений этого объекта UIntPtr UnitFieldsAddress = WowReader.ReadPointer(CurrObject_BaseAddress + Offsets.Unit.UnitFields); switch (Type) { case (int)Defines.ObjectType.UNIT: //NPC! { if (!NpcEnabled) { goto Skip; } //Если нпс выключены, пропускаем ulong Guid = WowReader.ReadUInt64(CurrObject_BaseAddress + Offsets.Object.Guid); uint NpcID = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.NpcID); float XPos = WowReader.ReadFloat(CurrObject_BaseAddress + Offsets.Unit.Pos_X); float YPos = WowReader.ReadFloat(CurrObject_BaseAddress + Offsets.Unit.Pos_Y); float ZPos = WowReader.ReadFloat(CurrObject_BaseAddress + Offsets.Unit.Pos_Z); float Rotation = WowReader.ReadFloat(CurrObject_BaseAddress + Offsets.Object.Rot); uint Level = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Level); uint CurrentHealth = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Health); uint MaxHealth = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.MaxHealth); uint CurrentEnergy = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Energy); uint MaxEnergy = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.MaxEnergy); string Name = MobNameFromGuid(Guid, NpcID); ulong SummonedBy = WowReader.ReadUInt64(UnitFieldsAddress + Offsets.Unit.SummonedBy); ReadedWowObjects++; NpcObject npc = new NpcObject(Guid, NpcID, XPos, YPos, ZPos, Rotation, CurrObject_BaseAddress, UnitFieldsAddress, Type, Name, CurrentHealth, MaxHealth, CurrentEnergy, MaxEnergy, Level); Npcs.Add(npc); All.Add(npc); } break; case (int)Defines.ObjectType.PLAYER: //PLAYER { ulong Guid = WowReader.ReadUInt64(CurrObject_BaseAddress + Offsets.Object.Guid); //Проходим если это мы if (Guid == MyPlayer.Guid) { MyPlayersFinded = true; goto Skip; } //Если игроки выключены, пропускаем if (!PlayersEnabled) { goto Skip; } byte Race = WowReader.ReadByte(UnitFieldsAddress + Offsets.Unit.Race); //Скипаем союзников, если такая настройка включена if (!FriendlyPlayersEnabled & !Defines.IsEnemy(Race, MyPlayer.Race)) { goto Skip; } float XPos = WowReader.ReadFloat(CurrObject_BaseAddress + Offsets.Unit.Pos_X); float YPos = WowReader.ReadFloat(CurrObject_BaseAddress + Offsets.Unit.Pos_Y); float ZPos = WowReader.ReadFloat(CurrObject_BaseAddress + Offsets.Unit.Pos_Z); float Rotation = WowReader.ReadFloat(CurrObject_BaseAddress + Offsets.Object.Rot); uint Level = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Level); uint CurrentHealth = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Health); uint MaxHealth = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.MaxHealth); uint CurrentEnergy = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.Energy); uint MaxEnergy = WowReader.ReadUInt32(UnitFieldsAddress + Offsets.Unit.MaxEnergy); byte Class = WowReader.ReadByte(UnitFieldsAddress + Offsets.Unit.Class); byte Gender = WowReader.ReadByte(UnitFieldsAddress + Offsets.Unit.Gender); string Name = PlayerNameFromGuid(Guid); if (Name == "Yeah") { } //Добавляем игрока в список игроков ReadedWowObjects++; PlayerObject player = new PlayerObject(Guid, XPos, YPos, ZPos, Rotation, CurrObject_BaseAddress, UnitFieldsAddress, Type, Name, Race, Class, Gender, CurrentHealth, MaxHealth, CurrentEnergy, MaxEnergy, Level); Players.Add(player); All.Add(player); } break; case (int)Defines.ObjectType.GAMEOBJ: //OBJECTS { if (!ObjectsEnabled) { goto Skip; } //Если объекты выключены, пропускаем //Чтение объекта (сам наварганил) uint objectID = WowReader.ReadUInt(UnitFieldsAddress + Offsets.Object.ID); float objectX = WowReader.ReadFloat(CurrObject_BaseAddress + Offsets.Object.Pos_X); float objectY = WowReader.ReadFloat(CurrObject_BaseAddress + Offsets.Object.Pos_Y); float objectZ = WowReader.ReadFloat(CurrObject_BaseAddress + Offsets.Object.Pos_Z); //Добавляем объект в список ReadedWowObjects++; OtherObject obj = new OtherObject(objectID, objectX, objectY, objectZ, CurrObject_BaseAddress, UnitFieldsAddress); Objects.Add(obj); All.Add(obj); } break; } Skip: //Для пропуска объекта //Устанавливаем текущий объект как следующий объект из менеджера объектов CurrObject_BaseAddress = NextObject(CurrObject_BaseAddress); } //Если нашего игрока нету в списке if (!MyPlayersFinded) { //Скорее всего что-то сбилось, реинициализируем адресса InitAddresses(); } }
protected override void Update(GameTime gameTime) { // Allows the game to exit if (Keyboard.GetState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape)) { this.Exit(); } GlobalRotating += Game1.random.Next(4, 6) / 10.0f; //Обновляем гуи GUI.Update(); //Если сканнер запустился if (scanner != null) { //Если игрок в мире HasConnected = scanner.HasConnected(); if (HasConnected) { HasInWorld = scanner.InWorld(); if (HasInWorld) { //Обновляем звуки Sounds.ChecksHighLevels(scanner.Players, scanner.MyPlayer); Stopwatch pingTime = Stopwatch.StartNew(); { scanner.Ping(settings.NpcEnabled, settings.PlayersEnabled, settings.FriendlyPlayersEnabled, settings.ObjectsEnabled); } pingTime.Stop(); PingTime = pingTime.ElapsedTicks; if (scanner.Target != null) { if (scanner.Target is Radar.PlayerObject) { Radar.PlayerObject player = scanner.Target as Radar.PlayerObject; this.Window.Title = "Rio WoW Radar - Target[" + player.Name + ":" + player.Level + "]"; } else if (scanner.Target is Radar.NpcObject) { Radar.NpcObject npc = scanner.Target as Radar.NpcObject; this.Window.Title = "Rio WoW Radar - Target[" + npc.Name + ":" + npc.Level + "]"; } else { this.Window.Title = "Rio WoW Radar - target has broken! (because emlpdr!)"; } } else { this.Window.Title = "Rio WoW Radar - [Draw: " + Tools.MsFromTicks(DrawTime) + " ms]"; } } else { this.Window.Title = "Rio WoW Radar - Not in world!"; } } else { this.Window.Title = "Rio WoW Radar - Not connected!"; } } else { this.Exit(); } base.Update(gameTime); }