Merge branch 'interface' of github.com:goaaats/Dalamud into interface

This commit is contained in:
goat 2020-01-30 20:10:19 +09:00
commit 829f9fb0cb
4 changed files with 48 additions and 4 deletions

View file

@ -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)

View file

@ -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;