public PlayerPhysics(Bot bot) : base(bot) { Enabled = true; playerTickTimer.Start(); UpdateSleep = 1; }
public Redstone(Bot bot) : base(bot) { UpdateSleep = 10; currentRedTime.Start(); wireTypes.Add(189/*red checker*/, 0.001F); wireTypes.Add(516/*background checker red*/, 0.001F); conductivityDelegateList.Add(new IsConductive((BlockPos pos, int jumps, float power, Block sourceBlock, Block block) => // colored wires { return (block.blockId >= 186/*gray checker*/ && block.blockId <= 192/*cyan checker*/ && (block.blockId == sourceBlock.blockId || sourceBlock.blockId == 20 // redstone || powerSourceTypes.ContainsKey(sourceBlock.blockId) || layerSwitches.Contains(sourceBlock.blockId))); })); conductivityDelegateList.Add(new IsConductive((BlockPos pos, int jumps, float power, Block sourceBlock, Block block) => { return block.blockId == 20; })); layerSwitches.Add(146/*industrial crosssupport*/); layerSwitches.Add(548/*carnival checker*/); powerSourceTypes.Add(30/*metal red*/, new Torch()); powerSourceTypes.Add(311/*cloud bottom*/, new PressurePlate()); powerSourceTypes.Add(301/*sand white*/, new PressurePlate()); destinationTypes.Add(33/*glossy black special*/, new Lamp()); destinationTypes.Add(143/*cloud white*/, new Lamp()); destinationTypes.Add(86/*scifi gray*/, new Door()); destinationTypes.Add(243/*secrets nonsolid*/, new Door()); }
public Zombies(Bot bot) : base(bot) { UpdateSleep = 300; zombieUpdateStopWatch.Start(); zombieDrawStopWatch.Start(); }
public SubBot(Bot bot) : base() { this.bot = bot; updateTask = new Task(updateTaskWork); //new Thread(updateTaskWork).Start(); }
public override void Update(Bot bot, Stopwatch currentRedTime, BlockPos pos) { enabled = false; lock (bot.playerList) { foreach (var p in bot.playerList) { if (p.Value.blockX == pos.x && p.Value.blockY == pos.y) { enabled = true; break; } } } if (!enabled) { if (bot.room.getBlock(pos.l, pos.x, pos.y).blockId == 301/*sand white*/) { bot.room.DrawBlock(Block.CreateBlock(pos.l, pos.x, pos.y, 311/*cloud bottom*/, -2)); } } else if (bot.room.getBlock(pos.l, pos.x, pos.y).blockId == 311/*cloud bottom*/) { bot.room.DrawBlock(Block.CreateBlock(pos.l, pos.x, pos.y, 301/*sand white*/, -2)); } }
public override void Update(Bot bot) { if (updateTimer.ElapsedMilliseconds >= 1000) { updateTimer.Restart(); double lowestDistance = 0; Player lowestDistancePlayer = null; lock (bot.playerList) { foreach (Player player in bot.playerList.Values) { if (player.isgod) continue; double currentDistance = GetDistanceBetween(player, xBlock, yBlock); if (currentDistance < lowestDistance || lowestDistance == 0) { lowestDistance = currentDistance; lowestDistancePlayer = player; } } } if (lowestDistancePlayer != null) { targetPlayer = lowestDistancePlayer; } } if (targetPlayer != null && xBlock != targetPlayer.x && yBlock != targetPlayer.y) { //pathFinding = null; //pathFinding = new PathFinding(); //lagTimer.Restart(); pathToGo = pathFinding.Start(xBlock, yBlock, targetPlayer.blockX, targetPlayer.blockY, bot); //Console.WriteLine("elapsed shitlagtime " + lagTimer.ElapsedMilliseconds + "MS"); if (pathToGo != null && pathToGo.Count != 0) { if (pathToGo.Count > 2) { pathToGo.Pop(); pathToGo.Pop(); } Square next = pathToGo.Pop(); xBlock = next.x; yBlock = next.y; } if (targetPlayer != null) { if (GetDistanceBetween(targetPlayer, xBlock, yBlock) <= 1 && !targetPlayer.isgod) { targetPlayer.killPlayer(); bot.connection.Send("say", "/kill " + targetPlayer.name); } } } base.Update(bot); }
public override void onCommand(object sender, string text, string[] args, Player player, bool isBotMod, Bot bot) { switch (args[0]) { case "resetredstone": if (isBotMod) ResetRed(); break; } }
public MdiForm(Bot bot) { InitializeComponent(); MaximizedBounds = new Rectangle(2, 23, bot.form.tabs.Width - 2, bot.form.tabs.Height - 25); this.bot = bot; bot.form.SizeChanged += delegate { MaximizedBounds = new Rectangle(2, 23, bot.form.tabs.Width - 2, bot.form.tabs.Height - 25); }; }
public override void Draw(Bot bot) { base.Draw(bot); if (xBlock != xOldBlock || yBlock != yOldBlock) { zombieBlock = Block.CreateBlock(0, xBlock, yBlock, 32, -1); bot.room.DrawBlock(zombieBlock); zombieOldBlock = Block.CreateBlock(0, xOldBlock, yOldBlock, 4, -1); bot.room.DrawBlock(zombieOldBlock); } }
public override void Update(Bot bot, System.Diagnostics.Stopwatch currentRedTime, BlockPos pos) { if (enabled) { if (bot.room.getBlock(pos.l, pos.x, pos.y).blockId == 86/*scifi gray*/) { bot.room.DrawBlock(Block.CreateBlock(pos.l, pos.x, pos.y, 243/*secrets nonsolid*/, -2)); } } else if (bot.room.getBlock(pos.l, pos.x, pos.y).blockId == 243/*secrets nonsolid*/) { bot.room.DrawBlock(Block.CreateBlock(pos.l, pos.x, pos.y, 86/*scifi gray*/, -2)); } enabled = false; }
public override void Update(Bot bot, System.Diagnostics.Stopwatch currentRedTime, BlockPos pos) { if (enabled) { if (bot.room.getBlock(pos.l, pos.x, pos.y).blockId == 33/*glossy black special*/) { bot.room.DrawBlock(Block.CreateBlock(pos.l, pos.x, pos.y, 143/*cloud white*/, -2)); } } else if (bot.room.getBlock(pos.l, pos.x, pos.y).blockId == 143/*cloud white*/) { bot.room.DrawBlock(Block.CreateBlock(pos.l, pos.x, pos.y, 33/*glossy black special*/, -2)); } enabled = false; base.Update(bot, currentRedTime, pos); }
public override void Update(Bot bot) { if (bot.connected && bot.room.loadedWorld) { if (playerTickTimer.ElapsedMilliseconds >= Config.physics_ms_per_tick) { playerTickTimer.Restart(); lock (bot.playerList) { foreach (Player player in bot.playerList.Values) { player.tick(); /*if (player.blockX > 0 && player.blockX < bot.room.Width - 1 && player.blockY > 0 && player.blockY < bot.room.Height - 1) { bot.room.DrawBlock(Block.CreateBlock(0, player.blockX, player.blockY, 16, -1)); }*/ } } } } }
public override void onCommand(object sender, string text, string[] args, Player player, bool isBotMod, Bot bot) { switch (args[0]) { case "zombie": if(isBotMod) { Zombie zombie = new Zombie(player.blockX * 16, player.blockY * 16); lock (zombieList) { zombieList.Add(zombie); } //bot.room.DrawBlock(Block.CreateBlock(0, bot.playerList[playerId].blockX, bot.playerList[playerId].blockY, 32, 0)); } break; case "zombies": { for (int i = 0; i < 3; i++) { int x = r.Next(1, bot.room.Width - 1); int y = r.Next(1, bot.room.Height - 1); Zombie zombie = new Zombie(x * 16, y * 16); lock (zombieList) { zombieList.Add(zombie); } } } break; case "removezombies": { lock (zombieList) { zombieList.Clear(); } } break; } }
public override void onCommand(object sender, string text, string[] args, Player player, bool isBotMod, Bot bot) { if (isBotMod) { switch (args[0]) { case "crash": Thread.Sleep(61000); throw new System.Exception("I'm a happy error in a sunny day."); break; case "roomname": if (args.Length > 1) bot.connection.Send("name", string.Join(" ", args).Replace("roomname ", "")); break; case "woot": bot.connection.Send("wootup"); break; case "reset": bot.connection.Send("say", "/reset"); break; case "load": bot.connection.Send("say", "/loadlevel"); break; case "save": bot.connection.Send("save"); break; case "clear": bot.connection.Send("clear"); break; case "ping": bot.connection.Send("say", "Pong!"); break; case "pos": bot.connection.Send("say", "Your position: X:" + player.blockX + " Y:" + player.blockY); break; } } }
public override void onDisconnect(object sender, string reason, Bot bot) { }
public override void onEnable(Bot bot) { }
public override void onMessage(object sender, PlayerIOClient.Message m, Bot bot) { //throw new NotImplementedException(); }
public override void onDisable(Bot bot) { }
public override void Update(Bot bot) { if (bot.connected) { long lag = 0; zombieUpdateStopWatch.Restart(); lock (zombieList) { foreach (Zombie zombie in zombieList) { zombie.Update(bot); zombie.Draw(bot); } } lag = zombieUpdateStopWatch.ElapsedMilliseconds; //Console.WriteLine(lag); } }
public override void onMessage(object sender, PlayerIOClient.Message m, Bot bot) { }
public override void onCommand(object sender, string text, string[] args, Player player, bool isBotMod, Bot bot) { switch (args[0]) { case "zombie": if (isBotMod) { Zombie zombie = new Zombie(player.blockX * 16, player.blockY * 16); lock (zombieList) { zombieList.Add(zombie); } //bot.room.DrawBlock(Block.CreateBlock(0, bot.playerList[playerId].blockX, bot.playerList[playerId].blockY, 32, 0)); } break; case "zombies": { for (int i = 0; i < 3; i++) { int x = r.Next(1, bot.room.Width - 1); int y = r.Next(1, bot.room.Height - 1); Zombie zombie = new Zombie(x * 16, y * 16); lock (zombieList) { zombieList.Add(zombie); } } } break; case "removezombies": { lock (zombieList) { zombieList.Clear(); } } break; } }
public override void onCommand(object sender, string text, string[] args, Player player, bool isBotMod, Bot bot) { }
public override void Update(Bot bot, System.Diagnostics.Stopwatch currentRedTime, BlockPos pos) { enabled = willEnable; willEnable = true; base.Update(bot, currentRedTime, pos); }
public virtual void Update(Bot bot, Stopwatch currentRedTime, BlockPos pos) { }
public Form1() { InitializeComponent(); bot = new Bot(this); //this.IsMdiContainer = true; }
public PhysicsPlayer(Bot bot, int ID, string name, int frame, float xPos, float yPos, bool isGod, bool isMod, bool bla, int coins, bool purple, bool isFriend, int level) : base(null, 16) { //this.Ding = Player_Ding; //this.Crown = Player_Crown; //this.CrownSilver = Player_CrownSilver; //this.Aura = Player_Aura; //this.ModAura = Player_ModAura; //this.FireAura = Player_FireAura; //this.LevitationEffect = Player_LevitationEffect; //this.ding = new this.Ding(); //this.crown = new this.Crown().bitmapData; //this.crown_silver = new this.CrownSilver().bitmapData; //this.aura = new this.Aura().bitmapData; //this.modaura = new this.ModAura().bitmapData; ///this.fireAura = new this.FireAura().bitmapData; //this.invulnerableAura = AnimationManager.animProtection; //this.levitationAnimaitonBitmapData = new this.LevitationEffect().bitmapData; //this.clubaura = AnimationManager.animClubAura; this.bot = bot; this.room = bot.room; this.rect2 = new Rectangle(0, 0, 16, 26); //this.fireAnimation = new BlSprite(this.fireAura, 0, 0, 26, 26, 6); //this.protectionAnimation = new BlSprite(this.invulnerableAura, 0, 0, 26, 26, 24); //this.levitationAnimation = new BlSprite(this.levitationAnimaitonBitmapData, 0, 0, 26, 26, 32); this.queue = new Queue<int>(Config.physics_queue_length); this.lastJump = new DateTime(); this.lastPortal = new Point(); this.that = this as SynchronizedObject; this.modrect = new Rectangle(0, 0, 64, 64); this.clubrect = new Rectangle(0, 0, 64, 64); //this.touchpotions = {}; this._currentThrust = this._maxThrust; //super(ItemManager.smiliesBMD); //this.state = param5; //this.connection = param4; //this.world = param1; //this.hitmap = param1; this.x = 16; this.y = 16; this.isme = false; this.name = name; //this.chat = new Chat(param2.indexOf(" ") != -1 ? ("") : (param2)); size = 16; width = 16; height = 16; return; }
public override void Update(Bot bot) { }
public Stack<Square> Start(int startX, int startY, int targetX, int targetY, Bot bot) { closedSquares = new Square[bot.room.Width, bot.room.Height]; openSquares = new Square[bot.room.Width, bot.room.Height]; openSquaresList = new List<Square>(); int h = CalculateH(startX, startY, targetX, targetY); Square start = new Square(startX, startY, 0, h, null); openSquares[startX, startY] = start; openSquaresList.Add(start); Square current = start; int maxCount = 1000; int currentCount = 0; while (openSquaresList.Count > 0) { //Find square with lowest F score in openlist current = openSquaresList.First(); foreach (Square s in openSquaresList) { if (s.G + s.H < current.G + current.H) { current = s; } } //Check if current square is target. if so, construct and return path if (current.x == targetX && current.y == targetY) { Stack<Square> temppath = ReconstructPath(new Stack<Square>(), current); Stack<Square> newpath = new Stack<Square>(); while (temppath.Count > 0) { Square s = temppath.Pop(); if (bot.room.getBlock(0, s.x, s.y).blockId == 4 || bot.room.getBlock(0, s.x, s.y).blockId == 32 ||bot.room.getBlock(0, s.x, s.y).blockId == 0) { newpath.Push(s); } else break; } newpath = new Stack<Square>(newpath); //Console.WriteLine(newpath.Count); //string str = ""; //foreach (Square s in newpath) // str += "X:" + s.x + " Y:" + s.y + " \n"; //Console.WriteLine(str); return newpath; } if (currentCount > maxCount) return null; //Switch current square from openlist to closedlist closedSquares[current.x, current.y] = current; openSquares[current.x, current.y] = null; for (int i = 0; i < openSquaresList.Count; i++) { Square temp = openSquaresList[i]; if (temp.x == current.x && temp.y == current.y) { openSquaresList.RemoveAt(i); break; } } //Check the neighbours of the current square for (int i = 0; i < 8; i++) { Square neighbour = new Square( current.x + adjacentSquares[i].x, current.y + adjacentSquares[i].y, current.G + adjacentSquares[i].cost, CalculateH(current.x + adjacentSquares[i].x, current.y + adjacentSquares[i].y, targetX, targetY), current); if (neighbour.x < 0 || neighbour.y < 0 || neighbour.x >= bot.room.Width || neighbour.y >= bot.room.Height) continue; if (bot.room.getBlock(0, neighbour.x, neighbour.y).blockId != 4) neighbour.G += 10000; //neighbour.G += bot.room.getBlock(0, neighbour.x, neighbour.y); int neighborInClosedF = 0; Square temp = closedSquares[neighbour.x, neighbour.y]; if (temp != null) neighborInClosedF = temp.G + temp.H; //If it's in closedsquares and its F is over the one in closedsquares, dont care about it if (closedSquares[neighbour.x, neighbour.y] != null && (neighbour.G + neighbour.H) >= neighborInClosedF) continue; //If it isn't in opensquares or its F is lower than the one in closedsquares, add it or swap them if ((openSquares[neighbour.x, neighbour.y] == null || ((neighbour.G + neighbour.H) < neighborInClosedF) && bot.room.getBlock(0, neighbour.x, neighbour.y).blockId == 4)) { neighbour.parent = current; openSquares[neighbour.x, neighbour.y] = neighbour; openSquaresList.Add(neighbour); currentCount++; } } } return null; }
public virtual void Draw(Bot bot) { }
//protected int currentPickaxeSlot = -1; public Player(Bot bot, int ID, string name, int frame, float xPos, float yPos, bool isGod, bool isMod, bool bla, int coins, bool purple, bool isFriend, int level) : base(bot, ID, name, frame, xPos, yPos, isGod, isMod, bla, coins, purple, isFriend, level) { Load(); setVar("brushtype", new SubBots.WorldEdit.SolidBrush()); }
public virtual void Update(Bot bot) { }