source: binary-improvements/7dtd-server-fixes/src/AdminToolsStuff.cs@ 106

Last change on this file since 106 was 103, checked in by alloc, 10 years ago

fixes

File size: 1.3 KB
RevLine 
[84]1using System;
2using System.Collections.Generic;
3
4public class AdminToolsStuff
5{
6 public static string[] GetAllowedCommandsList (AdminTools admTools, string _steamID)
7 {
8 List<string> allowed = new List<string> ();
9
[103]10 try {
11 AdminToolsClientInfo tmpInfo = admTools.GetClientCommandInfo (_steamID);
[86]12
[103]13 List<AdminToolsCommandPermissions> perms = admTools.commandPermissions;
14 ConsoleSdtd console = CommonMappingFunctions.GetGameManager ().m_GUIConsole;
15
16 foreach (AdminToolsCommandPermissions atcp in perms) {
17 if (tmpInfo.SteamID != null && tmpInfo.SteamID.Length > 0) {
18 if ((atcp.PermissionLevel >= tmpInfo.PermissionLevel) || (atcp.PermissionLevel >= 1000)) {
19 addAllowed (console, allowed, atcp.Command);
20 }
21 } else {
22 if (atcp.PermissionLevel >= 1000) {
23 addAllowed (console, allowed, atcp.Command);
24 }
[84]25 }
26 }
[103]27 } catch (Exception e) {
28 Log.Out ("Error in GetAllowedCommandsList: " + e);
[84]29 }
30
[103]31
[84]32 return allowed.ToArray ();
33 }
[86]34
35 private static void addAllowed (ConsoleSdtd console, List<string> list, string cmd)
36 {
37 ConsoleCommand cc = console.getCommand (cmd);
38 if (cc != null) {
39 foreach (string ccName in cc.Names()) {
40 if (!list.Contains (ccName)) {
41 list.Add (ccName);
42 }
43 }
44 } else {
45 list.Add (cmd);
46 }
47 }
[84]48}
49
Note: See TracBrowser for help on using the repository browser.