1
0
forked from liza/Questionable

Polished First Half of Elpis

This commit is contained in:
Liza 2024-05-29 00:17:19 +02:00
parent 1078d921ff
commit b2cf1df434
Signed by: liza
GPG Key ID: 7199F8D727D55F67
17 changed files with 197 additions and 34 deletions

View File

@ -339,7 +339,7 @@ internal sealed class QuestController
if (step.TargetTerritoryId == _clientState.TerritoryType) if (step.TargetTerritoryId == _clientState.TerritoryType)
{ {
// no more movement _pluginLog.Information("Skipping any movement");
} }
else if (step.Position != null) else if (step.Position != null)
{ {
@ -349,7 +349,6 @@ internal sealed class QuestController
else else
distance = step.StopDistance ?? MovementController.DefaultStopDistance; distance = step.StopDistance ?? MovementController.DefaultStopDistance;
_pluginLog.Information($"Stop dist: {distance}");
var position = _clientState.LocalPlayer?.Position ?? new Vector3(); var position = _clientState.LocalPlayer?.Position ?? new Vector3();
float actualDistance = (position - step.Position.Value).Length(); float actualDistance = (position - step.Position.Value).Length();
@ -473,7 +472,12 @@ internal sealed class QuestController
if (_gameFunctions.Unmount()) if (_gameFunctions.Unmount())
return; return;
if (step is { DataId: not null, ItemId: not null }) if (step is { DataId: not null, ItemId: not null, GroundTarget: true })
{
_gameFunctions.UseItemOnGround(step.DataId.Value, step.ItemId.Value);
IncreaseStepCount();
}
else if (step is { DataId: not null, ItemId: not null })
{ {
_gameFunctions.UseItem(step.DataId.Value, step.ItemId.Value); _gameFunctions.UseItem(step.DataId.Value, step.ItemId.Value);
IncreaseStepCount(); IncreaseStepCount();
@ -507,6 +511,26 @@ internal sealed class QuestController
_gameFunctions.UseEmote(step.DataId.Value, step.Emote.Value); _gameFunctions.UseEmote(step.DataId.Value, step.Emote.Value);
IncreaseStepCount(); IncreaseStepCount();
} }
else if (step.Emote != null)
{
_gameFunctions.UseEmote(step.Emote.Value);
IncreaseStepCount();
}
break;
case EInteractionType.Say:
if (_condition[ConditionFlag.Mounted])
{
_gameFunctions.Unmount();
return;
}
if (!string.IsNullOrEmpty(step.ChatMessage))
{
_gameFunctions.ExecuteCommand($"/say {step.ChatMessage}");
IncreaseStepCount();
}
break; break;

View File

@ -355,6 +355,16 @@ internal sealed unsafe class GameFunctions
} }
} }
public void UseItemOnGround(uint dataId, uint itemId)
{
GameObject? gameObject = FindObjectByDataId(dataId);
if (gameObject != null)
{
var position = (FFXIVClientStructs.FFXIV.Common.Math.Vector3)gameObject.Position;
ActionManager.Instance()->UseActionLocation(ActionType.KeyItem, itemId, gameObject.ObjectId, &position);
}
}
public void UseEmote(uint dataId, EEmote emote) public void UseEmote(uint dataId, EEmote emote)
{ {
GameObject? gameObject = FindObjectByDataId(dataId); GameObject? gameObject = FindObjectByDataId(dataId);
@ -365,6 +375,11 @@ internal sealed unsafe class GameFunctions
} }
} }
public void UseEmote(EEmote emote)
{
ExecuteCommand($"{_emoteCommands[emote]} motion");
}
public bool IsObjectAtPosition(uint dataId, Vector3 position) public bool IsObjectAtPosition(uint dataId, Vector3 position)
{ {
GameObject? gameObject = FindObjectByDataId(dataId); GameObject? gameObject = FindObjectByDataId(dataId);

View File

@ -17,6 +17,7 @@ public sealed class InteractionTypeConverter : JsonConverter<EInteractionType>
{ EInteractionType.AttuneAetherCurrent, "AttuneAetherCurrent" }, { EInteractionType.AttuneAetherCurrent, "AttuneAetherCurrent" },
{ EInteractionType.Combat, "Combat" }, { EInteractionType.Combat, "Combat" },
{ EInteractionType.UseItem, "UseItem" }, { EInteractionType.UseItem, "UseItem" },
{ EInteractionType.Say, "Say" },
{ EInteractionType.Emote, "Emote" }, { EInteractionType.Emote, "Emote" },
{ EInteractionType.WaitForObjectAtPosition, "WaitForNpcAtPosition" }, { EInteractionType.WaitForObjectAtPosition, "WaitForNpcAtPosition" },
{ EInteractionType.ManualAction, "ManualAction" } { EInteractionType.ManualAction, "ManualAction" }

View File

@ -9,6 +9,7 @@ public enum EInteractionType
AttuneAetherCurrent, AttuneAetherCurrent,
Combat, Combat,
UseItem, UseItem,
Say,
Emote, Emote,
WaitForObjectAtPosition, WaitForObjectAtPosition,
ManualAction ManualAction

View File

@ -33,9 +33,11 @@ public class QuestStep
public uint? AetherCurrentId { get; set; } public uint? AetherCurrentId { get; set; }
public uint? ItemId { get; set; } public uint? ItemId { get; set; }
public bool? GroundTarget { get; set; }
[JsonConverter(typeof(EmoteConverter))] [JsonConverter(typeof(EmoteConverter))]
public EEmote? Emote { get; set; } public EEmote? Emote { get; set; }
public string ChatMessage { get; set; }
[JsonConverter(typeof(EnemySpawnTypeConverter))] [JsonConverter(typeof(EnemySpawnTypeConverter))]
public EEnemySpawnType? EnemySpawnType { get; set; } public EEnemySpawnType? EnemySpawnType { get; set; }

View File

@ -29,7 +29,9 @@
"Z": 305.80603 "Z": 305.80603
}, },
"TerritoryId": 813, "TerritoryId": 813,
"InteractionType": "Interact" "InteractionType": "Interact",
"AetheryteShortcut": "Lakeland - Fort Jobb",
"Fly": true
} }
] ]
}, },
@ -46,6 +48,7 @@
"TerritoryId": 819, "TerritoryId": 819,
"InteractionType": "ManualAction", "InteractionType": "ManualAction",
"Comment": "Cutscene Interaction needed", "Comment": "Cutscene Interaction needed",
"AetheryteShortcut": "Crystarium",
"AethernetShortcut": [ "AethernetShortcut": [
"[Crystarium] Aetheryte Plaza", "[Crystarium] Aetheryte Plaza",
"[Crystarium] The Cabinet of Curiosity" "[Crystarium] The Cabinet of Curiosity"
@ -63,6 +66,7 @@
"Y": -37.7, "Y": -37.7,
"Z": -208.85028 "Z": -208.85028
}, },
"StopDistance": 6,
"TerritoryId": 819, "TerritoryId": 819,
"InteractionType": "Interact" "InteractionType": "Interact"
} }

View File

@ -12,6 +12,7 @@
"Y": -37.7, "Y": -37.7,
"Z": -208.85028 "Z": -208.85028
}, },
"StopDistance": 6,
"TerritoryId": 819, "TerritoryId": 819,
"InteractionType": "Interact" "InteractionType": "Interact"
} }
@ -37,18 +38,23 @@
] ]
}, },
{ {
"Sequence": 2, "Sequence": 3,
"Steps": [ "Steps": [
{ {
"DataId": 2012128,
"Position": { "Position": {
"X": -0.001528129, "X": -6.1157894,
"Y": 4.931927, "Y": 2.0849845,
"Z": 0.01416349 "Z": -4.654831
}, },
"TerritoryId": 1031, "TerritoryId": 1031,
"InteractionType": "ManualAction", "InteractionType": "WalkTo"
"Comment": "Interact with Aetheryte (Navmesh can't jump)" },
{
"DataId": 2012128,
"TerritoryId": 1031,
"InteractionType": "Interact",
"Comment": "Interact with Aetheryte (Navmesh can't jump)",
"$": "QuestVariables after: 16 0 16 0 0 16"
}, },
{ {
"DataId": 1039993, "DataId": 1039993,
@ -58,7 +64,8 @@
"Z": -9.353821 "Z": -9.353821
}, },
"TerritoryId": 1031, "TerritoryId": 1031,
"InteractionType": "Interact" "InteractionType": "Interact",
"$": "QuestVariables after: 32 1 16 0 0 144"
}, },
{ {
"DataId": 1039994, "DataId": 1039994,
@ -68,7 +75,8 @@
"Z": 2.1209717 "Z": 2.1209717
}, },
"TerritoryId": 1031, "TerritoryId": 1031,
"InteractionType": "Interact" "InteractionType": "Interact",
"$": "QuestVariables after: 49 1 16 0 0 208"
}, },
{ {
"DataId": 1039995, "DataId": 1039995,
@ -107,6 +115,7 @@
"Y": 44.32154, "Y": 44.32154,
"Z": 771.4198 "Z": 771.4198
}, },
"StopDistance": 5,
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Interact" "InteractionType": "Interact"
} }

View File

@ -12,6 +12,7 @@
"Y": 44.32154, "Y": 44.32154,
"Z": 771.4198 "Z": 771.4198
}, },
"StopDistance": 5,
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Interact" "InteractionType": "Interact"
} }
@ -37,11 +38,6 @@
"Steps": [ "Steps": [
{ {
"DataId": 1039998, "DataId": 1039998,
"Position": {
"X": 206.0426,
"Y": 20.561113,
"Z": 629.14465
},
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "ManualAction", "InteractionType": "ManualAction",
"Comment": "Capture Mobs with less than 50% HP" "Comment": "Capture Mobs with less than 50% HP"

View File

@ -12,6 +12,7 @@
"Y": -1.1050489, "Y": -1.1050489,
"Z": 158.0376 "Z": 158.0376
}, },
"StopDistance": 5,
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Interact" "InteractionType": "Interact"
} }
@ -42,6 +43,7 @@
"Y": 11.703674, "Y": 11.703674,
"Z": 126.878784 "Z": 126.878784
}, },
"StopDistance": 6,
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "AttuneAetheryte" "InteractionType": "AttuneAetheryte"
}, },

View File

@ -58,8 +58,22 @@
"Z": 1.5411377 "Z": 1.5411377
}, },
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "ManualAction", "InteractionType": "UseItem",
"Comment": "Use Quest Item on ground locations" "ItemId": 2003234,
"GroundTarget": true,
"$": "QuestValues after: 1 16 0 0 0 128"
},
{
"DataId": 2012132,
"Position": {
"X": 373.18982,
"Y": 2.9754639,
"Z": 10.788086
},
"TerritoryId": 961,
"InteractionType": "UseItem",
"ItemId": 2003234,
"GroundTarget": true
} }
] ]
}, },

View File

@ -43,7 +43,18 @@
"Z": 107.9021 "Z": 107.9021
}, },
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "AttuneAetherCurrent" "InteractionType": "AttuneAetherCurrent",
"AetherCurrentId": 2818374
},
{
"Position": {
"X": 346.73517,
"Y": -15.572778,
"Z": -105.96149
},
"TerritoryId": 961,
"InteractionType": "WalkTo",
"Comment": "Needs manual jumping"
}, },
{ {
"DataId": 1040052, "DataId": 1040052,
@ -75,6 +86,17 @@
{ {
"Sequence": 4, "Sequence": 4,
"Steps": [ "Steps": [
{
"Position": {
"X": 339.039,
"Y": -14.322072,
"Z": -101.509995
},
"StopDistance": 0.5,
"TerritoryId": 961,
"InteractionType": "WalkTo",
"DisableNavmesh": true
},
{ {
"DataId": 2012022, "DataId": 2012022,
"Position": { "Position": {
@ -83,7 +105,8 @@
"Z": 2.5177002 "Z": 2.5177002
}, },
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "AttuneAetherCurrent" "InteractionType": "AttuneAetherCurrent",
"AetherCurrentId": 2818376
}, },
{ {
"DataId": 1040061, "DataId": 1040061,
@ -93,7 +116,7 @@
"Z": -104.631165 "Z": -104.631165
}, },
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "ManualAction", "InteractionType": "Say",
"ChatMessage": "I have a favor to ask" "ChatMessage": "I have a favor to ask"
} }
] ]
@ -109,7 +132,7 @@
"Z": -104.631165 "Z": -104.631165
}, },
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "ManualAction", "InteractionType": "Say",
"ChatMessage": "Please, Emet-Selch" "ChatMessage": "Please, Emet-Selch"
} }
] ]
@ -118,14 +141,10 @@
"Sequence": 6, "Sequence": 6,
"Steps": [ "Steps": [
{ {
"Position": {
"X": -64.09766,
"Y": -15.335736,
"Z": -84.71621
},
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Emote", "InteractionType": "Emote",
"Emote": "wave" "Emote": "wave",
"Comment": "Need to jump manually"
} }
] ]
}, },
@ -140,7 +159,8 @@
"Z": 88.91431 "Z": 88.91431
}, },
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Interact" "InteractionType": "Interact",
"AetheryteShortcut": "Elpis - Anagnorisis"
} }
] ]
} }

View File

@ -12,6 +12,7 @@
"Y": 10.385857, "Y": 10.385857,
"Z": 89.34155 "Z": 89.34155
}, },
"StopDistance": 5,
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Interact" "InteractionType": "Interact"
} }
@ -20,6 +21,25 @@
{ {
"Sequence": 1, "Sequence": 1,
"Steps": [ "Steps": [
{
"Position": {
"X": -137.80992,
"Y": -26.995626,
"Z": 543.8281
},
"TerritoryId": 961,
"InteractionType": "WalkTo"
},
{
"Position": {
"X": -137.80992,
"Y": -26.995626,
"Z": 543.8281
},
"TerritoryId": 961,
"InteractionType": "ManualAction",
"Comment": "Jump on Ledge"
},
{ {
"DataId": 2012023, "DataId": 2012023,
"Position": { "Position": {
@ -28,7 +48,18 @@
"Z": 551.5067 "Z": 551.5067
}, },
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "AttuneAetherCurrent" "InteractionType": "AttuneAetherCurrent",
"AetherCurrentId": 2818377
},
{
"Position": {
"X": -139.15512,
"Y": -27.030453,
"Z": 535.6933
},
"TerritoryId": 961,
"InteractionType": "WalkTo",
"DisableNavmesh": true
}, },
{ {
"DataId": 1040073, "DataId": 1040073,
@ -53,7 +84,8 @@
"Z": 490.53174 "Z": 490.53174
}, },
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "AttuneAetherCurrent" "InteractionType": "AttuneAetherCurrent",
"AetherCurrentId": 2818378
}, },
{ {
"DataId": 1040080, "DataId": 1040080,
@ -102,6 +134,7 @@
"Y": -22.394821, "Y": -22.394821,
"Z": 527.88574 "Z": 527.88574
}, },
"StopDistance": 5,
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Interact" "InteractionType": "Interact"
} }

View File

@ -12,6 +12,7 @@
"Y": -22.39482, "Y": -22.39482,
"Z": 525.47485 "Z": 525.47485
}, },
"StopDistance": 5,
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Interact" "InteractionType": "Interact"
} }
@ -27,6 +28,7 @@
"Y": -22.394821, "Y": -22.394821,
"Z": 527.88574 "Z": 527.88574
}, },
"StopDistance": 5,
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Interact" "InteractionType": "Interact"
} }
@ -120,6 +122,15 @@
{ {
"Sequence": 7, "Sequence": 7,
"Steps": [ "Steps": [
{
"Position": {
"X": -734.30804,
"Y": -28.391644,
"Z": 432.59787
},
"TerritoryId": 961,
"InteractionType": "WalkTo"
},
{ {
"DataId": 2012021, "DataId": 2012021,
"Position": { "Position": {
@ -128,7 +139,9 @@
"Z": 411.12378 "Z": 411.12378
}, },
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "AttuneAetherCurrent" "InteractionType": "AttuneAetherCurrent",
"AetherCurrentId": 2818375,
"DisableNavmesh": true
}, },
{ {
"DataId": 2012141, "DataId": 2012141,

View File

@ -58,6 +58,7 @@
}, },
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Combat", "InteractionType": "Combat",
"EnemySpawnType": "AutoOnEnterArea",
"KillEnemyDataIds": [ "KillEnemyDataIds": [
14075, 14075,
14074 14074
@ -90,6 +91,7 @@
"Y": -22.39482, "Y": -22.39482,
"Z": 504.90576 "Z": 504.90576
}, },
"StopDistance": 5,
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Interact" "InteractionType": "Interact"
} }

View File

@ -12,6 +12,7 @@
"Y": -22.39482, "Y": -22.39482,
"Z": 505.08887 "Z": 505.08887
}, },
"StopDistance": 5,
"TerritoryId": 961, "TerritoryId": 961,
"InteractionType": "Interact" "InteractionType": "Interact"
} }

View File

@ -96,6 +96,7 @@
"AttuneAetherCurrent", "AttuneAetherCurrent",
"Combat", "Combat",
"UseItem", "UseItem",
"Say",
"Emote", "Emote",
"WaitForNpcAtPosition", "WaitForNpcAtPosition",
"ManualAction" "ManualAction"
@ -303,6 +304,10 @@
"deny" "deny"
] ]
}, },
"ChatMessage": {
"type": "string",
"description": "The text to use with /say"
},
"ItemId": { "ItemId": {
"type": ["number", "null"], "type": ["number", "null"],
"description": "The Item to use", "description": "The Item to use",

View File

@ -107,6 +107,27 @@ internal sealed class DebugWindow : Window
var q = _gameFunctions.GetCurrentQuest(); var q = _gameFunctions.GetCurrentQuest();
ImGui.Text($"Current Quest: {q.CurrentQuest} → {q.Sequence}"); ImGui.Text($"Current Quest: {q.CurrentQuest} → {q.Sequence}");
var questManager = QuestManager.Instance();
if (questManager != null)
{
for (int i = 0; i < 1 /*questManager->TrackedQuestsSpan.Length*/; ++i)
{
var trackedQuest = questManager->TrackedQuestsSpan[i];
switch (trackedQuest.QuestType)
{
default:
ImGui.Text($"Tracked quest {i}: {trackedQuest.QuestType}, {trackedQuest.Index}");
break;
case 1:
ImGui.Text(
$"Tracked quest: {questManager->NormalQuestsSpan[trackedQuest.Index].QuestId}, {trackedQuest.Index}");
break;
}
}
}
if (_targetManager.Target != null) if (_targetManager.Target != null)
{ {
ImGui.Separator(); ImGui.Separator();