Stuff
This commit is contained in:
parent
b0f5a49ec2
commit
442a5b4202
15 changed files with 74 additions and 255 deletions
|
|
@ -18,14 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using TShockAPI.DB;
|
using TShockAPI.DB;
|
||||||
|
using Region = TShockAPI.DB.Region;
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
{
|
{
|
||||||
|
|
@ -917,7 +918,7 @@ namespace TShockAPI
|
||||||
int penis57 = Main.rand.Next(Main.maxTilesX - 50) + 100;
|
int penis57 = Main.rand.Next(Main.maxTilesX - 50) + 100;
|
||||||
penis57 *= 0x10;
|
penis57 *= 0x10;
|
||||||
int penis58 = Main.rand.Next((int)(Main.maxTilesY * 0.05)) * 0x10;
|
int penis58 = Main.rand.Next((int)(Main.maxTilesY * 0.05)) * 0x10;
|
||||||
Vector2 vector = new Vector2(penis57, penis58);
|
PointF vector = new PointF(penis57, penis58);
|
||||||
float speedX = Main.rand.Next(-100, 0x65);
|
float speedX = Main.rand.Next(-100, 0x65);
|
||||||
float speedY = Main.rand.Next(200) + 100;
|
float speedY = Main.rand.Next(200) + 100;
|
||||||
float penis61 = (float)Math.Sqrt(((speedX * speedX) + (speedY * speedY)));
|
float penis61 = (float)Math.Sqrt(((speedX * speedX) + (speedY * speedY)));
|
||||||
|
|
@ -1326,7 +1327,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
string warpName = String.Join(" ", args.Parameters);
|
string warpName = String.Join(" ", args.Parameters);
|
||||||
var warp = TShock.Warps.FindWarp(warpName);
|
var warp = TShock.Warps.FindWarp(warpName);
|
||||||
if (warp.WarpPos != Vector2.Zero)
|
if (warp.WarpPos != PointF.Empty)
|
||||||
{
|
{
|
||||||
if (args.Player.Teleport((int)warp.WarpPos.X, (int)warp.WarpPos.Y + 3))
|
if (args.Player.Teleport((int)warp.WarpPos.X, (int)warp.WarpPos.Y + 3))
|
||||||
args.Player.SendMessage("Warped to " + warpName, Color.Yellow);
|
args.Player.SendMessage("Warped to " + warpName, Color.Yellow);
|
||||||
|
|
@ -1717,7 +1718,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
if (args.Parameters.Count > 1)
|
if (args.Parameters.Count > 1)
|
||||||
{
|
{
|
||||||
if (!args.Player.TempPoints.Any(p => p == Point.Zero))
|
if (!args.Player.TempPoints.Any(p => p == PointF.Empty))
|
||||||
{
|
{
|
||||||
string regionName = String.Join(" ", args.Parameters.GetRange(1, args.Parameters.Count - 1));
|
string regionName = String.Join(" ", args.Parameters.GetRange(1, args.Parameters.Count - 1));
|
||||||
var x = Math.Min(args.Player.TempPoints[0].X, args.Player.TempPoints[1].X);
|
var x = Math.Min(args.Player.TempPoints[0].X, args.Player.TempPoints[1].X);
|
||||||
|
|
@ -1727,8 +1728,8 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (TShock.Regions.AddRegion(x, y, width, height, regionName, Main.worldID.ToString()))
|
if (TShock.Regions.AddRegion(x, y, width, height, regionName, Main.worldID.ToString()))
|
||||||
{
|
{
|
||||||
args.Player.TempPoints[0] = Point.Zero;
|
args.Player.TempPoints[0] = Point.Empty;
|
||||||
args.Player.TempPoints[1] = Point.Zero;
|
args.Player.TempPoints[1] = Point.Empty;
|
||||||
args.Player.SendMessage("Set region " + regionName, Color.Yellow);
|
args.Player.SendMessage("Set region " + regionName, Color.Yellow);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1787,8 +1788,8 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
case "clear":
|
case "clear":
|
||||||
{
|
{
|
||||||
args.Player.TempPoints[0] = Point.Zero;
|
args.Player.TempPoints[0] = Point.Empty;
|
||||||
args.Player.TempPoints[1] = Point.Zero;
|
args.Player.TempPoints[1] = Point.Empty;
|
||||||
args.Player.SendMessage("Cleared temp area", Color.Yellow);
|
args.Player.SendMessage("Cleared temp area", Color.Yellow);
|
||||||
args.Player.AwaitingTempPoint = 0;
|
args.Player.AwaitingTempPoint = 0;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
|
|
||||||
|
|
@ -88,22 +88,28 @@ namespace TShockAPI.DB
|
||||||
|
|
||||||
while (reader.Read() && reader.NodeType != XmlNodeType.Text) ;
|
while (reader.Read() && reader.NodeType != XmlNodeType.Text) ;
|
||||||
|
|
||||||
|
int t = 0;
|
||||||
|
|
||||||
switch (name)
|
switch (name)
|
||||||
{
|
{
|
||||||
case "RegionName":
|
case "RegionName":
|
||||||
region.Name = reader.Value;
|
region.Name = reader.Value;
|
||||||
break;
|
break;
|
||||||
case "Point1X":
|
case "Point1X":
|
||||||
int.TryParse(reader.Value, out rect.X);
|
int.TryParse(reader.Value, out t);
|
||||||
|
rect.X = t;
|
||||||
break;
|
break;
|
||||||
case "Point1Y":
|
case "Point1Y":
|
||||||
int.TryParse(reader.Value, out rect.Y);
|
int.TryParse(reader.Value, out t);
|
||||||
|
rect.Y = t;
|
||||||
break;
|
break;
|
||||||
case "Point2X":
|
case "Point2X":
|
||||||
int.TryParse(reader.Value, out rect.Width);
|
int.TryParse(reader.Value, out t);
|
||||||
|
rect.Width = t;
|
||||||
break;
|
break;
|
||||||
case "Point2Y":
|
case "Point2Y":
|
||||||
int.TryParse(reader.Value, out rect.Height);
|
int.TryParse(reader.Value, out t);
|
||||||
|
rect.Height = t;
|
||||||
break;
|
break;
|
||||||
case "Protected":
|
case "Protected":
|
||||||
region.DisableBuild = reader.Value.ToLower().Equals("true");
|
region.DisableBuild = reader.Value.ToLower().Equals("true");
|
||||||
|
|
@ -175,7 +181,7 @@ namespace TShockAPI.DB
|
||||||
string mergedids = reader.Get<string>("UserIds");
|
string mergedids = reader.Get<string>("UserIds");
|
||||||
string name = reader.Get<string>("RegionName");
|
string name = reader.Get<string>("RegionName");
|
||||||
|
|
||||||
string[] splitids = mergedids.Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
string[] splitids = mergedids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
Region r = new Region(new Rectangle(X1, Y1, width, height), name, Protected != 0, Main.worldID.ToString());
|
Region r = new Region(new Rectangle(X1, Y1, width, height), name, Protected != 0, Main.worldID.ToString());
|
||||||
|
|
||||||
|
|
@ -370,13 +376,13 @@ namespace TShockAPI.DB
|
||||||
|
|
||||||
public static List<string> ListIDs(string MergedIDs)
|
public static List<string> ListIDs(string MergedIDs)
|
||||||
{
|
{
|
||||||
return MergedIDs.Split(new []{','}, StringSplitOptions.RemoveEmptyEntries).ToList();
|
return MergedIDs.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveUser(string regionName, string userName )
|
public bool RemoveUser(string regionName, string userName)
|
||||||
{
|
{
|
||||||
Region r = GetRegionByName(regionName);
|
Region r = GetRegionByName(regionName);
|
||||||
if( r != null )
|
if (r != null)
|
||||||
{
|
{
|
||||||
r.RemoveID(TShock.Users.GetUserID(userName));
|
r.RemoveID(TShock.Users.GetUserID(userName));
|
||||||
string ids = string.Join(",", r.AllowedIDs);
|
string ids = string.Join(",", r.AllowedIDs);
|
||||||
|
|
@ -408,7 +414,7 @@ namespace TShockAPI.DB
|
||||||
foreach (var r in Regions)
|
foreach (var r in Regions)
|
||||||
{
|
{
|
||||||
if (r.Name == regionName && r.WorldID == Main.worldID.ToString())
|
if (r.Name == regionName && r.WorldID == Main.worldID.ToString())
|
||||||
r.setAllowedIDs( MergedIDs );
|
r.setAllowedIDs(MergedIDs);
|
||||||
}
|
}
|
||||||
return q != 0;
|
return q != 0;
|
||||||
}
|
}
|
||||||
|
|
@ -509,16 +515,16 @@ namespace TShockAPI.DB
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAllowedIDs( String ids )
|
public void setAllowedIDs(String ids)
|
||||||
{
|
{
|
||||||
String[] id_arr = ids.Split(',');
|
String[] id_arr = ids.Split(',');
|
||||||
List<int> id_list = new List<int>();
|
List<int> id_list = new List<int>();
|
||||||
foreach( String id in id_arr )
|
foreach (String id in id_arr)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int.TryParse(id, out i);
|
int.TryParse(id, out i);
|
||||||
if( i != 0 )
|
if (i != 0)
|
||||||
id_list.Add( i );
|
id_list.Add(i);
|
||||||
}
|
}
|
||||||
AllowedIDs = id_list;
|
AllowedIDs = id_list;
|
||||||
}
|
}
|
||||||
|
|
@ -526,7 +532,7 @@ namespace TShockAPI.DB
|
||||||
public void RemoveID(int id)
|
public void RemoveID(int id)
|
||||||
{
|
{
|
||||||
var index = -1;
|
var index = -1;
|
||||||
for (int i = 0; i < AllowedIDs.Count; i++ )
|
for (int i = 0; i < AllowedIDs.Count; i++)
|
||||||
{
|
{
|
||||||
if (AllowedIDs[i] == id)
|
if (AllowedIDs[i] == id)
|
||||||
{
|
{
|
||||||
|
|
@ -534,7 +540,7 @@ namespace TShockAPI.DB
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AllowedIDs.RemoveAt( index );
|
AllowedIDs.RemoveAt(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Xml;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using Microsoft.Xna.Framework;
|
using System.Drawing;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
|
|
||||||
|
|
@ -45,7 +43,7 @@ namespace TShockAPI.DB
|
||||||
creator.EnsureExists(table);
|
creator.EnsureExists(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 GetLeavePos(string name, string IP)
|
public PointF GetLeavePos(string name, string IP)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -53,7 +51,7 @@ namespace TShockAPI.DB
|
||||||
{
|
{
|
||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
{
|
{
|
||||||
return new Vector2(reader.Get<int>("X"), reader.Get<int>("Y"));
|
return new PointF(reader.Get<int>("X"), reader.Get<int>("Y"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -62,12 +60,12 @@ namespace TShockAPI.DB
|
||||||
Log.Error(ex.ToString());
|
Log.Error(ex.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Vector2();
|
return new PointF();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertLeavePos(string name, string IP, int X, int Y)
|
public void InsertLeavePos(string name, string IP, int X, int Y)
|
||||||
{
|
{
|
||||||
if (GetLeavePos(name, IP) == Vector2.Zero)
|
if (GetLeavePos(name, IP) == PointF.Empty)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
|
|
||||||
|
|
@ -173,11 +173,11 @@ namespace TShockAPI.DB
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return new Warp(new Vector2(reader.Get<int>("X"), reader.Get<int>("Y")), reader.Get<string>("WarpName"), reader.Get<string>("WorldID"), reader.Get<string>("Private"));
|
return new Warp(new PointF(reader.Get<int>("X"), reader.Get<int>("Y")), reader.Get<string>("WarpName"), reader.Get<string>("WorldID"), reader.Get<string>("Private"));
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return new Warp(new Vector2(reader.Get<int>("X"), reader.Get<int>("Y")), reader.Get<string>("WarpName"), reader.Get<string>("WorldID"), "0");
|
return new Warp(new PointF(reader.Get<int>("X"), reader.Get<int>("Y")), reader.Get<string>("WarpName"), reader.Get<string>("WorldID"), "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -247,12 +247,12 @@ namespace TShockAPI.DB
|
||||||
|
|
||||||
public class Warp
|
public class Warp
|
||||||
{
|
{
|
||||||
public Vector2 WarpPos { get; set; }
|
public PointF WarpPos { get; set; }
|
||||||
public string WarpName { get; set; }
|
public string WarpName { get; set; }
|
||||||
public string WorldWarpID { get; set; }
|
public string WorldWarpID { get; set; }
|
||||||
public string Private { get; set; }
|
public string Private { get; set; }
|
||||||
|
|
||||||
public Warp(Vector2 warppos, string name, string worldid, string hidden)
|
public Warp(PointF warppos, string name, string worldid, string hidden)
|
||||||
{
|
{
|
||||||
WarpPos = warppos;
|
WarpPos = warppos;
|
||||||
WarpName = name;
|
WarpName = name;
|
||||||
|
|
@ -262,7 +262,7 @@ namespace TShockAPI.DB
|
||||||
|
|
||||||
public Warp()
|
public Warp()
|
||||||
{
|
{
|
||||||
WarpPos = Vector2.Zero;
|
WarpPos = PointF.Empty;
|
||||||
WarpName = null;
|
WarpName = null;
|
||||||
WorldWarpID = string.Empty;
|
WorldWarpID = string.Empty;
|
||||||
Private = "0";
|
Private = "0";
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using TerrariaAPI;
|
using TerrariaAPI;
|
||||||
using TShockAPI.Net;
|
using TShockAPI.Net;
|
||||||
|
|
@ -393,7 +393,7 @@ namespace TShockAPI
|
||||||
if (type == 0 && BlacklistTiles[Main.tile[x, y].type] && args.Player.Active)
|
if (type == 0 && BlacklistTiles[Main.tile[x, y].type] && args.Player.Active)
|
||||||
{
|
{
|
||||||
args.Player.TileThreshold++;
|
args.Player.TileThreshold++;
|
||||||
var coords = new Vector2(x, y);
|
var coords = new PointF(x, y);
|
||||||
if (!args.Player.TilesDestroyed.ContainsKey(coords))
|
if (!args.Player.TilesDestroyed.ContainsKey(coords))
|
||||||
args.Player.TilesDestroyed.Add(coords, Main.tile[x, y]);
|
args.Player.TilesDestroyed.Add(coords, Main.tile[x, y]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using TerrariaAPI;
|
using TerrariaAPI;
|
||||||
using XNAHelpers;
|
using XNAHelpers;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using TerrariaAPI;
|
using TerrariaAPI;
|
||||||
using TerrariaAPI.Hooks;
|
using TerrariaAPI.Hooks;
|
||||||
|
|
@ -90,7 +89,7 @@ namespace TShockAPI
|
||||||
Compressed = new int[52];
|
Compressed = new int[52];
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameHooks_Update(GameTime obj)
|
void GameHooks_Update()
|
||||||
{
|
{
|
||||||
FlushAll();
|
FlushAll();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,10 @@ using System.Runtime.InteropServices;
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
[assembly: AssemblyVersion("3.2.8.0903")]
|
[assembly: AssemblyVersion("3.2.8.0903")]
|
||||||
[assembly: AssemblyFileVersion("3.2.8.0903")]
|
[assembly: AssemblyFileVersion("3.2.8.0903")]
|
||||||
|
=======
|
||||||
|
[assembly: AssemblyVersion("3.2.8.0830")]
|
||||||
|
[assembly: AssemblyFileVersion("3.2.8.0830")]
|
||||||
|
>>>>>>> remotes/origin/general-devel-mono
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using TerrariaAPI;
|
using TerrariaAPI;
|
||||||
using TShockAPI.Net;
|
using TShockAPI.Net;
|
||||||
|
|
@ -32,7 +32,7 @@ namespace TShockAPI
|
||||||
public static readonly TSServerPlayer Server = new TSServerPlayer();
|
public static readonly TSServerPlayer Server = new TSServerPlayer();
|
||||||
public static readonly TSPlayer All = new TSPlayer("All");
|
public static readonly TSPlayer All = new TSPlayer("All");
|
||||||
public int TileThreshold { get; set; }
|
public int TileThreshold { get; set; }
|
||||||
public Dictionary<Vector2, Tile> TilesDestroyed { get; protected set; }
|
public Dictionary<PointF, Tile> TilesDestroyed { get; protected set; }
|
||||||
public bool SyncHP { get; set; }
|
public bool SyncHP { get; set; }
|
||||||
public bool SyncMP { get; set; }
|
public bool SyncMP { get; set; }
|
||||||
public Group Group { get; set; }
|
public Group Group { get; set; }
|
||||||
|
|
@ -46,10 +46,10 @@ namespace TShockAPI
|
||||||
public DateTime LastTileChangeNotify { get; set; }
|
public DateTime LastTileChangeNotify { get; set; }
|
||||||
public bool InitSpawn;
|
public bool InitSpawn;
|
||||||
public bool DisplayLogs = true;
|
public bool DisplayLogs = true;
|
||||||
public Vector2 oldSpawn = Vector2.Zero;
|
public PointF oldSpawn = PointF.Empty;
|
||||||
public TSPlayer LastWhisper;
|
public TSPlayer LastWhisper;
|
||||||
public int LoginAttempts { get; set; }
|
public int LoginAttempts { get; set; }
|
||||||
public Vector2 TeleportCoords = new Vector2(-1, -1);
|
public PointF TeleportCoords = new PointF(-1, -1);
|
||||||
public string UserAccountName { get; set; }
|
public string UserAccountName { get; set; }
|
||||||
public bool HasBeenSpammedWithBuildMessage;
|
public bool HasBeenSpammedWithBuildMessage;
|
||||||
public bool IsLoggedIn;
|
public bool IsLoggedIn;
|
||||||
|
|
@ -145,14 +145,14 @@ namespace TShockAPI
|
||||||
|
|
||||||
public TSPlayer(int index)
|
public TSPlayer(int index)
|
||||||
{
|
{
|
||||||
TilesDestroyed = new Dictionary<Vector2, Tile>();
|
TilesDestroyed = new Dictionary<PointF, Tile>();
|
||||||
Index = index;
|
Index = index;
|
||||||
Group = new Group("null");
|
Group = new Group("null");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TSPlayer(String playerName)
|
protected TSPlayer(String playerName)
|
||||||
{
|
{
|
||||||
TilesDestroyed = new Dictionary<Vector2, Tile>();
|
TilesDestroyed = new Dictionary<PointF, Tile>();
|
||||||
Index = -1;
|
Index = -1;
|
||||||
FakePlayer = new Player { name = playerName, whoAmi = -1 };
|
FakePlayer = new Player { name = playerName, whoAmi = -1 };
|
||||||
Group = new Group("null");
|
Group = new Group("null");
|
||||||
|
|
@ -406,17 +406,17 @@ namespace TShockAPI
|
||||||
NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", npcid, damage, knockBack, hitDirection);
|
NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", npcid, damage, knockBack, hitDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RevertKillTile(Dictionary<Vector2, Tile> destroyedTiles)
|
public void RevertKillTile(Dictionary<PointF, Tile> destroyedTiles)
|
||||||
{
|
{
|
||||||
// Update Main.Tile first so that when tile sqaure is sent it is correct
|
// Update Main.Tile first so that when tile sqaure is sent it is correct
|
||||||
foreach (KeyValuePair<Vector2, Tile> entry in destroyedTiles)
|
foreach (KeyValuePair<PointF, Tile> entry in destroyedTiles)
|
||||||
{
|
{
|
||||||
Main.tile[(int)entry.Key.X, (int)entry.Key.Y] = entry.Value;
|
Main.tile[(int)entry.Key.X, (int)entry.Key.Y] = entry.Value;
|
||||||
Log.Debug(string.Format("Reverted DestroyedTile(TileXY:{0}_{1}, Type:{2})",
|
Log.Debug(string.Format("Reverted DestroyedTile(TileXY:{0}_{1}, Type:{2})",
|
||||||
entry.Key.X, entry.Key.Y, Main.tile[(int)entry.Key.X, (int)entry.Key.Y].type));
|
entry.Key.X, entry.Key.Y, Main.tile[(int)entry.Key.X, (int)entry.Key.Y].type));
|
||||||
}
|
}
|
||||||
// Send all players updated tile sqaures
|
// Send all players updated tile sqaures
|
||||||
foreach (Vector2 coords in destroyedTiles.Keys)
|
foreach (PointF coords in destroyedTiles.Keys)
|
||||||
{
|
{
|
||||||
All.SendTileSquare((int)coords.X, (int)coords.Y, 3);
|
All.SendTileSquare((int)coords.X, (int)coords.Y, 3);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,13 @@ using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Community.CsharpSqlite.SQLiteClient;
|
using Community.CsharpSqlite.SQLiteClient;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using TerrariaAPI;
|
using TerrariaAPI;
|
||||||
|
|
@ -44,7 +44,7 @@ using TShockAPI.Net;
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
{
|
{
|
||||||
[APIVersion(1, 7)]
|
[APIVersion(1, 8)]
|
||||||
public class TShock : TerrariaPlugin
|
public class TShock : TerrariaPlugin
|
||||||
{
|
{
|
||||||
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
|
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
|
|
@ -356,7 +356,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
private DateTime LastCheck = DateTime.UtcNow;
|
private DateTime LastCheck = DateTime.UtcNow;
|
||||||
|
|
||||||
private void OnUpdate(GameTime time)
|
private void OnUpdate()
|
||||||
{
|
{
|
||||||
UpdateManager.UpdateProcedureCheck();
|
UpdateManager.UpdateProcedureCheck();
|
||||||
|
|
||||||
|
|
@ -812,9 +812,16 @@ namespace TShockAPI
|
||||||
|
|
||||||
public static bool CheckSpawn(int x, int y)
|
public static bool CheckSpawn(int x, int y)
|
||||||
{
|
{
|
||||||
Vector2 tile = new Vector2(x, y);
|
PointF tile = new PointF(x, y);
|
||||||
Vector2 spawn = new Vector2(Main.spawnTileX, Main.spawnTileY);
|
PointF spawn = new PointF(Main.spawnTileX, Main.spawnTileY);
|
||||||
return Vector2.Distance(spawn, tile) <= Config.SpawnProtectionRadius;
|
return Distance(spawn, tile) <= Config.SpawnProtectionRadius;
|
||||||
|
}
|
||||||
|
public static float Distance(PointF value1, PointF value2)
|
||||||
|
{
|
||||||
|
float num2 = value1.X - value2.X;
|
||||||
|
float num = value1.Y - value2.Y;
|
||||||
|
float num3 = (num2 * num2) + (num * num);
|
||||||
|
return (float)Math.Sqrt((double)num3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HackedHealth(TSPlayer player)
|
public static bool HackedHealth(TSPlayer player)
|
||||||
|
|
|
||||||
|
|
@ -1,196 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{49606449-072B-4CF5-8088-AA49DA586694}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>TShockAPI</RootNamespace>
|
|
||||||
<AssemblyName>TShockAPI</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
|
||||||
<PublishUrl>publish\</PublishUrl>
|
|
||||||
<Install>true</Install>
|
|
||||||
<InstallFrom>Disk</InstallFrom>
|
|
||||||
<UpdateEnabled>false</UpdateEnabled>
|
|
||||||
<UpdateMode>Foreground</UpdateMode>
|
|
||||||
<UpdateInterval>7</UpdateInterval>
|
|
||||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
|
||||||
<UpdatePeriodically>false</UpdatePeriodically>
|
|
||||||
<UpdateRequired>false</UpdateRequired>
|
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
|
||||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>..\..\serverplugins\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Community.CsharpSqlite.SQLiteClient, Version=3.7.5.0, Culture=neutral, processorArchitecture=x86">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\SqlBins\Community.CsharpSqlite.SQLiteClient.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
|
|
||||||
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
|
|
||||||
<Reference Include="MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\SqlBins\MySql.Data.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\SqlBins\MySql.Web.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Newtonsoft.Json">
|
|
||||||
<HintPath>.\Newtonsoft.Json.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="TerrariaServer, Version=1.0.4.0, Culture=neutral, processorArchitecture=x86">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<ExecutableExtension>.exe</ExecutableExtension>
|
|
||||||
<HintPath>..\TerrariaServerBins\TerrariaServer.exe</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="TerrariaServerAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\TerrariaServerBins\TerrariaServerAPI.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="XNAHelpers, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\TerrariaServerBins\XNAHelpers.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="BackupManager.cs" />
|
|
||||||
<Compile Include="DB\BanManager.cs" />
|
|
||||||
<Compile Include="DB\IQueryBuilder.cs" />
|
|
||||||
<Compile Include="DB\ItemManager.cs" />
|
|
||||||
<Compile Include="DB\SqlColumn.cs" />
|
|
||||||
<Compile Include="DB\SqlTable.cs" />
|
|
||||||
<Compile Include="DB\SqlValue.cs" />
|
|
||||||
<Compile Include="Extensions\DbExt.cs" />
|
|
||||||
<Compile Include="DB\GroupManager.cs" />
|
|
||||||
<Compile Include="DB\UserManager.cs" />
|
|
||||||
<Compile Include="Extensions\RandomExt.cs" />
|
|
||||||
<Compile Include="Extensions\StringExt.cs" />
|
|
||||||
<Compile Include="GeoIPCountry.cs" />
|
|
||||||
<Compile Include="IPackable.cs" />
|
|
||||||
<Compile Include="Commands.cs" />
|
|
||||||
<Compile Include="ConfigFile.cs" />
|
|
||||||
<Compile Include="FileTools.cs" />
|
|
||||||
<Compile Include="GetDataHandlers.cs" />
|
|
||||||
<Compile Include="Group.cs" />
|
|
||||||
<Compile Include="Extensions\LinqExt.cs" />
|
|
||||||
<Compile Include="Log.cs" />
|
|
||||||
<Compile Include="Net\BaseMsg.cs" />
|
|
||||||
<Compile Include="Net\DisconnectMsg.cs" />
|
|
||||||
<Compile Include="Net\NetTile.cs" />
|
|
||||||
<Compile Include="Net\SpawnMsg.cs" />
|
|
||||||
<Compile Include="Net\WorldInfoMsg.cs" />
|
|
||||||
<Compile Include="DB\RegionManager.cs" />
|
|
||||||
<Compile Include="PacketBufferer.cs" />
|
|
||||||
<Compile Include="Permissions.cs" />
|
|
||||||
<Compile Include="RconHandler.cs" />
|
|
||||||
<Compile Include="DB\RememberPosManager.cs" />
|
|
||||||
<Compile Include="Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Tools.cs" />
|
|
||||||
<Compile Include="TShock.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="TSPlayer.cs" />
|
|
||||||
<Compile Include="UpdateManager.cs" />
|
|
||||||
<Compile Include="DB\WarpsManager.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="config\groups.txt" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="config\users.txt" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>Windows Installer 3.1</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="config\itembans.txt" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup />
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<PreBuildEvent>
|
|
||||||
</PreBuildEvent>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<PostBuildEvent>"$(ProjectDir)postbuild.bat"</PostBuildEvent>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ProjectExtensions>
|
|
||||||
<VisualStudio>
|
|
||||||
<UserProperties BuildVersion_IncrementBeforeBuild="False" BuildVersion_StartDate="2011/6/17" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_BuildAction="Both" BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" />
|
|
||||||
</VisualStudio>
|
|
||||||
</ProjectExtensions>
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
||||||
|
|
@ -17,13 +17,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using TerrariaAPI;
|
using TerrariaAPI;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue