1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-09 23:00:57 -05:00

SPM and skill is rounded in profile now

fixed web console not waiting for reponse
fixed password not saving over time
web users level update properly now when promoted/demoted
This commit is contained in:
RaidMax
2018-04-28 16:39:45 -05:00
parent df30fee5bb
commit 1a580f17cb
12 changed files with 94 additions and 59 deletions

View File

@ -441,7 +441,7 @@ namespace SharedLibraryCore.Commands
}
}
if (newPerm > Player.Permission.Banned)
else if (newPerm > Player.Permission.Banned)
{
var ActiveClient = E.Owner.Manager.GetActiveClients()
.FirstOrDefault(p => p.NetworkId == E.Target.NetworkId);
@ -465,6 +465,7 @@ namespace SharedLibraryCore.Commands
catch (Exception)
{
// this updates their privilege level to the webfront claims
E.Owner.Manager.GetPrivilegedClients()[E.Target.ClientId] = E.Target;
}

View File

@ -55,6 +55,27 @@ namespace SharedLibraryCore
OnProcessed = new ManualResetEventSlim();
}
public static GameEvent TranferWaiter(EventType newType, GameEvent e)
{
var newEvent = new GameEvent()
{
Data = e.Data,
Extra = e.Extra,
Message = e.Message,
OnProcessed = e.OnProcessed,
Origin = e.Origin,
Owner = e.Owner,
Remote = e.Remote,
Target = e.Target,
Type = newType
};
// hack: prevent the previous event from completing until this one is done
e.OnProcessed = new ManualResetEventSlim();
return newEvent;
}
public EventType Type;
public string Data; // Data is usually the message sent by player
public string Message;
@ -63,6 +84,6 @@ namespace SharedLibraryCore
public Server Owner;
public Boolean Remote = false;
public object Extra { get; set; }
public ManualResetEventSlim OnProcessed { get; private set; }
public ManualResetEventSlim OnProcessed { get; set; }
}
}

View File

@ -10,7 +10,7 @@ namespace SharedLibraryCore.Interfaces
public interface IManager
{
Task Init();
void Start();
Task Start();
void Stop();
ILogger GetLogger();
IList<Server> GetServers();

View File

@ -255,7 +255,7 @@ namespace SharedLibraryCore.RCon
if (FailedReceives >= 4)
{
throw new NetworkException($"Could not receive data from the {ServerConnection.RemoteEndPoint}");
throw new NetworkException($"Could not receive data from {ServerConnection.RemoteEndPoint}");
}
}

View File

@ -134,9 +134,10 @@ namespace SharedLibraryCore.Services
{
using (var context = new DatabaseContext())
{
context.ChangeTracker.AutoDetectChangesEnabled = false;
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
if (victim)
{
context.ChangeTracker.AutoDetectChangesEnabled = false;
var now = DateTime.UtcNow;
var iqPenalties = from penalty in context.Penalties.AsNoTracking()
where penalty.OffenderId == clientId
@ -163,20 +164,21 @@ namespace SharedLibraryCore.Services
TimeRemaining = now > penalty.Expires ? "" : penalty.Expires.ToString()
},
When = penalty.When,
Sensitive = penalty.Type == Objects.Penalty.PenaltyType.Flag
Sensitive = penalty.Type == Penalty.PenaltyType.Flag
};
// fixme: is this good and fast?
var list = await iqPenalties.ToListAsync();
list.ForEach(p =>
{
// todo: why does this have to be done?
if (((PenaltyInfo)p.Value).Type.Length < 2)
((PenaltyInfo)p.Value).Type = ((Penalty.PenaltyType)Convert.ToInt32(((PenaltyInfo)p.Value).Type)).ToString();
var pi = ((PenaltyInfo)p.Value);
if (pi.TimeRemaining.Length > 0)
pi.TimeRemaining = (DateTime.Parse(((PenaltyInfo)p.Value).TimeRemaining) - now).TimeSpanText();
// todo: why does this have to be done?
if (pi.Type.Length > 2)
pi.Type = ((Penalty.PenaltyType)Convert.ToInt32(pi.Type)).ToString();
}
);
});
return list;
}
@ -268,7 +270,7 @@ namespace SharedLibraryCore.Services
{
await internalContext.Clients
.Where(c => c.AliasLinkId == p.LinkId)
.ForEachAsync(c => c.Level = Objects.Player.Permission.User);
.ForEachAsync(c => c.Level = Player.Permission.User);
await internalContext.SaveChangesAsync();
}

View File

@ -325,7 +325,9 @@ namespace SharedLibraryCore
LastConnection = client.LastConnection == DateTime.MinValue ? DateTime.UtcNow : client.LastConnection,
CurrentAlias = client.CurrentAlias,
CurrentAliasId = client.CurrentAlias.AliasId,
IsBot = client.NetworkId == -1
IsBot = client.NetworkId == -1,
Password = client.Password,
PasswordSalt = client.PasswordSalt
};
}