internal static string[] GetText(string command, string[] arguments, int returnLength) { lock (Inject.inject_Lock) { // Create a string array with the number of arguments and fill it with empty strings int num; string[] strArray = new string[arguments.Length]; for (num = 0; num < strArray.Length; num++) { strArray[num] = string.Empty; } if (ObjectManager.ExecuteOnce && ObjectManager.playerPtr != 0) { ObjectManager.ExecuteOnce = false; Register.LuaFunctions(); Ingame.PlaceAutoAttackAndShoot(); } bool firstBool = BmWrapper.memory.WriteASCIIString(Inject.DoStringTextPtr, command + "\0"); String[] asm = new String[] { "mov EDX, 0", "mov ECX, " + (uint)Inject.DoStringTextPtr, "call " + (uint)Offsets.functions.DoString, "retn", }; Inject.InjectAndExecute(asm, false); for (int i = 0; i < arguments.Length; i++) { bool thirdBool = BmWrapper.memory.WriteASCIIString(Inject.GetTextArgumentsPtr, arguments[i] + "\0"); if (thirdBool) { // Write the asm stuff for Lua_DoString String[] asm2 = new String[] { "push 0", "or edx, 0FFFFFFFFh", "mov ecx, " + (uint)Inject.GetTextArgumentsPtr, "call " + (uint)Offsets.functions.GetText, "retn", }; uint argumentValue = Inject.InjectAndExecuteReturn(asm2, true, false); if (argumentValue != 0) { strArray[i] = BmWrapper.memory.ReadASCIIString(argumentValue, returnLength); } } } return(strArray); } }
internal static string GetText(string command, string argument, int returnLength) { lock (Inject.inject_Lock) { string str = ""; if (ObjectManager.ExecuteOnce && ObjectManager.playerPtr != 0) { ObjectManager.ExecuteOnce = false; Register.LuaFunctions(); Ingame.PlaceAutoAttackAndShoot(); } bool firstBool = BmWrapper.memory.WriteASCIIString(Inject.DoStringTextPtr, command + "\0"); String[] asm = new String[] { "mov EDX, 0", "mov ECX, " + (uint)Inject.DoStringTextPtr, "call " + (uint)Offsets.functions.DoString, "retn", }; Inject.InjectAndExecute(asm, false); bool thirdBool = BmWrapper.memory.WriteASCIIString(Inject.GetTextArgumentsPtr, argument + "\0"); if (thirdBool) { // Write the asm stuff for Lua_DoString String[] asm2 = new String[] { "push 0", "or edx, 0FFFFFFFFh", "mov ecx, " + Inject.GetTextArgumentsPtr, "call " + (uint)Offsets.functions.GetText, "retn", }; //Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " Calling Get Text"); uint argumentValue = Inject.InjectAndExecuteReturn(asm2, true, false); if (argumentValue != 0) { str = BmWrapper.memory.ReadASCIIString(argumentValue, returnLength); } } return(str); } }
// ^ Offset by Cencil #region DoString internal static void DoString(string code) { lock (Inject.inject_Lock) { if (ObjectManager.ExecuteOnce && ObjectManager.playerPtr != 0) { ObjectManager.ExecuteOnce = false; Register.LuaFunctions(); Ingame.PlaceAutoAttackAndShoot(); } bool firstBool = BmWrapper.memory.WriteASCIIString(Inject.DoStringTextPtr, code + "\0"); // Write the asm stuff for Lua_DoString String[] asm = new String[] { "mov EDX, 0", "mov ECX, " + (uint)Inject.DoStringTextPtr, "call " + (uint)Offsets.functions.DoString, "retn", }; //Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " Calling Do String"); Inject.InjectAndExecute(asm, false); } }