diff --git a/.gitignore b/.gitignore
index 15e9726..26cfce7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -339,6 +339,8 @@ ASALocalRun/
# BeatPulse healthcheck temp database
healthchecksdb
-CompletionPlugin
-InfiniteManaPlugin
-RawRBot
\ No newline at end of file
+RawRBot
+RBot/ActionScript/rbot/bin
+RBot/rbot_blank.swf
+RBot/Properties/licenses.licx
+RBot/bin
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..b48b78a
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,26 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ // Use IntelliSense to find out which attributes exist for C# debugging
+ // Use hover for the description of the existing attributes
+ // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
+ "name": ".NET Core Launch (console)",
+ "type": "coreclr",
+ "request": "launch",
+ "preLaunchTask": "build",
+ // If you have changed target frameworks, make sure to update the program path.
+ "program": "${workspaceFolder}/RBot/bin/Debug/net6.0-windows/RBot.dll",
+ "args": [],
+ "cwd": "${workspaceFolder}/RBot",
+ // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
+ "console": "internalConsole",
+ "stopAtEntry": false
+ },
+ {
+ "name": ".NET Core Attach",
+ "type": "coreclr",
+ "request": "attach"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 0000000..42dc703
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,42 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "build",
+ "command": "dotnet",
+ "type": "process",
+ "args": [
+ "build",
+ "${workspaceFolder}/RBot/RBot.csproj",
+ "/property:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "problemMatcher": "$msCompile"
+ },
+ {
+ "label": "publish",
+ "command": "dotnet",
+ "type": "process",
+ "args": [
+ "publish",
+ "${workspaceFolder}/RBot/RBot.csproj",
+ "/property:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "problemMatcher": "$msCompile"
+ },
+ {
+ "label": "watch",
+ "command": "dotnet",
+ "type": "process",
+ "args": [
+ "watch",
+ "run",
+ "${workspaceFolder}/RBot/RBot.csproj",
+ "/property:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "problemMatcher": "$msCompile"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/RBot.sln b/RBot.sln
index 3310749..1d4faf9 100644
--- a/RBot.sln
+++ b/RBot.sln
@@ -1,38 +1,32 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29318.209
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31919.166
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RBot", "RBot\RBot.csproj", "{F45DFF0C-BD43-4F16-A947-44585DED4A29}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompletionPlugin", "CompletionPlugin\CompletionPlugin.csproj", "{98CC4B08-BA36-4547-B6BA-23FFC7841A8A}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfiniteManaPlugin", "InfiniteManaPlugin\InfiniteManaPlugin.csproj", "{4DF7EC6B-1665-48CF-97AF-B26D3842535A}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RawRBot", "RawRBot\RawRBot.csproj", "{5F8F2CE1-F842-4D0C-BB91-DD46613C1A0E}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RBot", "RBot\RBot.csproj", "{F45DFF0C-BD43-4F16-A947-44585DED4A29}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F45DFF0C-BD43-4F16-A947-44585DED4A29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F45DFF0C-BD43-4F16-A947-44585DED4A29}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F45DFF0C-BD43-4F16-A947-44585DED4A29}.Debug|x64.ActiveCfg = Debug|x64
+ {F45DFF0C-BD43-4F16-A947-44585DED4A29}.Debug|x64.Build.0 = Debug|x64
+ {F45DFF0C-BD43-4F16-A947-44585DED4A29}.Debug|x86.ActiveCfg = Debug|x86
+ {F45DFF0C-BD43-4F16-A947-44585DED4A29}.Debug|x86.Build.0 = Debug|x86
{F45DFF0C-BD43-4F16-A947-44585DED4A29}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F45DFF0C-BD43-4F16-A947-44585DED4A29}.Release|Any CPU.Build.0 = Release|Any CPU
- {98CC4B08-BA36-4547-B6BA-23FFC7841A8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {98CC4B08-BA36-4547-B6BA-23FFC7841A8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {98CC4B08-BA36-4547-B6BA-23FFC7841A8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {98CC4B08-BA36-4547-B6BA-23FFC7841A8A}.Release|Any CPU.Build.0 = Release|Any CPU
- {4DF7EC6B-1665-48CF-97AF-B26D3842535A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4DF7EC6B-1665-48CF-97AF-B26D3842535A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4DF7EC6B-1665-48CF-97AF-B26D3842535A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4DF7EC6B-1665-48CF-97AF-B26D3842535A}.Release|Any CPU.Build.0 = Release|Any CPU
- {5F8F2CE1-F842-4D0C-BB91-DD46613C1A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5F8F2CE1-F842-4D0C-BB91-DD46613C1A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5F8F2CE1-F842-4D0C-BB91-DD46613C1A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5F8F2CE1-F842-4D0C-BB91-DD46613C1A0E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F45DFF0C-BD43-4F16-A947-44585DED4A29}.Release|x64.ActiveCfg = Release|x64
+ {F45DFF0C-BD43-4F16-A947-44585DED4A29}.Release|x64.Build.0 = Release|x64
+ {F45DFF0C-BD43-4F16-A947-44585DED4A29}.Release|x86.ActiveCfg = Release|x86
+ {F45DFF0C-BD43-4F16-A947-44585DED4A29}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/RBot/.editorconfig b/RBot/.editorconfig
index 864769d..2aea850 100644
--- a/RBot/.editorconfig
+++ b/RBot/.editorconfig
@@ -5,3 +5,9 @@ dotnet_diagnostic.CA1303.severity = none
# CS1591: Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS1591.severity = none
+
+# CS0108: Member hides inherited member; missing new keyword
+dotnet_diagnostic.CS0108.severity = none
+
+# IDE1006: Naming Styles
+dotnet_diagnostic.IDE1006.severity = none
diff --git a/RBot/AS3InjectorForm.cs b/RBot/AS3InjectorForm.cs
deleted file mode 100644
index 8f4e805..0000000
--- a/RBot/AS3InjectorForm.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Text;
-using System.Linq;
-using System.Diagnostics;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using System.IO;
-
-using RBot.Flash;
-
-namespace RBot
-{
- public partial class AS3InjectorForm : HideForm
- {
- const string DefaultText = "package {\r\n\r\n\timport flash.display.*;\r\n\timport flash.external.*;\r\n\r\n\tpublic class Patch extends MovieClip {\r\n\r\n private var game:*;\r\n\r\n\t\tpublic function run(root:*) {\r\n game = root.getGame();\r\n \r\n \r\n\t\t}\r\n\t}\r\n}";
-
- public string CurrentFile { get; set; }
- private bool _modified;
- public bool Modified
- {
- get => _modified;
- set
- {
- Text = "AS3 Injector - " + (CurrentFile ?? "Unsaved.as") + (value ? "*" : "");
- _modified = value;
- }
- }
-
- public AS3InjectorForm()
- {
- InitializeComponent();
-
- KeyPreview = true;
- txtCode.DescriptionFile = "AS3Style.xml";
- txtCode.Text = DefaultText;
- txtCode.TextChanged += TxtCode_TextChanged;
- }
-
- private void TxtCode_TextChanged(object sender, FastColoredTextBoxNS.TextChangedEventArgs e)
- {
- Modified = true;
- }
-
- private void newToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (!Modified || MessageBox.Show("The current script has unsaved changes which will be lost if a new script is started. Are you sure you would like to start a new script?", "Unsaved Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
- {
- txtCode.Text = DefaultText;
- CurrentFile = null;
- Modified = false;
- }
- }
-
- private void openToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (!Modified || MessageBox.Show("The current script has unsaved changes which will be lost if another script is opened. Are you sure you would like to open a new script?", "Unsaved Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
- {
- using (OpenFileDialog ofd = new OpenFileDialog())
- {
- ofd.Filter = "ActionScript Files (*.as)|*.as";
- if (ofd.ShowDialog() == DialogResult.OK)
- {
- CurrentFile = ofd.FileName;
- txtCode.Text = File.ReadAllText(CurrentFile);
- Modified = false;
- }
- }
- }
- }
-
- private void saveToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (CurrentFile == null)
- saveAsToolStripMenuItem.PerformClick();
- else
- {
- File.WriteAllText(CurrentFile, txtCode.Text);
- Modified = false;
- }
- }
-
- private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
- {
- using (SaveFileDialog sfd = new SaveFileDialog())
- {
- sfd.Filter = "ActionScript Files (*.as)|*.as";
- if (sfd.ShowDialog() == DialogResult.OK)
- {
- CurrentFile = sfd.FileName;
- Modified = false;
- File.WriteAllText(CurrentFile, txtCode.Text);
- }
- }
- }
-
- private async void injectToolStripMenuItem_Click(object sender, EventArgs e)
- {
- injectToolStripMenuItem.Enabled = false;
- injectToolStripMenuItem.Text = "Compiling...";
-
- await Task.Run(() =>
- {
- File.WriteAllText("tmp/Patch.as", txtCode.Text);
-
- Process p = Process.Start(new ProcessStartInfo("tools/as3compile.exe")
- {
- Arguments = "tmp/Patch.as -o tmp/Patch.swf",
- UseShellExecute = false,
- CreateNoWindow = true,
- RedirectStandardError = true
- });
-
- StringBuilder sb = new StringBuilder();
- using (StreamReader err = p.StandardError)
- {
- while (!err.EndOfStream)
- sb.AppendLine(err.ReadLine());
- }
-
- p.WaitForExit();
- if (p.ExitCode == 0)
- {
- injectToolStripMenuItem.Text = "Injecting...";
- FlashUtil.Call("injectScript", new Uri(Path.Combine(Environment.CurrentDirectory, "tmp", "Patch.swf")).AbsoluteUri);
- }
- else
- MessageBox.Show($"Compiler exited with code {p.ExitCode}:\r\n{sb.ToString()}", "Compile Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- });
-
- injectToolStripMenuItem.Text = "Inject (Ctrl+F5)";
- injectToolStripMenuItem.Enabled = true;
- }
- }
-}
diff --git a/RBot/AS3InjectorForm.resx b/RBot/AS3InjectorForm.resx
deleted file mode 100644
index 2ed35b3..0000000
--- a/RBot/AS3InjectorForm.resx
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- AAEAAAD/////AQAAAAAAAAAMAgAAAFdGYXN0Q29sb3JlZFRleHRCb3gsIFZlcnNpb249Mi4xNi4yNC4w
- LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWZiOGFhMTJiOTk0ZWY2MWIMAwAAAFFTeXN0
- ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2Vu
- PWIwM2Y1ZjdmMTFkNTBhM2EFAQAAACJGYXN0Q29sb3JlZFRleHRCb3hOUy5TZXJ2aWNlQ29sb3JzBgAA
- ACg8Q29sbGFwc2VNYXJrZXJGb3JlQ29sb3I+a19fQmFja2luZ0ZpZWxkKDxDb2xsYXBzZU1hcmtlckJh
- Y2tDb2xvcj5rX19CYWNraW5nRmllbGQqPENvbGxhcHNlTWFya2VyQm9yZGVyQ29sb3I+a19fQmFja2lu
- Z0ZpZWxkJjxFeHBhbmRNYXJrZXJGb3JlQ29sb3I+a19fQmFja2luZ0ZpZWxkJjxFeHBhbmRNYXJrZXJC
- YWNrQ29sb3I+a19fQmFja2luZ0ZpZWxkKDxFeHBhbmRNYXJrZXJCb3JkZXJDb2xvcj5rX19CYWNraW5n
- RmllbGQEBAQEBAQUU3lzdGVtLkRyYXdpbmcuQ29sb3IDAAAAFFN5c3RlbS5EcmF3aW5nLkNvbG9yAwAA
- ABRTeXN0ZW0uRHJhd2luZy5Db2xvcgMAAAAUU3lzdGVtLkRyYXdpbmcuQ29sb3IDAAAAFFN5c3RlbS5E
- cmF3aW5nLkNvbG9yAwAAABRTeXN0ZW0uRHJhd2luZy5Db2xvcgMAAAACAAAABfz///8UU3lzdGVtLkRy
- YXdpbmcuQ29sb3IEAAAABG5hbWUFdmFsdWUKa25vd25Db2xvcgVzdGF0ZQEAAAAJBwcDAAAACgAAAAAA
- AAAAlgABAAH7/////P///woAAAAAAAAAAKQAAQAB+v////z///8KAAAAAAAAAACWAAEAAfn////8////
- CgAAAAAAAAAAjQABAAH4/////P///woAAAAAAAAAAKQAAQAB9/////z///8KAAAAAAAAAACWAAEACw==
-
-
-
- 17, 17
-
-
\ No newline at end of file
diff --git a/RBot/AS3Style.xml b/RBot/AS3Style.xml
deleted file mode 100644
index 1fb2048..0000000
--- a/RBot/AS3Style.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
- \b(as|break|case|catch|class|const|default|delete|do|else|extends|false|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|to|true|try|typeof|use|var|void|while|with)\b
- """"|"".*?[^\\]""
-
- //.*$
- (/\*.*?\*/)|(/\*.*)
- (/\*.*?\*/)|(.*\*/)
-
-
\ No newline at end of file
diff --git a/RBot/AboutForm.Designer.cs b/RBot/AboutForm.Designer.cs
deleted file mode 100644
index f5d6263..0000000
--- a/RBot/AboutForm.Designer.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-namespace RBot
-{
- partial class AboutForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.lblInfo = new System.Windows.Forms.Label();
- this.pbIcon = new System.Windows.Forms.PictureBox();
- ((System.ComponentModel.ISupportInitialize)(this.pbIcon)).BeginInit();
- this.SuspendLayout();
- //
- // lblInfo
- //
- this.lblInfo.AutoSize = true;
- this.lblInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblInfo.Location = new System.Drawing.Point(12, 12);
- this.lblInfo.Name = "lblInfo";
- this.lblInfo.Size = new System.Drawing.Size(139, 51);
- this.lblInfo.TabIndex = 0;
- this.lblInfo.Text = "RBot Version 0.0.0.0\r\nMade by Rodit\r\nBuild Date: [Date]";
- //
- // pbIcon
- //
- this.pbIcon.BackgroundImage = global::RBot.Properties.Resources.rbot;
- this.pbIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
- this.pbIcon.Location = new System.Drawing.Point(220, 12);
- this.pbIcon.Name = "pbIcon";
- this.pbIcon.Size = new System.Drawing.Size(51, 51);
- this.pbIcon.TabIndex = 1;
- this.pbIcon.TabStop = false;
- //
- // AboutForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(283, 76);
- this.Controls.Add(this.pbIcon);
- this.Controls.Add(this.lblInfo);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
- this.MaximizeBox = false;
- this.Name = "AboutForm";
- this.Text = "About";
- this.Load += new System.EventHandler(this.AboutForm_Load);
- ((System.ComponentModel.ISupportInitialize)(this.pbIcon)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.Label lblInfo;
- private System.Windows.Forms.PictureBox pbIcon;
- }
-}
\ No newline at end of file
diff --git a/RBot/AboutForm.cs b/RBot/AboutForm.cs
deleted file mode 100644
index 21c90bb..0000000
--- a/RBot/AboutForm.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Reflection;
-using System.Windows.Forms;
-
-using RBot.Utils;
-
-namespace RBot
-{
- public partial class AboutForm : HideForm
- {
- public AboutForm()
- {
- InitializeComponent();
- }
-
- private void AboutForm_Load(object sender, EventArgs e)
- {
- lblInfo.Text = $"RBot Version {Application.ProductVersion}\r\nMade by Rodit\r\nBuild Date: {Properties.Resources.BuildDate}";
- }
- }
-}
diff --git a/RBot/ActionScript/rbot/rbot.as3proj b/RBot/ActionScript/rbot/rbot.as3proj
index 9bacbd9..c772b25 100644
--- a/RBot/ActionScript/rbot/rbot.as3proj
+++ b/RBot/ActionScript/rbot/rbot.as3proj
@@ -8,10 +8,11 @@
-
+
+
@@ -73,7 +74,7 @@
-
+
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/Externalizer.as b/RBot/ActionScript/rbot/src/rbot/Externalizer.as
similarity index 83%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/Externalizer.as
rename to RBot/ActionScript/rbot/src/rbot/Externalizer.as
index 87fa7cb..42a2f80 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/Externalizer.as
+++ b/RBot/ActionScript/rbot/src/rbot/Externalizer.as
@@ -1,8 +1,8 @@
-package xyz.rodit.rbot
+package rbot
{
import flash.external.ExternalInterface;
- import xyz.rodit.rbot.remote.RemoteRegistry;
- import xyz.rodit.rbot.module.Modules;
+ import rbot.remote.RemoteRegistry;
+ import rbot.module.Modules;
public class Externalizer
{
@@ -14,10 +14,12 @@ package xyz.rodit.rbot
public function init(root:Main):void
{
- this.addCallback("loadClient", Main.loadGameClient);
+ this.addCallback("loadClient", Main.loadGame);
this.addCallback("getGameObject", Main.getGameObject);
this.addCallback("getGameObjectS", Main.getGameObjectS);
+ this.addCallback("getGameObjectKey", Main.getGameObjectKey);
this.addCallback("setGameObject", Main.setGameObject);
+ this.addCallback("setGameObjectKey", Main.setGameObjectKey);
this.addCallback("getArrayObject", Main.getArrayObject);
this.addCallback("setArrayObject", Main.setArrayObject);
this.addCallback("callGameFunction", Main.callGameFunction);
@@ -25,15 +27,15 @@ package xyz.rodit.rbot
this.addCallback("selectArrayObjects", Main.selectArrayObjects);
this.addCallback("isNull", Main.isNull);
- this.addCallback("setTitle", Main.setTitle);
this.addCallback("isLoggedIn", Main.isLoggedIn);
this.addCallback("isKicked", Main.isKicked);
this.addCallback("canUseSkill", Main.canUseSkill);
- this.addCallback("pickupDrops", Main.pickupDrops);
this.addCallback("rejectExcept", Main.rejectExcept);
this.addCallback("walkTo", Main.walkTo);
this.addCallback("untargetSelf", Main.untargetSelf);
- this.addCallback("attackMonster", Main.attackMonster);
+ this.addCallback("attackMonsterID", Main.attackMonsterByID);
+ this.addCallback("availableMonsters", Main.availableMonstersInCell);
+ this.addCallback("attackMonsterName", Main.attackMonsterByName);
this.addCallback("attackPlayer", Main.attackPlayer);
this.addCallback("useSkill", Main.useSkill);
this.addCallback("catchPackets", Main.catchPackets);
@@ -44,8 +46,10 @@ package xyz.rodit.rbot
this.addCallback("disableFX", Main.disableFX);
this.addCallback("hidePlayers", Main.hidePlayers);
this.addCallback("sendClientPacket", Main.sendClientPacket);
- this.addCallback("getDrops", Main.getDrops);
this.addCallback("injectScript", Main.injectScript);
+ this.addCallback("disableDeathAd", Main.disableDeathAd);
+ this.addCallback("UserID", Main.UserID);
+ this.addCallback("gender", Main.Gender);
this.addCallback("lnkCreate", RemoteRegistry.ext_create);
this.addCallback("lnkDestroy", RemoteRegistry.ext_destroy);
@@ -67,8 +71,6 @@ package xyz.rodit.rbot
this.addCallback("modEnable", Modules.enable);
this.addCallback("modDisable", Modules.disable);
- this.addCallback("test", Main.test);
-
this.debug("Externalizer::init done.");
this.call("requestLoadGame");
}
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ExtractedFuncs.as b/RBot/ActionScript/rbot/src/rbot/ExtractedFuncs.as
similarity index 97%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/ExtractedFuncs.as
rename to RBot/ActionScript/rbot/src/rbot/ExtractedFuncs.as
index df76e43..9c9786c 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ExtractedFuncs.as
+++ b/RBot/ActionScript/rbot/src/rbot/ExtractedFuncs.as
@@ -1,4 +1,4 @@
-package xyz.rodit.rbot
+package rbot
{
public class ExtractedFuncs
diff --git a/RBot/ActionScript/rbot/src/rbot/Main.as b/RBot/ActionScript/rbot/src/rbot/Main.as
new file mode 100644
index 0000000..112b41d
--- /dev/null
+++ b/RBot/ActionScript/rbot/src/rbot/Main.as
@@ -0,0 +1,596 @@
+package rbot
+{
+ import rbot.Externalizer;
+ import rbot.ExtractedFuncs;
+ import adobe.utils.ProductManager;
+ import flash.display.Loader;
+ import flash.display.LoaderInfo;
+ import flash.display.MovieClip;
+ import flash.display.Stage;
+ import flash.display.StageScaleMode;
+ import flash.display.StageAlign;
+ import flash.events.Event;
+ import flash.events.MouseEvent;
+ import flash.events.ProgressEvent;
+ import flash.net.URLLoader;
+ import flash.net.URLRequest;
+ import flash.system.ApplicationDomain;
+ import flash.system.LoaderContext;
+ import flash.system.Security;
+ import flash.utils.getQualifiedClassName;
+ import rbot.util.SFSEvent;
+ import rbot.module.Modules;
+
+ public class Main extends MovieClip
+ {
+ public static var instance:Main;
+
+ private static var _gameClass:Class;
+ private static var _fxStore:* = new Object();
+ private static var _fxLastOpt:Boolean = false;
+ private static var _handler:*;
+
+ private var game:*;
+ private var external:rbot.Externalizer;
+
+ private var sURL:String = "https://game.aq.com/game/";
+ private var versionUrl:String = (sURL + "api/data/gameversion");
+ private var loginURL:String = (sURL + "api/login/now");
+
+ private var sFile:String;
+ private var sBG:String = "Generic2.swf";
+ private var isEU:Boolean;
+ private var urlLoader:URLLoader;
+ private var loader:Loader;
+ private var vars:Object;
+ private var sTitle:String = "Welcome to RBot";
+
+ private var stg:Stage;
+ private var gameDomain:ApplicationDomain;
+
+ public function Main()
+ {
+ String.prototype.trim = function():String
+ {
+ return this.replace(/^\s+|\s+$/g, "");
+ };
+
+ Main.instance = this;
+
+ if (stage) this.init();
+ else addEventListener(Event.ADDED_TO_STAGE, this.init);
+ }
+
+ public static function loadGame(swfFile:String):void {
+ if (swfFile != null) {
+ Main.instance.sFile = swfFile;
+ }
+
+ Main.instance.onAddedToStage();
+ }
+
+ private function init(e:Event = null):void
+ {
+ removeEventListener(Event.ADDED_TO_STAGE, this.init);
+ this.external = new rbot.Externalizer();
+ this.external.init(this);
+ }
+
+ private function onAddedToStage():void
+ {
+ Security.allowDomain("*");
+ this.urlLoader = new URLLoader();
+ this.urlLoader.addEventListener(Event.COMPLETE, this.onDataComplete);
+ this.urlLoader.load(new URLRequest(this.versionUrl));
+ }
+
+ private function onDataComplete(event:Event):void
+ {
+ this.urlLoader.removeEventListener(Event.COMPLETE, this.onDataComplete);
+ this.vars = JSON.parse(event.target.data);
+ this.sFile = ((this.vars.sFile + "?ver=") + Math.random());
+ this.loadGame()
+ }
+
+ private function loadGame():void
+ {
+ this.loader = new Loader();
+ this.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onComplete);
+ this.loader.load(new URLRequest(this.sURL + "gamefiles/" + this.sFile));
+ }
+
+ private function onComplete(event:Event):void
+ {
+ this.loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, this.onComplete);
+
+ this.stg = stage;
+ this.stg.removeChildAt(0);
+ this.game = this.stg.addChild(this.loader.content);
+ this.stg.scaleMode = StageScaleMode.SHOW_ALL;
+ this.stg.align = StageAlign.TOP;
+
+ for (var param:String in root.loaderInfo.parameters)
+ {
+ this.game.params[param] = root.loaderInfo.parameters[param];
+ }
+
+ this.game.params.vars = this.vars;
+ this.game.params.sURL = this.sURL;
+ this.game.params.sTitle = this.sTitle;
+ this.game.params.sBG = this.sBG;
+ this.game.params.isEU = this.isEU;
+ this.game.params.loginURL = this.loginURL;
+
+ this.game.sfc.addEventListener(SFSEvent.onExtensionResponse, this.onExtensionResponse);
+ this.gameDomain = LoaderInfo(event.target).applicationDomain;
+
+ Modules.init();
+ this.stg.addEventListener(Event.ENTER_FRAME, Modules.handleFrame);
+
+ this.external.call("loaded");
+ }
+
+ public function onExtensionResponse(packet:*):void
+ {
+ this.external.call("pext", JSON.stringify(packet));
+ }
+
+ public function getGame():*
+ {
+ return this.game;
+ }
+
+ public function getExternal():rbot.Externalizer
+ {
+ return this.external;
+ }
+
+ public static function getGameObject(path:String):String
+ {
+ var obj:* = _getObjectS(instance.game, path);
+ return JSON.stringify(obj);
+ }
+
+ public static function getGameObjectS(path:String):String
+ {
+ if (_gameClass == null)
+ {
+ _gameClass = instance.gameDomain.getDefinition(getQualifiedClassName(instance.game)) as Class;
+ }
+ var obj:* = _getObjectS(_gameClass, path);
+ return JSON.stringify(obj);
+ }
+
+ public static function getGameObjectKey(path:String, key:String):String
+ {
+ var obj:* = _getObjectS(instance.game, path);
+ var obj2:* = obj[key];
+ return (JSON.stringify(obj2));
+ }
+
+ public static function setGameObject(path:String, value:*):void
+ {
+ var parts:Array = path.split(".");
+ var varName:String = parts.pop();
+ var obj:* = _getObjectA(instance.game, parts);
+ obj[varName] = value;
+ }
+
+ public static function setGameObjectKey(path:String, key:String, value:*):void
+ {
+ var parts:Array = path.split(".");
+ var obj:* = _getObjectA(instance.game, parts);
+ obj[key] = value;
+ }
+
+ public static function getArrayObject(path:String, index:int):String
+ {
+ var obj:* = _getObjectS(instance.game, path);
+ return JSON.stringify(obj[index]);
+ }
+
+ public static function setArrayObject(path:String, index:int, value:*):void
+ {
+ var obj:* = _getObjectS(instance.game, path);
+ obj[index] = value;
+ }
+
+ public static function callGameFunction(path:String, ... args):String
+ {
+ var parts:Array = path.split(".");
+ var funcName:String = parts.pop();
+ var obj:* = _getObjectA(instance.game, parts);
+ var func:Function = obj[funcName] as Function;
+ return JSON.stringify(func.apply(null, args));
+ }
+
+ public static function callGameFunction0(path:String):String
+ {
+ var parts:Array = path.split(".");
+ var funcName:String = parts.pop();
+ var obj:* = _getObjectA(instance.game, parts);
+ var func:Function = obj[funcName] as Function;
+ return JSON.stringify(func.apply());
+ }
+
+ public static function selectArrayObjects(path:String, selector:String):String
+ {
+ var obj:* = _getObjectS(instance.game, path);
+ if (!(obj is Array))
+ {
+ instance.external.debug("selectArrayObjects target is not an array");
+ return "";
+ }
+ var array:Array = obj as Array;
+ var narray:Array = new Array();
+ for (var j:int = 0; j < array.length; j++)
+ {
+ narray.push(_getObjectS(array[j], selector));
+ }
+ return JSON.stringify(narray);
+ }
+
+ public static function _getObjectS(root:*, path:String):*
+ {
+ return _getObjectA(root, path.split("."));
+ }
+
+ public static function _getObjectA(root:*, parts:Array):*
+ {
+ var obj:* = root;
+ for (var i:int = 0; i < parts.length; i++)
+ {
+ obj = obj[parts[i]];
+ }
+ return obj;
+ }
+
+ public static function isNull(path:String):String
+ {
+ try
+ {
+ return (_getObjectS(instance.game, path) == null).toString();
+ }
+ catch (ex:Error)
+ {
+ }
+ return "true";
+ }
+
+ public static function isLoggedIn():String
+ {
+ return (instance.game != null && instance.game.sfc != null && instance.game.sfc.isConnected).toString();
+ }
+
+ public static function isKicked():String
+ {
+ return (instance.game.mcLogin != null && instance.game.mcLogin.warning.visible).toString();
+ }
+
+ public static function canUseSkill(index:int):String
+ {
+ return (instance.game.world.myAvatar.target != null && instance.game.world.myAvatar.target.dataLeaf.intHP > 0 && rbot.ExtractedFuncs.actionTimeCheck(instance.game.world.actions.active[index]) && instance.game.world.actions.active[index].isOK).toString();
+ }
+
+ public static function walkTo(xPos:int, yPos:int, walkSpeed:int):void
+ {
+ walkSpeed = (walkSpeed == 8 ? instance.game.world.WALKSPEED : walkSpeed);
+ instance.game.world.myAvatar.pMC.walkTo(xPos, yPos, walkSpeed);
+ instance.game.world.moveRequest({
+ "mc":instance.game.world.myAvatar.pMC,
+ "tx":xPos,
+ "ty":yPos,
+ "sp":walkSpeed
+ });
+ }
+
+ public static function untargetSelf():void
+ {
+ var target:* = instance.game.world.myAvatar.target;
+ if (target && target == instance.game.world.myAvatar)
+ {
+ instance.game.world.cancelTarget();
+ }
+ }
+
+ public static function attackMonsterByID(id:int):void
+ {
+ var monster:Object = getMonsterByID(id);
+ attackTarget(monster);
+ }
+
+ public static function availableMonstersInCell():String
+ {
+ var monsters:* = instance.game.world.getMonstersByCell(instance.game.world.strFrame);
+ var retMonsters:Array = [];
+ for each (var monster:* in monsters)
+ {
+ if (monster.pMC != null)
+ {
+ retMonsters.push(monster.objData);
+ }
+ }
+ return JSON.stringify(retMonsters);
+ }
+
+ public static function attackMonsterByName(name:String):void
+ {
+ var monster:Object = getMonster(name);
+ attackTarget(monster);
+ }
+
+ public static function attackPlayer(name:String):void
+ {
+ var player:* = instance.game.world.getAvatarByUserName(name.toLowerCase());
+ attackTarget(player);
+ }
+
+ private static function attackTarget(target:*):void
+ {
+ if (target != null)
+ {
+ instance.game.world.setTarget(target);
+ instance.game.world.approachTarget();
+ }
+ }
+
+ public static function useSkill(index:int):void
+ {
+ var skill:* = instance.game.world.actions.active[index];
+ if (instance.game.world.myAvatar.target == null || instance.game.world.myAvatar.target.dataLeaf.intHP > 0)
+ {
+ if (rbot.ExtractedFuncs.actionTimeCheck(skill))
+ {
+ instance.game.world.testAction(skill);
+ }
+ }
+ }
+
+ public static function magnetize():void
+ {
+ var target:* = instance.game.world.myAvatar.target;
+ if (target)
+ {
+ target.pMC.x = instance.game.world.myAvatar.pMC.x;
+ target.pMC.y = instance.game.world.myAvatar.pMC.y;
+ }
+ }
+
+ public static function infiniteRange():void
+ {
+ for (var i:int = 0; i < 6; i++)
+ {
+ instance.game.world.actions.active[i].range = 20000;
+ }
+ }
+
+ public static function skipCutscenes():void
+ {
+ while (instance.game.mcExtSWF.numChildren > 0)
+ {
+ instance.game.mcExtSWF.removeChildAt(0);
+ }
+ instance.game.showInterface();
+ instance.game.world.visible = true;
+ }
+
+ public static function killLag(enable:Boolean):void
+ {
+ instance.game.world.visible = !enable;
+ }
+
+ public static function disableFX(enabled:Boolean):void
+ {
+ if (!_fxLastOpt && enabled)
+ {
+ _fxStore = new Object();
+ }
+ _fxLastOpt = enabled;
+ for each (var avatar:* in instance.game.world.avatars)
+ {
+ if (enabled)
+ {
+ if (avatar.pMC.spFX != null)
+ {
+ _fxStore[avatar.uid] = avatar.rootClass.spFX;
+ }
+ avatar.rootClass.spFX = null;
+ }
+ else
+ {
+ avatar.rootClass.spFX = _fxStore[avatar.uid];
+ }
+ }
+ }
+
+ public static function hidePlayers(enabled:Boolean):void
+ {
+ for each (var avatar:* in instance.game.world.avatars)
+ {
+ if (avatar != null && avatar.pnm != null && !avatar.isMyAvatar)
+ {
+ if (enabled)
+ {
+ avatar.hideMC();
+ }
+ else if (avatar.strFrame == instance.game.world.strFrame)
+ {
+ avatar.showMC();
+ }
+ }
+ }
+ }
+
+ private static function parseDrop(name:*):*
+ {
+ var ret:* = new Object();
+ ret.name = name.toLowerCase().trim();
+ ret.count = 1;
+ var regex:RegExp = /(.*)\s+x\s*(\d*)/g;
+ var result:Object = regex.exec(name.toLowerCase().trim());
+ if (result == null)
+ {
+ return ret;
+ }
+ else
+ {
+ ret.name = result[1];
+ ret.count = int(result[2]);
+ return ret;
+ }
+ }
+
+ public static function rejectExcept(whitelist:String):void
+ {
+ var pickup:Array = whitelist.split(",");
+ if (instance.game.litePreference.data.bCustomDrops)
+ {
+ var source:* = instance.game.cDropsUI.mcDraggable ? instance.game.cDropsUI.mcDraggable.menu : instance.game.cDropsUI;
+ for (var i: int = 0; i < source.numChildren; i++)
+ {
+ var child:* = source.getChildAt(i);
+ if (child.itemObj)
+ {
+ var itemName:String = child.itemObj.sName.toLowerCase();
+ if (pickup.indexOf(itemName) == -1)
+ {
+ child.btNo.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
+ }
+ }
+ }
+ }
+ else
+ {
+ var children:int = instance.game.ui.dropStack.numChildren;
+ for (i = 0; i < children; i++)
+ {
+ child = instance.game.ui.dropStack.getChildAt(i);
+ var type:String = getQualifiedClassName(child);
+ if (type.indexOf("DFrame2MC") != -1)
+ {
+ var drop:* = parseDrop(child.cnt.strName.text);
+ var name:* = drop.name;
+ if (pickup.indexOf(name) == -1)
+ {
+ child.cnt.nbtn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
+ }
+ }
+ }
+ }
+ }
+
+ public static function injectScript(uri:String):void
+ {
+ var ploader:Loader = new Loader();
+ ploader.contentLoaderInfo.addEventListener(Event.COMPLETE, onScriptLoaded);
+ var context:LoaderContext = new LoaderContext();
+ context.allowCodeImport = true;
+ ploader.load(new URLRequest(uri), context);
+ }
+
+ private static function onScriptLoaded(event:Event):void
+ {
+ try
+ {
+ var obj:* = LoaderInfo(event.target).loader.content;
+ obj.run(instance);
+ }
+ catch (ex:Error)
+ {
+ instance.external.debug("Error while running injection: " + ex);
+ }
+ }
+
+ public static function getMonsterByID(id:int):*
+ {
+ for each (var monster:* in instance.game.world.getMonstersByCell(instance.game.world.strFrame))
+ {
+ if (monster.dataLeaf.MonMapID == id)
+ {
+ return monster;
+ }
+ }
+ return null;
+ }
+
+ public static function getMonster(name:String):*
+ {
+ for each (var monster:* in instance.game.world.getMonstersByCell(instance.game.world.strFrame))
+ {
+ var monName:String = monster.objData.strMonName.toLowerCase();
+ if ((monName.indexOf(name.toLowerCase()) > -1 || name == "*") && monster.dataLeaf.intState > 0)
+ {
+ return monster;
+ }
+ }
+ return null;
+ }
+
+ public static function catchPackets():void
+ {
+ instance.game.sfc.addEventListener(SFSEvent.onDebugMessage, packetReceived);
+ }
+
+ public static function sendClientPacket(packet:String, type:String):void
+ {
+ if (_handler == null)
+ {
+ var cls:Class = Class(instance.gameDomain.getDefinition("it.gotoandplay.smartfoxserver.handlers.ExtHandler"));
+ _handler = new cls(instance.game.sfc);
+ }
+ switch (type)
+ {
+ case "xml":
+ xmlReceived(packet);
+ break;
+ case "json":
+ jsonReceived(packet);
+ break;
+ case "str":
+ strReceived(packet);
+ break;
+ default:
+ instance.external.debug("Invalid packet type.");
+ };
+ }
+
+ public static function xmlReceived(packet:String):void
+ {
+ _handler.handleMessage(new XML(packet), "xml");
+ }
+
+ public static function jsonReceived(packet:String):void
+ {
+ _handler.handleMessage(JSON.parse(packet)["b"], "json");
+ }
+
+ public static function strReceived(packet:String):void
+ {
+ var array:Array = packet.substr(1, packet.length - 2).split("%");
+ _handler.handleMessage(array.splice(1, array.length - 1), "str");
+ }
+
+ public static function packetReceived(packet:*):void
+ {
+ if (packet.params.message.indexOf("%xt%zm%") > -1)
+ {
+ instance.external.call("packet", packet.params.message.split(":", 2)[1].trim());
+ }
+ }
+
+ public static function disableDeathAd(enable:Boolean):void
+ {
+ instance.game.userPreference.data.bDeathAd = !enable;
+ }
+
+ public static function UserID():int
+ {
+ return instance.game.world.myAvatar.uid;
+ }
+
+ public static function Gender():String
+ {
+ return '"' + instance.game.world.myAvatar.objData.strGender.toUpperCase() + '"';
+ }
+ }
+}
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/DisableCollisions.as b/RBot/ActionScript/rbot/src/rbot/module/DisableCollisions.as
similarity index 94%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/DisableCollisions.as
rename to RBot/ActionScript/rbot/src/rbot/module/DisableCollisions.as
index 554d108..796ea17 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/DisableCollisions.as
+++ b/RBot/ActionScript/rbot/src/rbot/module/DisableCollisions.as
@@ -1,4 +1,4 @@
-package xyz.rodit.rbot.module
+package rbot.module
{
public class DisableCollisions extends Module
{
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/DisableFX.as b/RBot/ActionScript/rbot/src/rbot/module/DisableFX.as
similarity index 98%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/DisableFX.as
rename to RBot/ActionScript/rbot/src/rbot/module/DisableFX.as
index 2340f49..7f8cd7e 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/DisableFX.as
+++ b/RBot/ActionScript/rbot/src/rbot/module/DisableFX.as
@@ -1,4 +1,4 @@
-package xyz.rodit.rbot.module
+package rbot.module
{
import flash.display.MovieClip;
import flash.utils.getQualifiedClassName;
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/HidePlayers.as b/RBot/ActionScript/rbot/src/rbot/module/HidePlayers.as
similarity index 90%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/HidePlayers.as
rename to RBot/ActionScript/rbot/src/rbot/module/HidePlayers.as
index 5f37a57..009f3dc 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/HidePlayers.as
+++ b/RBot/ActionScript/rbot/src/rbot/module/HidePlayers.as
@@ -1,6 +1,6 @@
-package xyz.rodit.rbot.module
+package rbot.module
{
- import xyz.rodit.rbot.Main;;
+ import rbot.Main;
public class HidePlayers extends Module
{
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/Module.as b/RBot/ActionScript/rbot/src/rbot/module/Module.as
similarity index 90%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/Module.as
rename to RBot/ActionScript/rbot/src/rbot/module/Module.as
index 1ee4a09..da706b7 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/Module.as
+++ b/RBot/ActionScript/rbot/src/rbot/module/Module.as
@@ -1,4 +1,4 @@
-package xyz.rodit.rbot.module
+package rbot.module
{
public class Module
{
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/Modules.as b/RBot/ActionScript/rbot/src/rbot/module/Modules.as
similarity index 82%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/Modules.as
rename to RBot/ActionScript/rbot/src/rbot/module/Modules.as
index ba783ba..d62ab6c 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/Modules.as
+++ b/RBot/ActionScript/rbot/src/rbot/module/Modules.as
@@ -1,7 +1,7 @@
-package xyz.rodit.rbot.module
+package rbot.module
{
import flash.events.Event;
- import xyz.rodit.rbot.Main;
+ import rbot.Main;
public class Modules
{
@@ -26,7 +26,7 @@ package xyz.rodit.rbot.module
module.enabled = true;
if (toggle)
{
- module.onToggle(Main.instance.getGame());
+ module.onToggle(rbot.Main.instance.getGame());
}
}
}
@@ -40,7 +40,7 @@ package xyz.rodit.rbot.module
module.enabled = false;
if (toggle)
{
- module.onToggle(Main.instance.getGame());
+ module.onToggle(rbot.Main.instance.getGame());
}
}
}
@@ -52,15 +52,13 @@ package xyz.rodit.rbot.module
var module:Module = _modules[name];
if (module.enabled)
{
- module.onFrame(Main.instance.getGame());
+ module.onFrame(rbot.Main.instance.getGame());
}
}
}
public static function init():void
{
- registerModule(new UIModule());
-
registerModule(new QuestItemRates());
registerModule(new HidePlayers());
registerModule(new DisableCollisions());
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/QuestItemRates.as b/RBot/ActionScript/rbot/src/rbot/module/QuestItemRates.as
similarity index 96%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/QuestItemRates.as
rename to RBot/ActionScript/rbot/src/rbot/module/QuestItemRates.as
index dcdc594..969ea99 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/QuestItemRates.as
+++ b/RBot/ActionScript/rbot/src/rbot/module/QuestItemRates.as
@@ -1,4 +1,4 @@
-package xyz.rodit.rbot.module
+package rbot.module
{
import flash.utils.getQualifiedClassName;
public class QuestItemRates extends Module
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/FunctionCaller.as b/RBot/ActionScript/rbot/src/rbot/remote/FunctionCaller.as
similarity index 90%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/FunctionCaller.as
rename to RBot/ActionScript/rbot/src/rbot/remote/FunctionCaller.as
index c05810e..f865ebb 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/FunctionCaller.as
+++ b/RBot/ActionScript/rbot/src/rbot/remote/FunctionCaller.as
@@ -1,6 +1,6 @@
-package xyz.rodit.rbot.remote
+package rbot.remote
{
- import xyz.rodit.rbot.Main;
+ import rbot.Main;
public class FunctionCaller
{
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/LinkedObject.as b/RBot/ActionScript/rbot/src/rbot/remote/LinkedObject.as
similarity index 98%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/LinkedObject.as
rename to RBot/ActionScript/rbot/src/rbot/remote/LinkedObject.as
index 93469f7..0d71ed2 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/LinkedObject.as
+++ b/RBot/ActionScript/rbot/src/rbot/remote/LinkedObject.as
@@ -1,4 +1,4 @@
-package xyz.rodit.rbot.remote
+package rbot.remote
{
public class LinkedObject
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/ObjectParent.as b/RBot/ActionScript/rbot/src/rbot/remote/ObjectParent.as
similarity index 81%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/ObjectParent.as
rename to RBot/ActionScript/rbot/src/rbot/remote/ObjectParent.as
index 6a8e5d8..8c9ef12 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/ObjectParent.as
+++ b/RBot/ActionScript/rbot/src/rbot/remote/ObjectParent.as
@@ -1,4 +1,4 @@
-package xyz.rodit.rbot.remote
+package rbot.remote
{
public class ObjectParent
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/RemoteRegistry.as b/RBot/ActionScript/rbot/src/rbot/remote/RemoteRegistry.as
similarity index 94%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/RemoteRegistry.as
rename to RBot/ActionScript/rbot/src/rbot/remote/RemoteRegistry.as
index 6d7b5bd..c30acad 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/remote/RemoteRegistry.as
+++ b/RBot/ActionScript/rbot/src/rbot/remote/RemoteRegistry.as
@@ -1,6 +1,6 @@
-package xyz.rodit.rbot.remote
+package rbot.remote
{
- import xyz.rodit.rbot.Main;
+ import rbot.Main;
public class RemoteRegistry
{
@@ -34,7 +34,7 @@ package xyz.rodit.rbot.remote
{
var parts:Array = path.split(".");
var name:String = parts.pop();
- return createLinked(Main._getObjectA(Main.instance.getGame(), parts), name).getId().toString();
+ return createLinked(rbot.Main._getObjectA(rbot.Main.instance.getGame(), parts), name).getId().toString();
}
public static function ext_destroy(id:int):void
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/util/SFSEvent.as b/RBot/ActionScript/rbot/src/rbot/util/SFSEvent.as
similarity index 98%
rename from RBot/ActionScript/rbot/src/xyz/rodit/rbot/util/SFSEvent.as
rename to RBot/ActionScript/rbot/src/rbot/util/SFSEvent.as
index b43aa06..e003101 100644
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/util/SFSEvent.as
+++ b/RBot/ActionScript/rbot/src/rbot/util/SFSEvent.as
@@ -1,4 +1,4 @@
-package xyz.rodit.rbot.util
+package rbot.util
{
import flash.events.Event;
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/Main.as b/RBot/ActionScript/rbot/src/xyz/rodit/rbot/Main.as
deleted file mode 100644
index f7f13cc..0000000
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/Main.as
+++ /dev/null
@@ -1,625 +0,0 @@
-package xyz.rodit.rbot
-{
- import adobe.utils.ProductManager;
- import flash.display.Loader;
- import flash.display.LoaderInfo;
- import flash.display.MovieClip;
- import flash.display.Stage;
- import flash.display.StageScaleMode;
- import flash.display.StageAlign;
- import flash.events.Event;
- import flash.events.MouseEvent;
- import flash.events.ProgressEvent;
- import flash.net.URLLoader;
- import flash.net.URLRequest;
- import flash.net.URLVariables;
- import flash.system.ApplicationDomain;
- import flash.system.LoaderContext;
- import flash.system.Security;
- import flash.utils.getQualifiedClassName;
- import xyz.rodit.rbot.util.SFSEvent;
- import xyz.rodit.rbot.module.Modules;
-
- public class Main extends MovieClip
- {
- public static var instance:Main;
-
- private static var _gameClass:Class;
- private static var _fxStore:* = new Object();
- private static var _fxLastOpt:Boolean = false;
- private static var _handler:*;
-
- private var game:*;
- private var external:Externalizer;
-
- private var baseUrl:String = "https://game.aq.com/game/";
- private var versionUrl:String = (baseUrl + "gameversion.asp");
- private var sFile:*;
- private var sBG:String;
- private var isEU:Boolean;
- private var loginURL:*;
- private var infoLoader:URLLoader;
- private var gameLoader:Loader;
- private var vars:URLVariables;
- private var title:String = "Loading...";
- private var clientSwfFile: String = "spider.swf";
-
- private var stg:Stage;
- private var gameDomain:ApplicationDomain;
-
- public function Main()
- {
- String.prototype.trim = function():String
- {
- return this.replace(/^\s+|\s+$/g, "");
- };
-
- Main.instance = this;
-
- if (stage) this.init();
- else addEventListener(Event.ADDED_TO_STAGE, this.init);
- }
-
- public static function loadGameClient(swfFile: String):void {
- if (swfFile != null) {
- Main.instance.clientSwfFile = swfFile;
- }
-
- Main.instance.loadGame();
- }
-
- private function init(e:Event = null):void
- {
- removeEventListener(Event.ADDED_TO_STAGE, this.init);
- this.external = new Externalizer();
- this.external.init(this);
- }
-
- private function loadGame():void
- {
- Security.allowDomain("*");
- this.infoLoader = new URLLoader();
- this.infoLoader.addEventListener(Event.COMPLETE, this.onInfoLoaded);
- this.infoLoader.load(new URLRequest(this.versionUrl));
- }
-
- private function onInfoLoaded(event:Event):void
- {
- this.infoLoader.removeEventListener(Event.COMPLETE, this.onInfoLoaded);
- this.vars = new URLVariables(event.target.data);
- if (this.vars.status == "success")
- {
- this.sFile = (this.clientSwfFile + "?ver=" + Math.random());
- this.sBG = this.vars.sBG;
- this.isEU = (this.vars.isEU == "true");
- trace(("FlugelHorn = " + this.isEU));
- this.loginURL = this.vars.LoginURL;
- this.loadGameClient();
- }
- }
-
- private function loadGameClient():void
- {
- this.gameLoader = new Loader();
- this.gameLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, this.onGameProgress);
- this.gameLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onGameLoaded);
- this.gameLoader.load(new URLRequest(this.baseUrl + "gamefiles/" + this.sFile));
- }
-
- private function onGameProgress(event:ProgressEvent):void
- {
- this.external.call("progress", Math.round(Number(event.currentTarget.bytesLoaded / event.currentTarget.bytesTotal) * 100).toString());
- }
-
- private function onGameLoaded(event:Event):void
- {
- this.gameLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, this.onGameProgress);
- this.gameLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, this.onGameLoaded);
-
- this.stg = stage;
- this.stg.removeChildAt(0);
- this.game = this.stg.addChild(this.gameLoader.content);
- this.stg.scaleMode = StageScaleMode.SHOW_ALL;
- this.stg.align = StageAlign.TOP;
-
- for (var param:String in root.loaderInfo.parameters)
- {
- this.game.params[param] = root.loaderInfo.parameters[param];
- }
-
- this.game.params.sURL = this.baseUrl;
- this.game.params.sTitle = this.title;
- this.game.params.vars = this.vars;
- this.game.params.loginURL = "https://game.aq.com/game/api/login/now";
- this.game.params.sBG = this.vars.sBG;
-
- this.game.sfc.addEventListener(SFSEvent.onExtensionResponse, this.onExtensionResponse);
- this.gameDomain = LoaderInfo(event.target).applicationDomain;
-
- Modules.init();
- this.stg.addEventListener(Event.ENTER_FRAME, Modules.handleFrame);
-
- this.external.call("loaded");
- }
-
- public function onExtensionResponse(packet:*):void
- {
- this.external.call("pext", JSON.stringify(packet));
- }
-
- public function getGame():*
- {
- return this.game;
- }
-
- public function getExternal():Externalizer
- {
- return this.external;
- }
-
- public static function getGameObject(path:String):String
- {
- var obj:* = _getObjectS(instance.game, path);
- return JSON.stringify(obj);
- }
-
- public static function getGameObjectS(path:String):String
- {
- if (_gameClass == null)
- {
- _gameClass = instance.gameDomain.getDefinition(getQualifiedClassName(instance.game)) as Class;
- }
- var obj:* = _getObjectS(_gameClass, path);
- return JSON.stringify(obj);
- }
-
- public static function setGameObject(path:String, value:*):void
- {
- var parts:Array = path.split(".");
- var varName:String = parts.pop();
- var obj:* = _getObjectA(instance.game, parts);
- obj[varName] = value;
- }
-
- public static function getArrayObject(path:String, index:int):String
- {
- var obj:* = _getObjectS(instance.game, path);
- return JSON.stringify(obj[index]);
- }
-
- public static function setArrayObject(path:String, index:int, value:*):void
- {
- var obj:* = _getObjectS(instance.game, path);
- obj[index] = value;
- }
-
- public static function callGameFunction(path:String, ... args):String
- {
- var parts:Array = path.split(".");
- var funcName:String = parts.pop();
- var obj:* = _getObjectA(instance.game, parts);
- var func:Function = obj[funcName] as Function;
- return JSON.stringify(func.apply(null, args));
- }
-
- public static function callGameFunction0(path:String):String
- {
- var parts:Array = path.split(".");
- var funcName:String = parts.pop();
- var obj:* = _getObjectA(instance.game, parts);
- var func:Function = obj[funcName] as Function;
- return JSON.stringify(func.apply());
- }
-
- public static function selectArrayObjects(path:String, selector:String):String
- {
- var obj:* = _getObjectS(instance.game, path);
- if (!(obj is Array))
- {
- instance.external.debug("selectArrayObjects target is not an array");
- return "";
- }
- var array:Array = obj as Array;
- var narray:Array = new Array();
- for (var j:int = 0; j < array.length; j++)
- {
- narray.push(_getObjectS(array[j], selector));
- }
- return JSON.stringify(narray);
- }
-
- public static function _getObjectS(root:*, path:String):*
- {
- return _getObjectA(root, path.split("."));
- }
-
- public static function _getObjectA(root:*, parts:Array):*
- {
- var obj:* = root;
- for (var i:int = 0; i < parts.length; i++)
- {
- obj = obj[parts[i]];
- }
- return obj;
- }
-
- public static function isNull(path:String):String
- {
- try
- {
- return (_getObjectS(instance.game, path) == null).toString();
- }
- catch (ex:Error)
- {
- }
- return "true";
- }
-
- public static function setTitle(title:String):void
- {
- instance.game.mcLogin.mcLogo.txtTitle.htmlText = "New Release: " + title;
- }
-
- public static function isLoggedIn():String
- {
- return (instance.game != null && instance.game.sfc != null && instance.game.sfc.isConnected).toString();
- }
-
- public static function isKicked():String
- {
- return (instance.game.mcLogin != null && instance.game.mcLogin.warning.visible).toString();
- }
-
- public static function canUseSkill(index:int):String
- {
- return (instance.game.world.myAvatar.target != null && instance.game.world.myAvatar.target.dataLeaf.intHP > 0 && ExtractedFuncs.actionTimeCheck(instance.game.world.actions.active[index]) && instance.game.world.actions.active[index].isOK).toString();
- }
-
- public static function pickupDrops(whitelist:String):void
- {
- var all:Boolean = whitelist == "*";
- var pickup:Array = whitelist.split(",");
- var accepted:* = [];
- if (instance.game.litePreference.data.bCustomDrops)
- {
- var source:* = instance.game.cDropsUI.mcDraggable ? instance.game.cDropsUI.mcDraggable.menu : instance.game.cDropsUI;
- for (var i: int = 0; i < source.numChildren; i++)
- {
- var child:* = source.getChildAt(i);
- if (child.itemObj)
- {
- var itemName:String = child.itemObj.sName.toLowerCase();
- if ((all || pickup.indexOf(itemName) > -1) && accepted.indexOf(itemName) == -1)
- {
- child.btYes.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
- accepted.push(itemName);
- }
- }
- }
- }
- else
- {
- var children:int = instance.game.ui.dropStack.numChildren;
- for (var i:int = 0; i < children; i++)
- {
- var child:* = instance.game.ui.dropStack.getChildAt(i);
- var type:String = getQualifiedClassName(child);
- if (type.indexOf("DFrame2MC") != -1)
- {
- var drop:* = parseDrop(child.cnt.strName.text);
- var name:* = drop.name;
- if ((all || pickup.indexOf(name) > -1) && accepted.indexOf(name) == -1)
- {
- child.cnt.ybtn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
- accepted.push(name);
- }
- }
- }
- }
- }
-
- public static function rejectExcept(whitelist:String):void
- {
- var pickup:Array = whitelist.split(",");
- if (instance.game.litePreference.data.bCustomDrops)
- {
- var source:* = instance.game.cDropsUI.mcDraggable ? instance.game.cDropsUI.mcDraggable.menu : instance.game.cDropsUI;
- for (var i: int = 0; i < source.numChildren; i++)
- {
- var child:* = source.getChildAt(i);
- if (child.itemObj)
- {
- var itemName:String = child.itemObj.sName.toLowerCase();
- if (pickup.indexOf(itemName) == -1)
- {
- child.btNo.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
- }
- }
- }
- }
- else
- {
- var children:int = instance.game.ui.dropStack.numChildren;
- for (var i:int = 0; i < children; i++)
- {
- var child:* = instance.game.ui.dropStack.getChildAt(i);
- var type:String = getQualifiedClassName(child);
- if (type.indexOf("DFrame2MC") != -1)
- {
- var drop:* = parseDrop(child.cnt.strName.text);
- var name:* = drop.name;
- if (pickup.indexOf(name) == -1)
- {
- child.cnt.nbtn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
- }
- }
- }
- }
- }
-
- public static function walkTo(x:Number, y:Number):void
- {
- instance.game.world.myAvatar.pMC.walkTo(x, y, instance.game.world.WALKSPEED);
- instance.game.world.moveRequest({"mc": instance.game.world.myAvatar.pMC, "tx": x, "ty": y, "sp": instance.game.world.WALKSPEED});
- }
-
- public static function untargetSelf():void
- {
- var target:* = instance.game.world.myAvatar.target;
- if (target && target == instance.game.world.myAvatar)
- {
- instance.game.world.cancelTarget();
- }
- }
-
- public static function attackMonster(id:int):void
- {
- var monster:* = getMonsterByID(id);
- if (monster != null)
- {
- instance.game.world.setTarget(monster);
- instance.game.world.approachTarget();
- }
- }
-
- public static function attackPlayer(name:String):void
- {
- var player:* = instance.game.world.getAvatarByUserName(name.toLowerCase());
- if (player != null)
- {
- instance.game.world.setTarget(player);
- instance.game.world.approachTarget();
- }
- }
-
- public static function useSkill(index:int):void
- {
- var skill:* = instance.game.world.actions.active[index];
- if (instance.game.world.myAvatar.target == null || instance.game.world.myAvatar.target.dataLeaf.intHP > 0)
- {
- if (ExtractedFuncs.actionTimeCheck(skill))
- {
- instance.game.world.testAction(skill);
- }
- }
- }
-
- public static function catchPackets():void
- {
- instance.game.sfc.addEventListener(SFSEvent.onDebugMessage, packetReceived);
- }
-
- public static function magnetize():void
- {
- var target:* = instance.game.world.myAvatar.target;
- if (target)
- {
- target.pMC.x = instance.game.world.myAvatar.pMC.x;
- target.pMC.y = instance.game.world.myAvatar.pMC.y;
- }
- }
-
- public static function infiniteRange():void
- {
- for (var i:int = 0; i < 6; i++)
- {
- instance.game.world.actions.active[i].range = 20000;
- }
- }
-
- public static function skipCutscenes():void
- {
- while (instance.game.mcExtSWF.numChildren > 0)
- {
- instance.game.mcExtSWF.removeChildAt(0);
- }
- instance.game.showInterface();
- }
-
- public static function killLag(enable:Boolean):void
- {
- instance.game.world.visible = !enable;
- }
-
- public static function disableFX(enabled:Boolean):void
- {
- if (!_fxLastOpt && enabled)
- {
- _fxStore = new Object();
- }
- _fxLastOpt = enabled;
- for each (var avatar:* in instance.game.world.avatars)
- {
- if (enabled)
- {
- if (avatar.pMC.spFX != null)
- {
- _fxStore[avatar.uid] = avatar.rootClass.spFX;
- }
- avatar.rootClass.spFX = null;
- }
- else
- {
- avatar.rootClass.spFX = _fxStore[avatar.uid];
- }
- }
- }
-
- public static function hidePlayers(enabled:Boolean):void
- {
- for each (var avatar:* in instance.game.world.avatars)
- {
- if (avatar != null && avatar.pnm != null && !avatar.isMyAvatar)
- {
- if (enabled)
- {
- avatar.hideMC();
- }
- else if (avatar.strFrame == instance.game.world.strFrame)
- {
- avatar.showMC();
- }
- }
- }
- }
-
- private static function parseDrop(name:*):*
- {
- var ret:* = new Object();
- ret.name = name.toLowerCase().trim();
- ret.count = 1;
- var regex:RegExp = /(.*)\s+x\s*(\d*)/g;
- var result:Object = regex.exec(name.toLowerCase().trim());
- if (result == null)
- {
- return ret;
- }
- else
- {
- ret.name = result[1];
- ret.count = int(result[2]);
- return ret;
- }
- }
-
- public static function getDrops():String
- {
- var children:int = instance.game.ui.dropStack.numChildren;
- var drops:* = [];
- if (instance.game.litePreference.data.bCustomDrops)
- {
- var source:* = instance.game.cDropsUI.mcDraggable ? instance.game.cDropsUI.mcDraggable.menu : instance.game.cDropsUI;
- for (var i: int = 0; i < source.numChildren; i++)
- {
- var child:* = source.getChildAt(i);
- if (child.itemObj)
- {
- var count: int = child.txtDrop.text.split("x ")[1];
- drops.push({name: child.itemObj.sName, count: count});
- }
- }
- }
- else
- {
- for (var i:int = 0; i < children; i++)
- {
- var child:* = instance.game.ui.dropStack.getChildAt(i);
- var type:String = getQualifiedClassName(child);
- if (type.indexOf("DFrame2MC") > -1)
- {
- drops.push(parseDrop(child.cnt.strName.text));
- }
- }
- }
- return JSON.stringify(drops);
- }
-
- public static function injectScript(uri:String):void
- {
- var ploader:Loader = new Loader();
- ploader.contentLoaderInfo.addEventListener(Event.COMPLETE, onScriptLoaded);
- var context:LoaderContext = new LoaderContext();
- context.allowCodeImport = true;
- ploader.load(new URLRequest(uri), context);
- }
-
- private static function onScriptLoaded(event:Event):void
- {
- try
- {
- var obj:* = LoaderInfo(event.target).loader.content;
- obj.run(instance);
- }
- catch (ex:Error)
- {
- instance.external.debug("Error while running injection: " + ex);
- }
- }
-
- public static function getMonsterByID(id:int):*
- {
- for each (var monster:* in instance.game.world.monsters)
- {
- if (monster.dataLeaf.strFrame == instance.game.world.strFrame && monster.dataLeaf.MonMapID == id)
- {
- return monster;
- }
- }
- return null;
- }
-
- public static function sendClientPacket(packet:String, type:String):void
- {
- if (_handler == null)
- {
- var cls:Class = Class(instance.gameDomain.getDefinition("it.gotoandplay.smartfoxserver.handlers.ExtHandler"));
- _handler = new cls(instance.game.sfc);
- }
- if (type == "xml")
- {
- xmlReceived(packet);
- }
- else if (type == "json")
- {
- jsonReceived(packet);
- }
- else if (type == "str")
- {
- strReceived(packet);
- }
- else
- {
- instance.external.debug("Invalid packet type.");
- }
- }
-
- public static function xmlReceived(packet:String):void
- {
- _handler.handleMessage(new XML(packet), "xml");
- }
-
- public static function jsonReceived(packet:String):void
- {
- _handler.handleMessage(JSON.parse(packet)["b"], "json");
- }
-
- public static function strReceived(packet:String):void
- {
- var array:Array = packet.substr(1, packet.length - 2).split("%");
- _handler.handleMessage(array.splice(1, array.length - 1), "str");
- }
-
- public static function packetReceived(packet:*):void
- {
- if (packet.params.message.indexOf("%xt%zm%") > -1)
- {
- instance.external.call("packet", packet.params.message.split(":", 2)[1].trim());
- }
- }
-
- public static function test():String
- {
- return JSON.stringify(instance.game.world.monsters);
- }
- }
-}
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/UIModule.as b/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/UIModule.as
deleted file mode 100644
index a1895d8..0000000
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/module/UIModule.as
+++ /dev/null
@@ -1,62 +0,0 @@
-package xyz.rodit.rbot.module
-{
- import flash.display.MovieClip
- import xyz.rodit.rbot.Main;
- import xyz.rodit.rbot.ui.InventoryScroll;
- import xyz.rodit.rbot.ui.InventorySearch;
- import xyz.rodit.rbot.ui.UIExtension;
- public class UIModule extends Module
- {
- private var _extensions:* = new Object();
-
- public function UIModule()
- {
- super("UIModule");
- enabled = true;
-
- //addExtension("mcInventory", new InventorySearch());
- //addExtension("mcInventory", new InventoryScroll(["multiPanel", "splitPanel"], [4, 2]));
- //addExtension("mcShop", new InventoryScroll(["multiPanel", "splitPanel", "mergePanel"], [5, 2, 8]));
- }
-
- public function addExtension(uiName:String, ext:UIExtension):void
- {
- var arr:Array = _extensions[uiName];
- if (arr == null)
- {
- _extensions[uiName] = arr = [];
- }
- arr.push(ext);
- }
-
- override public function onFrame(game:*):void
- {
- for (var uiName:String in _extensions)
- {
- var parent:MovieClip = game.ui.mcPopup.getChildByName(uiName);
- if (parent)
- {
- for each(var ext:UIExtension in _extensions[uiName])
- {
- if (!parent.getChildByName(ext.name))
- {
- parent.addChild(ext);
- ext.onAdded(game);
- }
- }
- }
- else
- {
- for each(var ext:UIExtension in _extensions[uiName])
- {
- if (ext.parent)
- {
- ext.parent.removeChild(ext);
- ext.onRemoved(game);
- }
- }
- }
- }
- }
- }
-}
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/Arial.ttf b/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/Arial.ttf
deleted file mode 100644
index ab68fb1..0000000
Binary files a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/Arial.ttf and /dev/null differ
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/InventoryScroll.as b/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/InventoryScroll.as
deleted file mode 100644
index dde34c9..0000000
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/InventoryScroll.as
+++ /dev/null
@@ -1,40 +0,0 @@
-package xyz.rodit.rbot.ui
-{
- import flash.display.MovieClip;
- import flash.events.MouseEvent;
- public class InventoryScroll extends UIExtension
- {
- public var childNames:Array = [];
- public var indices:Array = [];
-
- public function InventoryScroll(_childNames:Array, _indices:Array)
- {
- name = "InventoryScroll";
- childNames = _childNames;
- indices = _indices;
- }
-
- override public function onAdded(game:*):void
- {
- var k:int = 0;
- for each (var name:String in childNames)
- {
- var child:MovieClip = parent[name];
- if (child && !child.hasEventListener(MouseEvent.MOUSE_WHEEL))
- {
- child.frames[indices[k++]].mc.addEventListener(MouseEvent.MOUSE_WHEEL, InventoryScroll.onWheel, false, 0, true);
- }
- }
- }
-
- public static function onWheel(e:MouseEvent):void
- {
- //TODO: Fix merge shop scroll.
- var btn:* = e.delta > 0 ? e.currentTarget.scr.a1 : e.currentTarget.scr.a2;
- for (var i:int = 0; i < Math.abs(e.delta); i += 2)
- {
- btn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
- }
- }
- }
-}
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/InventorySearch.as b/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/InventorySearch.as
deleted file mode 100644
index 704833b..0000000
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/InventorySearch.as
+++ /dev/null
@@ -1,67 +0,0 @@
-package xyz.rodit.rbot.ui
-{
- import fl.controls.TextInput;
- import flash.display.MovieClip;
- import flash.events.Event;
- import flash.text.TextField;
- import flash.text.TextFormat;
- import xyz.rodit.rbot.Main;
- public class InventorySearch extends UIExtension
- {
- private var txtInputSearch:TextInput
- private var txtSearch:TextField;
-
- public function InventorySearch()
- {
- name = "search";
- txtInputSearch = new TextInput();
- txtSearch = txtInputSearch.textField;
- txtSearch.embedFonts = true;
- txtSearch.defaultTextFormat = new TextFormat("Arial", 16, 0);
- txtSearch.width = 240;
- txtSearch.height = 24;
- txtSearch.textColor = 0x000000;
- txtSearch.background = true;
- txtSearch.backgroundColor = 0xFFFFFF;
- txtSearch.border = true;
- txtInputSearch.addEventListener(Event.CHANGE, textChanged);
- addChild(txtSearch);
- }
-
- override public function onAdded(game:*):void
- {
- txtSearch.text = "";
- var backdrop:* = MovieClip(parent).multiPanel;
- x = backdrop.x + 36;
- y = backdrop.y + 14;
- stage.focus = txtSearch;
- }
-
- public function filterFunc(item:*, index:int, arr:Array):Boolean
- {
- return item.sName.toLowerCase().indexOf(txtSearch.text.toLowerCase()) > -1;
- }
-
- public function textChanged(e:Event):void
- {
- var game:* = Main.instance.getGame();
- MovieClip(parent).fOpen(
- {
- fData:
- {
- itemsInv: txtSearch.text == "" ? game.world.myAvatar.items : game.world.myAvatar.items.filter(filterFunc),
- objData: game.world.myAvatar.objData
- },
- r:
- {
- x: 0,
- y: 0,
- w: stage.stageWidth,
- h: stage.stageHeight
- },
- sMode:"inventory"
- });
- parent.setChildIndex(this, parent.numChildren - 1);
- }
- }
-}
diff --git a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/UIExtension.as b/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/UIExtension.as
deleted file mode 100644
index 846850f..0000000
--- a/RBot/ActionScript/rbot/src/xyz/rodit/rbot/ui/UIExtension.as
+++ /dev/null
@@ -1,24 +0,0 @@
-package xyz.rodit.rbot.ui
-{
- import flash.display.MovieClip;
- public class UIExtension extends MovieClip
- {
- [Embed(source="Arial.ttf", fontName = "Arial", mimeType = "application/x-font", advancedAntiAliasing="true", embedAsCFF="false")]
- private var _font:Class;
-
- public function UIExtension()
- {
-
- }
-
- public function onAdded(game:*):void
- {
-
- }
-
- public function onRemoved(game:*):void
- {
-
- }
- }
-}
\ No newline at end of file
diff --git a/RBot/App.config b/RBot/App.config
index f5f7201..62ae62d 100644
--- a/RBot/App.config
+++ b/RBot/App.config
@@ -1,44 +1,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/RBot/AppRuntime.cs b/RBot/AppRuntime.cs
index ebff60a..c021487 100644
--- a/RBot/AppRuntime.cs
+++ b/RBot/AppRuntime.cs
@@ -1,39 +1,48 @@
using RBot.Options;
+using RBot.Repos;
using System.Collections.Generic;
using System.Windows.Forms;
-namespace RBot
+namespace RBot;
+
+public static class AppRuntime
{
- public static class AppRuntime
+ public static OptionContainer Options { get; set; } = new OptionContainer()
{
- public static OptionContainer Options { get; set; } = new OptionContainer()
- {
- OptionsFile = "rbot.cfg",
- };
+ OptionsFile = "rbot.cfg",
+ };
- public static void Init()
+ public static void Init()
+ {
+ Options.Options.AddRange(new List()
{
- Options.Options.AddRange(new List()
- {
- new Option("proxy.enabled", "Proxy Enabled", "Enables the proxy used to load and patch the game's SWF files. This can cause loading/login issues."),
- new Option("proxy.port", "Proxy Port", "The port that the patch proxy will bind to. Port 0 finds an available port."),
- new Option("proxy.cache.disable", "Disable Cache", "Disables caching of network responses when using the proxy.", true),
- new Option("updates.check", "Check for Updates", "When enabled, RBot will check for updates and notify you of new versions on launch.", true),
- new Option("updates.beta", "Check for Prereleases", "Update checks will also check for prerelease versions."),
+ new Option("proxy.enabled", "Proxy Enabled", "Enables the proxy used to load and patch the game's SWF files. This can cause loading/login issues."),
+ new Option("proxy.port", "Proxy Port", "The port that the patch proxy will bind to. Port 0 finds an available port."),
+ new Option("proxy.cache.disable", "Disable Cache", "Disables caching of network responses when using the proxy.", true),
+ new Option("updates.check", "Check for Updates", "When enabled, RBot will check for updates and notify you of new versions on launch.", true),
+ new Option("updates.beta", "Check for Prereleases", "Update checks will also check for prerelease versions."),
+ new Option("updates.scripts", "Check for Script updates", "When enabled, RBot will check for script updates and notify you of new changes on launch.", true),
+ new Option("updates.autodownloadscripts", "Download Scripts on launch", "When enabled, RBot will download new/updated scripts on launch.", true),
+ new Option("relogin.server", "Relogin Server", "The server which the bot will try to re-login to when needed.\r\nNote that this option has priority over any other setting for auto-relogin.", ""),
- new Option("binding.start", "", "", (int)Keys.F10),
- new Option("binding.stop", "", "", (int)Keys.F11),
- new Option("binding.toggle", "", "", (int)Keys.F12),
- new Option("binding.load", "", "", (int)Keys.F9),
+ new Option("binding.start", "", "", (int)Keys.F10),
+ new Option("binding.stop", "", "", (int)Keys.F11),
+ new Option("binding.toggle", "", "", (int)Keys.F12),
+ new Option("binding.load", "", "", (int)Keys.F9),
+ new Option("binding.bank", "", "", (int)Keys.F2),
+ new Option("binding.console", "", "", (int)Keys.F3),
+ new Option("binding.attack", "", "", (int)Keys.F5),
+ new Option("binding.hunt", "", "", (int)Keys.F6),
+ new Option("travel", "", "", ""),
- new Option("client.swf", "Client SWF", "The SWF file to be loaded as the game client.", "spider.swf"),
+ new Option("ignoregh", "Ignore GH Authentication", "Ignores the check for an GitHub account authentication. Not authenticating limits the Get Scripts function.", false),
+ new Option("ghtoken", "","",""),
- new Option("secret.zmana", "Zero Mana Skills", "Skills require zero mana to use.")
- });
+ new Option("client.swf", "Client SWF", "The SWF file to be loaded as the game client.", ""),
+ });
- Options.SetDefaults();
- Options.Load();
- Options.Save();
- }
+ Options.SetDefaults();
+ Options.Load();
+ Options.Save();
}
}
diff --git a/RBot/AxInterop.ShockwaveFlashObjects.dll b/RBot/Assemblies/AxInterop.ShockwaveFlashObjects.dll
similarity index 100%
rename from RBot/AxInterop.ShockwaveFlashObjects.dll
rename to RBot/Assemblies/AxInterop.ShockwaveFlashObjects.dll
diff --git a/RBot/Interop.ShockwaveFlashObjects.dll b/RBot/Assemblies/Interop.ShockwaveFlashObjects.dll
similarity index 100%
rename from RBot/Interop.ShockwaveFlashObjects.dll
rename to RBot/Assemblies/Interop.ShockwaveFlashObjects.dll
diff --git a/RBot/Assemblies/corehook32.dll b/RBot/Assemblies/corehook32.dll
new file mode 100644
index 0000000..a24337d
Binary files /dev/null and b/RBot/Assemblies/corehook32.dll differ
diff --git a/RBot/Assemblies/corehook64.dll b/RBot/Assemblies/corehook64.dll
new file mode 100644
index 0000000..9b21a40
Binary files /dev/null and b/RBot/Assemblies/corehook64.dll differ
diff --git a/RBot/Assemblies/coreload32.dll b/RBot/Assemblies/coreload32.dll
new file mode 100644
index 0000000..51f0062
Binary files /dev/null and b/RBot/Assemblies/coreload32.dll differ
diff --git a/RBot/Assemblies/coreload64.dll b/RBot/Assemblies/coreload64.dll
new file mode 100644
index 0000000..bb2a740
Binary files /dev/null and b/RBot/Assemblies/coreload64.dll differ
diff --git a/RBot/AutoReloginForm.resx b/RBot/AutoReloginForm.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/RBot/AutoReloginForm.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/RBot/BotBuilderForm.Designer.cs b/RBot/BotBuilderForm.Designer.cs
deleted file mode 100644
index cc0b331..0000000
--- a/RBot/BotBuilderForm.Designer.cs
+++ /dev/null
@@ -1,207 +0,0 @@
-namespace RBot
-{
- partial class BotBuilderForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.lbCommands = new System.Windows.Forms.ListBox();
- this.cbCommandTypes = new System.Windows.Forms.ComboBox();
- this.btnAddCommand = new System.Windows.Forms.Button();
- this.propCommand = new System.Windows.Forms.PropertyGrid();
- this.builderMenuStrip = new System.Windows.Forms.MenuStrip();
- this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.builderSplit = new System.Windows.Forms.SplitContainer();
- this.btnRemoveCommand = new System.Windows.Forms.Button();
- this.builderMenuStrip.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.builderSplit)).BeginInit();
- this.builderSplit.Panel1.SuspendLayout();
- this.builderSplit.Panel2.SuspendLayout();
- this.builderSplit.SuspendLayout();
- this.SuspendLayout();
- //
- // lbCommands
- //
- this.lbCommands.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.lbCommands.FormattingEnabled = true;
- this.lbCommands.Location = new System.Drawing.Point(3, 3);
- this.lbCommands.Name = "lbCommands";
- this.lbCommands.Size = new System.Drawing.Size(316, 290);
- this.lbCommands.TabIndex = 0;
- this.lbCommands.SelectedIndexChanged += new System.EventHandler(this.lbCommands_SelectedIndexChanged);
- //
- // cbCommandTypes
- //
- this.cbCommandTypes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.cbCommandTypes.DisplayMember = "Name";
- this.cbCommandTypes.FormattingEnabled = true;
- this.cbCommandTypes.Location = new System.Drawing.Point(3, 299);
- this.cbCommandTypes.Name = "cbCommandTypes";
- this.cbCommandTypes.Size = new System.Drawing.Size(316, 21);
- this.cbCommandTypes.TabIndex = 1;
- this.cbCommandTypes.ValueMember = "Name";
- //
- // btnAddCommand
- //
- this.btnAddCommand.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.btnAddCommand.Location = new System.Drawing.Point(3, 326);
- this.btnAddCommand.Name = "btnAddCommand";
- this.btnAddCommand.Size = new System.Drawing.Size(316, 23);
- this.btnAddCommand.TabIndex = 2;
- this.btnAddCommand.Text = "Add";
- this.btnAddCommand.UseVisualStyleBackColor = true;
- this.btnAddCommand.Click += new System.EventHandler(this.btnAddCommand_Click);
- //
- // propCommand
- //
- this.propCommand.Dock = System.Windows.Forms.DockStyle.Fill;
- this.propCommand.HelpVisible = false;
- this.propCommand.Location = new System.Drawing.Point(0, 0);
- this.propCommand.Name = "propCommand";
- this.propCommand.Size = new System.Drawing.Size(320, 381);
- this.propCommand.TabIndex = 3;
- this.propCommand.ToolbarVisible = false;
- //
- // builderMenuStrip
- //
- this.builderMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.fileToolStripMenuItem});
- this.builderMenuStrip.Location = new System.Drawing.Point(0, 0);
- this.builderMenuStrip.Name = "builderMenuStrip";
- this.builderMenuStrip.Size = new System.Drawing.Size(646, 24);
- this.builderMenuStrip.TabIndex = 4;
- //
- // fileToolStripMenuItem
- //
- this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.newToolStripMenuItem,
- this.openToolStripMenuItem,
- this.saveToolStripMenuItem,
- this.saveAsToolStripMenuItem});
- this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
- this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
- this.fileToolStripMenuItem.Text = "File";
- //
- // newToolStripMenuItem
- //
- this.newToolStripMenuItem.Name = "newToolStripMenuItem";
- this.newToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.newToolStripMenuItem.Text = "New";
- //
- // openToolStripMenuItem
- //
- this.openToolStripMenuItem.Name = "openToolStripMenuItem";
- this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.openToolStripMenuItem.Text = "Open";
- //
- // saveToolStripMenuItem
- //
- this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
- this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.saveToolStripMenuItem.Text = "Save";
- //
- // saveAsToolStripMenuItem
- //
- this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
- this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.saveAsToolStripMenuItem.Text = "Save As...";
- //
- // builderSplit
- //
- this.builderSplit.Dock = System.Windows.Forms.DockStyle.Fill;
- this.builderSplit.Location = new System.Drawing.Point(0, 24);
- this.builderSplit.Name = "builderSplit";
- //
- // builderSplit.Panel1
- //
- this.builderSplit.Panel1.Controls.Add(this.btnRemoveCommand);
- this.builderSplit.Panel1.Controls.Add(this.cbCommandTypes);
- this.builderSplit.Panel1.Controls.Add(this.btnAddCommand);
- this.builderSplit.Panel1.Controls.Add(this.lbCommands);
- //
- // builderSplit.Panel2
- //
- this.builderSplit.Panel2.Controls.Add(this.propCommand);
- this.builderSplit.Size = new System.Drawing.Size(646, 381);
- this.builderSplit.SplitterDistance = 322;
- this.builderSplit.TabIndex = 5;
- //
- // btnRemoveCommand
- //
- this.btnRemoveCommand.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.btnRemoveCommand.Location = new System.Drawing.Point(3, 355);
- this.btnRemoveCommand.Name = "btnRemoveCommand";
- this.btnRemoveCommand.Size = new System.Drawing.Size(316, 23);
- this.btnRemoveCommand.TabIndex = 3;
- this.btnRemoveCommand.Text = "Remove";
- this.btnRemoveCommand.UseVisualStyleBackColor = true;
- //
- // BotBuilderForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(646, 405);
- this.Controls.Add(this.builderSplit);
- this.Controls.Add(this.builderMenuStrip);
- this.MainMenuStrip = this.builderMenuStrip;
- this.Name = "BotBuilderForm";
- this.Text = "Bot Builder";
- this.builderMenuStrip.ResumeLayout(false);
- this.builderMenuStrip.PerformLayout();
- this.builderSplit.Panel1.ResumeLayout(false);
- this.builderSplit.Panel2.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.builderSplit)).EndInit();
- this.builderSplit.ResumeLayout(false);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.ListBox lbCommands;
- private System.Windows.Forms.ComboBox cbCommandTypes;
- private System.Windows.Forms.Button btnAddCommand;
- private System.Windows.Forms.PropertyGrid propCommand;
- private System.Windows.Forms.MenuStrip builderMenuStrip;
- private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
- private System.Windows.Forms.SplitContainer builderSplit;
- private System.Windows.Forms.Button btnRemoveCommand;
- }
-}
\ No newline at end of file
diff --git a/RBot/BotBuilderForm.cs b/RBot/BotBuilderForm.cs
deleted file mode 100644
index c31655b..0000000
--- a/RBot/BotBuilderForm.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-using RBot.CodeBuilder;
-using RBot.CodeBuilder.Commands;
-
-namespace RBot
-{
- public partial class BotBuilderForm : HideForm
- {
- public MultilineCodeBlock Root { get; set; } = new MultilineCodeBlock();
-
- public BotBuilderForm()
- {
- InitializeComponent();
-
- propCommand.PropertyValueChanged += PropCommand_PropertyValueChanged;
- cbCommandTypes.Items.AddRange(typeof(CodeCommand).Assembly.GetTypes().Where(t => t.IsPublic && t.Namespace == "RBot.CodeBuilder.Commands" && t != typeof(CodeCommand)).ToArray());
- }
-
- private void PropCommand_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
- {
- lbCommands.SelectedIndexChanged -= lbCommands_SelectedIndexChanged;
- int index = lbCommands.SelectedIndex;
- lbCommands.Items.RemoveAt(index);
- lbCommands.Items.Insert(index, propCommand.SelectedObject);
- lbCommands.SelectedIndex = index;
- lbCommands.SelectedIndexChanged += lbCommands_SelectedIndexChanged;
- }
-
- private void btnAddCommand_Click(object sender, EventArgs e)
- {
- Type t = cbCommandTypes.SelectedItem as Type;
- if (t != null)
- {
- CodeCommand cmd = (CodeCommand)Activator.CreateInstance(t);
- Root.Blocks.Add(cmd);
- lbCommands.Items.Add(cmd);
- }
- }
-
- private void lbCommands_SelectedIndexChanged(object sender, EventArgs e)
- {
- propCommand.SelectedObject = lbCommands.SelectedItem;
- }
- }
-}
diff --git a/RBot/BotBuilderForm.resx b/RBot/BotBuilderForm.resx
deleted file mode 100644
index 35414ef..0000000
--- a/RBot/BotBuilderForm.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
-
\ No newline at end of file
diff --git a/RBot/BotConverter.cs b/RBot/BotConverter.cs
deleted file mode 100644
index e5aea8b..0000000
--- a/RBot/BotConverter.cs
+++ /dev/null
@@ -1,377 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.IO;
-
-using Newtonsoft.Json;
-using System.CodeDom;
-using System.CodeDom.Compiler;
-
-namespace RBot
-{
- public static class BotConverter
- {
- private const string GrimoireKill = "Grimoire.Botting.Commands.Combat.CmdKill";
- private const string GrimoireKillFor = "Grimoire.Botting.Commands.Combat.CmdKillFor";
- private const string GrimoireRest = "Grimoire.Botting.Commands.Combat.CmdRest";
- private const string GrimoireBankSwap = "Grimoire.Botting.Commands.Item.CmdBankSwap";
- private const string GrimoireBankTransfer = "Grimoire.Botting.Commands.Item.CmdBankTransfer";
- private const string GrimoireBuy = "Grimoire.Botting.Commands.Item.CmdBuy";
- private const string GrimoireEquip = "Grimoire.Botting.Commands.Item.CmdEquip";
- private const string GrimoireGetDrop = "Grimoire.Botting.Commands.Item.CmdGetDrop";
- private const string GrimoireMapItem = "Grimoire.Botting.Commands.Item.CmdMapItem";
- private const string GrimoireSell = "Grimoire.Botting.Commands.Item.CmdSell";
- private const string GrimoireJoin = "Grimoire.Botting.Commands.Map.CmdJoin";
- private const string GrimoireTravel = "Grimoire.Botting.Commands.Map.CmdTravel";
- private const string GrimoireMoveToCell = "Grimoire.Botting.Commands.Map.CmdMoveToCell";
- private const string GrimoireWalk = "Grimoire.Botting.Commands.Map.CmdWalk";
- private const string GrimoireAcceptQuest = "Grimoire.Botting.Commands.Quest.CmdAcceptQuest";
- private const string GrimoireCompleteQuest = "Grimoire.Botting.Commands.Quest.CmdCompleteQuest";
- private const string GrimoireDelay = "Grimoire.Botting.Commands.Misc.CmdDelay";
- private const string GrimoireGotoLabel = "Grimoire.Botting.Commands.Misc.CmdGotoLabel";
- private const string GrimoireGotoPlayer = "Grimoire.Botting.Commands.Misc.CmdGotoPlayer";
- private const string GrimoireLabel = "Grimoire.Botting.Commands.Misc.CmdLabel";
- private const string GrimoireLogout = "Grimoire.Botting.Commands.Misc.CmdLogout";
- private const string GrimoirePacket = "Grimoire.Botting.Commands.Misc.CmdPacket";
- private const string GrimoireRestart = "Grimoire.Botting.Commands.Misc.CmdRestart";
- private const string GrimoireStop = "Grimoire.Botting.Commands.Misc.CmdStop";
- private const string GrimoireCellIs = "Grimoire.Botting.Commands.Misc.Statements.CmdCellIs";
- private const string GrimoireCellIsNot = "Grimoire.Botting.Commands.Misc.Statements.CmdCellIsNot";
- private const string GrimoireGoldGreaterThan = "Grimoire.Botting.Commands.Misc.Statements.CmdGoldGreaterThan";
- private const string GrimoireGoldLessThan = "Grimoire.Botting.Commands.Misc.Statements.CmdGoldLessThan";
- private const string GrimoireHealthGreaterThan = "Grimoire.Botting.Commands.Misc.Statements.CmdHealthGreaterThan";
- private const string GrimoireHealthLessThan = "Grimoire.Botting.Commands.Misc.Statements.CmdHealthLessThan";
- private const string GrimoireInBank = "Grimoire.Botting.Commands.Misc.Statements.CmdInBank";
- private const string GrimoireInCombat = "Grimoire.Botting.Commands.Misc.Statements.CmdInCombat";
- private const string GrimoireInInventory = "Grimoire.Botting.Commands.Misc.Statements.CmdInInventory";
- private const string GrimoireInTemp = "Grimoire.Botting.Commands.Misc.Statements.CmdInTemp";
- private const string GrimoireItemNotPickupable = "Grimoire.Botting.Commands.Misc.Statements.CmdItemNotPickupable";
- private const string GrimoireItemPickupable = "Grimoire.Botting.Commands.Misc.Statements.CmdItemPickupable";
- private const string GrimoireLevelGreaterThan = "Grimoire.Botting.Commands.Misc.Statements.CmdLevelGreaterThan";
- private const string GrimoireLevelIs = "Grimoire.Botting.Commands.Misc.Statements.CmdLevelIs";
- private const string GrimoireLevelLessThan = "Grimoire.Botting.Commands.Misc.Statements.CmdLevelLessThan";
- private const string GrimoireManaGreaterThan = "Grimoire.Botting.Commands.Misc.Statements.CmdManaGreaterThan";
- private const string GrimoireManaLessThan = "Grimoire.Botting.Commands.Misc.Statements.CmdManaLessThan";
- private const string GrimoireMapIs = "Grimoire.Botting.Commands.Misc.Statements.CmdMapIs";
- private const string GrimoireMapIsNot = "Grimoire.Botting.Commands.Misc.Statements.CmdMapIsNot";
- private const string GrimoireMonsterInRoom = "Grimoire.Botting.Commands.Misc.Statements.CmdMonsterInRoom";
- private const string GrimoireMonsterNotInRoom = "Grimoire.Botting.Commands.Misc.Statements.CmdMonsterNotInRoom";
- private const string GrimoireMonstersGreaterThan = "Grimoire.Botting.Commands.Misc.Statements.CmdMonstersGreaterThan";
- private const string GrimoireMonstersLessThan = "Grimoire.Botting.Commands.Misc.Statements.CmdMonstersLessThan";
- private const string GrimoireNotInBank = "Grimoire.Botting.Commands.Misc.Statements.CmdNotInBank";
- private const string GrimoireNotInCombat = "Grimoire.Botting.Commands.Misc.Statements.CmdNotInCombat";
- private const string GrimoireNotInInventory = "Grimoire.Botting.Commands.Misc.Statements.CmdNotInInventory";
- private const string GrimoireNotInTemp = "Grimoire.Botting.Commands.Misc.Statements.CmdNotInTemp";
- private const string GrimoirePlayerInRoom = "Grimoire.Botting.Commands.Misc.Statements.CmdPlayerInRoom";
- private const string GrimoirePlayerNotInRoom = "Grimoire.Botting.Commands.Misc.Statements.CmdPlayerNotInRoom";
- private const string GrimoirePlayersGreaterThan = "Grimoire.Botting.Commands.Misc.Statements.CmdPlayersGreaterThan";
- private const string GrimoirePlayersLessThan = "Grimoire.Botting.Commands.Misc.Statements.CmdPlayersLessThan";
- private const string GrimoireQuestCompleted = "Grimoire.Botting.Commands.Misc.Statements.CmdQuestCompleted";
- private const string GrimoireQuestNotCompleted = "Grimoire.Botting.Commands.Misc.Statements.CmdQuestNotCompleted";
-
- public static string GenCodeGrimoire(string file)
- {
- dynamic bot = JsonConvert.DeserializeObject(File.ReadAllText(file));
- string author = bot.Author;
-
- CodeStringBuilder sb = new CodeStringBuilder()
- .AppendLine("// Bot: " + Path.GetFileName(file))
- .AppendLine("// Author: " + author)
- .AppendLine("using System;")
- .AppendLine()
- .AppendLine("using RBot;")
- .AppendLine("using RBot.Servers;")
- .AppendLine()
- .AppendLine("public class Script")
- .AppendLine("{")
- .Indent()
- .AppendLine("public void ScriptMain(ScriptInterface bot)")
- .AppendLine("{")
- .Indent()
- .AppendLine("bot.Options.SafeTimings = true;")
- .AppendLine("bot.Options.RestPackets = true;")
- .AppendLine($"bot.Options.AutoRelogin = {ToBool(bot.AutoRelogin)};")
- .AppendLine($"bot.Options.ExitCombatBeforeQuest = {ToBool(bot.ExitCombatBeforeQuest)};")
- .AppendLine($"bot.Options.InfiniteRange = {ToBool(bot.InfiniteAttackRange)};")
- .AppendLine($"bot.Options.SkipCutscenes = {ToBool(bot.SkipCutscenes)};")
- .AppendLine($"bot.Options.WalkSpeed = {bot.WalkSpeed};")
- .If(bot.Server != null)
- .AppendLine($"bot.Options.LoginServer = ServerList.Servers.Find(x => x.Name == {ToLiteral(bot.Server.sName)});")
- .EndIf()
- .AppendLine()
- .AppendLine($"bot.Skills.SkillTimer = {bot.SkillDelay};");
-
- if (bot.Skills != null)
- {
- foreach (dynamic d in bot.Skills["$values"])
- sb.AppendLine($"bot.Skills.Add({d.Index}, 1f);");
- }
-
- if(bot.Drops != null)
- {
- foreach (dynamic d in bot.Drops["$values"])
- sb.AppendLine($"bot.Drops.Add({ToLiteral((string)d)});");
- sb.AppendLine("bot.Drops.Start();");
- }
-
- if(bot.Commands != null)
- {
- foreach (dynamic cmd in bot.Commands["$values"])
- {
- string name = cmd["$type"];
- name = name.Split(',')[0];
- if (name == GrimoireKill)
- sb.AppendLine($"bot.Player.Kill({ToLiteral(cmd.Monster)});");
- else if (name == GrimoireKillFor)
- sb.AppendLine($"bot.Player.KillForItem({ToLiteral(cmd.Monster)}, {ToLiteral(cmd.ItemName)}, {cmd.Quantity}{(cmd.ItemType == 1 ? ", true" : "")});");
- else if (name == GrimoireRest)
- sb.AppendLine($"bot.Player.Rest({((bool)cmd.Full).ToString().ToLower()});");
- else if (name == GrimoireBankSwap)
- sb.AppendLine($"bot.Bank.Swap({ToLiteral(cmd.InventoryItemName)}, {ToLiteral(cmd.BankItemName)});");
- else if (name == GrimoireBankTransfer)
- {
- if ((cmd.TransferFromBank as bool?).GetValueOrDefault())
- sb.AppendLine($"bot.Bank.ToInventory({ToLiteral(cmd.ItemName)});");
- else
- sb.AppendLine($"bot.Inventory.ToBank({ToLiteral(cmd.ItemName)});");
- }
- else if (name == GrimoireBuy)
- sb.AppendLine($"bot.Shops.BuyItem({cmd.ShopId}, {ToLiteral(cmd.ItemName)});");
- else if (name == GrimoireEquip)
- sb.AppendLine($"bot.Player.EquipItem({ToLiteral(cmd.ItemName)});");
- else if (name == GrimoireGetDrop)
- sb.AppendLine($"bot.Player.Pickup({ToLiteral(cmd.ItemName)});");
- else if (name == GrimoireMapItem)
- sb.AppendLine($"bot.Map.GetMapItem({cmd.ItemId});");
- else if (name == GrimoireSell)
- sb.AppendLine($"bot.Shops.SellItem({ToLiteral(cmd.ItemName)}");
- else if (name == GrimoireJoin || name == GrimoireTravel)
- sb.AppendLine($"bot.Player.Join({ToLiteral(cmd.Map)}, {ToLiteral(cmd.Cell)}, {ToLiteral(cmd.Pad)});");
- else if (name == GrimoireMoveToCell)
- sb.AppendLine($"bot.Player.Jump({ToLiteral(cmd.Cell)}, {ToLiteral(cmd.Pad)});");
- else if (name == GrimoireWalk)
- sb.AppendLine($"bot.Player.WalkTo({cmd.X}, {cmd.Y});");
- else if (name == GrimoireAcceptQuest)
- sb.AppendLine($"bot.Quests.EnsureAccept({cmd.Quest.QuestID});");
- else if (name == GrimoireCompleteQuest)
- {
- if (cmd.Quest.ItemId != null)
- sb.AppendLine($"bot.Quests.EnsureComplete({cmd.Quest.QuestID}, {cmd.Quest.ItemId});");
- else
- sb.AppendLine($"bot.Quests.EnsureComplete({cmd.Quest.QuestID});");
- }
- else if (name == GrimoireDelay)
- sb.AppendLine($"bot.Sleep({cmd.Delay});");
- else if (name == GrimoireGotoLabel)
- sb.AppendLine($"goto {((string)cmd.Label).SanitizeLabel()};");
- else if (name == GrimoireGotoPlayer)
- sb.AppendLine($"bot.Player.Goto({ToLiteral(cmd.PlayerName)});");
- else if (name == GrimoireLabel)
- sb.AppendLine($"{((string)cmd.Name).SanitizeLabel()}:");
- else if (name == GrimoireLogout)
- sb.AppendLine("bot.Player.Logout();");
- else if (name == GrimoirePacket)
- sb.AppendLine($"bot.SendPacket({ToLiteral(cmd.Packet)});");
- else if (name == GrimoireRestart)
- sb.AppendLine("ScriptManager.RestartScript();");
- else if (name == GrimoireStop)
- sb.AppendLine("ScriptManager.StopScript();");
- else if (name == GrimoireCellIs)
- sb.AppendIf($"bot.Player.Cell == {ToLiteral(cmd.Value1)}");
- else if (name == GrimoireCellIsNot)
- sb.AppendIf($"bot.Player.Cell != {ToLiteral(cmd.Value1)}");
- else if (name == GrimoireGoldGreaterThan)
- sb.AppendIf($"bot.Player.Gold >= {cmd.Value1}");
- else if (name == GrimoireGoldLessThan)
- sb.AppendIf($"bot.Player.Gold < {cmd.Value1}");
- else if (name == GrimoireHealthGreaterThan)
- sb.AppendIf($"bot.Player.Health >= {cmd.Value1}");
- else if (name == GrimoireHealthLessThan)
- sb.AppendIf($"bot.Player.Health < {cmd.Value1}");
- else if (name == GrimoireInBank)
- sb.AppendIf($"bot.Bank.Contains({ToLiteral(cmd.Value1)}, {((string)cmd.Value2).Replace("*", "1")})");
- else if (name == GrimoireNotInBank)
- sb.AppendIf($"!bot.Bank.Contains({ToLiteral(cmd.Value1)}, {((string)cmd.Value2).Replace("*", "1")})");
- else if (name == GrimoireInCombat)
- sb.AppendIf($"bot.Player.InCombat");
- else if (name == GrimoireNotInCombat)
- sb.AppendIf($"!bot.Player.InCombat");
- else if (name == GrimoireInInventory)
- sb.AppendIf($"bot.Inventory.Contains({ToLiteral(cmd.Value1)}, {((string)cmd.Value2).Replace("*", "1")})");
- else if (name == GrimoireNotInInventory)
- sb.AppendIf($"!bot.Inventory.Contains({ToLiteral(cmd.Value1)}, {((string)cmd.Value2).Replace("*", "1")})");
- else if (name == GrimoireInTemp)
- sb.AppendIf($"bot.Inventory.ContainsTempItem({ToLiteral(cmd.Value1)}, {((string)cmd.Value2).Replace("*", "1")})");
- else if (name == GrimoireNotInTemp)
- sb.AppendIf($"!bot.Inventory.ContainsTempItem({ToLiteral(cmd.Value1)}, {((string)cmd.Value2).Replace("*", "1")})");
- else if (name == GrimoireItemNotPickupable)
- sb.AppendIf($"!bot.Player.DropExists({ToLiteral(cmd.Value1)})");
- else if (name == GrimoireItemPickupable)
- sb.AppendIf($"bot.Player.DropExists({ToLiteral(cmd.Value1)})");
- else if (name == GrimoireLevelGreaterThan)
- sb.AppendIf($"bot.Player.Level >= {cmd.Value1}");
- else if (name == GrimoireLevelLessThan)
- sb.AppendIf($"bot.Player.Level < {cmd.Value1}");
- else if (name == GrimoireManaGreaterThan)
- sb.AppendIf($"bot.Player.Mana >= {cmd.Value1}");
- else if (name == GrimoireManaLessThan)
- sb.AppendIf($"bot.Player.Mana < {cmd.Value1}");
- else if (name == GrimoireMapIs)
- sb.AppendIf($"bot.Map.Name == {ToLiteral(cmd.Value1)}");
- else if (name == GrimoireMapIsNot)
- sb.AppendIf($"bot.Map.Name != {ToLiteral(cmd.Value1)}");
- else if (name == GrimoireMonsterInRoom)
- sb.AppendIf($"bot.Monsters.Exists({ToLiteral(cmd.Value1)})");
- else if (name == GrimoireMonsterNotInRoom)
- sb.AppendIf($"!bot.Monsters.Exists({ToLiteral(cmd.Value1)})");
- else if (name == GrimoireMonstersGreaterThan)
- sb.AppendIf($"bot.Monsters.CurrentMonsters.Count >= {cmd.Value1}");
- else if (name == GrimoireMonstersLessThan)
- sb.AppendIf($"bot.Monsters.CurrentMonsters.Count < {cmd.Value1}");
- else if (name == GrimoirePlayerInRoom)
- sb.AppendIf($"bot.Map.PlayerExists({ToLiteral(cmd.Value1)})");
- else if (name == GrimoirePlayerNotInRoom)
- sb.AppendIf($"!bot.Map.PlayerExists({ToLiteral(cmd.Value1)})");
- else if (name == GrimoirePlayersGreaterThan)
- sb.AppendIf($"bot.Map.CellPlayers.Count >= {cmd.Value1}");
- else if (name == GrimoirePlayersLessThan)
- sb.AppendIf($"bot.Map.CellPlayers.Count < {cmd.Value1}");
- else if (name == GrimoireQuestCompleted)
- sb.AppendIf($"bot.Quests.CanComplete({cmd.Value1})");
- else if (name == GrimoireQuestNotCompleted)
- sb.AppendIf($"!bot.Quests.CanComplete({cmd.Value1})");
- else
- sb.If(sb.InIf)
- .Append("; ")
- .EndIf()
- .AppendLine($"// Unsupported command {name}.");
- }
- }
-
- sb.UnIndent()
- .AppendLine("}")
- .UnIndent()
- .AppendLine("}");
-
- return sb.ToString();
- }
-
- public static string ToBool(dynamic d)
- {
- return ((bool)d).ToString().ToLower();
- }
-
- public static string ToLiteral(dynamic d)
- {
- return ((string)d).ToLiteral();
- }
-
- public static StringBuilder AppendTabs(this StringBuilder sb, int count, int size = 4)
- {
- return sb.Append(Enumerable.Range(0, count * size).Select(i => ' ').ToArray());
- }
-
- private static string ToLiteral(this string input)
- {
- /*
- using (var writer = new StringWriter())
- {
- using (var provider = CodeDomProvider.CreateProvider("CSharp"))
- {
- provider.GenerateCodeFromExpression(new CodePrimitiveExpression(input), writer, null);
- return writer.ToString();
- }
- }
- */
- return $"\"{input}\"";
- }
-
- public static string SanitizeLabel(this string label)
- {
- string s = new string(label.Replace(" ", "_").Where(IsAllowedInLabel).ToArray());
- if (char.IsDigit(s[0]))
- s = "_" + s;
- return s.ToLower();
- }
-
- public static bool IsAllowedInLabel(char c)
- {
- return char.IsLetterOrDigit(c) || c == '_';
- }
- }
-
- public class CodeStringBuilder
- {
- private StringBuilder _sb = new StringBuilder();
-
- public int IndentLevel = 0;
- public bool? NextCondition = null;
- public bool InIf = false;
-
- public CodeStringBuilder Indent()
- {
- IndentLevel++;
- return this;
- }
-
- public CodeStringBuilder UnIndent()
- {
- IndentLevel--;
- return this;
- }
-
- public CodeStringBuilder Append(string s)
- {
- _sb.Append(s);
- return this;
- }
-
- public CodeStringBuilder AppendLine(string line = "")
- {
- if (InIf)
- {
- _sb.AppendTabs(1);
- InIf = false;
- }
- if (NextCondition == null || NextCondition.Value)
- {
- _sb.AppendTabs(IndentLevel);
- _sb.AppendLine(line);
- }
- return this;
- }
-
- public CodeStringBuilder If(bool condition)
- {
- NextCondition = condition;
- return this;
- }
-
- public CodeStringBuilder EndIf()
- {
- NextCondition = null;
- return this;
- }
-
- public CodeStringBuilder AppendIf(string condition)
- {
- AppendLine($"if ({condition})");
- InIf = true;
- return this;
- }
-
- public CodeStringBuilder ForEach(IEnumerable enumerable, Func func)
- {
- foreach (T t in enumerable)
- AppendLine(func(t));
- return this;
- }
-
- public override string ToString()
- {
- return _sb.ToString();
- }
- }
-}
diff --git a/RBot/BotConverters/Extensions.cs b/RBot/BotConverters/Extensions.cs
deleted file mode 100644
index e53546e..0000000
--- a/RBot/BotConverters/Extensions.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace RBot.BotConverters
-{
- public static class Extensions
- {
- public static string ToLower(this bool b)
- {
- return b.ToString().ToLower();
- }
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/AcceptQuest.cs b/RBot/BotConverters/Grimoire/Commands/AcceptQuest.cs
deleted file mode 100644
index dd14650..0000000
--- a/RBot/BotConverters/Grimoire/Commands/AcceptQuest.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Quest.CmdAcceptQuest", "Grimoire.Botting.Commands.Quest.CmdAcceptQuest2")]
- public class AcceptQuest : ICodeGenerator
- {
- public QuestHolder Quest { get; set; }
- public string QuestID { get; set; }
-
- public string Id => Quest?.Id.ToString() ?? QuestID;
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Quests.EnsureAccept({Id.GetCode("int")});");
- }
-
- public class QuestHolder
- {
- public int Id { get; set; }
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/Attack.cs b/RBot/BotConverters/Grimoire/Commands/Attack.cs
deleted file mode 100644
index 822dc30..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Attack.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Combat.CmdAttack")]
- public class Attack : ICodeGenerator
- {
- public string Monster { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Player.Attack({Monster.GetCode()});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/BankSwap.cs b/RBot/BotConverters/Grimoire/Commands/BankSwap.cs
deleted file mode 100644
index 220ad99..0000000
--- a/RBot/BotConverters/Grimoire/Commands/BankSwap.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdBankSwap")]
- public class BankSwap : ICodeGenerator
- {
- public string BankItemName { get; set; }
- public string InventoryItemName { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Bank.Swap({InventoryItemName.GetCode()}, {BankItemName.GetCode()});");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/BankTransfer.cs b/RBot/BotConverters/Grimoire/Commands/BankTransfer.cs
deleted file mode 100644
index 56f5dc2..0000000
--- a/RBot/BotConverters/Grimoire/Commands/BankTransfer.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdBankTransfer")]
- public class BankTransfer : ICodeGenerator
- {
- public bool TransferFromBank { get; set; }
- public string ItemName { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine(TransferFromBank ? $"bot.Bank.ToInventory({ItemName.GetCode()});" : $"bot.Inventory.ToBank({ItemName.GetCode()});");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/Blank.cs b/RBot/BotConverters/Grimoire/Commands/Blank.cs
deleted file mode 100644
index d71a6ff..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Blank.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdBlank", "Grimoire.Botting.Commands.Misc.CmdBlank2", "Grimoire.Botting.Commands.Misc.CmdBlank3")]
- public class Blank : ICodeGenerator
- {
- public string Text { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine(string.IsNullOrWhiteSpace(Text) ? "// Blank" : $"// {Text}");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Buy.cs b/RBot/BotConverters/Grimoire/Commands/Buy.cs
deleted file mode 100644
index 974cfda..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Buy.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdBuy")]
- public class Buy : ICodeGenerator
- {
- public int ShopId { get; set; }
- public string ItemName { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Shops.BuyItem({ShopId}, {ItemName.GetCode()});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/BuyById.cs b/RBot/BotConverters/Grimoire/Commands/BuyById.cs
deleted file mode 100644
index 5af0fdb..0000000
--- a/RBot/BotConverters/Grimoire/Commands/BuyById.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdBuyById")]
- public class BuyById : ICodeGenerator
- {
- public string ItemID { get; set; }
- public string ShopID { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Shops.BuyItem({ShopID.GetCode("int")}, {ItemID.GetCode("int")});");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/BuyFast.cs b/RBot/BotConverters/Grimoire/Commands/BuyFast.cs
deleted file mode 100644
index 1745cf5..0000000
--- a/RBot/BotConverters/Grimoire/Commands/BuyFast.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdBuyFast")]
- public class BuyFast : ICodeGenerator
- {
- public string ItemName { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Shops.BuyItem({ItemName.GetCode()});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/BuyFastById.cs b/RBot/BotConverters/Grimoire/Commands/BuyFastById.cs
deleted file mode 100644
index ebfec3c..0000000
--- a/RBot/BotConverters/Grimoire/Commands/BuyFastById.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdBuyFastByID")]
- public class BuyFastById : ICodeGenerator
- {
- public string ItemID { get; set; }
- public string ShopID { get; set; }
-
- public string GenerateCode() => $"bot.Shops.BuyItem({ShopID}, {ItemID});";
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/CancelAutoAttack.cs b/RBot/BotConverters/Grimoire/Commands/CancelAutoAttack.cs
deleted file mode 100644
index da6f934..0000000
--- a/RBot/BotConverters/Grimoire/Commands/CancelAutoAttack.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Combat.CmdCancelAutoAttack")]
- public class CancelAutoAttack : ICodeGenerator
- {
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine("bot.Player.CancelAutoAttack();");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/CancelTarget.cs b/RBot/BotConverters/Grimoire/Commands/CancelTarget.cs
deleted file mode 100644
index b0edf29..0000000
--- a/RBot/BotConverters/Grimoire/Commands/CancelTarget.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Combat.CmdCancelTarget")]
- public class CancelTarget : ICodeGenerator
- {
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine("bot.Player.CancelTarget()");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/Change.cs b/RBot/BotConverters/Grimoire/Commands/Change.cs
deleted file mode 100644
index 797e554..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Change.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdChange")]
- public class Change : ICodeGenerator
- {
- public bool Guild { get; set; }
- public string Text { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Options.{(Guild ? "CustomGuild" : "CustomName")} = {Text.GetCode()};");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/ClearTemp.cs b/RBot/BotConverters/Grimoire/Commands/ClearTemp.cs
deleted file mode 100644
index a71bf80..0000000
--- a/RBot/BotConverters/Grimoire/Commands/ClearTemp.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.ClearTemp")]
- public class ClearTemp : ICodeGenerator
- {
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine("bot.Config.SetDefaults();");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/ClientMessage.cs b/RBot/BotConverters/Grimoire/Commands/ClientMessage.cs
deleted file mode 100644
index 0f0c4b2..0000000
--- a/RBot/BotConverters/Grimoire/Commands/ClientMessage.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdClientMessage")]
- public class ClientMessage : ICodeGenerator
- {
- public string Messages { get; set; }
- public bool IsWarning { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.SendClientPacket(\"%xt%{(IsWarning ? "warning" : "server")}%-1%{Messages}%\");");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/CompleteQuest.cs b/RBot/BotConverters/Grimoire/Commands/CompleteQuest.cs
deleted file mode 100644
index 3b7e814..0000000
--- a/RBot/BotConverters/Grimoire/Commands/CompleteQuest.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Quest.CmdCompleteQuest", "Grimoire.Botting.Commands.Quest.CmdCompleteQuest2")]
- public class CompleteQuest : ICodeGenerator
- {
- public QuestHolder Quest { get; set; }
- public string QuestID { get; set; }
- public string ItemID { get; set; }
-
- public string Id => Quest?.Id.ToString() ?? QuestID;
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Quests.EnsureComplete({Id.GetCode("int")}, {ItemID?.GetCode("int") ?? "-1"});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Delay.cs b/RBot/BotConverters/Grimoire/Commands/Delay.cs
deleted file mode 100644
index 1927586..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Delay.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using CodegenCS;
-using Newtonsoft.Json;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdDelay")]
- public class Delay : ICodeGenerator
- {
- [JsonProperty("Delay")]
- public int DelayLength { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Sleep({DelayLength});");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/Equip.cs b/RBot/BotConverters/Grimoire/Commands/Equip.cs
deleted file mode 100644
index 45ee115..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Equip.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdEquip")]
- public class Equip : ICodeGenerator
- {
- public string ItemName { get; set; }
- public bool Safe { get; set; }
-
- public void GenerateCode(CodegenTextWriter code)
- {
- if (Safe)
- {
- code.WriteLine("bot.Player.Jump(bot.Player.Cell, bot.Player.Pad);")
- .WriteLine("bot.Sleep(1000);");
- }
-
- code.WriteLine($"bot.Player.EquipItem({ItemName.GetCode()});");
- }
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/FieldExtensions.cs b/RBot/BotConverters/Grimoire/Commands/FieldExtensions.cs
deleted file mode 100644
index bb93a37..0000000
--- a/RBot/BotConverters/Grimoire/Commands/FieldExtensions.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- public static class FieldExtensions
- {
- private static readonly Dictionary _variables = new Dictionary();
-
- public static List Variables => _variables.Values.ToList();
-
- public static void Reset()
- {
- _variables.Clear();
- }
-
- public static string ToLabel(this string label)
- {
- return Regex.Replace(label.Replace(" ", "_"), "[^a-zA-Z0-9_]", "") + "_" + Math.Abs(label.GetHashCode());
- }
-
- public static bool IsVar(this string str)
- {
- return Regex.IsMatch(str, @"\[([^\)]*)\]");
- }
-
- public static string GetCode(this object field, string varType = "string", bool forceVar = false)
- {
- if (field is string str)
- {
- if (str.IsVar() || forceVar)
- {
- var varName = forceVar ? str : Regex.Replace(str, @"[\[\]']+", "");
- _variables[varName] = new GrimVariable { Name = varName, Type = varType };
- return $"bot.Config.Get<{varType}>(\"{varName.ToLower().Replace(" ", "_")}\")";
- }
-
- switch (varType)
- {
- case "string":
- return $"\"{field}\"";
- case "int" when str == "*":
- return "1";
- }
- }
-
- return field.ToString();
- }
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/GetDrop.cs b/RBot/BotConverters/Grimoire/Commands/GetDrop.cs
deleted file mode 100644
index a550c44..0000000
--- a/RBot/BotConverters/Grimoire/Commands/GetDrop.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdGetDrop")]
- public class GetDrop : ICodeGenerator
- {
- public string ItemName { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Player.Pickup({ItemName.GetCode()});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/GotoLabel.cs b/RBot/BotConverters/Grimoire/Commands/GotoLabel.cs
deleted file mode 100644
index 0a8fe46..0000000
--- a/RBot/BotConverters/Grimoire/Commands/GotoLabel.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdGotoLabel")]
- public class GotoLabel : ICodeGenerator
- {
- public string Label { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"goto {Label.ToLabel()};");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/GotoPlayer.cs b/RBot/BotConverters/Grimoire/Commands/GotoPlayer.cs
deleted file mode 100644
index 87bbdb7..0000000
--- a/RBot/BotConverters/Grimoire/Commands/GotoPlayer.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdGotoPlayer")]
- public class GotoPlayer : ICodeGenerator
- {
- public string PlayerName { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Player.Goto({PlayerName.GetCode()});");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/GrimVariable.cs b/RBot/BotConverters/Grimoire/Commands/GrimVariable.cs
deleted file mode 100644
index 97cd612..0000000
--- a/RBot/BotConverters/Grimoire/Commands/GrimVariable.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace RBot.BotConverters.Grimoire.Commands
-{
- public class GrimVariable
- {
- public string Name { get; set; }
- public string Type { get; set; }
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/IfStatements/IfStatement.cs b/RBot/BotConverters/Grimoire/Commands/IfStatements/IfStatement.cs
deleted file mode 100644
index df10a8e..0000000
--- a/RBot/BotConverters/Grimoire/Commands/IfStatements/IfStatement.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands.IfStatements
-{
- public abstract class IfStatement : ICodeGenerator
- {
- public string Tag { get; set; }
- public string Value1 { get; set; }
- public string Value2 { get; set; }
-
- public abstract string Statement { get; }
-
- public void GenerateCode(CodegenTextWriter code) => code.Write($"if ({Statement}) ");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/IfStatements/Statements.cs b/RBot/BotConverters/Grimoire/Commands/IfStatements/Statements.cs
deleted file mode 100644
index d7be614..0000000
--- a/RBot/BotConverters/Grimoire/Commands/IfStatements/Statements.cs
+++ /dev/null
@@ -1,268 +0,0 @@
-using Newtonsoft.Json;
-
-namespace RBot.BotConverters.Grimoire.Commands.IfStatements
-{
- public abstract class InvertStatement : IfStatement
- {
- [JsonProperty("$type")]
- public string Type { get; set; }
-
- public abstract string BaseStatement { get; }
- public virtual bool Invert => Type.Contains("Not");
- public override string Statement => (Invert ? "!" : "") + BaseStatement;
- }
-
- public abstract class EqualityStatement : InvertStatement
- {
- protected readonly string Op = "@<>@";
-
- public override bool Invert => Type.Contains("Not");
- public override string Statement => Invert ? BaseStatement.Replace(Op, "!=") : BaseStatement.Replace(Op, "==");
- }
-
- public abstract class InequalityStatement : InvertStatement
- {
- protected readonly string Op = "@<>@";
-
- public override bool Invert => Type.Contains("Greater");
- public override string Statement => Invert ? BaseStatement.Replace(Op, ">") : BaseStatement.Replace(Op, "<");
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdAvailableMonstersGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdAvailableMonstersLessThan")]
- public class AvailableMonstersGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"bot.Monsters.MapMonsters.Count {Op} {Value1.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdCellIs",
- "Grimoire.Botting.Commands.Misc.Statements.CmdCellIsNot")]
- public class CellIs : EqualityStatement
- {
- public override string BaseStatement => $"bot.Player.Cell {Op} {Value1.GetCode()}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdEquipped",
- "Grimoire.Botting.Commands.Misc.Statements.CmdNotEquipped")]
- public class Equipped : InvertStatement
- {
- public override string BaseStatement => $"bot.Inventory.IsEquipped({Value1.GetCode()})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdFactionRankGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdFactionRankLessThan")]
- public class FactionRankGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"bot.Player.GetFactionRank({Value1.GetCode()}) {Op} {Value2.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdGoldGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdGoldLessThan")]
- public class GoldGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"bot.Player.Gold {Op} {Value1.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdHealthGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdHealthLessThan")]
- public class HealthGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"bot.Player.Health {Op} {Value1.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdHealthPercentageGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdHealthPercentageLessThan")]
- public class HealthPercentageGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"(float)bot.Player.Health / bot.Player.MaxHealth {Op} {Value1.GetCode("float")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdInBank",
- "Grimoire.Botting.Commands.Misc.Statements.CmdNotInBank")]
- public class InBank : InvertStatement
- {
- public override string BaseStatement => $"bot.Bank.Contains({Value1.GetCode()}, {Value2.GetCode("int")})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdInCombat",
- "Grimoire.Botting.Commands.Misc.Statements.CmdNotInCombat")]
- public class InCombat : InvertStatement
- {
- public override string BaseStatement => "bot.Player.InCombat";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdInInventory",
- "Grimoire.Botting.Commands.Misc.Statements.CmdNotInInventory")]
- public class InInventory : InvertStatement
- {
- public override string BaseStatement => $"bot.Inventory.Contains({Value1.GetCode()}, {Value2.GetCode("int")})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdInTemp",
- "Grimoire.Botting.Commands.Misc.Statements.CmdNotInTemp")]
- public class InTemp : InvertStatement
- {
- public override string BaseStatement => $"bot.Inventory.ContainsTempItem({Value1.GetCode()}, {Value2.GetCode("int")})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdIntEqualInt",
- "Grimoire.Botting.Commands.Misc.Statements.CmdIntIs", "Grimoire.Botting.Commands.Misc.Statements.CmdIntIsNot", "Grimoire.Botting.Commands.Misc.Statements.CmdIntNotEqualInt")]
- public class IntEqualInt : EqualityStatement
- {
- public override string BaseStatement => $"{Value1.GetCode("int", true)} {Op} {Value2.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdIntGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdIntLessThan")]
- public class IntGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"{Value1.GetCode("int", true)} {Op} {Value2.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdIsMaxStack",
- "Grimoire.Botting.Commands.Misc.Statements.CmdIsNotMaxStack")]
- public class IsMaxStack : InvertStatement
- {
- public override string BaseStatement => $"bot.Inventory.IsMaxStack({Value1.GetCode()})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdIsMember",
- "Grimoire.Botting.Commands.Misc.Statements.CmdIsNotMember")]
- public class IsMember : InvertStatement
- {
- public override string BaseStatement => "bot.Player.IsMember";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdItemPickupable",
- "Grimoire.Botting.Commands.Misc.Statements.CmdItemNotPickupable")]
- public class ItemPickupable : InvertStatement
- {
- public override string BaseStatement => $"bot.Player.DropExists({Value1.GetCode()})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdLevelGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdLevelLessThan")]
- public class LevelGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"bot.Player.Level {Op} {Value1.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdLevelIs",
- "Grimoire.Botting.Commands.Misc.Statements.CmdLevelIsNot")]
- public class LevelIs : EqualityStatement
- {
- public override string BaseStatement => $"bot.Player.Level {Op} {Value1.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdManaGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdManaLessThan")]
- public class ManaGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"bot.Player.Mana {Op} {Value1.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdMapIs",
- "Grimoire.Botting.Commands.Misc.Statements.CmdMapIsNot")]
- public class MapIs : EqualityStatement
- {
- public override string BaseStatement => $"bot.Map.Name {Op} {Value1.GetCode()}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdMonsterHealthGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdMonsterHealthLessThan")]
- public class MonsterHealthGreaterThan : EqualityStatement
- {
- public override string BaseStatement => $"bot.Monsters.TryGetMonster({Value1.GetCode()}, out var __mon) && __mon.Health {Op} {Value2.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdMonsterInRoom",
- "Grimoire.Botting.Commands.Misc.Statements.CmdMonsterNotInRoom")]
- public class MonsterInRoom : InvertStatement
- {
- public override string BaseStatement => $"bot.Monsters.Exists({Value1.GetCode()})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdPlayerEquippedClass",
- "Grimoire.Botting.Commands.Misc.Statements.CmdPlayerNotEquippedClass")]
- public class PlayerEquippedClass : EqualityStatement
- {
- public override string BaseStatement => $"bot.Inventory.CurrentClass.Name {Op} {Value1.GetCode()}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdPlayerInRoom",
- "Grimoire.Botting.Commands.Misc.Statements.CmdPlayerNotInRoom")]
- public class PlayerInRoom : InvertStatement
- {
- public override string BaseStatement => $"bot.Map.PlayerExists({Value1.GetCode()})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdPlayerIsInCell",
- "Grimoire.Botting.Commands.Misc.Statements.CmdPlayerIsNotInCell")]
- public class PlayerInCell : EqualityStatement
- {
- public override string BaseStatement => $"bot.Map.TryGetPlayer({Value1.GetCode()}, out var __player) && __player.Cell {Op} {Value2.GetCode()}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdPlayerIsInMyCell",
- "Grimoire.Botting.Commands.Misc.Statements.CmdPlayerIsNotInMyCell")]
- public class PlayerInMyCell : EqualityStatement
- {
- public override string BaseStatement => $"bot.Map.TryGetPlayer({Value1.GetCode()}, out var __player) && __player.Cell {Op} bot.Player.Cell";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdPlayersGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdPlayersLessThan")]
- public class PlayersGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"bot.Map.PlayerCount {Op} {Value1.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdPlayersInCellGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdPlayersInCellLessThan")]
- public class PlayersInCellGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"bot.Map.Players.Where(p => p.Cell == {Value1.GetCode()}).Count() {Op} {Value2.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdPlayersInMyCellGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdPlayersInMyCellLessThan")]
- public class PlayersInMyCellGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"bot.Map.CellPlayers.Count {Op} {Value1.GetCode("int")}";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdQuestAvailable",
- "Grimoire.Botting.Commands.Misc.Statements.CmdQuestNotAvailable")]
- public class QuestAvailable : InvertStatement
- {
- public override string BaseStatement => $"bot.Quests.IsAvailable({Value1.GetCode("int")})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdQuestCompleted",
- "Grimoire.Botting.Commands.Misc.Statements.CmdQuestNotCompleted")]
- public class QuestCompleted : InvertStatement
- {
- public override string BaseStatement => $"bot.Quests.CanComplete({Value1.GetCode("int")})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdQuestInProgress",
- "Grimoire.Botting.Commands.Misc.Statements.CmdQuestNotInProgress")]
- public class QuestInProgress : InvertStatement
- {
- public override string BaseStatement => $"bot.Quests.IsInProgress({Value1.GetCode("int")})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdSkillIsAvailable",
- "Grimoire.Botting.Commands.Misc.Statements.CmdSkillIsNotAvailable")]
- public class SkillIsAvailable : InvertStatement
- {
- public override string BaseStatement => $"bot.Player.CanUseSkill({Value1.GetCode("int")})";
- }
-
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdVisibleMonstersGreaterThan",
- "Grimoire.Botting.Commands.Misc.Statements.CmdVisibleMonstersLessThan")]
- public class VisibleMonstersGreaterThan : InequalityStatement
- {
- public override string BaseStatement => $"bot.Monsters.CurrentMonsters.Count {Op} {Value1.GetCode("int")}";
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Index.cs b/RBot/BotConverters/Grimoire/Commands/Index.cs
deleted file mode 100644
index de370a3..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Index.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using CodegenCS;
-using Newtonsoft.Json;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdIndex")]
- public class Index : ICodeGenerator
- {
- public string Type { get; set; }
-
- [JsonProperty("AbsIndex")]
- public int Goto { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"goto idx_{Goto};");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Int.cs b/RBot/BotConverters/Grimoire/Commands/Int.cs
deleted file mode 100644
index 0b6f354..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Int.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using CodegenCS;
-using Newtonsoft.Json;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdInt")]
- public class Int : ICodeGenerator
- {
- public Types Type { get; set; }
-
- [JsonProperty("Int")]
- public string IntName { get; set; }
-
- public int Value { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine(Type switch
- {
- Types.Set => $"bot.Config.Set({IntName.GetCode()}, {Value});",
- Types.Lower => $"bot.Config.Set({IntName.GetCode()}, bot.Config.Get({IntName.GetCode()}) - 1);",
- Types.Upper => $"bot.Config.Set({IntName.GetCode()}, bot.Config.Get({IntName.GetCode()}) + 1);",
- _ => $"// Invalid int command {Type} for {IntName}."
- });
- }
-
- public enum Types
- {
- Set,
- Upper,
- Lower
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/ItemType.cs b/RBot/BotConverters/Grimoire/Commands/ItemType.cs
deleted file mode 100644
index 849de45..0000000
--- a/RBot/BotConverters/Grimoire/Commands/ItemType.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace RBot.BotConverters.Grimoire.Commands
-{
- public enum ItemType
- {
- Items,
- TempItems
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/Join.cs b/RBot/BotConverters/Grimoire/Commands/Join.cs
deleted file mode 100644
index 49b2d15..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Join.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Map.CmdJoin", "Grimoire.Botting.Commands.Map.CmdJoin2", "Grimoire.Botting.Commands.Map.CmdTravel")]
- public class Join : ICodeGenerator
- {
- public string Map { get; set; }
- public string Room { get; set; }
- public string Cell { get; set; }
- public string Pad { get; set; }
-
- public string MapName
- {
- get
- {
- if (Map.IsVar())
- {
- return Map;
- }
-
- var mapClean = Map.Replace("Packet", "").Replace("Glitch", "").Trim();
- var parts = mapClean.Split('-');
- return $"{parts[0]}-{(parts.Length == 2 ? parts[1] : Room ?? "1e9")}";
- }
- }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Player.Join({MapName.GetCode()}, {Cell.GetCode()}, {Pad.GetCode()});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Kill.cs b/RBot/BotConverters/Grimoire/Commands/Kill.cs
deleted file mode 100644
index 4874c49..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Kill.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Combat.CmdKill")]
- public class Kill : ICodeGenerator
- {
- public string Monster { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Player.Kill({Monster.GetCode()});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/KillFor.cs b/RBot/BotConverters/Grimoire/Commands/KillFor.cs
deleted file mode 100644
index 95de151..0000000
--- a/RBot/BotConverters/Grimoire/Commands/KillFor.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Combat.CmdKillFor")]
- public class KillFor : ICodeGenerator
- {
- public string Monster { get; set; }
- public string ItemName { get; set; }
- public ItemType ItemType { get; set; }
- public string Quantity { get; set; }
-
- public int QuantityInt => int.TryParse(Quantity, out var quant) ? quant : 1;
- public bool Temp => ItemType == ItemType.TempItems;
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Player.KillForItem({Monster.GetCode()}, {ItemName.GetCode()}, {QuantityInt}, {Temp.ToLower()});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Label.cs b/RBot/BotConverters/Grimoire/Commands/Label.cs
deleted file mode 100644
index 278da77..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Label.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdLabel")]
- public class Label : ICodeGenerator
- {
- public string Name { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"{Name.ToLabel()}:");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Load.cs b/RBot/BotConverters/Grimoire/Commands/Load.cs
deleted file mode 100644
index 9883498..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Load.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdLoad", "Grimoire.Botting.Commands.Item.CmdLoad2", "Grimoire.Botting.Commands.Item.CmdLoadTravel")]
- public class Load : ICodeGenerator
- {
- public string ShopId { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Shops.Load({ShopId.GetCode("int")});");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/LoadBot.cs b/RBot/BotConverters/Grimoire/Commands/LoadBot.cs
deleted file mode 100644
index 943548c..0000000
--- a/RBot/BotConverters/Grimoire/Commands/LoadBot.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdLoadBot")]
- public class LoadBot : ICodeGenerator
- {
- public string BotFilePath { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"ScriptManager.LoadedScript = {BotFilePath.GetCode()};")
- .WriteLine("ScriptManager.RestartScript();");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Log.cs b/RBot/BotConverters/Grimoire/Commands/Log.cs
deleted file mode 100644
index 746355b..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Log.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdLog")]
- public class Log : ICodeGenerator
- {
- public string Text { get; set; }
- public bool Debug { get; set; }
- private bool Clear { get; set; }
-
- public void GenerateCode(CodegenTextWriter code)
- {
- var text = Clear
- ? "[CLEAR]"
- : Text.Replace("{USERNAME}", "{bot.Player.Username}")
- .Replace("{MAP}", "{bot.Map.Name}")
- .Replace("{ROOM_ID}", "{bot.Map.RoomID}")
- .Replace("{ROOM_NUM}", "")
- .Replace("{GOLD}", "{bot.Player.Gold}")
- .Replace("{LEVEL}", "{bot.Player.Level}")
- .Replace("{CELL}", "{bot.Player.Cell}")
- .Replace("{PAD}", "{bot.Player.Pad}")
- .Replace("{HEALTH}", "{bot.Player.Health}")
- .Replace("{MANA}", "{bot.Player.Mana}")
- .Replace("{TIME}", "{DateTime.Now:HH:mm:ss}")
- .Replace("{TIME: 12}", "{DateTime.Now:hh:mm:ss tt}")
- .Replace("{TIME: 24}", "{DateTime.Now:HH:mm:ss}");
-
- code.WriteLine($"bot.Log($\"{text}\");");
- }
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/Logout.cs b/RBot/BotConverters/Grimoire/Commands/Logout.cs
deleted file mode 100644
index 797438d..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Logout.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdLogout")]
- public class Logout : ICodeGenerator
- {
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine("bot.Player.Logout();");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/MapItem.cs b/RBot/BotConverters/Grimoire/Commands/MapItem.cs
deleted file mode 100644
index c3e1e74..0000000
--- a/RBot/BotConverters/Grimoire/Commands/MapItem.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdMapItem", "Grimoire.Botting.Commands.Item.CmdMapItem2")]
- public class MapItem : ICodeGenerator
- {
- public string ItemId { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Map.GetMapItem({ItemId.GetCode("int")});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/MoveToCell.cs b/RBot/BotConverters/Grimoire/Commands/MoveToCell.cs
deleted file mode 100644
index 66e9282..0000000
--- a/RBot/BotConverters/Grimoire/Commands/MoveToCell.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Map.CmdMoveToCell")]
- public class MoveToCell : ICodeGenerator
- {
- public string Cell { get; set; }
- public string Pad { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Player.Jump({Cell.GetCode()}, {Pad.GetCode()});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Packet.cs b/RBot/BotConverters/Grimoire/Commands/Packet.cs
deleted file mode 100644
index 0e3884d..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Packet.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using CodegenCS;
-using Newtonsoft.Json;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdPacket")]
- public class Packet : ICodeGenerator
- {
- [JsonProperty("Packet")]
- public string Content { get; set; }
-
- public bool Client { get; set; }
-
- public void GenerateCode(CodegenTextWriter code)
- {
- var content = Content.Replace("{ROOM_ID}", "{bot.Map.RoomID}")
- .Replace("{ROOM_NUMBER}", "0")
- .Replace("PLAYERNAME", "{bot.Player.Username}")
- .Replace("{GETMAP}", "{bot.Map.Name}");
-
- code.WriteLine($"bot.{(Client ? "SendClientPacket" : "SendPacket")}($\"{content}\");");
- }
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Rest.cs b/RBot/BotConverters/Grimoire/Commands/Rest.cs
deleted file mode 100644
index 1e3628d..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Rest.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Combat.CmdRest")]
- public class Rest : ICodeGenerator
- {
- public bool Full { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Player.Rest({Full.ToLower()});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Restart.cs b/RBot/BotConverters/Grimoire/Commands/Restart.cs
deleted file mode 100644
index f19bc02..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Restart.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdRestart")]
- public class Restart : ICodeGenerator
- {
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine("ScriptManager.RestartScript();");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/Sell.cs b/RBot/BotConverters/Grimoire/Commands/Sell.cs
deleted file mode 100644
index 4116543..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Sell.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdSell")]
- public class Sell : ICodeGenerator
- {
- public string ItemName { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Shops.SellItem({ItemName.GetCode()});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/SetClientLevel.cs b/RBot/BotConverters/Grimoire/Commands/SetClientLevel.cs
deleted file mode 100644
index fe95019..0000000
--- a/RBot/BotConverters/Grimoire/Commands/SetClientLevel.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdSetClientLevel")]
- public class SetClientLevel : ICodeGenerator
- {
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine("bot.Player.Level = 100;");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/SetSpawnPoint.cs b/RBot/BotConverters/Grimoire/Commands/SetSpawnPoint.cs
deleted file mode 100644
index dca6908..0000000
--- a/RBot/BotConverters/Grimoire/Commands/SetSpawnPoint.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Map.CmdSetSpawn")]
- public class SetSpawnPoint : ICodeGenerator
- {
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine("bot.Player.SetSpawnPoint();");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/SetVar.cs b/RBot/BotConverters/Grimoire/Commands/SetVar.cs
deleted file mode 100644
index 978ebfb..0000000
--- a/RBot/BotConverters/Grimoire/Commands/SetVar.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.Statements.CmdSetVar", "Grimoire.Botting.Commands.Misc.Statements.CmdUpdateVar")]
- public class SetVar : ICodeGenerator
- {
- public string Value1 { get; set; }
- public string Value2 { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"bot.Config.Set(\"{Value1.ToLower().Replace(" ", "_")}\", \"{Value2}\");");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/Stop.cs b/RBot/BotConverters/Grimoire/Commands/Stop.cs
deleted file mode 100644
index b114926..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Stop.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdStop")]
- public class Stop : ICodeGenerator
- {
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine("ScriptManager.StopScript();");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/Commands/ToggleProvoke.cs b/RBot/BotConverters/Grimoire/Commands/ToggleProvoke.cs
deleted file mode 100644
index 590ad8c..0000000
--- a/RBot/BotConverters/Grimoire/Commands/ToggleProvoke.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using CodegenCS;
-using Newtonsoft.Json;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Misc.CmdToggleProvoke", "Grimoire.Botting.Commands.Misc.CmdToggleProvokeInMap")]
- public class ToggleProvoke : ICodeGenerator
- {
- [JsonProperty("$type")]
- private string CmdType { get; set; }
-
- public string OptionName => CmdType.Contains("InMap") ? "AggroAllMonsters" : "AggroMonsters";
- public int Type { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine(Type switch
- {
- 0 => $"bot.Options.{OptionName} = false;",
- 1 => $"bot.Options.{OptionName} = true;",
- 2 => $"bot.Options.{OptionName} = !bot.Options.{OptionName};",
- _ => $"// Unsupported ToggleProvoke type {Type}."
- });
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Unsupported.cs b/RBot/BotConverters/Grimoire/Commands/Unsupported.cs
deleted file mode 100644
index 2e6b20d..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Unsupported.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using CodegenCS;
-using Newtonsoft.Json;
-using System.Linq;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("*")]
- public class Unsupported : ICodeGenerator
- {
- [JsonProperty("$type")]
- public string Type { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine($"; // Unsupported command {Type.Replace(", Grimoire", "").Split('.').Last()}.");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/UseSkill.cs b/RBot/BotConverters/Grimoire/Commands/UseSkill.cs
deleted file mode 100644
index 93e0836..0000000
--- a/RBot/BotConverters/Grimoire/Commands/UseSkill.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Combat.CmdUseSkill")]
- public class UseSkill : ICodeGenerator
- {
- public string Index { get; set; }
- public int SafeHp { get; set; }
- public int SafeMp { get; set; }
- public bool Wait { get; set; }
-
- public void GenerateCode(CodegenTextWriter code)
- {
- if (Wait)
- {
- code.WriteLine($"bot.Wait.ForSkillCooldown({Index});");
- }
-
- code.WithCBlock($"if (({SafeHp} == 100 || 100 * bot.Player.Health / bot.Player.MaxHealth > {SafeHp}) && ({SafeMp} == 100 || 100 * bot.Player.Mana / bot.Player.MaxMana > {SafeMp}))", gen => gen
- .WriteLine($"bot.Player.UseSkill({Index});"));
- }
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/UseSkill2.cs b/RBot/BotConverters/Grimoire/Commands/UseSkill2.cs
deleted file mode 100644
index b5f047e..0000000
--- a/RBot/BotConverters/Grimoire/Commands/UseSkill2.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Combat.CmdUseSkill2")]
- public class UseSkill2 : ICodeGenerator
- {
- private const string SelfTargeted = "Self-targeted";
-
- public string Monster { get; set; }
- public string Index { get; set; }
- public int SafeHp { get; set; }
- public int SafeMp { get; set; }
- public bool Wait { get; set; }
-
- public void GenerateCode(CodegenTextWriter code)
- {
- if (Wait)
- {
- code.WriteLine($"bot.Wait.ForSkillCooldown({Index});");
- }
-
- code.WithCBlock($"if (100 * bot.Player.Health / bot.Player.MaxHealth > {SafeHp} && 100 * bot.Player.Mana / bot.Player.MaxMana > {SafeMp})", gen => gen
- .WriteLine(Monster == SelfTargeted ? "bot.Player.AttackPlayer(bot.Player.Username);" : $"bot.Player.Attack({Monster.GetCode()});")
- .WriteLine($"bot.Player.UseSkill({Index});"));
- }
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Walk.cs b/RBot/BotConverters/Grimoire/Commands/Walk.cs
deleted file mode 100644
index c03eb25..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Walk.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Map.CmdWalk")]
- public class Walk : ICodeGenerator
- {
- public int X { get; set; }
- public int Y { get; set; }
- public string Type { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine(Type == "Random"
- ? "bot.Player.WalkTo(bot.Runtime.Random.Next(150, 700), bot.Runtime.Random.Next(320, 450));"
- : $"bot.Player.WalkTo({X}, {Y});");
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Whitelist.cs b/RBot/BotConverters/Grimoire/Commands/Whitelist.cs
deleted file mode 100644
index 265fbf6..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Whitelist.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Item.CmdWhitelist")]
- public class Whitelist : ICodeGenerator
- {
- public string Item { get; set; }
-
- public WhitelistState State { get; set; }
-
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine(State switch
- {
- WhitelistState.On => "bot.Drops.Start();",
- WhitelistState.Off => "bot.Drops.Stop();",
- WhitelistState.Add => $"bot.Drops.Add({Item.GetCode()});",
- WhitelistState.Remove => $"bot.Drops.Remove({Item.GetCode()});",
- WhitelistState.Clear => "$bot.Drops.Clear();",
- _ => $"// Unsupported whitelist state {State} for item {Item}."
- });
- }
-
- public enum WhitelistState
- {
- On,
- Off,
- Clear,
- Add,
- Remove
- }
-}
diff --git a/RBot/BotConverters/Grimoire/Commands/Yulgar.cs b/RBot/BotConverters/Grimoire/Commands/Yulgar.cs
deleted file mode 100644
index 3e96515..0000000
--- a/RBot/BotConverters/Grimoire/Commands/Yulgar.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters.Grimoire.Commands
-{
- [Map("Grimoire.Botting.Commands.Map.Yulgar")]
- public class Yulgar : ICodeGenerator
- {
- public void GenerateCode(CodegenTextWriter code) => code.WriteLine("bot.Player.Jump(bot.Player.Cell, bot.Player.Pad);")
- .WriteLine("bot.Player.Join(\"yulgar\");")
- .WriteLine("bot.Player.WalkTo(bot.Runtime.Random.Next(150, 700), bot.Runtime.Random.Next(320, 450));")
- .WriteLine("ScriptManager.StopScript();");
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/Grimoire/GrimoireConverter.cs b/RBot/BotConverters/Grimoire/GrimoireConverter.cs
deleted file mode 100644
index f53c88a..0000000
--- a/RBot/BotConverters/Grimoire/GrimoireConverter.cs
+++ /dev/null
@@ -1,223 +0,0 @@
-using CodegenCS;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using RBot.BotConverters.Grimoire.Commands;
-using RBot.BotConverters.Grimoire.Commands.IfStatements;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Text.RegularExpressions;
-
-namespace RBot.BotConverters.Grimoire
-{
- public class GrimoireConverter : IBotConverter
- {
- private const string DefaultImports = @"using System;
-using System.Collections.Generic;
-using RBot;
-using RBot.Options;";
-
- private const string IndexType = "Grimoire.Botting.Commands.Misc.CmdIndex";
-
- private const string OptionsReplace = "$$$ OPTIONS $$$";
-
- private const string OptionDescription = "Grim variable.";
-
- private readonly Dictionary _generators = new Dictionary();
-
- public GrimoireConverter()
- {
- foreach (var type in typeof(GrimoireConverter).Assembly.GetTypes().Where(t => !t.IsInterface && t.GetInterface(nameof(ICodeGenerator)) != null))
- {
- AddGenerator(type);
- }
- }
-
- public void AddGenerator(Type type)
- {
- var attrib = type.GetCustomAttribute();
- if (attrib != null)
- {
- foreach (var cls in attrib.Types)
- {
- AddGenerator(cls, type);
- }
- }
- }
-
- public void AddGenerator(string commandClass, Type type)
- {
- _generators.Add(commandClass, type);
- }
-
- public string Convert(string path)
- {
- FieldExtensions.Variables.Clear();
-
- var bot = JObject.Parse(File.ReadAllText(path));
- var fileName = Path.GetFileNameWithoutExtension(path);
- var author = bot["Author"]?.ToObject() ?? "Unknown";
-
- var commands = (bot["Commands"]?["$values"] as JArray ?? new JArray()).OfType().ToList();
- var index = 0;
- var indexRefs = new List();
- foreach (var command in commands)
- {
- if (command.TryGetValue("$type", out var type) && type.ToString().StartsWith(IndexType)
- && command.TryGetValue("Index", out var indexToken))
- {
- var indexType = command["Type"]?.ToString() ?? "0";
- var idx = indexToken.ToObject();
-
- var refIndex = indexType switch
- {
- "0" => index - idx - 1,
- "1" => index + idx - 1,
- "2" => idx - 1,
- _ => -1
- };
- command["AbsIndex"] = JToken.Parse(refIndex.ToString());
- if (refIndex >= 0 && refIndex < commands.Count)
- {
- indexRefs.Add(refIndex);
- }
- }
-
- index++;
- }
-
- using var code = new CodegenTextWriter()
- .WriteLine($"// Converted from {fileName}")
- .WriteLine($"// Author: {author}")
- .WriteLine($"// Description: {bot["Description"] ?? "None"}")
- .WriteLine()
- .WriteLine(DefaultImports)
- .WithCBlock("public class Script", gen => gen
- .WriteLine($"public string OptionsStorage = \"{author}_{fileName}\";")
- .WriteLine("public bool DontPreconfigure = true;")
- .DecreaseIndent()
- .WriteLine(OptionsReplace)
- .IncreaseIndent()
- .WriteLine()
- .WithCBlock("public void ScriptMain(ScriptInterface bot)", main =>
- {
- main.WriteOption("SafeTimings", true)
- .WriteOption("RestPackets", true)
- .WriteOption("ExitCombatBeforeQuest", bot["ExitCombatBeforeQuest"])
- .WriteOption("InfiniteRange", bot["InfiniteAttackRange"])
- .WriteOption("SkipCutscenes", bot["SkipCutscenes"]);
-
- var serializer = new JsonSerializer { MetadataPropertyHandling = MetadataPropertyHandling.Ignore };
- var defaultGeneratorType = _generators["*"];
- var commandIndex = -1;
- var ifStack = 0;
- var postIfGenerators = new List();
- foreach (var command in commands)
- {
- var grimType = (command["$type"] ?? string.Empty).ToString().Split(',')[0];
- var generatorType = _generators.TryGetValue(grimType, out var type) ? type : defaultGeneratorType;
- var generator = (ICodeGenerator)command.ToObject(generatorType, serializer);
-
- if (indexRefs.Contains(commandIndex))
- {
- main.WriteLine($"idx_{commandIndex}:");
- }
-
- var ifStatement = generator is IfStatement;
- if (ifStatement)
- {
- ifStack++;
- generator.GenerateCode(main);
- main.WriteLine()
- .WriteLine("{")
- .IncreaseIndent();
- }
- else
- {
- if (ifStack > 0 && generator is Label)
- {
- postIfGenerators.Add(generator);
- }
- else
- {
- generator!.GenerateCode(main);
- if (ifStack > 0)
- {
- ifStack--;
- main.DecreaseIndent()
- .WriteLine("}");
-
- if (ifStack == 0)
- {
- postIfGenerators.ForEach(g => g.GenerateCode(main));
- postIfGenerators.Clear();
- }
- }
- }
- }
-
- commandIndex++;
- }
- }));
-
- using var options = new CodegenTextWriter();
- if (FieldExtensions.Variables.Count > 0)
- {
- options.IncreaseIndent()
- .WithCBlock("public List Options = new List()", block =>
- {
- var variables = FieldExtensions.Variables;
- for (var i = 0; i < variables.Count; i++)
- {
- var variable = variables[i];
- block.WriteLine($"new Option<{variable.Type}>(\"{variable.Name.ToLower().Replace(" ", "_")}\", \"{variable.Name}\", \"{OptionDescription}\")"
- + (i == variables.Count - 1 ? string.Empty : ","));
- }
- }).Write(";");
- }
-
- return code.GetContents().Replace(OptionsReplace, options.GetContents()).FixIndices();
- }
- }
-
- public static class CodeExtensions
- {
- public static string FixIndices(this string contents)
- {
- return Regex.Replace(contents, @"( *)(if \(.*\))\s+{\s+(idx_.*:)", m =>
- {
- var space = m.Groups[1].Value;
- var ifStatement = m.Groups[2].Value;
- var label = m.Groups[3].Value;
- return $"{space}{label}\n{space}{ifStatement}\n{space}{{";
- });
- }
-
- public static CodegenTextWriter WriteOption(this CodegenTextWriter code, string optionName, JToken value)
- {
- if (value != null)
- {
- try
- {
- var val = value.ToObject();
- if (val is string)
- {
- code.WriteLine($"bot.Options.{optionName} = \"{value}\";");
- }
- else
- {
- code.WriteLine($"bot.Options.{optionName} = {value.ToString().ToLower()};");
- }
- }
- catch
- {
- // ignored
- }
- }
-
- return code;
- }
- }
-}
diff --git a/RBot/BotConverters/IBotConverter.cs b/RBot/BotConverters/IBotConverter.cs
deleted file mode 100644
index ab03261..0000000
--- a/RBot/BotConverters/IBotConverter.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace RBot.BotConverters
-{
- public interface IBotConverter
- {
- string Convert(string path);
- }
-}
\ No newline at end of file
diff --git a/RBot/BotConverters/ICodeGenerator.cs b/RBot/BotConverters/ICodeGenerator.cs
deleted file mode 100644
index fed0ed9..0000000
--- a/RBot/BotConverters/ICodeGenerator.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using CodegenCS;
-
-namespace RBot.BotConverters
-{
- public interface ICodeGenerator
- {
- void GenerateCode(CodegenTextWriter code);
- }
-}
diff --git a/RBot/BotConverters/MapAttribute.cs b/RBot/BotConverters/MapAttribute.cs
deleted file mode 100644
index ac8d233..0000000
--- a/RBot/BotConverters/MapAttribute.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-
-namespace RBot.BotConverters
-{
- [AttributeUsage(AttributeTargets.Class)]
- public class MapAttribute : Attribute
- {
- public string[] Types { get; set; }
-
- public MapAttribute(params string[] types)
- {
- Types = types;
- }
- }
-}
diff --git a/RBot/CodeBuilder/Commands/CodeCommand.cs b/RBot/CodeBuilder/Commands/CodeCommand.cs
deleted file mode 100644
index 2fdc305..0000000
--- a/RBot/CodeBuilder/Commands/CodeCommand.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RBot.CodeBuilder.Commands
-{
- public abstract class CodeCommand : ICodeBlock
- {
- [Browsable(false)]
- public string Name => GetType().Name.Split(new string[] { "Command" }, StringSplitOptions.RemoveEmptyEntries)[0];
- [Browsable(false)]
- public abstract string Code { get; }
-
- public override string ToString()
- {
- return $"{Name}[{string.Join(", ", GetType().GetProperties().Where(p => p.Name != "Code" && p.Name != "Name").Select(p => p.GetValue(this)))}]";
- }
- }
-}
diff --git a/RBot/CodeBuilder/Commands/CustomCodeCommand.cs b/RBot/CodeBuilder/Commands/CustomCodeCommand.cs
deleted file mode 100644
index af4fac3..0000000
--- a/RBot/CodeBuilder/Commands/CustomCodeCommand.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RBot.CodeBuilder.Commands
-{
- public class CustomCodeCommand : CodeCommand
- {
- public string CustomCode { get; set; }
- public override string Code => CustomCode;
- }
-}
diff --git a/RBot/CodeBuilder/Commands/JoinCommand.cs b/RBot/CodeBuilder/Commands/JoinCommand.cs
deleted file mode 100644
index 33712b5..0000000
--- a/RBot/CodeBuilder/Commands/JoinCommand.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RBot.CodeBuilder.Commands
-{
- public class JoinCommand : CodeCommand
- {
- public string Map { get; set; }
- public string Cell { get; set; }
- public string Pad { get; set; }
- public override string Code => $"bot.Player.Join(\"{Map}\", \"{Cell}\", \"{Pad}\");";
- }
-}
diff --git a/RBot/CodeBuilder/Commands/JumpCommand.cs b/RBot/CodeBuilder/Commands/JumpCommand.cs
deleted file mode 100644
index 7dab8c4..0000000
--- a/RBot/CodeBuilder/Commands/JumpCommand.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RBot.CodeBuilder.Commands
-{
- public class JumpCommand : CodeCommand
- {
- public string Cell { get; set; }
- public string Pad { get; set; }
- public override string Code => $"bot.Player.Jump(\"{Cell}\", \"{Pad}\");";
- }
-}
diff --git a/RBot/CodeBuilder/Commands/SendClientPacketCommand.cs b/RBot/CodeBuilder/Commands/SendClientPacketCommand.cs
deleted file mode 100644
index 220aff7..0000000
--- a/RBot/CodeBuilder/Commands/SendClientPacketCommand.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RBot.CodeBuilder.Commands
-{
- public class SendClientPacketCommand : CodeCommand
- {
- public string Packet { get; set; }
- public override string Code => $"bot.SendClientPacket(\"{Packet}\");";
- }
-}
diff --git a/RBot/CodeBuilder/Commands/SendPacketCommand.cs b/RBot/CodeBuilder/Commands/SendPacketCommand.cs
deleted file mode 100644
index 9271830..0000000
--- a/RBot/CodeBuilder/Commands/SendPacketCommand.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RBot.CodeBuilder.Commands
-{
- public class SendPacketCommand : CodeCommand
- {
- public string Packet { get; set; }
- public override string Code => $"bot.SendPacket(\"{Packet}\");";
- }
-}
diff --git a/RBot/CodeBuilder/Condition.cs b/RBot/CodeBuilder/Condition.cs
deleted file mode 100644
index 5a9d592..0000000
--- a/RBot/CodeBuilder/Condition.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RBot.CodeBuilder
-{
- public class Condition : ICodeBlock
- {
- public static List CompareOperators = new List()
- {
- "==",
- "!=",
- ">",
- "<",
- ">=",
- "<="
- };
-
- public string Name => "Condition";
-
- public ICodeBlock Left { get; set; }
- public ICodeBlock Right { get; set; }
- public string Compare { get; set; }
-
- public string Code => $"{Left.Code} {Compare} {Right.Code}";
- }
-}
diff --git a/RBot/CodeBuilder/ICodeBlock.cs b/RBot/CodeBuilder/ICodeBlock.cs
deleted file mode 100644
index 0a285df..0000000
--- a/RBot/CodeBuilder/ICodeBlock.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RBot.CodeBuilder
-{
- public interface ICodeBlock
- {
- string Name { get; }
- string Code { get; }
- }
-}
diff --git a/RBot/CodeBuilder/IfBlock.cs b/RBot/CodeBuilder/IfBlock.cs
deleted file mode 100644
index d7984d5..0000000
--- a/RBot/CodeBuilder/IfBlock.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RBot.CodeBuilder
-{
- public class IfBlock : MultilineCodeBlock
- {
- public string Name => "If Block";
-
- public Condition Condition { get; set; } = new Condition();
- public new string Code => $"if({Condition.Code})\n{{\n {base.Code}\n}}";
- }
-}
diff --git a/RBot/CodeBuilder/MultilineCodeBlock.cs b/RBot/CodeBuilder/MultilineCodeBlock.cs
deleted file mode 100644
index 0ac8275..0000000
--- a/RBot/CodeBuilder/MultilineCodeBlock.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace RBot.CodeBuilder
-{
- public class MultilineCodeBlock : ICodeBlock
- {
- public string Name => "Multiline Block";
-
- public List Blocks { get; } = new List();
-
- public string Code => string.Join("\n", Blocks.Select(b => b.Code));
- }
-}
diff --git a/RBot/ConsoleForm.Designer.cs b/RBot/ConsoleForm.Designer.cs
deleted file mode 100644
index 817560a..0000000
--- a/RBot/ConsoleForm.Designer.cs
+++ /dev/null
@@ -1,126 +0,0 @@
-namespace RBot
-{
- partial class ConsoleForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConsoleForm));
- this.btnRun = new System.Windows.Forms.Button();
- this.chkAsync = new System.Windows.Forms.CheckBox();
- this.txtCode = new FastColoredTextBoxNS.FastColoredTextBox();
- ((System.ComponentModel.ISupportInitialize)(this.txtCode)).BeginInit();
- this.SuspendLayout();
- //
- // btnRun
- //
- this.btnRun.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.btnRun.Location = new System.Drawing.Point(73, 187);
- this.btnRun.Name = "btnRun";
- this.btnRun.Size = new System.Drawing.Size(304, 23);
- this.btnRun.TabIndex = 1;
- this.btnRun.Text = "Run (Ctrl+Enter)";
- this.btnRun.UseVisualStyleBackColor = true;
- this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
- //
- // chkAsync
- //
- this.chkAsync.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.chkAsync.AutoSize = true;
- this.chkAsync.Location = new System.Drawing.Point(12, 191);
- this.chkAsync.Name = "chkAsync";
- this.chkAsync.Size = new System.Drawing.Size(55, 17);
- this.chkAsync.TabIndex = 2;
- this.chkAsync.Text = "Async";
- this.chkAsync.UseVisualStyleBackColor = true;
- //
- // txtCode
- //
- this.txtCode.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.txtCode.AutoCompleteBracketsList = new char[] {
- '(',
- ')',
- '{',
- '}',
- '[',
- ']',
- '\"',
- '\"',
- '\'',
- '\''};
- this.txtCode.AutoIndentCharsPatterns = "\r\n^\\s*[\\w\\.]+(\\s\\w+)?\\s*(?=)\\s*(?[^;]+);\r\n^\\s*(case|default)\\s*[^:]" +
- "*(?:)\\s*(?[^;]+);\r\n";
- this.txtCode.AutoScrollMinSize = new System.Drawing.Size(155, 14);
- this.txtCode.BackBrush = null;
- this.txtCode.BracketsHighlightStrategy = FastColoredTextBoxNS.BracketsHighlightStrategy.Strategy2;
- this.txtCode.CharHeight = 14;
- this.txtCode.CharWidth = 8;
- this.txtCode.Cursor = System.Windows.Forms.Cursors.IBeam;
- this.txtCode.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
- this.txtCode.IsReplaceMode = false;
- this.txtCode.Language = FastColoredTextBoxNS.Language.CSharp;
- this.txtCode.LeftBracket = '(';
- this.txtCode.LeftBracket2 = '{';
- this.txtCode.Location = new System.Drawing.Point(12, 12);
- this.txtCode.Name = "txtCode";
- this.txtCode.Paddings = new System.Windows.Forms.Padding(0);
- this.txtCode.RightBracket = ')';
- this.txtCode.RightBracket2 = '}';
- this.txtCode.SelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))));
- this.txtCode.ServiceColors = ((FastColoredTextBoxNS.ServiceColors)(resources.GetObject("txtCode.ServiceColors")));
- this.txtCode.Size = new System.Drawing.Size(365, 169);
- this.txtCode.TabIndex = 3;
- this.txtCode.Text = "bot.Log(\"Test\");";
- this.txtCode.Zoom = 100;
- //
- // ConsoleForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(389, 218);
- this.Controls.Add(this.txtCode);
- this.Controls.Add(this.chkAsync);
- this.Controls.Add(this.btnRun);
- this.Name = "ConsoleForm";
- this.ShowIcon = false;
- this.Text = "Run";
- this.Load += new System.EventHandler(this.ConsoleForm_Load);
- ((System.ComponentModel.ISupportInitialize)(this.txtCode)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
- private System.Windows.Forms.Button btnRun;
- private System.Windows.Forms.CheckBox chkAsync;
- private FastColoredTextBoxNS.FastColoredTextBox txtCode;
- }
-}
\ No newline at end of file
diff --git a/RBot/ConsoleForm.cs b/RBot/ConsoleForm.cs
deleted file mode 100644
index 8065b58..0000000
--- a/RBot/ConsoleForm.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace RBot
-{
- public partial class ConsoleForm : HideForm
- {
- private volatile bool _ignoreKey = false;
-
- public ConsoleForm()
- {
- InitializeComponent();
-
- txtCode.KeyDown += TxtCode_KeyDown;
- txtCode.KeyPress += TxtCode_KeyPress;
- }
-
- protected override void OnGotFocus(EventArgs e)
- {
- base.OnGotFocus(e);
- ActiveControl = txtCode;
- }
-
- private void TxtCode_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter && e.Modifiers.HasFlag(Keys.Control))
- {
- e.Handled = true;
- _ignoreKey = true;
- btnRun.PerformClick();
- }
- }
-
- private void TxtCode_KeyPress(object sender, KeyPressEventArgs e)
- {
- e.Handled = _ignoreKey;
- _ignoreKey = false;
- }
-
- private void btnRun_Click(object sender, EventArgs e)
- {
- if (chkAsync.Checked)
- Task.Run(_RunCode);
- else
- _RunCode();
- }
-
- private void _RunCode()
- {
- try
- {
- string source = "using RBot;using RBot.Factions;using RBot.Flash;using RBot.Items;using RBot.Monsters;using RBot.Options;using RBot.PatchProxy;using RBot.Players;using RBot.Plugins;using RBot.Quests;using RBot.Servers;using RBot.Skills;using RBot.Utils;using System;using System.Collections.Generic;using System.Threading;using System.Linq;using Newtonsoft.Json;public class Script{public void ScriptMain(ScriptInterface bot){" + txtCode.Text + "}}";
- object o = ScriptManager.Compile(source);
- o.GetType().GetMethod("ScriptMain").Invoke(o, new object[] { Bot });
- }
- catch (Exception ex)
- {
- MessageBox.Show("Error running snippet:\r\n" + ex);
- }
- }
-
- private void ConsoleForm_Load(object sender, EventArgs e)
- {
-
- }
- }
-}
diff --git a/RBot/ConsoleForm.resx b/RBot/ConsoleForm.resx
deleted file mode 100644
index 64deb2e..0000000
--- a/RBot/ConsoleForm.resx
+++ /dev/null
@@ -1,138 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- AAEAAAD/////AQAAAAAAAAAMAgAAAFdGYXN0Q29sb3JlZFRleHRCb3gsIFZlcnNpb249Mi4xNi4yNC4w
- LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWZiOGFhMTJiOTk0ZWY2MWIMAwAAAFFTeXN0
- ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2Vu
- PWIwM2Y1ZjdmMTFkNTBhM2EFAQAAACJGYXN0Q29sb3JlZFRleHRCb3hOUy5TZXJ2aWNlQ29sb3JzBgAA
- ACg8Q29sbGFwc2VNYXJrZXJGb3JlQ29sb3I+a19fQmFja2luZ0ZpZWxkKDxDb2xsYXBzZU1hcmtlckJh
- Y2tDb2xvcj5rX19CYWNraW5nRmllbGQqPENvbGxhcHNlTWFya2VyQm9yZGVyQ29sb3I+a19fQmFja2lu
- Z0ZpZWxkJjxFeHBhbmRNYXJrZXJGb3JlQ29sb3I+a19fQmFja2luZ0ZpZWxkJjxFeHBhbmRNYXJrZXJC
- YWNrQ29sb3I+a19fQmFja2luZ0ZpZWxkKDxFeHBhbmRNYXJrZXJCb3JkZXJDb2xvcj5rX19CYWNraW5n
- RmllbGQEBAQEBAQUU3lzdGVtLkRyYXdpbmcuQ29sb3IDAAAAFFN5c3RlbS5EcmF3aW5nLkNvbG9yAwAA
- ABRTeXN0ZW0uRHJhd2luZy5Db2xvcgMAAAAUU3lzdGVtLkRyYXdpbmcuQ29sb3IDAAAAFFN5c3RlbS5E
- cmF3aW5nLkNvbG9yAwAAABRTeXN0ZW0uRHJhd2luZy5Db2xvcgMAAAACAAAABfz///8UU3lzdGVtLkRy
- YXdpbmcuQ29sb3IEAAAABG5hbWUFdmFsdWUKa25vd25Db2xvcgVzdGF0ZQEAAAAJBwcDAAAACgAAAAAA
- AAAAlgABAAH7/////P///woAAAAAAAAAAKQAAQAB+v////z///8KAAAAAAAAAACWAAEAAfn////8////
- CgAAAAAAAAAAjQABAAH4/////P///woAAAAAAAAAAKQAAQAB9/////z///8KAAAAAAAAAACWAAEACw==
-
-
-
\ No newline at end of file
diff --git a/RBot/Converters/DictionaryListConverter.cs b/RBot/Converters/DictionaryListConverter.cs
index f0799f3..6e4bfc6 100644
--- a/RBot/Converters/DictionaryListConverter.cs
+++ b/RBot/Converters/DictionaryListConverter.cs
@@ -1,28 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
using Newtonsoft.Json;
-namespace RBot.Converters
+namespace RBot.Converters;
+
+public class DictionaryListConverter : JsonConverter
{
- public class DictionaryListConverter : JsonConverter
+ public override bool CanConvert(Type objectType)
{
- public override bool CanConvert(Type objectType)
- {
- return objectType == typeof(List);
- }
+ return objectType == typeof(List);
+ }
- public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
- {
- return serializer.Deserialize>(reader).Values.ToList();
- }
+ public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+ {
+ return serializer.Deserialize>(reader).Values.ToList();
+ }
- public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
- {
- throw new NotImplementedException();
- }
+ public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+ {
+ throw new NotImplementedException();
}
}
diff --git a/RBot/Converters/StringBoolConverter.cs b/RBot/Converters/StringBoolConverter.cs
index 1df2884..bc9752a 100644
--- a/RBot/Converters/StringBoolConverter.cs
+++ b/RBot/Converters/StringBoolConverter.cs
@@ -1,28 +1,22 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
using Newtonsoft.Json;
-namespace RBot.Converters
+namespace RBot.Converters;
+
+public class StringBoolConverter : JsonConverter
{
- public class StringBoolConverter : JsonConverter
+ public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
- public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
- {
- writer.WriteValue(((bool)value) ? "1" : "0");
- }
+ writer.WriteValue(((bool)value) ? "1" : "0");
+ }
- public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
- {
- return reader.Value.ToString() == "1" || reader.Value.ToString() == "true";
- }
+ public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+ {
+ return reader.Value.ToString() == "1" || reader.Value.ToString() == "true";
+ }
- public override bool CanConvert(Type objectType)
- {
- return objectType == typeof(bool);
- }
+ public override bool CanConvert(Type objectType)
+ {
+ return objectType == typeof(bool);
}
}
diff --git a/RBot/Converters/TrimConverter.cs b/RBot/Converters/TrimConverter.cs
index 7e1a227..778554f 100644
--- a/RBot/Converters/TrimConverter.cs
+++ b/RBot/Converters/TrimConverter.cs
@@ -1,28 +1,22 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
using Newtonsoft.Json;
-namespace RBot.Converters
+namespace RBot.Converters;
+
+public class TrimConverter : JsonConverter
{
- public class TrimConverter : JsonConverter
+ public override bool CanConvert(Type objectType)
{
- public override bool CanConvert(Type objectType)
- {
- return objectType == typeof(string);
- }
+ return objectType == typeof(string);
+ }
- public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
- {
- return ((string)reader.Value)?.Trim();
- }
+ public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+ {
+ return ((string)reader.Value)?.Trim();
+ }
- public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
- {
- throw new NotImplementedException();
- }
+ public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+ {
+ throw new NotImplementedException();
}
}
diff --git a/RBot/CosmeticForm.Designer.cs b/RBot/CosmeticForm.Designer.cs
deleted file mode 100644
index d973c82..0000000
--- a/RBot/CosmeticForm.Designer.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-namespace RBot
-{
- partial class CosmeticForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.cbPlayer = new System.Windows.Forms.ComboBox();
- this.btnGrabCosm = new System.Windows.Forms.Button();
- this.lbItems = new System.Windows.Forms.ListBox();
- this.lnkRefresh = new System.Windows.Forms.LinkLabel();
- this.btnCopyAll = new System.Windows.Forms.Button();
- this.btnEquipSelected = new System.Windows.Forms.Button();
- this.lnkGrabTarget = new System.Windows.Forms.LinkLabel();
- this.SuspendLayout();
- //
- // cbPlayer
- //
- this.cbPlayer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.cbPlayer.FormattingEnabled = true;
- this.cbPlayer.Location = new System.Drawing.Point(12, 14);
- this.cbPlayer.Name = "cbPlayer";
- this.cbPlayer.Size = new System.Drawing.Size(294, 21);
- this.cbPlayer.TabIndex = 0;
- //
- // btnGrabCosm
- //
- this.btnGrabCosm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnGrabCosm.Location = new System.Drawing.Point(312, 12);
- this.btnGrabCosm.Name = "btnGrabCosm";
- this.btnGrabCosm.Size = new System.Drawing.Size(94, 23);
- this.btnGrabCosm.TabIndex = 1;
- this.btnGrabCosm.Text = "Grab";
- this.btnGrabCosm.UseVisualStyleBackColor = true;
- this.btnGrabCosm.Click += new System.EventHandler(this.btnGrabCosm_Click);
- //
- // lbItems
- //
- this.lbItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.lbItems.FormattingEnabled = true;
- this.lbItems.Location = new System.Drawing.Point(12, 54);
- this.lbItems.Name = "lbItems";
- this.lbItems.Size = new System.Drawing.Size(394, 173);
- this.lbItems.TabIndex = 2;
- //
- // lnkRefresh
- //
- this.lnkRefresh.AutoSize = true;
- this.lnkRefresh.Location = new System.Drawing.Point(9, 38);
- this.lnkRefresh.Name = "lnkRefresh";
- this.lnkRefresh.Size = new System.Drawing.Size(81, 13);
- this.lnkRefresh.TabIndex = 3;
- this.lnkRefresh.TabStop = true;
- this.lnkRefresh.Text = "Refresh Players";
- this.lnkRefresh.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkRefresh_LinkClicked);
- //
- // btnCopyAll
- //
- this.btnCopyAll.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.btnCopyAll.Location = new System.Drawing.Point(12, 234);
- this.btnCopyAll.Name = "btnCopyAll";
- this.btnCopyAll.Size = new System.Drawing.Size(208, 23);
- this.btnCopyAll.TabIndex = 4;
- this.btnCopyAll.Text = "Equip All";
- this.btnCopyAll.UseVisualStyleBackColor = true;
- this.btnCopyAll.Click += new System.EventHandler(this.btnCopyAll_Click);
- //
- // btnEquipSelected
- //
- this.btnEquipSelected.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnEquipSelected.Location = new System.Drawing.Point(226, 234);
- this.btnEquipSelected.Name = "btnEquipSelected";
- this.btnEquipSelected.Size = new System.Drawing.Size(180, 23);
- this.btnEquipSelected.TabIndex = 5;
- this.btnEquipSelected.Text = "Equip Selected";
- this.btnEquipSelected.UseVisualStyleBackColor = true;
- this.btnEquipSelected.Click += new System.EventHandler(this.btnEquipSelected_Click);
- //
- // lnkGrabTarget
- //
- this.lnkGrabTarget.AutoSize = true;
- this.lnkGrabTarget.Location = new System.Drawing.Point(342, 38);
- this.lnkGrabTarget.Name = "lnkGrabTarget";
- this.lnkGrabTarget.Size = new System.Drawing.Size(64, 13);
- this.lnkGrabTarget.TabIndex = 6;
- this.lnkGrabTarget.TabStop = true;
- this.lnkGrabTarget.Text = "Grab Target";
- this.lnkGrabTarget.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkGrabTarget_LinkClicked);
- //
- // CosmeticForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(418, 269);
- this.Controls.Add(this.lnkGrabTarget);
- this.Controls.Add(this.btnEquipSelected);
- this.Controls.Add(this.btnCopyAll);
- this.Controls.Add(this.lnkRefresh);
- this.Controls.Add(this.lbItems);
- this.Controls.Add(this.btnGrabCosm);
- this.Controls.Add(this.cbPlayer);
- this.Name = "CosmeticForm";
- this.Text = "SWF Cosmetics";
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.ComboBox cbPlayer;
- private System.Windows.Forms.Button btnGrabCosm;
- private System.Windows.Forms.ListBox lbItems;
- private System.Windows.Forms.LinkLabel lnkRefresh;
- private System.Windows.Forms.Button btnCopyAll;
- private System.Windows.Forms.Button btnEquipSelected;
- private System.Windows.Forms.LinkLabel lnkGrabTarget;
- }
-}
\ No newline at end of file
diff --git a/RBot/CosmeticForm.resx b/RBot/CosmeticForm.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/RBot/CosmeticForm.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/RBot/Cosmetics/CosmeticEquipment.cs b/RBot/Cosmetics/CosmeticEquipment.cs
index 29a2126..13c7373 100644
--- a/RBot/Cosmetics/CosmeticEquipment.cs
+++ b/RBot/Cosmetics/CosmeticEquipment.cs
@@ -1,66 +1,58 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
+using System.Collections.Generic;
using System.Dynamic;
-using System.IO;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
using Newtonsoft.Json;
-using RBot.Flash;
-namespace RBot.Cosmetics
+namespace RBot.Cosmetics;
+
+public class CosmeticEquipment : ScriptableObject
{
- public class CosmeticEquipment : ScriptableObject
+ private static Dictionary _cosMap = new()
{
- private static Dictionary _cosMap = new Dictionary()
- {
- { EquipType.Helm, "he" },
- { EquipType.Cape, "ba" },
- { EquipType.Armor, "co" },
- { EquipType.Class, "ar" },
- { EquipType.Pet, "pe" },
- { EquipType.Weapon, "Weapon" }
- };
+ { EquipType.Helm, "he" },
+ { EquipType.Cape, "ba" },
+ { EquipType.Armor, "co" },
+ { EquipType.Class, "ar" },
+ { EquipType.Pet, "pe" },
+ { EquipType.Weapon, "Weapon" }
+ };
- private static Dictionary _backMap = _cosMap.ToDictionary(kvp => kvp.Value, kvp => kvp.Key);
+ private static Dictionary _backMap = _cosMap.ToDictionary(kvp => kvp.Value, kvp => kvp.Key);
- public EquipType Slot { get; set; }
- [JsonProperty("ItemID")]
- public int ID { get; set; }
- [JsonProperty("sLink")]
- public string Link { get; set; }
- [JsonProperty("sMeta")]
- public string Meta { get; set; }
- [JsonProperty("sFile")]
- public string SWFFile { get; set; }
- [JsonProperty("sType")]
- public string Type { get; set; }
+ public EquipType Slot { get; set; }
+ [JsonProperty("ItemID")]
+ public int ID { get; set; }
+ [JsonProperty("sLink")]
+ public string Link { get; set; }
+ [JsonProperty("sMeta")]
+ public string Meta { get; set; }
+ [JsonProperty("sFile")]
+ public string SWFFile { get; set; }
+ [JsonProperty("sType")]
+ public string Type { get; set; }
- public void Equip()
- {
- string slot = _cosMap[Slot];
- dynamic equip = new ExpandoObject();
- equip.sFile = SWFFile;
- equip.sLink = Link;
- equip.sType = Type;
- equip.sMeta = Meta;
- if (ID != 0)
- equip.ItemID = ID;
- Bot.SetGameObject($"world.myAvatar.objData.eqp.{slot}", equip);
- Bot.CallGameFunction("world.myAvatar.loadMovieAtES", slot, SWFFile, Link);
- }
+ public void Equip()
+ {
+ string slot = _cosMap[Slot];
+ dynamic equip = new ExpandoObject();
+ equip.sFile = SWFFile;
+ equip.sLink = Link;
+ equip.sType = Type;
+ equip.sMeta = Meta;
+ if (ID != 0)
+ equip.ItemID = ID;
+ Bot.SetGameObject($"world.myAvatar.objData.eqp.{slot}", equip);
+ Bot.CallGameFunction("world.myAvatar.loadMovieAtES", slot, SWFFile, Link);
+ }
- public override string ToString()
- {
- return $"{Slot}: {SWFFile}";
- }
+ public override string ToString()
+ {
+ return $"{Slot}: {SWFFile}";
+ }
- public static List Get(int id)
- {
- Dictionary items = ScriptInterface.Instance.GetGameObject>($"world.avatars.{id}.objData.eqp") ?? new Dictionary();
- return items.Select(kvp => (kvp.Value.Slot = _backMap.TryGetValue(kvp.Key, out EquipType slot) ? slot : EquipType.None) != EquipType.None ? kvp.Value : null).Where(x => x != null).ToList();
- }
+ public static List Get(int id)
+ {
+ Dictionary items = ScriptInterface.Instance.GetGameObject>($"world.avatars.{id}.objData.eqp") ?? new Dictionary();
+ return items.Select(kvp => (kvp.Value.Slot = _backMap.TryGetValue(kvp.Key, out EquipType slot) ? slot : EquipType.None) != EquipType.None ? kvp.Value : null).Where(x => x != null).ToList();
}
}
diff --git a/RBot/Cosmetics/EquipType.cs b/RBot/Cosmetics/EquipType.cs
index e227c14..b0ccb0b 100644
--- a/RBot/Cosmetics/EquipType.cs
+++ b/RBot/Cosmetics/EquipType.cs
@@ -1,20 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+namespace RBot.Cosmetics;
-namespace RBot.Cosmetics
+public enum EquipType
{
- public enum EquipType
- {
- None,
- Helm,
- Cape,
- Armor,
- Class,
- Pet,
- Weapon,
- Offhand
- }
+ None,
+ Helm,
+ Cape,
+ Armor,
+ Class,
+ Pet,
+ Weapon,
+ Offhand
}
diff --git a/RBot/EasyHook32.dll b/RBot/EasyHook32.dll
deleted file mode 100644
index f34df0e..0000000
Binary files a/RBot/EasyHook32.dll and /dev/null differ
diff --git a/RBot/EasyHook32Svc.exe b/RBot/EasyHook32Svc.exe
deleted file mode 100644
index d033d68..0000000
Binary files a/RBot/EasyHook32Svc.exe and /dev/null differ
diff --git a/RBot/EasyHook64.dll b/RBot/EasyHook64.dll
deleted file mode 100644
index 086495b..0000000
Binary files a/RBot/EasyHook64.dll and /dev/null differ
diff --git a/RBot/EasyHook64Svc.exe b/RBot/EasyHook64Svc.exe
deleted file mode 100644
index a0a84bd..0000000
Binary files a/RBot/EasyHook64Svc.exe and /dev/null differ
diff --git a/RBot/EasyLoad32.dll b/RBot/EasyLoad32.dll
deleted file mode 100644
index 6954595..0000000
Binary files a/RBot/EasyLoad32.dll and /dev/null differ
diff --git a/RBot/EasyLoad64.dll b/RBot/EasyLoad64.dll
deleted file mode 100644
index af3b0c3..0000000
Binary files a/RBot/EasyLoad64.dll and /dev/null differ
diff --git a/RBot/Factions/Faction.cs b/RBot/Factions/Faction.cs
index 9aa2c94..dae0910 100644
--- a/RBot/Factions/Faction.cs
+++ b/RBot/Factions/Faction.cs
@@ -1,48 +1,41 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Newtonsoft.Json;
-using Newtonsoft.Json;
+namespace RBot.Factions;
-namespace RBot.Factions
+public class Faction
{
- public class Faction
- {
- ///
- /// The ID of the faction.
- ///
- [JsonProperty("FactionID")]
- public int ID { get; set; }
- ///
- /// The in-game name of the faction.
- ///
- [JsonProperty("sName")]
- public string Name { get; set; }
- ///
- /// The rank that the player has achieved in this faction.
- ///
- [JsonProperty("iRank")]
- public int Rank { get; set; }
- ///
- /// The total amount of rep the player has for this faction.
- ///
- [JsonProperty("iRep")]
- public int TotalRep { get; set; }
- ///
- /// The amount of rep the player has for their current rank.
- ///
- [JsonProperty("iSpillRep")]
- public int Rep { get; set; }
- ///
- /// The total required rep for the player to rank up.
- ///
- [JsonProperty("iRepToRank")]
- public int RequiredRep { get; set; }
- ///
- /// The remaining amount of rep required for the player to rank up.
- ///
- public int RemainingRep => RequiredRep - Rep;
- }
+ ///
+ /// The ID of the faction.
+ ///
+ [JsonProperty("FactionID")]
+ public int ID { get; set; }
+ ///
+ /// The in-game name of the faction.
+ ///
+ [JsonProperty("sName")]
+ public string Name { get; set; }
+ ///
+ /// The rank that the player has achieved in this faction.
+ ///
+ [JsonProperty("iRank")]
+ public int Rank { get; set; }
+ ///
+ /// The total amount of rep the player has for this faction.
+ ///
+ [JsonProperty("iRep")]
+ public int TotalRep { get; set; }
+ ///
+ /// The amount of rep the player has for their current rank.
+ ///
+ [JsonProperty("iSpillRep")]
+ public int Rep { get; set; }
+ ///
+ /// The total required rep for the player to rank up.
+ ///
+ [JsonProperty("iRepToRank")]
+ public int RequiredRep { get; set; }
+ ///
+ /// The remaining amount of rep required for the player to rank up.
+ ///
+ public int RemainingRep => RequiredRep - Rep;
}
diff --git a/RBot/Flash/CallBinding.cs b/RBot/Flash/CallBinding.cs
index da6c75b..47ed588 100644
--- a/RBot/Flash/CallBinding.cs
+++ b/RBot/Flash/CallBinding.cs
@@ -1,76 +1,68 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
using Newtonsoft.Json;
-
using PostSharp.Aspects;
-
using RBot.Utils;
-namespace RBot.Flash
+namespace RBot.Flash;
+
+[Serializable]
+public class CallBindingAttribute : LocationInterceptionAspect
{
- [Serializable]
- public class CallBindingAttribute : LocationInterceptionAspect
+ public string Name { get; set; }
+ public bool UseValue { get; set; } = true;
+ public bool Get { get; set; } = true;
+ public bool Set { get; set; } = true;
+ public bool Json { get; set; } = false;
+ public Type ConvertType { get; set; } = null;
+ public Type DefaultProvider { get; set; } = null;
+
+ private ITypedValueProvider _defaultProvider = new DefaultTypedValueProvider();
+ private bool _defaultProviderSet;
+
+ public CallBindingAttribute(string name)
{
- public string Name { get; set; }
- public bool UseValue { get; set; } = true;
- public bool Get { get; set; } = true;
- public bool Set { get; set; } = true;
- public bool Json { get; set; } = false;
- public Type ConvertType { get; set; } = null;
- public Type DefaultProvider { get; set; } = null;
+ Name = name;
+ }
- private TypedValueProvider _defaultProvider = new DefaultTypedValueProvider();
- private bool _defaultProviderSet;
+ public override void OnGetValue(LocationInterceptionArgs args)
+ {
+ base.OnGetValue(args);
- public CallBindingAttribute(string name)
+ if (DefaultProvider != null && !_defaultProviderSet)
{
- Name = name;
+ _defaultProvider = (ITypedValueProvider)Activator.CreateInstance(DefaultProvider);
+ _defaultProviderSet = true;
}
-
- public override void OnGetValue(LocationInterceptionArgs args)
+ if (Get)
{
- base.OnGetValue(args);
-
- if (DefaultProvider != null && !_defaultProviderSet)
+ if (ConvertType == null)
+ ConvertType = args.Location.LocationType;
+ try
{
- _defaultProvider = (TypedValueProvider)Activator.CreateInstance(DefaultProvider);
- _defaultProviderSet = true;
+ args.Value = Json ? JsonConvert.DeserializeObject(FlashUtil.Call(Name), ConvertType) : FlashUtil.Call(Name, ConvertType);
}
- if (Get)
+ catch
{
- if (ConvertType == null)
- ConvertType = args.Location.LocationType;
- try
- {
- args.Value = Json ? JsonConvert.DeserializeObject(FlashUtil.Call(Name), ConvertType) : FlashUtil.Call(Name, ConvertType);
- }
- catch
- {
- args.Value = _defaultProvider.Provide(ConvertType);
- }
+ args.Value = _defaultProvider.Provide(ConvertType);
}
}
+ }
- public override void OnSetValue(LocationInterceptionArgs args)
+ public override void OnSetValue(LocationInterceptionArgs args)
+ {
+ base.OnSetValue(args);
+ if (Set)
{
- base.OnSetValue(args);
- if (Set)
+ try
+ {
+ if (UseValue)
+ FlashUtil.Call(Name, args.Value);
+ else
+ FlashUtil.Call(Name);
+ }
+ catch
{
- try
- {
- if (UseValue)
- FlashUtil.Call(Name, args.Value);
- else
- FlashUtil.Call(Name);
- }
- catch
- {
- }
}
}
}
diff --git a/RBot/Flash/EoLHook.cs b/RBot/Flash/EoLHook.cs
index 5a8d36b..c0d875a 100644
--- a/RBot/Flash/EoLHook.cs
+++ b/RBot/Flash/EoLHook.cs
@@ -1,54 +1,49 @@
-using EasyHook;
+using CoreHook;
using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-namespace RBot.Flash
+namespace RBot.Flash;
+
+public class EoLHook
{
- public class EoLHook
+ private static LocalHook _hook;
+
+ public static bool IsHooked => _hook != null;
+
+ [DllImport("kernel32.dll", SetLastError = true)]
+ private static extern void GetSystemTime(IntPtr lpSystemTime);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall, SetLastError = true)]
+ private delegate void GetSystemTimeDelegate(IntPtr lpSystemTime);
+
+ private static unsafe void GetSystemTimeHooked(IntPtr lpSystemTime)
+ {
+ GetSystemTime(lpSystemTime);
+ _SYSTEMTIME* ptr = (_SYSTEMTIME*)lpSystemTime;
+ ptr->wYear = 2020;
+ }
+
+ public static void Hook()
+ {
+ _hook = LocalHook.Create(LocalHook.GetProcAddress("kernel32.dll", "GetSystemTime"), new GetSystemTimeDelegate(GetSystemTimeHooked), null);
+ _hook.ThreadACL.SetInclusiveACL(new int[1]);
+ }
+
+ public static void Unhook()
+ {
+ _hook.Dispose();
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct _SYSTEMTIME
{
- private static LocalHook _hook;
-
- public static bool IsHooked => _hook != null;
-
- [DllImport("kernel32.dll", SetLastError = true)]
- private static extern void GetSystemTime(IntPtr lpSystemTime);
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall, SetLastError = true)]
- private delegate void GetSystemTimeDelegate(IntPtr lpSystemTime);
-
- private static unsafe void GetSystemTimeHooked(IntPtr lpSystemTime)
- {
- GetSystemTime(lpSystemTime);
- _SYSTEMTIME* ptr = (_SYSTEMTIME*)lpSystemTime;
- ptr->wYear = 2020;
- }
-
- public static void Hook()
- {
- _hook = LocalHook.Create(LocalHook.GetProcAddress("kernel32.dll", "GetSystemTime"), new GetSystemTimeDelegate(GetSystemTimeHooked), null);
- _hook.ThreadACL.SetInclusiveACL(new int[1]);
- }
-
- public static void Unhook()
- {
- _hook.Dispose();
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct _SYSTEMTIME
- {
- public ushort wYear;
- public ushort wMonth;
- public ushort wDayOfWeek;
- public ushort wDay;
- public ushort wHour;
- public ushort wMinute;
- public ushort wSecond;
- public ushort wMilliseconds;
- }
+ public ushort wYear;
+ public ushort wMonth;
+ public ushort wDayOfWeek;
+ public ushort wDay;
+ public ushort wHour;
+ public ushort wMinute;
+ public ushort wSecond;
+ public ushort wMilliseconds;
}
}
diff --git a/RBot/Flash/FlashArray.cs b/RBot/Flash/FlashArray.cs
index 35f72d3..4d65e97 100644
--- a/RBot/Flash/FlashArray.cs
+++ b/RBot/Flash/FlashArray.cs
@@ -1,76 +1,68 @@
-using System;
-using System.Collections;
+using System.Collections;
using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-namespace RBot.Flash
+namespace RBot.Flash;
+
+public class FlashArray : FlashObject, IEnumerable>
{
- public class FlashArray : FlashObject, IEnumerable>
+ public FlashArray(int id) : base(id) { }
+
+ public FlashObject Get(int index)
{
- public FlashArray(int id) : base(id)
- {
- }
+ return new FlashObject(FlashUtil.Call("lnkGetArray", ID, index));
+ }
- public FlashObject Get(int index)
- {
- return new FlashObject(FlashUtil.Call("lnkGetArray", ID, index));
- }
+ public void Set(int index, T value)
+ {
+ FlashUtil.Call("lnkSetArray", ID, index, value);
+ }
+
+ IEnumerator> IEnumerable>.GetEnumerator()
+ {
+ return new FlashArrayEnumerator(this);
+ }
- public void Set(int index, T value)
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return new FlashArrayEnumerator(this);
+ }
+
+ private class FlashArrayEnumerator : IEnumerator>
+ {
+ private int _index;
+ private FlashArray _array;
+ private FlashObject _length;
+
+ public FlashObject Current { get; set; }
+ object IEnumerator.Current => Current;
+
+ public FlashArrayEnumerator(FlashArray array)
{
- FlashUtil.Call("lnkSetArray", ID, index, value);
+ _array = array;
+ _length = _array.GetChild("length");
}
- IEnumerator> IEnumerable>.GetEnumerator()
+ public void Dispose()
{
- return new FlashArrayEnumerator(this);
+ Current?.Dispose();
+ _length.Dispose();
}
- IEnumerator IEnumerable.GetEnumerator()
+ public bool MoveNext()
{
- return new FlashArrayEnumerator(this);
+ int length = _length.Value;
+ if (_index >= length)
+ return false;
+ Current?.Dispose();
+ Current = _array.Get(_index);
+ _index++;
+ return true;
}
- private class FlashArrayEnumerator : IEnumerator>
+ public void Reset()
{
- private int _index;
- private FlashArray _array;
- private FlashObject _length;
-
- public FlashObject Current { get; set; }
- object IEnumerator.Current => Current;
-
- public FlashArrayEnumerator(FlashArray array)
- {
- _array = array;
- _length = _array.GetChild("length");
- }
-
- public void Dispose()
- {
- Current?.Dispose();
- _length.Dispose();
- }
-
- public bool MoveNext()
- {
- int length = _length.Value;
- if (_index >= length)
- return false;
- Current?.Dispose();
- Current = _array.Get(_index);
- _index++;
- return true;
- }
-
- public void Reset()
- {
- _index = 0;
- Current?.Dispose();
- }
+ _index = 0;
+ Current?.Dispose();
}
}
}
diff --git a/RBot/Flash/FlashCaller.cs b/RBot/Flash/FlashCaller.cs
index 8a4c0a9..9294794 100644
--- a/RBot/Flash/FlashCaller.cs
+++ b/RBot/Flash/FlashCaller.cs
@@ -1,77 +1,72 @@
using System;
-using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
using Newtonsoft.Json;
-namespace RBot.Flash
+namespace RBot.Flash;
+
+public class FlashCaller : IDisposable
{
- public class FlashCaller : IDisposable
- {
- private FlashObject