Add /converthallow and /convertcorruption
Converts hallow/corruption tiles to their counterpart worldwide.
This commit is contained in:
parent
c8c2307935
commit
283dec89a0
2 changed files with 57 additions and 0 deletions
|
|
@ -198,6 +198,8 @@ namespace TShockAPI
|
||||||
add(Permissions.hardmode, StartHardMode, "hardmode");
|
add(Permissions.hardmode, StartHardMode, "hardmode");
|
||||||
add(Permissions.hardmode, DisableHardMode, "stophardmode", "disablehardmode");
|
add(Permissions.hardmode, DisableHardMode, "stophardmode", "disablehardmode");
|
||||||
add(Permissions.cfg, ServerInfo, "stats");
|
add(Permissions.cfg, ServerInfo, "stats");
|
||||||
|
add(Permissions.converthardmode, ConvertCorruption, "convertcorruption");
|
||||||
|
add(Permissions.converthardmode, ConvertHallow, "converthallow");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HandleCommand(TSPlayer player, string text)
|
public static bool HandleCommand(TSPlayer player, string text)
|
||||||
|
|
@ -1223,6 +1225,58 @@ namespace TShockAPI
|
||||||
Main.hardMode = false;
|
Main.hardMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ConvertCorruption(CommandArgs args)
|
||||||
|
{
|
||||||
|
TShock.Utils.Broadcast("Server is might lag for a moment.", Color.Red);
|
||||||
|
for (int x = 0; x < Main.maxTilesX; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < Main.maxTilesY; y++)
|
||||||
|
{
|
||||||
|
switch (Main.tile[x, y].type)
|
||||||
|
{
|
||||||
|
case 25:
|
||||||
|
Main.tile[x, y].type = 117;
|
||||||
|
break;
|
||||||
|
case 23:
|
||||||
|
Main.tile[x, y].type = 109;
|
||||||
|
break;
|
||||||
|
case 112:
|
||||||
|
Main.tile[x, y].type = 116;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TShock.Utils.Broadcast("Corruption conversion done.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ConvertHallow(CommandArgs args)
|
||||||
|
{
|
||||||
|
TShock.Utils.Broadcast("Server is might lag for a moment.", Color.Red);
|
||||||
|
for (int x = 0; x < Main.maxTilesX; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < Main.maxTilesY; y++)
|
||||||
|
{
|
||||||
|
switch (Main.tile[x, y].type)
|
||||||
|
{
|
||||||
|
case 117:
|
||||||
|
Main.tile[x, y].type = 25;
|
||||||
|
break;
|
||||||
|
case 109:
|
||||||
|
Main.tile[x, y].type = 23;
|
||||||
|
break;
|
||||||
|
case 116:
|
||||||
|
Main.tile[x, y].type = 112;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TShock.Utils.Broadcast("Hallow conversion done.");
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Cause Events and Spawn Monsters Commands
|
#endregion Cause Events and Spawn Monsters Commands
|
||||||
|
|
||||||
#region Teleport Commands
|
#region Teleport Commands
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,9 @@ namespace TShockAPI
|
||||||
[Description("Users can tp to anyone")]
|
[Description("Users can tp to anyone")]
|
||||||
public static readonly string tpall;
|
public static readonly string tpall;
|
||||||
|
|
||||||
|
[Description("User can convert hallow into corruption and vice-versa")]
|
||||||
|
public static readonly string converthardmode;
|
||||||
|
|
||||||
static Permissions()
|
static Permissions()
|
||||||
{
|
{
|
||||||
foreach (var field in typeof(Permissions).GetFields())
|
foreach (var field in typeof(Permissions).GetFields())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue