Hello everyone,
I just returned to playing WoW for the new expansion, and thus wanted to pick up working on a bot of some sort (mostly for learning, I use Honorbuddy and various other bots since I simply do not have enough time to work on a full bot).
I was thinking about taking a previous open source example full bot example (or engine for other bots), called cleanLayer by miceiken, and updating it and providing it back to the community. It'll mostly help people like myself who have a lot of experience programming, but don't have enough skills to fully reverse engineer/work with IDA, etc.
cleanLayer:
http://www.ownedcore.com/forums/worl...leanlayer.html (cleanLayer)
I was hoping if someone might be able to provide some guidance and maybe answer some of these questions for me. Thank in in advance, I appreciate any assistance and will do my best to get this engine updated and provided back for anyone else who would like to work with it.
1) Has anything materially changed between 5.0 and 6.0? From what I've gathered so far, GUIDs are now 128 bit versus 64.
2) cleanLayer does the following for LUA script execution using the following functions. Has anything really changed with this method, or will updated offsets allow this same method to work? Or is there an easier way?
GetTop = Helper.Magic.RegisterDelegate<LuaGetTopDelegate>(Offsets.LuaGetTop);
SetTop = Helper.Magic.RegisterDelegate<LuaSetTopDelegate>(Offsets.LuaSetTop);
Type = Helper.Magic.RegisterDelegate<LuaTypeDelegate>(Offsets.LuaType);
ToLString = Helper.Magic.RegisterDelegate<LuaToLStringDelegate>(Offsets.LuaToLString);
ToBoolean = Helper.Magic.RegisterDelegate<LuaToBooleanDelegate>(Offsets.LuaToBoolean);
ToNumber = Helper.Magic.RegisterDelegate<LuaToNumberDelegate>(Offsets.LuaToNumber);
PCall = Helper.Magic.RegisterDelegate<LuaPCallDelegate>(Offsets.LuaPCall);
LoadBuffer = Helper.Magic.RegisterDelegate<LuaLoadBufferDelegate>(Offsets.LuaLoadBuffer);
And uses this logic to call the LUA functions through PCall:
Code:
private static List<string> ExecuteInternal(string query, bool withResults)
{
if (withResults)
query = "return " + query;
var state = LuaInterface.LuaState;
int top = LuaInterface.GetTop(state);
var data = Encoding.ASCII.GetBytes(query);
var memory = Marshal.AllocHGlobal(data.Length + 1);
try
{
Marshal.Copy(data, 0, memory, data.Length);
Marshal.WriteByte(memory + data.Length, 0);
if (LuaInterface.LoadBuffer(state, memory, data.Length, "cleanCore") > 0)
return new List<string> {PopError(state)};
if (LuaInterface.PCall(state, 0, withResults ? (int)LuaInterface.LuaConstant.MultRet : 0, 0) > 0)
return new List<string> {PopError(state)};
int returnValueCount = LuaInterface.GetTop(state) - top;
var ret = new List<string>(returnValueCount);
for (int i = 1; i <= returnValueCount; i++)
ret.Add(LuaInterface.StackObjectToString(state, i));
LuaInterface.Pop(state, returnValueCount);
return ret;
}
finally
{
Marshal.FreeHGlobal(memory);
}
}
3) Is EnumVisibleObjects still the preferred method of enumerating and updating object states?
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate int EnumVisibleObjectsCallback(ulong guid, uint filter);
Since GUIDs are now 128 bit, does the callback for EnumVisibleObjects return the 128 bit guid now? (WoWGuid)
4) Does anyone have any patterns defined for various internal WoW functions? LUA Functions, Enumerations, etc
5) Does anyone have any implementations that they are comfortable sharing with me? Just as a reference to allow cleanLayer to be updated.
Again thank you for your help, I really appreciate it!!
-Shadow