-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExtraLoadoutsMod.cs
More file actions
73 lines (62 loc) · 3.02 KB
/
ExtraLoadoutsMod.cs
File metadata and controls
73 lines (62 loc) · 3.02 KB
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
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
namespace ExtraLoadouts;
public sealed partial class ExtraLoadoutsMod : Mod {
public const int VANILLA_LOADOUTS = 3;
public const int EXTRA_LOADOUTS = 6;
public static readonly Color[,] ExLoadoutColors = new Color[EXTRA_LOADOUTS, 3] { // Normal, Vanity, Dye
{
new(130, 116, 63),
new(122, 97, 59),
new(117, 70, 53)
},
{
new(108, 50, 137),
new(70, 56, 107),
new(77, 51, 104)
},
{
new(127, 72, 125),
new(102, 52, 104),
new(78, 46, 96),
},
{
new(170, 192, 179),
new(109, 166, 160),
new(46, 106, 110)
},
{
new(69, 69, 161),
new(46, 46, 102),
new(34, 34, 77)
},
{
new(190, 154, 235),
new(178, 139, 208),
new(172, 106, 190),
}
};
public override object Call(params object[] args) {
if (args[0] is not string method) {
return "args[0] must be a string specifying the method to call";
}
return method switch {
"CurrentExtraLoadoutIndex.0" when args[1] is Player player => player.GetModPlayer<LoadoutPlayer>().CurrentExtraLoadoutIndex,
"TotalExtraLoadouts.0" => EXTRA_LOADOUTS,
"SwitchToExtraLoadout.0" when args[1] is Player player && args[2] is int index => player.GetModPlayer<LoadoutPlayer>().TrySwitchingExtraLoadout(index),
"GetExtraLoadoutVanilla.0" when args[1] is Player player && args[2] is int index => player.GetModPlayer<LoadoutPlayer>().ExtraLoadouts[index].Vanilla,
"GetExtraLoadoutVanillaItems.0" when args[1] is Player player && args[2] is int index => player.GetModPlayer<LoadoutPlayer>().ExtraLoadouts[index].Vanilla.Armor,
"GetExtraLoadoutVanillaDyes.0" when args[1] is Player player && args[2] is int index => player.GetModPlayer<LoadoutPlayer>().ExtraLoadouts[index].Vanilla.Dye,
"GetExtraLoadoutVanillaHide.0" when args[1] is Player player && args[2] is int index => player.GetModPlayer<LoadoutPlayer>().ExtraLoadouts[index].Vanilla.Hide,
"GetExtraLoadoutModLoaderItems.0" when args[1] is Player player && args[2] is int index => player.GetModPlayer<LoadoutPlayer>().ExtraLoadouts[index].ModLoader.ExAccessorySlot,
"GetExtraLoadoutModLoaderDyes.0" when args[1] is Player player && args[2] is int index => player.GetModPlayer<LoadoutPlayer>().ExtraLoadouts[index].ModLoader.ExDyesAccessory,
"GetExtraLoadoutModLoaderHide.0" when args[1] is Player player && args[2] is int index => player.GetModPlayer<LoadoutPlayer>().ExtraLoadouts[index].ModLoader.ExHideAccessory,
_ => throw new Exception("Invalid method name or arguments")
};
}
public static int LoadoutNumber(int loadoutIndex, bool ex) {
return loadoutIndex + 1 + (ex ? VANILLA_LOADOUTS : 0);
}
}