protected override void CombatRoutine(GUnit Cible) { Cible.Target(); deplacement(Cible); CastSpell("Attaque auto"); int i = 0; //SendConsole("------", ConsoleLvl.High); // showTargetlist(); while (Cible.IsAlive && localPlayer.IsAlive) { if (BreakCurActionB == true) { BreakCurActionB = false; break; } LuaVM.DoString(LuaHelp.AttackingTarget); Repositionnement(Cible); Thread.Sleep(200); if (!Cible.inCombat || !localPlayer.inCombat) { Cible.Target(); Thread.Sleep(100); CastSpell("Attaque auto"); } i++; TargetList.Sort(); } //showTargetlist(); // SendConsole("Something stopped : " + (TargetList[0].Target == Cible).ToString() + " " + i.ToString(), ConsoleLvl.High); }
protected override void CombatRoutine(GUnit Cible) { if (waitTankPull) { if (BotHelper.CombatTime(Cible) < TimeSpan.FromMilliseconds(1000)) { // combat vien juste de commencer Thread.Sleep(timeToWaitPull); } } while (Cible.IsAlive && localPlayer.IsAlive) { if (BreakCurActionB == true) { BreakCurActionB = false; break; } LuaVM.DoString(LuaHelp.AttackingTarget); Repositionnement(Cible); if (!Cible.inCombat || !localPlayer.inCombat) { Cible.Target(); Thread.Sleep(100); } Thread.Sleep(200); TargetList.Sort(); } }
public void Close() { if (L != null) { L.Close(); L = null; } }
public void Launch() { TextAsset mainScript = Resources.Load(StartScriptPath) as TextAsset; string mainText = mainScript.ToString(); TextAsset initScript = Resources.Load(InitScriptPath) as TextAsset; string initText = initScript.ToString(); L = new LuaVM(mainText, initText); L.Start(); }
public static void InitLuaModule(LuaVM vm) { var script = vm.GetScriptObject(); var t = new Table(script); t["GetTextFromFile"] = (Func <string, string>)(GetTextFromFile); t["IsDebug"] = (Func <bool>)(IsDebug); vm.SetGlobal("UnityOs", t); }
private void OnEnable() { if (this.L != null) { return; } var luaVM = LuaVM.Create(); this.L = luaVM.L; ExposeNativeTypes(this.L); }
private void Start() { Debug.Log("Start called"); commandVM = new LuaVM(LuaVM.VMSettings.None); commandVM.AttachCustomAPI(typeof(CommandApi)); Logger.OnLog += Logger_OnLog; Application.logMessageReceived += Application_logMessageReceived; Debug.Log("Attach logged"); //Set commands as default (not cmd.simg but only simg) commandVM.ExecuteString("simg = cmd.simg"); commandVM.ExecuteString("spawn = cmd.spawn"); }
protected override void HealRoutine(GUnit Cible) { Cible.Target(); while (Cible.Health != 1.0) { if (BreakCurActionB == true) { BreakCurActionB = false; break; } LuaVM.DoString(LuaHelp.HealingTarget); Thread.Sleep(200); } }
public static void InitLibraries(LuaVM vm) { UnityOs.InitLuaModule(vm); ModifiersManager.InitLuaModule(); ChunkFinder.InitLuaModule(); SimpleOrderManager.InitLuaModule(); GameMoveManager.InitLuaModule(); AI_Calculation.InitLuaModule(); PathCalcManager.InitLuaModule(); FlagManager.InitLuaModule(); ProgressUnitBar.InitLuaModule(); LuaChunkManager.InitLuaModule(); ErrorBar_HTML.InitLuaModule(); LuaHelper.InitLuaModule(); ResearchManager.InitLuaModule(); }
void Awake() { Script.DefaultOptions.ScriptLoader = new UnityAssetsScriptLoader(); Vm = new LuaVM(CoreModules.Preset_Complete, new string[] { "Assets/Resources/Scripts/LuaScripts/?", "Assets/Resources/Scripts/LuaScripts/?.txt", "Resources/Scripts/LuaScripts/?", "Resources/Scripts/LuaScripts/?.txt", "Scripts/LuaScripts/?", "Scripts/LuaScripts/?.txt", "Assets/Resources/Scripts/LuaScripts/?/?", "Assets/Resources/Scripts/LuaScripts/?/?.txt", "Resources/Scripts/LuaScripts/?/?", "Resources/Scripts/LuaScripts/?/?.txt", "Scripts/LuaScripts/?/?", "Scripts/LuaScripts/?/?.txt", "Assets/Resources/Scripts/LuaScripts/?/?/?", "Assets/Resources/Scripts/LuaScripts/?/?/?.txt", "Resources/Scripts/LuaScripts/?/?/?", "Resources/Scripts/LuaScripts/?/?/?.txt", "Scripts/LuaScripts/?/?/?", "Scripts/LuaScripts/?/?/?.txt", }); ScriptObj = Vm.GetScriptObject(); LuaLibrariesIniter.InitLibraries(Vm); //UnityOs.IsDebugCheck = true; var fileText = UnityOs.GetTextFromFile("main"); var EvoEngine = Vm.ExecuteString(fileText); var main = EvoEngine.Table.Get("Main"); InitForLua(); Vm.Call(main); }
/// <summary> /// Adds the API to lua instance. /// </summary> /// <param name="luaInstance">Lua instance.</param> public void AddAPIToLuaInstance(LuaVM luaInstance) { // Set our parent m_ParentVM = luaInstance; // Make a new table Table apiTable = m_ParentVM.AddGlobalTable(m_APIName); if (apiTable != null) { // Set the api table m_ApiTable = apiTable; // Hand over to the API derived type to fill in the table InitialiseAPITable(); } else { Debug.Log($"Failed to Initilise API {m_APIName}"); } }
protected override void CombatRoutine(GUnit Cible) { while (Cible.IsAlive && localPlayer.IsAlive) { if (BreakCurActionB == true) { BreakCurActionB = false; break; } LuaVM.DoString(LuaHelp.AttackingTarget); Repositionnement(Cible); if (!Cible.inCombat || !localPlayer.inCombat) { Cible.Target(); Thread.Sleep(100); } Thread.Sleep(200); TargetList.Sort(); } }
private void ReadBody() { bodySize = reader.ReadUInt32(); var l = new LuaVM(reader.BaseStream); }
// Use this for initialization void Start() { vm = new LuaVM(); UserData.RegisterProxyType <LuaProxyGameObject, GameObject>(r => new LuaProxyGameObject(r)); }
public StdLib(LuaVM vm) { this.vm = vm; this.Init_package(); }
// Start is called before the first frame update void Start() { virtualM = new LuaVM(); virtualM.ExecuteString(luaCode); }