Пример #1
0
        static void Main(string[] args)
        {
            var programPath  = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var pobDirectory = Path.Combine(programPath, "PathOfBuilding");

            EnsurePobExists(pobDirectory).GetAwaiter().GetResult();

            var wrapper = new PobWrapper(pobDirectory);

            wrapper.LoadBuildFromFile(Path.Combine(programPath, "Builds", "Test-Character.xml"));
            wrapper.RunLua(@"
local player = GetPlayerActor()
local mainSkill = player.mainSkill
local output = player.output

for _, skillEffect in ipairs(mainSkill.effectList) do
    print(string.format(""Player Skill: %s %d/%d"", skillEffect.grantedEffect.name, skillEffect.level, skillEffect.quality))
end

print(""TotalDPS: "" .. output.TotalDPS)
");

            if (Debugger.IsAttached)
            {
                Console.ReadLine();
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            var programPath  = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var pobDirectory = Path.Combine(programPath, "PathOfBuilding");

            EnsurePobExists(pobDirectory).GetAwaiter().GetResult();

            var wrapper = new PobWrapper(pobDirectory);

            wrapper.LoadBuildFromFile(Path.Combine(programPath, "Builds", "Test-Character.xml"));

            Console.WriteLine("REPL Ready");
            var repl = new ReplInterpreter(wrapper.Script);

            var line = "";

            while (line != "quit")
            {
                Console.Write(repl.ClassicPrompt);
                line = Console.ReadLine();

                try
                {
                    var result = repl.Evaluate(line);

                    if (result.IsNotNil())
                    {
                        Console.WriteLine(result);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Exception: {e.Message}");
                }
            }

            /*
             * wrapper.RunLua(@"
             * local build = mainObject.main.modes[""BUILD""]
             *
             * local f = io.open(""Player.txt"", ""w"")
             * f:write(inspect(build.calcsTab.mainEnv.player))
             * f:close()
             * ");
             */

            if (Debugger.IsAttached)
            {
                Console.ReadLine();
            }
        }