📄 bot.cs
字号:
namespace WoWBot
{
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using WoWBot.My;
public class Bot
{
public static int avancer = 0;
public static int botavance = 0;
public static int botcheckpull = 0;
public static int bottingstatus = 0;
public static int haveghost = 0;
public static object lastwaypoint = 0;
public static object looting = 0;
public static int testroute = 0;
public static object boire()
{
func.PostMessage(Main.wow.WindowHandle, 0x100, 0x77, (int) IntPtr.Zero);
func.PostMessage(Main.wow.WindowHandle, 0x101, 0x77, (int) IntPtr.Zero);
return 0;
}
public static object botStart()
{
MyProject.Forms.Main.Button2.Visible = false;
MyProject.Forms.Main.ShrinkWoW.Visible = true;
MyProject.Forms.Main.Button2.Enabled = false;
MyProject.Forms.Main.Button3.Enabled = true;
if ((MyProject.Forms.Config.waypoint.Text == "") & !MyProject.Forms.UniverselSettings.PartyActive.Checked)
{
Interaction.MsgBox("S\x00e9lectionnez un chemin avant de lancer le bot", MsgBoxStyle.OkOnly, null);
}
else if (MyProject.Forms.Config.Classes.Text == "Select class ...")
{
Interaction.MsgBox("S\x00e9lectionnez une classe avant de lancer le bot", MsgBoxStyle.OkOnly, null);
}
else
{
MyProject.Forms.Main.mobskilled.Text = Conversions.ToString(0);
MyProject.Forms.Main.mobslooted.Text = Conversions.ToString(0);
MyProject.Forms.Main.died.Text = Conversions.ToString(0);
if (Main.BotStatus == "Stop")
{
Main.BotStatus = "Start";
func.logmsg("[BOT] Lancement du bot ...");
MyProject.Forms.TimerForm.BotTime.Enabled = true;
Main.ExpBotStart = Main.Exp;
MyProject.Forms.TimerForm.CheckRelog.Enabled = true;
buff();
lastwaypoint = 0;
walkwaypoint();
}
}
return 0;
}
public static object botStop()
{
if (Operators.ConditionalCompareObjectEqual(Main.WowWindowSize, "shrink", false))
{
Shrink();
}
if (Operators.ConditionalCompareObjectEqual(Main.WowWindowState, "hide", false))
{
func.ShowWindow((int) Main.wow.WindowHandle, 9);
Main.WowWindowState = "normal";
}
MyProject.Forms.Main.Button2.Enabled = true;
MyProject.Forms.Main.Button2.Visible = true;
MyProject.Forms.Main.ShrinkWoW.Visible = false;
MyProject.Forms.Main.Button3.Enabled = false;
MyProject.Forms.Main.ShowHideWoW.Visible = false;
MyProject.Forms.Main.Killtarget.Visible = true;
Main.BotStatus = "Stop";
func.logmsg("[BOT] Stopping the bot ...");
MyProject.Forms.TimerForm.CheckWalkwaypointBlock.Enabled = false;
Main.TimeBot_Hour = Conversions.ToString(0);
Main.TimeBot_Min = Conversions.ToString(0);
Main.Minute = 0;
Main.TimeBot_Sec = Conversions.ToString(0);
MyProject.Forms.TimerForm.BotTime.Enabled = false;
testroute = 0;
MyProject.Forms.TimerForm.CheckRelog.Enabled = false;
if (Conversions.ToDouble(MyProject.Forms.Main.Label15.Text) != 0.0)
{
func.rien();
}
return 0;
}
public static object buff()
{
Universel.Buff();
return 0;
}
public static object calculface(object x, object y)
{
float right = Conversions.ToSingle(MyProject.Forms.Main.Label16.Text);
float num2 = Conversions.ToSingle(MyProject.Forms.Main.Label15.Text);
float num = (float) Math.Atan2(Conversions.ToDouble(Operators.SubtractObject(y, right)), Conversions.ToDouble(Operators.SubtractObject(x, num2)));
if (num < 0f)
{
num += (float) 6.2831853071795862;
}
return (float) (((double) (num * 180f)) / 3.1415926535897931);
}
public static object combat()
{
Main.InCombat = 1;
Clavier.AvancerUp();
MyProject.Forms.TimerForm.CheckingTarget.Enabled = false;
MyProject.Forms.TimerForm.CheckHealthWalk.Enabled = false;
MyProject.Forms.TimerForm.CheckWalkwaypointBlock.Enabled = false;
Universel.Combat();
MyProject.Forms.TimerForm.CheckWalkwaypointBlock.Enabled = true;
Main.InCombat = 0;
return 0;
}
public static object face(float direction)
{
int num = 5;
if (((Conversions.ToDouble(MyProject.Forms.Main.Label18.Text) - num) > direction) | ((Conversions.ToDouble(MyProject.Forms.Main.Label18.Text) + num) < direction))
{
Clavier.AvancerUp();
Clavier.ReculerUp();
Clavier.GaucheUp();
Clavier.DroiteUp();
Injection.SetFacing((int) Math.Round((double) direction));
Clavier.AvancerDown();
Clavier.AvancerUp();
}
return 0;
}
[DllImport("user32", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern void keybd_event(byte bVk, byte bScan, long dwFlags, long dwExtraInfo);
public static object loot()
{
MyProject.Forms.TimerForm.CheckWalkwaypointBlock.Enabled = false;
if (MyProject.Forms.Config.Loot.Checked && (Main.havetarget == 0))
{
Clavier.SendTextToWoWChat("/targetlastenemy");
MyProject.Forms.CastTime.CombatCasttime1.Interval = 100;
MyProject.Forms.CastTime.CombatCasttime1.Enabled = true;
while (MyProject.Forms.CastTime.CombatCasttime1.Enabled)
{
func.oldWait(1);
}
Clavier.SendTextToWoWChat("/script InteractUnit()");
MyProject.Forms.CastTime.CombatCasttime1.Interval = 0x960;
MyProject.Forms.CastTime.CombatCasttime1.Enabled = true;
while (MyProject.Forms.CastTime.CombatCasttime1.Enabled)
{
func.oldWait(1);
}
if (MyProject.Forms.Config.Skin.Checked)
{
Clavier.AvancerDown();
Clavier.AvancerUp();
Clavier.SendTextToWoWChat("/targetlastenemy");
MyProject.Forms.CastTime.CombatCasttime1.Interval = 100;
MyProject.Forms.CastTime.CombatCasttime1.Enabled = true;
while (MyProject.Forms.CastTime.CombatCasttime1.Enabled)
{
func.oldWait(1);
}
Clavier.SendTextToWoWChat("/script InteractUnit()");
MyProject.Forms.CastTime.CombatCasttime1.Interval = 0x7d0;
MyProject.Forms.CastTime.CombatCasttime1.Enabled = true;
while (MyProject.Forms.CastTime.CombatCasttime1.Enabled)
{
func.oldWait(1);
}
}
if (Main.havetarget == 1)
{
Clavier.Send_Cleartarget();
}
MyProject.Forms.Main.mobslooted.Text = Conversions.ToString((double) (Conversions.ToDouble(MyProject.Forms.Main.mobslooted.Text) + 1.0));
}
MyProject.Forms.TimerForm.CheckWalkwaypointBlock.Enabled = true;
looting = 0;
return 0;
}
public static object manger()
{
func.PostMessage(Main.wow.WindowHandle, 0x100, 0xbb, (int) IntPtr.Zero);
func.PostMessage(Main.wow.WindowHandle, 0x101, 0xbb, (int) IntPtr.Zero);
return 0;
}
public static object nearestwaypoint()
{
int num5;
int num6;
int index = 0;
int num2 = 0x5f5e0ff;
int num4 = 0xf423f;
while (index != (MyProject.Forms.Config.waypoint.Lines.Length - 3))
{
string[] strArray = MyProject.Forms.Config.waypoint.Lines[index].Split(new char[] { ';' });
string str = strArray[0];
string str2 = strArray[1];
int num8 = (int) Math.Round((double) (Conversions.ToDouble(str) - Conversions.ToDouble(MyProject.Forms.Main.Label15.Text)));
int num9 = (int) Math.Round((double) (Conversions.ToDouble(str2) - Conversions.ToDouble(MyProject.Forms.Main.Label16.Text)));
double a = Math.Sqrt(Math.Pow((double) num8, 2.0) + Math.Pow((double) num9, 2.0));
if (a < num2)
{
num2 = (int) Math.Round(a);
num4 = index;
num5 = Conversions.ToInteger(str);
num6 = Conversions.ToInteger(str2);
}
index++;
}
if (num2 > 40)
{
face(Conversions.ToSingle(calculface(num5, num6)));
func.logmsg("Avancer de " + num2.ToString() + " m\x00e8tre dans cette direction");
botStop();
}
func.logmsg("[BOT] Le waypoint le plus pr\x00eat est le " + num4.ToString() + "\x00e8me");
return num4;
}
public static object Relog()
{
if (!File.Exists(Application.StartupPath + @"\Config\Account.ini"))
{
return 1;
}
StreamReader reader = new StreamReader(Application.StartupPath + @"\Config\Account.ini");
string keys = reader.ReadLine();
string str2 = reader.ReadLine();
string str4 = reader.ReadLine();
if (reader.ReadLine() != "True")
{
func.logmsg("[BOT] Reconnexion d\x00e9sactiv\x00e9e, bot stop");
return 1;
}
if (MyProject.Forms.Config.Notifications.Checked)
{
MyProject.Forms.Main.NotifyIcon1.ShowBalloonTip(0x3e8, "eBot - Notification", "Disconnected from the server", ToolTipIcon.Info);
}
func.logmsg("[BOT] Attente de " + str4.ToString() + "s avant de relog");
func.oldWait(Conversions.ToDouble(str4) * 1000.0);
func.logmsg("[BOT] Reconnexion du personnage");
Interaction.AppActivate(Main.wow.ProcessId);
func.oldWait(500);
Interaction.AppActivate(Main.wow.ProcessId);
SendKeys.Send("{ENTER}");
func.oldWait(0x3e8);
Interaction.AppActivate(Main.wow.ProcessId);
SendKeys.Send("^A");
SendKeys.Send("{BACKSPACE}");
SendKeys.Send(keys);
func.oldWait(0xbb8);
Interaction.AppActivate(Main.wow.ProcessId);
Clavier.TAB();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -