public LoadProxyActivationStatusCommandHandler( Plugins plugins, IInjectionService injectionService) { _plugins = plugins; _injectionService = injectionService; }
public StartGameCommandHandler( Plugins plugins, IGameRepository gamesRepository, IInjectionService injectionService) { _plugins = plugins; _gameRepository = gamesRepository; _injectionService = injectionService; }
private async Task Watch() { await Task.Delay(500); IInjectionService injection = App.Services.Get <IInjectionService>(); while (this.IsAlive) { try { await Task.Delay(1000); Selection.Modes mode = this.GetMode(); IBaseMemoryOffset baseOffset = mode == Selection.Modes.GPose ? Offsets.Gpose : Offsets.Target; ActorTypes type = baseOffset.GetValue(Offsets.ActorType); string name = baseOffset.GetValue(Offsets.Name); // Hide name while debugging #if DEBUG name = "Tester"; #endif string actorId = mode.ToString() + "_" + name; if (string.IsNullOrEmpty(actorId)) { this.CurrentGameTarget = null; continue; } if (this.CurrentGameTarget == null || this.CurrentGameTarget.Type != type || this.CurrentGameTarget.ActorId != actorId || this.CurrentGameTarget.Mode != mode) { this.CurrentGameTarget = new Selection(type, baseOffset, actorId, name, mode); } if (this.UseGameTarget && this.CurrentSelection != this.CurrentGameTarget) { this.CurrentSelection = this.CurrentGameTarget; } } catch (MemoryException) { // If the user has _never_ selected anything in game, then the memory wont be read correctly. // once the user has selected something, even if they then select nothing, the memory will work // fine, leaving the old selected behind. // so in this case, we just swallow the error, and let the thread loop. } catch (Exception ex) { Log.Write(ex); } } }
public Task Start() { IInjectionService injection = Services.Get <IInjectionService>(); this.gposeMem = injection.GetMemory(Offsets.Main.GposeCheck); this.gposeMem2 = injection.GetMemory(Offsets.Main.GposeCheck2); Task.Run(this.Watch); return(Task.CompletedTask); }
public SimplePoseViewModel(Selection selection) { injection = Module.Services.Get <IInjectionService>(); this.skel1Mem = Offsets.SkeletonOffset1.GetMemory(); this.skel2Mem = Offsets.SkeletonOffset2.GetMemory(); this.skel3Mem = Offsets.SkeletonOffset3.GetMemory(); this.phys1Mem = Offsets.PhysicsOffset1.GetMemory(); this.phys2Mem = Offsets.PhysicsOffset2.GetMemory(); this.appearance = selection.BaseAddress.GetMemory(Offsets.ActorAppearance); this.GenerateBones(selection); }
public TargetSelectorView() { this.InitializeComponent(); if (DesignerProperties.GetIsInDesignMode(this)) { return; } this.selection = App.Services.Get <SelectionService>(); this.injection = App.Services.Get <IInjectionService>(); this.DataContext = this; this.GetEntities(); }
public Task Initialize() { IInjectionService injection = Services.Get <IInjectionService>(); this.skel1Mem = injection.GetMemory(Offsets.Main.Skeleton1Flag); this.skel2Mem = injection.GetMemory(Offsets.Main.Skeleton2Flag); this.skel3Mem = injection.GetMemory(Offsets.Main.Skeleton3Flag); this.skel4Mem = injection.GetMemory(Offsets.Main.Skeleton4flag); this.skel5Mem = injection.GetMemory(Offsets.Main.Skeleton5Flag); this.skel6Mem = injection.GetMemory(Offsets.Main.Skeleton6Flag); this.phys1Mem = injection.GetMemory(Offsets.Main.Physics1Flag); this.phys2Mem = injection.GetMemory(Offsets.Main.Physics2Flag); this.phys3Mem = injection.GetMemory(Offsets.Main.Physics3Flag); this.selectionService = Services.Get <ISelectionService>(); this.selectionService.ModeChanged += this.Selection_ModeChanged; return(Task.CompletedTask); }
public GameSettingsWatchableProcess( AggregateId gameId, Plugins plugins, string communicationAddress, ushort communicationPort, ComponentAssembler assembler, IDirectoryRepository directoryRepository, IGameRepository gamesRepository, IInjectionService injectionService, ILogger logger) { GameId = gameId; _plugins = plugins; _communicationAddress = communicationAddress; _communicationPort = communicationPort; _assembler = assembler; _directoryRepository = directoryRepository; _gameRepository = gamesRepository; _injectionService = injectionService; _logger = logger; }
public static void TickAllActiveMemory() { IInjectionService injection = Services.Get <IInjectionService>(); List <MemoryBase> memories; lock (ActiveMemory) { memories = new List <MemoryBase>(ActiveMemory); } foreach (MemoryBase memory in memories) { if (!injection.ProcessIsAlive) { return; } memory.Tick(); } }
public GameSettingsProcessWatcher( Plugins plugins, string communicationAddress, ushort communicationPort, ComponentAssembler assembler, IDirectoryRepository directoryRepository, IGameRepository gameRepository, IInjectionService injectionService, ILogger logger, IProcessWatcher processWatcher) { _plugins = plugins; _communicationAddress = communicationAddress; _communicationPort = communicationPort; _assembler = assembler; _directoryRepository = directoryRepository; _injectionService = injectionService; _gameRepository = gameRepository; _logger = logger; _processWatcher = processWatcher; }
private void WatchCamera() { IInjectionService injection = Services.Get <IInjectionService>(); IMemory <float> camX = injection.GetMemory(Offsets.Main.CameraOffset, Offsets.Main.CameraAngleX); IMemory <float> camY = injection.GetMemory(Offsets.Main.CameraOffset, Offsets.Main.CameraAngleY); IMemory <float> camZ = injection.GetMemory(Offsets.Main.CameraOffset, Offsets.Main.CameraRotation); IMemory <float> camDist = injection.GetMemory(Offsets.Main.CameraOffset, Offsets.Main.CameraCurrentZoom); Vector3D camEuler = default; bool vis = true; while (vis && Application.Current != null) { camEuler.Y = (float)MathUtils.RadiansToDegrees((double)camX.Value) - 180; camEuler.Z = (float)-MathUtils.RadiansToDegrees((double)camY.Value); camEuler.X = (float)MathUtils.RadiansToDegrees((double)camZ.Value); Quaternion q = camEuler.ToQuaternion(); try { Application.Current.Dispatcher.Invoke(() => { vis = this.IsVisible; ////&& this.IsEnabled; Transform3DGroup g = new Transform3DGroup(); g.Children.Add(new TranslateTransform3D(0, 0.75, -(camDist.Value - 1))); g.Children.Add(new RotateTransform3D(new QuaternionRotation3D(q))); this.Viewport.Camera.Transform = g; }); } catch (Exception) { } Thread.Sleep(16); } }
public async Task SelectActor(Actor actor) { IInjectionService injection = Services.Get <IInjectionService>(); using IMemory <int> territoryMem = injection.GetMemory(Offsets.Main.TerritoryAddress, Offsets.Main.Territory); int territoryId = territoryMem.Value; bool isBarracks = false; isBarracks |= territoryId == 534; // Twin adder barracks isBarracks |= territoryId == 535; // Immortal Flame barracks isBarracks |= territoryId == 536; // Maelstrom barracks // Mannequins and housing NPC's get actor type changed, but squadron members do not. if (!isBarracks && actor.Type == ActorTypes.EventNpc) { bool?result = await GenericDialog.Show($"The Actor: \"{actor.Name}\" appears to be a humanoid NPC. Do you want to change them to a player to allow for posing and appearance changes?", "Actor Selection", MessageBoxButton.YesNo); if (result == null) { return; } if (result == true) { actor.SetValue(Offsets.Main.ActorType, ActorTypes.Player); actor.Type = ActorTypes.Player; await actor.ActorRefreshAsync(); if (actor.GetValue(Offsets.Main.ModelType) != 0) { actor.SetValue(Offsets.Main.ModelType, 0); await actor.ActorRefreshAsync(); } } } // Carbuncles get model type set to player (but not actor type!) if (actor.Type == ActorTypes.BattleNpc) { int modelType = actor.GetValue(Offsets.Main.ModelType); if (modelType == 409 || modelType == 410 || modelType == 412) { bool?result = await GenericDialog.Show($"The Actor: \"{actor.Name}\" appears to be a Carbuncle. Do you want to change them to a player to allow for posing and appearance changes?", "Actor Selection", MessageBoxButton.YesNo); if (result == null) { return; } if (result == true) { actor.SetValue(Offsets.Main.ModelType, 0); await actor.ActorRefreshAsync(); } } } this.actors.Add(actor); this.ActorSelected?.Invoke(actor, true); }
public InjectionForUrlController() { this.injectionService = new InjectionService(); }
/// <summary> /// Constructor sets dependent components. /// </summary> /// <param name="injectionService">Creates types, injecting dependent components.</param> /// <param name="listElementServices">Retrieves element services.</param> public ElementFactory(IInjectionService injectionService, IListElementServices listElementServices) { _injectionService = injectionService; _listElementServices = listElementServices; }
public TestInjectionService(IInjectionService injectionService) { injectionService.Inject(this); }
public async Task Start() { IInjectionService injection = Services.Get <IInjectionService>(); string directory = injection.GamePath; if (!IsValidInstallation(directory)) { throw new Exception("Invalid FFXIV installation"); } bool forceUpdate = false; Stopwatch sw = new Stopwatch(); sw.Start(); if (forceUpdate) { if (File.Exists("SaintCoinach.History.zip")) { File.Delete("SaintCoinach.History.zip"); } if (Directory.Exists("./Definitions/")) { Directory.Delete("./Definitions/", true); } } // Unzip definitions if (!Directory.Exists("./Definitions/")) { ZipFile.ExtractToDirectory("./Modules/SaintCoinach/bin/Definitions.zip", "./Definitions/"); } // TODO get language from language service? ARealmReversed realm = new ARealmReversed(directory, Language.English); try { if (!realm.IsCurrentVersion) { realm.Update(true, this); } } catch (Exception ex) { throw new Exception(@"Failed to update Saint Coinach", ex); } List <Task> tasks = new List <Task>(); tasks.Add(Task.Run(() => this.Items = this.Load <Table <IItem>, IItem, Item, ItemWrapper>(realm))); tasks.Add(Task.Run(() => this.Races = this.Load <Table <IRace>, IRace, Race, RaceWrapper>(realm))); tasks.Add(Task.Run(() => this.Tribes = this.Load <Table <ITribe>, ITribe, Tribe, TribeWrapper>(realm))); tasks.Add(Task.Run(() => this.Dyes = this.Load <Table <IDye>, IDye, Stain, DyeWrapper>(realm))); tasks.Add(Task.Run(() => this.BaseNPCs = this.Load <Table <INpcBase>, INpcBase, ENpcBase, NpcBaseWrapper>(realm))); tasks.Add(Task.Run(() => this.Territories = this.Load <Table <ITerritoryType>, ITerritoryType, TerritoryType, TerritoryTypeWrapper>(realm))); tasks.Add(Task.Run(() => this.Weathers = this.Load <Table <IWeather>, IWeather, Weather, WeatherWrapper>(realm))); tasks.Add(Task.Run(() => this.CharacterMakeCustomize = this.Load <CustomizeTable, ICharaMakeCustomize, CharaMakeCustomize, CharacterMakeCustomizeWrapper>(realm))); tasks.Add(Task.Run(() => this.CharacterMakeTypes = this.Load <Table <ICharaMakeType>, ICharaMakeType, CharaMakeType, CharacterMakeTypeWrapper>(realm))); tasks.Add(Task.Run(() => this.ResidentNPCs = this.Load <Table <INpcResident>, INpcResident, ENpcResident, NpcResidentWrapper>(realm))); tasks.Add(Task.Run(() => this.Titles = this.Load <Table <ITitle>, ITitle, Title, TitleWrapper>(realm))); tasks.Add(Task.Run(() => this.Statuses = this.Load <Table <IStatus>, IStatus, Status, StatusWrapper>(realm))); foreach (Task t in tasks) { await t; } Log.Write("Initialization took " + sw.ElapsedMilliseconds + "ms", @"Saint Coinach"); }
/// <summary> /// Constructor sets dependent components. /// </summary> /// <param name="injectionService">Creates types, injecting dependent components.</param> /// <param name="listFormServices">Used to find types of form services.</param> public FormServiceFactory(IInjectionService injectionService, IListFormServices listFormServices) { _injectionService = injectionService; _listFormServices = listFormServices; }
public Task Start() { this.selectionService = Services.Get <SelectionService>(); this.injectionService = Services.Get <IInjectionService>(); return(Task.CompletedTask); }