- Timestamp:
- Jul 26, 2014, 4:41:11 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/AdminToolsStuff.cs
r103 r107 25 25 } 26 26 } 27 28 if (tmpInfo.PermissionLevel <= 0) { 29 List<ConsoleCommand> commands = console.commands; 30 foreach (ConsoleCommand c in commands) { 31 if (!allowed.Contains (c.Names () [0])) { 32 if (!hasPermissionLevel (admTools, c.Names () [0])) { 33 addAllowed (console, allowed, c.Names () [0]); 34 } 35 } 36 } 37 } 27 38 } catch (Exception e) { 28 39 Log.Out ("Error in GetAllowedCommandsList: " + e); … … 33 44 } 34 45 46 private static bool hasPermissionLevel (AdminTools admTools, string cmd) 47 { 48 List<AdminToolsCommandPermissions> perms = admTools.commandPermissions; 49 50 foreach (AdminToolsCommandPermissions atcp in perms) { 51 foreach (string ccName in getAlternativeNames(cmd)) { 52 if (atcp.Command.ToLower ().Equals (ccName)) { 53 return true; 54 } 55 } 56 } 57 return false; 58 } 59 35 60 private static void addAllowed (ConsoleSdtd console, List<string> list, string cmd) 36 61 { 37 ConsoleCommand cc = console.getCommand (cmd); 62 foreach (string ccName in getAlternativeNames(cmd)) { 63 if (!list.Contains (ccName)) { 64 list.Add (ccName); 65 } 66 } 67 } 68 69 private static string[] getAlternativeNames (string cmd) 70 { 71 ConsoleCommand cc = CommonMappingFunctions.GetGameManager ().m_GUIConsole.getCommand (cmd); 38 72 if (cc != null) { 39 foreach (string ccName in cc.Names()) { 40 if (!list.Contains (ccName)) { 41 list.Add (ccName); 42 } 43 } 73 return cc.Names (); 44 74 } else { 45 list.Add (cmd);75 return new string[0]; 46 76 } 47 77 }
Note:
See TracChangeset
for help on using the changeset viewer.