Nice one Inf, or though i don't think raw packets should be abstracted, just let plugins implement an interface which we give the command string, and it fires off our plugin when someone does /plugin ourPluginName
you really should add better scripting support, therefore even noobs will be able to script.
not sure how it's done in C# but heres a java example
Code:
public class ExamplePlugin extends ScriptUtils implements CommandListener {
public String getCommand() {
return "autowalker"; // called with /plugin autowalker personToFollow
}
public void onCommand(Client c, String[] arguments) {
Entity target = getEntity(arguments[0]);
if(target != null) {
Chase(target, true); // boolean jump? or not.
}
}
}
Don't mind the bad indenting there, ScriptUtils is a super/base class that has many simplified methods.
also i saw somewhere about its for any language on .Net, is that including J# ?
Much easier than
Code:
using System;
using System.Threading;
using JProxyNativeInterface;
namespace ExamplePlugin
{
public class PluginClass
{
private static PluginForm Form;
private static JNativeGameClient Client;
private static ushort LastFollowedX;
private static ushort LastFollowedY;
public static void ServerToClient(IntPtr nativeInstance, byte[] Packet)
{
if (Form.Following)
{
Client = new JNativeGameClient(nativeInstance);
if (BitConverter.ToUInt16(Packet, 2) == 0x271A)
{ // 0x271A, 0x89 (Jump packet)
foreach (JNativeBasicEntity Entity in Client.Screen.Objects)
{
if (Entity.Name == Form.FollowName)
{
if (Entity.X != LastFollowedX &&
Entity.Y != LastFollowedY)
{
LastFollowedX = Entity.X;
LastFollowedY = Entity.Y;
Client.Jump(LastFollowedX, LastFollowedY);
Client.SyncClientScreen();
}
break;
}
}
}
}
}
public static void Main()
{
Form = new PluginForm();
new Thread(delegate()
{
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
Form.ShowDialog();
}
).Start();
}
}
}