muffin v7.38.8
This commit is contained in:
parent
5e2d8f648b
commit
3e10cbbbf2
51 changed files with 2585 additions and 1972 deletions
|
|
@ -22,16 +22,16 @@ internal sealed class AetheryteFunctions
|
|||
|
||||
private readonly IDataManager _dataManager;
|
||||
|
||||
private readonly IClientState _clientState;
|
||||
private readonly IObjectTable _objectTable;
|
||||
|
||||
public DateTime ReturnRequestedAt { get; set; } = DateTime.MinValue;
|
||||
|
||||
public AetheryteFunctions(IServiceProvider serviceProvider, ILogger<AetheryteFunctions> logger, IDataManager dataManager, IClientState clientState)
|
||||
public AetheryteFunctions(IServiceProvider serviceProvider, ILogger<AetheryteFunctions> logger, IDataManager dataManager, IObjectTable objectTable)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
_logger = logger;
|
||||
_dataManager = dataManager;
|
||||
_clientState = clientState;
|
||||
_objectTable = objectTable;
|
||||
}
|
||||
|
||||
public unsafe bool IsAetheryteUnlocked(uint aetheryteId, out byte subIndex)
|
||||
|
|
@ -114,7 +114,7 @@ internal sealed class AetheryteFunctions
|
|||
|
||||
public unsafe AetheryteRegistrationResult CanRegisterFreeOrFavoriteAetheryte(EAetheryteLocation aetheryteLocation)
|
||||
{
|
||||
if (_clientState.LocalPlayer == null)
|
||||
if (_objectTable[0] == null)
|
||||
{
|
||||
return AetheryteRegistrationResult.NotPossible;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ internal sealed class GameFunctions
|
|||
|
||||
public unsafe ushort? GetMountId()
|
||||
{
|
||||
BattleChara* ptr = (BattleChara*)(_clientState.LocalPlayer?.Address ?? 0);
|
||||
BattleChara* ptr = (BattleChara*)(_objectTable.LocalPlayer?.Address ?? 0);
|
||||
if (ptr != null && ptr->Mount.MountId != 0)
|
||||
{
|
||||
return ptr->Mount.MountId;
|
||||
|
|
@ -203,14 +203,14 @@ internal sealed class GameFunctions
|
|||
if (gameObject != null)
|
||||
{
|
||||
Vector3 position = gameObject.Position;
|
||||
return ActionManager.Instance()->UseActionLocation(ActionType.KeyItem, itemId, 3758096384uL, &position, 0u, 0);
|
||||
return ActionManager.Instance()->UseActionLocation(ActionType.EventItem, itemId, 3758096384uL, &position, 0u, 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public unsafe bool UseItemOnPosition(Vector3 position, uint itemId)
|
||||
{
|
||||
return ActionManager.Instance()->UseActionLocation(ActionType.KeyItem, itemId, 3758096384uL, &position, 0u, 0);
|
||||
return ActionManager.Instance()->UseActionLocation(ActionType.EventItem, itemId, 3758096384uL, &position, 0u, 0);
|
||||
}
|
||||
|
||||
public unsafe bool UseAction(EAction action)
|
||||
|
|
@ -287,7 +287,7 @@ internal sealed class GameFunctions
|
|||
{
|
||||
return true;
|
||||
}
|
||||
IPlayerCharacter localPlayer = _clientState.LocalPlayer;
|
||||
IPlayerCharacter localPlayer = _objectTable.LocalPlayer;
|
||||
if (localPlayer == null)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -308,7 +308,7 @@ internal sealed class GameFunctions
|
|||
|
||||
private unsafe bool HasCharacterStatusPreventingMountOrSprint()
|
||||
{
|
||||
IPlayerCharacter localPlayer = _clientState.LocalPlayer;
|
||||
IPlayerCharacter localPlayer = _objectTable.LocalPlayer;
|
||||
if (localPlayer == null)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -324,7 +324,7 @@ internal sealed class GameFunctions
|
|||
|
||||
public unsafe bool HasStatus(EStatus statusId)
|
||||
{
|
||||
IPlayerCharacter localPlayer = _clientState.LocalPlayer;
|
||||
IPlayerCharacter localPlayer = _objectTable.LocalPlayer;
|
||||
if (localPlayer == null)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -423,7 +423,7 @@ internal sealed class GameFunctions
|
|||
|
||||
public unsafe bool IsOccupied()
|
||||
{
|
||||
if (!_clientState.IsLoggedIn || _clientState.LocalPlayer == null)
|
||||
if (!_clientState.IsLoggedIn || _objectTable.LocalPlayer == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -547,7 +547,7 @@ internal sealed class GameFunctions
|
|||
|
||||
public unsafe bool SyncToFate(uint fateId)
|
||||
{
|
||||
IPlayerCharacter localPlayer = _clientState.LocalPlayer;
|
||||
IPlayerCharacter localPlayer = _objectTable.LocalPlayer;
|
||||
if (localPlayer == null)
|
||||
{
|
||||
_logger.LogWarning("Cannot sync to FATE: LocalPlayer is null");
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ internal sealed class QuestFunctions
|
|||
|
||||
private readonly IDataManager _dataManager;
|
||||
|
||||
private readonly IObjectTable _objectTable;
|
||||
|
||||
private readonly IClientState _clientState;
|
||||
|
||||
private readonly IGameGui _gameGui;
|
||||
|
|
@ -68,7 +70,7 @@ internal sealed class QuestFunctions
|
|||
|
||||
private ElementId? _lastLoggedAcceptedHiddenMsq;
|
||||
|
||||
public QuestFunctions(QuestRegistry questRegistry, QuestData questData, AetheryteFunctions aetheryteFunctions, AlliedSocietyQuestFunctions alliedSocietyQuestFunctions, AlliedSocietyData alliedSocietyData, AetheryteData aetheryteData, Configuration configuration, IDataManager dataManager, IClientState clientState, IGameGui gameGui, IAetheryteList aetheryteList, ILogger<QuestFunctions> logger)
|
||||
public QuestFunctions(QuestRegistry questRegistry, QuestData questData, AetheryteFunctions aetheryteFunctions, AlliedSocietyQuestFunctions alliedSocietyQuestFunctions, AlliedSocietyData alliedSocietyData, AetheryteData aetheryteData, Configuration configuration, IDataManager dataManager, IObjectTable objectTable, IClientState clientState, IGameGui gameGui, IAetheryteList aetheryteList, ILogger<QuestFunctions> logger)
|
||||
{
|
||||
_questRegistry = questRegistry;
|
||||
_questData = questData;
|
||||
|
|
@ -78,6 +80,7 @@ internal sealed class QuestFunctions
|
|||
_aetheryteData = aetheryteData;
|
||||
_configuration = configuration;
|
||||
_dataManager = dataManager;
|
||||
_objectTable = objectTable;
|
||||
_clientState = clientState;
|
||||
_gameGui = gameGui;
|
||||
_aetheryteList = aetheryteList;
|
||||
|
|
@ -163,14 +166,14 @@ internal sealed class QuestFunctions
|
|||
}
|
||||
questReference = QuestReference.NoQuest(questReference.State);
|
||||
}
|
||||
byte currentLevel = _clientState.LocalPlayer?.Level ?? 0;
|
||||
byte currentLevel = _objectTable.LocalPlayer?.Level ?? 0;
|
||||
if (questReference.CurrentQuest != null)
|
||||
{
|
||||
Questionable.Model.Quest quest;
|
||||
bool flag = _questRegistry.TryGetQuest(questReference.CurrentQuest, out quest);
|
||||
bool flag2 = IsQuestAccepted(questReference.CurrentQuest);
|
||||
_logger.LogTrace("MSQ check: QuestId={QuestId}, InRegistry={InRegistry}, Level={QuestLevel}, CurrentLevel={CurrentLevel}, IsAccepted={IsAccepted}", questReference.CurrentQuest, flag, ((int?)quest?.Info.Level) ?? (-1), currentLevel, flag2);
|
||||
EClassJob valueOrDefault = ((EClassJob?)_clientState.LocalPlayer?.ClassJob.RowId).GetValueOrDefault();
|
||||
EClassJob valueOrDefault = ((EClassJob?)_objectTable.LocalPlayer?.ClassJob.RowId).GetValueOrDefault();
|
||||
if (valueOrDefault != EClassJob.Adventurer)
|
||||
{
|
||||
QuestInfo questInfo = (from x in _questData.GetClassJobQuests(valueOrDefault)
|
||||
|
|
@ -467,7 +470,7 @@ internal sealed class QuestFunctions
|
|||
return (QuestReference.NoQuest(MainScenarioQuestState.Unavailable), $"Not readdy to accept quest {questId.Value}");
|
||||
}
|
||||
_lastLoggedNotReadyQuest = null;
|
||||
if (!(_clientState.LocalPlayer?.Level).HasValue)
|
||||
if (!(_objectTable.LocalPlayer?.Level).HasValue)
|
||||
{
|
||||
_logger.LogTrace("GetMainScenarioQuest: In loading screen");
|
||||
return (QuestReference.NoQuest(MainScenarioQuestState.LoadingScreen), "In loading screen");
|
||||
|
|
@ -492,7 +495,7 @@ internal sealed class QuestFunctions
|
|||
|
||||
private unsafe bool IsOnAlliedSocietyMount()
|
||||
{
|
||||
BattleChara* ptr = (BattleChara*)(_clientState.LocalPlayer?.Address ?? 0);
|
||||
BattleChara* ptr = (BattleChara*)(_objectTable.LocalPlayer?.Address ?? 0);
|
||||
if (ptr != null && ptr->Mount.MountId != 0)
|
||||
{
|
||||
return _alliedSocietyData.Mounts.ContainsKey(ptr->Mount.MountId);
|
||||
|
|
@ -639,7 +642,7 @@ internal sealed class QuestFunctions
|
|||
}
|
||||
if (!_configuration.Advanced.SkipClassJobQuests)
|
||||
{
|
||||
EClassJob valueOrDefault = ((EClassJob?)_clientState.LocalPlayer?.ClassJob.RowId).GetValueOrDefault();
|
||||
EClassJob valueOrDefault = ((EClassJob?)_objectTable.LocalPlayer?.ClassJob.RowId).GetValueOrDefault();
|
||||
uint[] shadowbringersRoleQuestChapters = QuestData.AllRoleQuestChapters.Select((IReadOnlyList<uint> x) => x[0]).ToArray();
|
||||
if (valueOrDefault != EClassJob.Adventurer)
|
||||
{
|
||||
|
|
@ -712,7 +715,7 @@ internal sealed class QuestFunctions
|
|||
}
|
||||
if (!ignoreLevel)
|
||||
{
|
||||
byte b = _clientState.LocalPlayer?.Level ?? 0;
|
||||
byte b = _objectTable.LocalPlayer?.Level ?? 0;
|
||||
if (b == 0)
|
||||
{
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue