Skip to content

Commit

Permalink
UI overhaul and Censor
Browse files Browse the repository at this point in the history
  • Loading branch information
Limiana committed Mar 16, 2024
1 parent b46e9cd commit 77d790a
Show file tree
Hide file tree
Showing 28 changed files with 663 additions and 334 deletions.
25 changes: 0 additions & 25 deletions DynamicBridge/Biome.cs

This file was deleted.

114 changes: 114 additions & 0 deletions DynamicBridge/Censor.cs

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions DynamicBridge/Checkers/Biome.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DynamicBridge.Core
{
public enum Biome
{
//Snowy = 0,
Desert = 1,
Tropical = 2,
No_biome = 3,
Temperate = 4,
Taiga = 5,
Tundra = 6,
Wasteland = 7,
Urban_Hot = 8,
Urban = 9,
Urban_Cold = 10,
Dungeons = 11,
Dungeons_2 = 12,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Text;
using System.Threading.Tasks;

namespace DynamicBridge
namespace DynamicBridge.Core
{
public static class BiomeChecker
{
Expand Down Expand Up @@ -48,14 +48,14 @@ public static class BiomeChecker
Dungeons.the_Stone_Vigil, Dungeons.the_Stone_Vigil_Hard,
],
[Biome.Wasteland] = [
147, 410, 483, 402, 459, 818, 932, 959, 960, 1027, 920, 975, 1071, 1072, 1092, 1140, 1141, 1159, 1168, 1169, 1181, 936, 937, 911, 1077, 1162, 1006, 1007, 1081, 1082, 1083, 1084, 903, 907, 945, 949, 847, 881, 885, 916, 978, 1079, 995, 996, 1030, 1153, 1154, 970, 973, 992, 993, 1028, 997, 998, 1029, 1013, 1026, 897, 912, 793, 830, 1174, 507,
147, 410, 483, 402, 459, 818, 932, 959, 960, 1027, 920, 975, 1071, 1072, 1092, 1140, 1141, 1159, 1168, 1169, 1181, 936, 937, 911, 1077, 1162, 1006, 1007, 1081, 1082, 1083, 1084, 903, 907, 945, 949, 847, 881, 885, 916, 978, 1079, 995, 996, 1030, 1153, 1154, 970, 973, 992, 993, 1028, 997, 998, 1029, 1013, 1026, 897, 912, 793, 830, 1174, 507,
1153,1154,
Raids.Sigmascape_V2_0, Raids.Sigmascape_V2_0_Savage, Raids.Sigmascape_V3_0, Raids.Sigmascape_V3_0_Savage,
799,803,
878,965, //empty
],
[Biome.Urban_Hot] = [
409, 474, 404, 130, 182, 251, 254, 259, 274, 790, 131, 666, 705, 706, 341, 635, 659, 963, 915, 1078, 178, 210, 535, 971,
409, 474, 404, 130, 182, 251, 254, 259, 274, 790, 131, 666, 705, 706, 341, 635, 659, 963, 915, 1078, 178, 210, 535, 971,
],
[Biome.Urban] = [
132, 183, 133, 238, 865, 340, 144, 832, 641, 628, 664, 665, 667, 710, 682, 739, 759, 819, 820, 863, 1061, 844, 735, 828, 736, 919, 882, 896, 917, 928, 838, 841, 884, 987, 1057, 1073, 744, 629, 639, 353, 806, 738, 679, 727, 740, 829, 658, 690, 724, 756, 800, 801, 804, 805, 807, 808, 812, 1122, 388, 389, 390, 391, 417, 506, 589, 590, 591, 1197, 579, 940, 941, 179, 534, 994, 571, 1094, 626, 1142,136,339,250, 717,
Expand Down Expand Up @@ -87,7 +87,7 @@ public static class BiomeChecker

public static bool Check(this Biome biome)
{
if(Cache.TryGetValue(Svc.ClientState.TerritoryType, out var b))
if (Cache.TryGetValue(Svc.ClientState.TerritoryType, out var b))
{
return biome == b;
}
Expand All @@ -97,12 +97,12 @@ public static bool Check(this Biome biome)

public static Biome FindBiome(this TerritoryType t)
{
foreach(var x in Territories)
foreach (var x in Territories)
{
if (x.Value.Contains(t.RowId)) return x.Key;
}
if (((TerritoryIntendedUseEnum)t.TerritoryIntendedUse).EqualsAny(TerritoryIntendedUseEnum.Housing_Instances)) return Biome.No_biome;
foreach(var x in Regions)
foreach (var x in Regions)
{
if (x.Value.Contains((TerritoryRegion)t.PlaceNameRegion.Row)) return x.Key;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace DynamicBridge
namespace DynamicBridge.Core
{
public enum CharacterState
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Text;
using System.Threading.Tasks;

namespace DynamicBridge
namespace DynamicBridge.Core
{
public static class CharacterStateChecker
{
Expand All @@ -25,11 +25,11 @@ public static class CharacterStateChecker

public static bool Check(this CharacterState state)
{
if(States.TryGetValue(state, out var func))
if (States.TryGetValue(state, out var func))
{
return func();
}
if(EzThrottler.Throttle("ErrorReport", 10000)) DuoLog.Error($"Cound not find checker for state {state}. Please report this error with logs.");
if (EzThrottler.Throttle("ErrorReport", 10000)) DuoLog.Error($"Cound not find checker for state {state}. Please report this error with logs.");
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion DynamicBridge/ETime.cs → DynamicBridge/Checkers/ETime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace DynamicBridge;
namespace DynamicBridge.Core;
public enum ETime
{
Dawn, Morning, Day, Dusk, Evening, Night
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Text;
using System.Threading.Tasks;

namespace DynamicBridge;
namespace DynamicBridge.Core;
public unsafe static class ETimeChecker
{
internal static long* ET = &CSFramework.Instance()->ClientTime.EorzeaTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace DynamicBridge
namespace DynamicBridge.Core
{
public enum SpecialTerritory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Text;
using System.Threading.Tasks;

namespace DynamicBridge
namespace DynamicBridge.Core
{
public static class SpecialTerritoryChecker
{
Expand Down
14 changes: 14 additions & 0 deletions DynamicBridge/Colors.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DynamicBridge;
public static class Colors
{
public static readonly Vector4 TabBlue = ImGuiEx.Vector4FromRGB(0xade7ff);
public static readonly Vector4 TabGreen = ImGuiEx.Vector4FromRGB(0xadffd9);
public static readonly Vector4 TabYellow = ImGuiEx.Vector4FromRGB(0xfaffad);
public static readonly Vector4 TabPurple = ImGuiEx.Vector4FromRGB(0xffadfa);
}
3 changes: 2 additions & 1 deletion DynamicBridge/Configuration/ApplyRule.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ECommons.ExcelServices;
using DynamicBridge.Core;
using ECommons.ExcelServices;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
4 changes: 4 additions & 0 deletions DynamicBridge/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public class Config : IEzConfig
public bool Cond_Gearset = false;

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

public string CensorSeed = Guid.NewGuid().ToString();
public bool NoNames = false;
public bool LesserCensor = false;
}

public enum GlamourerNoRuleBehavior
Expand Down
1 change: 1 addition & 0 deletions DynamicBridge/Configuration/Preset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class Preset
{
[NonSerialized] internal string GUID = Guid.NewGuid().ToString();
public string Name = "";
internal string CensoredName => C.NoNames ? GUID : Name;
public List<string> Glamourer = [];
public List<string> ComplexGlamourer = [];
public List<string> Honorific = [];
Expand Down
4 changes: 3 additions & 1 deletion DynamicBridge/Configuration/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public class Profile
public List<string> Pathes = [];
public Preset FallbackPreset = new();

public bool IsGlobal => C.GlobalProfile == this;
internal bool IsGlobal => C.GlobalProfile == this;

internal string CensoredName => C.NoNames ? GUID : Name;

public IEnumerable<Preset> GetPresetsUnion(bool includeGlobal = true)
{
Expand Down
4 changes: 4 additions & 0 deletions DynamicBridge/DynamicBridge.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DynamicBridge.Configuration;
using DynamicBridge.Core;
using DynamicBridge.Gui;
using DynamicBridge.IPC.Customize;
using DynamicBridge.IPC.Glamourer;
Expand Down Expand Up @@ -44,6 +45,8 @@ public unsafe class DynamicBridge : IDalamudPlugin
public GlamourerManager GlamourerManager;
public CustomizePlusManager CustomizePlusManager;

public NeoTabs NeoTabs;

public DynamicBridge(DalamudPluginInterface pi)
{
P = this;
Expand Down Expand Up @@ -87,6 +90,7 @@ public DynamicBridge(DalamudPluginInterface pi)
CustomizePlusManager = new();
ProperOnLogin.RegisterInteractable(OnLogin, true);
Memory = new();
NeoTabs = new([new("Presets", () => { }), new("Characters", () => { }), new("Dynamic Rules", () => { }), new("Profiles", () => { }), new("Global Profiles", () => { }), new("Layered Designs", () => { }), new("House Registration", () => { }), new("Settings", () => { })]);
});
}

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.7</Version>
<Version>1.0.4.8</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion DynamicBridge/Gui/Debug.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DynamicBridge.IPC;
using DynamicBridge.Core;
using DynamicBridge.IPC;
using DynamicBridge.IPC.Customize;
using DynamicBridge.IPC.Glamourer;
using DynamicBridge.IPC.Honorific;
Expand Down
105 changes: 105 additions & 0 deletions DynamicBridge/Gui/GuiCharacters.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
using ECommons.GameHelpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DynamicBridge.Gui;
public static class GuiCharacters
{
static string[] Filters = ["", "", "", ""];
public static void Draw()
{
ImGuiEx.SetNextItemFullWidth();
ImGui.InputTextWithHint($"##Filter1", "Search character name...", ref Filters[1], 100, Utils.CensorFlags);

ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, Utils.CellPadding);
if (ImGui.BeginTable($"##characters", 3, ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders | ImGuiTableFlags.SizingFixedSame))
{
ImGui.TableSetupColumn("Name", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn("Assigned profile", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn(" ", ImGuiTableColumnFlags.NoResize | ImGuiTableColumnFlags.WidthFixed);
ImGui.TableHeadersRow();

foreach (var x in C.SeenCharacters)
{
if (C.Blacklist.Contains(x.Key)) continue;
if (Filters[1].Length > 0 && !x.Value.ContainsAny(StringComparison.OrdinalIgnoreCase, Filters[1])) continue;

ImGui.PushID(x.Key.ToString());
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGuiEx.TextV(Player.CID == x.Key ? ImGuiColors.HealerGreen : null, $"{Censor.Character(x.Value)}");
ImGui.TableNextColumn();

var currentProfile = C.ProfilesL.FirstOrDefault(z => z.Characters.Contains(x.Key));
ImGuiEx.SetNextItemFullWidth();
if (ImGui.BeginCombo($"selProfile", currentProfile?.CensoredName ?? "- No profile -", C.ComboSize))
{
if (ImGui.Selectable("- No profile -"))
{
C.ProfilesL.Each(z => z.Characters.Remove(x.Key));
}
ImGui.SetNextItemWidth(350f);
ImGui.InputTextWithHint($"##selProfileFltr", "Filter...", ref Filters[2], 100);
foreach (var profile in C.ProfilesL)
{
if (Filters[2].Length > 0 && !profile.Name.Contains(Filters[2], StringComparison.OrdinalIgnoreCase)) continue;
if (currentProfile == profile && ImGui.IsWindowAppearing()) ImGui.SetScrollHereY();
if (ImGui.Selectable($"{profile.CensoredName}##{profile.GUID}", currentProfile == profile))
{
profile.SetCharacter(x.Key);
}
}
ImGui.EndCombo();
}

ImGui.TableNextColumn();

if (ImGuiEx.IconButton(FontAwesomeIcon.Ban))
{
C.Blacklist.Add(x.Key);
C.ProfilesL.Each(z => z.Characters.Remove(x.Key));
}
ImGuiEx.Tooltip($"Blacklist {x.Value}. This will prevent it from showing up for profile assignments. This will also undo profile assignments for {x.Value}. ");
ImGui.SameLine();

if (ImGuiEx.IconButton(FontAwesomeIcon.Trash))
{
if (ImGuiEx.Ctrl)
{
new TickScheduler(() => C.SeenCharacters.Remove(x));
C.ProfilesL.Each(z => z.Characters.Remove(x.Key));
}
}
ImGuiEx.Tooltip($"Hold CTRL and click to delete information about {x.Value}. This will also undo profile assignment to the character but and as soon as you relog back onto it, {x.Value} will be registered in a plugin again.");

ImGui.PopID();
}

foreach (var x in C.Blacklist)
{
var name = C.SeenCharacters.TryGetValue(x, out var n) ? n : $"{x:X16}";
if (Filters[1].Length > 0 && !name.ContainsAny(StringComparison.OrdinalIgnoreCase, Filters[1])) continue;
ImGui.PushID(x.ToString());
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGuiEx.TextV(ImGuiColors.DalamudGrey3, $"{Censor.Character(name)}");
ImGui.TableNextColumn();

ImGui.TableNextColumn();
if (ImGuiEx.IconButton(FontAwesomeIcon.ArrowCircleUp))
{
var item = x;
new TickScheduler(() => C.Blacklist.Remove(item));
}
ImGuiEx.Tooltip("Unblacklist this character");
ImGui.PopID();
}

ImGui.EndTable();
}
ImGui.PopStyleVar();
}
}
Loading

0 comments on commit 77d790a

Please sign in to comment.