-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetcolorCommand.cs
82 lines (66 loc) · 2.2 KB
/
SetcolorCommand.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace MultiDraw
{
public class SetcolorCommand : ModCommand
{
// CommandType.Chat means that command can be used in Chat in SP and MP
public override CommandType Type
=> CommandType.Chat;
// The desired text to trigger this command
public override string Command
=> "setcolor";
// A short description of this command
public override string Description
=> "Changes brush color to a color or an item sprite. Input either 'black', 'white', 'red', 'green', 'blue', 'yellow', 'orange', 'purple', 'magenta', 'pink', or a valid item ID";
public override void Action(CommandCaller caller, string input, string[] args) {
if (args.Length != 1) {
Main.NewText("Incorrect amount of arguments supplied to 'setcolor'. Input only 'black', 'white', 'red', 'green', 'blue', or a valid item ID");
return;
}
switch (args[0]) {
case "black":
ModContent.GetInstance<ConfigClientSide>().BrushImage = 0;
break;
case "white":
ModContent.GetInstance<ConfigClientSide>().BrushImage = -1;
break;
case "red":
ModContent.GetInstance<ConfigClientSide>().BrushImage = -2;
break;
case "green":
ModContent.GetInstance<ConfigClientSide>().BrushImage = -3;
break;
case "blue":
ModContent.GetInstance<ConfigClientSide>().BrushImage = -4;
break;
case "yellow":
ModContent.GetInstance<ConfigClientSide>().BrushImage = -5;
break;
case "orange":
ModContent.GetInstance<ConfigClientSide>().BrushImage = -6;
break;
case "purple":
ModContent.GetInstance<ConfigClientSide>().BrushImage = -7;
break;
case "magenta":
ModContent.GetInstance<ConfigClientSide>().BrushImage = -7;
break;
case "pink":
ModContent.GetInstance<ConfigClientSide>().BrushImage = -8;
break;
default:
int num = -100;
if (Int32.TryParse(args[0], out num) && num > 0 && num <= 5455) {
ModContent.GetInstance<ConfigClientSide>().BrushImage = num;
return;
} else {
Main.NewText("Argument is unparsable. Input either 'black', 'white', 'red', 'green', 'blue', or a valid item ID");
return;
}
}
}
}
}