mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
Merge pull request #246 from Aireil/add_ll_back
This commit is contained in:
commit
6545c097da
2 changed files with 23 additions and 0 deletions
|
|
@ -54,6 +54,10 @@ namespace Dalamud
|
||||||
HelpMessage = Loc.Localize("DalamudUnmuteHelp", "Unmute a word or sentence. Usage: /xlunmute <word or sentence>")
|
HelpMessage = Loc.Localize("DalamudUnmuteHelp", "Unmute a word or sentence. Usage: /xlunmute <word or sentence>")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.dalamud.CommandManager.AddHandler("/ll", new CommandInfo(OnLastLinkCommand) {
|
||||||
|
HelpMessage = Loc.Localize("DalamudLastLinkHelp", "Open the last posted link in your default browser.")
|
||||||
|
});
|
||||||
|
|
||||||
this.dalamud.CommandManager.AddHandler("/xlbgmset", new CommandInfo(OnBgmSetCommand)
|
this.dalamud.CommandManager.AddHandler("/xlbgmset", new CommandInfo(OnBgmSetCommand)
|
||||||
{
|
{
|
||||||
HelpMessage = Loc.Localize("DalamudBgmSetHelp", "Set the Game background music. Usage: /xlbgmset <BGM ID>")
|
HelpMessage = Loc.Localize("DalamudBgmSetHelp", "Set the Game background music. Usage: /xlbgmset <BGM ID>")
|
||||||
|
|
@ -171,6 +175,16 @@ namespace Dalamud
|
||||||
string.Format(Loc.Localize("DalamudUnmuted", "Unmuted \"{0}\"."), arguments));
|
string.Format(Loc.Localize("DalamudUnmuted", "Unmuted \"{0}\"."), arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnLastLinkCommand(string command, string arguments) {
|
||||||
|
if (string.IsNullOrEmpty(this.dalamud.ChatHandlers.LastLink)) {
|
||||||
|
this.dalamud.Framework.Gui.Chat.Print(Loc.Localize("DalamudNoLastLink", "No last link..."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dalamud.Framework.Gui.Chat.Print(string.Format(Loc.Localize("DalamudOpeningLink", "Opening {0}"), this.dalamud.ChatHandlers.LastLink));
|
||||||
|
Process.Start(this.dalamud.ChatHandlers.LastLink);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnBgmSetCommand(string command, string arguments) {
|
private void OnBgmSetCommand(string command, string arguments) {
|
||||||
this.dalamud.Framework.Gui.SetBgm(ushort.Parse(arguments));
|
this.dalamud.Framework.Gui.SetBgm(ushort.Parse(arguments));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,14 @@ namespace Dalamud.Game {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private readonly Regex urlRegex =
|
||||||
|
new Regex(@"((http|ftp|https)://)?([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?",
|
||||||
|
RegexOptions.Compiled);
|
||||||
|
|
||||||
private bool hasSeenLoadingMsg;
|
private bool hasSeenLoadingMsg;
|
||||||
|
|
||||||
|
public string LastLink { get; private set; }
|
||||||
|
|
||||||
public ChatHandlers(Dalamud dalamud) {
|
public ChatHandlers(Dalamud dalamud) {
|
||||||
this.dalamud = dalamud;
|
this.dalamud = dalamud;
|
||||||
|
|
||||||
|
|
@ -160,6 +166,9 @@ namespace Dalamud.Game {
|
||||||
var messageCopy = message;
|
var messageCopy = message;
|
||||||
var senderCopy = sender;
|
var senderCopy = sender;
|
||||||
|
|
||||||
|
var linkMatch = this.urlRegex.Match(message.TextValue);
|
||||||
|
if (linkMatch.Value.Length > 0)
|
||||||
|
LastLink = linkMatch.Value;
|
||||||
|
|
||||||
// Handle all of this with SeString some day
|
// Handle all of this with SeString some day
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue