increased max events for event api to 100

added GameInfo to EventInfo class
make sure score gets updated properly after authentication
This commit is contained in:
RaidMax 2018-07-30 19:31:00 -05:00
parent f40bcce44f
commit 4ec16d3aa2
7 changed files with 6421 additions and 18 deletions

View File

@ -10,7 +10,7 @@ namespace IW4MAdmin.Application.API
{
class EventApi : IEventApi
{
private const int MaxEvents = 32;
private const int MaxEvents = 100;
private Queue<EventInfo> RecentEvents = new Queue<EventInfo>();
public IEnumerable<EventInfo> GetEvents(bool shouldConsume)
@ -35,6 +35,11 @@ namespace IW4MAdmin.Application.API
var apiEvent = new EventInfo()
{
ExtraInfo = E.Extra?.ToString() ?? E.Data,
GameInfo = new EntityInfo()
{
Name = E.Owner.GameName.ToString(),
Id = (int)E.Owner.GameName
},
OwnerEntity = new EntityInfo()
{
Name = E.Owner.Hostname,

View File

@ -42,7 +42,9 @@ namespace IW4MAdmin.Application.Core
else
{
// this update their ping
// todo: this seems kinda hacky
value.Ping = client.Ping;
value.Score = client.Score;
}
}

View File

@ -462,17 +462,8 @@ namespace IW4MAdmin.Application
queuedEvent.Target.DelayedEvents.Enqueue(queuedEvent);
continue;
}
if (queuedEvent.Type == GameEvent.EventType.Connect)
{
// we don't want to block here to due to needing event completion in the addplayer method
processEvent(queuedEvent);
}
else
{
await processEvent(queuedEvent);
}
// for delayed events, they're added after the connect event so it should work out
await processEvent(queuedEvent);
}
// signal that all events have been processed

View File

@ -247,9 +247,7 @@ namespace IW4MAdmin
Manager.GetEventHandler().AddEvent(e);
// let all the plugins get the event
// this is only beause the connect event executes
e.OnProcessed.Wait();
player.State = Player.ClientState.Connected;
// add the delayed event to the queue
while (delayedEventQueue?.Count > 0)
@ -583,8 +581,6 @@ namespace IW4MAdmin
// all polled players should be authenticated
var addPlayerTasks = AuthQueue.GetAuthenticatedClients()
.Where(client => Players[client.ClientNumber] == null ||
Players[client.ClientNumber].State == Player.ClientState.Connecting)
.Select(client => AddPlayer(client));
await Task.WhenAll(addPlayerTasks);

View File

@ -125,7 +125,7 @@
<Architecture>X64</Architecture>
</Interpreter>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.Web.targets" />
<!--<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.Web.targets" />-->
<!-- Specify pre- and post-build commands in the BeforeBuild and
AfterBuild targets below. -->
<Target Name="BeforeBuild">

View File

@ -8,6 +8,7 @@ namespace SharedLibraryCore.Dtos
/// </summary>
public class EventInfo
{
public EntityInfo GameInfo { get; set; }
public EntityInfo OriginEntity { get; set; }
public EntityInfo TargetEntity { get; set; }
public EntityInfo EventType { get; set; }

File diff suppressed because it is too large Load Diff