mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 12:23:39 +01:00
feat: implement roulette bonus notification command
This commit is contained in:
parent
375807de1a
commit
130fbe8639
2 changed files with 46 additions and 12 deletions
|
|
@ -18,14 +18,16 @@ namespace Dalamud
|
||||||
|
|
||||||
public List<string> BadWords { get; set; }
|
public List<string> BadWords { get; set; }
|
||||||
|
|
||||||
public List<Tuple<int, int>> PreferredRoleReminders { get; set; }
|
public enum PreferredRole
|
||||||
|
{
|
||||||
public class FateInfo {
|
None,
|
||||||
public string Name { get; set; }
|
All,
|
||||||
public int Id { get; set; }
|
Tank,
|
||||||
|
Dps,
|
||||||
|
Healer
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FateInfo> Fates;
|
public Dictionary<int, PreferredRole> PreferredRoleReminders { get; set; }
|
||||||
|
|
||||||
public string LastVersion { get; set; }
|
public string LastVersion { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -434,8 +434,38 @@ namespace Dalamud {
|
||||||
Framework.Gui.Chat.PrintError("You have not set up a discord channel for these notifications - you will only receive them in chat. To do this, please use the XIVLauncher in-game settings.");
|
Framework.Gui.Chat.PrintError("You have not set up a discord channel for these notifications - you will only receive them in chat. To do this, please use the XIVLauncher in-game settings.");
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(arguments))
|
if (string.IsNullOrEmpty(arguments))
|
||||||
Framework.Gui.Chat.Print("Possible values for roulette: leveling, 506070, msq, guildhests, expert, trials, mentor, alliance, normal, all\n" +
|
goto InvalidArgs;
|
||||||
"Possible values for role: tank, dps, healer");
|
|
||||||
|
var argParts = arguments.Split();
|
||||||
|
if (argParts.Length < 2)
|
||||||
|
goto InvalidArgs;
|
||||||
|
|
||||||
|
|
||||||
|
if (this.Configuration.PreferredRoleReminders == null)
|
||||||
|
this.Configuration.PreferredRoleReminders = new Dictionary<int, DalamudConfiguration.PreferredRole>();
|
||||||
|
|
||||||
|
var rouletteIndex = RouletteSlugToKey(argParts[0]);
|
||||||
|
|
||||||
|
if (rouletteIndex == 0)
|
||||||
|
goto InvalidArgs;
|
||||||
|
|
||||||
|
if (!Enum.TryParse(argParts[1].First().ToString().ToUpper() + argParts[1].ToLower().Substring(1), out DalamudConfiguration.PreferredRole role))
|
||||||
|
goto InvalidArgs;
|
||||||
|
|
||||||
|
if (this.Configuration.PreferredRoleReminders.ContainsKey(rouletteIndex))
|
||||||
|
this.Configuration.PreferredRoleReminders[rouletteIndex] = role;
|
||||||
|
else
|
||||||
|
this.Configuration.PreferredRoleReminders.Add(rouletteIndex, role);
|
||||||
|
|
||||||
|
Framework.Gui.Chat.Print($"Set bonus notifications for {argParts[0]}({rouletteIndex}) to {role}");
|
||||||
|
this.Configuration.Save(this.StartInfo.ConfigurationPath);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
InvalidArgs:
|
||||||
|
Framework.Gui.Chat.PrintError("Unrecognized arguments.");
|
||||||
|
Framework.Gui.Chat.Print("Possible values for roulette: leveling, 506070, msq, guildhests, expert, trials, mentor, alliance, normal\n" +
|
||||||
|
"Possible values for role: tank, dps, healer, all");
|
||||||
}
|
}
|
||||||
|
|
||||||
private int RouletteSlugToKey(string slug) => slug.ToLower() switch {
|
private int RouletteSlugToKey(string slug) => slug.ToLower() switch {
|
||||||
|
|
@ -451,11 +481,13 @@ namespace Dalamud {
|
||||||
_ => 0
|
_ => 0
|
||||||
};
|
};
|
||||||
|
|
||||||
private int RoleNameToKey(string name) => name.ToLower() switch
|
private DalamudConfiguration.PreferredRole RoleNameToPreferredRole(string name) => name.ToLower() switch
|
||||||
{
|
{
|
||||||
"Tank" => 1,
|
"Tank" => DalamudConfiguration.PreferredRole.Tank,
|
||||||
"Healer" => 4,
|
"Healer" => DalamudConfiguration.PreferredRole.Healer,
|
||||||
_ => 0
|
"Dps" => DalamudConfiguration.PreferredRole.Dps,
|
||||||
|
"All" => DalamudConfiguration.PreferredRole.All,
|
||||||
|
_ => DalamudConfiguration.PreferredRole.None
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue