From 641aa8250ea75ca877b6c6be2db52ffef36411e7 Mon Sep 17 00:00:00 2001 From: Macocian Alexandru Victor Date: Tue, 23 Apr 2024 14:47:44 +0200 Subject: [PATCH] Minimap player arrow (#673) --- Daybreak.GWCA/CMakeLists.txt | 2 +- Daybreak.GWCA/header/payloads/LivingEntity.h | 1 + Daybreak.GWCA/header/payloads/StatePayload.h | 1 + Daybreak.GWCA/source/GameModule.cpp | 2 ++ Daybreak.GWCA/source/GameStateModule.cpp | 1 + Daybreak.GWCA/source/MainPlayerModule.cpp | 1 + Daybreak.GWCA/source/payloads/LivingEntity.cpp | 3 ++- Daybreak.GWCA/source/payloads/StatePayload.cpp | 3 ++- Daybreak/Controls/Minimap/GuildwarsMinimap.xaml.cs | 4 ++++ Daybreak/Daybreak.csproj | 2 ++ Daybreak/Models/Guildwars/EntityGameState.cs | 1 + Daybreak/Models/Guildwars/IPositionalEntity.cs | 1 + Daybreak/Models/Guildwars/LivingEntity.cs | 2 ++ Daybreak/Models/Guildwars/MainPlayerInformation.cs | 1 + Daybreak/Models/Guildwars/MapIcon.cs | 1 + Daybreak/Models/Guildwars/PlayerInformation.cs | 1 + Daybreak/Models/Guildwars/QuestMetadata.cs | 1 + Daybreak/Models/Guildwars/WorldPlayerInformation.cs | 1 + Daybreak/Services/Drawing/DrawingService.cs | 7 +++++-- .../Modules/Bosses/BossEntityDrawingModule.cs | 4 ++-- .../Services/Drawing/Modules/DrawingModuleBase.cs | 6 +++--- .../Modules/Entities/MainPlayerDrawingModule.cs | 13 +++++++++++-- .../Modules/Entities/UnknownEntityDrawingModule.cs | 4 ++-- .../Primitives/CircleEntityDrawingModuleBase.cs | 2 +- .../CircleTargetedEntityDrawingModuleBase.cs | 4 ++-- .../Primitives/StarEntityDrawingModuleBase.cs | 4 ++-- .../StarTargetedEntityDrawingModuleBase.cs | 4 ++-- .../Primitives/TriangleEntityDrawingModuleBase.cs | 4 ++-- .../TriangleTargetedEntityDrawingModuleBase.cs | 4 ++-- .../Services/Drawing/Resources/CircledArrow.svg | 5 +++++ Daybreak/Services/Scanner/GWCAMemoryReader.cs | 9 +++++++-- .../Services/Scanner/Models/LivingEntityPayload.cs | 1 + Daybreak/Services/Scanner/Models/StatePayload.cs | 1 + 33 files changed, 74 insertions(+), 27 deletions(-) create mode 100644 Daybreak/Services/Drawing/Resources/CircledArrow.svg diff --git a/Daybreak.GWCA/CMakeLists.txt b/Daybreak.GWCA/CMakeLists.txt index 1bf8dee9..ec53db71 100644 --- a/Daybreak.GWCA/CMakeLists.txt +++ b/Daybreak.GWCA/CMakeLists.txt @@ -11,7 +11,7 @@ endif() set(VERSION_MAJOR 0) set(VERSION_MINOR 9) set(VERSION_PATCH 9) -set(VERSION_TWEAK 33) +set(VERSION_TWEAK 36) set(VERSION_RC "${CMAKE_CURRENT_BINARY_DIR}/version.rc") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in" "${VERSION_RC}" @ONLY) diff --git a/Daybreak.GWCA/header/payloads/LivingEntity.h b/Daybreak.GWCA/header/payloads/LivingEntity.h index 0e7c097d..f3932432 100644 --- a/Daybreak.GWCA/header/payloads/LivingEntity.h +++ b/Daybreak.GWCA/header/payloads/LivingEntity.h @@ -19,6 +19,7 @@ namespace Daybreak { uint32_t EntityAllegiance = 0; float Health; float Energy; + float RotationAngle; }; void to_json(json& j, const LivingEntity& p); diff --git a/Daybreak.GWCA/header/payloads/StatePayload.h b/Daybreak.GWCA/header/payloads/StatePayload.h index 52066290..a6b0742b 100644 --- a/Daybreak.GWCA/header/payloads/StatePayload.h +++ b/Daybreak.GWCA/header/payloads/StatePayload.h @@ -12,6 +12,7 @@ namespace Daybreak { uint32_t State = 0; float Health = 0; float Energy = 0; + float RotationAngle = 0; }; void to_json(json& j, const StatePayload& p); diff --git a/Daybreak.GWCA/source/GameModule.cpp b/Daybreak.GWCA/source/GameModule.cpp index ad8661c6..26b8b46a 100644 --- a/Daybreak.GWCA/source/GameModule.cpp +++ b/Daybreak.GWCA/source/GameModule.cpp @@ -178,6 +178,7 @@ namespace Daybreak::Modules::GameModule { entity.PosY = agent.pos.y; entity.Health = agent.hp; entity.Energy = agent.energy; + entity.RotationAngle = agent.rotation_angle; if (agent.primary == 0) { const auto npc = GW::Agents::GetNPCByID(agent.player_number); if (npc) { @@ -257,6 +258,7 @@ namespace Daybreak::Modules::GameModule { player.SecondaryProfessionId = (uint32_t)agent->secondary; player.Health = agent->hp * (agent->max_hp > 0 ? agent->max_hp : 1); player.Energy = agent->energy * (agent->max_energy > 0 ? agent->max_energy : 1); + player.RotationAngle = agent->rotation_angle; } else if (professionState) { player.PrimaryProfessionId = (uint32_t)professionState->primary; diff --git a/Daybreak.GWCA/source/GameStateModule.cpp b/Daybreak.GWCA/source/GameStateModule.cpp index 425e4f93..67a840c5 100644 --- a/Daybreak.GWCA/source/GameStateModule.cpp +++ b/Daybreak.GWCA/source/GameStateModule.cpp @@ -47,6 +47,7 @@ namespace Daybreak::Modules::GameStateModule { state.State = agent.type_map; state.Health = agent.hp * (agent.max_hp > 0 ? agent.max_hp : 1); state.Energy = agent.energy * (agent.max_energy > 0 ? agent.max_energy : 1); + state.RotationAngle = agent.rotation_angle; states.push_back(state); } diff --git a/Daybreak.GWCA/source/MainPlayerModule.cpp b/Daybreak.GWCA/source/MainPlayerModule.cpp index 58a47ae1..ca329c10 100644 --- a/Daybreak.GWCA/source/MainPlayerModule.cpp +++ b/Daybreak.GWCA/source/MainPlayerModule.cpp @@ -284,6 +284,7 @@ namespace Daybreak::Modules::MainPlayerModule { player.SecondaryProfessionId = (uint32_t)agent->secondary; player.Health = agent->hp * (agent->max_hp > 0 ? agent->max_hp : 1); player.Energy = agent->energy * (agent->max_energy > 0 ? agent->max_energy : 1); + player.RotationAngle = agent->rotation_angle; } else if (professionState) { player.PrimaryProfessionId = (uint32_t)professionState->primary; diff --git a/Daybreak.GWCA/source/payloads/LivingEntity.cpp b/Daybreak.GWCA/source/payloads/LivingEntity.cpp index f9b11d4a..f6feb2b4 100644 --- a/Daybreak.GWCA/source/payloads/LivingEntity.cpp +++ b/Daybreak.GWCA/source/payloads/LivingEntity.cpp @@ -20,7 +20,8 @@ namespace Daybreak { {"EntityState", p.EntityState}, {"EntityAllegiance", p.EntityAllegiance}, {"Health", p.Health}, - {"Energy", p.Energy} + {"Energy", p.Energy}, + {"RotationAngle", p.RotationAngle} }; } } \ No newline at end of file diff --git a/Daybreak.GWCA/source/payloads/StatePayload.cpp b/Daybreak.GWCA/source/payloads/StatePayload.cpp index 347310d6..c6deb078 100644 --- a/Daybreak.GWCA/source/payloads/StatePayload.cpp +++ b/Daybreak.GWCA/source/payloads/StatePayload.cpp @@ -13,7 +13,8 @@ namespace Daybreak { {"PosY", p.PosY}, {"State", p.State}, {"Health", p.Health}, - {"Energy", p.Energy} + {"Energy", p.Energy}, + {"RotationAngle", p.RotationAngle} }; } } \ No newline at end of file diff --git a/Daybreak/Controls/Minimap/GuildwarsMinimap.xaml.cs b/Daybreak/Controls/Minimap/GuildwarsMinimap.xaml.cs index b472a1cf..5e992a9a 100644 --- a/Daybreak/Controls/Minimap/GuildwarsMinimap.xaml.cs +++ b/Daybreak/Controls/Minimap/GuildwarsMinimap.xaml.cs @@ -167,12 +167,14 @@ this.GameData is null || this.GameData.MainPlayer!.Position = mainPlayerState?.Position ?? new Position(); this.GameData.MainPlayer!.CurrentHealth = mainPlayerState?.Health ?? 0; this.GameData.MainPlayer!.CurrentEnergy = mainPlayerState?.Energy ?? 0; + this.GameData.MainPlayer!.RotationAngle = mainPlayerState?.RotationAngle ?? 0; foreach (var worldPlayer in this.GameData.WorldPlayers!) { var worldPlayerState = this.GameState.States?.FirstOrDefault(state => state.Id == worldPlayer.Id); worldPlayer.Position = worldPlayerState?.Position ?? new Position(); worldPlayer.CurrentHealth = worldPlayerState?.Health ?? 0; worldPlayer.CurrentEnergy = worldPlayerState?.Energy ?? 0; + worldPlayer.RotationAngle = worldPlayerState?.RotationAngle ?? 0; } foreach (var partyPlayer in this.GameData.Party!) @@ -181,6 +183,7 @@ this.GameData is null || partyPlayer.Position = partyPlayerState?.Position ?? new Position(); partyPlayer.CurrentHealth = partyPlayerState?.Health ?? 0; partyPlayer.CurrentEnergy = partyPlayerState?.Energy ?? 0; + partyPlayer.RotationAngle = partyPlayerState?.RotationAngle ?? 0; } foreach (var entity in this.GameData.LivingEntities!) @@ -190,6 +193,7 @@ this.GameData is null || entity.State = state?.State ?? LivingEntityState.Unknown; entity.Health = state?.Health ?? 0; entity.Energy = state?.Energy ?? 0; + entity.RotationAngle = state?.RotationAngle ?? 0; } this.Angle = this.CanRotate ? (this.GameState.Camera.Yaw - (Math.PI / 2)) * (180 / Math.PI) : 0; diff --git a/Daybreak/Daybreak.csproj b/Daybreak/Daybreak.csproj index a6989cff..d5507673 100644 --- a/Daybreak/Daybreak.csproj +++ b/Daybreak/Daybreak.csproj @@ -26,6 +26,7 @@ + @@ -48,6 +49,7 @@ + diff --git a/Daybreak/Models/Guildwars/EntityGameState.cs b/Daybreak/Models/Guildwars/EntityGameState.cs index 1bce35c2..e1e3fe4b 100644 --- a/Daybreak/Models/Guildwars/EntityGameState.cs +++ b/Daybreak/Models/Guildwars/EntityGameState.cs @@ -6,4 +6,5 @@ public sealed class EntityGameState public LivingEntityState State { get; set; } public float Health { get; set; } public float Energy { get; set; } + public float RotationAngle { get; set; } } diff --git a/Daybreak/Models/Guildwars/IPositionalEntity.cs b/Daybreak/Models/Guildwars/IPositionalEntity.cs index e8fdc884..41d4d3e6 100644 --- a/Daybreak/Models/Guildwars/IPositionalEntity.cs +++ b/Daybreak/Models/Guildwars/IPositionalEntity.cs @@ -2,4 +2,5 @@ public interface IPositionalEntity { Position? Position { get; } + float RotationAngle { get; } } diff --git a/Daybreak/Models/Guildwars/LivingEntity.cs b/Daybreak/Models/Guildwars/LivingEntity.cs index da2b9e60..0ccb0347 100644 --- a/Daybreak/Models/Guildwars/LivingEntity.cs +++ b/Daybreak/Models/Guildwars/LivingEntity.cs @@ -25,4 +25,6 @@ public sealed class LivingEntity : IEntity public float Health { get; set; } public float Energy { get; set; } + + public float RotationAngle { get; set; } } diff --git a/Daybreak/Models/Guildwars/MainPlayerInformation.cs b/Daybreak/Models/Guildwars/MainPlayerInformation.cs index 916b9d06..d2fe5df3 100644 --- a/Daybreak/Models/Guildwars/MainPlayerInformation.cs +++ b/Daybreak/Models/Guildwars/MainPlayerInformation.cs @@ -20,6 +20,7 @@ public sealed class MainPlayerInformation : IEntity public float MaxEnergy { get; init; } public float HealthRegen { get; init; } public float EnergyRegen { get; init; } + public float RotationAngle { get; set; } public bool HardModeUnlocked { get; init; } public uint Experience { get; init; } public uint Morale { get; init; } diff --git a/Daybreak/Models/Guildwars/MapIcon.cs b/Daybreak/Models/Guildwars/MapIcon.cs index 7ce113fa..a54b0076 100644 --- a/Daybreak/Models/Guildwars/MapIcon.cs +++ b/Daybreak/Models/Guildwars/MapIcon.cs @@ -5,4 +5,5 @@ public sealed class MapIcon : IPositionalEntity public Position? Position { get; init; } public GuildwarsIcon? Icon { get; init; } public Affiliation? Affiliation { get; init; } + public float RotationAngle { get; } = 0f; } diff --git a/Daybreak/Models/Guildwars/PlayerInformation.cs b/Daybreak/Models/Guildwars/PlayerInformation.cs index cb878611..bae13073 100644 --- a/Daybreak/Models/Guildwars/PlayerInformation.cs +++ b/Daybreak/Models/Guildwars/PlayerInformation.cs @@ -20,4 +20,5 @@ public sealed class PlayerInformation : IEntity public float MaxEnergy { get; init; } public float HealthRegen { get; init; } public float EnergyRegen { get; init; } + public float RotationAngle { get; set; } } diff --git a/Daybreak/Models/Guildwars/QuestMetadata.cs b/Daybreak/Models/Guildwars/QuestMetadata.cs index 2ccb5678..5a8a7300 100644 --- a/Daybreak/Models/Guildwars/QuestMetadata.cs +++ b/Daybreak/Models/Guildwars/QuestMetadata.cs @@ -6,4 +6,5 @@ public sealed class QuestMetadata : IPositionalEntity public Position? Position { get; init; } public Map? From { get; init; } public Map? To { get; init; } + public float RotationAngle { get; } = 0f; } diff --git a/Daybreak/Models/Guildwars/WorldPlayerInformation.cs b/Daybreak/Models/Guildwars/WorldPlayerInformation.cs index bb6a197e..e97a923b 100644 --- a/Daybreak/Models/Guildwars/WorldPlayerInformation.cs +++ b/Daybreak/Models/Guildwars/WorldPlayerInformation.cs @@ -20,4 +20,5 @@ public sealed class WorldPlayerInformation : IEntity public float MaxEnergy { get; init; } public float HealthRegen { get; init; } public float EnergyRegen { get; init; } + public float RotationAngle { get; set; } } diff --git a/Daybreak/Services/Drawing/DrawingService.cs b/Daybreak/Services/Drawing/DrawingService.cs index 5133a08f..042cc978 100644 --- a/Daybreak/Services/Drawing/DrawingService.cs +++ b/Daybreak/Services/Drawing/DrawingService.cs @@ -1,6 +1,7 @@ using Daybreak.Models; using Daybreak.Models.Guildwars; using Daybreak.Services.Drawing.Modules; +using Daybreak.Services.Screenshots.Models; using Slim; using System; using System.Collections.Generic; @@ -100,7 +101,8 @@ gameData.Party is null || { if (module.CanDrawEntity(entity)) { - module.DrawEntity(finalX, finalY, this.finalEntitySize, angle, bitmap, false, this.foregroundColor); + var entityAngle = -(entity.RotationAngle - (Math.PI / 2)); + module.DrawEntity(finalX, finalY, this.finalEntitySize, angle, entityAngle, bitmap, false, this.foregroundColor); } } } @@ -113,7 +115,8 @@ gameData.Party is null || { if (module.CanDrawEntity(targetedEntity)) { - module.DrawEntity(finalTargetedX, finalTargetedY, this.finalEntitySize, angle, bitmap, true, this.foregroundColor); + var entityAngle = -(targetedEntity.RotationAngle - (Math.PI / 2)); + module.DrawEntity(finalTargetedX, finalTargetedY, this.finalEntitySize, angle, entityAngle, bitmap, true, this.foregroundColor); } } } diff --git a/Daybreak/Services/Drawing/Modules/Bosses/BossEntityDrawingModule.cs b/Daybreak/Services/Drawing/Modules/Bosses/BossEntityDrawingModule.cs index b195b4ec..64f2ea03 100644 --- a/Daybreak/Services/Drawing/Modules/Bosses/BossEntityDrawingModule.cs +++ b/Daybreak/Services/Drawing/Modules/Bosses/BossEntityDrawingModule.cs @@ -20,8 +20,8 @@ public override bool CanDrawEntity(IEntity entity) livingEntity.State is LivingEntityState.Boss; } - public override void DrawEntity(int finalX, int finalY, int size, double angle, WriteableBitmap bitmap, bool targeted, Color shade) + public override void DrawEntity(int finalX, int finalY, int size, double cameraAngle, double entityAngle, WriteableBitmap bitmap, bool targeted, Color shade) { - this.DrawSvg(bitmap, finalX, finalY, size, angle, targeted ? this.OutlineColor : this.FillColor, this.FillColor, shade); + this.DrawSvg(bitmap, finalX, finalY, size, cameraAngle, targeted ? this.OutlineColor : this.FillColor, this.FillColor, shade); } } diff --git a/Daybreak/Services/Drawing/Modules/DrawingModuleBase.cs b/Daybreak/Services/Drawing/Modules/DrawingModuleBase.cs index 4679b8b2..3cd5c087 100644 --- a/Daybreak/Services/Drawing/Modules/DrawingModuleBase.cs +++ b/Daybreak/Services/Drawing/Modules/DrawingModuleBase.cs @@ -21,15 +21,15 @@ public abstract class DrawingModuleBase public virtual bool CanDrawEngagementArea(IEntity entity) => false; - public virtual void DrawEntity(int finalX, int finalY, int size, double angle, WriteableBitmap bitmap, bool targeted, Color shade) { } + public virtual void DrawEntity(int finalX, int finalY, int size, double cameraAngle, double entityAngle, WriteableBitmap bitmap, bool targeted, Color shade) { } - public virtual void DrawMapIcon(int finalX, int finalY, int size, double angle, WriteableBitmap bitmap, Affiliation affiliation, Color shade) { } + public virtual void DrawMapIcon(int finalX, int finalY, int size, double cameraAngle, WriteableBitmap bitmap, Affiliation affiliation, Color shade) { } public virtual void DrawPlayerPositionHistory(int finalX, int finalY, int size, WriteableBitmap bitmap, Color shade) { } public virtual void DrawPathFinding(int finalX, int finalY, int size, WriteableBitmap bitmap, Color color, Color shade) { } - public virtual void DrawQuestObjective(int finalX, int finalY, int size, double angle, WriteableBitmap bitmap, Color color, Color shade) { } + public virtual void DrawQuestObjective(int finalX, int finalY, int size, double cameraAngle, WriteableBitmap bitmap, Color color, Color shade) { } public virtual void DrawEngagementArea(int finalX, int finalY, int size, WriteableBitmap bitmap, Color shade) { } } diff --git a/Daybreak/Services/Drawing/Modules/Entities/MainPlayerDrawingModule.cs b/Daybreak/Services/Drawing/Modules/Entities/MainPlayerDrawingModule.cs index 04f432e1..8088600e 100644 --- a/Daybreak/Services/Drawing/Modules/Entities/MainPlayerDrawingModule.cs +++ b/Daybreak/Services/Drawing/Modules/Entities/MainPlayerDrawingModule.cs @@ -1,14 +1,23 @@ using Daybreak.Models.Guildwars; using Daybreak.Services.Drawing.Modules.Primitives; using System.Windows.Media; +using System.Windows.Media.Imaging; namespace Daybreak.Services.Drawing.Modules.Entities; -public sealed class MainPlayerDrawingModule : CircleEntityDrawingModuleBase +public sealed class MainPlayerDrawingModule : EmbeddedSvgDrawingModuleBase { - protected override Color FillColor { get; } = Colors.Green; + private Color OutlineColor { get; } = Colors.Chocolate; + private Color FillColor { get; } = Colors.Green; + protected override string EmbeddedSvgPath { get; } = "Daybreak.Services.Drawing.Resources.CircledArrow.svg"; public override bool CanDrawEntity(IEntity entity) { return entity is MainPlayerInformation; } + + public override void DrawEntity(int finalX, int finalY, int size, double cameraAngle, double entityAngle, WriteableBitmap bitmap, bool targeted, Color shade) + { + var angle = entityAngle != 0 ? entityAngle : cameraAngle; + this.DrawSvg(bitmap, finalX, finalY, size, angle, targeted ? this.OutlineColor : this.FillColor, this.FillColor, shade); + } } diff --git a/Daybreak/Services/Drawing/Modules/Entities/UnknownEntityDrawingModule.cs b/Daybreak/Services/Drawing/Modules/Entities/UnknownEntityDrawingModule.cs index 92b84974..8f3dea2e 100644 --- a/Daybreak/Services/Drawing/Modules/Entities/UnknownEntityDrawingModule.cs +++ b/Daybreak/Services/Drawing/Modules/Entities/UnknownEntityDrawingModule.cs @@ -17,8 +17,8 @@ public override bool CanDrawEntity(IEntity entity) livingEntity.NpcDefinition == Npc.Unknown); } - public override void DrawEntity(int finalX, int finalY, int size, double angle, WriteableBitmap bitmap, bool targeted, Color shade) + public override void DrawEntity(int finalX, int finalY, int size, double cameraAngle, double entityAngle, WriteableBitmap bitmap, bool targeted, Color shade) { - this.DrawSvg(bitmap, finalX, finalY, (int)(size / 1.3), angle, this.StrokeColor, Colors.Transparent, shade); + this.DrawSvg(bitmap, finalX, finalY, (int)(size / 1.3), cameraAngle, this.StrokeColor, Colors.Transparent, shade); } } diff --git a/Daybreak/Services/Drawing/Modules/Primitives/CircleEntityDrawingModuleBase.cs b/Daybreak/Services/Drawing/Modules/Primitives/CircleEntityDrawingModuleBase.cs index ed1a92b0..22f013c7 100644 --- a/Daybreak/Services/Drawing/Modules/Primitives/CircleEntityDrawingModuleBase.cs +++ b/Daybreak/Services/Drawing/Modules/Primitives/CircleEntityDrawingModuleBase.cs @@ -7,7 +7,7 @@ public abstract class CircleEntityDrawingModuleBase : CircleDrawingModuleBase { protected abstract Color FillColor { get; } - public override void DrawEntity(int finalX, int finalY, int size, double angle, WriteableBitmap bitmap, bool targeted, Color shade) + public override void DrawEntity(int finalX, int finalY, int size, double cameraAngle, double entityAngle, WriteableBitmap bitmap, bool targeted, Color shade) { this.DrawFilledCircle(bitmap, finalX, finalY, size, this.FillColor, shade); } diff --git a/Daybreak/Services/Drawing/Modules/Primitives/CircleTargetedEntityDrawingModuleBase.cs b/Daybreak/Services/Drawing/Modules/Primitives/CircleTargetedEntityDrawingModuleBase.cs index b0ff62c0..f5bfc2de 100644 --- a/Daybreak/Services/Drawing/Modules/Primitives/CircleTargetedEntityDrawingModuleBase.cs +++ b/Daybreak/Services/Drawing/Modules/Primitives/CircleTargetedEntityDrawingModuleBase.cs @@ -7,7 +7,7 @@ public abstract class CircleTargetedEntityDrawingModuleBase : CircleEntityDrawin { protected virtual Color OutlineColor { get; } = Colors.Chocolate; - public override sealed void DrawEntity(int finalX, int finalY, int size, double angle, WriteableBitmap bitmap, bool targeted, Color shade) + public override sealed void DrawEntity(int finalX, int finalY, int size, double angle, double entityAngle, WriteableBitmap bitmap, bool targeted, Color shade) { if (targeted) { @@ -15,6 +15,6 @@ public override sealed void DrawEntity(int finalX, int finalY, int size, double this.DrawFilledCircle(bitmap, finalX, finalY, outlineSize, this.OutlineColor, shade); } - base.DrawEntity(finalX, finalY, size, angle, bitmap, targeted, shade); + base.DrawEntity(finalX, finalY, size, angle, entityAngle, bitmap, targeted, shade); } } diff --git a/Daybreak/Services/Drawing/Modules/Primitives/StarEntityDrawingModuleBase.cs b/Daybreak/Services/Drawing/Modules/Primitives/StarEntityDrawingModuleBase.cs index c6631d3a..9dd832f8 100644 --- a/Daybreak/Services/Drawing/Modules/Primitives/StarEntityDrawingModuleBase.cs +++ b/Daybreak/Services/Drawing/Modules/Primitives/StarEntityDrawingModuleBase.cs @@ -7,8 +7,8 @@ public abstract class StarEntityDrawingModuleBase : StarDrawingModuleBase { protected abstract Color FillColor { get; } - public override void DrawEntity(int finalX, int finalY, int size, double angle, WriteableBitmap bitmap, bool targeted, Color shade) + public override void DrawEntity(int finalX, int finalY, int size, double cameraAngle, double entityAngle, WriteableBitmap bitmap, bool targeted, Color shade) { - this.DrawFilledStar(bitmap, finalX, finalY, size, angle, this.FillColor, shade); + this.DrawFilledStar(bitmap, finalX, finalY, size, cameraAngle, this.FillColor, shade); } } diff --git a/Daybreak/Services/Drawing/Modules/Primitives/StarTargetedEntityDrawingModuleBase.cs b/Daybreak/Services/Drawing/Modules/Primitives/StarTargetedEntityDrawingModuleBase.cs index 355cb261..dd9c958d 100644 --- a/Daybreak/Services/Drawing/Modules/Primitives/StarTargetedEntityDrawingModuleBase.cs +++ b/Daybreak/Services/Drawing/Modules/Primitives/StarTargetedEntityDrawingModuleBase.cs @@ -7,9 +7,9 @@ public abstract class StarTargetedEntityDrawingModuleBase : StarEntityDrawingMod { protected virtual Color OutlineColor { get; } = Colors.Chocolate; - public override sealed void DrawEntity(int finalX, int finalY, int size, double angle, WriteableBitmap bitmap, bool targeted, Color shade) + public override sealed void DrawEntity(int finalX, int finalY, int size, double angle, double entityAngle, WriteableBitmap bitmap, bool targeted, Color shade) { - base.DrawEntity(finalX, finalY, size, angle, bitmap, targeted, shade); + base.DrawEntity(finalX, finalY, size, angle, entityAngle, bitmap, targeted, shade); if (targeted) { var thickness = size / 5; diff --git a/Daybreak/Services/Drawing/Modules/Primitives/TriangleEntityDrawingModuleBase.cs b/Daybreak/Services/Drawing/Modules/Primitives/TriangleEntityDrawingModuleBase.cs index 822a08fa..9ac3202e 100644 --- a/Daybreak/Services/Drawing/Modules/Primitives/TriangleEntityDrawingModuleBase.cs +++ b/Daybreak/Services/Drawing/Modules/Primitives/TriangleEntityDrawingModuleBase.cs @@ -7,8 +7,8 @@ public abstract class TriangleEntityDrawingModuleBase : TriangleDrawingModuleBas { protected abstract Color FillColor { get; } - public override void DrawEntity(int finalX, int finalY, int size, double angle, WriteableBitmap bitmap, bool targeted, Color shade) + public override void DrawEntity(int finalX, int finalY, int size, double cameraAngle, double entityAngle, WriteableBitmap bitmap, bool targeted, Color shade) { - this.DrawFilledTriangle(bitmap, finalX, finalY, size, angle, this.FillColor, shade); + this.DrawFilledTriangle(bitmap, finalX, finalY, size, cameraAngle, this.FillColor, shade); } } diff --git a/Daybreak/Services/Drawing/Modules/Primitives/TriangleTargetedEntityDrawingModuleBase.cs b/Daybreak/Services/Drawing/Modules/Primitives/TriangleTargetedEntityDrawingModuleBase.cs index 30d17067..68d6f443 100644 --- a/Daybreak/Services/Drawing/Modules/Primitives/TriangleTargetedEntityDrawingModuleBase.cs +++ b/Daybreak/Services/Drawing/Modules/Primitives/TriangleTargetedEntityDrawingModuleBase.cs @@ -7,9 +7,9 @@ public abstract class TriangleTargetedEntityDrawingModuleBase : TriangleEntityDr { protected virtual Color OutlineColor { get; } = Colors.Chocolate; - public override sealed void DrawEntity(int finalX, int finalY, int size, double angle, WriteableBitmap bitmap, bool targeted, Color shade) + public override sealed void DrawEntity(int finalX, int finalY, int size, double angle, double entityAngle, WriteableBitmap bitmap, bool targeted, Color shade) { - base.DrawEntity(finalX, finalY, size, angle, bitmap, targeted, shade); + base.DrawEntity(finalX, finalY, size, angle, entityAngle, bitmap, targeted, shade); if (targeted) { var thickness = size / 5; diff --git a/Daybreak/Services/Drawing/Resources/CircledArrow.svg b/Daybreak/Services/Drawing/Resources/CircledArrow.svg new file mode 100644 index 00000000..2617b541 --- /dev/null +++ b/Daybreak/Services/Drawing/Resources/CircledArrow.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Daybreak/Services/Scanner/GWCAMemoryReader.cs b/Daybreak/Services/Scanner/GWCAMemoryReader.cs index cda0c228..45c0dd23 100644 --- a/Daybreak/Services/Scanner/GWCAMemoryReader.cs +++ b/Daybreak/Services/Scanner/GWCAMemoryReader.cs @@ -592,7 +592,8 @@ public async Task EnsureInitialized(uint processId, CancellationToken cancellati _ => LivingEntityState.Unknown }, Health = state.Health, - Energy = state.Energy + Energy = state.Energy, + RotationAngle = state.RotationAngle }; }).ToList(); @@ -826,6 +827,7 @@ private static MainPlayerInformation ParsePayload(MainPlayerPayload mainPlayerPa Timer = worldPlayer.Timer, TitleInformation = worldPlayer.TitleInformation, UnlockedProfession = worldPlayer.UnlockedProfession, + RotationAngle = worldPlayer.RotationAngle, QuestLog = mainPlayerPayload.QuestLog?.Select(metadata => { if (!Quest.TryParse((int)metadata.Id, out var q)) @@ -865,6 +867,7 @@ private static WorldPlayerInformation ParsePayload(WorldPlayerPayload worldPlaye Name = worldPlayerPayload.Name, Timer = partyPlayer.Timer, UnlockedProfession = partyPlayer.UnlockedProfession, + RotationAngle = partyPlayer.RotationAngle, TitleInformation = new TitleInformation { CurrentPoints = worldPlayerPayload.Title?.CurrentPoints, @@ -924,6 +927,7 @@ private static PlayerInformation ParsePayload(PartyPlayerPayload partyPlayerPayl NpcDefinition = livingEntity.NpcDefinition, ModelType = livingEntity.ModelType ?? 0, Timer = livingEntity.Timer, + RotationAngle = livingEntity.RotationAngle, UnlockedProfession = partyPlayerPayload.UnlockedProfession?.Select(id => { if (Profession.TryParse((int)id, out var profession)) @@ -959,7 +963,8 @@ private static LivingEntity ParsePayload(LivingEntityPayload livingEntityPayload Y = livingEntityPayload.PosY, }, Health = livingEntityPayload.Health, - Energy = livingEntityPayload.Energy + Energy = livingEntityPayload.Energy, + RotationAngle = livingEntityPayload.RotationAngle }; } diff --git a/Daybreak/Services/Scanner/Models/LivingEntityPayload.cs b/Daybreak/Services/Scanner/Models/LivingEntityPayload.cs index 1f50aa2a..008e826d 100644 --- a/Daybreak/Services/Scanner/Models/LivingEntityPayload.cs +++ b/Daybreak/Services/Scanner/Models/LivingEntityPayload.cs @@ -14,4 +14,5 @@ internal class LivingEntityPayload public uint Timer { get; set; } public float Health { get; set; } public float Energy { get; set; } + public float RotationAngle { get; set; } } diff --git a/Daybreak/Services/Scanner/Models/StatePayload.cs b/Daybreak/Services/Scanner/Models/StatePayload.cs index c660d867..949b6e9a 100644 --- a/Daybreak/Services/Scanner/Models/StatePayload.cs +++ b/Daybreak/Services/Scanner/Models/StatePayload.cs @@ -7,4 +7,5 @@ internal sealed class StatePayload public uint State { get; set; } public float Health { get; set; } public float Energy { get; set; } + public float RotationAngle { get; set; } }