Add gold coffers (#10)

This commit is contained in:
Liza 2023-02-26 17:31:37 +01:00
parent cbdcf58063
commit e45b72a655
8 changed files with 117 additions and 7 deletions

View File

@ -56,6 +56,14 @@ namespace Pal.Client.Configuration
OnlyVisibleAfterPomander = false,
Fill = true
};
public MarkerConfiguration GoldCoffers { get; set; } = new()
{
Show = false,
Color = ImGui.ColorConvertFloat4ToU32(new Vector4(1, 1, 0, 0.4f)),
OnlyVisibleAfterPomander = false,
Fill = true
};
}
public class MarkerConfiguration

View File

@ -250,6 +250,12 @@ namespace Pal.Client.Floors
CreateRenderElement(location, elements, DetermineColor(location),
_configuration.DeepDungeons.SilverCoffers);
}
else if (location.Type == MemoryLocation.EType.GoldCoffer &&
_configuration.DeepDungeons.GoldCoffers.Show)
{
CreateRenderElement(location, elements, DetermineColor(location),
_configuration.DeepDungeons.GoldCoffers);
}
}
if (elements.Count == 0)
@ -279,10 +285,12 @@ namespace Pal.Client.Floors
private uint DetermineColor(EphemeralLocation location)
{
if (location.Type == MemoryLocation.EType.SilverCoffer)
return _configuration.DeepDungeons.SilverCoffers.Color;
return RenderData.ColorInvisible;
return location.Type switch
{
MemoryLocation.EType.SilverCoffer => _configuration.DeepDungeons.SilverCoffers.Color,
MemoryLocation.EType.GoldCoffer => _configuration.DeepDungeons.GoldCoffers.Color,
_ => RenderData.ColorInvisible
};
}
private void CreateRenderElement(MemoryLocation location, List<IRenderElement> elements, uint color,
@ -411,6 +419,15 @@ namespace Pal.Client.Floors
Seen = true,
});
break;
case 2007358:
ephemeralLocations.Add(new EphemeralLocation
{
Type = MemoryLocation.EType.GoldCoffer,
Position = obj.Position,
Seen = true
});
break;
}
}

View File

@ -26,6 +26,7 @@ namespace Pal.Client.Floors
Hoard,
SilverCoffer,
GoldCoffer,
}
public override bool Equals(object? obj)

View File

@ -176,6 +176,43 @@ namespace Pal.Client.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Gold Coffer color.
/// </summary>
internal static string Config_GoldCoffer_Color {
get {
return ResourceManager.GetString("Config_GoldCoffer_Color", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Draw filled.
/// </summary>
internal static string Config_GoldCoffer_Filled {
get {
return ResourceManager.GetString("Config_GoldCoffer_Filled", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show gold coffers on current floor.
/// </summary>
internal static string Config_GoldCoffer_Show {
get {
return ResourceManager.GetString("Config_GoldCoffer_Show", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Shows nearby gold coffers (containing pomanders) on the current floor.
///This is not synchronized with other players and not saved between floors/runs..
/// </summary>
internal static string Config_GoldCoffers_ToolTip {
get {
return ResourceManager.GetString("Config_GoldCoffers_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hoard Coffer color.
/// </summary>
@ -357,7 +394,7 @@ namespace Pal.Client.Properties {
}
/// <summary>
/// Looks up a localized string similar to Shows all the silver coffers visible to you on the current floor.
/// Looks up a localized string similar to Shows nearby silver coffers (gear upgrades and magicites) on the current floor.
///This is not synchronized with other players and not saved between floors/runs..
/// </summary>
internal static string Config_SilverCoffers_ToolTip {

View File

@ -146,7 +146,7 @@ When using a Pomander of Safety, all traps are hidden.</value>
<value>Show silver coffers on current floor</value>
</data>
<data name="Config_SilverCoffers_ToolTip" xml:space="preserve">
<value>Shows all the silver coffers visible to you on the current floor.
<value>Shows nearby silver coffers (gear upgrades and magicites) on the current floor.
This is not synchronized with other players and not saved between floors/runs.</value>
</data>
<data name="Config_SilverCoffer_Color" xml:space="preserve">
@ -156,6 +156,20 @@ This is not synchronized with other players and not saved between floors/runs.</
<value>Draw filled</value>
<comment>Whether silver coffers should only be drawn with the circle outline or as filled circle.</comment>
</data>
<data name="Config_GoldCoffer_Show" xml:space="preserve">
<value>Show gold coffers on current floor</value>
</data>
<data name="Config_GoldCoffers_ToolTip" xml:space="preserve">
<value>Shows nearby gold coffers (containing pomanders) on the current floor.
This is not synchronized with other players and not saved between floors/runs.</value>
</data>
<data name="Config_GoldCoffer_Color" xml:space="preserve">
<value>Gold Coffer color</value>
</data>
<data name="Config_GoldCoffer_Filled" xml:space="preserve">
<value>Draw filled</value>
<comment>Whether gold coffers should only be drawn with the circle outline or as filled circle.</comment>
</data>
<!-- Config Window: Community -->
<data name="ConfigTab_Community" xml:space="preserve">

View File

@ -12,6 +12,7 @@ namespace Pal.Client.Rendering
{ MemoryLocation.EType.Trap, new MarkerConfig { Radius = 1.7f } },
{ MemoryLocation.EType.Hoard, new MarkerConfig { Radius = 1.7f, OffsetY = -0.03f } },
{ MemoryLocation.EType.SilverCoffer, new MarkerConfig { Radius = 1f } },
{ MemoryLocation.EType.GoldCoffer, new MarkerConfig { Radius = 1f } },
};
public float OffsetY { get; private init; }

View File

@ -22,7 +22,6 @@ namespace Pal.Client.Scheduled
protected override void Run(QueuedConfigUpdate queued, ref bool recreateLayout)
{
// TODO filter stuff if offline
_renderAdapter.ConfigUpdated();
}
}

View File

@ -47,6 +47,7 @@ namespace Pal.Client.Windows
private ConfigurableMarker _trapConfig = new();
private ConfigurableMarker _hoardConfig = new();
private ConfigurableMarker _silverConfig = new();
private ConfigurableMarker _goldConfig = new();
private string? _connectionText;
private bool _switchToCommunityTab;
@ -124,6 +125,7 @@ namespace Pal.Client.Windows
_trapConfig = new ConfigurableMarker(_configuration.DeepDungeons.Traps);
_hoardConfig = new ConfigurableMarker(_configuration.DeepDungeons.HoardCoffers);
_silverConfig = new ConfigurableMarker(_configuration.DeepDungeons.SilverCoffers);
_goldConfig = new ConfigurableMarker(_configuration.DeepDungeons.GoldCoffers);
_connectionText = null;
UpdateLastImport();
@ -162,6 +164,7 @@ namespace Pal.Client.Windows
_configuration.DeepDungeons.Traps = _trapConfig.Build();
_configuration.DeepDungeons.HoardCoffers = _hoardConfig.Build();
_configuration.DeepDungeons.SilverCoffers = _silverConfig.Build();
_configuration.DeepDungeons.GoldCoffers = _goldConfig.Build();
_configurationManager.Save(_configuration);
@ -174,6 +177,7 @@ namespace Pal.Client.Windows
{
if (ImGui.BeginTabItem($"{Localization.ConfigTab_DeepDungeons}###TabDeepDungeons"))
{
ImGui.PushID("trap");
ImGui.Checkbox(Localization.Config_Traps_Show, ref _trapConfig.Show);
ImGui.Indent();
ImGui.BeginDisabled(!_trapConfig.Show);
@ -184,9 +188,11 @@ namespace Pal.Client.Windows
ImGuiComponents.HelpMarker(Localization.Config_Traps_HideImpossible_ToolTip);
ImGui.EndDisabled();
ImGui.Unindent();
ImGui.PopID();
ImGui.Separator();
ImGui.PushID("hoard");
ImGui.Checkbox(Localization.Config_HoardCoffers_Show, ref _hoardConfig.Show);
ImGui.Indent();
ImGui.BeginDisabled(!_hoardConfig.Show);
@ -199,9 +205,11 @@ namespace Pal.Client.Windows
ImGuiComponents.HelpMarker(Localization.Config_HoardCoffers_HideImpossible_ToolTip);
ImGui.EndDisabled();
ImGui.Unindent();
ImGui.PopID();
ImGui.Separator();
ImGui.PushID("silver");
ImGui.Checkbox(Localization.Config_SilverCoffer_Show, ref _silverConfig.Show);
ImGuiComponents.HelpMarker(Localization.Config_SilverCoffers_ToolTip);
ImGui.Indent();
@ -212,6 +220,22 @@ namespace Pal.Client.Windows
ImGui.Checkbox(Localization.Config_SilverCoffer_Filled, ref _silverConfig.Fill);
ImGui.EndDisabled();
ImGui.Unindent();
ImGui.PopID();
ImGui.Separator();
ImGui.PushID("gold");
ImGui.Checkbox(Localization.Config_GoldCoffer_Show, ref _goldConfig.Show);
ImGuiComponents.HelpMarker(Localization.Config_GoldCoffers_ToolTip);
ImGui.Indent();
ImGui.BeginDisabled(!_goldConfig.Show);
ImGui.Spacing();
ImGui.ColorEdit4(Localization.Config_GoldCoffer_Color, ref _goldConfig.Color,
ImGuiColorEditFlags.NoInputs);
ImGui.Checkbox(Localization.Config_GoldCoffer_Filled, ref _goldConfig.Fill);
ImGui.EndDisabled();
ImGui.Unindent();
ImGui.PopID();
ImGui.Separator();
@ -408,6 +432,15 @@ namespace Pal.Client.Windows
$"{silverCoffers} silver coffer{(silverCoffers == 1 ? "" : "s")} visible on current floor");
}
if (_goldConfig.Show)
{
int goldCoffers =
_floorService.EphemeralLocations.Count(x =>
x.Type == MemoryLocation.EType.GoldCoffer);
ImGui.Text(
$"{goldCoffers} silver coffer{(goldCoffers == 1 ? "" : "s")} visible on current floor");
}
ImGui.Text($"Pomander of Sight: {_territoryState.PomanderOfSight}");
ImGui.Text($"Pomander of Intuition: {_territoryState.PomanderOfIntuition}");
}