68 lines
2.3 KiB
C#

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 IW4MAdmin.Plugins.ClanTagRankCommands.Events
{
public class Script : IRegisterEvent
{
private const string EVENT_RC = "RC";
/// <summary>
/// this is a custom event printed out by _clientids.gsc (used for recording highest personal round records)
/// </summary>
/// <returns></returns>
private EventGeneratorCallback RC()
{
return (EVENT_RC, EVENT_RC, (string eventLine, IEventParserConfiguration config, GameEvent autoEvent) =>
{
string[] lineSplit = eventLine.Split(";");
long originId = lineSplit[1].ConvertGuidToLong(config.GuidNumberStyle, 1);
autoEvent.Type = GameEvent.EventType.Other;
autoEvent.Origin = new EFClient() { NetworkId = originId };
autoEvent.RequiredEntity = GameEvent.EventRequiredEntity.Origin;
autoEvent.GameTime = autoEvent.GameTime;
autoEvent.Subtype = EVENT_RC;
return autoEvent;
}
);
}
//private const string EVENT_RoundNumber = "RoundNumber";
///// <summary>
///// this is a custom event printed out by _clientids.gsc (used for recording highest server round records)
///// </summary>
///// <returns></returns>
//private EventGeneratorCallback RoundNumber()
//{
// return (EVENT_RoundNumber, EVENT_RoundNumber, (string eventLine, IEventParserConfiguration config, GameEvent autoEvent) =>
// {
// string[] lineSplit = eventLine.Split(";");
// autoEvent.Type = GameEvent.EventType.RoundNumber;
// autoEvent.Origin = Utilities.IW4MAdminClient();
// autoEvent.GameTime = autoEvent.GameTime;
// return autoEvent;
// }
// );
//}
public IEnumerable<EventGeneratorCallback> Events =>
new[]
{
RC(),
};
}
}