Skip to content

Commit

Permalink
fix gearsets
Browse files Browse the repository at this point in the history
  • Loading branch information
Limiana committed Mar 12, 2024
1 parent 7291eff commit 8d2e5e1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DynamicBridge/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Config : IEzConfig
public bool Cond_World = false;
public bool Cond_Gearset = false;

public Dictionary<string, List<GearsetEntry>> GearsetNameCache = [];
public Dictionary<ulong, List<GearsetEntry>> GearsetNameCacheCID = [];
}

public enum GlamourerNoRuleBehavior
Expand Down
2 changes: 1 addition & 1 deletion DynamicBridge/DynamicBridge.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>NightmareXIV</Authors>
<Version>1.0.4.2</Version>
<Version>1.0.4.3</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
5 changes: 3 additions & 2 deletions DynamicBridge/Gui/GuiRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,11 @@ void FiltersSelection()
ImGui.TableNextColumn();
//Gearset
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X);
if (ImGui.BeginCombo("##gs", rule.Gearsets.ToGearsetNames(Profile.Name).PrintRange(rule.Not.Gearsets.ToGearsetNames(Profile.Name), out var fullList), C.ComboSize))
var gch = Profile.Characters.FirstOrDefault();
if (ImGui.BeginCombo("##gs", rule.Gearsets.ToGearsetNames(gch).PrintRange(rule.Not.Gearsets.ToGearsetNames(gch), out var fullList), C.ComboSize))
{
FiltersSelection();
if (!C.GearsetNameCache.TryGetValue(Profile.Name, out var gearsets)) gearsets = [];
if (!C.GearsetNameCacheCID.TryGetValue(gch, out var gearsets)) gearsets = [];
foreach (var cond in gearsets)
{
var name = cond.ToString();
Expand Down
4 changes: 2 additions & 2 deletions DynamicBridge/SpecialTerritoryChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public static class SpecialTerritoryChecker
static readonly uint[] Ocean = [138, 263, 280, 330, 405, 406, 413, 453, 552, 675, 621, 684, 686, 687, 641, 614, 634, 685, 613, 657, 711, 726, 757, 820, 863, 814, 864, 870, 818, 932, 957, 915, 1055, 732];
static readonly uint[] Lake = [139, 221, 328, 412, 454, 466, 180, 325, 486, 154, 228, 240, 321, 324, 140, 215, 255, 267, 269, 273, 278, 1049, 147, 410, 483, 156, 299, 300, 305, 308, 309, 315, 326, 335, 379, 480, 672, 401, 455, 461, 492, 478, 399, 476, 485, 503, 400, 501, 715, 682, 739, 759, 813, 861, 862, 877, 816, 869, 817, 871, 874, 875, 959, 961, 1014, 1061, 827, 920, 975];
static readonly uint[] River = [148, 190, 219, 225, 226, 227, 230, 233, 237, 239, 319, 320, 1015, 152, 191, 234, 277, 289, 290, 303, 839, 153, 192, 220, 229, 231, 232, 235, 236, 291, 317, 394, 473, 141, 216, 248, 253, 258, 270, 271, 314, 145, 256, 257, 266, 268, 275, 465, 494, 668, 146, 260, 261, 306, 312, 318, 323, 491, 669, 402, 459, 398, 464, 481, 482, 1023, 635, 659, 612, 640, 647, 648, 670, 671, 678, 703, 760, 620, 716, 868, 1019, 622, 688, 713, 718, 723, 797, 819, 815, 860, 872, 962, 963, 399, 476, 485, 503, 512, 514, 515, 624, 625, 656, 901, 929, 939];
static readonly uint[] Frozen = [397, 467, 470, 472, 477, 479, 489, 493, 497, 498, 709, 866, 155, 223, 298, 301, 302, 304, 313, 316, 322, 468, 469, 475, 487, 488, 496, 500, 533, 699, 958, 1011, 1120, 960, 1027, 763, 795];
static readonly uint[] Hotsprings = [628, 664, 665, 667, 710, 419, 499, 886, 979];
static readonly uint[] Frozen = [397, 467, 470, 472, 477, 479, 489, 493, 497, 498, 709, 866, 155, 223, 298, 301, 302, 304, 313, 316, 322, 468, 469, 475, 487, 488, 496, 500, 533, 699, 958, 1011, 1120, 960, 1027, 763, 795, 419, 499];
static readonly uint[] Hotsprings = [628, 664, 665, 667, 710, 886, 979];

static readonly Dictionary<SpecialTerritory, Func<bool>> States = new()
{
Expand Down
6 changes: 3 additions & 3 deletions DynamicBridge/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,13 @@ public static void UpdateGearsetCache()
if (*x.Name == 0) continue;
list.Add(new(x.ID, MemoryHelper.ReadStringNullTerminated((nint)x.Name), x.ClassJob));
}
C.GearsetNameCache[Player.NameWithWorld] = list;
C.GearsetNameCacheCID[Player.CID] = list;
}
}

public static IEnumerable<string> ToGearsetNames(this List<int> gearsetIDs, string nameWithWorld)
public static IEnumerable<string> ToGearsetNames(this List<int> gearsetIDs, ulong CID)
{
if (!C.GearsetNameCache.TryGetValue(nameWithWorld, out var cache)) cache = [];
if (!C.GearsetNameCacheCID.TryGetValue(CID, out var cache)) cache = [];
for (int i = 0; i < gearsetIDs.Count; i++)
{
if (cache.TryGetFirst(x => x.Id == gearsetIDs[i], out var ret))
Expand Down

0 comments on commit 8d2e5e1

Please sign in to comment.