Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.94 KB | None | 0 0
  1. {
  2.  
  3. public static class Permissions
  4.  
  5. {
  6.  
  7. // tshock.account nodes
  8.  
  9.  
  10.  
  11. [Description("User can register account in game.")]
  12.  
  13. public static readonly string canregister = "tshock.account.register";
  14.  
  15.  
  16.  
  17. [Description("User can login in game.")]
  18.  
  19. public static readonly string canlogin = "tshock.account.login";
  20.  
  21.  
  22.  
  23. [Description("User can logout in game.")]
  24.  
  25. public static readonly string canlogout = "tshock.account.logout";
  26.  
  27.  
  28.  
  29. [Description("User can change password in game.")]
  30.  
  31. public static readonly string canchangepassword = "tshock.account.changepassword";
  32.  
  33.  
  34.  
  35. // tshock.admin nodes
  36.  
  37.  
  38.  
  39. [Description("User can set build protection status.")]
  40.  
  41. public static readonly string antibuild = "tshock.admin.antibuild";
  42.  
  43.  
  44.  
  45. [Description("Prevents you from being kicked.")]
  46.  
  47. public static readonly string immunetokick = "tshock.admin.nokick";
  48.  
  49.  
  50.  
  51. [Description("Prevents you from being banned.")]
  52.  
  53. public static readonly string immunetoban = "tshock.admin.noban";
  54.  
  55.  
  56.  
  57. [Description("Specific log messages are sent to users with this permission.")]
  58.  
  59. public static readonly string logs = "tshock.admin.viewlogs";
  60.  
  61.  
  62.  
  63. [Description("User can kick others.")]
  64.  
  65. public static readonly string kick = "tshock.admin.kick";
  66.  
  67.  
  68.  
  69. [Description("User can ban others.")]
  70.  
  71. public static readonly string ban = "tshock.admin.ban";
  72.  
  73.  
  74.  
  75. [Description("User can manage warps.")]
  76.  
  77. public static readonly string managewarp = "tshock.admin.warp";
  78.  
  79.  
  80.  
  81. [Description("User can manage item bans.")]
  82.  
  83. public static readonly string manageitem = "tshock.admin.itemban";
  84.  
  85.  
  86.  
  87. [Description("User can manage projectile bans.")]
  88.  
  89. public static readonly string manageprojectile = "tshock.admin.projectileban";
  90.  
  91.  
  92.  
  93. [Description("User can manage tile bans.")]
  94.  
  95. public static readonly string managetile = "tshock.admin.tileban";
  96.  
  97.  
  98.  
  99. [Description("User can manage groups.")]
  100.  
  101. public static readonly string managegroup = "tshock.admin.group";
  102.  
  103.  
  104.  
  105. [Description("User can manage regions.")]
  106.  
  107. public static readonly string manageregion = "tshock.admin.region";
  108.  
  109.  
  110.  
  111. [Description("User can mute and unmute users.")]
  112.  
  113. public static readonly string mute = "tshock.admin.mute";
  114.  
  115.  
  116.  
  117. [Description("User can see the id of players with /who.")]
  118.  
  119. public static readonly string seeids = "tshock.admin.seeplayerids";
  120.  
  121.  
  122.  
  123. [Description("User can save all the players SSI (server side character) state.")]
  124.  
  125. public static readonly string savessc = "tshock.admin.savessi";
  126.  
  127.  
  128.  
  129. [Description("User can upload their joined character data as SSC data.")]
  130.  
  131. public static readonly string uploaddata = "tshock.ssc.upload";
  132.  
  133.  
  134.  
  135. [Description("User can upload other players join data to the SSC database.")]
  136.  
  137. public static readonly string uploadothersdata = "tshock.ssc.upload.others";
  138.  
  139.  
  140.  
  141. [Description("User can elevate other users' groups temporarily.")]
  142.  
  143. public static readonly string settempgroup = "tshock.admin.tempgroup";
  144.  
  145.  
  146.  
  147. [Description("User can broadcast messages.")]
  148.  
  149. public static readonly string broadcast = "tshock.admin.broadcast";
  150.  
  151.  
  152.  
  153. [Description("User can get other users' info.")]
  154.  
  155. public static readonly string userinfo = "tshock.admin.userinfo";
  156.  
  157.  
  158.  
  159. // tshock.buff nodes
  160.  
  161.  
  162.  
  163. [Description("User can buff self.")]
  164.  
  165. public static readonly string buff = "tshock.buff.self";
  166.  
  167.  
  168.  
  169. [Description("User can buff other players.")]
  170.  
  171. public static readonly string buffplayer = "tshock.buff.others";
  172.  
  173.  
  174.  
  175. // tshock.cfg nodes
  176.  
  177.  
  178.  
  179. [Description("User is notified when an update is available, user can turn off / restart the server.")]
  180.  
  181. public static readonly string maintenance = "tshock.cfg.maintenance";
  182.  
  183.  
  184.  
  185. [Description("User can modify the whitelist.")]
  186.  
  187. public static readonly string whitelist = "tshock.cfg.whitelist";
  188.  
  189.  
  190.  
  191. [Description("User can edit the server password.")]
  192.  
  193. public static readonly string cfgpassword = "tshock.cfg.password";
  194.  
  195.  
  196.  
  197. [Description("User can reload the configurations file.")]
  198.  
  199. public static readonly string cfgreload = "tshock.cfg.reload";
  200.  
  201.  
  202.  
  203. [Description("User can create reference files of Terraria IDs and the permission matrix in the server folder.")]
  204.  
  205. public static readonly string createdumps = "tshock.cfg.createdumps";
  206.  
  207.  
  208.  
  209. // tshock.ignore nodes
  210.  
  211.  
  212.  
  213. [Description("Prevents you from being reverted by kill tile abuse detection.")]
  214.  
  215. public static readonly string ignorekilltiledetection = "tshock.ignore.removetile";
  216.  
  217.  
  218.  
  219. [Description("Prevents you from being reverted by place tile abuse detection.")]
  220.  
  221. public static readonly string ignoreplacetiledetection = "tshock.ignore.placetile";
  222.  
  223.  
  224.  
  225. [Description("Prevents you from being disabled by liquid set abuse detection.")]
  226.  
  227. public static readonly string ignoreliquidsetdetection = "tshock.ignore.liquid";
  228.  
  229.  
  230.  
  231. [Description("Prevents you from being disabled by projectile abuse detection.")]
  232.  
  233. public static readonly string ignoreprojectiledetection = "tshock.ignore.projectile";
  234.  
  235.  
  236.  
  237. [Description("Prevents you from being disabled by paint abuse detection.")]
  238.  
  239. public static readonly string ignorepaintdetection = "tshock.ignore.paint";
  240.  
  241.  
  242.  
  243. [Description("Prevents you from being reverted by no clip detection.")]
  244.  
  245. public static readonly string ignorenoclipdetection = "tshock.ignore.noclip";
  246.  
  247.  
  248.  
  249. [Description("Prevents you from being disabled by stack hack detection.")]
  250.  
  251. public static readonly string ignorestackhackdetection = "tshock.ignore.itemstack";
  252.  
  253.  
  254.  
  255. [Description("Prevents your actions from being ignored if damage is too high.")]
  256.  
  257. public static readonly string ignoredamagecap = "tshock.ignore.damage";
  258.  
  259.  
  260.  
  261. [Description("Bypass server side character checks.")]
  262.  
  263. public static readonly string bypassssc = "tshock.ignore.ssc";
  264.  
  265.  
  266.  
  267. [Description("Allow unrestricted SendTileSquare usage, for client side world editing.")]
  268.  
  269. public static readonly string allowclientsideworldedit = "tshock.ignore.sendtilesquare";
  270.  
  271.  
  272.  
  273. [Description("Allow dropping banned items without the item being eaten.")]
  274.  
  275. public static readonly string allowdroppingbanneditems = "tshock.ignore.dropbanneditem";
  276.  
  277.  
  278.  
  279. [Description("Prevents you from being disabled by abnormal HP.")]
  280.  
  281. public static readonly string ignorehp = "tshock.ignore.hp";
  282.  
  283.  
  284.  
  285. [Description("Prevents you from being disabled by abnormal MP.")]
  286.  
  287. public static readonly string ignoremp = "tshock.ignore.mp";
  288.  
  289.  
  290.  
  291. // tshock.item nodes
  292.  
  293.  
  294.  
  295. [Description("User can give items.")]
  296.  
  297. public static readonly string give = "tshock.item.give";
  298.  
  299.  
  300.  
  301. [Description("User can spawn items.")]
  302.  
  303. public static readonly string item = "tshock.item.spawn";
  304.  
  305.  
  306.  
  307. [Description("Allows you to use banned items.")]
  308.  
  309. public static readonly string usebanneditem = "tshock.item.usebanned";
  310.  
  311.  
  312.  
  313. // tshock.npc nodes
  314.  
  315.  
  316.  
  317. [Description("User can edit the max spawns.")]
  318.  
  319. public static readonly string maxspawns = "tshock.npc.maxspawns";
  320.  
  321.  
  322.  
  323. [Description("User can edit the spawnrate.")]
  324.  
  325. public static readonly string spawnrate = "tshock.npc.spawnrate";
  326.  
  327.  
  328.  
  329. [Description("User can start an invasion.")]
  330.  
  331. public static readonly string invade = "tshock.npc.invade";
  332.  
  333.  
  334.  
  335. [Description("User can hurt town NPCs.")]
  336.  
  337. public static readonly string hurttownnpc = "tshock.npc.hurttown";
  338.  
  339.  
  340.  
  341. [Description("User can spawn bosses.")]
  342.  
  343. public static readonly string spawnboss = "tshock.npc.spawnboss";
  344.  
  345.  
  346.  
  347. [Description("User can rename NPCs.")]
  348.  
  349. public static readonly string renamenpc = "tshock.npc.rename";
  350.  
  351.  
  352.  
  353. [Description("User can spawn npcs.")]
  354.  
  355. public static readonly string spawnmob = "tshock.npc.spawnmob";
  356.  
  357.  
  358.  
  359. [Description("User can kill all enemy npcs.")]
  360.  
  361. public static readonly string butcher = "tshock.npc.butcher";
  362.  
  363.  
  364.  
  365. [Description("User can summon bosses using items.")]
  366.  
  367. public static readonly string summonboss = "tshock.npc.summonboss";
  368.  
  369.  
  370.  
  371. [Description("User can start invasions (Goblin/Snow Legion) using items.")]
  372.  
  373. public static readonly string startinvasion = "tshock.npc.startinvasion";
  374.  
  375.  
  376.  
  377. [Description("User can start the dd2 event.")]
  378.  
  379. public static readonly string startdd2 = "tshock.npc.startdd2";
  380.  
  381.  
  382.  
  383. [Description("User can clear the list of users who have completed an angler quest that day.")]
  384.  
  385. public static readonly string clearangler = "tshock.npc.clearanglerquests";
  386.  
  387.  
  388.  
  389. [Description("Meant for super admins only.")]
  390.  
  391. public static readonly string user = "tshock.superadmin.user";
  392.  
  393.  
  394.  
  395. [Description("Allows a user to elevate to superadmin for 10 minutes.")]
  396.  
  397. public static readonly string su = "tshock.su";
  398.  
  399.  
  400.  
  401. // tshock.tp nodes
  402.  
  403.  
  404.  
  405. [Description("User can teleport *everyone* to them.")]
  406.  
  407. public static readonly string tpallothers = "tshock.tp.allothers";
  408.  
  409.  
  410.  
  411. [Description("User can teleport to others.")]
  412.  
  413. public static readonly string tp = "tshock.tp.self";
  414.  
  415.  
  416.  
  417. [Description("User can teleport other people.")]
  418.  
  419. public static readonly string tpothers = "tshock.tp.others";
  420.  
  421.  
  422.  
  423. [Description("User can teleport to tile positions.")]
  424.  
  425. public static readonly string tppos = "tshock.tp.pos";
  426.  
  427.  
  428.  
  429. [Description("User can get the position of players.")]
  430.  
  431. public static readonly string getpos = "tshock.tp.getpos";
  432.  
  433.  
  434.  
  435. [Description("User can teleport to an NPC.")]
  436.  
  437. public static readonly string tpnpc = "tshock.tp.npc";
  438.  
  439.  
  440.  
  441. [Description("Users can stop people from teleporting.")]
  442.  
  443. public static readonly string tpallow = "tshock.tp.block";
  444.  
  445.  
  446.  
  447. [Description("Users can override teleport blocks.")]
  448.  
  449. public static readonly string tpoverride = "tshock.tp.override";
  450.  
  451.  
  452.  
  453. [Description("Users can teleport to people without showing a notice")]
  454.  
  455. public static readonly string tpsilent = "tshock.tp.silent";
  456.  
  457.  
  458.  
  459. [Description("User can use /home.")]
  460.  
  461. public static readonly string home = "tshock.tp.home";
  462.  
  463.  
  464.  
  465. [Description("User can use /spawn.")]
  466.  
  467. public static readonly string spawn = "tshock.tp.spawn";
  468.  
  469.  
  470.  
  471. [Description("User can use the Rod of Discord.")]
  472.  
  473. public static readonly string rod = "tshock.tp.rod";
  474.  
  475.  
  476.  
  477. [Description("User can use wormhole potions.")]
  478.  
  479. public static readonly string wormhole = "tshock.tp.wormhole";
  480.  
  481.  
  482.  
  483. // tshock.world nodes
  484.  
  485.  
  486.  
  487. [Description("User can change expert state.")]
  488.  
  489. public static readonly string toggleexpert = "tshock.world.toggleexpert";
  490.  
  491.  
  492.  
  493. [Description("Allows you to edit the spawn.")]
  494.  
  495. public static readonly string editspawn = "tshock.world.editspawn";
  496.  
  497.  
  498.  
  499. [Description("Allows you to edit regions.")]
  500.  
  501. public static readonly string editregion = "tshock.world.editregion";
  502.  
  503.  
  504.  
  505. [Description("User can force a blood moon.")]
  506.  
  507. public static readonly string bloodmoon = "tshock.world.time.bloodmoon";
  508.  
  509.  
  510.  
  511. [Description("User can set the time.")]
  512.  
  513. public static readonly string time = "tshock.world.time.set";
  514.  
  515.  
  516.  
  517. [Description("Player can use the Enchanted Sundial item.")]
  518.  
  519. public static readonly string usesundial = "tshock.world.time.usesundial";
  520.  
  521.  
  522.  
  523. [Description("User can grow plants.")]
  524.  
  525. public static readonly string grow = "tshock.world.grow";
  526.  
  527.  
  528.  
  529. [Description("User can change hardmode state.")]
  530.  
  531. public static readonly string hardmode = "tshock.world.hardmode";
  532.  
  533.  
  534.  
  535. [Description("User can change the homes of NPCs.")]
  536.  
  537. public static readonly string movenpc = "tshock.world.movenpc";
  538.  
  539.  
  540.  
  541. [Description("User can convert hallow into corruption and vice-versa.")]
  542.  
  543. public static readonly string converthardmode = "tshock.world.converthardmode";
  544.  
  545.  
  546.  
  547. [Description("User can force the server to Halloween mode.")]
  548.  
  549. public static readonly string halloween = "tshock.world.sethalloween";
  550.  
  551.  
  552.  
  553. [Description("User can force the server to Christmas mode.")]
  554.  
  555. public static readonly string xmas = "tshock.world.setxmas";
  556.  
  557.  
  558.  
  559. [Description("User can save the world.")]
  560.  
  561. public static readonly string worldsave = "tshock.world.save";
  562.  
  563.  
  564.  
  565. [Description("User can settle liquids.")]
  566.  
  567. public static readonly string worldsettle = "tshock.world.settleliquids";
  568.  
  569.  
  570.  
  571. [Description("User can get the world info.")]
  572.  
  573. public static readonly string worldinfo = "tshock.world.info";
  574.  
  575.  
  576.  
  577. [Description("User can set the world spawn.")]
  578.  
  579. public static readonly string worldspawn = "tshock.world.setspawn";
  580.  
  581.  
  582.  
  583. [Description("User can set the dungeon's location.")]
  584.  
  585. public static readonly string dungeonposition = "tshock.world.setdungeon";
  586.  
  587.  
  588.  
  589. [Description("User can drop a meteor.")]
  590.  
  591. public static readonly string dropmeteor = "tshock.world.time.dropmeteor";
  592.  
  593.  
  594.  
  595. [Description("User can force an eclipse.")]
  596.  
  597. public static readonly string eclipse = "tshock.world.time.eclipse";
  598.  
  599.  
  600.  
  601. [Description("User can force a full moon.")]
  602.  
  603. public static readonly string fullmoon = "tshock.world.time.fullmoon";
  604.  
  605.  
  606.  
  607. [Description("User can modify the world.")]
  608.  
  609. public static readonly string canbuild = "tshock.world.modify";
  610.  
  611.  
  612.  
  613. [Description("User can paint tiles.")]
  614.  
  615. public static readonly string canpaint = "tshock.world.paint";
  616.  
  617.  
  618.  
  619. [Description("User can turn on or off sandstorms.")]
  620.  
  621. public static readonly string sandstorm = "tshock.world.sandstorm";
  622.  
  623.  
  624.  
  625. [Description("User can turn on or off the rain.")]
  626.  
  627. public static readonly string rain = "tshock.world.rain";
  628.  
  629.  
  630.  
  631. [Description("User can modify the wind.")]
  632.  
  633. public static readonly string wind = "tshock.world.wind";
  634.  
  635.  
  636.  
  637. [Description("Player can toggle party event.")]
  638.  
  639. public static readonly string toggleparty = "tshock.world.toggleparty";
  640.  
  641.  
  642.  
  643. // Non-grouped
  644.  
  645.  
  646.  
  647. [Description("User can clear items or projectiles.")]
  648.  
  649. public static readonly string clear = "tshock.clear";
  650.  
  651.  
  652.  
  653. [Description("User can kill others.")]
  654.  
  655. public static readonly string kill = "tshock.kill";
  656.  
  657.  
  658.  
  659. [Description("Allows you to bypass the max slots for up to 5 slots above your max.")]
  660.  
  661. public static readonly string reservedslot = "tshock.reservedslot";
  662.  
  663.  
  664.  
  665. [Description("User can use warps.")]
  666.  
  667. public static readonly string warp = "tshock.warp";
  668.  
  669.  
  670.  
  671. [Description("User can slap others.")]
  672.  
  673. public static readonly string slap = "tshock.slap";
  674.  
  675.  
  676.  
  677. [Description("User can whisper to others.")]
  678.  
  679. public static readonly string whisper = "tshock.whisper";
  680.  
  681.  
  682.  
  683. [Description("User can annoy others.")]
  684.  
  685. public static readonly string annoy = "tshock.annoy";
  686.  
  687.  
  688.  
  689. [Description("User can heal players.")]
  690.  
  691. public static readonly string heal = "tshock.heal";
  692.  
  693.  
  694.  
  695. [Description("User can use party chat in game.")]
  696.  
  697. public static readonly string canpartychat = "tshock.partychat";
  698.  
  699.  
  700.  
  701. [Description("User can talk in third person.")]
  702.  
  703. public static readonly string cantalkinthird = "tshock.thirdperson";
  704.  
  705.  
  706.  
  707. [Description("User can get the server info.")]
  708.  
  709. public static readonly string serverinfo = "tshock.info";
  710.  
  711.  
  712.  
  713. [Description("Player recovers health as damage is taken. Can be one shotted.")]
  714.  
  715. public static readonly string godmode = "tshock.godmode";
  716.  
  717.  
  718.  
  719. [Description("User can godmode other players.")]
  720.  
  721. public static readonly string godmodeother = "tshock.godmode.other";
  722.  
  723.  
  724.  
  725. [Description("Player can chat.")]
  726.  
  727. public static readonly string canchat = "tshock.canchat";
  728.  
  729.  
  730.  
  731. [Description("Player can use banned projectiles.")]
  732.  
  733. public static readonly string canusebannedprojectiles = "tshock.projectiles.usebanned";
  734.  
  735.  
  736.  
  737. [Description("Player can place banned tiles.")]
  738.  
  739. public static readonly string canusebannedtiles = "tshock.tiles.usebanned";
  740.  
  741.  
  742.  
  743. [Description("Player can check if a username is registered and see its last login time.")]
  744.  
  745. public static readonly string checkaccountinfo = "tshock.accountinfo.check";
  746.  
  747.  
  748.  
  749. [Description("Player can see advanced information about any user account.")]
  750.  
  751. public static readonly string advaccountinfo = "tshock.accountinfo.details";
  752.  
  753. /// <summary>
  754.  
  755. /// Lists all commands associated with a given permission
  756.  
  757. /// </summary>
  758.  
  759. /// <param name="perm">string permission - the permission to get information on</param>
  760.  
  761. /// <returns>List of commands</returns>
  762.  
  763. private static List<Command> GetCommands(string perm)
  764.  
  765. {
  766.  
  767. if (Commands.ChatCommands.Count < 1)
  768.  
  769. Commands.InitCommands();
  770.  
  771. return Commands.ChatCommands.Where(c => c.Permissions.Contains(perm)).ToList();
  772.  
  773. }
  774.  
  775.  
  776.  
  777. /// <summary>
  778.  
  779. /// Dumps the descriptions of each permission to a file in Markdown format.
  780.  
  781. /// </summary>
  782.  
  783. public static void DumpDescriptions()
  784.  
  785. {
  786.  
  787. var sb = new StringBuilder();
  788.  
  789. foreach (var field in typeof(Permissions).GetFields().OrderBy(f => f.Name))
  790.  
  791. {
  792.  
  793. var name = (string)field.GetValue(null);
  794.  
  795.  
  796.  
  797. var descattr =
  798.  
  799. field.GetCustomAttributes(false).FirstOrDefault(o => o is DescriptionAttribute) as DescriptionAttribute;
  800.  
  801. var desc = descattr != null && !string.IsNullOrWhiteSpace(descattr.Description) ? descattr.Description : "None";
  802.  
  803.  
  804.  
  805. var commands = GetCommands(name);
  806.  
  807. foreach (var c in commands)
  808.  
  809. {
  810.  
  811. for (var i = 0; i < c.Names.Count; i++)
  812.  
  813. {
  814.  
  815. c.Names[i] = "/" + c.Names[i];
  816.  
  817. }
  818.  
  819. }
  820.  
  821. var strs =
  822.  
  823. commands.Select(
  824.  
  825. c =>
  826.  
  827. c.Name + (c.Names.Count > 1 ? "({0})".SFormat(string.Join(" ", c.Names.ToArray(), 1, c.Names.Count - 1)) : ""));
  828.  
  829.  
  830.  
  831. sb.AppendLine("{0}".SFormat(name));
  832.  
  833. sb.AppendLine("Description: {0} ".SFormat(desc));
  834.  
  835. sb.AppendLine("Commands: {0} ".SFormat(strs.Count() > 0 ? string.Join(" ", strs) : "None"));
  836.  
  837. sb.AppendLine();
  838.  
  839. }
  840.  
  841.  
  842.  
  843. File.WriteAllText("PermissionsDescriptions.txt", sb.ToString());
  844.  
  845. }
  846.  
  847. }
  848.  
  849.  
  850.  
  851. [AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
  852.  
  853. public sealed class TodoAttribute : Attribute
  854.  
  855. {
  856.  
  857. public string Info { get; private set; }
  858.  
  859.  
  860.  
  861. public TodoAttribute(string info)
  862.  
  863. {
  864.  
  865. Info = info;
  866.  
  867. }
  868.  
  869.  
  870.  
  871. public TodoAttribute()
  872.  
  873. {
  874.  
  875. }
  876.  
  877. }
  878.  
  879. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement