示例#1
0
文件: AST.cs 项目: zerodowned/CEasyUO
        public override bool Execute()
        {
            var index = (int)Index.GetValue();

            EUOInterpreter.Setvariable("#journal", World.Player.GetJournal(index));
            return(base.Execute());
        }
示例#2
0
        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());
        }
示例#3
0
文件: AST.cs 项目: zerodowned/CEasyUO
        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());
        }