Add case for new invasion, and commands for the invasion/moons added recently

This commit is contained in:
Zack Piispanen 2013-12-19 20:00:00 -05:00
parent 34e1a70872
commit 2dc99c2d8c
4 changed files with 77 additions and 1 deletions

View file

@ -358,6 +358,10 @@ namespace TShockAPI
{ {
HelpText = "Starts a Pumpkin Moon invasion at the specified wave." HelpText = "Starts a Pumpkin Moon invasion at the specified wave."
}); });
add(new Command(Permissions.invade, SnowInvasion, "snowinvasion")
{
HelpText = "Starts a Snow Moon invasion at the specified wave."
});
#endregion #endregion
#region TP Commands #region TP Commands
add(new Command(Permissions.home, Home, "home") add(new Command(Permissions.home, Home, "home")
@ -395,6 +399,14 @@ namespace TShockAPI
{ {
HelpText = "Sets a blood moon." HelpText = "Sets a blood moon."
}); });
add(new Command(Permissions.snowmoon, SnowMoon, "snowmoon")
{
HelpText = "Sets a snow moon."
});
add(new Command(Permissions.pumpkinmoon, PumpkinMoon, "pumpkinmoon")
{
HelpText = "Sets a pumpkin moon."
});
add(new Command(Permissions.grow, Grow, "grow") add(new Command(Permissions.grow, Grow, "grow")
{ {
AllowServer = false, AllowServer = false,
@ -1578,6 +1590,18 @@ namespace TShockAPI
TShock.Utils.Broadcast(string.Format("{0} turned on the blood moon.", args.Player.Name), Color.Green); TShock.Utils.Broadcast(string.Format("{0} turned on the blood moon.", args.Player.Name), Color.Green);
} }
private static void SnowMoon(CommandArgs args)
{
TSPlayer.Server.SetSnowMoon(true);
TShock.Utils.Broadcast(string.Format("{0} turned on the snow moon.", args.Player.Name), Color.Green);
}
private static void PumpkinMoon(CommandArgs args)
{
TSPlayer.Server.SetPumpkinMoon(true);
TShock.Utils.Broadcast(string.Format("{0} turned on the pumpkin moon.", args.Player.Name), Color.Green);
}
private static void Eclipse(CommandArgs args) private static void Eclipse(CommandArgs args)
{ {
TSPlayer.Server.SetEclipse(true); TSPlayer.Server.SetEclipse(true);
@ -1634,7 +1658,7 @@ namespace TShockAPI
Main.bloodMoon = false; Main.bloodMoon = false;
NPC.waveKills = 0f; NPC.waveKills = 0f;
NPC.waveCount = wave; NPC.waveCount = wave;
string text = "Pumpkin Invasion started at wave;" + wave; string text = "Pumpkin Invasion started at wave: " + wave;
if (Main.netMode == 0) if (Main.netMode == 0)
{ {
Main.NewText(text, 175, 75, 255, false); Main.NewText(text, 175, 75, 255, false);
@ -1645,6 +1669,35 @@ namespace TShockAPI
NetMessage.SendData(25, -1, -1, text, 255, 175f, 75f, 255f, 0); NetMessage.SendData(25, -1, -1, text, 255, 175f, 75f, 255f, 0);
} }
} }
private static void SnowInvasion(CommandArgs args)
{
TSPlayer.Server.SetTime(false, 0.0);
int wave = 1;
if (args.Parameters.Count != 0)
int.TryParse(args.Parameters[0], out wave);
Main.snowMoon = true;
Main.pumpkinMoon = false;
Main.bloodMoon = false;
if (Main.netMode != 1)
{
NPC.waveKills = 0f;
NPC.waveCount = 1;
string text = "Snow Invasion started at wave: " + wave;
if (Main.netMode == 0)
{
Main.NewText(text, 175, 75, 255, false);
return;
}
if (Main.netMode == 2)
{
NetMessage.SendData(25, -1, -1, text, 255, 175f, 75f, 255f, 0);
}
}
}
private static void Hardmode(CommandArgs args) private static void Hardmode(CommandArgs args)
{ {
if (Main.hardMode) if (Main.hardMode)

View file

@ -3216,6 +3216,7 @@ namespace TShockAPI
case -2: case -2:
case -3: case -3:
case -4: case -4:
case -5:
invasion = true; invasion = true;
break; break;
case 4: case 4:
@ -3226,6 +3227,7 @@ namespace TShockAPI
case 125: case 125:
case 126: case 126:
case 127: case 127:
case 128:
case 134: case 134:
case 222: case 222:
case 245: case 245:
@ -3254,6 +3256,9 @@ namespace TShockAPI
string boss; string boss;
switch (Type) switch (Type)
{ {
case -5:
boss = "a snow invasion";
break;
case -4: case -4:
boss = "a pumpkin invasion"; boss = "a pumpkin invasion";
break; break;

View file

@ -227,6 +227,12 @@ namespace TShockAPI
[Description("User can force a blood moon.")] [Description("User can force a blood moon.")]
public static readonly string bloodmoon = "tshock.world.time.bloodmoon"; public static readonly string bloodmoon = "tshock.world.time.bloodmoon";
[Description("User can force a pumpkin moon.")]
public static readonly string pumpkinmoon = "tshock.world.time.pumpkinmoon";
[Description("User can force a snow moon.")]
public static readonly string snowmoon = "tshock.world.time.snowmoon";
[Description("User can set the time.")] [Description("User can set the time.")]
public static readonly string time = "tshock.world.time.set"; public static readonly string time = "tshock.world.time.set";

View file

@ -1196,6 +1196,18 @@ namespace TShockAPI
SetTime(false, 0); SetTime(false, 0);
} }
public void SetSnowMoon(bool snowMoon)
{
Main.snowMoon = snowMoon;
SetTime(false, 0);
}
public void SetPumpkinMoon(bool pumpkinMoon)
{
Main.pumpkinMoon = pumpkinMoon;
SetTime(false, 0);
}
public void SetEclipse(bool Eclipse) public void SetEclipse(bool Eclipse)
{ {
Main.eclipse = Eclipse; Main.eclipse = Eclipse;