Пример #1
0
        private void RunActions(ScriptExecutionContext context)
        {
            _currentConditionValue = EvaluateConditions(context);

            var actions = _currentConditionValue.Value
                ? _actionsIfTrue
                : _actionsIfFalse;

            foreach (var action in actions)
            {
                var executor = ActionLookup.Get(action);
                var result   = executor(action, context);
                if (result is ActionResult.ActionContinuation coroutine)
                {
                    context.Scripting.AddCoroutine(coroutine);
                }
            }

            var shouldDeactivate = _deactivateUponSuccess && actions.Count > 0;

            if (shouldDeactivate)
            {
                IsActive = false;
            }
        }
Пример #2
0
        public void SyncActionWithTarget(string hash, ActorProxy targetActorProxy)
        {
            if (_syncActionCoroutine != null)
            {
                SyncAction.OnActionCancel(ActorProxy);
                StopCoroutine(_syncActionCoroutine);
            }

            var action = ActionLookup.GetActionWithTarget(hash);

            SyncAction           = action;
            _syncActionCoroutine = StartCoroutine(RunSyncAction(action.Action(ActorProxy, targetActorProxy)));
        }
Пример #3
0
        static void Main(string[] args)
        {
            var stringReader = new StringReader(XElement.Load("./Bootstrapper.exe.nlog").ToString());

            using (XmlReader xmlReader = XmlReader.Create(stringReader)) {
                LogManager.Configuration = new XmlLoggingConfiguration(xmlReader, null);
            }

            ActionLookup.GetActionInfo(2);
            StatusEffectLookup.GetStatusInfo(2);
            ZoneLookup.GetZoneInfo(138);

            ActionItem action = ActionLookup.GetActionInfo(2);
            StatusItem status = StatusEffectLookup.GetStatusInfo(2);
            MapItem    zone   = ZoneLookup.GetZoneInfo(138);

            Process process = Process.GetProcessesByName("ffxiv_dx11").FirstOrDefault();

            if (process != null)
            {
                MemoryHandler.Instance.SetProcess(
                    new ProcessModel {
                    IsWin64 = true,
                    Process = process,
                });

                while (Scanner.Instance.IsScanning)
                {
                    Thread.Sleep(1000);
                    Console.WriteLine("Scanning...");
                }

                MemoryHandler.Instance.SignaturesFoundEvent += delegate(object sender, SignaturesFoundEvent e) {
                    foreach (KeyValuePair <string, Signature> kvp in e.Signatures)
                    {
                        Console.WriteLine($"{kvp.Key} => {kvp.Value.GetAddress():X}");
                    }
                };
            }

            Console.WriteLine("To exit this application press \"Enter\".");
            Console.ReadLine();
        }
Пример #4
0
        ActionLookup initActionLookup(SubscriptionEndpoint endpoint)
        {
            ActionLookup lookup = null;

            if (_lookup != null)
            {
                return(_lookup);
            }

            lookup = new ActionLookup();

            Dictionary <string, MethodInfo> actionLookup      = new Dictionary <string, MethodInfo>();
            Dictionary <string, string>     replyActionLookup = new Dictionary <string, string>();

            foreach (OperationDescription operation in ContractDescription.GetContract(endpoint.ContractType).Operations)
            {
                MessageDescription requestMessage  = operation.Messages.Where(md => md.Direction == MessageDirection.Input).First();
                MessageDescription responseMessage = operation.Messages.Where(md => md.Direction == MessageDirection.Output).FirstOrDefault();

                if (requestMessage.Action == "*")
                {
                    _passThrough = true;
                }

                actionLookup.Add(requestMessage.Action, operation.SyncMethod);

                if (responseMessage != null)
                {
                    string replyAction = responseMessage.Action;

                    if (replyAction != null)
                    {
                        replyActionLookup.Add(requestMessage.Action, replyAction);
                    }
                }
            }
            lookup.MethodLookup      = actionLookup;
            lookup.ReplyActionLookup = replyActionLookup;

            _lookup = lookup;

            return(lookup);
        }
Пример #5
0
        public void SetProcess(ProcessModel processModel, string gameLanguage = "English", string patchVersion = "latest", bool useLocalCache = true, bool scanAllMemoryRegions = false)
        {
            this.ProcessModel  = processModel;
            this.GameLanguage  = gameLanguage;
            this.UseLocalCache = useLocalCache;

            this.UnsetProcess();

            try
            {
                this.ProcessHandle = UnsafeNativeMethods.OpenProcess(UnsafeNativeMethods.ProcessAccessFlags.PROCESS_VM_ALL, false, (uint)this.ProcessModel.ProcessID);
            }
            catch (Exception)
            {
                this.ProcessHandle = processModel.Process.Handle;
            }
            finally
            {
                Constants.ProcessHandle = this.ProcessHandle;
                this.IsAttached         = true;
            }

            if (this.IsNewInstance)
            {
                this.IsNewInstance = false;

                ActionLookup.Resolve();
                StatusEffectLookup.Resolve();
                ZoneLookup.Resolve();

                this.ResolveMemoryStructures(processModel, patchVersion);
            }

            this.AttachmentWorker = new AttachmentWorker();
            this.AttachmentWorker.StartScanning(processModel);

            this.SystemModules.Clear();
            this.GetProcessModules();

            Scanner.Instance.Locations.Clear();
            Scanner.Instance.LoadOffsets(Signatures.Resolve(processModel, patchVersion), scanAllMemoryRegions);
        }
Пример #6
0
        public MemoryHandler(SharlayanConfiguration configuration)
        {
            this.Configuration = configuration;
            try {
                this.ProcessHandle = UnsafeNativeMethods.OpenProcess(UnsafeNativeMethods.ProcessAccessFlags.PROCESS_VM_ALL, false, (uint)this.Configuration.ProcessModel.ProcessID);
            }
            catch (Exception) {
                this.ProcessHandle = this.Configuration.ProcessModel.Process.Handle;
            }
            finally {
                this.IsAttached = true;
            }

            this.Configuration.ProcessModel.Process.EnableRaisingEvents = true;
            this.Configuration.ProcessModel.Process.Exited += this.Process_OnExited;

            this.GetProcessModules();

            this.Scanner = new Scanner(this);
            this.Reader  = new Reader(this);

            if (this._isNewInstance)
            {
                this._isNewInstance = false;

                Task.Run(
                    async() => {
                    await this.ResolveMemoryStructures();

                    await ActionLookup.Resolve(this.Configuration);
                    await StatusEffectLookup.Resolve(this.Configuration);
                    await ZoneLookup.Resolve(this.Configuration);
                });
            }

            Task.Run(
                async() => {
                Signature[] signatures = await Signatures.Resolve(this.Configuration);
                this.Scanner.LoadOffsets(signatures, this.Configuration.ScanAllRegions);
            });
        }
Пример #7
0
        public void SyncActionWithoutTarget(string hash)
        {
            //푸시를 만들면 이 부분에 수행되어야 한다.
            //스턴 중에도 푸시 액션을 허용해야 함.

            if (ActorProxy.isCantAI)
            {
                return;
            }

            if (_syncActionCoroutine != null)
            {
                SyncAction.OnActionCancel(ActorProxy);
                StopCoroutine(_syncActionCoroutine);
            }

            var action = ActionLookup.GetActionWithoutTarget(hash);

            SyncAction           = action;
            _syncActionCoroutine = StartCoroutine(RunSyncAction(action.Action(ActorProxy)));
        }
Пример #8
0
        ActionLookup initActionLookup(SubscriptionEndpoint endpoint)
        {
            ActionLookup lookup = null;

            if (_lookup != null) return _lookup;

            lookup = new ActionLookup();

            Dictionary<string, MethodInfo> actionLookup = new Dictionary<string, MethodInfo>();
            Dictionary<string, string> replyActionLookup = new Dictionary<string, string>();
            foreach (OperationDescription operation in ContractDescription.GetContract(endpoint.ContractType).Operations)
            {
                MessageDescription requestMessage = operation.Messages.Where(md => md.Direction == MessageDirection.Input).First();
                MessageDescription responseMessage = operation.Messages.Where(md => md.Direction == MessageDirection.Output).FirstOrDefault();

                if (requestMessage.Action == "*")
                {
                    _passThrough = true;
                }

                actionLookup.Add(requestMessage.Action, operation.SyncMethod);

                if (responseMessage != null)
                {
                    string replyAction = responseMessage.Action;

                    if (replyAction != null)
                    {
                        replyActionLookup.Add(requestMessage.Action, replyAction);
                    }
                }

            }
            lookup.MethodLookup = actionLookup;
            lookup.ReplyActionLookup = replyActionLookup;

            _lookup = lookup;

            return lookup;
        }
Пример #9
0
        public async Task SetProcess(ProcessModel processModel, string gameLanguage = "English", string patchVersion = "latest", bool useLocalCache = true, bool scanAllMemoryRegions = false)
        {
            this.ProcessModel  = processModel;
            this.GameLanguage  = gameLanguage;
            this.UseLocalCache = useLocalCache;

            this.UnsetProcess();

            try {
                this.ProcessHandle = UnsafeNativeMethods.OpenProcess(UnsafeNativeMethods.ProcessAccessFlags.PROCESS_VM_ALL, false, (uint)this.ProcessModel.ProcessID);
            }
            catch (Exception) {
                this.ProcessHandle = processModel.Process.Handle;
            }
            finally {
                Constants.ProcessHandle = this.ProcessHandle;
                this.IsAttached         = true;
            }

            if (this.IsNewInstance)
            {
                this.IsNewInstance = false;

                //Parallel.Invoke(async () => await ActionLookup.Resolve(), async () => await StatusEffectLookup.Resolve(), async () => await ZoneLookup.Resolve());
                Task[] taskArray = new Task[3];

                taskArray[0] = Task.Factory.StartNew(async() => await ActionLookup.Resolve());
                taskArray[1] = Task.Factory.StartNew(async() => await StatusEffectLookup.Resolve());
                taskArray[2] = Task.Factory.StartNew(async() => await ZoneLookup.Resolve());

                Task.WaitAll(taskArray);
                //await ActionLookup.Resolve();
                //await StatusEffectLookup.Resolve();
                //await ZoneLookup.Resolve();


                await this.ResolveMemoryStructures(processModel, patchVersion);
            }

            this.AttachmentWorker = new AttachmentWorker();
            this.AttachmentWorker.StartScanning(processModel);

            this.SystemModules.Clear();
            this.GetProcessModules();

            Scanner.Instance.Locations.Clear();
            var signatures = await Signatures.Resolve(processModel, patchVersion);

            List <Signature> sigs = signatures as List <Signature>;

            sigs.Add(new Signature
            {
                Key         = "INVENTORYBAGS",
                PointerPath = new List <long>
                {
                    0x15786f0
                }
            });

            sigs.Add(new Signature
            {
                Key         = "INVENTORYSTART",
                PointerPath = new List <long>
                {
                    0x1c1de30
                }
            });
            Scanner.Instance.LoadOffsets(sigs, scanAllMemoryRegions);
        }
Пример #10
0
 public Sharlayan.Models.XIVDatabase.ActionItem GetActionInfo(uint id) => ActionLookup.GetActionInfo(id);
Пример #11
0
        static void Main(string[] args)
        {
            var stringReader = new StringReader(XElement.Load("./Bootstrapper.exe.nlog").ToString());

            using (XmlReader xmlReader = XmlReader.Create(stringReader)) {
                LogManager.Configuration = new XmlLoggingConfiguration(xmlReader, null);
            }

            ActionLookup.GetActionInfo(2);
            StatusEffectLookup.GetStatusInfo(2);
            ZoneLookup.GetZoneInfo(138);

            ActionItem action = ActionLookup.GetActionInfo(2);
            StatusItem status = StatusEffectLookup.GetStatusInfo(2);
            MapItem    zone   = ZoneLookup.GetZoneInfo(138);

            var processName = "ffxiv_dx11";

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                processName = "ffxiv_dx11.exe";
            }

            Process process = Process.GetProcessesByName(processName).FirstOrDefault();

            if (process == null && RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                var ps = new Process();
                ps.StartInfo = new ProcessStartInfo("ps", "-Ao pid,command");
                ps.StartInfo.RedirectStandardOutput = true;
                ps.Start();
                var content = ps.StandardOutput.ReadToEnd();
                ps.WaitForExit(2000);

                var pid = content.Split(Environment.NewLine).Where(x => x.Contains(processName)).Select(x => Enumerable.FirstOrDefault(x.Split(' '))).FirstOrDefault(x => x != null);
                if (!string.IsNullOrEmpty(pid))
                {
                    process = Process.GetProcessById(int.Parse(pid));
                }
            }

            if (process != null)
            {
                MemoryHandler.Instance.SetProcess(
                    new ProcessModel {
                    IsWin64 = true,
                    Process = process,
                });

                MemoryHandler.Instance.SignaturesFoundEvent += delegate(object sender, SignaturesFoundEvent e) {
                    foreach (KeyValuePair <string, Signature> kvp in e.Signatures)
                    {
                        Console.WriteLine($"{kvp.Key} => {kvp.Value.GetAddress():X}");
                    }
                };

                while (Scanner.Instance.IsScanning)
                {
                    Thread.Sleep(1000);
                    Console.WriteLine("Scanning...");
                }
            }

            Console.WriteLine("To exit this application press \"Enter\".");
            Console.ReadLine();
        }