Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix map #18

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
41 changes: 25 additions & 16 deletions src/ClassicUO.Client/Dust765/Dust765/CombatCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
else if (ww < 1)
ww = 0;

World.Player.UpdateHits((byte) ww);
World.Player.UpdateHits((byte)ww);
}

if (World.Player.HitsPercentage < 20)
Expand All @@ -292,7 +292,7 @@
else if (World.Player.HitsPercentage < 80)
color = 0x0035; //yellow (but shows green?)
else if (World.Player.HitsPercentage == 100)
color = (ushort) Notoriety.GetHue(World.Player.NotorietyFlag);
color = (ushort)Notoriety.GetHue(World.Player.NotorietyFlag);
// "original colors from overhead %, < 30 0x0021, < 50 0x0030, < 80 0x0058"

return color;
Expand Down Expand Up @@ -376,6 +376,7 @@
}

//GAME\GAMEOBJECTS\VIEWS\ - MULTIVIEW.CS - STATICVIEW.CS - TILEVIEW.CS
//22 - Teleport
//24 - Wall of Stone
//28 - Fire Field
//39 - Poison Field
Expand Down Expand Up @@ -444,6 +445,7 @@
}
}
}

if (GameActions.LastSpellIndexCursor == 28 || GameActions.LastSpellIndexCursor == 39 || GameActions.LastSpellIndexCursor == 47 || GameActions.LastSpellIndexCursor == 50)
{
//Calc _fieldEastToWest
Expand Down Expand Up @@ -515,7 +517,7 @@
}
}
}
if (GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55)
if (GameActions.LastSpellIndexCursor == 22 || GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55)
{
if (SelectedObject.Object != null && (SelectedObject.Object.RealScreenPosition.X + 22) == obj.RealScreenPosition.X && (SelectedObject.Object.RealScreenPosition.Y + 22) == obj.RealScreenPosition.Y)
{
Expand Down Expand Up @@ -677,6 +679,7 @@
}
}
}

if (GameActions.LastSpellIndexCursor == 28 || GameActions.LastSpellIndexCursor == 39 || GameActions.LastSpellIndexCursor == 47 || GameActions.LastSpellIndexCursor == 50)
{
//Calc _fieldEastToWest
Expand Down Expand Up @@ -748,7 +751,7 @@
}
}
}
if (GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55)
if (GameActions.LastSpellIndexCursor == 22 || GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55)
{
if (SelectedObject.Object != null && (SelectedObject.Object.RealScreenPosition.X + 22) == obj.RealScreenPosition.X && (SelectedObject.Object.RealScreenPosition.Y + 22) == obj.RealScreenPosition.Y)
{
Expand Down Expand Up @@ -850,6 +853,9 @@
}
return false;
}



public static bool LandFieldPreview(Land obj)
{
if (GameCursor._spellTime >= 1)
Expand Down Expand Up @@ -911,6 +917,7 @@
}
}
}

if (GameActions.LastSpellIndexCursor == 28 || GameActions.LastSpellIndexCursor == 39 || GameActions.LastSpellIndexCursor == 47 || GameActions.LastSpellIndexCursor == 50)
{
//Calc _fieldEastToWest
Expand Down Expand Up @@ -982,7 +989,7 @@
}
}
}
if (GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55)
if (GameActions.LastSpellIndexCursor == 22 || GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55)
{
if (SelectedObject.Object != null && (SelectedObject.Object.RealScreenPosition.X + 22) == obj.RealScreenPosition.X && (SelectedObject.Object.RealScreenPosition.Y + 22) == obj.RealScreenPosition.Y)
{
Expand Down Expand Up @@ -1088,10 +1095,11 @@
{
if (GameCursor._spellTime >= 1)
{

if (GameActions.LastSpellIndexCursor == 24)
{
//Calc _fieldEastToWest
if (SelectedObject.Object == obj)

Check warning on line 1102 in src/ClassicUO.Client/Dust765/Dust765/CombatCollection.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'Entity'

Check warning on line 1102 in src/ClassicUO.Client/Dust765/Dust765/CombatCollection.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'Entity'

Check warning on line 1102 in src/ClassicUO.Client/Dust765/Dust765/CombatCollection.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'Entity'
{
int PlayerX = World.Player.X;
int PlayerY = World.Player.Y;
Expand Down Expand Up @@ -1145,10 +1153,11 @@
}
}
}

if (GameActions.LastSpellIndexCursor == 28 || GameActions.LastSpellIndexCursor == 39 || GameActions.LastSpellIndexCursor == 47 || GameActions.LastSpellIndexCursor == 50)
{
//Calc _fieldEastToWest
if (SelectedObject.Object == obj)

Check warning on line 1160 in src/ClassicUO.Client/Dust765/Dust765/CombatCollection.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'Entity'

Check warning on line 1160 in src/ClassicUO.Client/Dust765/Dust765/CombatCollection.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'Entity'

Check warning on line 1160 in src/ClassicUO.Client/Dust765/Dust765/CombatCollection.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'Entity'
{
int PlayerX = World.Player.X;
int PlayerY = World.Player.Y;
Expand Down Expand Up @@ -1216,7 +1225,7 @@
}
}
}
if (GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55)
if (GameActions.LastSpellIndexCursor == 22 || GameActions.LastSpellIndexCursor == 48 || GameActions.LastSpellIndexCursor == 49 || GameActions.LastSpellIndexCursor == 55)
{
if (SelectedObject.Object != null && (SelectedObject.Object.RealScreenPosition.X + 22) == obj.RealScreenPosition.X && (SelectedObject.Object.RealScreenPosition.Y + 22) == obj.RealScreenPosition.Y)
{
Expand Down Expand Up @@ -1343,7 +1352,7 @@
if (ProfileManager.CurrentProfile.OnCastingGump)
{
if (!GameActions.iscasting)
World.Player.OnCasting.Start((uint) GameActions.LastSpellIndexCursor);
World.Player.OnCasting.Start((uint)GameActions.LastSpellIndexCursor);
}
// ## BEGIN - END ## // ONCASTINGGUMP
}
Expand All @@ -1355,7 +1364,7 @@
switch (TargetManager.TargetingType)
{
case TargetType.Neutral:
hue = 0x0000; //BETTER HUE? 0x03B2
hue = 0x03B2; //BETTER HUE? 0x03B2
return hue;

case TargetType.Harmful:
Expand Down Expand Up @@ -1489,8 +1498,8 @@
public static Point CalcUnderChar5(Mobile mobile)
{
Point p = mobile.RealScreenPosition;
p.X += (int) mobile.Offset.X + 22 + 5;
p.Y += (int) (mobile.Offset.Y - mobile.Offset.Z) + 22 + 5;
p.X += (int)mobile.Offset.X + 22 + 5;
p.Y += (int)(mobile.Offset.Y - mobile.Offset.Z) + 22 + 5;

p = Client.Game.Scene.Camera.WorldToScreen(p);

Expand All @@ -1500,8 +1509,8 @@
public static Point CalcUnderChar(Mobile mobile)
{
Point p = mobile.RealScreenPosition;
p.X += (int) mobile.Offset.X + 22;
p.Y += (int) (mobile.Offset.Y - mobile.Offset.Z) + 22;
p.X += (int)mobile.Offset.X + 22;
p.Y += (int)(mobile.Offset.Y - mobile.Offset.Z) + 22;

p = Client.Game.Scene.Camera.WorldToScreen(p);

Expand All @@ -1510,8 +1519,8 @@
public static Point CalcOverChar(Mobile mobile)
{
Point p = mobile.RealScreenPosition;
p.X += (int) mobile.Offset.X + 22;
p.Y += (int) (mobile.Offset.Y - mobile.Offset.Z) + 22;
p.X += (int)mobile.Offset.X + 22;
p.Y += (int)(mobile.Offset.Y - mobile.Offset.Z) + 22;

AnimationsLoader.Instance.GetAnimationDimensions
(
Expand All @@ -1532,8 +1541,8 @@

Point p1 = p;

p1.X = (int) (mobile.RealScreenPosition.X + mobile.Offset.X + 22);
p1.Y = (int) (mobile.RealScreenPosition.Y + (mobile.Offset.Y - mobile.Offset.Z) - (height + centerY + 8 + 22) + (mobile.IsGargoyle && mobile.IsFlying ? -22 : !mobile.IsMounted ? 22 : 0));
p1.X = (int)(mobile.RealScreenPosition.X + mobile.Offset.X + 22);
p1.Y = (int)(mobile.RealScreenPosition.Y + (mobile.Offset.Y - mobile.Offset.Z) - (height + centerY + 8 + 22) + (mobile.IsGargoyle && mobile.IsFlying ? -22 : !mobile.IsMounted ? 22 : 0));

if (mobile.ObjectHandlesStatus == ObjectHandlesStatus.DISPLAYING)
{
Expand Down
5 changes: 5 additions & 0 deletions src/ClassicUO.Client/Game/GameActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

using System;
using ClassicUO.Configuration;
using ClassicUO.Dust765.Dust765;
using ClassicUO.Game.Data;
using ClassicUO.Game.GameObjects;
using ClassicUO.Game.Managers;
Expand Down Expand Up @@ -720,6 +721,7 @@ public static void CastSpellFromBook(int index, uint bookSerial)
// ## BEGIN - END ## // VISUAL HELPERS
LastSpellIndexCursor = index;
GameCursor._spellTime = 0;

// ## BEGIN - END ## // VISUAL HELPERS
// ## BEGIN - END ## // ONCASTINGGUMP
if (ProfileManager.CurrentProfile.OnCastingGump)
Expand All @@ -741,6 +743,8 @@ public static void CastSpell(int index)
// ## BEGIN - END ## // VISUAL HELPERS
LastSpellIndexCursor = index;
GameCursor._spellTime = 0;
CombatCollection.StartSpelltime();

// ## BEGIN - END ## // VISUAL HELPERS
// ## BEGIN - END ## // ONCASTINGGUMP
if (ProfileManager.CurrentProfile.OnCastingGump)
Expand All @@ -751,6 +755,7 @@ public static void CastSpell(int index)
// ## BEGIN - END ## // ONCASTINGGUMP

LastSpellIndex = index;

Socket.Send_CastSpell(index);
}
}
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
16 changes: 15 additions & 1 deletion src/ClassicUO.Client/Game/Managers/PartyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
#endregion

using System;
using Microsoft.Extensions.Caching.Memory;
using ClassicUO.Configuration;
using ClassicUO.Game.Data;
using ClassicUO.Game.GameObjects;
using ClassicUO.Game.UI.Gumps;
using ClassicUO.IO;
using ClassicUO.Network;
using ClassicUO.Resources;
using System.Collections.Generic;

namespace ClassicUO.Game.Managers
{
Expand All @@ -55,6 +57,8 @@ internal class PartyManager
public long PartyHealTimer { get; set; }
public uint PartyHealTarget { get; set; }



public void ParsePacket(ref StackDataReader p)
{
byte code = p.ReadUInt8();
Expand Down Expand Up @@ -246,6 +250,7 @@ public void Clear()
internal class PartyMember : IEquatable<PartyMember>
{
private string _name;
public Dictionary<uint, string> nameCache = new Dictionary<uint, string>();

public PartyMember(uint serial)
{
Expand All @@ -262,10 +267,19 @@ public string Name
if (mobile != null)
{
_name = mobile.Name;
nameCache[mobile.Serial] = _name;

if (string.IsNullOrEmpty(_name))
{
_name = ResGeneral.NotSeeing;
if (nameCache.TryGetValue(Serial, out string cachedName))
{
_name = string.IsNullOrEmpty(_name) ? cachedName : _name;
}
else
{
_name = ResGeneral.NotSeeing;
}

}
}

Expand Down
Loading
Loading