public void DisplaySongTitle(string songTitle) { if (!Configuration.DisplayChatMessages) { return; } var message = PluginInterface.UiLanguage switch { "ja" => new SeString(new Payload[] { new TextPayload($"「{songTitle}」を再生しました。"), // 「Weight of the World/Prelude Version」を再生しました。 }), "de" => new SeString(new Payload[] { new TextPayload($"„{songTitle}“ wird nun wiedergegeben."), // „Weight of the World (Prelude Version)“ wird nun wiedergegeben. }), "fr" => new SeString(new Payload[] { new TextPayload($"Le FantasyPlayer lit désormais “{songTitle}”."), // L'orchestrion joue désormais “Weight of the World (Prelude Version)”. }), _ => new SeString(new Payload[] { new EmphasisItalicPayload(true), new TextPayload(songTitle), // _Weight of the World (Prelude Version)_ is now playing. new EmphasisItalicPayload(false), new TextPayload(" is now playing."), }), }; ChatGui.Print(message); }
private void FrameworkOnOnUpdateEvent(Framework framework) { if (this.Disable) { this.characterDrawResolver.ShowAll(); this.Disable = false; if (this.refresh) { Task.Run( async() => { await Task.Delay(250); this.Configuration.Enabled = true; ChatGui.Print(this.PluginLocalization.RefreshComplete); }); } this.refresh = false; } else if (this.refresh) { this.Disable = true; this.Configuration.Enabled = false; } }
public void DisplayMessage(string message) { if (Configuration.DisplayChatMessages) { ChatGui.Print(message); } }
public void Log(string message, string detail_message = "") { //if (!Config.PrintMessage) return; var msg = $"[{Name}] {message}"; PluginLog.Log(detail_message == "" ? msg : detail_message); ChatGui.Print(msg); }
public void Log(string message) { if (!Config.PrintMessage) { return; } var msg = $"[{Name}] {message}"; PluginLog.Log(msg); ChatGui.Print(msg); }
private void Update(Dalamud.Game.Framework framework) { if (!this.config.enabled) { return; } var wasInFateArea = inFateArea; inFateArea = Marshal.ReadByte(inFateAreaPtr) == 1; if (wasInFateArea != inFateArea) { if (inFateArea) { if (firstRun) { chat.Print("FATE Auto Sync ran for the first time in this session (/fateautosync to toggle)"); firstRun = false; } ExecuteCommand("/levelsync on"); } } }
private void OnCommand(string command, string arguments) { if (command.ToLower() != "/sc") { return; } byte[] rndSeries = new byte[4]; _csp.GetBytes(rndSeries); int rnd = (int)Math.Abs(BitConverter.ToUInt32(rndSeries, 0) / _base * 50 + 1); ChatGui.Print(_config.IsEnabled ? $"sancheck: 1d100={rnd + 50}, Failed" : $"sancheck: 1d100={rnd}, Passed"); _config.IsEnabled = !_config.IsEnabled; SetEnabled(_config.IsEnabled); Interface.SavePluginConfig(_config); }
public void WhitelistTargetPlayer(string command, string arguments) { if (ObjectTable.SingleOrDefault( x => x is PlayerCharacter && x.ObjectId != 0 && x.ObjectId != ClientState.LocalPlayer?.ObjectId && x.ObjectId == ClientState.LocalPlayer?.TargetObjectId) is PlayerCharacter actor) { var item = new VoidItem(actor, arguments, false); var playerString = Encoding.UTF8.GetString( new SeString( new TextPayload(actor.Name.TextValue), new IconPayload(BitmapFontIcon.CrossWorld), new TextPayload(actor.HomeWorld.GameData !.Name)).Encode()); if (!this.Configuration.Whitelist.Any( x => x.Name == item.Name && x.HomeworldId == item.HomeworldId)) { this.Configuration.Whitelist.Add(item); this.Configuration.Save(); this.ShowPlayer(actor.ObjectId); ChatGui.Print( this.PluginLocalization.EntryAdded(this.PluginLocalization.WhitelistName, playerString)); } else { ChatGui.Print( this.PluginLocalization.EntryExistsError(this.PluginLocalization.WhitelistName, playerString)); } } else { ChatGui.Print( this.PluginLocalization.InvalidTargetError(this.PluginLocalization.WhitelistName)); } }
public void CommandHandler(string command, string arguments) { var args = arguments.Trim().Replace("\"", string.Empty); if (string.IsNullOrEmpty(args) || args.Equals("config", StringComparison.OrdinalIgnoreCase)) { Gui.ConfigWindow.Visible = !Gui.ConfigWindow.Visible; return; } else if (args == "on") { Config.Enable = true; ToastGui.ShowQuest( String.Format(Localizer.Localize("Auto invite is turned on for \"{0}\""), Config.TextPattern) , new QuestToastOptions { DisplayCheckmark = true, PlaySound = true }); Config.Save(); } else if (args == "off") { Config.Enable = false; ToastGui.ShowQuest(Localizer.Localize("Auto invite is turned off"), new QuestToastOptions { DisplayCheckmark = true, PlaySound = true }); Config.Save(); } else if (args == "toggle") { Config.Enable = !Config.Enable; if (Config.Enable) { ToastGui.ShowQuest( String.Format(Localizer.Localize("Auto invite is turned on for \"{0}\""), Config.TextPattern) , new QuestToastOptions { DisplayCheckmark = true, PlaySound = true }); } else { ToastGui.ShowQuest(Localizer.Localize("Auto invite is turned off"), new QuestToastOptions { DisplayCheckmark = true, PlaySound = true }); } Config.Save(); } else if (timedRecruitment.TryProcessCommandTimedEnable(args)) { //success } else if (CmdManager.Commands.TryGetValue("/xinvite", out var cmdInfo)) { ChatGui.Print(cmdInfo.HelpMessage); } /* * else if (args == "party") * { * unsafe * { * GroupManager* groupManager = (GroupManager*)groupManagerAddress; * var partyMembers = (PartyMember*)groupManager->PartyMembers; * var leader = partyMembers[groupManager->PartyLeaderIndex]; * string leaderName = StringFromNativeUtf8(new IntPtr(leader.Name)); * Log($"MemberCount:{groupManager->MemberCount}"); * Log($"LeaderIndex:{groupManager->PartyLeaderIndex}"); * Log($"LeaderName:{leaderName}"); * Log($"SelfName:{Interface.ClientState.LocalPlayer.Name}"); * Log($"isLeader:{Interface.ClientState.LocalPlayer.Name == leaderName}"); * } * } */ }
public void WhitelistPlayer(string command, string arguments) { if (string.IsNullOrEmpty(arguments)) { ChatGui.Print( this.PluginLocalization.NoArgumentsError(this.PluginLocalization.WhitelistName)); return; } var args = arguments.Split(new[] { ' ' }, 4); if (args.Length < 3) { ChatGui.Print( this.PluginLocalization.NotEnoughArgumentsError(this.PluginLocalization.WhitelistName)); return; } var world = DataManager.GetExcelSheet <World>()?.SingleOrDefault( x => x.DataCenter.Value?.Region != 0 && x.Name.ToString().Equals(args[2], StringComparison.InvariantCultureIgnoreCase)); if (world == default(World)) { ChatGui.Print( this.PluginLocalization.InvalidWorldNameError(this.PluginLocalization.WhitelistName, args[2])); return; } var playerName = $"{args[0].ToUppercase()} {args[1].ToUppercase()}"; var actor = ObjectTable.SingleOrDefault( x => x is PlayerCharacter character && character.HomeWorld.Id == world.RowId && character.Name.TextValue.Equals(playerName, StringComparison.Ordinal)) as PlayerCharacter; var item = actor == null ? new VoidItem( playerName, world.Name, world.RowId, args.Length == 3 ? string.Empty : args[3], command == "WhitelistUIManual") : new VoidItem(actor, args.Length == 3 ? string.Empty : args[3], command == "WhitelistUIManual"); var playerString = Encoding.UTF8.GetString( new SeString( new TextPayload(playerName), new IconPayload(BitmapFontIcon.CrossWorld), new TextPayload(world.Name)).Encode()); if (!this.Configuration.Whitelist.Any( x => x.Name == item.Name && x.HomeworldId == item.HomeworldId)) { this.Configuration.Whitelist.Add(item); this.Configuration.Save(); if (actor != null) { this.ShowPlayer(actor.ObjectId); } ChatGui.Print( this.PluginLocalization.EntryAdded(this.PluginLocalization.WhitelistName, playerString)); } else { ChatGui.Print( this.PluginLocalization.EntryExistsError(this.PluginLocalization.WhitelistName, playerString)); } }
private void PluginCommand(string command, string arguments) { if (this.refresh) { return; } if (string.IsNullOrEmpty(arguments)) { this.drawConfig = !this.drawConfig; } else { var args = arguments.Split(new[] { ' ' }, 2); if (args[0].Equals("help", StringComparison.InvariantCultureIgnoreCase)) { ChatGui.Print(this.PluginLocalization.PluginCommandHelpMenu1); ChatGui.Print(this.PluginLocalization.PluginCommandHelpMenu2); ChatGui.Print(this.PluginLocalization.PluginCommandHelpMenu3); ChatGui.Print(this.PluginLocalization.PluginCommandHelpMenu4); foreach (var key in this.Configuration.SettingDictionary.Keys) { ChatGui.Print($"{key}"); } return; } if (args[0].Equals("refresh", StringComparison.InvariantCulture)) { this.RefreshActors(); return; } if (args.Length != 2) { ChatGui.Print(this.PluginLocalization.PluginCommandHelpMenuError); return; } if (!this.Configuration.SettingDictionary.Keys.Any( x => x.Equals(args[0], StringComparison.InvariantCultureIgnoreCase))) { ChatGui.Print( this.PluginLocalization.PluginCommandHelpMenuInvalidValueError(args[0])); return; } int value; switch (args[1].ToLowerInvariant()) { case "0": case "off": case "false": value = 0; break; case "1": case "on": case "true": value = 1; break; case "toggle": value = 2; break; default: ChatGui.Print( this.PluginLocalization.PluginCommandHelpMenuInvalidValueError(args[1])); return; } this.Configuration.SettingDictionary[args[0].ToLowerInvariant()].Invoke(value); this.Configuration.Save(); } }
private void OnCommandDebugCombo(string command, string arguments) { var argumentsParts = arguments.Split(); switch (argumentsParts[0]) { case "setall": { foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast <CustomComboPreset>()) { if (value == CustomComboPreset.None) { continue; } this.Configuration.ComboPresets |= value; } ChatGui.Print("all SET"); } break; case "unsetall": { foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast <CustomComboPreset>()) { this.Configuration.ComboPresets &= value; } ChatGui.Print("all UNSET"); } break; case "set": { foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast <CustomComboPreset>()) { if (value.ToString().ToLower() != argumentsParts[1].ToLower()) { continue; } this.Configuration.ComboPresets |= value; } } break; case "toggle": { foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast <CustomComboPreset>()) { if (value.ToString().ToLower() != argumentsParts[1].ToLower()) { continue; } this.Configuration.ComboPresets ^= value; } } break; case "unset": { foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast <CustomComboPreset>()) { if (value.ToString().ToLower() != argumentsParts[1].ToLower()) { continue; } this.Configuration.ComboPresets &= ~value; } } break; case "list": { foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast <CustomComboPreset>().Where(x => x != CustomComboPreset.None)) { if (argumentsParts[1].ToLower() == "set") { if (this.Configuration.ComboPresets.HasFlag(value)) { ChatGui.Print(value.ToString()); } } else if (argumentsParts[1].ToLower() == "all") { ChatGui.Print(value.ToString()); } } } break; default: this.isImguiComboSetupOpen = true; break; } PluginInterface.SavePluginConfig(this.Configuration); }