private void Startup() { Address = new LockAddressResolver(); Address.Setup(PluginInterface.TargetModuleScanner); PluginLog.Log($"Address Found: {Address.LockFunction.ToInt64():X}"); SetHotbarLock = new Hook <OnHotbarLock>(Address.LockFunction, new OnHotbarLock(HandleOnHotbarLock)); SetHotbarLock.Enable(); PluginLog.Log("Hook Enabled"); started = true; }
public void SearchRecipesByItem(Item item) { if (item == null) { PluginLog.Log("Tried to find recipe for NULL item."); return; } searchQueue.Enqueue(item.RowId); }
public void ExampleCommand1(string command, string args) { // You may want to assign these references to private variables for convenience. // Keep in mind that the local player does not exist until after logging in. var chat = this.pluginInterface.Framework.Gui.Chat; var world = this.pluginInterface.ClientState.LocalPlayer.CurrentWorld.GameData; chat.Print($"Hello {world.Name}!"); PluginLog.Log("Message sent successfully."); }
private unsafe void *GetResourceHandler( bool isSync, IntPtr pFileManager, uint *pCategoryId, char *pResourceType, uint *pResourceHash, char *pPath, void *pUnknown, bool isUnknown ) { var modManager = Service <ModManager> .Get(); if (!Plugin !.Configuration !.IsEnabled || modManager == null) { if (LogAllFiles) { PluginLog.Log("[GetResourceHandler] {0}", GamePath.GenerateUncheckedLower(Marshal.PtrToStringAnsi(new IntPtr(pPath)) !)); } return(CallOriginalHandler(isSync, pFileManager, pCategoryId, pResourceType, pResourceHash, pPath, pUnknown, isUnknown)); } var gameFsPath = GamePath.GenerateUncheckedLower(Marshal.PtrToStringAnsi(new IntPtr(pPath)) !); var replacementPath = modManager.ResolveSwappedOrReplacementFilePath(gameFsPath); if (LogAllFiles) { PluginLog.Log("[GetResourceHandler] {0}", gameFsPath); } // path must be < 260 because statically defined array length :( if (replacementPath == null) { return(CallOriginalHandler(isSync, pFileManager, pCategoryId, pResourceType, pResourceHash, pPath, pUnknown, isUnknown)); } var path = Encoding.ASCII.GetBytes(replacementPath); var bPath = stackalloc byte[path.Length + 1]; Marshal.Copy(path, 0, new IntPtr(bPath), path.Length); pPath = ( char * )bPath; Crc32.Init(); Crc32.Update(path); *pResourceHash = Crc32.Checksum; #if DEBUG PluginLog.Log("[GetResourceHandler] resolved {GamePath} to {NewPath}", gameFsPath, replacementPath); #endif return(CallOriginalHandler(isSync, pFileManager, pCategoryId, pResourceType, pResourceHash, pPath, pUnknown, isUnknown)); }
private void ImportExtendedV2ModPack(ZipFile extractedModPack) { PluginLog.Log(" -> Importing Extended V2 ModPack"); var mpl = extractedModPack.GetEntry("TTMPL.mpl"); var modList = JsonConvert.DeserializeObject <ExtendedModPack>(GetStringFromZipEntry(extractedModPack, mpl, Encoding.UTF8)); // Create a new ModMeta from the TTMP modlist info var modMeta = new ModMeta { Author = modList.Author, Name = modList.Name, Description = string.IsNullOrEmpty(modList.Description) ? "Mod imported from TexTools mod pack" : modList.Description, Version = modList.Version }; // Open the mod data file from the modpack as a SqPackStream using var modData = GetMagicSqPackDeleterStream(extractedModPack, "TTMPD.mpd"); var newModFolder = new DirectoryInfo( Path.Combine(_outDirectory.FullName, Path.GetFileNameWithoutExtension(modList.Name) ) ); newModFolder.Create(); if (modList.SimpleModsList != null) { ExtractSimpleModList(newModFolder, modList.SimpleModsList, modData); } if (modList.ModPackPages == null) { return; } // Iterate through all pages foreach (var option in from modPackPage in modList.ModPackPages from modGroup in modPackPage.ModGroups from option in modGroup.OptionList select option) { var optionFolder = new DirectoryInfo(Path.Combine(newModFolder.FullName, option.Name)); ExtractSimpleModList(optionFolder, option.ModsJsons, modData); AddMeta(optionFolder, newModFolder, modMeta, option.Name); } File.WriteAllText( Path.Combine(newModFolder.FullName, "meta.json"), JsonConvert.SerializeObject(modMeta, Formatting.Indented) ); }
internal static void LoadDefaultLanguage() { try { var currentUiLang = CultureInfo.CurrentUICulture; PluginLog.Log("Trying to set up Loc for culture {0}", currentUiLang.TwoLetterISOLanguageName); LoadLanguage(ApplicableLangCodes.Any(x => currentUiLang.TwoLetterISOLanguageName == x) ? currentUiLang.TwoLetterISOLanguageName : "en"); } catch (Exception ex) { PluginLog.LogError("Could not get language information. Setting up fallbacks. {0}", ex.ToString()); LoadLanguage("en"); } }
public void UpdateSelfRace(Race race) { if (this.config.SelfRace == race) { return; } PluginLog.Log($"SelfRace changed to {race}, refreshing players"); this.config.SelfRace = race; unsavedConfigChanges = true; }
public void ToggleSelfRace(bool changeRace) { if (this.config.SelfChange == changeRace) { return; } PluginLog.Log($"SelfRace toggled to {changeRace}, refreshing players"); this.config.SelfChange = changeRace; unsavedConfigChanges = true; }
public void Log(string message) { if (!Config.PrintMessage) { return; } var msg = $"[{Name}] {message}"; PluginLog.Log(msg); ChatGui.Print(msg); }
public void UpdateOtherTargetRace(Race race) { if (this.config.ChangeOthersTargetRace == race) { return; } PluginLog.Log($"Target race for other players changed to {race}, refreshing players"); this.config.ChangeOthersTargetRace = race; unsavedConfigChanges = true; }
public void UpdateTargetRace(int id) { if (this.config.TargetRace == id) { return; } PluginLog.Log($"TargetRace changed to {id}, refreshing players"); this.config.TargetRace = (byte)id; RefreshAllPlayers(); }
public void UpdateImmersiveMode(bool immersiveMode) { if (this.config.ImmersiveMode == immersiveMode) { return; } PluginLog.Log($"Immersive mode set to {immersiveMode}, refreshing players"); this.config.ImmersiveMode = immersiveMode; unsavedConfigChanges = true; }
public override void SaveData() { if (!Sync.IsServer || !SettingsSession.Static.Settings.Enable) { return; } PluginLog.Log("Saving system data"); SaveConfig(); }
public void ToggleOtherRace(bool changeRace) { if (this.config.ShouldChangeOthers == changeRace) { return; } PluginLog.Log($"Target race for other players toggled to {changeRace}, refreshing players"); this.config.ShouldChangeOthers = changeRace; unsavedConfigChanges = true; }
private void OnStopServer() { // Start the Nancy Host. try { Host.Stop(); IsServerStarted = false; PluginLog.Log($"HTTP server Stoped!"); } catch (Exception ex) { PluginLog.LogError($"{ex}\nCould not Stop the HTTP server!"); } }
public void Dispose() { disposed = true; var c = 0; PluginLog.Log("Disposing icon textures"); foreach (var texture in iconTextures.Values.Where(texture => texture != null)) { c++; texture.Dispose(); } PluginLog.Log($"Disposed {c} icon textures."); iconTextures.Clear(); }
public void Enable() { if (!IsActive) { OriginalBytes = Memory.Read(Address, Bytes.Length); Memory.Write(Address, Bytes); IsActive = true; PluginLog.Log($"Enabled patch {Definition.Name}"); } }
public void Disable() { if (IsActive) { Memory.Write(Address, OriginalBytes); OriginalBytes = null; IsActive = false; PluginLog.Log($"Disabled patch {Definition.Name}"); } }
public SeString getName(SeString sender, XivChatType type, SeString message) { var playerPayload = sender.Payloads.SingleOrDefault(x => x is PlayerPayload) as PlayerPayload; if (type is XivChatType.StandardEmote) { playerPayload = message.Payloads.FirstOrDefault(x => x is PlayerPayload) as PlayerPayload; } var pName = playerPayload == default(PlayerPayload) ? ClientState.LocalPlayer.Name.TextValue : playerPayload.PlayerName; PluginLog.Log(pName); return(pName); }
private void OnStartServer() { Host = new NancyHost(new MacroBootstrapper(), new Uri($"http://localhost:{Port}")); // Start the Nancy Host. try { Host.Start(); IsServerStarted = true; PluginLog.Log($"HTTP server Started on http://localhost:{Port}!"); } catch (Exception ex) { PluginLog.LogError($"{ex}\nCould not start the HTTP server!"); } }
protected override void UnloadData() { PluginLog.Log("Unloading system generator data"); UnloadNet(); m_objects?.Clear(); m_planetDefinitions?.Clear(); m_moonDefinitions?.Clear(); m_mandatoryPlanets?.Clear(); m_gasGiants?.Clear(); m_settings = null; Static = null; }
protected override void OnSoundLoop(SystemSoundQueueItem nextItem) { this.speechSynthesizer.UseVoicePreset(nextItem.Preset); var ssml = this.lexiconManager.MakeSsml(nextItem.Text, this.speechSynthesizer.Voice.Culture.IetfLanguageTag); PluginLog.Log(ssml); this.speechSynthesizer.SpeakSsmlAsync(ssml); // Waits for the AutoResetEvent lock in the callback to fire. this.speechCompleted.WaitOne(); }
public static void OnHttpRecivedMacroData(string data) { PluginLog.Log($"HTTPAction Received:{data}"); if (macroBasePtr != IntPtr.Zero && macroPtr != IntPtr.Zero) { string[] macroLines = (data).Split('|'); for (int i = 0; i < macroLines.Length; i++) { WriteMacroUnit(macroPtr, macroLines[i]); macroCallHook.Original(macroBasePtr + 642424, macroPtr, macroBasePtr); } } }
private EquipData MapRacialEquipModels(int race, int gender, EquipData eq) { if (Array.IndexOf(RACE_STARTER_GEAR_IDS, eq.model) > -1) { PluginLog.Log($"Modified {eq.model}, {eq.variant}"); PluginLog.Log($"Race {race}, index {race - 1}, gender {gender}"); eq.model = RACE_STARTER_GEAR_ID_MAP[race - 1, gender]; eq.variant = 1; PluginLog.Log($"New {eq.model}, {eq.variant}"); } return(eq); }
public void UpdateOtherSourceRace(Race?race) { if (this.config.ChangeOthersSourceRace == race) { return; } String newRace = race.HasValue ? $"{race.Value}" : "Any"; PluginLog.Log($"Source race for other players changed to {newRace}, refreshing players"); this.config.ChangeOthersSourceRace = race; unsavedConfigChanges = true; }
private HousingData(DataManager dataMgr) { var sheet = dataMgr.GetExcelSheet <HousingLandSet>(); uint[] terriKeys = { 339, 340, 341, 641, 979 }; _territoryToLandSetDict = new Dictionary <uint, Dictionary <uint, CommonLandSet> >(); for (uint i = 0; i < sheet.RowCount; i++) { if (terriKeys.Length < i) { continue; } var row = sheet.GetRow(i); var rowDict = new Dictionary <uint, CommonLandSet>(); for (var j = 0; j < row.LandSets.Length; j++) { var cset = CommonLandSet.FromExd(row.LandSets[j], j); rowDict[cset.PlacardId] = cset; } _territoryToLandSetDict[terriKeys[i]] = rowDict; } var unitedExteriorSheet = dataMgr.GetExcelSheet <HousingUnitedExterior>(); _unitedDict = new Dictionary <uint, uint>(); foreach (var row in unitedExteriorSheet) { foreach (var item in row.Item) { _unitedDict[item.Row] = row.RowId; } } _itemDict = dataMgr.GetExcelSheet <Item>() .Where(item => item.AdditionalData != 0 && (item.ItemSearchCategory.Row == 65 || item.ItemSearchCategory.Row == 66)) .ToDictionary(row => row.AdditionalData, row => row); _stainDict = dataMgr.GetExcelSheet <Stain>().ToDictionary(row => row.RowId, row => row); _furnitureDict = dataMgr.GetExcelSheet <HousingFurniture>().ToDictionary(row => row.RowId, row => row); _yardObjectDict = dataMgr.GetExcelSheet <HousingYardObject>().ToDictionary(row => row.RowId, row => row); PluginLog.Log($"Loaded {_territoryToLandSetDict.Keys.Count} landset rows"); PluginLog.Log($"Loaded {_furnitureDict.Keys.Count} furniture"); PluginLog.Log($"Loaded {_yardObjectDict.Keys.Count} yard objects"); PluginLog.Log($"Loaded {_unitedDict.Keys.Count} united parts"); PluginLog.Log($"Loaded {_stainDict.Keys.Count} stain infos"); PluginLog.Log($"Loaded {_itemDict.Keys.Count} items with AdditionalData"); }
private void ImportExtendedV2ModPack(ZipFile extractedModPack) { PluginLog.Log(" -> Importing Extended V2 ModPack"); var modList = JsonConvert.DeserializeObject <ExtendedModPack>(GetStringFromZipEntry(extractedModPack["TTMPL.mpl"], Encoding.UTF8)); // Create a new ModMeta from the TTMP modlist info var modMeta = new ModMeta { Author = modList.Author, Name = modList.Name, Description = string.IsNullOrEmpty(modList.Description) ? "Mod imported from TexTools mod pack" : modList.Description }; // Open the mod data file from the modpack as a SqPackStream var modData = GetSqPackStreamFromZipEntry(extractedModPack["TTMPD.mpd"]); var newModFolder = new DirectoryInfo(Path.Combine(_outDirectory.FullName, Path.GetFileNameWithoutExtension(modList.Name))); newModFolder.Create(); File.WriteAllText(Path.Combine(newModFolder.FullName, "meta.json"), JsonConvert.SerializeObject(modMeta)); if (modList.SimpleModsList != null) { ExtractSimpleModList(newModFolder, modList.SimpleModsList, modData); } if (modList.ModPackPages == null) { return; } // Iterate through all pages // For now, we are just going to import the default selections // TODO: implement such a system in resrep? foreach (var option in from modPackPage in modList.ModPackPages from modGroup in modPackPage.ModGroups from option in modGroup.OptionList where option.IsChecked select option) { ExtractSimpleModList(newModFolder, option.ModsJsons, modData); } }
public unsafe void Initialize(DalamudPluginInterface pluginInterface) { setNamePlatePtr = pluginInterface.TargetModuleScanner.ScanText("48 89 5C 24 ?? 48 89 6C 24 ?? 56 57 41 54 41 56 41 57 48 83 EC 40 44 0F B6 E2"); setNamePlate = new SetNamePlate(setNamePlateFunc); try { setNamePlateHook = new Hook <SetNamePlate>(setNamePlatePtr, setNamePlate, this); setNamePlateHook.Enable(); } catch (Exception e) { PluginLog.Log("BAD 1\n" + e.ToString()); } scaleIconPtr = pluginInterface.TargetModuleScanner.ScanText("8B 81 ?? ?? ?? ?? A8 01 75 ?? F3 0F 10 41 ?? 0F 2E C1 7A ?? 75 ?? F3 0F 10 41 ?? 0F 2E C2 7A ?? 74 ?? 83 C8 01 89 81 ?? ?? ?? ?? F3 0F 10 05 ?? ?? ?? ??"); scaleIcon = Marshal.GetDelegateForFunctionPointer <scaleIconFunc>(scaleIconPtr); var GetBaseUIObject = pluginInterface.TargetModuleScanner.ScanText("E8 ?? ?? ?? ?? 41 b8 01 00 00 00 48 8d 15 ?? ?? ?? ?? 48 8b 48 20 e8 ?? ?? ?? ?? 48 8b cf"); var GetUI2ObjByName = pluginInterface.TargetModuleScanner.ScanText("e8 ?? ?? ?? ?? 48 8b cf 48 89 87 ?? ?? 00 00 e8 ?? ?? ?? ?? 41 b8 01 00 00 00"); getBaseUIObj = Marshal.GetDelegateForFunctionPointer <GetBaseUIObjDelegate>(GetBaseUIObject); getUI2ObjByName = Marshal.GetDelegateForFunctionPointer <GetUI2ObjByNameDelegate>(GetUI2ObjByName); this.pluginInterface = pluginInterface; Configuration = pluginInterface.GetPluginConfig() as Config ?? new Config(); role = Configuration.Role; enabled = Configuration.Enabled; scaler = Configuration.Scale; xAdjust = Configuration.XAdjust; yAdjust = Configuration.YAdjust; this.pluginInterface.CommandManager.AddHandler("/jicons", new CommandInfo(Command) { HelpMessage = "Opens Job Icons config." }); baseUIObject = getBaseUIObj(); baseUiProperties = Marshal.ReadIntPtr(baseUIObject, 0x20); UIModulePtr = Marshal.ReadIntPtr(pluginInterface.Framework.Address.BaseAddress, 0x29F8); UI3DModule = Marshal.ReadIntPtr(UIModulePtr, 0xA62C0); RaptureAtkModule = (RaptureAtkModule *)(Marshal.ReadIntPtr(pluginInterface.Framework.Address.BaseAddress, 0x29F8) + 0xB3780).ToPointer(); nameplateUIPtr = getUI2ObjByName(baseUiProperties, "NamePlate", 1); if (nameplateUIPtr != IntPtr.Zero) { npObjArray = ((AddonNamePlate *)nameplateUIPtr)->NamePlateObjectArray; } this.pluginInterface.UiBuilder.OnOpenConfigUi += ConfigWindow; this.pluginInterface.UiBuilder.OnBuildUi += DrawWindow; }
/// <summary> /// Saves the global configuration file /// </summary> public void SaveSettings() { FileUtils.DeleteFileInGlobalStorage(FILENAME); string xml = FileUtils.SerializeToXml(Settings); PluginLog.Log("Saving global SEWorldGenPlugin config file: " + xml); using (var writer = FileUtils.WriteFileInGlobalStorage(FILENAME)) { writer.Write(xml); writer.Close(); } }
public override void Init(MyObjectBuilder_SessionComponent sessionComponent) { PluginLog.Log("Initializing procedural generator"); if (!Sync.IsServer || !SettingsSession.Static.Settings.Enable || MySession.Static.Settings.WorldSizeKm > 0) { return; } base.Init(sessionComponent); Enabled = true; m_seed = MySession.Static.Settings.ProceduralSeed; }