Merge branch 'master' of github.com:TShock/TShock into sql
This commit is contained in:
commit
cfd472b3cb
1 changed files with 15 additions and 8 deletions
|
|
@ -43,13 +43,15 @@ namespace TShockAPI
|
||||||
public TSPlayer LastWhisper;
|
public TSPlayer LastWhisper;
|
||||||
public int LoginAttempts { get; set; }
|
public int LoginAttempts { get; set; }
|
||||||
|
|
||||||
|
Player FakePlayer = null;
|
||||||
|
|
||||||
public bool RealPlayer
|
public bool RealPlayer
|
||||||
{
|
{
|
||||||
get { return Index >= 0 && Index < Main.maxNetPlayers; }
|
get { return Index >= 0 && Index < Main.maxNetPlayers && Main.player[Index] != null; }
|
||||||
}
|
}
|
||||||
public bool ConnectionAlive
|
public bool ConnectionAlive
|
||||||
{
|
{
|
||||||
get { return RealPlayer ? Netplay.serverSock[Index].active && !Netplay.serverSock[Index].kill : false; }
|
get { return RealPlayer ? Netplay.serverSock[Index] != null && Netplay.serverSock[Index].active && !Netplay.serverSock[Index].kill : false; }
|
||||||
}
|
}
|
||||||
public string IP
|
public string IP
|
||||||
{
|
{
|
||||||
|
|
@ -61,14 +63,20 @@ namespace TShockAPI
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Terraria Player
|
/// Terraria Player
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Player TPlayer { get; protected set; }
|
public Player TPlayer
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return FakePlayer ?? Main.player[Index];
|
||||||
|
}
|
||||||
|
}
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return TPlayer.name; }
|
get { return TPlayer.name; }
|
||||||
}
|
}
|
||||||
public bool Active
|
public bool Active
|
||||||
{
|
{
|
||||||
get { return TPlayer.active; }
|
get { return TPlayer != null && TPlayer.active; }
|
||||||
}
|
}
|
||||||
public int Team
|
public int Team
|
||||||
{
|
{
|
||||||
|
|
@ -104,9 +112,9 @@ namespace TShockAPI
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
if (RealPlayer)
|
if (RealPlayer)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 40; i++)
|
for (int i = 0; i < TPlayer.inventory.Length; i++)
|
||||||
{
|
{
|
||||||
if (!TPlayer.inventory[i].active)
|
if (TPlayer.inventory[i] == null || !TPlayer.inventory[i].active)
|
||||||
{
|
{
|
||||||
flag = true;
|
flag = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -121,7 +129,6 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
TilesDestroyed = new Dictionary<Vector2, Tile>();
|
TilesDestroyed = new Dictionary<Vector2, Tile>();
|
||||||
Index = index;
|
Index = index;
|
||||||
TPlayer = Main.player[index];
|
|
||||||
Group = new Group("null");
|
Group = new Group("null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,7 +136,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
TilesDestroyed = new Dictionary<Vector2, Tile>();
|
TilesDestroyed = new Dictionary<Vector2, Tile>();
|
||||||
Index = -1;
|
Index = -1;
|
||||||
TPlayer = new Player { name = playerName, whoAmi = -1 };
|
FakePlayer = new Player { name = playerName, whoAmi = -1 };
|
||||||
Group = new Group("null");
|
Group = new Group("null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue