Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Collections.Generic;
- using SlimDX;
- namespace Teamspeak3
- {
- public class ENTITY
- {
- public long Base;
- public int Id;
- public int Type;
- public String Name;
- public Vector3 Position;
- public float Distance;
- public float Yaw;
- public float Pitch;
- public Vector2 Screen;
- public bool Alive;
- public int Stance;
- public int Health;
- public Color Color;
- public bool DrawBBox;
- [Flags]
- private enum Read
- {
- None = 0x0,
- Position = 0x1,
- Yaw = 0x2,
- Pitch = 0x4,
- Name = 0x8,
- Stance = 0x10,
- Health = 0x20
- }
- public ENTITY(long lbase)
- {
- Base = lbase;
- //Id = Main.GameMemory.ReadInt32(lbase + Offset.Id); // this in combination with type is unique identifier (for aimbot)
- Type = Main.GameMemory.ReadInt32(lbase + Offset.Type);
- // all others will be set to binary representation of 0 by compiler
- }
- public void ReadName()
- {
- long nameOffset = Main.GameMemory.ReadInt64(Base + Offset.Name);
- int nameLength = Math.Min(256, Main.GameMemory.ReadInt32(Base + Offset.NameLength)); // don't read more than 256 bytes
- Name = Main.GameMemory.ReadString(nameOffset, nameLength);
- }
- public void ReadPosition(bool readYaw = false)
- {
- byte[] xyz;
- long posOffset;
- switch (Type)
- {
- case 0x04: // Player
- case 0x05: // BoyNextDoor
- posOffset = Main.GameMemory.ReadInt64(Base + 0x118);
- xyz = Main.GameMemory.ReadBytes(posOffset + 0x6e4, 4 * 3);
- Position.X = BitConverter.ToSingle(xyz, 0);
- Position.Y = BitConverter.ToSingle(xyz, 4);
- Position.Z = BitConverter.ToSingle(xyz, 8);
- if (readYaw) Yaw = Main.GameMemory.ReadFloat(Base + 0x2D0);
- break;
- case 0x11: // OffRoad
- case 0x72: // Pickup
- case 0x76: // PoliceCar
- posOffset = Main.GameMemory.ReadInt64(Base + 0x118);
- xyz = Main.GameMemory.ReadBytes(posOffset + 0x580, 4 * 3);
- Position.X = BitConverter.ToSingle(xyz, 0);
- Position.Y = BitConverter.ToSingle(xyz, 4);
- Position.Z = BitConverter.ToSingle(xyz, 8);
- if (readYaw) Yaw = (float)Math.Atan2(Main.GameMemory.ReadFloat(posOffset + 0x550), Main.GameMemory.ReadFloat(posOffset + 0x558)) - 0.5f * (float)Math.PI;
- break;
- default:
- xyz = Main.GameMemory.ReadBytes(Base + 0x3C90, 4 * 3);
- Position.X = BitConverter.ToSingle(xyz, 0);
- Position.Y = BitConverter.ToSingle(xyz, 4);
- Position.Z = BitConverter.ToSingle(xyz, 8);
- if (readYaw) Yaw = Main.GameMemory.ReadFloat(Base + 0x2D0);
- break;
- }
- Distance = Vector3.Distance(Position, Main.Player.Position);
- }
- public void ReadPitch() // for players only (erect penis detection)
- {
- Pitch = Main.GameMemory.ReadFloat(Base + 0x2E4);
- }
- public void ReadStance()
- {
- Stance = Main.GameMemory.ReadInt32(Base + Offset.Stance);
- }
- public string GetStance()
- {
- switch (Stance)
- {
- case 0: return "Standing";
- case 1: return "Crouched";
- case 2: return "Walking";
- case 3: return "Running";
- case 4: return "Jumping";
- case 5: return "Crouching";
- case 6: return "Prone";
- case 7: return "Crawling";
- default: return "unknown";
- }
- }
- private void readFromMem(Read what)
- {
- if (what.HasFlag(Read.Name)) ReadName();
- if (what.HasFlag(Read.Position)) ReadPosition(what.HasFlag(Read.Yaw));
- if (what.HasFlag(Read.Pitch)) ReadPitch();
- if (what.HasFlag(Read.Stance)) ReadStance();
- }
- private bool isAlive(bool animal = false)
- {
- Alive = Convert.ToBoolean(Main.GameMemory.ReadByte(Base + Offset.Alive));
- if (animal)
- {
- long HPoffset = Main.GameMemory.ReadInt64(Base + Offset.HPBase);
- if (Main.GameMemory.ReadUInt32(HPoffset + Offset.HP + 4) == 3000) Alive = false; // dirty
- else Alive = true;
- }
- return Alive;
- }
- private bool isVisible() // is it in front of you and within screen area?
- {
- // call readPosition() before you call isVisible() or better call saul
- if (Main.WorldToScreen(Position, out Screen))
- return (Screen.Y > Main.GameWindowRect.Top && Screen.X > Main.GameWindowRect.Left && Screen.X < Main.GameWindowRect.Right && Screen.Y < Main.GameWindowRect.Bottom);
- else return false;
- }
- // TODO: getColorByType, getColorByName
- public void ParseAndRead(ref List<ENTITY> screen, ref List<ENTITY> radar, ref List<ENTITY> list)
- {
- //Read memRadar = Read.Position | Read.Yaw;
- Read memEsp = Read.Name | Read.Health;
- Read memList = Read.Name;
- Read mem = Read.None;
- switch (Type)
- {
- case 0x04: // Player
- case 0x05: // SUMMIIIIIIIIIIIT
- if (isAlive())
- {
- Color = Color.SkyBlue;
- DrawBBox = Main.BoxedPlayers;
- ReadPosition(true);
- if (Main.ShowESP && Main.ShowPlayers && isVisible()) { mem |= memEsp | Read.Stance | Read.Pitch; screen.Add(this); }
- if ((Main.ShowRadar && Main.RadarPlayers) || Main.ShowAdvancedMap) { radar.Add(this); }
- if (Main.ShowEntityLists) { mem |= memList; list.Add(this); }
- readFromMem(mem);
- }
- break;
- case 0x0C: // Zombie
- case 0x5B: // Zombie
- if (isAlive(true))
- {
- Color = Color.Crimson;
- DrawBBox = Main.BoxedAggressive;
- ReadPosition(true);
- if (Main.ShowESP && Main.ShowAggressive && isVisible()) { mem |= memEsp | Read.Stance; screen.Add(this); }
- if ((Main.ShowRadar && Main.RadarAggressive) || Main.ShowAdvancedMap) { radar.Add(this); }
- if (Main.ShowEntityLists) { mem |= memList; list.Add(this); }
- readFromMem(mem);
- }
- break;
- case 0x14: // Wolf
- case 0x50: // Bear
- if (isAlive(true))
- {
- Color = Color.OrangeRed;
- DrawBBox = Main.BoxedAggressive;
- ReadPosition(true);
- if (Main.ShowESP && Main.ShowAggressive && isVisible()) { mem |= memEsp; screen.Add(this); }
- if ((Main.ShowRadar && Main.RadarAggressive) || Main.ShowAdvancedMap) { radar.Add(this); }
- if (Main.ShowEntityLists) { mem |= memList; list.Add(this); }
- readFromMem(mem);
- }
- break;
- case 0x13: // Deer
- case 0x55: // Rabbit
- if (isAlive(true))
- {
- Color = Color.OliveDrab;
- DrawBBox = Main.BoxedAnimals;
- ReadPosition(true);
- if (Main.ShowESP && Main.ShowAnimals && isVisible()) { mem |= memEsp; screen.Add(this); }
- if ((Main.ShowRadar && Main.RadarAnimals) || Main.ShowAdvancedMap) { radar.Add(this); }
- if (Main.ShowEntityLists) { mem |= memList; list.Add(this); }
- readFromMem(mem);
- }
- break;
- case 0x11: // OffRoad
- case 0x72: // Pickup
- case 0x76: // PoliceCar
- Color = Color.HotPink;
- DrawBBox = Main.BoxedVehicles;
- ReadPosition(true);
- if (Main.ShowESP && Main.ShowVehicles && isVisible()) { mem |= memEsp; screen.Add(this); }
- if ((Main.ShowRadar && Main.RadarVehicles) || Main.ShowAdvancedMap) { radar.Add(this); }
- if (Main.ShowEntityLists) { mem |= memList; list.Add(this); }
- readFromMem(mem);
- break;
- case 0x34: // Weapons
- ReadPosition();
- if (Main.ShowESP && Main.ShowWeapons && isVisible())
- {
- ReadName();
- if (Name.Contains(".308") || Name.Contains("Shotgun") || Name == "AR15" || Name == "M1911A1" || Name.Contains("M9") || Name == "R380" || Name.Contains("Magnum"))
- Color = Color.Gold;
- else Color = Color.BurlyWood;
- mem |= memEsp & ~Read.Name;
- screen.Add(this);
- }
- readFromMem(mem);
- break;
- case 0x15: // Ammo, Water, Bottle, Food, ...
- ReadPosition();
- if (Main.ShowESP && Main.ShowAmmo && isVisible())
- {
- ReadName();
- if (Name.Contains(".") || Name.Contains("Shell") || Name.Contains("mm"))
- Color = Color.Orange;
- else Color = Color.Plum;
- mem |= memEsp & ~Read.Name;
- screen.Add(this);
- }
- readFromMem(mem);
- break;
- case 0x2E: // Loot
- Color = Color.GreenYellow;
- ReadPosition();
- if (Main.ShowESP && Main.ShowItems && isVisible()) { mem |= memEsp; screen.Add(this); }
- readFromMem(mem);
- break;
- case 0x1B: // Campfire
- case 0x6D: // Stash
- case 0x9C: // Land Mine, IED
- Color = Color.SaddleBrown;
- ReadPosition();
- if (Main.ShowESP && Main.ShowItems && isVisible()) { mem |= memEsp; screen.Add(this); }
- readFromMem(mem);
- break;
- case 0x2F: // Furnace
- case 0x33: // Storage Container
- case 0x35: // Animal Trap
- case 0x36: // Dew Collector
- case 0x53: // Barbeque
- Color = Color.Gray;
- ReadPosition();
- if (Main.ShowESP && Main.ShowContainers && isVisible()) { mem |= memEsp; screen.Add(this); }
- readFromMem(mem);
- break;
- case 0x2C: // First Aid, Helmet, Backpack, Armor, Helmet, Battery, Sparkplugs, ...
- ReadPosition();
- if (Main.ShowESP && Main.ShowItems && isVisible())
- {
- ReadName();
- if (Name.Contains("Battery") || Name.Contains("Sparkplugs") || Name.Contains("Turbo") || Name.Contains("Headlights")) Color = Color.DeepPink;
- else if (Name.Contains("First")) Color = Color.LimeGreen;
- else Color = Color.White;
- mem |= memEsp & ~Read.Name;
- if (!Name.Contains("T-") && !Name.Contains("Duct")) screen.Add(this); // hide T-Shirts & Duct Tapes
- }
- readFromMem(mem);
- break;
- case 0x16: // Dresser
- case 0x17: // Armoire
- case 0x19: // World Doors
- case 0x1D: // Cabinets
- case 0x1E: // Cabinets
- case 0x21: // Cabinets
- case 0x22: // Cabinets
- case 0x23: // Cabinets
- case 0x25: // Refrigerator
- case 0x26: // Garbage Can
- case 0x28: // Cabinets
- case 0x29: // Desk
- case 0x27: // Dumpster
- case 0x30: // File Cabinet
- case 0x31: // Tool Cabinet
- case 0x37: // Recycle Bin (with fire)
- case 0x38: // Punji Sticks
- case 0x3D: // Wooded Barricade
- case 0x3E: // Water Well
- case 0x3F: // Armoire
- case 0x40: // Dresser
- case 0x42: // Chest
- case 0x44: // Wrecked Sedan
- case 0x45: // Wrecked Van
- case 0x46: // Wrecked Truck
- case 0x49: // Ottoman
- case 0x4A: // Ottoman
- case 0x4F: // Designer-placed(?) Door
- case 0x5D: // File Cabinet
- case 0x61: // Cabinets
- case 0x63: // Cabinets
- case 0x6F: // Locker
- case 0x70: // Weapon Locker
- case 0x71: // Glass Cabinet
- case 0x79: // Designer-placed(?) Door
- case 0x7A: // Resting (Bed)
- case 0x7B: // Designer-placed(?) Door
- case 0x7C: // Designer-placed(?) Door
- case 0x7D: // IO.FireHydrant
- case 0x7E: // IO.FireHydrant
- case 0x80: // Cabinets
- case 0x81: // Cabinets
- case 0x82: // Cabinets
- case 0x83: // Cabinets
- case 0x84: // Cabinets
- case 0x85: // Cabinets
- case 0x86: // Cabinets
- case 0x87: // Cabinets
- case 0x88: // Cabinets
- case 0x89: // Cabinets
- case 0xA1: // Washing Machine
- case 0xA2: // Dryer
- break;
- case 0x3B: // Ground Tamper
- case 0x4C: // Shed
- case 0x5F: // Metal Wall/Gate
- case 0x62: // Basic Shack Door
- case 0x6E: // Desk Foundation
- case 0x9E: // Metal Door
- case 0xA6: // Large Shelter
- case 0xA7: // Shed
- break;
- case 0x2D: // Flare
- case 0xA8: // Torch
- case 0xA0: // Corn Seeds, Wheat Seeds
- case 0x78: // Parachute
- case 0xAA: // BeeBox
- // 0x2A: Handcuff Key
- // 0xAD: Explosive Barel
- // 0xB5: Fuel
- break;
- default: // Other Items, append type to name
- ReadPosition();
- if (Main.ShowESP && Main.ShowItems && isVisible())
- {
- Color = Color.Teal;
- ReadName();
- Name = Name + "[" + Type.ToString("X2") + "]";
- mem |= memEsp & ~Read.Name;
- screen.Add(this);
- }
- readFromMem(mem);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement