mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-07-01 01:20:49 -05:00
update live radar plugin to IPluginV2
This commit is contained in:
38
Plugins/LiveRadar/Events/LiveRadarEvent.cs
Normal file
38
Plugins/LiveRadar/Events/LiveRadarEvent.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using SharedLibraryCore.Events.Game;
|
||||
using EventGeneratorCallback = System.ValueTuple<string, string,
|
||||
System.Func<string, SharedLibraryCore.Interfaces.IEventParserConfiguration,
|
||||
SharedLibraryCore.GameEvent,
|
||||
SharedLibraryCore.GameEvent>>;
|
||||
|
||||
namespace IW4MAdmin.Plugins.LiveRadar.Events;
|
||||
|
||||
public class Script : IRegisterEvent
|
||||
{
|
||||
private const string EventLiveRadar = "LiveRadar";
|
||||
|
||||
private EventGeneratorCallback LiveRadar()
|
||||
{
|
||||
return (EventLiveRadar, EventLiveRadar, (eventLine, _, _) =>
|
||||
{
|
||||
var radarEvent = new LiveRadarEvent
|
||||
{
|
||||
Type = GameEvent.EventType.Other,
|
||||
Subtype = EventLiveRadar,
|
||||
Origin = new EFClient { NetworkId = 0 },
|
||||
ScriptData = eventLine
|
||||
};
|
||||
return radarEvent;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public IEnumerable<EventGeneratorCallback> Events => new[] { LiveRadar() };
|
||||
}
|
||||
|
||||
public class LiveRadarEvent : GameScriptEvent
|
||||
{
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using EventGeneratorCallback = System.ValueTuple<string, string,
|
||||
System.Func<string, SharedLibraryCore.Interfaces.IEventParserConfiguration,
|
||||
SharedLibraryCore.GameEvent,
|
||||
SharedLibraryCore.GameEvent>>;
|
||||
|
||||
namespace LiveRadar.Events
|
||||
{
|
||||
public class Script : IRegisterEvent
|
||||
{
|
||||
private const string EVENT_LIVERADAR = "LiveRadar";
|
||||
private EventGeneratorCallback LiveRadar()
|
||||
{
|
||||
return (EVENT_LIVERADAR, EVENT_LIVERADAR, (string eventLine, IEventParserConfiguration config, GameEvent autoEvent) =>
|
||||
{
|
||||
string[] lineSplit = eventLine.Split(";");
|
||||
|
||||
autoEvent.Type = GameEvent.EventType.Other;
|
||||
autoEvent.Subtype = EVENT_LIVERADAR;
|
||||
autoEvent.Origin = new EFClient() { NetworkId = 0 };
|
||||
autoEvent.Extra = lineSplit[1]; // guid
|
||||
|
||||
return autoEvent;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public IEnumerable<EventGeneratorCallback> Events => new[] { LiveRadar() };
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user