Moved Auto attack and auto fishing to ChatBots and added ChatBotAPI for entity handling

This commit is contained in:
ReinforceZwei 2020-03-23 19:59:00 +08:00 committed by ORelio
parent 8b8f3a719b
commit dbf5334758
16 changed files with 602 additions and 465 deletions

View file

@ -8,39 +8,35 @@ namespace MinecraftClient.Commands
class AutoAttack : Command
{
public override string CMDName { get { return "autoattack"; } }
public override string CMDDesc { get { return "autoattack <on|off>: Enable/disable auto attack mobs."; } }
public override string CMDDesc { get { return "autoattack <on|off>: Auto attack mobs around you."; } }
public override string Run(McTcpClient handler, string command)
{
if (hasArg(command))
{
string state = getArg(command);
if (state.ToLower() == "on")
string arg = getArg(command);
if (arg == "on")
{
if (!handler.AutoAttack)
if (handler.GetEntityHandlingEnabled())
{
handler.AutoAttack = true;
return "Auto attack turned on.";
// TODO: check if the bot already loaded
// I don't know how :C
handler.BotLoad(new ChatBots.AutoAttack());
return "Auto Attack now enabled.";
}
else
{
return "Auto attack is on.";
}
}else if (state.ToLower() == "off")
{
if (handler.AutoAttack)
{
handler.AutoAttack = false;
return "Auto attack turned off.";
}
else
{
return "Auto attack is off.";
return "Please enable EntityHandling in the config before using this.";
}
}
return "";
else if(arg == "off")
{
// TODO: unload auto attack bot
// I don't know how to unload a single bot :C
return "Currently not implemented :/";
}
}
else return CMDDesc;
return CMDDesc;
}
}
}

View file

@ -1,48 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MinecraftClient.Commands
{
class Fishing : Command
{
public override string CMDName { get { return "fishing"; } }
public override string CMDDesc { get { return "fishing <on|off>: Auto fishing"; } }
public override string Run(McTcpClient handler, string command)
{
if (hasArg(command))
{
string state = getArg(command);
if (state.ToLower() == "on")
{
if (!handler.AutoFishing)
{
handler.AutoFishing = true;
handler.useItemOnHand();
return "Auto fishing turned on.";
}
else
{
return "Auto fishing is on.";
}
}
else if (state.ToLower() == "off")
{
if (handler.AutoFishing)
{
handler.AutoFishing = false;
handler.useItemOnHand();
return "Auto fishing turned off.";
}
else
{
return "Auto fishing is off.";
}
}
}
return CMDDesc;
}
}
}

View file

@ -12,7 +12,7 @@ namespace MinecraftClient.Commands
public override string Run(McTcpClient handler, string command)
{
handler.useItemOnHand();
handler.UseItemOnHand();
return "Use an item";
}
}