Handle dialogue choices in 'In from the Cold'
authorLiza Carvelli <liza@carvel.li>
Mon, 14 Oct 2024 23:09:21 +0000 (01:09 +0200)
committerLiza Carvelli <liza@carvel.li>
Mon, 14 Oct 2024 23:09:21 +0000 (01:09 +0200)
13 files changed:
GatheringPathRenderer/packages.lock.json
GatheringPaths/packages.lock.json
QuestPathGenerator/QuestPathGenerator.csproj
QuestPathGenerator/RoslynElements/DialogueChoiceExtensions.cs
QuestPathGenerator/packages.lock.json
QuestPaths/6.x - Endwalker/MSQ/B-Garlemald/4394_In from the Cold.json
QuestPaths/packages.lock.json
Questionable.Model/Questing/DialogueChoice.cs
Questionable.Model/Questionable.Model.csproj
Questionable.Model/packages.lock.json
Questionable/Controller/GameUi/InteractionUiController.cs
Questionable/Questionable.csproj
Questionable/packages.lock.json

index f7b5b4d3d232eb7a3650f29ae8bb0dc528bf1152..aae9abbad664aa86b5545f2c3cd61853db784e69 100644 (file)
           "Microsoft.SourceLink.Common": "1.1.1"
         }
       },
-      "System.Text.Encodings.Web": {
-        "type": "Transitive",
-        "resolved": "8.0.0",
-        "contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
-      },
       "System.Text.Json": {
         "type": "Transitive",
-        "resolved": "8.0.4",
-        "contentHash": "bAkhgDJ88XTsqczoxEMliSrpijKZHhbJQldhAmObj/RbrN3sU5dcokuXmWJWsdQAhiMJ9bTayWsL1C9fbbCRhw==",
-        "dependencies": {
-          "System.Text.Encodings.Web": "8.0.0"
-        }
+        "resolved": "8.0.5",
+        "contentHash": "0f1B50Ss7rqxXiaBJyzUu9bWFOO2/zSlifZ/UNMdiIpDYe4cY4LQQicP4nirK1OS31I43rn062UIJ1Q9bpmHpg=="
       },
       "ecommons": {
         "type": "Project"
       "questionable.model": {
         "type": "Project",
         "dependencies": {
-          "System.Text.Json": "[8.0.4, )"
+          "System.Text.Json": "[8.0.5, )"
         }
       }
     }
index 408e267a5d1e90e3f5704145c02b07c6ef98e968..d46a7a0e844b0263d558d6689b2e53edca29ef5c 100644 (file)
@@ -2,23 +2,15 @@
   "version": 1,
   "dependencies": {
     "net8.0-windows7.0": {
-      "System.Text.Encodings.Web": {
-        "type": "Transitive",
-        "resolved": "8.0.0",
-        "contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
-      },
       "System.Text.Json": {
         "type": "Transitive",
-        "resolved": "8.0.4",
-        "contentHash": "bAkhgDJ88XTsqczoxEMliSrpijKZHhbJQldhAmObj/RbrN3sU5dcokuXmWJWsdQAhiMJ9bTayWsL1C9fbbCRhw==",
-        "dependencies": {
-          "System.Text.Encodings.Web": "8.0.0"
-        }
+        "resolved": "8.0.5",
+        "contentHash": "0f1B50Ss7rqxXiaBJyzUu9bWFOO2/zSlifZ/UNMdiIpDYe4cY4LQQicP4nirK1OS31I43rn062UIJ1Q9bpmHpg=="
       },
       "questionable.model": {
         "type": "Project",
         "dependencies": {
-          "System.Text.Json": "[8.0.4, )"
+          "System.Text.Json": "[8.0.5, )"
         }
       }
     }
index d5eb73ba8deced23b7dd1af11e1438cf0d30e095..9c862ec982938766dc51abb52a4fc26a2b88add5 100644 (file)
@@ -26,7 +26,7 @@
         </PackageReference>
         <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
         <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.9.2" />
-        <PackageReference Include="System.Text.Json" Version="8.0.4" PrivateAssets="all" />
+        <PackageReference Include="System.Text.Json" Version="8.0.5" PrivateAssets="all" />
     </ItemGroup>
 
     <ItemGroup>
index 92f6ab8747947bb56200a88bd60ccb2e6519b6e2..e33fe408548fb103405cda85c4d44721ec1f9853 100644 (file)
@@ -42,6 +42,9 @@ internal static class DialogueChoiceExtensions
                                 .AsSyntaxNodeOrToken(),
                             Assignment(nameof(DialogueChoice.DataId), dialogueChoice.DataId,
                                     emptyChoice.DataId)
+                                .AsSyntaxNodeOrToken(),
+                            Assignment(nameof(DialogueChoice.SpecialCondition), dialogueChoice.SpecialCondition,
+                                    emptyChoice.SpecialCondition)
                                 .AsSyntaxNodeOrToken()))));
     }
 }
index 77bbdf0a88eb9613042fdee8793b61086b204763..44b2a0117133b038f25a6e57ec17b25e6b708767 100644 (file)
@@ -68,9 +68,9 @@
       },
       "System.Text.Json": {
         "type": "Direct",
-        "requested": "[8.0.4, )",
-        "resolved": "8.0.4",
-        "contentHash": "bAkhgDJ88XTsqczoxEMliSrpijKZHhbJQldhAmObj/RbrN3sU5dcokuXmWJWsdQAhiMJ9bTayWsL1C9fbbCRhw==",
+        "requested": "[8.0.5, )",
+        "resolved": "8.0.5",
+        "contentHash": "0f1B50Ss7rqxXiaBJyzUu9bWFOO2/zSlifZ/UNMdiIpDYe4cY4LQQicP4nirK1OS31I43rn062UIJ1Q9bpmHpg==",
         "dependencies": {
           "Microsoft.Bcl.AsyncInterfaces": "8.0.0",
           "System.Buffers": "4.5.1",
       "questionable.model": {
         "type": "Project",
         "dependencies": {
-          "System.Text.Json": "[8.0.4, )"
+          "System.Text.Json": "[8.0.5, )"
         }
       }
     }
index 20e3b2b8dc854bcc1ff61e341aac6ba190f3b96e..aaa63db46c8475d3537de8c8f6e722d006758f01 100644 (file)
               "Type": "YesNo",
               "Prompt": "TEXT_AKTKMB115_04394_Q1_000_042",
               "Yes": true
+            },
+            {
+              "Type": "List",
+              "ExcelSheet": "ContentTalk",
+              "Prompt": 254,
+              "Answer": 247,
+              "SpecialCondition": "NoDutyActions"
+            },
+            {
+              "Type": "List",
+              "ExcelSheet": "ContentTalk",
+              "Prompt": 254,
+              "Answer": 248
             }
           ],
           "AetheryteShortcut": "Garlemald - Camp Broken Glass",
index 408e267a5d1e90e3f5704145c02b07c6ef98e968..d46a7a0e844b0263d558d6689b2e53edca29ef5c 100644 (file)
@@ -2,23 +2,15 @@
   "version": 1,
   "dependencies": {
     "net8.0-windows7.0": {
-      "System.Text.Encodings.Web": {
-        "type": "Transitive",
-        "resolved": "8.0.0",
-        "contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
-      },
       "System.Text.Json": {
         "type": "Transitive",
-        "resolved": "8.0.4",
-        "contentHash": "bAkhgDJ88XTsqczoxEMliSrpijKZHhbJQldhAmObj/RbrN3sU5dcokuXmWJWsdQAhiMJ9bTayWsL1C9fbbCRhw==",
-        "dependencies": {
-          "System.Text.Encodings.Web": "8.0.0"
-        }
+        "resolved": "8.0.5",
+        "contentHash": "0f1B50Ss7rqxXiaBJyzUu9bWFOO2/zSlifZ/UNMdiIpDYe4cY4LQQicP4nirK1OS31I43rn062UIJ1Q9bpmHpg=="
       },
       "questionable.model": {
         "type": "Project",
         "dependencies": {
-          "System.Text.Json": "[8.0.4, )"
+          "System.Text.Json": "[8.0.5, )"
         }
       }
     }
index a43a335c0d8bb98b5ded32b95daec08fffcc4a6a..329449a73d2d44cc9e6d1d038f73072fc4422c29 100644 (file)
@@ -23,4 +23,9 @@ public sealed class DialogueChoice
     /// If set, only applies when focusing the given target id.
     /// </summary>
     public uint? DataId { get; set; }
+
+    /// <summary>
+    /// Used for 'In from the Cold'.
+    /// </summary>
+    public string? SpecialCondition { get; set; }
 }
index 54301430aa0ac8cbdfba63a5fea3acc1da3f7a2b..62ae2a34b9f19cc1fac056a4184c08f16456ee6e 100644 (file)
@@ -11,7 +11,7 @@
     </PropertyGroup>
 
     <ItemGroup>
-        <PackageReference Include="System.Text.Json" Version="8.0.4" />
+        <PackageReference Include="System.Text.Json" Version="8.0.5" />
     </ItemGroup>
 
 
index c609cb4fe2ca1e86708dbc3b022e52adec24d67b..7fd9471e69aa75fc0cdcccc5d7dcd8a0e737bc30 100644 (file)
@@ -13,9 +13,9 @@
       },
       "System.Text.Json": {
         "type": "Direct",
-        "requested": "[8.0.4, )",
-        "resolved": "8.0.4",
-        "contentHash": "bAkhgDJ88XTsqczoxEMliSrpijKZHhbJQldhAmObj/RbrN3sU5dcokuXmWJWsdQAhiMJ9bTayWsL1C9fbbCRhw==",
+        "requested": "[8.0.5, )",
+        "resolved": "8.0.5",
+        "contentHash": "0f1B50Ss7rqxXiaBJyzUu9bWFOO2/zSlifZ/UNMdiIpDYe4cY4LQQicP4nirK1OS31I43rn062UIJ1Q9bpmHpg==",
         "dependencies": {
           "Microsoft.Bcl.AsyncInterfaces": "8.0.0",
           "System.Buffers": "4.5.1",
index 6db38b80f54e613f372535422ba9fc2d21ad5ca3..698d24dda7c2533027dd85b080d220c54dae0546 100644 (file)
@@ -7,7 +7,9 @@ using Dalamud.Game.Addon.Lifecycle;
 using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
 using Dalamud.Game.ClientState.Objects;
 using Dalamud.Plugin.Services;
+using FFXIVClientStructs.FFXIV.Client.Game;
 using FFXIVClientStructs.FFXIV.Client.Game.Event;
+using FFXIVClientStructs.FFXIV.Client.Game.InstanceContent;
 using FFXIVClientStructs.FFXIV.Client.Game.UI;
 using FFXIVClientStructs.FFXIV.Client.UI;
 using FFXIVClientStructs.FFXIV.Component.GUI;
@@ -333,7 +335,16 @@ internal sealed class InteractionUiController : IDisposable
             }
             else
             {
-                var step = quest.FindSequence(currentQuest.Sequence)?.FindStep(currentQuest.Step);
+                QuestStep? step = null;
+                if (_territoryData.IsQuestBattleInstance(_clientState.TerritoryType))
+                {
+                    step = quest.FindSequence(currentQuest.Sequence)?.Steps
+                        .FirstOrDefault(x => x.InteractionType == EInteractionType.SinglePlayerDuty);
+                }
+
+                if (step == null)
+                    step = quest.FindSequence(currentQuest.Sequence)?.FindStep(currentQuest.Step);
+
                 if (step == null)
                     _logger.LogDebug("Ignoring current quest dialogue choices, no active step");
                 else
@@ -427,6 +438,27 @@ internal sealed class InteractionUiController : IDisposable
             if (dialogueChoice.Type != EDialogChoiceType.List)
                 continue;
 
+            if (dialogueChoice.SpecialCondition == "NoDutyActions")
+            {
+                try
+                {
+                    unsafe
+                    {
+                        ContentDirector* contentDirector = EventFramework.Instance()->GetContentDirector();
+                        if (contentDirector != null && contentDirector->DutyActionManager.ActionsPresent)
+                        {
+                            _logger.LogInformation("NoDutyActions: actions present, skipping dialogue choice");
+                            continue;
+                        }
+                    }
+                }
+                catch (Exception ex)
+                {
+                    _logger.LogError(ex, "Failed to check for duty actions");
+                    continue;
+                }
+            }
+
             if (dialogueChoice.Answer == null)
             {
                 _logger.LogDebug("Ignoring entry in DialogueChoices, no answer");
index 376045ee11c56f77c2d7d82a4f39e7996b9fd789..8d1a3c894c72bd796a1b949d0374f8b4fe6133ca 100644 (file)
@@ -13,7 +13,7 @@
         <PackageReference Include="JetBrains.Annotations" Version="2024.2.0" ExcludeAssets="runtime" />
         <PackageReference Include="JsonSchema.Net" Version="7.1.2" />
         <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0"/>
-        <PackageReference Include="System.Text.Json" Version="8.0.4" />
+        <PackageReference Include="System.Text.Json" Version="8.0.5" />
     </ItemGroup>
 
     <ItemGroup>
index 1fd1286547b6ea269af375982df3ec51956f758b..07f5b16f27c3cf8a4d4dcc7b0eb3f587058bca0c 100644 (file)
       },
       "System.Text.Json": {
         "type": "Direct",
-        "requested": "[8.0.4, )",
-        "resolved": "8.0.4",
-        "contentHash": "bAkhgDJ88XTsqczoxEMliSrpijKZHhbJQldhAmObj/RbrN3sU5dcokuXmWJWsdQAhiMJ9bTayWsL1C9fbbCRhw==",
-        "dependencies": {
-          "System.Text.Encodings.Web": "8.0.0"
-        }
+        "requested": "[8.0.5, )",
+        "resolved": "8.0.5",
+        "contentHash": "0f1B50Ss7rqxXiaBJyzUu9bWFOO2/zSlifZ/UNMdiIpDYe4cY4LQQicP4nirK1OS31I43rn062UIJ1Q9bpmHpg=="
       },
       "Humanizer.Core": {
         "type": "Transitive",
           "Microsoft.SourceLink.Common": "1.1.1"
         }
       },
-      "System.Text.Encodings.Web": {
-        "type": "Transitive",
-        "resolved": "8.0.0",
-        "contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
-      },
       "gatheringpaths": {
         "type": "Project",
         "dependencies": {
-          "Questionable.Model": "[1.0.0, )"
+          "Questionable.Model": "[3.10.0, )"
         }
       },
       "llib": {
       "questionable.model": {
         "type": "Project",
         "dependencies": {
-          "System.Text.Json": "[8.0.4, )"
+          "System.Text.Json": "[8.0.5, )"
         }
       },
       "questpaths": {
         "type": "Project",
         "dependencies": {
-          "Questionable.Model": "[1.0.0, )"
+          "Questionable.Model": "[3.10.0, )"
         }
       }
     }