Remove more obsolete code; fix tab/space screwup in TSPlayer

This commit is contained in:
Lucas Nicodemus 2015-02-28 19:37:06 -07:00
parent 78c6f4db84
commit cbce64f1eb
13 changed files with 329 additions and 340 deletions

View file

@ -72,7 +72,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return null; return null;
} }
@ -96,7 +96,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.StackTrace);
} }
return null; return null;
@ -123,7 +123,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return null; return null;
} }
@ -145,7 +145,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return null; return null;
} }
@ -167,7 +167,7 @@ namespace TShockAPI.DB
{ {
if (exceptions) if (exceptions)
throw ex; throw ex;
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }
@ -193,7 +193,7 @@ namespace TShockAPI.DB
{ {
if (exceptions) if (exceptions)
throw ex; throw ex;
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }
@ -206,7 +206,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }

View file

@ -95,7 +95,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return playerData; return playerData;
@ -137,7 +137,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
@ -162,7 +162,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
} }
else else
@ -176,7 +176,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
} }
return false; return false;
@ -191,7 +191,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;

View file

@ -137,7 +137,7 @@ namespace TShockAPI.DB
var error = "Invalid parent {0} for group {1}".SFormat(parentname, group.Name); var error = "Invalid parent {0} for group {1}".SFormat(parentname, group.Name);
if (exceptions) if (exceptions)
throw new GroupManagerException(error); throw new GroupManagerException(error);
Log.ConsoleError(error); TShock.Log.ConsoleError(error);
return error; return error;
} }
group.Parent = parent; group.Parent = parent;
@ -298,7 +298,7 @@ namespace TShockAPI.DB
string groupName = reader.Get<string>("GroupName"); string groupName = reader.Get<string>("GroupName");
if (groupName == "superadmin") if (groupName == "superadmin")
{ {
Log.ConsoleInfo("WARNING: Group \"superadmin\" is defined in the database even though it's a reserved group name."); TShock.Log.ConsoleInfo("WARNING: Group \"superadmin\" is defined in the database even though it's a reserved group name.");
continue; continue;
} }
@ -314,7 +314,7 @@ namespace TShockAPI.DB
catch (ArgumentException) catch (ArgumentException)
{ {
// Just in case somebody messed with the unique primary key. // Just in case somebody messed with the unique primary key.
Log.ConsoleError("ERROR: Group name \"{0}\" occurs more than once. Keeping current group settings."); TShock.Log.ConsoleError("ERROR: Group name \"{0}\" occurs more than once. Keeping current group settings.");
return; return;
} }
} }
@ -349,14 +349,14 @@ namespace TShockAPI.DB
group.Parent = groups.FirstOrDefault(g => g.Name == parentGroupName); group.Parent = groups.FirstOrDefault(g => g.Name == parentGroupName);
if (group.Parent == null) if (group.Parent == null)
{ {
Log.ConsoleError( TShock.Log.ConsoleError(
"ERROR: Group \"{0}\" is referencing non existent parent group \"{1}\", parent reference was removed.", "ERROR: Group \"{0}\" is referencing non existent parent group \"{1}\", parent reference was removed.",
group.Name, parentGroupName); group.Name, parentGroupName);
} }
else else
{ {
if (group.Parent == group) if (group.Parent == group)
Log.ConsoleInfo( TShock.Log.ConsoleInfo(
"WARNING: Group \"{0}\" is referencing itself as parent group, parent reference was removed.", group.Name); "WARNING: Group \"{0}\" is referencing itself as parent group, parent reference was removed.", group.Name);
List<Group> groupChain = new List<Group> { group }; List<Group> groupChain = new List<Group> { group };
@ -365,7 +365,7 @@ namespace TShockAPI.DB
{ {
if (groupChain.Contains(checkingGroup.Parent)) if (groupChain.Contains(checkingGroup.Parent))
{ {
Log.ConsoleError( TShock.Log.ConsoleError(
"ERROR: Group \"{0}\" is referencing parent group \"{1}\" which is already part of the parent chain. Parent reference removed.", "ERROR: Group \"{0}\" is referencing parent group \"{1}\" which is already part of the parent chain. Parent reference removed.",
checkingGroup.Name, checkingGroup.Parent.Name); checkingGroup.Name, checkingGroup.Parent.Name);
@ -386,7 +386,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.ConsoleError("Error on reloading groups: " + ex); TShock.Log.ConsoleError("Error on reloading groups: " + ex);
} }
} }
} }

View file

@ -72,7 +72,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
} }
@ -87,7 +87,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
} }
@ -131,7 +131,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
} }
@ -155,7 +155,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
} }
return false; return false;

View file

@ -94,15 +94,15 @@ namespace TShockAPI.DB
if (Int32.TryParse(splitids[i], out id)) // if unparsable, it's not an int, so silently skip if (Int32.TryParse(splitids[i], out id)) // if unparsable, it's not an int, so silently skip
r.AllowedIDs.Add(id); r.AllowedIDs.Add(id);
else else
Log.Warn("One of your UserIDs is not a usable integer: " + splitids[i]); TShock.Log.Warn("One of your UserIDs is not a usable integer: " + splitids[i]);
} }
} }
catch (Exception e) catch (Exception e)
{ {
Log.Error("Your database contains invalid UserIDs (they should be ints)."); TShock.Log.Error("Your database contains invalid UserIDs (they should be ints).");
Log.Error("A lot of things will fail because of this. You must manually delete and re-create the allowed field."); TShock.Log.Error("A lot of things will fail because of this. You must manually delete and re-create the allowed field.");
Log.Error(e.ToString()); TShock.Log.Error(e.ToString());
Log.Error(e.StackTrace); TShock.Log.Error(e.StackTrace);
} }
Regions.Add(r); Regions.Add(r);
@ -111,7 +111,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
} }
@ -131,7 +131,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }
@ -147,7 +147,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }
@ -165,7 +165,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
return false; return false;
} }
} }
@ -182,7 +182,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
return false; return false;
} }
} }
@ -308,7 +308,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }
@ -363,7 +363,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }
@ -390,7 +390,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }
@ -413,7 +413,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return regions; return regions;
} }
@ -518,7 +518,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
return false; return false;
} }
} }
@ -584,7 +584,7 @@ namespace TShockAPI.DB
{ {
if (!ply.HasBeenNaggedAboutLoggingIn) if (!ply.HasBeenNaggedAboutLoggingIn)
{ {
ply.SendMessage("You must be logged in to take advantage of protected regions.", Color.Red); ply.SendMessage("You must be TShock.Logged in to take advantage of protected regions.", Color.Red);
ply.HasBeenNaggedAboutLoggingIn = true; ply.HasBeenNaggedAboutLoggingIn = true;
} }
return false; return false;

View file

@ -72,7 +72,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
} }
@ -87,7 +87,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
} }
@ -131,7 +131,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
} }
@ -155,7 +155,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
} }
return false; return false;

View file

@ -74,7 +74,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }
@ -117,7 +117,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }
@ -162,7 +162,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }
@ -186,7 +186,7 @@ namespace TShockAPI.DB
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }

View file

@ -213,7 +213,7 @@ namespace Rests
object result = cmd.Execute(verbs, parms, request); object result = cmd.Execute(verbs, parms, request);
if (cmd.DoLog && TShock.Config.LogRest) if (cmd.DoLog && TShock.Config.LogRest)
{ {
Log.ConsoleInfo("Anonymous requested REST endpoint: " + BuildRequestUri(cmd, verbs, parms, false)); TShock.Log.ConsoleInfo("Anonymous requested REST endpoint: " + BuildRequestUri(cmd, verbs, parms, false));
} }
return result; return result;

View file

@ -179,7 +179,7 @@ namespace TShockAPI
var msg = args.Parameters["msg"]; var msg = args.Parameters["msg"];
if (string.IsNullOrWhiteSpace(msg)) if (string.IsNullOrWhiteSpace(msg))
return RestMissingParam("msg"); return RestMissingParam("msg");
TShock.Utils.Broadcast(msg); TSPlayer.All.SendInfoMessage(msg);
return RestResponse("The message was broadcasted successfully"); return RestResponse("The message was broadcasted successfully");
} }
@ -660,7 +660,7 @@ namespace TShockAPI
TSPlayer player = (TSPlayer)ret; TSPlayer player = (TSPlayer)ret;
player.DamagePlayer(999999); player.DamagePlayer(999999);
var from = string.IsNullOrWhiteSpace(args.Parameters["from"]) ? "Server Admin" : args.Parameters["from"]; var from = string.IsNullOrWhiteSpace(args.Parameters["from"]) ? "Server Admin" : args.Parameters["from"];
player.SendMessage(string.Format("{0} just killed you!", from)); player.SendInfoMessage(string.Format("{0} just killed you!", from));
return RestResponse("Player " + player.Name + " was killed"); return RestResponse("Player " + player.Name + " was killed");
} }
@ -916,7 +916,7 @@ namespace TShockAPI
TSPlayer player = (TSPlayer)ret; TSPlayer player = (TSPlayer)ret;
player.mute = mute; player.mute = mute;
var verb = mute ? "muted" : "unmuted"; var verb = mute ? "muted" : "unmuted";
player.SendMessage("You have been remotely " + verb); player.SendInfoMessage("You have been remotely " + verb);
return RestResponse("Player " + player.Name + " was " + verb); return RestResponse("Player " + player.Name + " was " + verb);
} }

View file

@ -68,7 +68,7 @@ namespace Rests
"The old model will be removed with the next maintenance release of TShock. In order to switch to the new model, ", "The old model will be removed with the next maintenance release of TShock. In order to switch to the new model, ",
"change the config setting \"RestUseNewPermissionModel\" to true." "change the config setting \"RestUseNewPermissionModel\" to true."
); );
Log.Warn(warningMessage); TShock.Log.Warn(warningMessage);
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(warningMessage); Console.WriteLine(warningMessage);
Console.ForegroundColor = ConsoleColor.Gray; Console.ForegroundColor = ConsoleColor.Gray;
@ -80,7 +80,7 @@ namespace Rests
"with existing REST services. If compatibility problems occur, you can switch back to the unsecure permission ", "with existing REST services. If compatibility problems occur, you can switch back to the unsecure permission ",
"model by changing the config setting \"RestUseNewPermissionModel\" to false, which is not recommended." "model by changing the config setting \"RestUseNewPermissionModel\" to false, which is not recommended."
); );
Log.ConsoleInfo(warningMessage); TShock.Log.ConsoleInfo(warningMessage);
} }
} }

View file

@ -130,7 +130,7 @@ namespace TShockAPI
else else
WorldFile.saveWorld(task.resetTime); WorldFile.saveWorld(task.resetTime);
TShock.Utils.Broadcast("World saved.", Color.Yellow); TShock.Utils.Broadcast("World saved.", Color.Yellow);
Log.Info(string.Format("World saved at ({0})", Main.worldPathName)); TShock.Log.Info(string.Format("World saved at ({0})", Main.worldPathName));
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -30,29 +30,29 @@ namespace TShockAPI
{ {
public class TSPlayer public class TSPlayer
{ {
/// <summary> /// <summary>
/// This represents the server as a player. /// This represents the server as a player.
/// </summary> /// </summary>
public static readonly TSServerPlayer Server = new TSServerPlayer(); public static readonly TSServerPlayer Server = new TSServerPlayer();
/// <summary> /// <summary>
/// This player represents all the players. /// This player represents all the players.
/// </summary> /// </summary>
public static readonly TSPlayer All = new TSPlayer("All"); public static readonly TSPlayer All = new TSPlayer("All");
/// <summary> /// <summary>
/// The amount of tiles that the player has killed in the last second. /// The amount of tiles that the player has killed in the last second.
/// </summary> /// </summary>
public int TileKillThreshold { get; set; } public int TileKillThreshold { get; set; }
/// <summary> /// <summary>
/// The amount of tiles the player has placed in the last second. /// The amount of tiles the player has placed in the last second.
/// </summary> /// </summary>
public int TilePlaceThreshold { get; set; } public int TilePlaceThreshold { get; set; }
/// <summary> /// <summary>
/// The amount of liquid (in tiles) that the player has placed in the last second. /// The amount of liquid (in tiles) that the player has placed in the last second.
/// </summary> /// </summary>
public int TileLiquidThreshold { get; set; } public int TileLiquidThreshold { get; set; }
/// <summary> /// <summary>
@ -60,9 +60,9 @@ namespace TShockAPI
/// </summary> /// </summary>
public int PaintThreshold { get; set; } public int PaintThreshold { get; set; }
/// <summary> /// <summary>
/// The number of projectiles created by the player in the last second. /// The number of projectiles created by the player in the last second.
/// </summary> /// </summary>
public int ProjectileThreshold { get; set; } public int ProjectileThreshold { get; set; }
/// <summary> /// <summary>
@ -83,130 +83,130 @@ namespace TShockAPI
public int sX = -1; public int sX = -1;
public int sY = -1; public int sY = -1;
/// <summary> /// <summary>
/// A queue of tiles destroyed by the player for reverting. /// A queue of tiles destroyed by the player for reverting.
/// </summary> /// </summary>
public Dictionary<Vector2, Tile> TilesDestroyed { get; protected set; } public Dictionary<Vector2, Tile> TilesDestroyed { get; protected set; }
/// <summary> /// <summary>
/// A queue of tiles placed by the player for reverting. /// A queue of tiles placed by the player for reverting.
/// </summary> /// </summary>
public Dictionary<Vector2, Tile> TilesCreated { get; protected set; } public Dictionary<Vector2, Tile> TilesCreated { get; protected set; }
/// <summary> /// <summary>
/// The player's group. /// The player's group.
/// </summary> /// </summary>
public Group Group public Group Group
{ {
get get
{ {
if (tempGroup != null) if (tempGroup != null)
return tempGroup; return tempGroup;
return group; return group;
} }
set { group = value; } set { group = value; }
} }
/// <summary> /// <summary>
/// The player's temporary group. This overrides the user's actual group. /// The player's temporary group. This overrides the user's actual group.
/// </summary> /// </summary>
public Group tempGroup = null; public Group tempGroup = null;
private Group group = null; private Group group = null;
public bool ReceivedInfo { get; set; } public bool ReceivedInfo { get; set; }
/// <summary> /// <summary>
/// The players index in the player array( Main.players[] ). /// The players index in the player array( Main.players[] ).
/// </summary> /// </summary>
public int Index { get; protected set; } public int Index { get; protected set; }
/// <summary> /// <summary>
/// The last time the player changed their team or pvp status. /// The last time the player changed their team or pvp status.
/// </summary> /// </summary>
public DateTime LastPvPTeamChange; public DateTime LastPvPTeamChange;
/// <summary> /// <summary>
/// Temp points for use in regions and other plugins. /// Temp points for use in regions and other plugins.
/// </summary> /// </summary>
public Point[] TempPoints = new Point[2]; public Point[] TempPoints = new Point[2];
/// <summary> /// <summary>
/// Whether the player is waiting to place/break a tile to set as a temp point. /// Whether the player is waiting to place/break a tile to set as a temp point.
/// </summary> /// </summary>
public int AwaitingTempPoint { get; set; } public int AwaitingTempPoint { get; set; }
/// <summary> /// <summary>
/// A list of command callbacks indexed by the command they need to do. /// A list of command callbacks indexed by the command they need to do.
/// </summary> /// </summary>
public Dictionary<string, Action<object>> AwaitingResponse; public Dictionary<string, Action<object>> AwaitingResponse;
public bool AwaitingName { get; set; } public bool AwaitingName { get; set; }
public string[] AwaitingNameParameters { get; set; } public string[] AwaitingNameParameters { get; set; }
/// <summary> /// <summary>
/// The last time a player broke a grief check. /// The last time a player broke a grief check.
/// </summary> /// </summary>
public DateTime LastThreat { get; set; } public DateTime LastThreat { get; set; }
public bool InitSpawn; public bool InitSpawn;
/// <summary> /// <summary>
/// Whether the player should see logs. /// Whether the player should see logs.
/// </summary> /// </summary>
public bool DisplayLogs = true; public bool DisplayLogs = true;
/// <summary> /// <summary>
/// The last player that the player whispered with (to or from). /// The last player that the player whispered with (to or from).
/// </summary> /// </summary>
public TSPlayer LastWhisper; public TSPlayer LastWhisper;
/// <summary> /// <summary>
/// The number of unsuccessful login attempts. /// The number of unsuccessful login attempts.
/// </summary> /// </summary>
public int LoginAttempts { get; set; } public int LoginAttempts { get; set; }
public Vector2 TeleportCoords = new Vector2(-1, -1); public Vector2 TeleportCoords = new Vector2(-1, -1);
public Vector2 LastNetPosition = Vector2.Zero; public Vector2 LastNetPosition = Vector2.Zero;
/// <summary> /// <summary>
/// The player's login name. /// The player's login name.
/// </summary> /// </summary>
public string UserAccountName { get; set; } public string UserAccountName { get; set; }
/// <summary> /// <summary>
/// Whether the player performed a valid login attempt (i.e. entered valid user name and password) but is still blocked /// Whether the player performed a valid login attempt (i.e. entered valid user name and password) but is still blocked
/// from logging in because of SSI. /// from logging in because of SSI.
/// </summary> /// </summary>
public bool LoginFailsBySsi { get; set; } public bool LoginFailsBySsi { get; set; }
/// <summary> /// <summary>
/// Whether the player is logged in or not. /// Whether the player is logged in or not.
/// </summary> /// </summary>
public bool IsLoggedIn; public bool IsLoggedIn;
/// <summary> /// <summary>
/// Whether the player has sent their whole inventory to the server while connecting. /// Whether the player has sent their whole inventory to the server while connecting.
/// </summary> /// </summary>
public bool HasSentInventory { get; set; } public bool HasSentInventory { get; set; }
/// <summary> /// <summary>
/// The player's user id( from the db ). /// The player's user id( from the db ).
/// </summary> /// </summary>
public int UserID = -1; public int UserID = -1;
/// <summary> /// <summary>
/// Whether the player has been nagged about logging in. /// Whether the player has been nagged about logging in.
/// </summary> /// </summary>
public bool HasBeenNaggedAboutLoggingIn; public bool HasBeenNaggedAboutLoggingIn;
public bool TPAllow = true; public bool TPAllow = true;
/// <summary> /// <summary>
/// Whether the player is muted or not. /// Whether the player is muted or not.
/// </summary> /// </summary>
public bool mute; public bool mute;
private Player FakePlayer; private Player FakePlayer;
@ -218,16 +218,16 @@ namespace TShockAPI
/// </summary> /// </summary>
public int RespawnTimer; public int RespawnTimer;
/// <summary> /// <summary>
/// Whether the player is dead or not. /// Whether the player is dead or not.
/// </summary> /// </summary>
public bool Dead; public bool Dead;
public string Country = "??"; public string Country = "??";
/// <summary> /// <summary>
/// The players difficulty( normal[softcore], mediumcore, hardcore ). /// The players difficulty( normal[softcore], mediumcore, hardcore ).
/// </summary> /// </summary>
public int Difficulty; public int Difficulty;
private string CacheIP; private string CacheIP;
@ -240,53 +240,53 @@ namespace TShockAPI
public bool IgnoreActionsForClearingTrashCan; public bool IgnoreActionsForClearingTrashCan;
/// <summary> /// <summary>
/// The player's server side inventory data. /// The player's server side inventory data.
/// </summary> /// </summary>
public PlayerData PlayerData; public PlayerData PlayerData;
/// <summary> /// <summary>
/// Whether the player needs to specify a password upon connection( either server or user account ). /// Whether the player needs to specify a password upon connection( either server or user account ).
/// </summary> /// </summary>
public bool RequiresPassword; public bool RequiresPassword;
public bool SilentKickInProgress; public bool SilentKickInProgress;
public bool SilentJoinInProgress; public bool SilentJoinInProgress;
/// <summary> /// <summary>
/// A list of points where ice tiles have been placed. /// A list of points where ice tiles have been placed.
/// </summary> /// </summary>
public List<Point> IceTiles; public List<Point> IceTiles;
/// <summary> /// <summary>
/// Unused, can be removed. /// Unused, can be removed.
/// </summary> /// </summary>
public long RPm = 1; public long RPm = 1;
/// <summary> /// <summary>
/// World protection message cool down. /// World protection message cool down.
/// </summary> /// </summary>
public long WPm = 1; public long WPm = 1;
/// <summary> /// <summary>
/// Spawn protection message cool down. /// Spawn protection message cool down.
/// </summary> /// </summary>
public long SPm = 1; public long SPm = 1;
/// <summary> /// <summary>
/// Permission to build message cool down. /// Permission to build message cool down.
/// </summary> /// </summary>
public long BPm = 1; public long BPm = 1;
/// <summary> /// <summary>
/// The time in ms when the player has logged in. /// The time in ms when the player has logged in.
/// </summary> /// </summary>
public long LoginMS; public long LoginMS;
/// <summary> /// <summary>
/// Whether the player has been harrassed about logging in due to server side inventory or forced login. /// Whether the player has been harrassed about logging in due to server side inventory or forced login.
/// </summary> /// </summary>
public bool LoginHarassed = false; public bool LoginHarassed = false;
/// <summary> /// <summary>
@ -304,9 +304,9 @@ namespace TShockAPI
/// </summary> /// </summary>
public int LastKilledProjectile = 0; public int LastKilledProjectile = 0;
/// <summary> /// <summary>
/// Whether the player is a real, human, player on the server. /// Whether the player is a real, human, player on the server.
/// </summary> /// </summary>
public bool RealPlayer public bool RealPlayer
{ {
get { return Index >= 0 && Index < Main.maxNetPlayers && Main.player[Index] != null; } get { return Index >= 0 && Index < Main.maxNetPlayers && Main.player[Index] != null; }
@ -317,7 +317,7 @@ namespace TShockAPI
get get
{ {
return RealPlayer && return RealPlayer &&
(Netplay.serverSock[Index] != null && Netplay.serverSock[Index].active && !Netplay.serverSock[Index].kill); (Netplay.serverSock[Index] != null && Netplay.serverSock[Index].active && !Netplay.serverSock[Index].kill);
} }
} }
@ -488,9 +488,9 @@ namespace TShockAPI
TilesDestroyed = new Dictionary<Vector2, Tile>(); TilesDestroyed = new Dictionary<Vector2, Tile>();
TilesCreated = new Dictionary<Vector2, Tile>(); TilesCreated = new Dictionary<Vector2, Tile>();
Index = index; Index = index;
Group = Group.DefaultGroup; Group = Group.DefaultGroup;
IceTiles = new List<Point>(); IceTiles = new List<Point>();
AwaitingResponse = new Dictionary<string, Action<object>>(); AwaitingResponse = new Dictionary<string, Action<object>>();
} }
protected TSPlayer(String playerName) protected TSPlayer(String playerName)
@ -499,8 +499,8 @@ namespace TShockAPI
TilesCreated = new Dictionary<Vector2, Tile>(); TilesCreated = new Dictionary<Vector2, Tile>();
Index = -1; Index = -1;
FakePlayer = new Player {name = playerName, whoAmi = -1}; FakePlayer = new Player {name = playerName, whoAmi = -1};
Group = Group.DefaultGroup; Group = Group.DefaultGroup;
AwaitingResponse = new Dictionary<string, Action<object>>(); AwaitingResponse = new Dictionary<string, Action<object>>();
} }
public virtual void Disconnect(string reason) public virtual void Disconnect(string reason)
@ -622,7 +622,6 @@ namespace TShockAPI
public void Spawn() public void Spawn()
{ {
// TPlayer.FindSpawn();
if (this.sX > 0 && this.sY > 0) if (this.sX > 0 && this.sY > 0)
{ {
Spawn(this.sX, this.sY); Spawn(this.sX, this.sY);
@ -662,8 +661,8 @@ namespace TShockAPI
} }
} }
public virtual bool SendTileSquare(int x, int y, int size = 10) public virtual bool SendTileSquare(int x, int y, int size = 10)
{ {
try try
{ {
int num = (size - 1)/2; int num = (size - 1)/2;
@ -710,19 +709,19 @@ namespace TShockAPI
TShock.Log.Error(ex.ToString()); TShock.Log.Error(ex.ToString());
} }
return false; return false;
} }
public bool GiveItemCheck(int type, string name, int width, int height, int stack, int prefix = 0) public bool GiveItemCheck(int type, string name, int width, int height, int stack, int prefix = 0)
{ {
if ((TShock.Itembans.ItemIsBanned(name) && TShock.Config.PreventBannedItemSpawn) && if ((TShock.Itembans.ItemIsBanned(name) && TShock.Config.PreventBannedItemSpawn) &&
(TShock.Itembans.ItemIsBanned(name, this) || !TShock.Config.AllowAllowedGroupsToSpawnBannedItems)) (TShock.Itembans.ItemIsBanned(name, this) || !TShock.Config.AllowAllowedGroupsToSpawnBannedItems))
return false; return false;
GiveItem(type,name,width,height,stack,prefix); GiveItem(type,name,width,height,stack,prefix);
return true; return true;
} }
public virtual void GiveItem(int type, string name, int width, int height, int stack, int prefix = 0) public virtual void GiveItem(int type, string name, int width, int height, int stack, int prefix = 0)
{ {
int itemid = Item.NewItem((int) X, (int) Y, width, height, type, stack, true, prefix, true); int itemid = Item.NewItem((int) X, (int) Y, width, height, type, stack, true, prefix, true);
@ -730,7 +729,7 @@ namespace TShockAPI
Main.item[itemid].SetDefaults(name); Main.item[itemid].SetDefaults(name);
// The set default overrides the wet and stack set by NewItem // The set default overrides the wet and stack set by NewItem
Main.item[itemid].wet = Collision.WetCollision(Main.item[itemid].position, Main.item[itemid].width, Main.item[itemid].wet = Collision.WetCollision(Main.item[itemid].position, Main.item[itemid].width,
Main.item[itemid].height); Main.item[itemid].height);
Main.item[itemid].stack = stack; Main.item[itemid].stack = stack;
Main.item[itemid].owner = Index; Main.item[itemid].owner = Index;
Main.item[itemid].prefix = (byte) prefix; Main.item[itemid].prefix = (byte) prefix;
@ -740,47 +739,47 @@ namespace TShockAPI
NetMessage.SendData((int)PacketTypes.ItemOwner, -1, -1, "", itemid, 0f, 0f, 0f); NetMessage.SendData((int)PacketTypes.ItemOwner, -1, -1, "", itemid, 0f, 0f, 0f);
} }
public virtual void SendInfoMessage(string msg) public virtual void SendInfoMessage(string msg)
{ {
SendMessage(msg, Color.Yellow); SendMessage(msg, Color.Yellow);
} }
public void SendInfoMessage(string format, params object[] args) public void SendInfoMessage(string format, params object[] args)
{ {
SendInfoMessage(string.Format(format, args)); SendInfoMessage(string.Format(format, args));
} }
public virtual void SendSuccessMessage(string msg) public virtual void SendSuccessMessage(string msg)
{ {
SendMessage(msg, Color.Green); SendMessage(msg, Color.Green);
} }
public void SendSuccessMessage(string format, params object[] args) public void SendSuccessMessage(string format, params object[] args)
{ {
SendSuccessMessage(string.Format(format, args)); SendSuccessMessage(string.Format(format, args));
} }
public virtual void SendWarningMessage(string msg) public virtual void SendWarningMessage(string msg)
{ {
SendMessage(msg, Color.OrangeRed); SendMessage(msg, Color.OrangeRed);
} }
public void SendWarningMessage(string format, params object[] args) public void SendWarningMessage(string format, params object[] args)
{ {
SendWarningMessage(string.Format(format, args)); SendWarningMessage(string.Format(format, args));
} }
public virtual void SendErrorMessage(string msg) public virtual void SendErrorMessage(string msg)
{ {
SendMessage(msg, Color.Red); SendMessage(msg, Color.Red);
} }
public void SendErrorMessage(string format, params object[] args) public void SendErrorMessage(string format, params object[] args)
{ {
SendErrorMessage(string.Format(format, args)); SendErrorMessage(string.Format(format, args));
} }
[Obsolete("Use SendErrorMessage, SendInfoMessage, or SendWarningMessage, or a custom color instead.")] [Obsolete("Use SendErrorMessage, SendInfoMessage, or SendWarningMessage, or a custom color instead.")]
public virtual void SendMessage(string msg) public virtual void SendMessage(string msg)
{ {
SendMessage(msg, 0, 255, 0); SendMessage(msg, 0, 255, 0);
@ -796,10 +795,10 @@ namespace TShockAPI
SendData(PacketTypes.ChatText, msg, 255, red, green, blue); SendData(PacketTypes.ChatText, msg, 255, red, green, blue);
} }
public virtual void SendMessageFromPlayer(string msg, byte red, byte green, byte blue, int ply) public virtual void SendMessageFromPlayer(string msg, byte red, byte green, byte blue, int ply)
{ {
SendDataFromPlayer(PacketTypes.ChatText, ply, msg, red, green, blue, 0); SendDataFromPlayer(PacketTypes.ChatText, ply, msg, red, green, blue, 0);
} }
public virtual void DamagePlayer(int damage) public virtual void DamagePlayer(int damage)
{ {
@ -849,7 +848,7 @@ namespace TShockAPI
StackFrame frame = null; StackFrame frame = null;
frame = trace.GetFrame(1); frame = trace.GetFrame(1);
if (frame != null && frame.GetMethod().DeclaringType != null) if (frame != null && frame.GetMethod().DeclaringType != null)
Log.Debug(frame.GetMethod().DeclaringType.Name + " called Disable()."); TShock.Log.Debug(frame.GetMethod().DeclaringType.Name + " called Disable().");
} }
public virtual void Whoopie(object time) public virtual void Whoopie(object time)
@ -883,13 +882,13 @@ namespace TShockAPI
NetMessage.SendData((int) msgType, Index, -1, text, number, number2, number3, number4, number5); NetMessage.SendData((int) msgType, Index, -1, text, number, number2, number3, number4, number5);
} }
public virtual void SendDataFromPlayer(PacketTypes msgType, int ply, string text = "", float number2 = 0f, float number3 = 0f, float number4 = 0f, int number5 = 0) public virtual void SendDataFromPlayer(PacketTypes msgType, int ply, string text = "", float number2 = 0f, float number3 = 0f, float number4 = 0f, int number5 = 0)
{ {
if (RealPlayer && !ConnectionAlive) if (RealPlayer && !ConnectionAlive)
return; return;
NetMessage.SendData((int) msgType, Index, -1, text, ply, number2, number3, number4, number5); NetMessage.SendData((int) msgType, Index, -1, text, ply, number2, number3, number4, number5);
} }
public virtual void SendRawData(byte[] data) public virtual void SendRawData(byte[] data)
{ {
@ -898,20 +897,20 @@ namespace TShockAPI
NetMessage.SendBytes(Netplay.serverSock[Index], data, 0, data.Length, Netplay.serverSock[Index].ServerWriteCallBack, Netplay.serverSock[Index].networkStream); NetMessage.SendBytes(Netplay.serverSock[Index], data, 0, data.Length, Netplay.serverSock[Index].ServerWriteCallBack, Netplay.serverSock[Index].networkStream);
} }
/// <summary> /// <summary>
/// Adds a command callback to a specified command string. /// Adds a command callback to a specified command string.
/// </summary> /// </summary>
/// <param name="name">The string representing the command i.e "yes" == /yes</param> /// <param name="name">The string representing the command i.e "yes" == /yes</param>
/// <param name="callback">The method that will be executed on confirmation ie user accepts</param> /// <param name="callback">The method that will be executed on confirmation ie user accepts</param>
public void AddResponse( string name, Action<object> callback) public void AddResponse( string name, Action<object> callback)
{ {
if( AwaitingResponse.ContainsKey(name)) if( AwaitingResponse.ContainsKey(name))
{ {
AwaitingResponse.Remove(name); AwaitingResponse.Remove(name);
} }
AwaitingResponse.Add(name, callback); AwaitingResponse.Add(name, callback);
} }
} }
public class TSRestPlayer : TSPlayer public class TSRestPlayer : TSPlayer
@ -924,14 +923,9 @@ namespace TShockAPI
AwaitingResponse = new Dictionary<string, Action<object>>(); AwaitingResponse = new Dictionary<string, Action<object>>();
} }
public override void SendMessage(string msg)
{
SendMessage(msg, 0, 255, 0);
}
public override void SendMessage(string msg, Color color) public override void SendMessage(string msg, Color color)
{ {
SendMessage(msg, color.R, color.G, color.B); SendInfoMessage(msg, color.R, color.G, color.B);
} }
public override void SendMessage(string msg, byte red, byte green, byte blue) public override void SendMessage(string msg, byte red, byte green, byte blue)
@ -967,45 +961,40 @@ namespace TShockAPI
public class TSServerPlayer : TSPlayer public class TSServerPlayer : TSPlayer
{ {
public static string AccountName = "ServerConsole"; public static string AccountName = "ServerConsole";
public TSServerPlayer() public TSServerPlayer()
: base("Server") : base("Server")
{ {
Group = new SuperAdminGroup(); Group = new SuperAdminGroup();
UserAccountName = AccountName; UserAccountName = AccountName;
} }
public override void SendErrorMessage(string msg) public override void SendErrorMessage(string msg)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(msg);
Console.ResetColor();
}
public override void SendInfoMessage(string msg)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(msg);
Console.ResetColor();
}
public override void SendSuccessMessage(string msg)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(msg);
Console.ResetColor();
}
public override void SendWarningMessage(string msg)
{
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.WriteLine(msg);
Console.ResetColor();
}
public override void SendMessage(string msg)
{ {
SendMessage(msg, 0, 255, 0); Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(msg);
Console.ResetColor();
}
public override void SendInfoMessage(string msg)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(msg);
Console.ResetColor();
}
public override void SendSuccessMessage(string msg)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(msg);
Console.ResetColor();
}
public override void SendWarningMessage(string msg)
{
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.WriteLine(msg);
Console.ResetColor();
} }
public override void SendMessage(string msg, Color color) public override void SendMessage(string msg, Color color)
@ -1016,7 +1005,6 @@ namespace TShockAPI
public override void SendMessage(string msg, byte red, byte green, byte blue) public override void SendMessage(string msg, byte red, byte green, byte blue)
{ {
Console.WriteLine(msg); Console.WriteLine(msg);
//RconHandler.Response += msg + "\n";
} }
public void SetFullMoon() public void SetFullMoon()
@ -1093,7 +1081,7 @@ namespace TShockAPI
int spawnTileX; int spawnTileX;
int spawnTileY; int spawnTileY;
TShock.Utils.GetRandomClearTileWithInRange(startTileX, startTileY, tileXRange, tileYRange, out spawnTileX, TShock.Utils.GetRandomClearTileWithInRange(startTileX, startTileY, tileXRange, tileYRange, out spawnTileX,
out spawnTileY); out spawnTileY);
int npcid = NPC.NewNPC(spawnTileX*16, spawnTileY*16, type, 0); int npcid = NPC.NewNPC(spawnTileX*16, spawnTileY*16, type, 0);
// This is for special slimes // This is for special slimes
Main.npc[npcid].SetDefaults(name); Main.npc[npcid].SetDefaults(name);
@ -1407,19 +1395,19 @@ namespace TShockAPI
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[8].name, player.Index, 67f, (float)Main.player[player.Index].armor[8].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[8].name, player.Index, 67f, (float)Main.player[player.Index].armor[8].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[9].name, player.Index, 68f, (float)Main.player[player.Index].armor[9].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[9].name, player.Index, 68f, (float)Main.player[player.Index].armor[9].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[10].name, player.Index, 69f, (float)Main.player[player.Index].armor[10].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[10].name, player.Index, 69f, (float)Main.player[player.Index].armor[10].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[11].name, player.Index, 70f, (float)Main.player[player.Index].armor[11].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[11].name, player.Index, 70f, (float)Main.player[player.Index].armor[11].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[12].name, player.Index, 71f, (float)Main.player[player.Index].armor[12].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[12].name, player.Index, 71f, (float)Main.player[player.Index].armor[12].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[13].name, player.Index, 72f, (float)Main.player[player.Index].armor[13].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[13].name, player.Index, 72f, (float)Main.player[player.Index].armor[13].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[14].name, player.Index, 73f, (float)Main.player[player.Index].armor[14].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[14].name, player.Index, 73f, (float)Main.player[player.Index].armor[14].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[15].name, player.Index, 74f, (float)Main.player[player.Index].armor[15].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[15].name, player.Index, 74f, (float)Main.player[player.Index].armor[15].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[0].name, player.Index, 75f, (float)Main.player[player.Index].dye[0].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[0].name, player.Index, 75f, (float)Main.player[player.Index].dye[0].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[1].name, player.Index, 76f, (float)Main.player[player.Index].dye[1].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[1].name, player.Index, 76f, (float)Main.player[player.Index].dye[1].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[2].name, player.Index, 77f, (float)Main.player[player.Index].dye[2].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[2].name, player.Index, 77f, (float)Main.player[player.Index].dye[2].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[3].name, player.Index, 78f, (float)Main.player[player.Index].dye[3].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[3].name, player.Index, 78f, (float)Main.player[player.Index].dye[3].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[4].name, player.Index, 79f, (float)Main.player[player.Index].dye[4].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[4].name, player.Index, 79f, (float)Main.player[player.Index].dye[4].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[5].name, player.Index, 80f, (float)Main.player[player.Index].dye[5].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[5].name, player.Index, 80f, (float)Main.player[player.Index].dye[5].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[6].name, player.Index, 81f, (float)Main.player[player.Index].dye[6].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[6].name, player.Index, 81f, (float)Main.player[player.Index].dye[6].prefix, 0f, 0);
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[7].name, player.Index, 82f, (float)Main.player[player.Index].dye[7].prefix, 0f, 0); NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[7].name, player.Index, 82f, (float)Main.player[player.Index].dye[7].prefix, 0f, 0);
NetMessage.SendData(4, -1, -1, player.Name, player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(4, -1, -1, player.Name, player.Index, 0f, 0f, 0f, 0);
NetMessage.SendData(42, -1, -1, "", player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(42, -1, -1, "", player.Index, 0f, 0f, 0f, 0);
NetMessage.SendData(16, -1, -1, "", player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(16, -1, -1, "", player.Index, 0f, 0f, 0f, 0);
@ -1428,30 +1416,31 @@ namespace TShockAPI
{ {
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].inventory[k].name, player.Index, (float)k, (float)Main.player[player.Index].inventory[k].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].inventory[k].name, player.Index, (float)k, (float)Main.player[player.Index].inventory[k].prefix, 0f, 0);
} }
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[0].name, player.Index, 59f, (float)Main.player[player.Index].armor[0].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[1].name, player.Index, 60f, (float)Main.player[player.Index].armor[1].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[0].name, player.Index, 59f, (float)Main.player[player.Index].armor[0].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[2].name, player.Index, 61f, (float)Main.player[player.Index].armor[2].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[1].name, player.Index, 60f, (float)Main.player[player.Index].armor[1].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[3].name, player.Index, 62f, (float)Main.player[player.Index].armor[3].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[2].name, player.Index, 61f, (float)Main.player[player.Index].armor[2].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[4].name, player.Index, 63f, (float)Main.player[player.Index].armor[4].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[3].name, player.Index, 62f, (float)Main.player[player.Index].armor[3].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[5].name, player.Index, 64f, (float)Main.player[player.Index].armor[5].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[4].name, player.Index, 63f, (float)Main.player[player.Index].armor[4].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[6].name, player.Index, 65f, (float)Main.player[player.Index].armor[6].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[5].name, player.Index, 64f, (float)Main.player[player.Index].armor[5].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[7].name, player.Index, 66f, (float)Main.player[player.Index].armor[7].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[6].name, player.Index, 65f, (float)Main.player[player.Index].armor[6].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[8].name, player.Index, 67f, (float)Main.player[player.Index].armor[8].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[7].name, player.Index, 66f, (float)Main.player[player.Index].armor[7].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[9].name, player.Index, 68f, (float)Main.player[player.Index].armor[9].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[8].name, player.Index, 67f, (float)Main.player[player.Index].armor[8].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[10].name, player.Index, 69f, (float)Main.player[player.Index].armor[10].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[9].name, player.Index, 68f, (float)Main.player[player.Index].armor[9].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[11].name, player.Index, 70f, (float)Main.player[player.Index].armor[11].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[10].name, player.Index, 69f, (float)Main.player[player.Index].armor[10].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[12].name, player.Index, 71f, (float)Main.player[player.Index].armor[12].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[11].name, player.Index, 70f, (float)Main.player[player.Index].armor[11].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[13].name, player.Index, 72f, (float)Main.player[player.Index].armor[13].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[12].name, player.Index, 71f, (float)Main.player[player.Index].armor[12].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[14].name, player.Index, 73f, (float)Main.player[player.Index].armor[14].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[13].name, player.Index, 72f, (float)Main.player[player.Index].armor[13].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[15].name, player.Index, 74f, (float)Main.player[player.Index].armor[15].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[14].name, player.Index, 73f, (float)Main.player[player.Index].armor[14].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[0].name, player.Index, 75f, (float)Main.player[player.Index].dye[0].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[15].name, player.Index, 74f, (float)Main.player[player.Index].armor[15].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[1].name, player.Index, 76f, (float)Main.player[player.Index].dye[1].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[0].name, player.Index, 75f, (float)Main.player[player.Index].dye[0].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[2].name, player.Index, 77f, (float)Main.player[player.Index].dye[2].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[1].name, player.Index, 76f, (float)Main.player[player.Index].dye[1].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[3].name, player.Index, 78f, (float)Main.player[player.Index].dye[3].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[2].name, player.Index, 77f, (float)Main.player[player.Index].dye[2].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[4].name, player.Index, 79f, (float)Main.player[player.Index].dye[4].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[3].name, player.Index, 78f, (float)Main.player[player.Index].dye[3].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[5].name, player.Index, 80f, (float)Main.player[player.Index].dye[5].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[4].name, player.Index, 79f, (float)Main.player[player.Index].dye[4].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[6].name, player.Index, 81f, (float)Main.player[player.Index].dye[6].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[5].name, player.Index, 80f, (float)Main.player[player.Index].dye[5].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[7].name, player.Index, 82f, (float)Main.player[player.Index].dye[7].prefix, 0f, 0); NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[6].name, player.Index, 81f, (float)Main.player[player.Index].dye[6].prefix, 0f, 0);
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[7].name, player.Index, 82f, (float)Main.player[player.Index].dye[7].prefix, 0f, 0);
NetMessage.SendData(4, player.Index, -1, player.Name, player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(4, player.Index, -1, player.Name, player.Index, 0f, 0f, 0f, 0);
NetMessage.SendData(42, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(42, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0);
NetMessage.SendData(16, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0); NetMessage.SendData(16, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0);

View file

@ -94,7 +94,7 @@ namespace TShockAPI
} }
catch (Exception e) catch (Exception e)
{ {
Log.ConsoleError("UpdateManager Exception: {0}", e); TShock.Log.ConsoleError("UpdateManager Exception: {0}", e);
throw e; throw e;
} }