private void btnPlayClicked(object sender, EventArgs e) { //if ( Parser == null || Parser.Script != txtScriptEntry.Text ) Parser = new EUOInterpreter(txtScriptEntry.Text); Parser.Run(); }
public override bool Execute() { var index = (int)Index.GetValue(); EUOInterpreter.Setvariable("#journal", World.Player.GetJournal(index)); return(base.Execute()); }
private void btnStepClicked(object sender, EventArgs e) { try { if (Interpreter == null || Interpreter.Script != txtScriptEntry.Text) { Interpreter = new EUOInterpreter(txtScriptEntry.Text); UpdateAST(); } Interpreter.Statement(); txtDebug.Text = "Current Line: " + Interpreter.CurrentLine + " Current Statement: " + Interpreter.CurrentStatment ?? "null"; var start = txtScriptEntry.GetFirstCharIndexFromLine(Interpreter.CurrentLine - 1); var end = txtScriptEntry.GetFirstCharIndexFromLine(Interpreter.CurrentLine) - 1; txtScriptEntry.SelectionStart = 0; txtScriptEntry.SelectionLength = txtScriptEntry.Text.Length; txtScriptEntry.SelectionBackColor = SystemColors.Window; txtScriptEntry.SelectionStart = start; txtScriptEntry.SelectionLength = end - start; txtScriptEntry.SelectionBackColor = Color.Red; txtScriptEntry.SelectionBullet = true; txtScriptEntry.SelectionLength = 0; } catch (Exception ee) { txtDebug.Text = "E: " + ee.Message; } }
public void UpdateAST() { if (Interpreter == null || Interpreter.Script != txtScriptEntry.Text) { Interpreter = new EUOInterpreter(txtScriptEntry.Text); } tree_AST.Nodes.Clear(); foreach (var n in (Interpreter.AST.First() as Block).statements) { tree_AST.Nodes.AddRange(AddTree(n)); } }
private Dictionary <string, object> BuildCharInfo() { var charinfo = new Dictionary <string, object>(); charinfo.Add("#CHARPOSX", EUOInterpreter.GetVariable <string>("#CHARPOSX")); charinfo.Add("#CHARPOSY", EUOInterpreter.GetVariable <string>("#CHARPOSY")); charinfo.Add("#CHARPOSZ", EUOInterpreter.GetVariable <string>("#CHARPOSZ")); charinfo.Add("#CHARDIR", EUOInterpreter.GetVariable <string>("#CHARDIR")); charinfo.Add("#CHARSTATUS", EUOInterpreter.GetVariable <string>("#CHARSTATUS"));; charinfo.Add("#CHARID", EUOInterpreter.GetVariable <string>("#CHARID")); charinfo.Add("#CHARTYPE", EUOInterpreter.GetVariable <string>("#CHARTYPE")); charinfo.Add("#CHARGHOST", EUOInterpreter.GetVariable <string>("#CHARGHOST")); charinfo.Add("#CHARBACKPACKID", EUOInterpreter.GetVariable <string>("#CHARBACKPACKID")); return(charinfo); }
public override bool Execute() { string varName = ""; if (ident is Ident i) { varName = i.value.ToLowerInvariant(); EUOInterpreter.Setvariable(varName, value); } else { varName = ident.GetValue().ToString().ToLowerInvariant(); EUOInterpreter.Setvariable(varName, value); } return(base.Execute()); }
private Dictionary <string, object> BuildLastInfo() { var last = new Dictionary <string, object>(); last.Add("#LOBJECTID", EUOInterpreter.GetVariable <string>("#LOBJECTID")); last.Add("#LOBJECTTYPE", EUOInterpreter.GetVariable <string>("#LOBJECTTYPE")); last.Add("#LTARGETID", EUOInterpreter.GetVariable <string>("#LTARGETID")); last.Add("#LTARGETTYPE", EUOInterpreter.GetVariable <string>("#LTARGETTYPE")); last.Add("#LTARGETX", EUOInterpreter.GetVariable <string>("#LTARGETX")); last.Add("#LTARGETY", EUOInterpreter.GetVariable <string>("#LTARGETY")); last.Add("#LTARGETZ", EUOInterpreter.GetVariable <string>("#LTARGETZ")); last.Add("#LTARGETKIND", EUOInterpreter.GetVariable <string>("#LTARGETKIND")); last.Add("#LTARGETTILE", EUOInterpreter.GetVariable <string>("#LTARGETTILE")); last.Add("#LSKILL", EUOInterpreter.GetVariable <string>("#LSKILL")); last.Add("#LSPELL", EUOInterpreter.GetVariable <string>("#LSPELL")); last.Add("#LGUMPBUTTON", EUOInterpreter.GetVariable <string>("#LGUMPBUTTON")); return(last); }
private void btnPlayClicked(object sender, EventArgs e) { if (Interpreter == null || Interpreter.Script != txtScriptEntry.Text) { Interpreter = new EUOInterpreter(txtScriptEntry.Text); UpdateAST(); } if (Interpreter.Running && Interpreter.Paused) { Interpreter.Paused = false; } else if (!Interpreter.Running) { Interpreter.Run(); } btnPlay.Enabled = false; btnStop.Enabled = true; btnPause.Enabled = true; txtDebug.Text = "Running..."; }
private void UpdateVars() { try { //txtDebug.Text = "CurrentLine: " + Parser?.CurrentLine ?? "0"; Dictionary <string, object> charinfo = new Dictionary <string, object>(); if (!Engine.IsInstalled || World.Player == null) { return; } charinfo.Add("#CHARPOSX", World.Player.Position.X); charinfo.Add("#CHARPOSY", World.Player.Position.Y); charinfo.Add("#CHARPOSZ", World.Player.Position.Z); charinfo.Add("#CHARDIR", World.Player.Direction); charinfo.Add("#CHARSTATUS", World.Player.GetStatusCode()); charinfo.Add("#CHARID", World.Player.Serial); charinfo.Add("#CHARTYPE", World.Player.Body); charinfo.Add("#CHARGHOST", World.Player.IsGhost); charinfo.Add("#CHARBACKPACKID", uintToEUO(World.Player?.Backpack?.Serial ?? 0)); Dictionary <string, object> last = new Dictionary <string, object>(); last.Add("#LOBJECTID", EUOInterpreter.GetVariable <string>("#LOBJECTID")); last.Add("#LOBJECTTYPE", EUOInterpreter.GetVariable <string>("#LOBJECTTYPE")); last.Add("#LTARGETID", EUOInterpreter.GetVariable <string>("#LTARGETID")); last.Add("#LTARGETX", EUOInterpreter.GetVariable <string>("#LTARGETX")); last.Add("#LTARGETY", EUOInterpreter.GetVariable <string>("#LTARGETY")); last.Add("#LTARGETZ", EUOInterpreter.GetVariable <string>("#LTARGETZ")); last.Add("#LTARGETKIND", EUOInterpreter.GetVariable <string>("#LTARGETKIND")); last.Add("#LTARGETTILE", EUOInterpreter.GetVariable <string>("#LTARGETTILE")); last.Add("#LSKILL", EUOInterpreter.GetVariable <string>("#LSKILL")); last.Add("#LSPELL", EUOInterpreter.GetVariable <string>("#LSPELL")); Dictionary <string, object> find = new Dictionary <string, object>(); find.Add("#FINDID", EUOInterpreter.GetVariable <string>("#findid")); find.Add("#FINDTYPE", EUOInterpreter.GetVariable <string>("#FINDTYPE")); find.Add("#FINDX", EUOInterpreter.GetVariable <string>("#FINDX")); find.Add("#FINDY", EUOInterpreter.GetVariable <string>("#FINDY")); find.Add("#FINDZ", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDDIST", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDKIND", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDSTACK", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDBAGID", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDMOD", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDREP", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDCOL", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDINDEX", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDCNT", EUOInterpreter.GetVariable <string>("#FINDZ")); foreach (TreeNode n in treeVarTree.Nodes) { if (n.Text == "Last Action") { UpdateChildren((TreeNode)n, last); } if (n.Text == "Character Info") { UpdateChildren((TreeNode)n, charinfo); } if (n.Text == "Find Item") { UpdateChildren((TreeNode)n, find); } } }catch (Exception e) { Debugger.Break(); Console.WriteLine(e.Message); } }
public override object GetValue() { return(EUOInterpreter.GetVariable <string>(value.ToLowerInvariant())); }
public override bool Execute() { if (DEBUG) { Console.WriteLine($"Executing Event: {EventType} "); } switch (EventType) { case "macro": switch ((int)Params[0].GetValue()) { case 13: ClientCommunication.SendToServer(new UseSkill((int)Params[1].GetValue())); break; case 15: World.Player.LastSpell = (int)Params[1].GetValue(); ClientCommunication.CastSpell((int)Params[1].GetValue()); break; case 16: ClientCommunication.CastSpell(World.Player.LastSpell); break; case 17: var obj = Utility.EUO2StealthID(EUOInterpreter.GetVariable <string>("#lobjectid")); ClientCommunication.SendToServer(new DoubleClick(obj)); break; case 22: var targ = Utility.EUO2StealthID(EUOInterpreter.GetVariable <string>("#ltargetid")); EUOVars.SendTargetLast(); break; case 23: Targeting.Target(World.Player.Serial); break; } break; case "gump": { switch (Params[0].GetValue().ToString()) { case "wait": { int timeout = 10000; if (Params.Count > 1) { timeout = Params[1].GetValueInt(); } int max = timeout / 250; int cnt = 0; while (!World.Player.HasGump && cnt++ < max) { Thread.Sleep(250); } if (!World.Player.HasGump) { World.Player?.SendMessage("Gump not found"); } } break; case "last": if (World.Player?.HasGump == true) { World.Player?.LastGumpResponseAction?.Perform(); } else { World.Player?.SendMessage("Gump not found"); } break; case "button": int button = Params[1].GetValueInt(); World.Player.LastGumpResponseAction = new GumpResponseAction(button, new int[] { }, new GumpTextEntry[] { }); if (World.Player?.HasGump == true) { World.Player?.LastGumpResponseAction?.Perform(); } else { World.Player?.SendMessage("Gump not found"); } break; } } break; case "contextmenu": uint serial = Utility.EUO2StealthID(Params[0].GetValue().ToString()); ushort index = (ushort)Params[1].GetValueInt(); ClientCommunication.SendToServer(new ContextMenuRequest(serial)); ClientCommunication.SendToServer(new ContextMenuResponse(serial, index)); break; } return(base.Execute()); }
public override bool Execute() { var ids = Find.GetValue().ToString().Split(new[] { '_' }); foreach (var id in ids) { if (id.Length <= 3) { FindTypes.Add(Utility.EUO2StealthType(id)); } else { FindIDs.Add(Utility.EUO2StealthID(id)); } } if (Filter != null) { var str = Filter.GetValue().ToString().Trim(); ContainerOnly = (str.Contains("C")); GroundOnly = (str.Contains("G")); try { var id = str.Split('_')[1]; ContainerSerial = Utility.EUO2StealthID(id); } catch { } } var results = new List <IUOEntity>(); foreach (var i in FindIDs) { results.Add(World.FindEntity(i)); } foreach (var i in FindTypes) { results.AddRange(World.Items.Values.Where(t => t.GraphicID == i)); } foreach (var i in FindTypes) { results.AddRange(World.Mobiles.Values.Where(t => t.GraphicID == i)); } if (ContainerOnly) { results = results.Where(t => t.Parent != null).ToList(); } if (GroundOnly) { results = results.Where(t => t.Parent == null).ToList(); } var res = results.FirstOrDefault(); Debug($"Found:{results.Count} items"); EUOInterpreter.Setvariable("#FINDID", Utility.UintToEUO(res?.Serial ?? 0)); EUOInterpreter.Setvariable("#FINDTYPE", Utility.UintToEUO(res?.GraphicID ?? 0)); EUOInterpreter.Setvariable("#findx", res?.Position.X ?? 0); EUOInterpreter.Setvariable("#findy", res?.Position.Y ?? 0); EUOInterpreter.Setvariable("#findz", res?.Position.Z ?? 0); return(base.Execute()); }
private void UpdateVars() { btnPause.Checked = false; btnStop.Checked = false; if (Interpreter != null) { btnPause.Enabled = Interpreter.Running; btnStop.Enabled = Interpreter.Running; btnPlay.Enabled = !Interpreter.Running; btnPlay.Checked = Interpreter.Running; } else { btnPause.Enabled = false; btnStop.Enabled = false; btnPlay.Enabled = true; btnPlay.Checked = false; } this.Text = $"CEasyUO {Assembly.GetExecutingAssembly().GetName().Version} - {(m_FilePath ?? "New")}"; try { //txtDebug.Text = "CurrentLine: " + Parser?.CurrentLine ?? "0"; if (!Engine.IsInstalled || World.Player == null) { return; } Dictionary <string, object> charinfo = BuildCharInfo(); Dictionary <string, object> last = BuildLastInfo(); Dictionary <string, object> container = new Dictionary <string, object>(); container.Add("#GUMPPOSX", EUOInterpreter.GetVariable <string>("#GUMPPOSX")); container.Add("#GUMPPOSY", EUOInterpreter.GetVariable <string>("#GUMPPOSY")); container.Add("#GUMPSIZEX", EUOInterpreter.GetVariable <string>("#GUMPSIZEX")); container.Add("#GUMPSIZEY", EUOInterpreter.GetVariable <string>("#GUMPSIZEY")); container.Add("#CONTKIND", EUOInterpreter.GetVariable <string>("#CONTKIND")); container.Add("#CONTID", EUOInterpreter.GetVariable <string>("#CONTID")); container.Add("#CONTTYPE", EUOInterpreter.GetVariable <string>("#CONTTYPE")); container.Add("#CONTHP", "N/A"); container.Add("#GUMPSERIAL", EUOInterpreter.GetVariable <string>("#GUMPSERIAL")); container.Add("#GUMPTYPE", EUOInterpreter.GetVariable <string>("#GUMPTYPE")); Dictionary <string, object> find = new Dictionary <string, object>(); find.Add("#FINDID", EUOInterpreter.GetVariable <string>("#findid")); find.Add("#FINDTYPE", EUOInterpreter.GetVariable <string>("#FINDTYPE")); find.Add("#FINDX", EUOInterpreter.GetVariable <string>("#FINDX")); find.Add("#FINDY", EUOInterpreter.GetVariable <string>("#FINDY")); find.Add("#FINDZ", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDDIST", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDKIND", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDSTACK", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDBAGID", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDMOD", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDREP", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDCOL", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDINDEX", EUOInterpreter.GetVariable <string>("#FINDZ")); find.Add("#FINDCNT", EUOInterpreter.GetVariable <string>("#FINDZ")); Dictionary <string, object> status = new Dictionary <string, object>(); status.Add("#CHARNAME", EUOInterpreter.GetVariable <string>("#CHARNAME")); status.Add("#SEX", EUOInterpreter.GetVariable <string>("#SEX")); status.Add("#STR", EUOInterpreter.GetVariable <string>("#STR")); status.Add("#DEX", EUOInterpreter.GetVariable <string>("#DEX")); status.Add("#INT", EUOInterpreter.GetVariable <string>("#INT")); status.Add("#HITS", EUOInterpreter.GetVariable <string>("#HITS")); status.Add("#MAXHITS", EUOInterpreter.GetVariable <string>("#MAXHITS")); status.Add("#MANA", EUOInterpreter.GetVariable <string>("#MANA")); status.Add("#MAXMANA", EUOInterpreter.GetVariable <string>("#MAXMANA")); status.Add("#STAMINA", EUOInterpreter.GetVariable <string>("#STAMINA")); status.Add("#MAXSTAM", EUOInterpreter.GetVariable <string>("#MAXSTAM")); status.Add("#MAXSTATS", EUOInterpreter.GetVariable <string>("#MAXSTATS")); status.Add("#LUCK", EUOInterpreter.GetVariable <string>("#LUCK")); status.Add("#WEIGHT", EUOInterpreter.GetVariable <string>("#WEIGHT")); status.Add("#MAXWEIGHT", EUOInterpreter.GetVariable <string>("#MAXWEIGHT")); status.Add("#MINDMG", EUOInterpreter.GetVariable <string>("#MINDMG")); status.Add("#MAXDMG", EUOInterpreter.GetVariable <string>("#MAXDMG")); status.Add("#GOLD", EUOInterpreter.GetVariable <string>("#GOLD")); status.Add("#FOLLOWERS", EUOInterpreter.GetVariable <string>("#FOLLOWERS")); status.Add("#MAXFOL", EUOInterpreter.GetVariable <string>("#MAXFOL")); status.Add("#AR", EUOInterpreter.GetVariable <string>("#AR")); status.Add("#FR", EUOInterpreter.GetVariable <string>("#FR")); status.Add("#CR", EUOInterpreter.GetVariable <string>("#CR")); status.Add("#PR", EUOInterpreter.GetVariable <string>("#PR")); status.Add("#ER", EUOInterpreter.GetVariable <string>("#ER")); Dictionary <string, object> extended = new Dictionary <string, object>(); extended.Add("#JOURNAL", EUOInterpreter.GetVariable <string>("#JOURNAL")); extended.Add("#JCOLOR", EUOInterpreter.GetVariable <string>("#JCOLOR")); extended.Add("#JINDEX", EUOInterpreter.GetVariable <string>("#JINDEX")); extended.Add("#SYSMSG", EUOInterpreter.GetVariable <string>("#SYSMSG")); extended.Add("#TARGCURS", EUOInterpreter.GetVariable <string>("#TARGCURS")); extended.Add("#CURSKIND", EUOInterpreter.GetVariable <string>("#CURSKIND")); extended.Add("#PROPERTY", EUOInterpreter.GetVariable <string>("#PROPERTY")); Dictionary <string, object> results = new Dictionary <string, object>(); results.Add("#RESULT", EUOInterpreter.GetVariable <string>("#RESULT")); results.Add("#STRRES", EUOInterpreter.GetVariable <string>("#STRRES")); results.Add("#MENURES", EUOInterpreter.GetVariable <string>("#MENURES")); results.Add("#DISPRES", EUOInterpreter.GetVariable <string>("#DISPRES")); foreach (TreeNode n in treeVarTree.Nodes) { if (n.Text == "Last Action") { UpdateChildren((TreeNode)n, last); } if (n.Text == "Character Info") { UpdateChildren((TreeNode)n, charinfo); } if (n.Text == "Find Item") { UpdateChildren((TreeNode)n, find); } if (n.Text == "Status Bar") { UpdateChildren((TreeNode)n, status); } if (n.Text == "Container Info") { UpdateChildren((TreeNode)n, container); } if (n.Text == "Result Variables") { UpdateChildren((TreeNode)n, results); } if (n.Text == "Extended Info") { UpdateChildren((TreeNode)n, extended); } } } catch (Exception e) { Console.WriteLine(e.Message + e.StackTrace); } }