Skip to content

Commit

Permalink
Journal and modern paperdoll anchor can be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
bittiez committed Feb 1, 2024
1 parent d2bb90c commit ffb8d25
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/ClassicUO.Client/Configuration/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ public class TazUO
public string JournalStyle { get; set; } = "Journal style";
public string JournalHideBorders { get; set; } = "Hide borders";
public string HideTimestamp { get; set; } = "Hide timestamp";
public string JournalAnchor { get; set; } = "Make anchorable";
#endregion

#region ModernPaperdoll
Expand All @@ -443,6 +444,7 @@ public class TazUO
public string PaperdollHue { get; set; } = "Paperdoll hue";
public string DurabilityBarHue { get; set; } = "Durability bar hue";
public string ShowDurabilityBarBelow { get; set; } = "Show durability bar below %";
public string PaperdollAnchor { get; set; } = "Make anchorable";
#endregion

#region Nameplates
Expand Down
3 changes: 3 additions & 0 deletions src/ClassicUO.Client/Configuration/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,9 @@ public int CoolDownConditionCount

public uint SOSGumpID { get; set; } = 1915258020;

public bool ModernPaperdollAnchorEnabled { get; set; } = false;
public bool JournalAnchorEnabled { get; set; } = false;


public void Save(string path, bool saveGumps = true)
{
Expand Down
13 changes: 13 additions & 0 deletions src/ClassicUO.Client/Game/UI/Gumps/ModernOptionsGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2084,6 +2084,12 @@ private void BuildTazUO()
{
profile.HideJournalTimestamp = b;
}), true, page);
content.BlankLine();
content.AddToRight(c = new CheckboxWithLabel(lang.GetTazUO.MakeAnchorable, 0, profile.JournalAnchorEnabled, (b) =>
{
profile.JournalAnchorEnabled = b;
ResizableJournal.UpdateJournalOptions();
}), true, page);
#endregion

#region Modern paperdoll
Expand All @@ -2105,13 +2111,20 @@ private void BuildTazUO()
content.AddToRight(new ModernColorPickerWithLabel(lang.GetTazUO.DurabilityBarHue, profile.ModernPaperDollDurabilityHue, (h) =>
{
profile.ModernPaperDollDurabilityHue = h;
ModernPaperdoll.UpdateAllOptions();
}), true, page);
content.RemoveIndent();
content.BlankLine();
content.AddToRight(new SliderWithLabel(lang.GetTazUO.ShowDurabilityBarBelow, 0, Theme.SLIDER_WIDTH, 1, 100, profile.ModernPaperDoll_DurabilityPercent, (i) =>
{
profile.ModernPaperDoll_DurabilityPercent = i;
}), true, page);
content.BlankLine();
content.AddToRight(c = new CheckboxWithLabel(lang.GetTazUO.PaperdollAnchor, 0, profile.ModernPaperdollAnchorEnabled, (b) =>
{
profile.ModernPaperdollAnchorEnabled = b;
ModernPaperdoll.UpdateAllOptions();
}), true, page);
#endregion

#region Nameplates
Expand Down
10 changes: 3 additions & 7 deletions src/ClassicUO.Client/Game/UI/Gumps/ModernPaperdoll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@
using ClassicUO.Game.Scenes;
using ClassicUO.Game.UI.Controls;
using ClassicUO.Input;
using ClassicUO.Network;
using ClassicUO.Renderer;
using ClassicUO.Renderer.Animations;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml;

namespace ClassicUO.Game.UI.Gumps
Expand All @@ -38,12 +34,11 @@ internal class ModernPaperdoll : AnchorableGump
public ModernPaperdoll(uint localSerial) : base(localSerial, 0)
{
UIManager.GetGump<MinimizedPaperdoll>()?.Dispose();
#region ASSIGN FIELDS
#region SET VARS
AcceptMouseInput = true;
CanMove = true;
CanCloseWithRightClick = true;
#endregion
#region SET VARS
AnchorType = ProfileManager.CurrentProfile.ModernPaperdollAnchorEnabled ? ANCHOR_TYPE.NONE : ANCHOR_TYPE.DISABLED;
Width = WIDTH;
Height = HEIGHT;
GroupMatrixHeight = Height;
Expand Down Expand Up @@ -225,6 +220,7 @@ protected override void UpdateContents()
public void UpdateOptions()
{
backgroundImage.Hue = ProfileManager.CurrentProfile.ModernPaperDollHue;
AnchorType = ProfileManager.CurrentProfile.ModernPaperdollAnchorEnabled ? ANCHOR_TYPE.NONE : ANCHOR_TYPE.DISABLED;
foreach (var layerSlot in itemLayerSlots)
{
layerSlot.Value.UpdateOptions();
Expand Down
11 changes: 6 additions & 5 deletions src/ClassicUO.Client/Game/UI/Gumps/ResizableJournal.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using ClassicUO.Configuration;
using ClassicUO.Game.Data;
using ClassicUO.Game.GameObjects;
using ClassicUO.Game.Managers;
using ClassicUO.Game.UI.Controls;
using ClassicUO.Input;
using ClassicUO.Renderer;
using ClassicUO.Utility.Collections;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using ClassicUO.Game.GameObjects;
using System.Linq;

namespace ClassicUO.Game.UI.Gumps
Expand Down Expand Up @@ -50,7 +50,7 @@ internal class ResizableJournal : ResizableGump
#endregion
public ResizableJournal() : base(_lastWidth, _lastHeight, MIN_WIDTH, MIN_HEIGHT, 0, 0)
{
AnchorType = ANCHOR_TYPE.NONE;
AnchorType = ProfileManager.CurrentProfile.JournalAnchorEnabled ? ANCHOR_TYPE.NONE : ANCHOR_TYPE.DISABLED;
CanMove = true;
_prevCanMove = true;
AcceptMouseInput = true;
Expand Down Expand Up @@ -303,13 +303,14 @@ public void UpdateOptions()
_backgroundTexture.Alpha = (float)ProfileManager.CurrentProfile.JournalOpacity / 100;
BorderControl.Alpha = (float)ProfileManager.CurrentProfile.JournalOpacity / 100;
_background.Hue = ProfileManager.CurrentProfile.AltJournalBackgroundHue;
AnchorType = ProfileManager.CurrentProfile.JournalAnchorEnabled ? ANCHOR_TYPE.NONE : ANCHOR_TYPE.DISABLED;

BuildBorder();
}

public static void UpdateJournalOptions()
{
foreach(ResizableJournal j in UIManager.Gumps.OfType<ResizableJournal>())
foreach (ResizableJournal j in UIManager.Gumps.OfType<ResizableJournal>())
{
j.UpdateOptions();
}
Expand Down Expand Up @@ -423,7 +424,7 @@ public JournalEntriesContainer(int x, int y, int width, int height, ScrollBarBas
_scrollBar.IsVisible = false;
AcceptMouseInput = true;
CanMove = true;

X = x;
Y = y;
Width = lastWidth = width;
Expand Down

0 comments on commit ffb8d25

Please sign in to comment.