Skip to content

Commit

Permalink
Merge pull request #20 from jsebold666/hotfix/map-trackings
Browse files Browse the repository at this point in the history
Hotfix for World Map tracking, HighlightTileAtRangeSpell for all spells, and gump for change elf to human
  • Loading branch information
jsebold666 authored Jan 29, 2024
2 parents a06fe4e + 11a86b6 commit 98fe47f
Show file tree
Hide file tree
Showing 9 changed files with 859 additions and 26 deletions.
4 changes: 4 additions & 0 deletions src/ClassicUO.Client/ClassicUO.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
<DataFiles_vulkan Include="$(ProjectDir)..\..\external\vulkan\icd.d\*.*" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<Reference Include="cuoapi">
<HintPath>..\..\external\cuoapi\cuoapi.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/ClassicUO.Client/Game/GameObjects/Views/LandView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public override bool Draw(UltimaBatcher2D batcher, int posX, int posY, float dep
}
if (ProfileManager.CurrentProfile.HighlightTileAtRangeSpell)
{
if (GameCursor._spellTime >= 1 && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRangeSpell)
if (GameActions.LastSpellIndexCursor > 0 && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRangeSpell)
{
hueVec.X = ProfileManager.CurrentProfile.HighlightTileRangeHueSpell;
hueVec.Y = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/ClassicUO.Client/Game/GameObjects/Views/MultiView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public override bool Draw(UltimaBatcher2D batcher, int posX, int posY, float dep
}
if (ProfileManager.CurrentProfile.HighlightTileAtRangeSpell)
{
if (GameCursor._spellTime >= 1 && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRangeSpell)
if (GameActions.LastSpellIndexCursor > 0 && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRangeSpell)
{
hueVec.X = ProfileManager.CurrentProfile.HighlightTileRangeHueSpell;
hueVec.Y = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/ClassicUO.Client/Game/GameObjects/Views/StaticView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public override bool Draw(UltimaBatcher2D batcher, int posX, int posY, float dep
}
if (ProfileManager.CurrentProfile.HighlightTileAtRangeSpell)
{
if (GameCursor._spellTime >= 1 && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRangeSpell)
if (GameActions.LastSpellIndexCursor > 0 && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRangeSpell)
{
hueVec.X = ProfileManager.CurrentProfile.HighlightTileRangeHueSpell;
hueVec.Y = 1;
Expand Down
51 changes: 33 additions & 18 deletions src/ClassicUO.Client/Game/Managers/WorldMapEntityManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#endregion

using System;
using Microsoft.Extensions.Caching.Memory;
using System.Collections.Generic;
using ClassicUO.Configuration;
using ClassicUO.Game.Data;
Expand All @@ -43,33 +45,46 @@ namespace ClassicUO.Game.Managers
{
internal class WMapEntity
{
public bool IsGuild;
public uint LastUpdate;
public string Name;
public uint Serial;
public int X, Y, HP, Map;
public static readonly Dictionary<uint, string> nameCache = new Dictionary<uint, string>();

public WMapEntity(uint serial)
{
Serial = serial;

//var mob = World.Mobiles.Get(serial);
var mob = World.Mobiles.Get(serial);

//if (mob != null)
// GetName();
if (mob != null)
{
GetName(serial);
}

}

public bool IsGuild;
public uint LastUpdate;
public string Name;
public readonly uint Serial;
public int X, Y, HP, Map;

//public string GetName()
//{
// Entity e = World.Get(Serial);
public string GetName(uint Serial)
{
Entity e = World.Get(Serial);

// if (e != null && !e.IsDestroyed && !string.IsNullOrEmpty(e.Name) && Name != e.Name)
// {
// Name = e.Name;
// }
if (e != null && !e.IsDestroyed && !string.IsNullOrEmpty(e.Name) && Name != e.Name)
{
Name = e.Name;
nameCache[Serial] = Name;
}

// return string.IsNullOrEmpty(Name) ? "<out of range>" : Name;
//}
if (nameCache.TryGetValue(Serial, out string cachedName))
{
var teste = string.IsNullOrEmpty(Name) ? cachedName : Name;
return string.IsNullOrEmpty(Name) ? cachedName : Name;
}
else
{
return string.IsNullOrEmpty(Name) ? "<out of range>" : Name;
}
}
}

internal class WorldMapEntityManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public void RequestUpdate()
_updateUI = true;
}

private static ushort GetAnimID(ushort graphic, ushort animID, bool isfemale)
public static ushort GetAnimID(ushort graphic, ushort animID, bool isfemale)
{
int offset = isfemale ? Constants.FEMALE_GUMP_OFFSET : Constants.MALE_GUMP_OFFSET;

Expand Down Expand Up @@ -395,7 +395,7 @@ private static ushort GetAnimID(ushort graphic, ushort animID, bool isfemale)
return (ushort) (animID + offset);
}

private class GumpPicEquipment : GumpPic
public class GumpPicEquipment : GumpPic
{
private readonly Layer _layer;

Expand Down
Loading

0 comments on commit 98fe47f

Please sign in to comment.