muffin v7.38.6
This commit is contained in:
parent
ac85eea230
commit
317800fb39
4 changed files with 894 additions and 609 deletions
|
|
@ -151,6 +151,10 @@ internal sealed class QuestionableIpc : IDisposable
|
|||
|
||||
private const string IpcGetAlliedSocietiesWithAvailableQuests = "Questionable.AlliedSociety.GetSocietiesWithAvailableQuests";
|
||||
|
||||
private const string IpcAddAlliedSocietyOptimalQuests = "Questionable.AlliedSociety.AddOptimalQuests";
|
||||
|
||||
private const string IpcGetAlliedSocietyOptimalQuests = "Questionable.AlliedSociety.GetOptimalQuests";
|
||||
|
||||
private readonly QuestController _questController;
|
||||
|
||||
private readonly QuestRegistry _questRegistry;
|
||||
|
|
@ -269,6 +273,10 @@ internal sealed class QuestionableIpc : IDisposable
|
|||
|
||||
private readonly ICallGateProvider<List<byte>> _getAlliedSocietiesWithAvailableQuests;
|
||||
|
||||
private readonly ICallGateProvider<byte, int> _addAlliedSocietyOptimalQuests;
|
||||
|
||||
private readonly ICallGateProvider<byte, List<string>> _getAlliedSocietyOptimalQuests;
|
||||
|
||||
public QuestionableIpc(QuestController questController, EventInfoComponent eventInfoComponent, QuestRegistry questRegistry, QuestFunctions questFunctions, QuestData questData, ManualPriorityComponent manualPriorityComponent, PresetBuilderComponent presetBuilderComponent, Configuration configuration, IDalamudPluginInterface pluginInterface, IServiceProvider serviceProvider)
|
||||
{
|
||||
QuestionableIpc questionableIpc = this;
|
||||
|
|
@ -382,6 +390,10 @@ internal sealed class QuestionableIpc : IDisposable
|
|||
_getAlliedSocietyCurrentRank.RegisterFunc(GetAlliedSocietyCurrentRank);
|
||||
_getAlliedSocietiesWithAvailableQuests = pluginInterface.GetIpcProvider<List<byte>>("Questionable.AlliedSociety.GetSocietiesWithAvailableQuests");
|
||||
_getAlliedSocietiesWithAvailableQuests.RegisterFunc(GetAlliedSocietiesWithAvailableQuests);
|
||||
_addAlliedSocietyOptimalQuests = pluginInterface.GetIpcProvider<byte, int>("Questionable.AlliedSociety.AddOptimalQuests");
|
||||
_addAlliedSocietyOptimalQuests.RegisterFunc(AddAlliedSocietyOptimalQuests);
|
||||
_getAlliedSocietyOptimalQuests = pluginInterface.GetIpcProvider<byte, List<string>>("Questionable.AlliedSociety.GetOptimalQuests");
|
||||
_getAlliedSocietyOptimalQuests.RegisterFunc(GetAlliedSocietyOptimalQuests);
|
||||
}
|
||||
|
||||
private bool StartQuest(string questId, bool single)
|
||||
|
|
@ -1026,9 +1038,16 @@ internal sealed class QuestionableIpc : IDisposable
|
|||
{
|
||||
return false;
|
||||
}
|
||||
byte num = (byte)(ptr->BeastReputation[alliedSocietyId - 1].Rank & 0x7F);
|
||||
byte b = (byte)((alliedSocietyId <= 5) ? 8 : 3);
|
||||
return num >= b;
|
||||
byte b = (byte)(ptr->BeastReputation[alliedSocietyId - 1].Rank & 0x7F);
|
||||
return b >= (EAlliedSociety)alliedSocietyId switch
|
||||
{
|
||||
EAlliedSociety.Amaljaa => 3,
|
||||
EAlliedSociety.Sylphs => 3,
|
||||
EAlliedSociety.Kobolds => 3,
|
||||
EAlliedSociety.Sahagin => 3,
|
||||
EAlliedSociety.Ixal => 7,
|
||||
_ => 8,
|
||||
};
|
||||
}
|
||||
|
||||
private unsafe int GetAlliedSocietyCurrentRank(byte alliedSocietyId)
|
||||
|
|
@ -1060,6 +1079,71 @@ internal sealed class QuestionableIpc : IDisposable
|
|||
return list;
|
||||
}
|
||||
|
||||
private int AddAlliedSocietyOptimalQuests(byte alliedSocietyId)
|
||||
{
|
||||
if (!Enum.IsDefined(typeof(EAlliedSociety), alliedSocietyId) || alliedSocietyId == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EAlliedSociety eAlliedSociety = (EAlliedSociety)alliedSocietyId;
|
||||
List<QuestId> availableAlliedSocietyQuests = _serviceProvider.GetRequiredService<AlliedSocietyQuestFunctions>().GetAvailableAlliedSocietyQuests(eAlliedSociety);
|
||||
if (availableAlliedSocietyQuests.Count == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Quest quest;
|
||||
List<QuestInfo> list = (from QuestInfo questInfo in availableAlliedSocietyQuests.Select((QuestId questId) => _questData.GetQuestInfo(questId))
|
||||
where _questRegistry.TryGetQuest(questInfo.QuestId, out quest) && !quest.Root.Disabled
|
||||
where !_questController.ManualPriorityQuests.Any((Quest pq) => pq.Id.Equals(questInfo.QuestId))
|
||||
orderby questInfo.AlliedSocietyRank descending
|
||||
select questInfo).ToList();
|
||||
if (list.Count == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int val = (((int)eAlliedSociety <= 5) ? 12 : 3);
|
||||
int alliedSocietyRemainingAllowances = GetAlliedSocietyRemainingAllowances();
|
||||
int count = Math.Min(Math.Min(val, alliedSocietyRemainingAllowances), list.Count);
|
||||
int num = 0;
|
||||
foreach (QuestInfo item in list.Take(count))
|
||||
{
|
||||
if (_questController.AddQuestPriority(item.QuestId))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private List<string> GetAlliedSocietyOptimalQuests(byte alliedSocietyId)
|
||||
{
|
||||
if (!Enum.IsDefined(typeof(EAlliedSociety), alliedSocietyId) || alliedSocietyId == 0)
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
EAlliedSociety eAlliedSociety = (EAlliedSociety)alliedSocietyId;
|
||||
List<QuestId> availableAlliedSocietyQuests = _serviceProvider.GetRequiredService<AlliedSocietyQuestFunctions>().GetAvailableAlliedSocietyQuests(eAlliedSociety);
|
||||
if (availableAlliedSocietyQuests.Count == 0)
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
Quest quest;
|
||||
List<QuestInfo> list = (from QuestInfo questInfo in availableAlliedSocietyQuests.Select((QuestId questId) => _questData.GetQuestInfo(questId))
|
||||
where _questRegistry.TryGetQuest(questInfo.QuestId, out quest) && !quest.Root.Disabled
|
||||
where !_questController.ManualPriorityQuests.Any((Quest pq) => pq.Id.Equals(questInfo.QuestId))
|
||||
orderby questInfo.AlliedSocietyRank descending
|
||||
select questInfo).ToList();
|
||||
if (list.Count == 0)
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
int val = (((int)eAlliedSociety <= 5) ? 12 : 3);
|
||||
int alliedSocietyRemainingAllowances = GetAlliedSocietyRemainingAllowances();
|
||||
int count = Math.Min(Math.Min(val, alliedSocietyRemainingAllowances), list.Count);
|
||||
return (from q in list.Take(count)
|
||||
select q.QuestId.ToString()).ToList();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_exportQuestPriority.UnregisterFunc();
|
||||
|
|
@ -1112,5 +1196,7 @@ internal sealed class QuestionableIpc : IDisposable
|
|||
_getAlliedSocietyAvailableQuestIds.UnregisterFunc();
|
||||
_getAlliedSocietyTimeUntilReset.UnregisterFunc();
|
||||
_getAlliedSocietyRemainingAllowances.UnregisterFunc();
|
||||
_addAlliedSocietyOptimalQuests.UnregisterFunc();
|
||||
_getAlliedSocietyOptimalQuests.UnregisterFunc();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue