fix things
This commit is contained in:
parent
8062c4c4ff
commit
ef35c59d13
@ -18,6 +18,7 @@ public class ConfigurationManager
|
|||||||
public bool AutoShareMsq { get; set; } = false;
|
public bool AutoShareMsq { get; set; } = false;
|
||||||
public bool AutoShareNewQuests { get; set; } = false;
|
public bool AutoShareNewQuests { get; set; } = false;
|
||||||
public bool BroadcastToParty { get; set; } = false;
|
public bool BroadcastToParty { get; set; } = false;
|
||||||
|
public bool TrackMSQ { get; set; } = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Configuration Instance { get; private set; } = new Configuration();
|
public Configuration Instance { get; private set; } = new Configuration();
|
||||||
|
|||||||
@ -2,6 +2,7 @@ using Dalamud.Game.Text.SeStringHandling.Payloads;
|
|||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||||
using Lumina.Excel;
|
using Lumina.Excel;
|
||||||
using Lumina.Excel.Sheets;
|
using Lumina.Excel.Sheets;
|
||||||
using Lumina.Extensions;
|
using Lumina.Extensions;
|
||||||
@ -69,8 +70,43 @@ namespace QuestShare.Common
|
|||||||
SharedCache.Clear();
|
SharedCache.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public unsafe static bool TrackMsq()
|
||||||
|
{
|
||||||
|
if (ShareService.IsMsqTracking && ShareService.IsHost)
|
||||||
|
{
|
||||||
|
var questId = (uint)AgentScenarioTree.Instance()->Data->CurrentScenarioQuest;
|
||||||
|
if (questId == 0) return false;
|
||||||
|
else questId += 0x10000U;
|
||||||
|
if (GetActiveQuest() != null && GetActiveQuest()?.QuestId == questId) return false;
|
||||||
|
if (SheetManager.QuestSheet.TryGetRow(questId, out var row))
|
||||||
|
{
|
||||||
|
if (row.RowId == 0) return false;
|
||||||
|
var quest = GetQuestById(questId);
|
||||||
|
if (GameQuests.Contains(quest) && GetActiveQuest()?.QuestId != questId)
|
||||||
|
{
|
||||||
|
SetActiveFlag(questId);
|
||||||
|
SocketClientService.DispatchUpdate(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GameQuests.Add(quest);
|
||||||
|
SetActiveFlag(questId);
|
||||||
|
SocketClientService.DispatchUpdate(false);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.Debug($"Quest {questId} not found in QuestSheet");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static void OnFrameworkUpdate(IFramework framework)
|
private static void OnFrameworkUpdate(IFramework framework)
|
||||||
{
|
{
|
||||||
|
if (ClientState.LocalContentId == 0) return;
|
||||||
|
TrackMsq();
|
||||||
var q = GetActiveQuest();
|
var q = GetActiveQuest();
|
||||||
if (q != null && q.QuestId == LastQuestId)
|
if (q != null && q.QuestId == LastQuestId)
|
||||||
{
|
{
|
||||||
@ -84,6 +120,12 @@ namespace QuestShare.Common
|
|||||||
// check for next quest in the chain
|
// check for next quest in the chain
|
||||||
if (q.QuestData.PreviousQuest.TryGetFirst(out var prevQuest))
|
if (q.QuestData.PreviousQuest.TryGetFirst(out var prevQuest))
|
||||||
{
|
{
|
||||||
|
if (prevQuest.RowId == 0 || !prevQuest.IsValid)
|
||||||
|
{
|
||||||
|
Log.Debug("No previous quest in chain");
|
||||||
|
GameQuests.Remove(q);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Log.Debug($"Previous quest in chain was {prevQuest.RowId}");
|
Log.Debug($"Previous quest in chain was {prevQuest.RowId}");
|
||||||
var nextQuest = SheetManager.QuestSheet.FirstOrDefault(qu => prevQuest.Value.RowId == q.QuestId);
|
var nextQuest = SheetManager.QuestSheet.FirstOrDefault(qu => prevQuest.Value.RowId == q.QuestId);
|
||||||
if (nextQuest.RowId != 0)
|
if (nextQuest.RowId != 0)
|
||||||
@ -136,6 +178,7 @@ namespace QuestShare.Common
|
|||||||
|
|
||||||
public static void SetActiveFlag(uint questId)
|
public static void SetActiveFlag(uint questId)
|
||||||
{
|
{
|
||||||
|
Log.Debug($"Setting active quest to {questId}");
|
||||||
var quest = GameQuests.FirstOrDefault(q => q.QuestId == questId);
|
var quest = GameQuests.FirstOrDefault(q => q.QuestId == questId);
|
||||||
if (quest != null)
|
if (quest != null)
|
||||||
{
|
{
|
||||||
@ -188,7 +231,7 @@ namespace QuestShare.Common
|
|||||||
public MapLinkPayload GetMapLink(byte step)
|
public MapLinkPayload GetMapLink(byte step)
|
||||||
{
|
{
|
||||||
var toDoData = QuestData.TodoParams.Select(t => t.ToDoLocation).ToList();
|
var toDoData = QuestData.TodoParams.Select(t => t.ToDoLocation).ToList();
|
||||||
var data = toDoData.ElementAt(step).FirstOrDefault();
|
var data = toDoData.ElementAt(step == 0xFF ? QuestSteps.Count-1 : step).FirstOrDefault();
|
||||||
var coords = MapUtil.WorldToMap(new Vector3(data.Value.X, data.Value.Y, data.Value.Z), data.Value.Map.Value.OffsetX, data.Value.Map.Value.OffsetY, 0, data.Value.Map.Value.SizeFactor);
|
var coords = MapUtil.WorldToMap(new Vector3(data.Value.X, data.Value.Y, data.Value.Z), data.Value.Map.Value.OffsetX, data.Value.Map.Value.OffsetY, 0, data.Value.Map.Value.SizeFactor);
|
||||||
var mapLink = new MapLinkPayload(data.Value.Territory.Value.RowId, data.Value.Map.Value.RowId, coords.X, coords.Y);
|
var mapLink = new MapLinkPayload(data.Value.Territory.Value.RowId, data.Value.Map.Value.RowId, coords.X, coords.Y);
|
||||||
return mapLink;
|
return mapLink;
|
||||||
|
|||||||
@ -18,6 +18,7 @@ namespace QuestShare.Services
|
|||||||
internal static bool IsGrouped { get; set; } = false;
|
internal static bool IsGrouped { get; set; } = false;
|
||||||
internal static bool IsHost { get; set; } = false;
|
internal static bool IsHost { get; set; } = false;
|
||||||
internal static bool IsRegistered { get; set; } = false;
|
internal static bool IsRegistered { get; set; } = false;
|
||||||
|
internal static bool IsMsqTracking { get; set; } = false;
|
||||||
internal static string ShareCode { get; private set; } = "";
|
internal static string ShareCode { get; private set; } = "";
|
||||||
internal static string HostedShareCode { get; private set; } = "";
|
internal static string HostedShareCode { get; private set; } = "";
|
||||||
internal static string Token { get; set; } = "";
|
internal static string Token { get; set; } = "";
|
||||||
|
|||||||
@ -120,7 +120,7 @@ namespace QuestShare.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Disconnect()
|
public static async Task Disconnect()
|
||||||
{
|
{
|
||||||
IsDisposing = true;
|
IsDisposing = true;
|
||||||
await connection.StopAsync();
|
await connection.StopAsync();
|
||||||
@ -307,6 +307,8 @@ namespace QuestShare.Services
|
|||||||
ShareService.IsHost = false;
|
ShareService.IsHost = false;
|
||||||
ShareService.ActiveQuestId = 0;
|
ShareService.ActiveQuestId = 0;
|
||||||
ShareService.ActiveQuestStep = 0;
|
ShareService.ActiveQuestStep = 0;
|
||||||
|
Plugin.Configuration.Instance.LastShareCode = "";
|
||||||
|
ShareService.SetShareCode("");
|
||||||
OnUngroupEvent.Invoke(this, new SocketEventArgs { Success = true });
|
OnUngroupEvent.Invoke(this, new SocketEventArgs { Success = true });
|
||||||
Log.Debug("Left group");
|
Log.Debug("Left group");
|
||||||
}
|
}
|
||||||
@ -337,6 +339,7 @@ namespace QuestShare.Services
|
|||||||
ShareService.IsHost = false;
|
ShareService.IsHost = false;
|
||||||
ShareService.IsGrouped = true;
|
ShareService.IsGrouped = true;
|
||||||
ShareService.SetActiveQuest(response.SharedQuestId, response.SharedQuestStep);
|
ShareService.SetActiveQuest(response.SharedQuestId, response.SharedQuestStep);
|
||||||
|
ShareService.SetShareCode(response.ShareCode);
|
||||||
}
|
}
|
||||||
OnGetEvent.Invoke(this, new SocketEventArgs { Success = true });
|
OnGetEvent.Invoke(this, new SocketEventArgs { Success = true });
|
||||||
Log.Debug($"Resumed share: {response.ShareCode}");
|
Log.Debug($"Resumed share: {response.ShareCode}");
|
||||||
|
|||||||
@ -25,9 +25,6 @@ public class MainWindow : Window, IDisposable
|
|||||||
|
|
||||||
public override void OnOpen()
|
public override void OnOpen()
|
||||||
{
|
{
|
||||||
var questId = 69286;
|
|
||||||
// find the quest by id
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() { }
|
public void Dispose() { }
|
||||||
@ -64,7 +61,7 @@ public class MainWindow : Window, IDisposable
|
|||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
if (ImGui.Button("Disconnect"))
|
if (ImGui.Button("Disconnect"))
|
||||||
{
|
{
|
||||||
SocketClientService.connection.StopAsync().ConfigureAwait(false);
|
SocketClientService.Disconnect().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
// ImGui.SameLine();
|
// ImGui.SameLine();
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
@ -75,14 +72,17 @@ public class MainWindow : Window, IDisposable
|
|||||||
}
|
}
|
||||||
isConnecting = false;
|
isConnecting = false;
|
||||||
ImGui.TextUnformatted("Share Mode:");
|
ImGui.TextUnformatted("Share Mode:");
|
||||||
ImGui.BeginDisabled(ShareService.IsHost || ShareService.IsGrouped || ShareService.IsRegistered);
|
// ImGui.BeginDisabled(ShareService.IsHost || ShareService.IsGrouped || ShareService.IsRegistered);
|
||||||
if (ShareService.IsHost && SocketClientService.IsConnected)
|
/*if (ShareService.IsHost && SocketClientService.IsConnected)
|
||||||
{
|
{
|
||||||
shareMode = ShareMode.Host;
|
shareMode = ShareMode.Host;
|
||||||
} else if (ShareService.IsGrouped && SocketClientService.IsConnected)
|
} else if (ShareService.IsGrouped && SocketClientService.IsConnected)
|
||||||
{
|
{
|
||||||
shareMode = ShareMode.Member;
|
shareMode = ShareMode.Member;
|
||||||
}
|
} else if (SocketClientService.IsConnected)
|
||||||
|
{
|
||||||
|
shareMode = ShareMode.None;
|
||||||
|
} */ // TODO: Fix this
|
||||||
if (ImGui.RadioButton("Host", shareMode == ShareMode.Host))
|
if (ImGui.RadioButton("Host", shareMode == ShareMode.Host))
|
||||||
{
|
{
|
||||||
shareMode = ShareMode.Host;
|
shareMode = ShareMode.Host;
|
||||||
@ -96,7 +96,7 @@ public class MainWindow : Window, IDisposable
|
|||||||
Plugin.Configuration.Instance.LastShareMode = ShareMode.Member;
|
Plugin.Configuration.Instance.LastShareMode = ShareMode.Member;
|
||||||
Plugin.Configuration.Save();
|
Plugin.Configuration.Save();
|
||||||
}
|
}
|
||||||
ImGui.EndDisabled();
|
// ImGui.EndDisabled();
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
if (shareMode == ShareMode.Host)
|
if (shareMode == ShareMode.Host)
|
||||||
{
|
{
|
||||||
@ -137,6 +137,7 @@ public class MainWindow : Window, IDisposable
|
|||||||
}
|
}
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
ImGui.BeginDisabled(ShareService.IsMsqTracking);
|
||||||
using (var combo = ImRaii.Combo("##Quests", GameQuestManager.GetActiveQuest()?.QuestName ?? "---SELECT---", ImGuiComboFlags.HeightRegular))
|
using (var combo = ImRaii.Combo("##Quests", GameQuestManager.GetActiveQuest()?.QuestName ?? "---SELECT---", ImGuiComboFlags.HeightRegular))
|
||||||
{
|
{
|
||||||
if (combo)
|
if (combo)
|
||||||
@ -157,13 +158,22 @@ public class MainWindow : Window, IDisposable
|
|||||||
{
|
{
|
||||||
GameQuestManager.LoadQuests();
|
GameQuestManager.LoadQuests();
|
||||||
}
|
}
|
||||||
|
ImGui.EndDisabled();
|
||||||
|
ImGui.SameLine();
|
||||||
|
var track = Plugin.Configuration.Instance.TrackMSQ;
|
||||||
|
if (ImGui.Checkbox("Track MSQ", ref track))
|
||||||
|
{
|
||||||
|
Plugin.Configuration.Instance.TrackMSQ = track;
|
||||||
|
ShareService.IsMsqTracking = track;
|
||||||
|
Plugin.Configuration.Save();
|
||||||
|
}
|
||||||
if (selectedQuest == null && GameQuestManager.GetActiveQuest() == null)
|
if (selectedQuest == null && GameQuestManager.GetActiveQuest() == null)
|
||||||
{
|
{
|
||||||
ImGui.TextUnformatted("No quest selected.");
|
ImGui.TextUnformatted("No quest selected.");
|
||||||
return;
|
return;
|
||||||
} else if (GameQuestManager.GetActiveQuest() != null)
|
} else if (GameQuestManager.GetActiveQuest() != null)
|
||||||
{
|
{
|
||||||
selectedQuest = selectedQuest ?? GameQuestManager.GetActiveQuest();
|
selectedQuest = GameQuestManager.GetActiveQuest();
|
||||||
}
|
}
|
||||||
ImGui.TextUnformatted("Active Quest:");
|
ImGui.TextUnformatted("Active Quest:");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|||||||
@ -12,17 +12,17 @@
|
|||||||
],
|
],
|
||||||
"RepoUrl": "https://git.nathanc.tech/nate/QuestShare/",
|
"RepoUrl": "https://git.nathanc.tech/nate/QuestShare/",
|
||||||
"AcceptsFeedback": false,
|
"AcceptsFeedback": false,
|
||||||
"DownloadLinkInstall": "https://git.nathanc.tech/nate/QuestShare/releases/download/alpha-2/latest.zip",
|
"DownloadLinkInstall": "https://git.nathanc.tech/nate/QuestShare/releases/download/alpha-3/latest.zip",
|
||||||
"DownloadLinkTesting": "https://git.nathanc.tech/nate/QuestShare/releases/download/alpha-2/latest.zip",
|
"DownloadLinkTesting": "https://git.nathanc.tech/nate/QuestShare/releases/download/alpha-3/latest.zip",
|
||||||
"DownloadLinkUpdate": "https://git.nathanc.tech/nate/QuestShare/releases/download/alpha-2/latest.zip",
|
"DownloadLinkUpdate": "https://git.nathanc.tech/nate/QuestShare/releases/download/alpha-3/latest.zip",
|
||||||
"DownloadCount": 1,
|
"DownloadCount": 1,
|
||||||
"LastUpdate": "1739848999",
|
"LastUpdate": "1739849999",
|
||||||
"IsHide": false,
|
"IsHide": false,
|
||||||
"IsTestingExclusive": false,
|
"IsTestingExclusive": false,
|
||||||
"IconUrl": "",
|
"IconUrl": "",
|
||||||
"DalamudApiLevel": 11,
|
"DalamudApiLevel": 11,
|
||||||
"InternalName": "QuestShare",
|
"InternalName": "QuestShare",
|
||||||
"AssemblyVersion": "1.0.0.4"
|
"AssemblyVersion": "1.0.0.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user