internal static void CastAoe(string parSpellName, Objects.Location parSpellPos) { lock (Inject.inject_Lock) { DoString("CastSpellByName('" + parSpellName + "')"); uint posStruc = BmWrapper.memory.AllocateMemory(12); if (posStruc != 0) { bool b1 = BmWrapper.memory.WriteFloat(posStruc, parSpellPos.x); bool b2 = BmWrapper.memory.WriteFloat(posStruc + 4, parSpellPos.y); bool b3 = BmWrapper.memory.WriteFloat(posStruc + 8, parSpellPos.z); if (b1 && b2 && b3) { // Write the asm stuff for Lua_DoString String[] asm = new String[] { "mov eax, 0x40", "mov [0xCECAC0], eax", "mov eax, [" + Inject.PlayerPtr + "]", "mov ecx, " + (uint)posStruc, "call " + (uint)0x6E60F0, "retn", }; Inject.InjectAndExecute(asm, true); } BmWrapper.memory.FreeMemory(posStruc); } } }
private Objects.Location CentralizeMemoryLocation(Objects.Location memLoc, Map.Tile playerTile) { // 8,6 == center int diffX = 8 - playerTile.RealMemoryLocation.X; int diffY = 6 - playerTile.RealMemoryLocation.Y; Objects.Location loc = memLoc.Offset(diffX, diffY); int maxX = Constants.Map.MaxX, maxY = Constants.Map.MaxY; if (loc.X >= maxX) { loc.X -= maxX; } else if (loc.X < 0) { loc.X += maxX; } if (loc.Y >= maxY) { loc.Y -= maxY; } else if (loc.Y < 0) { loc.Y += maxY; } return(loc); }
/// <summary> /// Gets a world location based on a memory location. /// </summary> /// <param name="worldLocation">The world location to use as reference.</param> /// <param name="playerTile">The player's tile to use as reference.</param> /// <returns></returns> private Objects.Location WorldLocationToMemoryLocation(Objects.Location worldLocation, Map.Tile playerTile) { // get and apply diffs int diffX = worldLocation.X - playerTile.WorldLocation.X; int diffY = worldLocation.Y - playerTile.WorldLocation.Y; int diffZ = worldLocation.Z - playerTile.WorldLocation.Z; Objects.Location memLoc = playerTile.RealMemoryLocation.Offset(diffX, diffY, diffZ); // re-align values if they're out of range if (memLoc.X < 0) { memLoc.X += Constants.Map.MaxX; } else if (memLoc.X >= Constants.Map.MaxX) { memLoc.X -= Constants.Map.MaxX; } if (memLoc.Y < 0) { memLoc.Y += Constants.Map.MaxY; } else if (memLoc.Y >= Constants.Map.MaxY) { memLoc.Y -= Constants.Map.MaxY; } return(memLoc); }
internal static void TurnCharacter(Objects.Location Loc) { lock (Inject.inject_Lock) { float f = (float)Math.Atan2(Loc.y - ObjectManager.PlayerObject.Pos.y, Loc.x - ObjectManager.PlayerObject.Pos.x); if (f < 0.0f) { f = f + PI * 2.0f; } else { if (f > PI * 2) { f = f - PI * 2.0f; } } // Write the asm stuff for Lua_DoString String[] asm = new String[] { //"mov EAX, [" + Inject.PlayerPtr + "]", "mov ECX, [" + Inject.PlayerPtr + "]", // movement struct "add ECX, 0x9A8", "push 0x" + FloatToHex32(f), "call " + (uint)Offsets.functions.SetFacing, // Set Facing Funktion "retn" }; //Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " Calling Set Facing Update"); Inject.InjectAndExecute(asm, true); SendMovementUpdate(0xDA, (uint)Environment.TickCount); } }
/// <summary> /// Attempts to use an item on a world location. /// </summary> /// <param name="itemid">The item's ID.</param> /// <param name="loc">The world location to use the item on.</param> public void HotkeyUseItemOnLocation(ushort itemid, Objects.Location loc) { if (itemid == 0 || !loc.IsValid()) { return; } }
/// <summary> /// Checks whether this location is inside a pre-defined area. /// </summary> /// <param name="areaEffect">The area effect used.</param> /// <param name="location">The center of the area.</param> /// <param name="direction">The direction of the area effect used.</param> /// <returns></returns> public bool IsInAreaEffect(Objects.AreaEffect areaEffect, Objects.Location location, Enums.Direction direction) { ushort y = 0; Objects.Location currentLoc = this.Clone(); byte dir = areaEffect.Type == AreaEffect.EffectType.Spell ? (byte)direction : (byte)1; foreach (byte[] row in areaEffect.GetArea()) { int center = row.Length / 2; for (int i = 0; i < row.Length; i++) { if (row[i] != dir) { continue; } if (location.Offset(i - center, y, 0) == currentLoc) { return(true); } } y++; } return(false); }
public static bool Send(Objects.Client client, Objects.Location location) { TileUpdatePacket p = new TileUpdatePacket(client); p.Location = location; return(p.Send()); }
protected bool ParseTileDescription(NetworkMessage msg, Objects.Location pos, NetworkMessage outMsg) { int n = 0; bool ret = true; Tile tile = new Tile(Client, 0, pos); while (true) { ushort inspectTileId = msg.PeekUInt16(); if (inspectTileId >= 0xFF00) { //end of the tile ret = true; break; } else { if (n > 10) { ret = false; break; } //read tile things: items and creatures ParseThing(msg, pos, tile, n, outMsg); } n++; } tiles.Add(tile); return(ret); }
public MergedChunk GetMergedChunk(Objects.Location start, Objects.Location end) { Objects.Location minimapStart = this.GetAlignedMiniMapLocation(new Objects.Location(Math.Min(start.X, end.X), Math.Min(start.Y, end.Y), Math.Min(start.Z, end.Z))); Objects.Location minimapEnd = this.GetAlignedMiniMapLocation(new Objects.Location(Math.Max(start.X, end.X), Math.Max(start.Y, end.Y), Math.Max(start.Z, end.Z))); // check if only one chunk if necessary if (minimapStart == minimapEnd) { int address = 0; if (this.ExistsInMemory(minimapStart, ref address)) { return(new MergedChunk(this.Client, start, new FastChunk(this.Client, address).GetNodes(start, end))); } FileInfo fi = null; if ((fi = this.GetMapFile(minimapStart)) != null) { return(new MergedChunk(this.Client, start, new FastChunk(this.Client, fi).GetNodes(start, end))); } return(null); } // get several chunks return(this.GetCombinedChunks(ChunkTypes.Fast, start, end).GetMergedChunk(start, end)); }
public IEnumerable <FileInfo> GetMapFiles(Objects.Location worldStart, Objects.Location worldEnd) { Objects.Location minimapStart = this.GetAlignedMiniMapLocation( new Objects.Location(Math.Min(worldStart.X, worldEnd.X), Math.Min(worldStart.Y, worldEnd.Y), Math.Min(worldStart.Z, worldEnd.Z))); Objects.Location minimapEnd = this.GetAlignedMiniMapLocation( new Objects.Location(Math.Max(worldStart.X, worldEnd.X), Math.Max(worldStart.Y, worldEnd.Y), Math.Max(worldStart.Z, worldEnd.Z))); for (int z = 0; z <= minimapEnd.Z - minimapStart.Z; z++) { for (int y = 0; y <= minimapEnd.Y - minimapStart.Y; y++) { for (int x = 0; x <= minimapEnd.X - minimapStart.X; x++) { FileInfo fi = this.GetMapFile(minimapStart.Offset(x, y, z)); if (fi != null) { yield return(fi); } } } } }
private void picboxMap_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { this.mouseRightClickPosition = e.Location; // get world location of mouse click Objects.Location worldLoc = new Objects.Location(this.CurrentFloorBounds.X + this.CurrentLocation.X + (int)(e.Location.X / this.Scale), this.CurrentFloorBounds.Y + this.CurrentLocation.Y + (int)(e.Location.Y / this.Scale), this.CurrentLocation.Z); bool found = false; foreach (Modules.Cavebot.Waypoint wp in this.Client.Modules.Cavebot.GetWaypoints()) { if (wp.Location.DistanceTo(worldLoc) < 10 / this.Scale) { found = true; this.selectedWaypoint = wp; break; } } if (!found) { this.selectedWaypoint = null; } contextitemWaypointRemove.Enabled = found; contextmenuMap.Show(Cursor.Position); } }
public Objects.Location GetAlignedMiniMapLocation(Objects.Location worldLocation) { int multiplier = this.Client.Addresses.MiniMap.WorldLocationMultiplier; return(new Objects.Location((ushort)(worldLocation.X / multiplier), (ushort)(worldLocation.Y / multiplier), worldLocation.Z)); }
private void picboxMap_MouseMove(object sender, MouseEventArgs e) { if (this.mouseIsPressed) { int margin = 1500; Objects.Location newLoc = new Objects.Location(this.CurrentLocation.X + this.mouseOldPosition.X - e.Location.X, this.CurrentLocation.Y + this.mouseOldPosition.Y - e.Location.Y, this.CurrentLocation.Z); if (newLoc.X > 0 - margin && newLoc.Y > 0 - margin && newLoc.X < this.CurrentFloorBounds.Width + margin && newLoc.Y < this.CurrentFloorBounds.Height + margin) { this.CurrentLocation = newLoc; this.mouseOldPosition = e.Location; picboxMap.Invalidate(); } } else { Objects.Location worldLocation = this.CurrentLocation.Offset((int)(e.Location.X / this.Scale), (int)(e.Location.Y / this.Scale), 0); worldLocation.X += this.CurrentFloorBounds.X; worldLocation.Y += this.CurrentFloorBounds.Y; this.hoveredWaypoint = null; foreach (var wp in this.Client.Modules.Cavebot.GetWaypoints()) { if (worldLocation.DistanceTo(wp.Location) < 5) { this.hoveredWaypoint = wp; //picboxMap.Invalidate(); break; } } } }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination, NetworkMessage outMsg) { if (msg.GetByte() != (byte)IncomingPacketType.TileUpdate) { return(false); } Destination = destination; Type = IncomingPacketType.TileUpdate; outMsg.AddByte((byte)Type); Objects.Location pos = msg.GetLocation(); outMsg.AddLocation(pos); ushort thingId = msg.PeekUInt16(); if (thingId == 0xFF01) { outMsg.AddUInt16(msg.GetUInt16()); } else { ParseTileDescription(msg, pos, outMsg); outMsg.AddUInt16(msg.GetUInt16()); } return(true); }
internal static bool teleToMaster() { try { leader = ObjectManager.leader; if (leader.Pos.differenceToPlayer() > 30 || forceTele) { Objects.Location tmp = clientConnect.requestCoords(); if (tmp.x != 0 && tmp.y != 0 && tmp.z != 0) { Calls.StopRunning(); Ingame.DismissPet(); Thread.CurrentThread.Join(2000); Ingame.Tele(tmp, 60, false); forceTele = false; return(true); } } } catch { } forceTele = false; return(false); }
private void comboboxWaypoint_SelectedIndexChanged(object sender, EventArgs e) { if (comboboxWaypoint.SelectedIndex < 0) { return; } if (comboboxWaypoint.SelectedIndex == 0) { Modules.Cavebot.Waypoint wp = (Modules.Cavebot.Waypoint)comboboxWaypoint.SelectedItem; comboboxType.Enabled = true; foreach (object obj in comboboxType.Items) { if (obj.ToString() == wp.Type.ToString()) { comboboxWaypoint.SelectedItem = obj; break; } } numericLocX.Value = wp.Location.X; numericLocY.Value = wp.Location.Y; numericLocZ.Value = wp.Location.Z; } else { Objects.Location subnode = (Objects.Location)comboboxWaypoint.SelectedItem; comboboxType.Enabled = false; numericLocX.Value = subnode.X; numericLocY.Value = subnode.Y; numericLocZ.Value = subnode.Z; } }
/// <summary> /// Constructor for a script in a file and is associated with a world location. /// </summary> /// <param name="c">The Objects.Client object that will host this Script object.</param> /// <param name="scriptFileh">The script file.</param> /// <param name="wpLocation">The world location associated with this script.</param> public Script(Objects.Client c, FileInfo scriptFile, Objects.Location wpLocation) { this.Client = c; this.ScriptFile = scriptFile; this.WaypointLocation = wpLocation; this.TTS = new SpeechSynthesizer(); this.ResetEventLoaded = new AutoResetEvent(false); }
private void AddWaypoint(Modules.Cavebot.Waypoint.Types waypointType, Point location) { Objects.Location worldLocation = this.CurrentLocation.Offset((int)(location.X / this.Scale), (int)(location.Y / this.Scale), 0); worldLocation.X += this.CurrentFloorBounds.X; worldLocation.Y += this.CurrentFloorBounds.Y; this.Client.Modules.Cavebot.AddWaypoint(new Modules.Cavebot.Waypoint(this.Client.Modules.Cavebot, worldLocation, waypointType)); this.picboxMap.Invalidate(); }
private void downUseToolStripMenuItem_Click(object sender, EventArgs e) { Objects.Location l = Core.client.PlayerLocation; Objects.Bot.Waypoint w = new Objects.Bot.Waypoint(); w.Location = l; w.Type = Constants.WaypointType.DownUse; Core.Global.Waypoints.Add(w); }
internal static void setCoords(Objects.Location TargetPos) { uint ptr = ObjectManager.playerPtr + 0x9B8; BmWrapper.memory.WriteFloat(ptr, TargetPos.x); BmWrapper.memory.WriteFloat(ptr + 4, TargetPos.y); BmWrapper.memory.WriteFloat(ptr + 8, TargetPos.z); }
/// <summary> /// Attempts to use an item on a world location. /// If possible, use UseItemOnTile instead, as it provides better performance. /// </summary> /// <param name="itemLocation">The item's location.</param> /// <param name="loc">The world location to use the item on.</param> public void UseItemOnLocation(Objects.ItemLocation itemLocation, Objects.Location loc) { if (itemLocation == null || !loc.IsValid()) { return; } this.UseItemOnTile(itemLocation, this.Client.Map.GetTile(loc, null)); }
/// <summary> /// Gets a collection of nearby tiles. /// </summary> /// <param name="loc">The parent tile's world location.</param> /// <param name="range">How far away from the tile to get tiles.</param> /// <returns></returns> public TileCollection GetNearbyTileCollection(Objects.Location loc, byte range) { Map.Tile tile = this.GetTile(loc); if (tile == null) { return(new TileCollection(this.Client, Enumerable.Empty <Map.Tile>())); } return(this.GetNearbyTileCollection(tile, range)); }
public static bool Send(Objects.Client client, Objects.Location fromLocation, Objects.Location toLocation, ProjectileType effect) { ProjectilePacket p = new ProjectilePacket(client); p.FromPosition = fromLocation; p.ToPosition = toLocation; p.Effect = effect; return(p.Send()); }
private void westToolStripMenuItem1_Click(object sender, EventArgs e) { Objects.Location l = Core.client.PlayerLocation; Objects.Bot.Waypoint w = new Objects.Bot.Waypoint(); l.X -= 1; w.Location = l; w.Type = Constants.WaypointType.Machete; Core.Global.Waypoints.Add(w); }
/// <summary> /// Gets a collection of adjacent tiles. /// </summary> /// <param name="loc">The parent tile's world location.</param> /// <returns></returns> public IEnumerable <Map.Tile> GetAdjacentTiles(Objects.Location loc) { Map.Tile tile = this.GetTile(loc); if (tile == null) { return(Enumerable.Empty <Map.Tile>()); } return(this.GetNearbyTiles(tile, 1)); }
public static bool Send(Objects.Client client, string message, Objects.Location position, TextColor color) { AnimatedTextPacket p = new AnimatedTextPacket(client); p.Message = message; p.Location = position; p.Color = color; return(p.Send()); }
public static bool Send(Objects.Client client, Objects.Location position, ushort spriteId, byte stackPosition) { LookAtPacket p = new LookAtPacket(client); p.Location = position; p.SpriteId = spriteId; p.StackPosition = stackPosition; return(p.Send()); }
/// <summary> /// Constructor for a scripted waypoint. /// </summary> /// <param name="parent">The Cavebot module that will host this object.</param> /// <param name="loc">A world location.</param> /// <param name="code">The C# code that will be loaded as a script.</param> public Waypoint(Cavebot parent, Objects.Location loc, string code, string label = "") { this.Parent = parent; this.Location = loc; this.Script = new Script(this.Parent, code, this); this.Type = Types.Script; this.NodeLocations = new List <Objects.Location>(); this.Label = label; }
public IEnumerable <Node> FindPath(Objects.Location start, Objects.Location end, bool stopWhenAdjacent = false) { if (start.Z != end.Z) { throw new Exception("start.Z must be the same as end.Z"); } return(this.FindPath(new Point(start.X, start.Y), new Point(end.X, end.Y), stopWhenAdjacent)); }
public ChunkCollection GetChunksInMemory(ChunkTypes desiredType, Objects.Location start, Objects.Location end) { if (desiredType == ChunkTypes.Merged) { throw new Exception("desiredType can not be Merged"); } return(this.GetChunksInMemory(desiredType).GetChunkCollection(start, end)); }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) { if (msg.GetByte() != (byte)OutgoingPacketType.TileUpdate) return false; Destination = destination; Type = OutgoingPacketType.TileUpdate; Location = msg.GetLocation(); return true; }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) { int position = msg.Position; if (msg.GetByte() != (byte)IncomingPacketType.MagicEffect) return false; Destination = destination; Type = IncomingPacketType.MagicEffect; Position = msg.GetLocation(); Effect = msg.GetByte(); return true; }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) { int position = msg.Position; if (msg.GetByte() != (byte)IncomingPacketType.TileRemoveThing) return false; Destination = destination; Type = IncomingPacketType.TileRemoveThing; Position = msg.GetLocation(); StackPosition = msg.GetByte(); return true; }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) { int position = msg.Position; if (msg.GetByte() != (byte)IncomingPacketType.CreatureMove) return false; Destination = destination; Type = IncomingPacketType.CreatureMove; FromLocation = msg.GetLocation(); FromStackPosition = msg.GetByte(); ToLocation = msg.GetLocation(); return true; }
private void picboxMap_MouseMove(object sender, MouseEventArgs e) { if (this.mouseIsPressed) { int margin = 1500; Objects.Location newLoc = new Objects.Location(this.CurrentLocation.X + this.mouseOldPosition.X - e.Location.X, this.CurrentLocation.Y + this.mouseOldPosition.Y - e.Location.Y, this.CurrentLocation.Z); if (newLoc.X > 0 - margin && newLoc.Y > 0 - margin && newLoc.X < this.CurrentFloorBounds.Width + margin && newLoc.Y < this.CurrentFloorBounds.Height + margin) { this.CurrentLocation = newLoc; this.mouseOldPosition = e.Location; picboxMap.Invalidate(); } } else { Objects.Location worldLocation = this.CurrentLocation.Offset((int)(e.Location.X / this.Scale), (int)(e.Location.Y / this.Scale), 0); worldLocation.X += this.CurrentFloorBounds.X; worldLocation.Y += this.CurrentFloorBounds.Y; this.hoveredWaypoint = null; foreach (var wp in this.Client.Modules.Cavebot.GetWaypoints()) { if (worldLocation.DistanceTo(wp.Location) < 5) { this.hoveredWaypoint = wp; //picboxMap.Invalidate(); break; } } } }
private void telePointGrid_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (!gotJob) { if (e.RowIndex != -1) { telePoint t = (telePoint)telePointGrid.CurrentRow.Cells[0].Value; if (t.mapId == ObjectManager.MapId) { curLoc = new Objects.Location(t.x, t.y, t.z); gotJob = true; } } } }
/// <summary> /// Loads data (waypoints, loot, targets, settings) from a binary file loaded into a Objects.Packet object. /// </summary> /// <param name="version">The version of LibreBot which created the file.</param> /// <param name="p">The Objects.Packet object.</param> /// <returns></returns> private bool Load(ushort version, Objects.Packet p) { while (p.GetPosition < p.Length) { Enums.CavebotDatType type = (Enums.CavebotDatType)p.GetByte(); ushort count = 0; switch (type) { case Enums.CavebotDatType.Settings: switch (version) { case 212: case 213: this.CurrentSettings.EatFood = p.GetBool(); this.CurrentSettings.Exhaust = p.GetUInt16(); this.CurrentSettings.MinimumHealthToShoot = p.GetUInt16(); this.CurrentSettings.NodeRadius = p.GetByte(); this.CurrentSettings.NodeSkipRange = p.GetByte(); this.CurrentSettings.OpenContainers = p.GetBool(); this.CurrentSettings.PrioritizeDanger = p.GetBool(); this.CurrentSettings.StickToCreature = p.GetBool(); this.CurrentSettings.StopAttackingWhenOutOfRange = p.GetBool(); this.CurrentSettings.UseGoldStacks = p.GetBool(); this.CurrentSettings.CanUseMagicRope = p.GetBool(); this.CurrentSettings.UseAlternateNodeFinder = p.GetBool(); this.CurrentSettings.KillBeforeLooting = p.GetBool(); break; default: this.CurrentSettings.EatFood = p.GetBool(); this.CurrentSettings.Exhaust = p.GetUInt16(); this.CurrentSettings.MinimumHealthToShoot = p.GetUInt16(); this.CurrentSettings.NodeRadius = p.GetByte(); this.CurrentSettings.NodeSkipRange = p.GetByte(); this.CurrentSettings.OpenContainers = p.GetBool(); this.CurrentSettings.PrioritizeDanger = p.GetBool(); this.CurrentSettings.StickToCreature = p.GetBool(); this.CurrentSettings.StopAttackingWhenOutOfRange = p.GetBool(); this.CurrentSettings.UseGoldStacks = p.GetBool(); this.CurrentSettings.CanUseMagicRope = p.GetBool(); break; } break; case Enums.CavebotDatType.Loot: count = p.GetUInt16(); for (int i = 0; i < count; i++) { switch (version) { default: Loot l = new Loot(); l.ID = p.GetUInt16(); l.Name = p.GetString(); l.Cap = p.GetUInt16(); string destination = p.GetString(); switch (destination.ToLower()) { case "ground": l.Destination = Loot.Destinations.Ground; break; default: l.Destination = Loot.Destinations.EmptyContainer; l.Index = byte.Parse(destination[1].ToString()); break; } this.AddLoot(l); break; case 213: this.AddLoot(new Loot(p.GetUInt16(), p.GetString(), p.GetUInt16(), (Loot.Destinations)p.GetByte(), p.GetByte())); break; } } break; case Enums.CavebotDatType.Targetting: count = p.GetUInt16(); for (int i = 0; i < count; i++) { Target t = new Target(this); t.Name = p.GetString(); if (version < 212) // load old settings (single setting environment) { Target.Setting setting = new Target.Setting(t); setting.Count = p.GetByte(); setting.Range = p.GetByte(); setting.DistanceRange = 3; setting.FightMode = (Enums.FightMode)p.GetByte(); setting.FightStance = (Enums.FightStance)p.GetByte(); p.GetString(); // ring p.GetString(); // rune setting.Spell = p.GetString(); setting.DangerLevel = p.GetByte(); p.GetBool(); // friendly mode setting.MustBeReachable = p.GetBool(); setting.MustBeShootable = p.GetBool(); t.DoLoot = p.GetBool(); setting.UseThisSetting = true; p.GetBool(); // alarm, deprecated t.SetSettings(new List<Target.Setting>() { setting }); } else // load new settings (multiple setting environment) { ushort settingsCount = p.GetUInt16(); List<Target.Setting> settings = new List<Target.Setting>(); for (int j = 0; j < settingsCount; j++) { Target.Setting setting = new Target.Setting(t); setting.Count = p.GetByte(); setting.Range = p.GetByte(); setting.DistanceRange = 3; setting.FightMode = (Enums.FightMode)p.GetByte(); setting.FightStance = (Enums.FightStance)p.GetByte(); p.GetString(); // ring p.GetString(); // rune setting.Spell = p.GetString(); setting.DangerLevel = p.GetByte(); p.GetBool(); // friendly mode setting.MustBeReachable = p.GetBool(); setting.MustBeShootable = p.GetBool(); t.DoLoot = p.GetBool(); setting.UseThisSetting = true; settings.Add(setting); } t.SetSettings(settings); } this.AddTarget(t); } break; case Enums.CavebotDatType.Waypoints: count = p.GetUInt16(); for (int i = 0; i < count; i++) { Modules.Cavebot.Waypoint.Types wpType = (Modules.Cavebot.Waypoint.Types)p.GetByte(); Objects.Location wpLocation = new Objects.Location(p.GetUInt16(), p.GetUInt16(), p.GetByte()); string wpLabel = p.GetString(); List<Objects.Location> wpNodes = new List<Objects.Location>(); string wpScript = string.Empty; switch (wpType) { case Modules.Cavebot.Waypoint.Types.Node: switch (version) { case 200: this.AddWaypoint(new Waypoint(this, wpLocation, wpType)); break; case 201: default: ushort nodeCount = p.GetUInt16(); for (int j = 0; j < nodeCount; j++) wpNodes.Add(new Objects.Location(p.GetUInt16(), p.GetUInt16(), p.GetByte())); this.AddWaypoint(new Waypoint(this, wpLocation, wpNodes)); break; } break; case Modules.Cavebot.Waypoint.Types.Script: if (version == 211) { ushort scriptCount = p.GetUInt16(); List<Objects.Script> scripts = new List<Objects.Script>(); string filePath = p.GetString(); string contents = System.IO.File.Exists(filePath) ? System.IO.File.ReadAllText(filePath) : string.Empty; /*for (int j = 0; j < scriptCount; j++) { string fileName = p.GetString(); if (!System.IO.File.Exists(fileName)) continue; Objects.Script script = new Objects.Script(this.Client, fileName, wpLocation); scripts.Add(script); }*/ this.AddWaypoint(new Waypoint(this, wpLocation, contents)); } else { wpScript = p.GetString(); this.AddWaypoint(new Waypoint(this, wpLocation, wpScript)); } break; default: this.AddWaypoint(new Waypoint(this, wpLocation, wpType)); break; } } break; default: return false; } } return true; }
public override void Run() { if (!StockadesContainer.done && !ObjectManager.isDeath) { if (StockadesContainer.doOncePerRun) { waitTollerance = 0; Calls.DoString("ResetInstances()"); } Thread.Sleep(250); List<Objects.GameObject> chestList = ObjectManager.GetGameObjectsByName("Large Solid Chest"); int i = 0; while (i < chestList.Count) { if (Ingame.IsDc()) return; if (ObjectManager.FreeBagSlots >= 3) { if (chestList[i].baseAdd != 0) { if (chestList[i].Pos.differenceToPlayer() > 2) { Objects.Location tmpPos = new Objects.Location(); tmpPos.x = chestList[i].Pos.x; tmpPos.y = chestList[i].Pos.y; tmpPos.z = chestList[i].Pos.z - 4; Ingame.Tele(tmpPos, 60, false); waitTollerance = 0; } else { try { int tmp = Environment.TickCount; Calls.OnRightClickObject(chestList[i].baseAdd, 1); Thread.CurrentThread.Join(1000); while (ObjectManager.PlayerObject.IsCasting != 0 && Environment.TickCount - tmp <= 8000) Thread.CurrentThread.Join(10); tmp = Environment.TickCount; while (Calls.IsLooting() == 1 && Environment.TickCount - tmp <= 1000) Thread.CurrentThread.Join(10); Console.WriteLine("WAITING"); i++; } catch { break; } } } else { waitTollerance += 1; if (waitTollerance == 3) { StockadesContainer.done = true; i = int.MaxValue; break; } } } else { StockadesContainer.done = true; i = int.MaxValue; break; } } StockadesContainer.done = true; } if (!ObjectManager.isDeath) { Ingame.KillPlayer(); while (StockadesContainer.isInside && !Ingame.IsDc()) Thread.CurrentThread.Join(10); } else { Calls.DoString("RepopMe();"); } }
public override void Run() { slaveStates.returnCoords = false; MasterContainer.StuckTimer.Reset(); MasterContainer.IsStuck = false; MasterContainer.resetEngage = true; Calls.StopRunning(); Thread.CurrentThread.Join(1000); if (Calls.MovementIsOnly(0x0)) { if (!locationSaved) { MasterContainer.StuckTimer.Reset(); curPoint = new Objects.Location(ObjectManager.PlayerObject.Pos.x, ObjectManager.PlayerObject.Pos.y, ObjectManager.PlayerObject.Pos.z); locationSaved = true; IsVendoring = true; failCounter = 0; failCounter2 = 0; } else { if (Data.VendorLocation.differenceToPlayer() > 2) { if (ObjectManager.playerClass == (uint)Constants.Offsets.classIds.Warlock || ObjectManager.playerClass == (uint)Constants.Offsets.classIds.Hunter) { if (Ingame.GotPet()) { Ingame.DismissPet(); } else { Ingame.Tele(Data.VendorLocation, 60, false); } } else { Ingame.Tele(Data.VendorLocation, 60, false); } } else { if (ObjectManager.playerClass == (byte)Constants.Offsets.classIds.Druid) { SpellManager.CheckSpells(); if (Ingame.druidIsBear()) Ingame.Cast("Bear Form", false); if (Ingame.druidIsCat()) Ingame.Cast("Cat Form", false); Ingame.CastFinal(); } if (Ingame.IsVendorFrameOpen()) { Ingame.SellAllBut(Data.ProtectedItems); cTimer waitTimer = new cTimer(1000); while (!waitTimer.IsReady()) Thread.CurrentThread.Join(100); failCounter2 = failCounter2 + 1; if (Data.gotVendor && ObjectManager.FreeBagSlots <= Data.LeaveFreeSlots) { if (failCounter2 >= 20) { MasterContainer.StopVendor = true; if (Data.StopOnVendorFail) { Master.engine.StopEngine(); Master.Dispose(); } else { GoBack(); } } } else { GoBack(); } } else { Objects.UnitObject tmpObj = ObjectManager.GetUnitByName(Data.VendorName); if (tmpObj.baseAdd != 0) { Calls.OnRightClickUnit(tmpObj.baseAdd, 1); } else { failCounter = failCounter + 1; } cTimer waitTimer = new cTimer(1000); while (!waitTimer.IsReady()) Thread.CurrentThread.Join(100); if (failCounter >= 6) { MasterContainer.StopVendor = true; GoBack(); } } } } } else { Calls.StopRunning(); } }
private void btnWaypointsInsert_Click(object sender, EventArgs e) { if (!Client.Player.Connected || Client.Player.Health == 0) return; if (comboboxWaypointsOffset.SelectedIndex < 0 || comboboxWaypointsType.SelectedIndex < 0 || listboxWaypoints.SelectedIndex < 0) return; Modules.Cavebot.Waypoint.Types type; switch (comboboxWaypointsType.Text) { case "Node": type = Modules.Cavebot.Waypoint.Types.Node; break; case "Walk": type = Modules.Cavebot.Waypoint.Types.Walk; break; case "Rope": type = Modules.Cavebot.Waypoint.Types.Rope; break; case "Shovel": type = Modules.Cavebot.Waypoint.Types.Shovel; break; case "Machete": type = Modules.Cavebot.Waypoint.Types.Machete; break; case "Pick": type = Modules.Cavebot.Waypoint.Types.Pick; break; case "Ladder": type = Modules.Cavebot.Waypoint.Types.Ladder; break; case "Script": type = Modules.Cavebot.Waypoint.Types.Script; break; default: type = Modules.Cavebot.Waypoint.Types.Node; break; } int diffX = 0, diffY = 0; switch (comboboxWaypointsOffset.SelectedIndex) { case 0: break; case 1: diffY = -1; break; case 2: diffX = 1; break; case 3: diffY = 1; break; case 4: diffX = -1; break; } int index = listboxWaypoints.SelectedIndex; if (type == Modules.Cavebot.Waypoint.Types.Script) { Objects.Location loc = new Objects.Location(this.Client.Player.X + diffX, this.Client.Player.Y + diffY, this.Client.Player.Z); Modules.Cavebot.Waypoint wp = new Modules.Cavebot.Waypoint(this.Client.Modules.Cavebot, loc, Modules.Cavebot.Waypoint.Types.Script); this.Client.Modules.Cavebot.InsertWaypoint(wp, index); } else { Modules.Cavebot.Waypoint wp = new Modules.Cavebot.Waypoint(this.Client.Modules.Cavebot, new Objects.Location(this.Client.Player.X + diffX, this.Client.Player.Y + diffY, this.Client.Player.Z), type); if (type == Modules.Cavebot.Waypoint.Types.Node && numericSettingsNodeRadius.Value > 0) { ushort pX = this.Client.Player.X, pY = this.Client.Player.Y; byte pZ = this.Client.Player.Z, radius = (byte)numericSettingsNodeRadius.Value; Map.TileCollection tiles = this.Client.Map.GetTilesOnScreen(); Map.Tile playerTile = tiles.GetTile(count: this.Client.Player.ID); if (playerTile == null) { MessageBox.Show("Could not find player tile"); return; } List<Objects.Location> nodeLocations = new List<Objects.Location>(); for (ushort x = (ushort)(pX - radius); x < pX + radius; x++) { for (ushort y = (ushort)(pY - radius); y < pY + radius; y++) { if (x == pX && y == pY) continue; Map.Tile tile = tiles.GetTile(new Objects.Location(x, y, pZ)); if (tile == null) continue; if (tile.IsWalkable()) nodeLocations.Add(tile.WorldLocation); } } wp.NodeLocations.AddRange(nodeLocations); } this.Client.Modules.Cavebot.InsertWaypoint(wp, index); } }
private void picboxMap_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { this.mouseRightClickPosition = e.Location; // get world location of mouse click Objects.Location worldLoc = new Objects.Location(this.CurrentFloorBounds.X + this.CurrentLocation.X + (int)(e.Location.X / this.Scale), this.CurrentFloorBounds.Y + this.CurrentLocation.Y + (int)(e.Location.Y / this.Scale), this.CurrentLocation.Z); bool found = false; foreach (Modules.Cavebot.Waypoint wp in this.Client.Modules.Cavebot.GetWaypoints()) { if (wp.Location.DistanceTo(worldLoc) < 10 / this.Scale) { found = true; this.selectedWaypoint = wp; break; } } if (!found) this.selectedWaypoint = null; contextitemWaypointRemove.Enabled = found; contextmenuMap.Show(Cursor.Position); } }