Merge branch '2.3' into 2.4-pr
This commit is contained in:
commit
a57c982270
@ -488,7 +488,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
})
|
})
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public override Task ExecuteAsync(GameEvent E)
|
public override async Task ExecuteAsync(GameEvent E)
|
||||||
{
|
{
|
||||||
Permission oldPerm = E.Target.Level;
|
Permission oldPerm = E.Target.Level;
|
||||||
Permission newPerm = Utilities.MatchPermission(E.Data);
|
Permission newPerm = Utilities.MatchPermission(E.Data);
|
||||||
@ -496,15 +496,16 @@ namespace SharedLibraryCore.Commands
|
|||||||
if (E.Target == E.Origin)
|
if (E.Target == E.Origin)
|
||||||
{
|
{
|
||||||
E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_SELF"]);
|
E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_SELF"]);
|
||||||
return Task.CompletedTask;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (newPerm == Permission.Owner &&
|
else if (newPerm == Permission.Owner &&
|
||||||
!E.Owner.Manager.GetApplicationSettings().Configuration().EnableMultipleOwners)
|
!E.Owner.Manager.GetApplicationSettings().Configuration().EnableMultipleOwners &&
|
||||||
|
await E.Owner.Manager.GetClientService().GetOwnerCount() > 0)
|
||||||
{
|
{
|
||||||
// only one owner is allowed
|
// only one owner is allowed
|
||||||
E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_OWNER"]);
|
E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_OWNER"]);
|
||||||
return Task.CompletedTask;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (E.Origin.Level < Permission.Owner &&
|
else if (E.Origin.Level < Permission.Owner &&
|
||||||
@ -512,7 +513,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
{
|
{
|
||||||
// only the owner is allowed to set levels
|
// only the owner is allowed to set levels
|
||||||
E.Origin.Tell($"{Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_STEPPEDDISABLED"]} ^5{E.Target.Name}");
|
E.Origin.Tell($"{Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_STEPPEDDISABLED"]} ^5{E.Target.Name}");
|
||||||
return Task.CompletedTask;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ((E.Origin.Level <= newPerm &&
|
else if ((E.Origin.Level <= newPerm &&
|
||||||
@ -522,7 +523,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
// can't promote a client to higher than your current perms
|
// can't promote a client to higher than your current perms
|
||||||
// or your peer
|
// or your peer
|
||||||
E.Origin.Tell(string.Format(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_LEVELTOOHIGH"], E.Target.Name, (E.Origin.Level - 1).ToString()));
|
E.Origin.Tell(string.Format(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_LEVELTOOHIGH"], E.Target.Name, (E.Origin.Level - 1).ToString()));
|
||||||
return Task.CompletedTask;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (newPerm > Permission.Banned)
|
else if (newPerm > Permission.Banned)
|
||||||
@ -557,8 +558,6 @@ namespace SharedLibraryCore.Commands
|
|||||||
{
|
{
|
||||||
E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_FAIL"]);
|
E.Origin.Tell(Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_SETLEVEL_FAIL"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,19 +231,13 @@ namespace SharedLibraryCore.Services
|
|||||||
temporalClient.CurrentServer.Logger.WriteDebug($"Updated {temporalClient.ClientId} to {newPermission}");
|
temporalClient.CurrentServer.Logger.WriteDebug($"Updated {temporalClient.ClientId} to {newPermission}");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
var linkedPermissionSet = new[] { Permission.Banned, Permission.Flagged };
|
||||||
// if their permission level has been changed to level that needs to be updated on all accounts
|
// if their permission level has been changed to level that needs to be updated on all accounts
|
||||||
if ((oldPermission != newPermission) &&
|
if (linkedPermissionSet.Contains(newPermission) || linkedPermissionSet.Contains(oldPermission))
|
||||||
(newPermission == Permission.Banned ||
|
|
||||||
newPermission == Permission.Flagged ||
|
|
||||||
newPermission == Permission.User))
|
|
||||||
{
|
{
|
||||||
var changeSvc = new ChangeHistoryService();
|
|
||||||
|
|
||||||
//get all clients that have the same linkId
|
//get all clients that have the same linkId
|
||||||
var iqMatchingClients = ctx.Clients
|
var iqMatchingClients = ctx.Clients
|
||||||
.Where(_client => _client.AliasLinkId == entity.AliasLinkId);
|
.Where(_client => _client.AliasLinkId == entity.AliasLinkId);
|
||||||
// make sure we don't select ourselves twice
|
|
||||||
//.Where(_client => _client.ClientId != temporalClient.ClientId);
|
|
||||||
|
|
||||||
// this updates the level for all the clients with the same LinkId
|
// this updates the level for all the clients with the same LinkId
|
||||||
// only if their new level is flagged or banned
|
// only if their new level is flagged or banned
|
||||||
|
Loading…
Reference in New Issue
Block a user