Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by PESCAVIP ( 3 years ago )
using AdvancedBot.Client;
using AdvancedBot.Client.Commands;
using AdvancedBot.Client.Map;
using AdvancedBot.Client.Packets;
using AdvancedBot.Viewer;
using MacrosCloudCraft;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Pescaria.AutoPesca
{
public class CommandAutoPescaVIP : ICommand
{
private CommandAutoPescaVIP.MacroState macroState = CommandAutoPescaVIP.MacroState.STOPPED;
private int chest_index = 0;
private int chest_string = 0;
private int fish_durability = 0;
private CommandAutoPescaVIP.MacroType macroType = CommandAutoPescaVIP.MacroType.VIP;
private int tick_eat = -1;
private bool waiting_login = true;
public long timer_msg = (long)0;
public CommandAutoPescaVIP(MinecraftClient cli) : base(cli, "Auto Pesca - Warp VIP", "Pesca, repara e guarda os itens. Mais informações https://bit.ly/3vxnOjF", true, new string[] { "autopesca-vip" })
{
this.ToggleText = "§6Macro Auto Pesca Warp VIP {0}";
}
private async void cleanInventory()
{
bool flag;
bool flag1;
this.Client.Player.Pitch = 0f;
this.Client.Player.Yaw = 0f;
Inventory inventory = this.Client.Inventory;
for (int i = 1; i < inventory.NumSlots; i++)
{
flag = (i == 36 || i == 37 ? true : i == 38);
if (!flag)
{
ItemStack slots = inventory.Slots[i];
if (slots != null)
{
flag1 = (slots.ID == 346 ? true : slots.ID == 287);
if (flag1)
{
goto Label0;
}
if (!this.isStorable(slots))
{
inventory.DropItem(this.Client.SendQueue, i);
await Task.Delay(100);
}
}
slots = null;
}
Label0:
}
await Task.Delay(2000);
if (this.macroType == CommandAutoPescaVIP.MacroType.VIP)
{
this.Client.SendMessage("/home pescaria");
await Task.Delay(5000);
}
this.macroState = CommandAutoPescaVIP.MacroState.WAITING;
inventory = null;
return;
goto Label0;
}
public void closeWindow()
{
if (this.Client.OpenWindow != null)
{
this.Client.SendQueue.AddToQueue(new PacketCloseWindow(this.Client.OpenWindow.WindowID));
this.Client.OpenWindow = null;
}
}
private int FindFoodSlot()
{
int num;
int num1 = 0;
while (true)
{
if (num1 < 9)
{
ItemStack hotbarItem = this.Client.GetHotbarItem(num1);
if ((hotbarItem == null ? true : hotbarItem.ID != 349))
{
num1++;
}
else
{
num = num1;
break;
}
}
else
{
num = -1;
break;
}
}
return num;
}
private Vec3d findIronBlock()
{
Vec3d vec3d;
int num = -2;
while (true)
{
if (num <= 2)
{
for (int i = -2; i <= 2; i++)
{
int num1 = -4;
while (num1 <= 4)
{
if (this.Client.TheWorld.GetBlock((int)this.Client.Player.PosX + num, (int)this.Client.Player.PosY + num1, (int)this.Client.Player.PosZ + i) != 42)
{
num1++;
}
else
{
vec3d = new Vec3d((double)((int)this.Client.Player.PosX + num), (double)((int)this.Client.Player.PosY + num1), (double)((int)this.Client.Player.PosZ + i));
return vec3d;
}
}
}
num++;
}
else
{
vec3d = null;
break;
}
}
return vec3d;
}
private int findItem(int itemId)
{
int num;
Inventory inventory = this.Client.Inventory;
int numSlots = this.Client.Inventory.NumSlots - 1;
while (true)
{
if (numSlots > 0)
{
ItemStack slots = inventory.Slots[numSlots];
if (slots != null)
{
if (slots.ID == itemId)
{
num = numSlots;
break;
}
}
numSlots--;
}
else
{
num = -1;
break;
}
}
return num;
}
private int FindSlot(ItemStack itemStack)
{
int emptySlot;
int num = 0;
while (true)
{
if (num < this.Client.OpenWindow.NumSlots)
{
ItemStack slots = this.Client.OpenWindow.Slots[num];
if ((slots == null || slots.ID != itemStack.ID ? false : slots.Metadata == itemStack.Metadata))
{
int num1 = 64;
if ((slots.Count + itemStack.Count >= num1 || num1 <= 1 ? false : itemStack.Metadata == slots.Metadata))
{
emptySlot = num;
break;
}
}
num++;
}
else
{
emptySlot = this.getEmptySlot(this.Client.OpenWindow);
break;
}
}
return emptySlot;
}
private int getEmptySlot(Inventory inventory)
{
int num;
int numSlots = inventory.NumSlots - 1;
while (true)
{
if (numSlots <= 9)
{
num = -1;
break;
}
else if (inventory.Slots[numSlots] != null)
{
numSlots--;
}
else
{
num = numSlots;
break;
}
}
return num;
}
private bool isFullHoe()
{
return (this.Client.get_ItemInHand() == null ? false : this.Client.get_ItemInHand().Metadata == 0);
}
private bool isStorable(ItemStack itemStack)
{
bool flag;
foreach (ConfigPesca config in Main.configs)
{
if ((!config.enabled ? false : config.IsStorable(itemStack)))
{
flag = true;
return flag;
}
}
flag = false;
return flag;
}
private void jogarVara()
{
this.Client.SendPacket(new PacketBlockPlace(this.Client.get_ItemInHand()));
}
private List<Vec3d> loadChests()
{
lock (ViewForm.BlocksToHighlight)
{
ViewForm.BlocksToHighlight.Clear();
}
List<Vec3d> vec3ds = new List<Vec3d>();
int[] numArray = new int[1];
for (int i = 4; i > -4; i--)
{
for (int j = -6; j <= 6; j++)
{
for (int k = -4; k <= 6; k++)
{
if ((numArray.Contains<int>(j) ? false : !numArray.Contains<int>(k)))
{
int posX = (int)base.get_Player().PosX + j;
int posY = (int)base.get_Player().PosY + i;
int posZ = (int)base.get_Player().PosZ + k;
if (Math.Floor(base.get_Player().GetDistanceToBlock(posX, posY, posZ)) < 4)
{
int block = base.get_World().GetBlock(posX, posY, posZ);
if ((block == 146 ? true : block == 54))
{
vec3ds.Add(new Vec3d((double)posX, (double)posY, (double)posZ));
lock (ViewForm.BlocksToHighlight)
{
ViewForm.BlocksToHighlight.Add(new Vec3i(posX, posY, posZ));
}
}
}
}
}
}
}
return vec3ds;
}
private List<Vec3d> loadChestsString()
{
lock (ViewForm.BlocksToHighlight)
{
ViewForm.BlocksToHighlight.Clear();
}
List<Vec3d> vec3ds = new List<Vec3d>();
for (int i = -3; i <= 0; i++)
{
for (int j = -2; j <= 2; j++)
{
for (int k = -2; k <= 2; k++)
{
int posX = (int)base.get_Player().PosX + j;
int posY = (int)base.get_Player().PosY + i;
int posZ = (int)base.get_Player().PosZ + k;
if ((int)base.get_Player().GetDistanceToBlock(posX, posY, posZ) <= 2)
{
int block = base.get_World().GetBlock(posX, posY, posZ);
if ((block == 146 ? true : block == 54))
{
vec3ds.Add(new Vec3d((double)posX, (double)posY, (double)posZ));
lock (ViewForm.BlocksToHighlight)
{
ViewForm.BlocksToHighlight.Add(new Vec3i(posX, posY, posZ));
}
}
}
}
}
}
return vec3ds;
}
public async void onReceiveChat(string chat, byte pos, MinecraftClient client)
{
bool flag;
bool flag1;
bool flag2;
flag = ((object)client != (object)this.Client || this.macroState == CommandAutoPescaVIP.MacroState.PICK_STRING ? false : Utils.EqualsIgnoreCase(Utils.StripColorCodes(chat), "Você precisa de mais String"));
if (flag)
{
flag2 = (!this.IsToggled ? false : MacroUtils.getcurrentmillis() - this.timer_msg >= (long)30000);
if (flag2)
{
this.macroState = CommandAutoPescaVIP.MacroState.STOPPED;
this.Client.SendMessage("/home guardar");
this.timer_msg = MacroUtils.getcurrentmillis();
this.Client.PrintToChat("§eO servidor disse que o bot está sem linhas, indo buscar...");
await Task.Delay(5000);
this.macroState = CommandAutoPescaVIP.MacroState.STRING;
}
}
flag1 = ((object)client != (object)this.Client ? false : Utils.EqualsIgnoreCase(Utils.StripColorCodes(chat), "Isso já está com durabilidade cheia."));
if (flag1)
{
if (this.IsToggled)
{
if (this.macroType != CommandAutoPescaVIP.MacroType.VIP)
{
this.Client.SendMessage("/home pesqueiro");
}
else
{
this.Client.SendMessage("/home pescaria");
}
await Task.Delay(5000);
this.macroState = CommandAutoPescaVIP.MacroState.WAITING;
this.Client.set_HotbarSlot(0);
this.chest_index = 0;
this.chest_string = 0;
this.timer_msg = (long)0;
}
}
}
private void rightClick(Vec3d vec3D)
{
Task.Run(() => {
Entity player = this.Client.Player;
int x = (int)vec3D.X;
int y = (int)vec3D.Y - 1;
int z = (int)vec3D.Z;
HitResult hitResult = this.Client.TheWorld.RayCast(new Vec3d(player.PosX, player.PosY, player.PosZ), new Vec3d((double)x + 0.5, (double)y + 0.5, (double)z + 0.5), false, true);
int num = (hitResult == null ? 1 : hitResult.Face);
if (hitResult == null)
{
hitResult = new HitResult(x, y, z, num);
}
this.Client.SendPacket(new PacketSwingArm(this.Client.PlayerID));
this.Client.SendPacket(new PacketBlockPlace(hitResult, this.Client.get_ItemInHand()));
});
}
public override CommandResult Run(string alias, string[] args)
{
base.Toggle();
if (!this.IsToggled)
{
this.macroState = CommandAutoPescaVIP.MacroState.STOPPED;
}
else
{
this.macroState = CommandAutoPescaVIP.MacroState.STOPPED;
this.start();
}
return 0;
}
public async void start()
{
this.macroState = CommandAutoPescaVIP.MacroState.STOPPED;
this.Client.set_HotbarSlot(0);
this.chest_index = 0;
this.chest_string = 0;
this.timer_msg = (long)0;
this.tick_eat = -1;
this.waiting_login = !this.Client.LoggedIn;
if (this.Client.get_ItemInHand() != null)
{
this.fish_durability = this.Client.get_ItemInHand().Metadata;
}
this.Client.PrintToChat("§cO macro irá pescar na '/warp vip'. Tenha certeza que criou um home com o nome 'guardar' para o macro guardar os itens e home 'pescaria' para voltar a pescar!");
this.Client.SendMessageAlert("O macro irá pescar na '/warp vip'. Tenha certeza que criou um home com o nome 'guardar' para o macro guardar os itens e home 'pescaria' para voltar a pescar!");
this.macroType = CommandAutoPescaVIP.MacroType.VIP;
this.Client.SendMessage("/home pescaria");
await Task.Delay(3000);
this.macroState = CommandAutoPescaVIP.MacroState.WAITING;
Console.WriteLine("iniciou");
}
public async void swapSlot(int current, int newSlot)
{
Inventory inventory = this.Client.Inventory;
ItemStack slots = inventory.Slots[newSlot];
inventory.Click(this.Client, (short)current, false, true);
await Task.Delay(500);
inventory.Click(this.Client, (short)newSlot, false, true);
if (slots != null)
{
await Task.Delay(500);
inventory.Click(this.Client, (short)current, false, true);
}
inventory = null;
slots = null;
}
public override async void Tick()
{
CommandAutoPescaVIP.<Tick>d__13 variable = null;
AsyncVoidMethodBuilder asyncVoidMethodBuilder = AsyncVoidMethodBuilder.Create();
asyncVoidMethodBuilder.Start<CommandAutoPescaVIP.<Tick>d__13>(ref variable);
}
private enum MacroState
{
STOPPED,
PICK_STRING,
STRING,
FISH_ROD,
DROP,
REPAIR,
WAITING,
CLEAN_INVENTORY,
STORAGE
}
private enum MacroType
{
VIP
}
}
}
Revise this Paste