Skip to content

Commit

Permalink
Merge pull request #191 from bittiez/dev
Browse files Browse the repository at this point in the history
v3.13.0
  • Loading branch information
bittiez authored Nov 17, 2023
2 parents 19bcf00 + edcad83 commit b5d694e
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 55 deletions.
4 changes: 2 additions & 2 deletions src/ClassicUO.Client/ClassicUO.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<ApplicationIcon>cuoicon.ico</ApplicationIcon>
<AssemblyName>ClassicUO</AssemblyName>
<RootNamespace>ClassicUO</RootNamespace>
<AssemblyVersion>3.12.0</AssemblyVersion>
<FileVersion>3.12.0</FileVersion>
<AssemblyVersion>3.13.0</AssemblyVersion>
<FileVersion>3.13.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
Expand Down
8 changes: 7 additions & 1 deletion src/ClassicUO.Client/Configuration/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,8 @@ public int CoolDownConditionCount
}
};

public bool UseLastMovedCooldownPosition { get; set; } = false;
public bool UseLastMovedCooldownPosition { get; set; } = false;
public bool CloseHealthBarIfAnchored { get; set; } = false;



Expand Down Expand Up @@ -744,6 +745,11 @@ public List<Gump> ReadGumps(string path)
int y = int.Parse(xml.GetAttribute(nameof(y)));
uint serial = uint.Parse(xml.GetAttribute(nameof(serial)));

if(uint.TryParse(xml.GetAttribute("serverSerial"), out uint serverSerial))
{
UIManager.SavePosition(serverSerial, new Point(x, y));
}

Gump gump = null;

switch (type)
Expand Down
6 changes: 6 additions & 0 deletions src/ClassicUO.Client/Game/Managers/SpellVisualRangeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,18 @@ private void SetCasting(SpellRangeInfo spell)
LastSpellTime = DateTime.Now;
currentSpell = spell;
isCasting = true;
if(currentSpell != null && currentSpell.FreezeCharacterWhileCasting)
{
World.Player.Flags |= Flags.Frozen;
}
}

public void ClearCasting()
{
isCasting = false;
currentSpell = null;
LastSpellTime = DateTime.MinValue;
World.Player.Flags &= ~Flags.Frozen;
}

public SpellRangeInfo GetCurrentSpell()
Expand Down Expand Up @@ -422,6 +427,7 @@ public class SpellRangeInfo
public bool IsLinear { get; set; } = false;
public double CastTime { get; set; } = 0.0;
public bool ShowCastRangeDuringCasting { get; set; } = false;
public bool FreezeCharacterWhileCasting { get; set; } = false;

public static SpellRangeInfo FromSpellDef(SpellDefinition spell)
{
Expand Down
4 changes: 2 additions & 2 deletions src/ClassicUO.Client/Game/Managers/UIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ public static void ShowGamePopup(PopupMenuGump popup)

public static bool IsModalControlOpen()
{
foreach (Gump control in Gumps)
for (LinkedListNode<Gump> last = Gumps.Last; last != null; last = last.Previous)
{
if (control.IsModal)
if (last.Value.IsModal)
{
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion src/ClassicUO.Client/Game/UI/Gumps/GridContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,9 @@ private void _hit_MouseUp(object sender, MouseEventArgs e)
}
else
{
Rectangle containerBounds = ContainerManager.Get(container.Graphic).Bounds;
gridContainer.gridSlotManager.AddLockedItemSlot(Client.Game.GameCursor.ItemHold.Serial, slot);
GameActions.DropItem(Client.Game.GameCursor.ItemHold.Serial, 0xFFFF, 0xFFFF, 0, container.Serial);
GameActions.DropItem(Client.Game.GameCursor.ItemHold.Serial, containerBounds.Width / 2, containerBounds.Height / 2, 0, container.Serial);
Mouse.CancelDoubleClick = true;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/ClassicUO.Client/Game/UI/Gumps/Gump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public Gump(uint local, uint server)
AcceptKeyboardInput = false;
}

public bool CanBeSaved => GumpType != Gumps.GumpType.None;
public bool CanBeSaved => GumpType != Gumps.GumpType.None || ServerSerial != 0;

public virtual GumpType GumpType { get; }

Expand Down Expand Up @@ -155,6 +155,7 @@ public virtual void Save(XmlTextWriter writer)
writer.WriteAttributeString("x", X.ToString());
writer.WriteAttributeString("y", Y.ToString());
writer.WriteAttributeString("serial", LocalSerial.ToString());
writer.WriteAttributeString("serverSerial", ServerSerial.ToString());
writer.WriteAttributeString("isLocked", isLocked.ToString());
writer.WriteAttributeString("alphaOffset", AlphaOffset.ToString());
}
Expand Down
6 changes: 5 additions & 1 deletion src/ClassicUO.Client/Game/UI/Gumps/HealthBarGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,11 @@ public override bool Draw(UltimaBatcher2D batcher, int x, int y)

protected bool CheckIfAnchoredElseDispose()
{
if (UIManager.AnchorManager[this] == null && LocalSerial != World.Player)
if (IsLocked)
{
return false;
}
if ((UIManager.AnchorManager[this] == null || ProfileManager.CurrentProfile.CloseHealthBarIfAnchored) && LocalSerial != World.Player)
{
Dispose();

Expand Down
7 changes: 6 additions & 1 deletion src/ClassicUO.Client/Game/UI/Gumps/OptionsGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ internal class OptionsGump : Gump
private HSliderBar _showSkillsMessageDelta;

private Checkbox _leftAlignToolTips, _namePlateHealthOnlyWarmode, _enableHealthIndicator, _spellIconDisplayHotkey, _enableAlphaScrollWheel, _useModernShop, _forceCenterAlignMobileTooltips, _openHealthBarForLastAttack;
private Checkbox _hideJournalBorder, _hideJournalTimestamp, _gridHideBorder, _skillProgressBarOnChange, _displaySpellIndicators, _uselastCooldownPosition;
private Checkbox _hideJournalBorder, _hideJournalTimestamp, _gridHideBorder, _skillProgressBarOnChange, _displaySpellIndicators, _uselastCooldownPosition, _closeHPBarWhenAnchored;
private InputField _healthIndicatorPercentage, _healthIndicatorWidth, _tooltipHeaderFormat, _skillProgressBarFormat;
private ModernColorPicker.HueDisplay _mainWindowHuePicker, _spellIconHotkeyHue, _tooltipBGHue;
private HSliderBar _spellIconScale, _journalFontSize, _tooltipFontSize, _gameWindowSideChatFontSize, _overheadFontSize, _overheadTextWidth, _textStrokeSize, _gridHightlightLineSize, _maxJournalEntries;
Expand Down Expand Up @@ -4389,6 +4389,10 @@ private void BuildTazUO()
};


section.Add(AddLabel(null, "Close anchored healthbars when automatically closing healthbars", 0, 0));
section.AddRight(_closeHPBarWhenAnchored = AddCheckBox(null, "", _currentProfile.CloseHealthBarIfAnchored, 0, 0));


NiceButton autoLoot;
section.Add(autoLoot = new NiceButton(0, 0, 150, TEXTBOX_HEIGHT, ButtonAction.Activate, "Open auto loot options") { IsSelectable = false, DisplayBorder = true });
autoLoot.MouseUp += (s, e) => {
Expand Down Expand Up @@ -5095,6 +5099,7 @@ private void Apply()
UIManager.Add(new ResizableJournal());
}
}
_currentProfile.CloseHealthBarIfAnchored = _closeHPBarWhenAnchored.IsChecked;
_currentProfile.UseLastMovedCooldownPosition = _uselastCooldownPosition.IsChecked;

_currentProfile.InfoBarFont = TrueTypeLoader.Instance.Fonts[_infoBarFont.SelectedIndex];
Expand Down
23 changes: 22 additions & 1 deletion src/ClassicUO.Client/Game/UI/Gumps/PaperdollGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ internal class PaperDollGump : TextContainerGump
private GumpPic _picBase;
private GumpPic _profilePic;
private readonly EquipmentSlot[] _slots = new EquipmentSlot[6];
private readonly EquipmentSlot[] _slots_right = new EquipmentSlot[6];
private Label _titleLabel;
private GumpPic _virtueMenuPic;
private Button _warModeBtn;
Expand Down Expand Up @@ -314,6 +315,19 @@ private void BuildGump()

Add(_slots[5] = new EquipmentSlot(0, 2, 75 + 21 * 5, Layer.Tunic, this));

// Right side equip slots
Add(_slots_right[0] = new EquipmentSlot(0, 166, 75, Layer.Torso, this));

Add(_slots_right[1] = new EquipmentSlot(0, 166, 75 + 21, Layer.Arms, this));

Add(_slots_right[2] = new EquipmentSlot(0, 166, 75 + 21 * 2, Layer.Shirt, this));

Add(_slots_right[3] = new EquipmentSlot(0, 166, 75 + 21 * 3, Layer.Pants, this));

Add(_slots_right[4] = new EquipmentSlot(0, 166, 75 + 21 * 4, Layer.Skirt, this));

Add(_slots_right[5] = new EquipmentSlot(0, 166, 75 + 21 * 5, Layer.Shoes, this));

// Paperdoll control!
_paperDollInteractable = new PaperDollInteractable(8, 19, LocalSerial, this);
Add(_paperDollInteractable);
Expand Down Expand Up @@ -613,6 +627,13 @@ protected override void UpdateContents()

_slots[i].LocalSerial = mobile.FindItemByLayer((Layer)idx)?.Serial ?? 0;
}

for (int i = 0; i < _slots_right.Length; i++)
{
int idx = (int)_slots_right[i].Layer;

_slots_right[i].LocalSerial = mobile.FindItemByLayer((Layer)idx)?.Serial ?? 0;
}
}
}

Expand Down Expand Up @@ -790,7 +811,7 @@ public override void Update()
{
Item it_at_layer = mobile.FindItemByLayer(Layer);

if (item != it_at_layer || _itemGump == null)
if ((it_at_layer != null && _itemGump != null && _itemGump.Graphic != it_at_layer.DisplayedGraphic) || _itemGump == null)
{
if (_itemGump != null)
{
Expand Down
8 changes: 8 additions & 0 deletions src/ClassicUO.Client/Game/UI/Gumps/VersionHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ namespace ClassicUO.Game.UI.Gumps
internal class VersionHistory : Gump
{
private static string[] updateTexts = {
"/c[white][3.13.0]/cd\n" +
"- Fix item unintentional stacking\n" +
"- Potential small bug fix\n" +
"- Option to close anchored healthbars automatically\n" +
"- Added optional freeze on cast to spell indicator system\n" +
"- Save server side gump positions\n" +
"- Added addition equipment slots to the original paperdoll gump",

"/c[white][3.12.0]/cd\n" +
"- Added Exclude self to advanced nameplate options\n" +
"- Bug fix for spell indicator loading\n" +
Expand Down
89 changes: 45 additions & 44 deletions src/ClassicUO.Client/Network/PacketHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2145,9 +2145,9 @@ private static void UpdateSkills(ref StackDataReader p)
{
if (lastBase != skill.BaseFixed)
Skill.InvokeSkillBaseChanged(id);
if(lastValue != skill.ValueFixed)
if (lastValue != skill.ValueFixed)
Skill.InvokeSkillValueChanged(id);
if(lastCap != skill.CapFixed)
if (lastCap != skill.CapFixed)
Skill.InvokeSkillCapChanged(id);
}

Expand Down Expand Up @@ -3732,47 +3732,47 @@ private static void UnicodeTalk(ref StackDataReader p)
{
Span<byte> buffer =
stackalloc byte[] {
0x03,
0x00,
0x28,
0x20,
0x00,
0x34,
0x00,
0x03,
0xdb,
0x13,
0x14,
0x3f,
0x45,
0x2c,
0x58,
0x0f,
0x5d,
0x44,
0x2e,
0x50,
0x11,
0xdf,
0x75,
0x5c,
0xe0,
0x3e,
0x71,
0x4f,
0x31,
0x34,
0x05,
0x4e,
0x18,
0x1e,
0x72,
0x0f,
0x59,
0xad,
0xf5,
0x00
};
0x03,
0x00,
0x28,
0x20,
0x00,
0x34,
0x00,
0x03,
0xdb,
0x13,
0x14,
0x3f,
0x45,
0x2c,
0x58,
0x0f,
0x5d,
0x44,
0x2e,
0x50,
0x11,
0xdf,
0x75,
0x5c,
0xe0,
0x3e,
0x71,
0x4f,
0x31,
0x34,
0x05,
0x4e,
0x18,
0x1e,
0x72,
0x0f,
0x59,
0xad,
0xf5,
0x00
};

NetClient.Socket.Send(buffer);

Expand Down Expand Up @@ -7235,7 +7235,8 @@ string[] lines
GameActions.Print($"If I am on the correct facet I think these coords should be somewhere near.. {location.X} and {location.Y}..");

MenuButton menu = new MenuButton(25, Color.Black.PackedValue, 0.75f, "Menu") { X = gump.Width - 46, Y = 6 };
menu.MouseUp += (s, e) => {
menu.MouseUp += (s, e) =>
{
menu.ContextMenu?.Show();
};

Expand Down
2 changes: 1 addition & 1 deletion tazuoversioninfo.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12.0
3.13.0

0 comments on commit b5d694e

Please sign in to comment.