using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.DependencyInjection; using PhoenixLib.Configuration; using PhoenixLib.Events; using PhoenixLib.ServiceBus.Extensions; using WingsAPI.Communication.Compliments; using WingsAPI.Communication.InstantBattle; using WingsAPI.Communication.Miniland; using WingsAPI.Communication.Player; using WingsAPI.Communication.Quests; using WingsAPI.Communication.Raid; using WingsAPI.Communication.ServerApi.Protocol; using WingsAPI.Communication.Translations; using WingsAPI.Plugins; using WingsEmu.Game.GameEvent; using WingsEmu.Game.GameEvent.Matchmaking; using WingsEmu.Game.GameEvent.Matchmaking.Matchmaker; using WingsEmu.Plugins.GameEvents.Configuration.InstantBattle; using WingsEmu.Plugins.GameEvents.Consumers; using WingsEmu.Plugins.GameEvents.Matchmaking.Matchmaker; using WingsEmu.Plugins.GameEvents.RecurrentJob; namespace WingsEmu.Plugins.GameEvents { public class GameEventsPluginCore : IGameServerPlugin { public string Name => nameof(GameEventsPluginCore); public void AddDependencies(IServiceCollection services, GameServerLoader gameServer) { services.AddEventHandlersInAssembly(); services.AddMessagePublisher(); services.AddMessageSubscriber(); services.AddMessageSubscriber(); services.AddMessageSubscriber(); services.AddMessageSubscriber(); services.AddMessageSubscriber(); services.AddMessageSubscriber(); services.AddMessageSubscriber(); services.AddMessagePublisher(); services.AddMessageSubscriber(); services.AddSingleton(); services.AddSingleton(); if (gameServer.Type != GameChannelType.ACT_4) { services.AddHostedService(); } services.AddConfigurationsFromDirectory("gameevents/instant_combats"); services.AddSingleton(s => new GlobalInstantBattleConfiguration { Configurations = s.GetRequiredService>().ToList() }); services.AddSingleton(s => new Matchmaking.Matchmaking(new Dictionary { [GameEventType.InstantBattle] = new InstantBattleMatchmaker(s.GetService()) })); } } }