mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge branch 'master' of https://github.com/goaaats/Dalamud
This commit is contained in:
commit
e3731551b0
7 changed files with 51 additions and 13 deletions
|
|
@ -559,7 +559,7 @@ namespace Dalamud {
|
|||
private bool isImguiDrawItemSearchWindow;
|
||||
|
||||
private void OnItemLinkCommand(string command, string arguments) {
|
||||
this.itemSearchCommandWindow = new ItemSearchWindow(this.Data, new UiBuilder(this.InterfaceManager, "ItemSearcher"), false);
|
||||
this.itemSearchCommandWindow = new ItemSearchWindow(this.Data, new UiBuilder(this.InterfaceManager, "ItemSearcher"), false, arguments);
|
||||
this.itemSearchCommandWindow.OnItemChosen += (sender, item) => {
|
||||
var hexData = new byte[] {
|
||||
0x02, 0x13, 0x06, 0xFE, 0xFF, 0xF3, 0xF3, 0xF3, 0x03, 0x02, 0x27, 0x07, 0x03, 0xF2, 0x3A, 0x2F,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,12 @@ namespace Dalamud.Game.ClientState.Actors.Types {
|
|||
/// </summary>
|
||||
public Position3 Position => this.actorStruct.Position;
|
||||
|
||||
/// <summary>
|
||||
/// Rotation of this <see cref="Actor"/>.<br/>
|
||||
/// This ranges from -pi to pi radians.
|
||||
/// </summary>
|
||||
public float Rotation => this.actorStruct.Rotation;
|
||||
|
||||
/// <summary>
|
||||
/// Displayname of this <see cref="Actor">Actor</see>.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace Dalamud.Game.ClientState.Actors.Types {
|
|||
/// <summary>
|
||||
/// The maximum MP of this Chara.
|
||||
/// </summary>
|
||||
public int MaxMp => this.actorStruct.MaxMp;
|
||||
public int MaxMp => 10000; // Currently hardcoded because the value in actorStruct is very questionable.
|
||||
|
||||
/// <summary>
|
||||
/// Byte array describing the visual appearance of this Chara. Indexed by <see cref="CustomizeIndex"/>.
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ namespace Dalamud.Game.ClientState.Structs
|
|||
[FieldOffset(145)] public byte PlayerTargetStatus; // This is some kind of enum
|
||||
[FieldOffset(146)] public byte YalmDistanceFromPlayerY; // and the other is z distance
|
||||
[FieldOffset(160)] public Position3 Position;
|
||||
[FieldOffset(176)] public float Rotation; // Rotation around the vertical axis (yaw), from -pi to pi radians
|
||||
|
||||
[FieldOffset(0x17B8)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public byte[] Customize;
|
||||
|
||||
|
|
@ -38,12 +39,16 @@ namespace Dalamud.Game.ClientState.Structs
|
|||
[FieldOffset(0x1868)] public int NameId;
|
||||
[FieldOffset(0x1884)] public byte CurrentWorld;
|
||||
[FieldOffset(0x1886)] public byte HomeWorld;
|
||||
[FieldOffset(6328)] public int CurrentHp;
|
||||
[FieldOffset(6332)] public int MaxHp;
|
||||
[FieldOffset(6336)] public int CurrentMp;
|
||||
[FieldOffset(6340)] public int MaxMp;
|
||||
[FieldOffset(0x1898)] public int CurrentHp;
|
||||
[FieldOffset(0x189C)] public int MaxHp;
|
||||
[FieldOffset(0x18A0)] public int CurrentMp;
|
||||
// This value is weird. It seems to change semi-randomly between 0 and 10k, definitely
|
||||
// in response to mp-using events, but it doesn't often have a value and the changing seems
|
||||
// somewhat arbitrary.
|
||||
[FieldOffset(0x18AA)] public int MaxMp;
|
||||
[FieldOffset(6358)] public byte ClassJob;
|
||||
[FieldOffset(6360)] public byte Level;
|
||||
[FieldOffset(0x1958)][MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public StatusEffect[] UIStatusEffects;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
18
Dalamud/Game/ClientState/Structs/StatusEffect.cs
Normal file
18
Dalamud/Game/ClientState/Structs/StatusEffect.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Structs
|
||||
{
|
||||
/// <summary>
|
||||
/// Native memory representation of a FFXIV status effect.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct StatusEffect
|
||||
{
|
||||
public short EffectId;
|
||||
public byte StackCount;
|
||||
public byte Param;
|
||||
public float Duration;
|
||||
public int OwnerId;
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ namespace Dalamud.Interface
|
|||
continue;
|
||||
|
||||
stateString +=
|
||||
$"{actor.Address.ToInt64():X}:{actor.ActorId:X}[{i}] - {actor.ObjectKind} - {actor.Name} - X{actor.Position.X} Y{actor.Position.Y} Z{actor.Position.Z} D{actor.YalmDistanceX}\n";
|
||||
$"{actor.Address.ToInt64():X}:{actor.ActorId:X}[{i}] - {actor.ObjectKind} - {actor.Name} - X{actor.Position.X} Y{actor.Position.Y} Z{actor.Position.Z} D{actor.YalmDistanceX} R{actor.Rotation}\n";
|
||||
|
||||
if (actor is Npc npc)
|
||||
stateString += $" DataId: {npc.DataId} NameId:{npc.NameId}\n";
|
||||
|
|
|
|||
|
|
@ -41,10 +41,11 @@ namespace Dalamud.Interface
|
|||
|
||||
public event EventHandler<Item> OnItemChosen;
|
||||
|
||||
public ItemSearchWindow(DataManager data, UiBuilder builder, bool closeOnChoose = true) {
|
||||
public ItemSearchWindow(DataManager data, UiBuilder builder, bool closeOnChoose = true, string searchText = "") {
|
||||
this.data = data;
|
||||
this.builder = builder;
|
||||
this.closeOnChoose = closeOnChoose;
|
||||
this.searchText = searchText;
|
||||
|
||||
while (!data.IsDataReady)
|
||||
Thread.Sleep(1);
|
||||
|
|
@ -186,15 +187,23 @@ namespace Dalamud.Interface
|
|||
|
||||
ImGui.EndChild();
|
||||
|
||||
if (ImGui.Button(Loc.Localize("Choose", "Choose"))) {
|
||||
OnItemChosen?.Invoke(this, this.searchTask.Result[this.selectedItemIndex]);
|
||||
// Darken choose button if it shouldn't be clickable
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, this.selectedItemIndex < 0 ? 0.25f : 1);
|
||||
|
||||
if (this.closeOnChoose) {
|
||||
this.selectedItemTex?.Dispose();
|
||||
isOpen = false;
|
||||
if (ImGui.Button(Loc.Localize("Choose", "Choose"))) {
|
||||
try {
|
||||
OnItemChosen?.Invoke(this, this.searchTask.Result[this.selectedItemIndex]);
|
||||
if (this.closeOnChoose) {
|
||||
this.selectedItemTex?.Dispose();
|
||||
isOpen = false;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Log.Error($"Exception in Choose: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
if (!this.closeOnChoose) {
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button(Loc.Localize("Close", "Close")))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue