diff --git a/TarnishedTool/GameIds/GestureNameLookup.cs b/TarnishedTool/GameIds/GestureNameLookup.cs new file mode 100644 index 0000000..6474dbb --- /dev/null +++ b/TarnishedTool/GameIds/GestureNameLookup.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +namespace TarnishedTool.GameIds; + +public static class GestureNameLookup +{ + private static readonly Dictionary Names = new() + { + { 0, "Bow" }, { 1, "Polite Bow" }, { 2, "My Thanks" }, { 3, "Curtsy" }, + { 4, "Reverential Bow" }, { 5, "My Lord" }, { 6, "Warm Welcome" }, { 7, "Wave" }, + { 8, "Casual Greeting" }, { 9, "Strength!" }, { 10, "As You Wish" }, + { 20, "Point Forwards" }, { 21, "Point Upwards" }, { 22, "Point Downwards" }, + { 23, "Beckon" }, { 24, "Wait!" }, { 25, "Calm Down!" }, { 30, "Nod In Thought" }, + { 40, "Extreme Repentance" }, { 41, "Grovel For Mercy" }, { 50, "Rallying Cry" }, + { 51, "Heartening Cry" }, { 52, "By My Sword" }, { 53, "Hoslow's Oath" }, + { 54, "Fire Spur Me" }, { 60, "Bravo!" }, { 70, "Jump for Joy" }, + { 71, "Triumphant Delight" }, { 72, "Fancy Spin" }, { 73, "Finger Snap" }, + { 80, "Dejection" }, { 90, "Patches' Crouch" }, { 91, "Crossed Legs" }, + { 92, "Rest" }, { 93, "Sitting Sideways" }, { 94, "Dozing Cross-Legged" }, + { 95, "Spread Out" }, { 97, "Balled Up" }, { 98, "What Do You Want?" }, + { 100, "Prayer" }, { 101, "Desperate Prayer" }, { 102, "Rapture" }, + { 103, "Erudition" }, { 104, "Outer Order" }, { 105, "Inner Order" }, + { 106, "Golden Order Totality" }, + { 108, "The Ring (Pre-Order Gesture)" }, { 109, "The Ring" }, + { 111, "May the Best Win" }, { 112, "The Two Fingers" }, + { 113, "Ring of Miquella" }, { 114, "Let Us Go Together" }, + { 115, "O' Mother" }, { 116, "Ring of Miquella (Pre-Order Gesture)" }, + }; + + private static readonly HashSet PreOrderCheckIds = [108, 109, 113, 116]; + + public static string GetName(int id) => + Names.TryGetValue(id, out var name) ? name : $"Gesture {id}"; + + public static bool IsPreOrderVariant(int id) => PreOrderCheckIds.Contains(id); +} \ No newline at end of file diff --git a/TarnishedTool/Models/GraceSelectionItem.cs b/TarnishedTool/Models/GraceSelectionItem.cs new file mode 100644 index 0000000..039d426 --- /dev/null +++ b/TarnishedTool/Models/GraceSelectionItem.cs @@ -0,0 +1,22 @@ +using TarnishedTool.ViewModels; + +namespace TarnishedTool.Models; + +public class GestureSelectionItem : BaseViewModel +{ + public int Id { get; } + public string Name { get; } + + private bool _isSelected; + public bool IsSelected + { + get => _isSelected; + set => SetProperty(ref _isSelected, value); + } + + public GestureSelectionItem(int id, string name) + { + Id = id; + Name = name; + } +} \ No newline at end of file diff --git a/TarnishedTool/Properties/Resources.Designer.cs b/TarnishedTool/Properties/Resources.Designer.cs index ed2d443..8b45564 100644 --- a/TarnishedTool/Properties/Resources.Designer.cs +++ b/TarnishedTool/Properties/Resources.Designer.cs @@ -491,6 +491,79 @@ internal static string BaseGestures { } } + /// + /// Looks up a localized string similar to 670135 + ///670132 + ///670133 + ///670131 + ///670134 + ///670130 + ///670330 + ///670332 + ///670331 + ///670333 + ///670334 + ///670731 + ///670730 + ///670614 + ///670611 + ///670612 + ///670610 + ///670616 + ///670615 + ///670613 + ///670625 + ///670624 + ///670622 + ///670620 + ///670621 + ///670623 + ///670626 + ///670633 + ///670632 + ///670630 + ///670631 + ///670634 + ///670652 + ///670651 + ///670650 + ///670671 + ///670670 + ///670740 + ///670741 + ///670742 + ///670743 + ///670744 + ///670745 + ///670746 + ///670747 + ///670231 + ///670232 + ///670233 + ///670530 + ///670531 + ///670532 + ///670534 + ///670535 + ///670536 + ///670537 + ///670539 + ///670352 + ///670351 + ///670353 + ///670354 + ///670750 + ///670160 + ///670161 + ///670162 + /// [rest of string was truncated]";. + /// + internal static string BaseSummoningPools { + get { + return ResourceManager.GetString("BaseSummoningPools", resourceCulture); + } + } + /// /// Looks up a localized string similar to 0,400022E9,Abandoned Merchant's Bell Bearing,1,1 ///0,400022D4,Bernahl's Bell Bearing,1,1 @@ -590,6 +663,17 @@ internal static string ChrNames { } } + /// + /// Looks up a localized string similar to 60360 + ///60350 + ///60370. + /// + internal static string Colosseums { + get { + return ResourceManager.GetString("Colosseums", resourceCulture); + } + } + /// /// Looks up a localized string similar to 1,401E8CB4,Ancient Dragon's Blessing,1,0 ///0,40000D20,Baldachin's Blessing,1,0 @@ -761,6 +845,77 @@ internal static string DLCMaps { } } + /// + /// Looks up a localized string similar to 670842 + ///670843 + ///670841 + ///670851 + ///670854 + ///670853 + ///670850 + ///670852 + ///670940 + ///670941 + ///670942 + ///670943 + ///670909 + ///670953 + ///670956 + ///670955 + ///670950 + ///670951 + ///670952 + ///670945 + ///670831 + ///670830 + ///670814 + ///670815 + ///670860 + ///670960 + ///670961 + ///670813 + ///670870 + ///670970 + ///670871 + ///670980 + ///670880 + ///670908 + ///670908 + ///670901 + ///670907 + ///670907 + ///670806 + ///670805 + ///670800 + ///670801 + ///670801 + ///670902 + ///670902 + ///670906 + ///670906 + ///670802 + ///670802 + ///670912 + ///670912 + ///670808 + ///670809 + ///670804 + ///670807 + ///670913 + ///670900 + ///670911 + ///670904 + ///670910 + ///670903 + ///670930 + ///670812. + /// + internal static string DlcSummoningPools { + get { + return ResourceManager.GetString("DlcSummoningPools", resourceCulture); + } + } + /// /// Looks up a localized string similar to 1,Nebula Hand Slam ///3,Spin Swing diff --git a/TarnishedTool/Properties/Resources.resx b/TarnishedTool/Properties/Resources.resx index 260b30a..9f6f25d 100644 --- a/TarnishedTool/Properties/Resources.resx +++ b/TarnishedTool/Properties/Resources.resx @@ -143693,4 +143693,236 @@ c6 05 00 00 00 00 02 mov BYTE PTR [rip+0x0],0x2 # 47 <exit> 48 83 ec 30 sub rsp,0x30 e9 00 00 00 00 jmp 53 <skip+0xa> + + 670135 +670132 +670133 +670131 +670134 +670130 +670330 +670332 +670331 +670333 +670334 +670731 +670730 +670614 +670611 +670612 +670610 +670616 +670615 +670613 +670625 +670624 +670622 +670620 +670621 +670623 +670626 +670633 +670632 +670630 +670631 +670634 +670652 +670651 +670650 +670671 +670670 +670740 +670741 +670742 +670743 +670744 +670745 +670746 +670747 +670231 +670232 +670233 +670530 +670531 +670532 +670534 +670535 +670536 +670537 +670539 +670352 +670351 +670353 +670354 +670750 +670160 +670161 +670162 +670261 +670164 +670260 +670262 +670364 +670360 +670360 +670361 +670362 +670163 +670363 +670460 +670461 +670462 +670560 +670561 +670562 +670563 +670172 +670171 +670170 +670173 +670270 +670271 +670272 +670370 +670371 +670471 +670473 +670570 +670174 +670175 +670372 +670373 +670472 +670470 +670571 +670180 +670181 +670280 +670380 +670381 +670480 +670481 +670580 +670390 +670490 +670340 +670341 +670342 +670240 +670241 +670200 +670202 +670201 +670203 +670230 +670204 +670301 +670300 +670304 +670303 +670205 +670305 +670306 +670307 +670100 +670101 +670308 +670105 +670104 +670103 +670102 +670106 +670106 +670309 +670309 +670310 +670400 +670401 +670500 +670402 +670403 +670404 +670506 +670507 +670405 +670406 +670407 +670408 +670504 +670505 +670409 +670502 +670503 +670501 + + + 670842 +670843 +670841 +670851 +670854 +670853 +670850 +670852 +670940 +670941 +670942 +670943 +670909 +670953 +670956 +670955 +670950 +670951 +670952 +670945 +670831 +670830 +670814 +670815 +670860 +670960 +670961 +670813 +670870 +670970 +670871 +670980 +670880 +670908 +670908 +670901 +670907 +670907 +670806 +670805 +670800 +670801 +670801 +670902 +670902 +670906 +670906 +670802 +670802 +670912 +670912 +670808 +670809 +670804 +670807 +670913 +670900 +670911 +670904 +670910 +670903 +670930 +670812 + + + 60360 +60350 +60370 + diff --git a/TarnishedTool/TarnishedTool.csproj b/TarnishedTool/TarnishedTool.csproj index a259e4f..26f898e 100644 --- a/TarnishedTool/TarnishedTool.csproj +++ b/TarnishedTool/TarnishedTool.csproj @@ -256,6 +256,7 @@ + @@ -308,6 +309,7 @@ + @@ -378,6 +380,7 @@ + @@ -483,6 +486,9 @@ AiWindow.xaml + + GestureSelectionWindow.xaml + GraceImportPresentSelectionWindow.xaml @@ -546,6 +552,7 @@ + diff --git a/TarnishedTool/ViewModels/EventViewModel.cs b/TarnishedTool/ViewModels/EventViewModel.cs index ec20981..c8d35dc 100644 --- a/TarnishedTool/ViewModels/EventViewModel.cs +++ b/TarnishedTool/ViewModels/EventViewModel.cs @@ -31,6 +31,9 @@ public class EventViewModel : BaseViewModel private readonly List _baseGameGestureIds; private readonly List _dlcGestureIds; + private readonly List _baseGameSummoningPools; + private readonly List _dlcSummoningPools; + private readonly List _colosseums; private readonly EventLogViewModel _eventLogViewModel = new(); private EventLogWindow _eventLogWindow; @@ -63,6 +66,8 @@ public EventViewModel(IEventService eventService, IStateService stateService, II UnlockMetyrCommand = new DelegateCommand(UnlockMetyr); FightFortissaxCommand = new DelegateCommand(FightFortissax); UnlockGesturesCommand = new DelegateCommand(UnlockGestures); + UnlockSummoningPoolsCommand = new DelegateCommand(UnlockSummoningPools); + UnlockAllColosseumsCommand = new DelegateCommand(UnlockAllColosseums); FightEldenBeastCommand = new DelegateCommand(FightEldenBeast); ClearDlcCommand = new DelegateCommand(ToggleClearDlc); DeactivateMausoleumCommand = new DelegateCommand(ToggleSnowfieldMausoleum); @@ -79,6 +84,13 @@ public EventViewModel(IEventService eventService, IStateService stateService, II DataLoader.GetSimpleList("BaseGestures", s => int.Parse(s, CultureInfo.InvariantCulture)); _dlcGestureIds = DataLoader.GetSimpleList("DlcGestures", s => int.Parse(s, CultureInfo.InvariantCulture)); + _baseGameSummoningPools = + DataLoader.GetSimpleList("BaseSummoningPools", s => int.Parse(s, CultureInfo.InvariantCulture)); + _dlcSummoningPools = + DataLoader.GetSimpleList("DlcSummoningPools", s => int.Parse(s, CultureInfo.InvariantCulture)); + _colosseums = + DataLoader.GetSimpleList("Colosseums", s => int.Parse(s, CultureInfo.InvariantCulture)); + SelectedWeatherType = WeatherTypes.FirstOrDefault(); RegisterHotkeys(); @@ -95,6 +107,8 @@ public EventViewModel(IEventService eventService, IStateService stateService, II public ICommand UnlockMetyrCommand { get; set; } public ICommand FightFortissaxCommand { get; set; } public ICommand UnlockGesturesCommand { get; set; } + public ICommand UnlockSummoningPoolsCommand { get; set; } + public ICommand UnlockAllColosseumsCommand { get; set; } public ICommand FightEldenBeastCommand { get; set; } public ICommand ClearDlcCommand { get; set; } public ICommand DeactivateMausoleumCommand { get; set; } @@ -354,7 +368,7 @@ private void RegisterHotkeys() () => IsDisableEventsEnabled = !IsDisableEventsEnabled); _hotkeyManager.RegisterAction(HotkeyActions.OpenEventLogger, () => OpenEventLogWindow()); _hotkeyManager.RegisterAction(HotkeyActions.UnlockAffinites, () => SafeExecute(UnlockWhetblades)); - _hotkeyManager.RegisterAction(HotkeyActions.UnlockGestures, () => SafeExecute(UnlockGestures)); + _hotkeyManager.RegisterAction(HotkeyActions.UnlockGestures, () => SafeExecute(UnlockAllGesturesInternal)); _hotkeyManager.RegisterAction(HotkeyActions.FightEldenBeast, () => SafeExecute(FightEldenBeast)); _hotkeyManager.RegisterAction(HotkeyActions.FightFortissax, () => SafeExecute(FightFortissax)); _hotkeyManager.RegisterAction(HotkeyActions.UnlockMetyr, () => SafeExecute(UnlockMetyr)); @@ -420,7 +434,7 @@ private void UnlockWhetblades() private void UnlockMetyr() { - _eventService.SetEvents(Event.UnlockMetyr, true); + _eventService.SetEvents(Event.UnlockMetyr, true); } private void FightFortissax() => _eventService.SetEvent(Event.FightFortissax, true); @@ -428,35 +442,54 @@ private void UnlockMetyr() private void UnlockGestures() { - UnlockBaseGestures(); + var vm = new GestureSelectionViewModel( + _ezStateService, _baseGameGestureIds, _dlcGestureIds, + IsDlcAvailable, PreOrderBaseGesture, PreOrderDlcGesture); + + var window = new GestureSelectionWindow { DataContext = vm }; + window.Show(); + } + + private void UnlockAllGesturesInternal() + { + var vm = new GestureSelectionViewModel( + _ezStateService, _baseGameGestureIds, _dlcGestureIds, + IsDlcAvailable, PreOrderBaseGesture, PreOrderDlcGesture); + + vm.UnlockAllCommand.Execute(null); + } + + private void UnlockSummoningPools() + { + UnlockBaseSummoningPools(); if (!IsDlcAvailable) return; - UnlockDlcGestures(); + UnlockDlcSummoningPools(); } - private void UnlockBaseGestures() + private void UnlockBaseSummoningPools() { - foreach (var baseGameGestureId in _baseGameGestureIds) + foreach (var baseSummoningPoolId in _baseGameSummoningPools) { - _ezStateService.ExecuteTalkCommand(EzState.TalkCommands.AcquireGesture(baseGameGestureId)); + _eventService.SetEvent(baseSummoningPoolId, true); } - - // Pre-Order Check - int basePreOrderGestureId = !PreOrderBaseGesture ? 109 : 108; - _ezStateService.ExecuteTalkCommand(EzState.TalkCommands.AcquireGesture(basePreOrderGestureId)); } - private void UnlockDlcGestures() + private void UnlockDlcSummoningPools() { - foreach (var dlcGestureId in _dlcGestureIds) + foreach (var dlcSummoningPoolId in _dlcSummoningPools) { - _ezStateService.ExecuteTalkCommand(EzState.TalkCommands.AcquireGesture(dlcGestureId)); + _eventService.SetEvent(dlcSummoningPoolId, true); } + } - // Pre-Order Check - int dlcPreOrderGestureId = !PreOrderDlcGesture ? 113 : 116; - _ezStateService.ExecuteTalkCommand(EzState.TalkCommands.AcquireGesture(dlcPreOrderGestureId)); + private void UnlockAllColosseums() + { + foreach (var colosseum in _colosseums) + { + _eventService.SetEvent(colosseum, true); + } } private void ToggleClearDlc() diff --git a/TarnishedTool/ViewModels/GestureSelectionViewModel.cs b/TarnishedTool/ViewModels/GestureSelectionViewModel.cs new file mode 100644 index 0000000..8658310 --- /dev/null +++ b/TarnishedTool/ViewModels/GestureSelectionViewModel.cs @@ -0,0 +1,87 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Windows.Input; +using TarnishedTool.Core; +using TarnishedTool.GameIds; +using TarnishedTool.Interfaces; +using TarnishedTool.Models; + +namespace TarnishedTool.ViewModels +{ + public class GestureSelectionViewModel : BaseViewModel + { + private readonly IEzStateService _ezStateService; + + public ObservableCollection BaseGestures { get; } + public ObservableCollection DlcGestures { get; } + public bool IsDlcAvailable { get; } + + public ICommand SelectAllCommand { get; } + public ICommand SelectNoneCommand { get; } + public ICommand UnlockSelectedCommand { get; } + public ICommand UnlockAllCommand { get; } + + public GestureSelectionViewModel( + IEzStateService ezStateService, + IEnumerable baseGestureIds, + IEnumerable dlcGestureIds, + bool isDlcAvailable, + bool preOrderBaseGesture, + bool preOrderDlcGesture) + { + _ezStateService = ezStateService; + IsDlcAvailable = isDlcAvailable; + + BaseGestures = new ObservableCollection( + baseGestureIds.Where(id => !GestureNameLookup.IsPreOrderVariant(id)) + .Select(id => new GestureSelectionItem(id, GestureNameLookup.GetName(id)))); + + int baseRingId = !preOrderBaseGesture ? 109 : 108; + BaseGestures.Add(new GestureSelectionItem(baseRingId, GestureNameLookup.GetName(baseRingId))); + + DlcGestures = new ObservableCollection( + dlcGestureIds.Where(id => !GestureNameLookup.IsPreOrderVariant(id)) + .Select(id => new GestureSelectionItem(id, GestureNameLookup.GetName(id)))); + + if (isDlcAvailable) + { + int dlcRingId = !preOrderDlcGesture ? 113 : 116; + DlcGestures.Add(new GestureSelectionItem(dlcRingId, GestureNameLookup.GetName(dlcRingId))); + } + + SelectAllCommand = new DelegateCommand(() => SetAll(true)); + SelectNoneCommand = new DelegateCommand(() => SetAll(false)); + UnlockSelectedCommand = new DelegateCommand(UnlockSelected); + UnlockAllCommand = new DelegateCommand(UnlockAll); + } + + private void SetAll(bool value) + { + foreach (var g in BaseGestures) g.IsSelected = value; + if (IsDlcAvailable) foreach (var g in DlcGestures) g.IsSelected = value; + } + + private void UnlockSelected() + { + foreach (var g in BaseGestures.Where(g => g.IsSelected)) + _ezStateService.ExecuteTalkCommand(EzState.TalkCommands.AcquireGesture(g.Id)); + + if (!IsDlcAvailable) return; + + foreach (var g in DlcGestures.Where(g => g.IsSelected)) + _ezStateService.ExecuteTalkCommand(EzState.TalkCommands.AcquireGesture(g.Id)); + } + + private void UnlockAll() + { + foreach (var g in BaseGestures) + _ezStateService.ExecuteTalkCommand(EzState.TalkCommands.AcquireGesture(g.Id)); + + if (!IsDlcAvailable) return; + + foreach (var g in DlcGestures) + _ezStateService.ExecuteTalkCommand(EzState.TalkCommands.AcquireGesture(g.Id)); + } + } +} \ No newline at end of file diff --git a/TarnishedTool/Views/Tabs/EventTab.xaml b/TarnishedTool/Views/Tabs/EventTab.xaml index 0d5226c..6c35fa7 100644 --- a/TarnishedTool/Views/Tabs/EventTab.xaml +++ b/TarnishedTool/Views/Tabs/EventTab.xaml @@ -126,18 +126,22 @@ IsEnabled="{Binding AreOptionsEnabled}" Command="{Binding UnlockWhetbladesCommand}" Margin="0,2" /> - @@ -179,7 +183,7 @@ CornerRadius="10" Width="12" Height="12" - Margin="10,0,0,0" + Margin="10,-1,0,0" VerticalAlignment="Center" ToolTip="Must be in general area" ToolTipService.InitialShowDelay="100"> @@ -193,10 +197,10 @@ @@ -204,7 +208,7 @@ CornerRadius="10" Width="12" Height="12" - Margin="10,0,0,0" + Margin="10,2,0,0" VerticalAlignment="Center" ToolTip="Need to be somewhere in Deeproot Depths" ToolTipService.InitialShowDelay="100"> @@ -219,7 +223,14 @@ + @@ -309,7 +320,7 @@ Width="130" Height="22.5" Command="{Binding GoldenErdtreeCommand}" - Margin="10, 0, 0,2" + Margin="32, 0, 0,2" IsEnabled="{Binding AreOptionsEnabled}" /> + + + + + + + + + + + + + + + + + + + + + + +