mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #30 from silasary/cfpop
Refactor CfPop event to allow plugins to hook it more easily
This commit is contained in:
commit
a7baf08b52
4 changed files with 48 additions and 4 deletions
35
.github/workflows/main.yml
vendored
Normal file
35
.github/workflows/main.yml
vendored
Normal file
|
|
@ -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\Dalamud.sln /t:Build /p:Configuration=Release /p:DefineConstants=XL_NOAUTOUPDATE
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@master
|
||||||
|
with:
|
||||||
|
name: dalamud-artifact
|
||||||
|
path: bin\
|
||||||
|
|
@ -38,6 +38,7 @@ namespace Dalamud.DiscordBot {
|
||||||
|
|
||||||
this.socketClient = new DiscordSocketClient();
|
this.socketClient = new DiscordSocketClient();
|
||||||
this.socketClient.Ready += SocketClientOnReady;
|
this.socketClient.Ready += SocketClientOnReady;
|
||||||
|
this.dalamud.NetworkHandlers.ProcessCfPop += ProcessCfPop;
|
||||||
}
|
}
|
||||||
|
|
||||||
private XivChatType GetChatTypeBySlug(string slug) {
|
private XivChatType GetChatTypeBySlug(string slug) {
|
||||||
|
|
@ -103,6 +104,9 @@ namespace Dalamud.DiscordBot {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ProcessCfPop(JObject contentFinderCondition) {
|
public async Task ProcessCfPop(JObject contentFinderCondition) {
|
||||||
|
if (!this.IsConnected)
|
||||||
|
return;
|
||||||
|
|
||||||
var contentName = contentFinderCondition["Name"];
|
var contentName = contentFinderCondition["Name"];
|
||||||
|
|
||||||
if (this.config.CfNotificationChannel == null)
|
if (this.config.CfNotificationChannel == null)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||||
using Dalamud.Game.Network.MarketBoardUploaders;
|
using Dalamud.Game.Network.MarketBoardUploaders;
|
||||||
using Dalamud.Game.Network.Structures;
|
using Dalamud.Game.Network.Structures;
|
||||||
using Dalamud.Game.Network.Universalis.MarketBoardUploaders;
|
using Dalamud.Game.Network.Universalis.MarketBoardUploaders;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
namespace Dalamud.Game.Network {
|
namespace Dalamud.Game.Network {
|
||||||
|
|
@ -19,6 +20,9 @@ namespace Dalamud.Game.Network {
|
||||||
|
|
||||||
private byte[] lastPreferredRole;
|
private byte[] lastPreferredRole;
|
||||||
|
|
||||||
|
public delegate Task CfPop(JObject contentFinderCondition);
|
||||||
|
public event CfPop ProcessCfPop;
|
||||||
|
|
||||||
public NetworkHandlers(Dalamud dalamud, bool optOutMbUploads) {
|
public NetworkHandlers(Dalamud dalamud, bool optOutMbUploads) {
|
||||||
this.dalamud = dalamud;
|
this.dalamud = dalamud;
|
||||||
this.optOutMbUploads = optOutMbUploads;
|
this.optOutMbUploads = optOutMbUploads;
|
||||||
|
|
@ -26,6 +30,7 @@ namespace Dalamud.Game.Network {
|
||||||
this.uploader = new UniversalisMarketBoardUploader(dalamud);
|
this.uploader = new UniversalisMarketBoardUploader(dalamud);
|
||||||
|
|
||||||
dalamud.Framework.Network.OnZonePacket += OnZonePacket;
|
dalamud.Framework.Network.OnZonePacket += OnZonePacket;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnZonePacket(IntPtr dataPtr) {
|
private void OnZonePacket(IntPtr dataPtr) {
|
||||||
|
|
@ -48,8 +53,8 @@ namespace Dalamud.Game.Network {
|
||||||
|
|
||||||
this.dalamud.Framework.Gui.Chat.Print($"Duty pop: " + contentFinderCondition["Name"]);
|
this.dalamud.Framework.Gui.Chat.Print($"Duty pop: " + contentFinderCondition["Name"]);
|
||||||
|
|
||||||
if (this.dalamud.BotManager.IsConnected)
|
await this.ProcessCfPop?.Invoke(contentFinderCondition);
|
||||||
await this.dalamud.BotManager.ProcessCfPop(contentFinderCondition);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Dalamud
|
# Dalamud [](https://github.com/goaaats/Dalamud/actions)
|
||||||
|
|
||||||
FFXIV Hooking framework for [FFXIVQuickLauncher](https://github.com/goaaats/FFXIVQuickLauncher).
|
FFXIV Hooking framework for [FFXIVQuickLauncher](https://github.com/goaaats/FFXIVQuickLauncher).
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue