remove /xlbonus

This commit is contained in:
goat 2020-09-08 21:13:05 +02:00
parent 94f6babb82
commit 0406c12ef5
3 changed files with 0 additions and 140 deletions

View file

@ -18,17 +18,6 @@ namespace Dalamud
public List<string> BadWords { get; set; }
public enum PreferredRole
{
None,
All,
Tank,
Dps,
Healer
}
public Dictionary<int, PreferredRole> PreferredRoleReminders { get; set; }
public bool DutyFinderTaskbarFlash { get; set; } = true;
public bool DutyFinderChatMessage { get; set; } = true;

View file

@ -541,10 +541,6 @@ namespace Dalamud {
});
#endif
CommandManager.AddHandler("/xlbonus", new CommandInfo(OnRouletteBonusNotifyCommand) {
HelpMessage = Loc.Localize("DalamudBonusHelp", "Notify when a roulette has a bonus you specified. Run without parameters for more info. Usage: /xlbonus <roulette name> <role name>")
});
CommandManager.AddHandler("/xldev", new CommandInfo(OnDebugDrawDevMenu) {
HelpMessage = Loc.Localize("DalamudDevMenuHelp", "Draw dev menu DEBUG"),
ShowInHelp = false
@ -695,46 +691,6 @@ namespace Dalamud {
}
#endif
private void OnRouletteBonusNotifyCommand(string command, string arguments)
{
if (this.Configuration.DiscordFeatureConfig.CfPreferredRoleChannel == null)
Framework.Gui.Chat.PrintError(Loc.Localize("DalamudChannelNotSetup", "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))
goto InvalidArgs;
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);
this.Framework.Gui.Chat.Print($"Set bonus notifications for {argParts[0]}({rouletteIndex}) to {role}");
this.Framework.Gui.Chat.Print(string.Format(Loc.Localize("DalamudBonusSet", "Set bonus notifications for {0}({1}) to {2}"), argParts[0], rouletteIndex, role));
this.Configuration.Save();
return;
InvalidArgs:
this.Framework.Gui.Chat.PrintError(Loc.Localize("DalamudInvalidArguments", "Unrecognized arguments."));
this.Framework.Gui.Chat.Print(Loc.Localize("DalamudBonusPossibleValues", "Possible values for roulette: leveling, 506070, msq, guildhests, expert, trials, mentor, alliance, normal\nPossible values for role: tank, dps, healer, all, none/reset"));
}
private void OnDebugDrawDevMenu(string command, string arguments) {
this.isImguiDrawDevMenu = !this.isImguiDrawDevMenu;
}
@ -815,27 +771,5 @@ namespace Dalamud {
}
});
}
private int RouletteSlugToKey(string slug) => slug.ToLower() switch {
"leveling" => 1,
"506070" => 2,
"msq" => 3,
"guildhests" => 4,
"expert" => 5,
"trials" => 6,
"mentor" => 8,
"alliance" => 9,
"normal" => 10,
_ => 0
};
private DalamudConfiguration.PreferredRole RoleNameToPreferredRole(string name) => name.ToLower() switch
{
"Tank" => DalamudConfiguration.PreferredRole.Tank,
"Healer" => DalamudConfiguration.PreferredRole.Healer,
"Dps" => DalamudConfiguration.PreferredRole.Dps,
"All" => DalamudConfiguration.PreferredRole.All,
_ => DalamudConfiguration.PreferredRole.None
};
}
}

View file

@ -90,60 +90,6 @@ namespace Dalamud.Game.Network {
return;
}
if (opCode == this.dalamud.Data.ServerOpCodes["CfPreferredRole"]) {
if (this.dalamud.Configuration.PreferredRoleReminders == null)
return;
var data = new byte[64];
Marshal.Copy(dataPtr, data, 0, 32);
if (this.lastPreferredRole == null) {
this.lastPreferredRole = data;
return;
}
Task.Run(async () => {
for (var rouletteIndex = 1; rouletteIndex < 11; rouletteIndex++) {
var currentRoleKey = data[rouletteIndex];
var prevRoleKey = this.lastPreferredRole[rouletteIndex];
Log.Verbose("CfPreferredRole: {0} - {1} => {2}", rouletteIndex, prevRoleKey, currentRoleKey);
if (currentRoleKey != prevRoleKey) {
var rouletteName = rouletteIndex switch {
1 => "Duty Roulette: Leveling",
2 => "Duty Roulette: Level 50/60/70 Dungeons",
3 => "Duty Roulette: Main Scenario",
4 => "Duty Roulette: Guildhests",
5 => "Duty Roulette: Expert",
6 => "Duty Roulette: Trials",
8 => "Duty Roulette: Mentor",
9 => "Duty Roulette: Alliance Raids",
10 => "Duty Roulette: Normal Raids",
_ => "Unknown ContentRoulette"
};
var prevRoleName = RoleKeyToPreferredRole(prevRoleKey);
var currentRoleName = RoleKeyToPreferredRole(currentRoleKey);
if (!this.dalamud.Configuration.PreferredRoleReminders.TryGetValue(rouletteIndex, out var roleToCheck))
return;
if (roleToCheck == DalamudConfiguration.PreferredRole.All || currentRoleName != roleToCheck)
return;
this.dalamud.Framework.Gui.Chat.Print($"Roulette bonus for {rouletteName} changed: {prevRoleName} => {currentRoleName}");
if (this.dalamud.BotManager.IsConnected)
await this.dalamud.BotManager.ProcessCfPreferredRoleChange(rouletteName, prevRoleName.ToString(), currentRoleName.ToString());
}
}
this.lastPreferredRole = data;
});
return;
}
if (!this.optOutMbUploads) {
if (opCode == this.dalamud.Data.ServerOpCodes["MarketBoardItemRequestStart"]) {
var catalogId = (uint) Marshal.ReadInt32(dataPtr);
@ -254,14 +200,5 @@ namespace Dalamud.Game.Network {
}
}
}
private DalamudConfiguration.PreferredRole RoleKeyToPreferredRole(int key) => key switch
{
1 => DalamudConfiguration.PreferredRole.Tank,
2 => DalamudConfiguration.PreferredRole.Dps,
3 => DalamudConfiguration.PreferredRole.Dps,
4 => DalamudConfiguration.PreferredRole.Healer,
_ => DalamudConfiguration.PreferredRole.None
};
}
}