コード例 #1
0
 public static void setImmune(this Entity entity, bool state, DGAdmin.GroupsDatabase database)
 {
     DGAdmin.PlayerInfo playerFromImmunes = database.FindMatchingPlayerFromImmunes(entity.GetInfo());
     if (playerFromImmunes == null && state)
     {
         database.ImmunePlayers.Add(entity.GetInfo());
     }
     if (playerFromImmunes != null && !state)
     {
         database.ImmunePlayers.Remove(playerFromImmunes);
     }
     return;
 }
コード例 #2
0
        //CHANGE
        public static bool FixPlayerIdentifiers(this Entity player, DGAdmin.GroupsDatabase database)
        {
            player.setLogged(false);
            var matchedplayerinfo = database.FindEntryFromPlayersOR(player.GetInfo());

            if (matchedplayerinfo != null)
            {
                database.Players.Remove(matchedplayerinfo.Value.Key);
                database.Players[DGAdmin.PlayerInfo.CommonIdentifiers(player.GetInfo(), matchedplayerinfo.Value.Key)] = matchedplayerinfo.Value.Value;
                return(true);
            }
            return(false);
        }
コード例 #3
0
ファイル: Groups.cs プロジェクト: IsmaeelAkram/MahjesticAdmin
        public static DGAdmin.GroupsDatabase.Group GetGroup(this Entity entity, DGAdmin.GroupsDatabase database)
        {
            KeyValuePair <DGAdmin.PlayerInfo, string>?playerFromGroups = database.FindEntryFromPlayersAND(entity.GetInfo());

            if (playerFromGroups == null)
            {
                return(database.GetGroup("default"));
            }
            DGAdmin.GroupsDatabase.Group grp = database.GetGroup(playerFromGroups.Value.Value);
            if (grp != null)
            {
                return(grp);
            }
            else
            {
                DGAdmin.WriteLog.Error("# Player " + entity.Name + ": GUID=" + entity.GUID + ", HWID = " + entity.GetHWID().ToString());
                DGAdmin.WriteLog.Error("# Is in nonexistent group: " + playerFromGroups);
                return(database.GetGroup("default"));
            }
        }
コード例 #4
0
ファイル: Groups.cs プロジェクト: IsmaeelAkram/MahjesticAdmin
        public static string GetFormattedName(this Entity player, DGAdmin.GroupsDatabase database)
        {
            DGAdmin.GroupsDatabase.Group grp = player.GetGroup(database);
            var alias = "";

            if (DGAdmin.ChatAlias.Keys.Contains(player.GUID))
            {
                alias = DGAdmin.ChatAlias[player.GUID];
            }
            if (!string.IsNullOrWhiteSpace(grp.short_name))
            {
                return(DGAdmin.Lang_GetString("FormattedNameRank").Format(new Dictionary <string, string>()
                {
                    { "<shortrank>", grp.short_name },
                    { "<rankname>", grp.group_name },
                    { "<name>", (alias != "")?alias : player.Name },
                }));
            }
            return(DGAdmin.Lang_GetString("FormattedNameRankless").Format(new Dictionary <string, string>()
            {
                { "<name>", (alias != "")?alias : player.Name },
            }));
        }
コード例 #5
0
ファイル: Groups.cs プロジェクト: IsmaeelAkram/MahjesticAdmin
 public static bool HasPermission(this Entity player, string permission_string, DGAdmin.GroupsDatabase database)
 {
     if (DGAdmin.ConfigValues.DEBUG && DGAdmin.ConfigValues.DEBUGOPT.PERMSFORALL)
     {
         return(true);
     }
     return(database.GetEntityPermission(player, permission_string));
 }
コード例 #6
0
ファイル: Groups.cs プロジェクト: IsmaeelAkram/MahjesticAdmin
 public static bool isImmune(this Entity entity, DGAdmin.GroupsDatabase database)
 {
     return(database.FindMatchingPlayerFromImmunes(entity.GetInfo()) != null);
 }