feat: start adding the data structure for actor spawning
This commit is contained in:
parent
ed679ae141
commit
fd0ca7f445
@ -20,6 +20,9 @@ internal class Message {
|
|||||||
public int NegativeVotes { get; set; }
|
public int NegativeVotes { get; set; }
|
||||||
public int UserVote { get; set; }
|
public int UserVote { get; set; }
|
||||||
|
|
||||||
|
public uint? Emote { get; set; }
|
||||||
|
public byte[]? Customise { get; set; }
|
||||||
|
|
||||||
public int Glyph { get; set; }
|
public int Glyph { get; set; }
|
||||||
|
|
||||||
internal Vector3 Position => new(this.X, this.Y, this.Z);
|
internal Vector3 Position => new(this.X, this.Y, this.Z);
|
||||||
@ -45,6 +48,9 @@ internal class MessageWithTerritory {
|
|||||||
public int NegativeVotes { get; init; }
|
public int NegativeVotes { get; init; }
|
||||||
public int UserVote { get; set; }
|
public int UserVote { get; set; }
|
||||||
|
|
||||||
|
public uint? Emote { get; set; }
|
||||||
|
public byte[]? Customise { get; set; }
|
||||||
|
|
||||||
public int Glyph { get; set; }
|
public int Glyph { get; set; }
|
||||||
public bool IsHidden { get; set; }
|
public bool IsHidden { get; set; }
|
||||||
|
|
||||||
@ -62,12 +68,56 @@ internal class MessageWithTerritory {
|
|||||||
PositiveVotes = message.PositiveVotes,
|
PositiveVotes = message.PositiveVotes,
|
||||||
NegativeVotes = message.NegativeVotes,
|
NegativeVotes = message.NegativeVotes,
|
||||||
UserVote = message.UserVote,
|
UserVote = message.UserVote,
|
||||||
|
Emote = message.Emote,
|
||||||
|
Customise = message.Customise,
|
||||||
Glyph = message.Glyph,
|
Glyph = message.Glyph,
|
||||||
IsHidden = false,
|
IsHidden = false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
|
||||||
|
internal class EmoteData {
|
||||||
|
public uint Id { get; set; }
|
||||||
|
public byte[] Customise { get; set; }
|
||||||
|
public EquipmentData[] Equipment { get; set; }
|
||||||
|
public WeaponData[] Weapon { get; set; }
|
||||||
|
public bool HatHidden { get; set; }
|
||||||
|
public bool VisorToggled { get; set; }
|
||||||
|
public bool WeaponHidden { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
|
||||||
|
internal class EquipmentData {
|
||||||
|
public ushort Id { get; set; }
|
||||||
|
public byte Variant { get; set; }
|
||||||
|
public byte Stain0 { get; set; }
|
||||||
|
public byte Stain1 { get; set; }
|
||||||
|
public ulong Value { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
|
||||||
|
internal class WeaponData {
|
||||||
|
public WeaponModelId ModelId { get; set; }
|
||||||
|
public byte State { get; set; }
|
||||||
|
public ushort Flags1 { get; set; }
|
||||||
|
public byte Flags2 { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
|
||||||
|
internal class WeaponModelId {
|
||||||
|
public ushort Id { get; set; }
|
||||||
|
public ushort Type { get; set; }
|
||||||
|
public ushort Variant { get; set; }
|
||||||
|
public byte Stain0 { get; set; }
|
||||||
|
public byte Stain1 { get; set; }
|
||||||
|
public ulong Value { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
|
[JsonObject(NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
|
||||||
internal class ErrorMessage {
|
internal class ErrorMessage {
|
||||||
|
@ -21,10 +21,6 @@ internal class ActorManager : IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private unsafe void OnFramework(IFramework framework) {
|
private unsafe void OnFramework(IFramework framework) {
|
||||||
if (this._idx is not { } idx) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this._tasks.TryPeek(out var actorAction)) {
|
if (!this._tasks.TryPeek(out var actorAction)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -60,15 +56,8 @@ internal class ActorManager : IDisposable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal unsafe void Spawn(Message message) {
|
internal void Spawn(Message message) {
|
||||||
if (this._idx != null) {
|
this._tasks.Enqueue(new SpawnAction(message));
|
||||||
Plugin.Log.Warning("refusing to spawn more than one actor");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Plugin.Log.Debug("spawning actor");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Despawn() {
|
internal void Despawn() {
|
||||||
@ -80,7 +69,7 @@ internal class ActorManager : IDisposable {
|
|||||||
this._tasks.Enqueue(new DeleteAction());
|
this._tasks.Enqueue(new DeleteAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe abstract class BaseActorAction {
|
private abstract unsafe class BaseActorAction {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Run this action.
|
/// Run this action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -130,6 +119,7 @@ internal class ActorManager : IDisposable {
|
|||||||
var chara = (BattleChara*) objMan->GetObjectByIndex((ushort) idx);
|
var chara = (BattleChara*) objMan->GetObjectByIndex((ushort) idx);
|
||||||
|
|
||||||
chara->ObjectKind = ObjectKind.BattleNpc;
|
chara->ObjectKind = ObjectKind.BattleNpc;
|
||||||
|
chara->TargetableStatus = 0;
|
||||||
chara->Position = message.Position;
|
chara->Position = message.Position;
|
||||||
chara->Rotation = message.Yaw;
|
chara->Rotation = message.Yaw;
|
||||||
var drawData = &chara->DrawData;
|
var drawData = &chara->DrawData;
|
||||||
@ -183,6 +173,7 @@ internal class ActorManager : IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
objMan->DeleteObjectByIndex((ushort) idx, 0);
|
objMan->DeleteObjectByIndex((ushort) idx, 0);
|
||||||
|
manager._idx = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user