Skip to content
This repository has been archived by the owner on Apr 17, 2021. It is now read-only.

Commit

Permalink
Build 4 from Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
DeathCradle committed Aug 2, 2015
1 parent 51edf02 commit b2dcea5
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 77 deletions.
Binary file modified Binaries/Plugins/TDSM.Core.dll
Binary file not shown.
Binary file modified Binaries/Plugins/TDSM.Core.dll.mdb
Binary file not shown.
Binary file modified Binaries/TDSM.API.dll
Binary file not shown.
Binary file modified Binaries/TDSM.API.dll.mdb
Binary file not shown.
Binary file modified Binaries/tdsm-patcher.exe
Binary file not shown.
Binary file modified Binaries/tdsm.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion tdsm-api/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public enum ReleasePhase : ushort
}
public static class Globals
{
public const Int32 Build = 3;
public const Int32 Build = 4;
public const ReleasePhase BuildPhase = ReleasePhase.LiveRelease;

public const Int32 TerrariaRelease = 146;
Expand Down
102 changes: 30 additions & 72 deletions tdsm-api/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,69 +13,17 @@ namespace TDSM.API
{
public static class Tools
{
// private static Action<String, ConsoleColor, Object[]> _WriteLineMethod;
// internal static Action WriteClose;
//
// public static void WriteLine(string fmt, params object[] args)
// {
// WriteLine(fmt, ConsoleColor.White, args);
// }
//
// public static void WriteLine(string fmt, ConsoleColor colour = ConsoleColor.White, params object[] args)
// {
// if (_WriteLineMethod != null)
// lock (_WriteLineMethod)
// _WriteLineMethod(fmt, colour, args);
// else
// {
// if (Console.ForegroundColor != colour) Console.ForegroundColor = colour;
// Console.WriteLine(fmt, args);
// }
// }
//
// public static void WriteLine(string fmt)
// {
// WriteLine(fmt, null);
// }
//
// public static void WriteLine(object arg)
// {
// WriteLine("{0}", arg);
// }
//
// public static void WriteLine(Exception e)
// {
// WriteLine("{0}", e);
// }
//
// public static void SetWriteLineMethod(Action<String, ConsoleColor, Object[]> writeMethod, Action closeMethod = null)
// {
// if (_WriteLineMethod == null) _WriteLineMethod = writeMethod;
// else
// lock (_WriteLineMethod)
// _WriteLineMethod = writeMethod;
//
// if (closeMethod != null) SetWriteLineCloseMethod(closeMethod);
// }
//
// public static void SetWriteLineCloseMethod(Action method)
// {
// if (WriteClose == null) WriteClose = method;
// else
// lock (WriteClose)
// WriteClose = method;
// }

public static void NotifyAllPlayers(string message, Color color, bool writeToConsole = true) //, SendingLogger Logger = SendingLogger.CONSOLE)
{
#if Full_API
foreach (var player in Main.player)
{
if (player.active)
if (player != null && player.active)
NetMessage.SendData((int)Packet.PLAYER_CHAT, player.whoAmI, -1, message, 255 /* PlayerId */, color.R, color.G, color.B);
}

if (writeToConsole) ProgramLog.Log(message);
if (writeToConsole)
ProgramLog.Log(message);
#endif
}

Expand All @@ -84,14 +32,15 @@ public static void NotifyAllOps(string message, bool writeToConsole = true) //,
#if Full_API
foreach (var player in Main.player)
{
if (player.active && player.Op)
if (player != null && player.active && player.Op)
NetMessage.SendData((int)Packet.PLAYER_CHAT, player.whoAmI, -1, message, 255 /* PlayerId */, 176f, 196, 222f);
}

if (writeToConsole) ProgramLog.Log(message);
if (writeToConsole)
ProgramLog.Log(message);
#endif
}
#if Full_API
#if Full_API
/// <summary>
/// Gets a specified Online Player
/// Input name must already be cleaned of spaces
Expand All @@ -103,7 +52,7 @@ public static Player GetPlayerByName(string name)
string lowercaseName = name.ToLower();
foreach (Player player in Main.player)
{
if (player.active && player.Name.ToLower().Equals(lowercaseName))
if (player != null && player.active && player.Name.ToLower().Equals(lowercaseName))
return player;
}
return null;
Expand All @@ -122,7 +71,9 @@ public static int ActiveNPCCount()
npcCount++;
}
return npcCount;*/
return (from x in Main.npc where x.active select x).Count();
return (from x in Main.npc
where x != null && x.active
select x).Count();
}

/// <summary>
Expand All @@ -134,11 +85,11 @@ public static int ActiveNPCCount()
public static bool IsValidLocation(Vector2 point, bool defaultResist = true)
{
if (point != null && (defaultResist) ? (point != default(Vector2)) : true)
if (point.X <= Main.maxTilesX && point.X >= 0)
{
if (point.Y <= Main.maxTilesY && point.Y >= 0)
return true;
}
if (point.X <= Main.maxTilesX && point.X >= 0)
{
if (point.Y <= Main.maxTilesY && point.Y >= 0)
return true;
}

return false;
}
Expand Down Expand Up @@ -173,7 +124,7 @@ public static List<Player> FindPlayerByPart(string partName, bool ignoreCase = t

foreach (var player in Main.player)
{
if (player.Name == null)
if (player == null || player.Name == null)
continue;

string playerName = player.Name;
Expand Down Expand Up @@ -317,14 +268,16 @@ public static bool TryGetFirstOnlinePlayer(out Player player)
for (var i = 0; i < Main.player.Length; i++)
{
var ply = Main.player[i];
if (ply.active && ply.Name.Trim() != String.Empty)
if (ply != null && ply.active && ply.Name.Trim() != String.Empty)
{
player = ply;
return true;
}
}
}
catch { }
catch
{
}

return false;
}
Expand Down Expand Up @@ -382,7 +335,8 @@ public static int FindExistingProjectileForUser(int playerId, int identity)
{
for (int x = 0; x < 1000; x++)
{
if (Main.projectile[x].owner == playerId && Main.projectile[x].identity == identity && Main.projectile[x].active)
var prj = Main.projectile[x];
if (prj != null && prj.owner == playerId && prj.identity == identity && prj.active)
return x;
}
return -1;
Expand Down Expand Up @@ -432,7 +386,9 @@ public static int ActivePlayerCount
{
get
{
return (from p in Terraria.Main.player where p.active select p.Name).Count();
return (from p in Terraria.Main.player
where p != null && p.active
select p.Name).Count();
}
}

Expand All @@ -443,7 +399,7 @@ public static int MaxPlayers
return Main.maxNetPlayers;
}
}
#endif
#endif
public static RuntimePlatform RuntimePlatform
{
get
Expand All @@ -454,12 +410,14 @@ public static RuntimePlatform RuntimePlatform
public struct ItemInfo
{
public int NetID { get; set; }

public int Type { get; set; }
}

public enum RuntimePlatform
{
Microsoft = 1, //.net
Microsoft = 1,
//.net
Mono
}
}
2 changes: 1 addition & 1 deletion tdsm-core/Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace TDSM.Core
{
public partial class Entry : BasePlugin
{
public const Int32 CoreBuild = 3;
public const Int32 CoreBuild = 4;

private bool _useTimeLock;

Expand Down
2 changes: 1 addition & 1 deletion tdsm-mysql-connector/SqlPermissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class SqlPermissions : BasePlugin

public SqlPermissions()
{
this.TDSMBuild = 3;
this.TDSMBuild = 4;
this.Version = "1";
this.Author = "TDSM";
this.Name = "MySQL Connector";
Expand Down
2 changes: 1 addition & 1 deletion tdsm-patcher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace tdsm.patcher
public class Program
{
public const String TDSMGuid = "9f7bca2e-4d2e-4244-aaae-fa56ca7797ec";
public const Int32 Build = 3;
public const Int32 Build = 4;
// public static bool IsPatching { get; private set; }

// static Program()
Expand Down
2 changes: 1 addition & 1 deletion tdsm-sqlite-connector/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Plugin : BasePlugin

public Plugin()
{
this.TDSMBuild = 3;
this.TDSMBuild = 4;
this.Version = "1";
this.Author = "TDSM";
this.Name = "SQLite Connector";
Expand Down

0 comments on commit b2dcea5

Please sign in to comment.