-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCheatToggleCommand.cs
60 lines (51 loc) · 1.74 KB
/
CheatToggleCommand.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using HamstarHelpers.Helpers.Debug;
using HamstarHelpers.Helpers.User;
using HamstarHelpers.Services.Cheats;
namespace HamstarHelpers.Commands.Cheats {
/// @private
public class CheatToggleCommand : ModCommand {
/// @private
public override CommandType Type => CommandType.World;
/// @private
public override string Command => "mh-cheat-toggle";
/// @private
public override string Usage => "/" + this.Command + " god fly";
/// @private
public override string Description => "Toggles cheat modes."
+"\n Parameters: [<mode 1> <mode 2> ...]"
+"\n Modes:"
+"\n bilbo: Invisible."
+"\n god: Invincibility."
+"\n mdk: Maximum damage weapons."
+"\n fly: Flight accessories unlimited.";
////////////////
/// @private
public override void Action( CommandCaller caller, string input, string[] args ) {
if( Main.netMode == NetmodeID.MultiplayerClient ) {
LogHelpers.Alert( "Not supposed to run on client." );
return;
}
if( !ModHelpersConfig.Instance.DebugModeCheats ) {
caller.Reply( "Cheats mode not enabled.", Color.Red );
return;
}
/*if( Main.netMode != NetmodeID.SinglePlayer ) {
if( !UserHelpers.HasBasicServerPrivilege( caller.Player ) ) {
caller.Reply( "Access denied.", Color.Red );
return;
}
}*/
if( !PlayerCheats.TryParseCheatFlags(args, out CheatModeType cheatFlags) ) {
caller.Reply( "Invalid cheat identifiers.", Color.Red );
return;
}
PlayerCheats.ToggleCheats( caller.Player, cheatFlags );
string cheats = string.Join( ", ", PlayerCheats.OutputActiveCheats(caller.Player) );
caller.Reply( "Cheats active: "+cheats, Color.Lime );
}
}
}