forked from aly/qstbak
muffin v7.4.18
This commit is contained in:
parent
53aa9fdee8
commit
f82b9ce2a2
50 changed files with 142364 additions and 230361 deletions
|
|
@ -63,6 +63,8 @@ internal sealed class InteractionUiController : IDisposable
|
|||
|
||||
private readonly FateController _fateController;
|
||||
|
||||
private readonly SeasonalDutyController _seasonalDutyController;
|
||||
|
||||
private readonly BossModIpc _bossModIpc;
|
||||
|
||||
private readonly Configuration _configuration;
|
||||
|
|
@ -79,7 +81,7 @@ internal sealed class InteractionUiController : IDisposable
|
|||
{
|
||||
get
|
||||
{
|
||||
if (!_isInitialCheck && !_questController.IsRunning && !_fateController.IsRunning)
|
||||
if (!_isInitialCheck && !_questController.IsRunning && !_fateController.IsRunning && !_seasonalDutyController.IsRunning)
|
||||
{
|
||||
return _territoryData.IsQuestBattleInstance(_clientState.TerritoryType);
|
||||
}
|
||||
|
|
@ -87,7 +89,7 @@ internal sealed class InteractionUiController : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe InteractionUiController(IAddonLifecycle addonLifecycle, IDataManager dataManager, QuestFunctions questFunctions, AetheryteFunctions aetheryteFunctions, ExcelFunctions excelFunctions, QuestController questController, GatheringPointRegistry gatheringPointRegistry, QuestRegistry questRegistry, QuestData questData, TerritoryData territoryData, IGameGui gameGui, ITargetManager targetManager, IPluginLog pluginLog, IClientState clientState, IObjectTable objectTable, ShopController shopController, FateController fateController, BossModIpc bossModIpc, Configuration configuration, ILogger<InteractionUiController> logger)
|
||||
public unsafe InteractionUiController(IAddonLifecycle addonLifecycle, IDataManager dataManager, QuestFunctions questFunctions, AetheryteFunctions aetheryteFunctions, ExcelFunctions excelFunctions, QuestController questController, GatheringPointRegistry gatheringPointRegistry, QuestRegistry questRegistry, QuestData questData, TerritoryData territoryData, IGameGui gameGui, ITargetManager targetManager, IPluginLog pluginLog, IClientState clientState, IObjectTable objectTable, ShopController shopController, FateController fateController, SeasonalDutyController seasonalDutyController, BossModIpc bossModIpc, Configuration configuration, ILogger<InteractionUiController> logger)
|
||||
{
|
||||
_addonLifecycle = addonLifecycle;
|
||||
_dataManager = dataManager;
|
||||
|
|
@ -105,6 +107,7 @@ internal sealed class InteractionUiController : IDisposable
|
|||
_objectTable = objectTable;
|
||||
_shopController = shopController;
|
||||
_fateController = fateController;
|
||||
_seasonalDutyController = seasonalDutyController;
|
||||
_bossModIpc = bossModIpc;
|
||||
_configuration = configuration;
|
||||
_logger = logger;
|
||||
|
|
@ -118,6 +121,7 @@ internal sealed class InteractionUiController : IDisposable
|
|||
_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "DifficultySelectYesNo", DifficultySelectYesNoPostSetup);
|
||||
_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "PointMenu", PointMenuPostSetup);
|
||||
_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "HousingSelectBlock", HousingSelectBlockPostSetup);
|
||||
_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "EasterMowingResult", EasterMowingResultPostSetup);
|
||||
if (_gameGui.TryGetAddonByName<AtkUnitBase>("RhythmAction", out var addonPtr))
|
||||
{
|
||||
addonPtr->Close(fireCallback: true);
|
||||
|
|
@ -369,9 +373,7 @@ internal sealed class InteractionUiController : IDisposable
|
|||
int num = 1;
|
||||
List<EAetheryteLocation> list2 = new List<EAetheryteLocation>(num);
|
||||
CollectionsMarshal.SetCount(list2, num);
|
||||
Span<EAetheryteLocation> span = CollectionsMarshal.AsSpan(list2);
|
||||
int index = 0;
|
||||
span[index] = valueOrDefault;
|
||||
CollectionsMarshal.AsSpan(list2)[0] = valueOrDefault;
|
||||
source = list2;
|
||||
}
|
||||
}
|
||||
|
|
@ -466,6 +468,15 @@ internal sealed class InteractionUiController : IDisposable
|
|||
list.AddRange(list4.Select((DialogueChoice x) => new DialogueChoiceInfo(null, x)));
|
||||
}
|
||||
}
|
||||
if (_seasonalDutyController.IsRunning)
|
||||
{
|
||||
List<DialogueChoice> list5 = _seasonalDutyController.CurrentDuty?.DialogueChoices;
|
||||
if (list5 != null && list5.Count > 0)
|
||||
{
|
||||
_logger.LogInformation("Adding {Count} dialogue choices from active seasonal duty", list5.Count);
|
||||
list.AddRange(list5.Select((DialogueChoice x) => new DialogueChoiceInfo(null, x)));
|
||||
}
|
||||
}
|
||||
if (list.Count == 0)
|
||||
{
|
||||
_logger.LogDebug("No dialogue choices to check");
|
||||
|
|
@ -658,24 +669,48 @@ internal sealed class InteractionUiController : IDisposable
|
|||
return;
|
||||
}
|
||||
QuestController.QuestProgress nextQuest = _questController.NextQuest;
|
||||
if ((nextQuest != null && CheckQuestYesNo(addonSelectYesno, nextQuest, text, checkAllSteps)) || !_fateController.IsRunning)
|
||||
if (nextQuest != null && CheckQuestYesNo(addonSelectYesno, nextQuest, text, checkAllSteps))
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<DialogueChoice> list = _fateController.CurrentFate?.TransformDialogueChoices;
|
||||
if (list == null)
|
||||
if (_fateController.IsRunning)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (DialogueChoice item in list)
|
||||
{
|
||||
if (item.Type == EDialogChoiceType.YesNo)
|
||||
List<DialogueChoice> list = _fateController.CurrentFate?.TransformDialogueChoices;
|
||||
if (list != null)
|
||||
{
|
||||
StringOrRegex stringOrRegex = ResolveReference(null, item.ExcelSheet, item.Prompt, item.PromptIsRegularExpression);
|
||||
if (stringOrRegex != null && IsMatch(text, stringOrRegex))
|
||||
foreach (DialogueChoice item in list)
|
||||
{
|
||||
_logger.LogInformation("FATE: Returning {YesNo} for '{Prompt}'", item.Yes ? "Yes" : "No", text);
|
||||
addonSelectYesno->AtkUnitBase.FireCallbackInt((!item.Yes) ? 1 : 0);
|
||||
if (item.Type == EDialogChoiceType.YesNo)
|
||||
{
|
||||
StringOrRegex stringOrRegex = ResolveReference(null, item.ExcelSheet, item.Prompt, item.PromptIsRegularExpression);
|
||||
if (stringOrRegex != null && IsMatch(text, stringOrRegex))
|
||||
{
|
||||
_logger.LogInformation("FATE: Returning {YesNo} for '{Prompt}'", item.Yes ? "Yes" : "No", text);
|
||||
addonSelectYesno->AtkUnitBase.FireCallbackInt((!item.Yes) ? 1 : 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!_seasonalDutyController.IsRunning)
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<DialogueChoice> list2 = _seasonalDutyController.CurrentDuty?.DialogueChoices;
|
||||
if (list2 == null || list2.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (DialogueChoice item2 in list2)
|
||||
{
|
||||
if (item2.Type == EDialogChoiceType.YesNo)
|
||||
{
|
||||
StringOrRegex stringOrRegex2 = ResolveReference(null, item2.ExcelSheet, item2.Prompt, item2.PromptIsRegularExpression);
|
||||
if (stringOrRegex2 != null && IsMatch(text, stringOrRegex2))
|
||||
{
|
||||
_logger.LogInformation("Seasonal duty: Returning {YesNo} for '{Prompt}'", item2.Yes ? "Yes" : "No", text);
|
||||
addonSelectYesno->AtkUnitBase.FireCallbackInt((!item2.Yes) ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1017,6 +1052,35 @@ internal sealed class InteractionUiController : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
private unsafe void EasterMowingResultPostSetup(AddonEvent type, AddonArgs args)
|
||||
{
|
||||
if (_seasonalDutyController.IsRunning)
|
||||
{
|
||||
_logger.LogInformation("Dismissing EasterMowingResult");
|
||||
AtkUnitBase* address = (AtkUnitBase*)args.Addon.Address;
|
||||
AtkValue* values = stackalloc AtkValue[3]
|
||||
{
|
||||
new AtkValue
|
||||
{
|
||||
Type = FFXIVClientStructs.FFXIV.Component.GUI.ValueType.Int,
|
||||
Int = -1
|
||||
},
|
||||
new AtkValue
|
||||
{
|
||||
Type = FFXIVClientStructs.FFXIV.Component.GUI.ValueType.Int,
|
||||
Int = 1
|
||||
},
|
||||
new AtkValue
|
||||
{
|
||||
Type = FFXIVClientStructs.FFXIV.Component.GUI.ValueType.Int,
|
||||
Int = 1
|
||||
}
|
||||
};
|
||||
address->FireCallback(3u, values);
|
||||
address->Close(fireCallback: true);
|
||||
}
|
||||
}
|
||||
|
||||
private StringOrRegex? ResolveReference(Questionable.Model.Quest? quest, string? excelSheet, ExcelRef? excelRef, bool isRegExp)
|
||||
{
|
||||
if (excelRef == null)
|
||||
|
|
@ -1040,6 +1104,7 @@ internal sealed class InteractionUiController : IDisposable
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "EasterMowingResult", EasterMowingResultPostSetup);
|
||||
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "HousingSelectBlock", HousingSelectBlockPostSetup);
|
||||
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "PointMenu", PointMenuPostSetup);
|
||||
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "DifficultySelectYesNo", DifficultySelectYesNoPostSetup);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue