private void KeepStance(Creature c, Objects.Bot.Target t) { while (Core.client.Player.RedSquare > 0) { Creature newMonster = GetNextTarget(); if (newMonster != null) { if (newMonster.Id != c.Id) { if (isNewTargetBetter(c, newMonster)) { Attack(newMonster); return; } } } t.DoStance(c, GetAroundTargets()); System.Threading.Thread.Sleep(50); } Core.client.MiniMap.Stop(); if (Core.Global.LootWhenAllIsDead == false) { if (!NonLootAbleCreatures.Contains(c.Name)) { Core.WaitForLoot = System.DateTime.Now.AddSeconds(3); } } }
public static Objects.Bot.Target GetTarget(Objects.Bot.Target t = null) { m_addtarget = new AddTarget(); if (t != null) { m_addtarget.TextBox1.Text = t.Name; m_addtarget.CheckBox1.Checked = t.AvoidWave; switch (t.FollowType) { case Constants.FollowType.Reach: m_addtarget.ComboBox1.SelectedIndex = 0; break; case Constants.FollowType.Distance: m_addtarget.ComboBox1.SelectedIndex = 2; break; case Constants.FollowType.Stand: m_addtarget.ComboBox1.SelectedIndex = 1; break; } m_addtarget.NumericUpDown1.Value = (decimal)t.Prio; m_addtarget.fastColoredTextBox1.Text = t.Script; } else { m_addtarget.ComboBox1.SelectedIndex = 0; } m_addtarget.TopMost = true; m_addtarget.TextBox1.Focus(); m_addtarget.ShowDialog(); return(m_target); }
private void addToolStripMenuItem2_Click(object sender, EventArgs e) { Objects.Bot.Target t = Forms.Settings.AddTarget.GetTarget(); if (t != null) { Core.Global.TargetList.Add(t); } }
private void Attack(Creature newMonster) { Objects.Bot.Target target = Core.Global.TargetList.FirstOrDefault(t => t.Name.ToLower() == newMonster.Name.ToLower()); Core.client.MiniMap.Stop(); Core.SleepRandom(); newMonster.Attack(); MonstertoAtack = newMonster; while (Core.client.Player.RedSquare == 0) { System.Threading.Thread.Sleep(10); } KeepStance(newMonster, target); }
private void listBox3_DoubleClick(object sender, EventArgs e) { int index = listBox3.SelectedIndex; if (index > -1) { Objects.Bot.Target t = Forms.Settings.AddTarget.GetTarget(Core.Global.TargetList[index]); if (t != null) { Core.Global.TargetList[index] = t; } } }
private void Button1_Click(object sender, EventArgs e) { Objects.Bot.Target t = new Objects.Bot.Target(); t.Name = m_addtarget.TextBox1.Text; t.AvoidWave = m_addtarget.CheckBox1.Checked; t.Prio = (int)m_addtarget.NumericUpDown1.Value; t.Script = m_addtarget.fastColoredTextBox1.Text; switch (m_addtarget.ComboBox1.SelectedIndex) { case 0: t.FollowType = Constants.FollowType.Reach; break; case 1: t.FollowType = Constants.FollowType.Stand; break; case 2: t.FollowType = Constants.FollowType.Distance; break; } m_target = t; m_addtarget.Dispose(); }
public IEnumerable <MyPathNode> GetPath(Objects.Location loc, List <Location> BlockingLocs = null) { lock (lockThis) { int maxX = 150; int maxY = 150; // IsWalking = true; StopWalk = false; if (!loc.IsInRange(maxX, maxY)) { client.StatusBar = "Destination is out of range"; return(null); } int playerX, playerY, playerZ, playerId; playerX = client.PlayerLocation.X; playerY = client.PlayerLocation.Y; playerZ = client.PlayerLocation.Z; int StartX, StartY, EndX, EndY; StartX = maxX; StartY = maxY; EndX = loc.X - playerX + maxX; EndY = loc.Y - playerY + maxY; playerId = client.Player.Id; if (client.PlayerLocation.Z != loc.Z) { return(null); } MyPathNode[,] grid = new MyPathNode[maxX * 2, maxY * 2]; if (StopWalk) { return(null); } this.LoadMapfiles(); for (int x = 0; x < maxX * 2; x++) { for (int y = 0; y < maxX * 2; y++) { int xdiff = playerX + x - maxX; int ydiff = playerY + y - maxY; int MovmentSpeed = GetTileCost(xdiff, ydiff); bool isWall = IsBlocking(xdiff, ydiff); grid[x, y] = new MyPathNode() { IsWall = isWall, X = x, Y = y, Cost = 1, }; } } foreach (Tile t in client.Map.GetTilesSameFloor()) { bool isWall = false; int cost = 0; int cx, cy; cx = t.Location.X - playerX + 300 / 2; cy = t.Location.Y - playerY + 300 / 2; /*if (t.IsBlocking()) * { * isWall = true; * cost = 500; * * } */ if (t.Ground.ItemData.Blocking || t.Ground.ItemData.BlocksPath || t.Items.Any(i => i.ItemData.Blocking || i.ItemData.BlocksPath && !WalkAbleIds.Contains(i.Id))) { isWall = true; cost = 500; } foreach (TileObject o in t.Objects) { if (o.Id == 99) { //has creature if (o.Data == Core.client.Memory.ReadInt32(client.Addresses.Player.Id)) { break; } Creature cr = Core.client.Battlelist.GetCreatures().FirstOrDefault(c => c.Id == o.Data); if (cr != null) { Objects.Bot.Target target = Core.Global.TargetList.FirstOrDefault(j => j.Name.ToLower() == cr.Name.ToLower()); if (target == null) { //it means it is a monster that we dont want. isWall = true; cost = 500; } } } } grid[cx, cy] = new MyPathNode() { IsWall = isWall, // X = t.Location.X - playerX, // Y = t.Location.Y - playerY, X = cx, Y = cy, Cost = 1, }; } if (BlockingLocs != null) { foreach (Location l in BlockingLocs) { int cx, cy; cx = l.X - playerX + 300 / 2; cy = l.Y - playerY + 300 / 2; grid[cx, cy] = new MyPathNode() { IsWall = false, X = cx, Y = cy, Cost = 2000, }; } } grid[EndX, EndY] = new MyPathNode() { IsWall = false, X = EndX, Y = EndY, Cost = 0, }; MySolver <MyPathNode, Object> aStar = new MySolver <MyPathNode, Object>(grid); IEnumerable <MyPathNode> path = aStar.Search(new Point(StartX, StartY), new Point(EndX, EndY), null); return(path); } }
public void LoadGrid() { int playerX, playerY, playerZ; playerX = client.PlayerLocation.X; playerY = client.PlayerLocation.Y; playerZ = client.PlayerLocation.Z; for (int x = -GridSize / 2; x < GridSize / 2; x++) { for (int y = -GridSize / 2; y < GridSize / 2; y++) { int ArryX = playerX + x; int ArryY = playerY + y; int Speed = 0; bool isBlocking = IsBlocking(ArryX, ArryY, playerZ); grid[x + GridSize / 2, y + GridSize / 2] = new MyPathNode() { IsWall = isBlocking, X = x + GridSize / 2, Y = y + GridSize / 2, Cost = Speed, }; } } foreach (Tile t in client.Map.GetTilesSameFloor()) { bool isWall = false; int cost = 0; int cx, cy; cx = t.Location.X - playerX + GridSize / 2; cy = t.Location.Y - playerY + GridSize / 2; if (t.IsBlocking()) { isWall = true; cost = 500; } if (t.Ground.ItemData.Blocking || t.Ground.ItemData.BlocksPath || t.Items.Any(i => i.ItemData.Blocking || i.ItemData.BlocksPath)) { isWall = true; cost = 500; } foreach (TileObject o in t.Objects) { if (o.Id == 99) { //has creature if (o.Data == Core.client.Memory.ReadInt32(client.Addresses.Player.Id)) { break; } Creature cr = Core.client.Battlelist.GetCreatures().First(c => c.Id == o.Data); if (cr != null) { Objects.Bot.Target target = Core.Global.TargetList.FirstOrDefault(j => j.Name.ToLower() == cr.Name.ToLower()); if (target == null) { //it means it is a monster that we dont want. isWall = true; cost = 500; } } } } grid[cx, cy] = new MyPathNode() { IsWall = isWall, // X = t.Location.X - playerX, // Y = t.Location.Y - playerY, X = cx, Y = cy, Cost = 1, }; } }