Merge commit '5e9cfb2791' into general-devel-rest
This commit is contained in:
commit
158a9245ce
7 changed files with 34 additions and 22 deletions
|
|
@ -349,6 +349,13 @@ namespace TShockAPI
|
||||||
args.Player.SendTileSquare(x, y);
|
args.Player.SendTileSquare(x, y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (type == 1 && tiletype == 21 && Tools.MaxChests())
|
||||||
|
{
|
||||||
|
args.Player.SendMessage("Reached world's max chest limit, unable to place more!", Color.Red);
|
||||||
|
Log.Info("Reached world's chest limit, unable to place more.");
|
||||||
|
args.Player.SendTileSquare(x, y);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!args.Player.Group.HasPermission(Permissions.editspawn) && !TShock.Regions.CanBuild(x, y, args.Player) && TShock.Regions.InArea(x, y))
|
if (!args.Player.Group.HasPermission(Permissions.editspawn) && !TShock.Regions.CanBuild(x, y, args.Player) && TShock.Regions.InArea(x, y))
|
||||||
{
|
{
|
||||||
|
|
@ -395,7 +402,7 @@ namespace TShockAPI
|
||||||
args.Player.TileThreshold++;
|
args.Player.TileThreshold++;
|
||||||
var coords = new PointF(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].Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((DateTime.UtcNow - args.Player.LastExplosive).TotalMilliseconds < 1000)
|
if ((DateTime.UtcNow - args.Player.LastExplosive).TotalMilliseconds < 1000)
|
||||||
|
|
@ -480,12 +487,18 @@ namespace TShockAPI
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 23 && (vely == 0f || velx == 0f)) //float.IsNaN((float)Math.Sqrt((double)(velx * velx + vely * vely))))
|
if (type == 23)
|
||||||
{
|
{
|
||||||
Tools.HandleGriefer(args.Player, TShock.Config.ProjectileAbuseReason);
|
if (velx == 0f && vely == 0f && dmg == 99)
|
||||||
return true;
|
{
|
||||||
|
Tools.HandleGriefer(args.Player, TShock.Config.ProjectileAbuseReason);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (velx == 0f || vely == 0f)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (type == 29 || type == 28 || type == 37)
|
if (type == 29 || type == 28 || type == 37)
|
||||||
{
|
{
|
||||||
Log.Debug(string.Format("Explosive(PlyXY:{0}_{1}, Type:{2})", args.Player.TileX, args.Player.TileY, type));
|
Log.Debug(string.Format("Explosive(PlyXY:{0}_{1}, Type:{2})", args.Player.TileX, args.Player.TileY, type));
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,5 @@ using System.Runtime.InteropServices;
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.3.2.0905")]
|
[assembly: AssemblyVersion("3.3.3.0916")]
|
||||||
[assembly: AssemblyFileVersion("3.3.2.0905")]
|
[assembly: AssemblyFileVersion("3.3.3.0916")]
|
||||||
|
|
|
||||||
|
|
@ -4,21 +4,21 @@ using System.Collections.Generic;
|
||||||
namespace Rests
|
namespace Rests
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class RestObject : Dictionary<string, string>
|
public class RestObject : Dictionary<string, object>
|
||||||
{
|
{
|
||||||
public string Status
|
public string Status
|
||||||
{
|
{
|
||||||
get { return this["status"]; }
|
get { return this["status"] as string; }
|
||||||
set { this["status"] = value; }
|
set { this["status"] = value; }
|
||||||
}
|
}
|
||||||
public string Error
|
public string Error
|
||||||
{
|
{
|
||||||
get { return this["error"]; }
|
get { return this["error"] as string; }
|
||||||
set { this["error"] = value; }
|
set { this["error"] = value; }
|
||||||
}
|
}
|
||||||
public string Response
|
public string Response
|
||||||
{
|
{
|
||||||
get { return this["response"]; }
|
get { return this["response"] as string; }
|
||||||
set { this["response"] = value; }
|
set { this["response"] = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,11 +33,11 @@ namespace Rests
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="value"></param>
|
/// <param name="value"></param>
|
||||||
/// <returns>Returns null if key does not exist.</returns>
|
/// <returns>Returns null if key does not exist.</returns>
|
||||||
public new string this[string key]
|
public new object this[string key]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
string ret;
|
object ret;
|
||||||
if (TryGetValue(key, out ret))
|
if (TryGetValue(key, out ret))
|
||||||
return ret;
|
return ret;
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -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<PointF, Tile> TilesDestroyed { get; protected set; }
|
public Dictionary<PointF, TileData> 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; }
|
||||||
|
|
@ -145,14 +145,14 @@ namespace TShockAPI
|
||||||
|
|
||||||
public TSPlayer(int index)
|
public TSPlayer(int index)
|
||||||
{
|
{
|
||||||
TilesDestroyed = new Dictionary<PointF, Tile>();
|
TilesDestroyed = new Dictionary<PointF, TileData>();
|
||||||
Index = index;
|
Index = index;
|
||||||
Group = new Group("null");
|
Group = new Group("null");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TSPlayer(String playerName)
|
protected TSPlayer(String playerName)
|
||||||
{
|
{
|
||||||
TilesDestroyed = new Dictionary<PointF, Tile>();
|
TilesDestroyed = new Dictionary<PointF, TileData>();
|
||||||
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");
|
||||||
|
|
@ -213,7 +213,7 @@ namespace TShockAPI
|
||||||
//150 Should avoid all client crash errors
|
//150 Should avoid all client crash errors
|
||||||
//The error occurs when a tile trys to update which the client hasnt load yet, Clients only update tiles withen 150 blocks
|
//The error occurs when a tile trys to update which the client hasnt load yet, Clients only update tiles withen 150 blocks
|
||||||
//Try 300 if it does not work (Higher number - Longer load times - Less chance of error)
|
//Try 300 if it does not work (Higher number - Longer load times - Less chance of error)
|
||||||
if (!SendTileSquare(tilex, tiley, 150))
|
if (!SendTileSquare(tilex, tiley))
|
||||||
{
|
{
|
||||||
InitSpawn = true;
|
InitSpawn = true;
|
||||||
SendWorldInfo(Main.spawnTileX, Main.spawnTileY, false);
|
SendWorldInfo(Main.spawnTileX, Main.spawnTileY, false);
|
||||||
|
|
@ -406,12 +406,12 @@ 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<PointF, Tile> destroyedTiles)
|
public void RevertKillTile(Dictionary<PointF, TileData> 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<PointF, Tile> entry in destroyedTiles)
|
foreach (KeyValuePair<PointF, TileData> 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].Data = 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));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ namespace TShockAPI
|
||||||
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;
|
||||||
public static readonly string VersionCodename = "And believe me, we are still alive.";
|
public static readonly string VersionCodename = "Try the new slim model.";
|
||||||
|
|
||||||
public static string SavePath = "tshock";
|
public static string SavePath = "tshock";
|
||||||
|
|
||||||
|
|
@ -177,7 +177,7 @@ namespace TShockAPI
|
||||||
Regions = new RegionManager(DB);
|
Regions = new RegionManager(DB);
|
||||||
Itembans = new ItemManager(DB);
|
Itembans = new ItemManager(DB);
|
||||||
RememberedPos = new RemeberedPosManager(DB);
|
RememberedPos = new RemeberedPosManager(DB);
|
||||||
RestApi = new SecureRest(IPAddress.Any, 8080);
|
RestApi = new SecureRest(Netplay.serverListenIP, 8080);
|
||||||
RestApi.Verify += RestApi_Verify;
|
RestApi.Verify += RestApi_Verify;
|
||||||
RestApi.Port = Config.RestApiPort;
|
RestApi.Port = Config.RestApiPort;
|
||||||
RestManager = new RestManager(RestApi);
|
RestManager = new RestManager(RestApi);
|
||||||
|
|
@ -310,7 +310,6 @@ namespace TShockAPI
|
||||||
if (IPAddress.TryParse(parms[++i], out ip))
|
if (IPAddress.TryParse(parms[++i], out ip))
|
||||||
{
|
{
|
||||||
Netplay.serverListenIP = ip;
|
Netplay.serverListenIP = ip;
|
||||||
RestApi.Ip = ip;
|
|
||||||
Console.Write("Using IP: {0}", ip);
|
Console.Write("Using IP: {0}", ip);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue