From 6132027c886d978769b702c8236f66ed179acb8d Mon Sep 17 00:00:00 2001 From: goaaats <16760685+goaaats@users.noreply.github.com> Date: Mon, 13 Jan 2020 01:47:02 +0900 Subject: [PATCH 1/4] ci: build and artifacts --- .github/workflows/main.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..3f371e390 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +name: Build Dalamud +on: [push] + +jobs: + build: + name: Build on Windows + runs-on: windows-2019 + steps: + - uses: actions/checkout@v1 + - name: Initialize Submodules + run: git submodule update --init --recursive + - name: Setup Nuget + uses: nuget/setup-nuget@v1 + with: + nuget-version: 'latest' + - name: Restore Nuget Packages + run: nuget restore Dalamud.sln + - name: Define VERSION + run: | + $env:COMMIT = $env:GITHUB_SHA.Substring(0, 7) + $env:REPO_NAME = $env:GITHUB_REPOSITORY -replace '.*/' + $env:BRANCH = $env:GITHUB_REF -replace '.*/' + + ($env:REPO_NAME) >> VERSION + ($env:BRANCH) >> VERSION + ($env:COMMIT) >> VERSION + - name: Build DotNet4 + run: | + cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\" + .\MSBuild.exe $Env:GITHUB_WORKSPACE\XIVLauncher.sln /t:Build /p:Configuration=Release /p:DefineConstants=XL_NOAUTOUPDATE + - name: Upload artifact + uses: actions/upload-artifact@master + with: + name: dalamud-artifact + path: bin\ From 93b94038d8f1ce6d9057ce69b79b9bfb4fbb22ee Mon Sep 17 00:00:00 2001 From: goaaats <16760685+goaaats@users.noreply.github.com> Date: Mon, 13 Jan 2020 02:59:15 +0900 Subject: [PATCH 2/4] ci: fix sln file name --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3f371e390..f36c27185 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: - name: Build DotNet4 run: | cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\" - .\MSBuild.exe $Env:GITHUB_WORKSPACE\XIVLauncher.sln /t:Build /p:Configuration=Release /p:DefineConstants=XL_NOAUTOUPDATE + .\MSBuild.exe $Env:GITHUB_WORKSPACE\Dalamud.sln /t:Build /p:Configuration=Release /p:DefineConstants=XL_NOAUTOUPDATE - name: Upload artifact uses: actions/upload-artifact@master with: From c41f3cee34403609b6e90cdc09d74dbb6643308b Mon Sep 17 00:00:00 2001 From: goaaats <16760685+goaaats@users.noreply.github.com> Date: Mon, 13 Jan 2020 03:25:26 +0900 Subject: [PATCH 3/4] doc: add workflow badge --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 71c0ab4d6..238b38994 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# Dalamud +# Dalamud [![Actions Status](https://github.com/goaaats/Dalamud/workflows/Build%20Dalamud/badge.svg)](https://github.com/goaaats/Dalamud/actions) FFXIV Hooking framework for [FFXIVQuickLauncher](https://github.com/goaaats/FFXIVQuickLauncher). -Thanks to Mino, whose work has made this possible! \ No newline at end of file +Thanks to Mino, whose work has made this possible! From ea9acd3aea17fa36c4f7855b7eb1e677220040ab Mon Sep 17 00:00:00 2001 From: Katelyn Gigante Date: Thu, 30 Jan 2020 17:16:06 +1100 Subject: [PATCH 4/4] Refactor CfPop event to allow plugins to hook it --- Dalamud/DiscordBot/DiscordBotManager.cs | 4 ++++ Dalamud/Game/Network/NetworkHandlers.cs | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Dalamud/DiscordBot/DiscordBotManager.cs b/Dalamud/DiscordBot/DiscordBotManager.cs index fdf1a945f..5371e6db5 100644 --- a/Dalamud/DiscordBot/DiscordBotManager.cs +++ b/Dalamud/DiscordBot/DiscordBotManager.cs @@ -38,6 +38,7 @@ namespace Dalamud.DiscordBot { this.socketClient = new DiscordSocketClient(); this.socketClient.Ready += SocketClientOnReady; + this.dalamud.NetworkHandlers.ProcessCfPop += ProcessCfPop; } private XivChatType GetChatTypeBySlug(string slug) { @@ -103,6 +104,9 @@ namespace Dalamud.DiscordBot { } public async Task ProcessCfPop(JObject contentFinderCondition) { + if (!this.IsConnected) + return; + var contentName = contentFinderCondition["Name"]; if (this.config.CfNotificationChannel == null) diff --git a/Dalamud/Game/Network/NetworkHandlers.cs b/Dalamud/Game/Network/NetworkHandlers.cs index 4613e03de..752e92e0a 100644 --- a/Dalamud/Game/Network/NetworkHandlers.cs +++ b/Dalamud/Game/Network/NetworkHandlers.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Dalamud.Game.Network.MarketBoardUploaders; using Dalamud.Game.Network.Structures; using Dalamud.Game.Network.Universalis.MarketBoardUploaders; +using Newtonsoft.Json.Linq; using Serilog; namespace Dalamud.Game.Network { @@ -19,6 +20,9 @@ namespace Dalamud.Game.Network { private byte[] lastPreferredRole; + public delegate Task CfPop(JObject contentFinderCondition); + public event CfPop ProcessCfPop; + public NetworkHandlers(Dalamud dalamud, bool optOutMbUploads) { this.dalamud = dalamud; this.optOutMbUploads = optOutMbUploads; @@ -26,6 +30,7 @@ namespace Dalamud.Game.Network { this.uploader = new UniversalisMarketBoardUploader(dalamud); dalamud.Framework.Network.OnZonePacket += OnZonePacket; + } private void OnZonePacket(IntPtr dataPtr) { @@ -48,8 +53,8 @@ namespace Dalamud.Game.Network { this.dalamud.Framework.Gui.Chat.Print($"Duty pop: " + contentFinderCondition["Name"]); - if (this.dalamud.BotManager.IsConnected) - await this.dalamud.BotManager.ProcessCfPop(contentFinderCondition); + await this.ProcessCfPop?.Invoke(contentFinderCondition); + }); return;