Removed lua, because it shouldnt be here.
Attempted hotfix of trashcan abuse. User's inventory shouldn't be saved if they are being nagged about logging out.
This commit is contained in:
parent
491eafd484
commit
4c4cd4027d
6 changed files with 153 additions and 285 deletions
|
|
@ -134,6 +134,7 @@ namespace TShockAPI
|
|||
add(Permissions.maintenance, CheckUpdates, "checkupdates");
|
||||
add(Permissions.causeevents, DropMeteor, "dropmeteor");
|
||||
add(Permissions.causeevents, Star, "star");
|
||||
add(Permissions.causeevents, Ore, "genore");
|
||||
add(Permissions.causeevents, Fullmoon, "fullmoon");
|
||||
add(Permissions.causeevents, Bloodmoon, "bloodmoon");
|
||||
add(Permissions.causeevents, Invade, "invade");
|
||||
|
|
@ -211,10 +212,6 @@ namespace TShockAPI
|
|||
add(Permissions.cfg, ServerInfo, "stats");
|
||||
add(Permissions.converthardmode, ConvertCorruption, "convertcorruption");
|
||||
add(Permissions.converthardmode, ConvertHallow, "converthallow");
|
||||
add(Permissions.runlua, RunLuaFile, "luarun");
|
||||
add(Permissions.runlua, RunLuaString, "lua");
|
||||
add(Permissions.runlua, ReloadLua, "luareload");
|
||||
add(Permissions.runlua, TestLuaHook, "testhook");
|
||||
}
|
||||
|
||||
public static bool HandleCommand(TSPlayer player, string text)
|
||||
|
|
@ -332,43 +329,6 @@ namespace TShockAPI
|
|||
return c == ' ' || c == '\t' || c == '\n';
|
||||
}
|
||||
|
||||
#region Lua Commands
|
||||
|
||||
public static void TestLuaHook(CommandArgs args)
|
||||
{
|
||||
TShock.LuaLoader.HookCalls.OnHookTest();
|
||||
}
|
||||
|
||||
public static void ReloadLua(CommandArgs args)
|
||||
{
|
||||
TShock.LuaLoader.LoadServerAutoruns();
|
||||
args.Player.SendMessage("Lua reloaded.");
|
||||
}
|
||||
|
||||
public static void RunLuaString(CommandArgs args)
|
||||
{
|
||||
|
||||
if (args.Parameters.Count < 1)
|
||||
{
|
||||
args.Player.SendMessage("Syntax: /lua <lua>");
|
||||
return;
|
||||
}
|
||||
|
||||
TShock.LuaLoader.RunLuaString(args.Parameters[0]);
|
||||
args.Player.SendMessage("Lua run: " + args.Parameters[0]);
|
||||
}
|
||||
|
||||
public static void RunLuaFile(CommandArgs args)
|
||||
{
|
||||
if (args.Parameters.Count != 1)
|
||||
{
|
||||
args.Player.SendMessage("Syntax: /luarun <file>");
|
||||
return;
|
||||
}
|
||||
TShock.LuaLoader.RunLuaFile(args.Parameters[0]);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Account commands
|
||||
|
||||
public static void AttemptLogin(CommandArgs args)
|
||||
|
|
@ -437,10 +397,12 @@ namespace TShockAPI
|
|||
args.Player.IsLoggedIn = true;
|
||||
args.Player.IgnoreActionsForInventory = "none";
|
||||
|
||||
args.Player.PlayerData.CopyInventory(args.Player);
|
||||
TShock.InventoryDB.InsertPlayerData(args.Player);
|
||||
|
||||
args.Player.SendMessage("Authenticated as " + user.Name + " successfully.", Color.LimeGreen);
|
||||
if (!args.Player.IgnoreActionsForClearingTrashCan)
|
||||
{
|
||||
args.Player.PlayerData.CopyInventory(args.Player);
|
||||
TShock.InventoryDB.InsertPlayerData(args.Player);
|
||||
}
|
||||
args.Player.SendMessage("Authenticated as " + user.Name + " successfully.", Color.LimeGreen);
|
||||
Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user: " + user.Name);
|
||||
}
|
||||
else
|
||||
|
|
@ -1023,6 +985,114 @@ namespace TShockAPI
|
|||
Projectile.NewProjectile(vector.X, vector.Y, speedX, speedY, 12, 0x3e8, 10f, Main.myPlayer);
|
||||
}
|
||||
|
||||
private static void Ore(CommandArgs args)
|
||||
{
|
||||
if (WorldGen.genRand == null)
|
||||
WorldGen.genRand = new Random();
|
||||
|
||||
TSPlayer ply = args.Player;
|
||||
|
||||
|
||||
|
||||
int num = WorldGen.altarCount % 3;
|
||||
int num2 = WorldGen.altarCount / 3 + 1;
|
||||
float num3 = (float)(Main.maxTilesX / 4200);
|
||||
int num4 = 1 - num;
|
||||
num3 = num3 * 310f - (float)(85 * num);
|
||||
num3 *= 0.85f;
|
||||
num3 /= (float)num2;
|
||||
|
||||
if (args.Parameters.Count < 1)
|
||||
{
|
||||
ply.SendMessage("Picking a random ore!", Color.Green);
|
||||
num = WorldGen.genRand.Next(2);
|
||||
}
|
||||
else if (args.Parameters[0] == "cobalt")
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
else if (args.Parameters[0] == "mythril")
|
||||
{
|
||||
num = 1;
|
||||
}
|
||||
else if (args.Parameters[0] == "cobalt")
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = 2;
|
||||
}
|
||||
|
||||
if (num == 0)
|
||||
{
|
||||
num = 107;
|
||||
num3 *= 1.05f;
|
||||
}
|
||||
else if (num == 1)
|
||||
{
|
||||
num = 108;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = 111;
|
||||
}
|
||||
|
||||
if (args.Parameters[0] == "iron")
|
||||
{
|
||||
num = 11;
|
||||
}
|
||||
else if (args.Parameters[0] == "gold")
|
||||
{
|
||||
num = 13;
|
||||
}
|
||||
else if (args.Parameters[0] == "silver")
|
||||
{
|
||||
num = 14;
|
||||
}
|
||||
else if (args.Parameters[0] == "copper")
|
||||
{
|
||||
num = 12;
|
||||
}
|
||||
else if (args.Parameters[0] == "demonite")
|
||||
{
|
||||
num = 22;
|
||||
}
|
||||
else if (args.Parameters[0] == "meteorite")
|
||||
{
|
||||
num = 116;
|
||||
}
|
||||
else if (args.Parameters[0] == "hellstone")
|
||||
{
|
||||
num = 58;
|
||||
}
|
||||
|
||||
if (args.Parameters.Count > 1)
|
||||
{
|
||||
float.TryParse(args.Parameters[1], out num3);
|
||||
//num3 = Math.Min(num3, 1000f);
|
||||
}
|
||||
|
||||
int num5 = 0;
|
||||
while ((float)num5 < num3)
|
||||
{
|
||||
int i2 = WorldGen.genRand.Next(100, Main.maxTilesX - 100);
|
||||
double num6 = Main.worldSurface;
|
||||
if (num == 108)
|
||||
{
|
||||
num6 = Main.rockLayer;
|
||||
}
|
||||
if (num == 111)
|
||||
{
|
||||
num6 = (Main.rockLayer + Main.rockLayer + (double)Main.maxTilesY) / 3.0;
|
||||
}
|
||||
int j2 = WorldGen.genRand.Next((int)num6, Main.maxTilesY - 150);
|
||||
WorldGen.OreRunner(i2, j2, 20.0, 20, num);
|
||||
num5++;
|
||||
}
|
||||
ply.SendMessage(String.Format("Spawned {0} tiles of {1}", Math.Floor(num3), num), Color.Green );
|
||||
}
|
||||
|
||||
private static void Fullmoon(CommandArgs args)
|
||||
{
|
||||
TSPlayer.Server.SetFullMoon(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue