feat(mosstank): add VTank-style automation PoC

This commit is contained in:
Erik 2026-08-27 18:57:21 +02:00
parent f6fe0f2a4f
commit 4e6e9bc9d9
212 changed files with 49462 additions and 416 deletions

View file

@ -3,6 +3,7 @@ using AcDream.Core.Items;
using AcDream.Core.Net;
using AcDream.Core.Net.Messages;
using AcDream.Core.Physics;
using AcDream.Core.Properties;
using AcDream.Core.Spells;
using AcDream.Runtime.Entities;
using AcDream.Runtime.Gameplay;
@ -172,6 +173,43 @@ public sealed class RuntimeHostileTargetQueryTests
Assert.Null(RuntimeHostileTargetQuery.FindClosest(runtime));
}
[Fact]
public void Capture_ProjectsRetailRelativeHeadingRangeNameAndHealth()
{
using GameRuntime runtime = Create();
runtime.PlayerIdentity.ServerGuid = Player;
Add(runtime, Player, 0x01010001u, 10f, 10f, PlayerObject(Player));
ClientObject east = Hostile(0x50000020u);
east.Name = "East Drudge";
east.WeenieClassId = 1234u;
east.Properties.Ints[(uint)PropertyInt.CreatureType] = 4;
Add(runtime, east.ObjectId, 0x01010001u, 13f, 10f, east);
runtime.InventoryOwner.Objects.AddOrUpdate(new ClientObject
{
ObjectId = 0x70000020u,
Type = ItemType.Armor,
WielderId = east.ObjectId,
CurrentlyEquippedLocation = EquipMask.Shield,
});
runtime.ActionOwner.Combat.OnUpdateHealth(east.ObjectId, 0.75f);
IReadOnlyList<RuntimeHostileTargetSnapshot> captured =
RuntimeHostileTargetQuery.Capture(runtime, 4f);
RuntimeHostileTargetSnapshot target = Assert.Single(captured);
Assert.Equal(east.ObjectId, target.ObjectId);
Assert.Equal("East Drudge", target.Name);
Assert.Equal(1234u, target.WeenieClassId);
Assert.Equal(3f, target.Distance, 3);
Assert.Equal(90f, target.RelativeAngleDegrees, 3);
Assert.True(target.IsHealthKnown);
Assert.Equal(0.75f, target.HealthFraction, 3);
Assert.Equal(4, target.SpeciesId);
Assert.True(target.HasShield);
Assert.Equal(0, target.MaximumHealth);
Assert.Empty(RuntimeHostileTargetQuery.Capture(runtime, 2.9f));
}
private static GameRuntime Create()
{
var operations = new Operations();