Add /converthallow and /convertcorruption

Converts hallow/corruption tiles to their counterpart worldwide.
This commit is contained in:
Deathmax 2011-12-18 21:19:43 +08:00
parent c8c2307935
commit 283dec89a0
2 changed files with 57 additions and 0 deletions

View file

@ -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

View file

@ -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())