Merge remote branch 'origin' into 1.2_terraria
This commit is contained in:
commit
5d72c6261d
6 changed files with 43 additions and 17 deletions
|
|
@ -124,7 +124,7 @@ namespace TShockAPI.DB
|
|||
{
|
||||
try
|
||||
{
|
||||
return database.Query("INSERT INTO Bans (IP, Name, Reason, BanningUser, Date, Expiration) VALUES (@0, @1, @2, @3, @4, @5);", ip, name, reason, banner, DateTime.Now.ToString("G"), expiration) != 0;
|
||||
return database.Query("INSERT INTO Bans (IP, Name, Reason, BanningUser, Date, Expiration) VALUES (@0, @1, @2, @3, @4, @5);", ip, name, reason, banner, DateTime.UtcNow.ToString("s"), expiration) != 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
@ -38,6 +39,7 @@ namespace TShockAPI.DB
|
|||
new SqlColumn("Username", MySqlDbType.VarChar, 32) {Unique = true},
|
||||
new SqlColumn("Password", MySqlDbType.VarChar, 128),
|
||||
new SqlColumn("Usergroup", MySqlDbType.Text),
|
||||
new SqlColumn("Registered", MySqlDbType.Text),
|
||||
new SqlColumn("LastAccessed", MySqlDbType.Text),
|
||||
new SqlColumn("KnownIPs", MySqlDbType.Text)
|
||||
);
|
||||
|
|
@ -60,8 +62,8 @@ namespace TShockAPI.DB
|
|||
int ret;
|
||||
try
|
||||
{
|
||||
ret = database.Query("INSERT INTO Users (Username, Password, UserGroup) VALUES (@0, @1, @2);", user.Name,
|
||||
TShock.Utils.HashPassword(user.Password), user.Group);
|
||||
ret = database.Query("INSERT INTO Users (Username, Password, UserGroup, Registered) VALUES (@0, @1, @2, @3);", user.Name,
|
||||
TShock.Utils.HashPassword(user.Password), user.Group, DateTime.UtcNow.ToString("s"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -146,7 +148,7 @@ namespace TShockAPI.DB
|
|||
{
|
||||
try
|
||||
{
|
||||
if (database.Query("UPDATE Users SET LastAccessed = @0, KnownIps = @1 WHERE Username = @2;", DateTime.Now.ToString("G"), user.KnownIps, user.Name) == 0)
|
||||
if (database.Query("UPDATE Users SET LastAccessed = @0, KnownIps = @1 WHERE Username = @2;", DateTime.UtcNow.ToString("s"), user.KnownIps, user.Name) == 0)
|
||||
throw new UserNotExistException(user.Name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -268,6 +270,7 @@ namespace TShockAPI.DB
|
|||
user.Group = result.Get<string>("Usergroup");
|
||||
user.Password = result.Get<string>("Password");
|
||||
user.Name = result.Get<string>("Username");
|
||||
user.Registered = result.Get<string>("Registered");
|
||||
user.LastAccessed = result.Get<string>("LastAccessed");
|
||||
user.KnownIps = result.Get<string>("KnownIps");
|
||||
return user;
|
||||
|
|
@ -280,14 +283,16 @@ namespace TShockAPI.DB
|
|||
public string Name { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string Group { get; set; }
|
||||
public string Registered { get; set; }
|
||||
public string LastAccessed { get; set; }
|
||||
public string KnownIps { get; set; }
|
||||
|
||||
public User(string name, string pass, string group, string last, string known)
|
||||
public User(string name, string pass, string group, string registered, string last, string known)
|
||||
{
|
||||
Name = name;
|
||||
Password = pass;
|
||||
Group = group;
|
||||
Registered = registered;
|
||||
LastAccessed = last;
|
||||
KnownIps = known;
|
||||
}
|
||||
|
|
@ -297,6 +302,7 @@ namespace TShockAPI.DB
|
|||
Name = "";
|
||||
Password = "";
|
||||
Group = "";
|
||||
Registered = "";
|
||||
LastAccessed = "";
|
||||
KnownIps = "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1880,10 +1880,10 @@ namespace TShockAPI
|
|||
}
|
||||
else if (action == EditAction.PlaceTile || action == EditAction.PlaceWall)
|
||||
{
|
||||
if (action == EditAction.PlaceTile && TShock.Config.PreventInvalidPlaceStyle && ((editData == 4 && style > 8) ||
|
||||
(editData == 13 && style > 4) || (editData == 15 && style > 1) || (editData == 21 && style > 6) ||
|
||||
(editData == 82 && style > 5) || (editData == 91 && style > 3) || (editData == 105 && style > 42) ||
|
||||
(editData == 135 && style > 3) || (editData == 139 && style > 12) || (editData == 144 && style > 2) ||
|
||||
if (action == EditAction.PlaceTile && TShock.Config.PreventInvalidPlaceStyle && ((editData == 4 && style > 11) ||
|
||||
(editData == 13 && style > 4) || (editData == 15 && style > 17) || (editData == 21 && style > 22) ||
|
||||
(editData == 82 && style > 5) || (editData == 91 && style > 21) || (editData == 105 && style > 49) ||
|
||||
(editData == 135 && style > 6) || (editData == 139 && style > 27) || (editData == 144 && style > 2) ||
|
||||
(editData == 149 && style > 2)))
|
||||
{
|
||||
args.Player.SendTileSquare(tileX, tileY);
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ namespace TShockAPI
|
|||
return RestMissingParam("password");
|
||||
|
||||
// NOTE: ip can be blank
|
||||
User user = new User(username, password, group, "", "");
|
||||
User user = new User(username, password, group, "", "", "");
|
||||
try
|
||||
{
|
||||
TShock.Users.AddUser(user);
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ namespace TShockAPI
|
|||
Main.item[itemid].stack = stack;
|
||||
Main.item[itemid].owner = Index;
|
||||
Main.item[itemid].prefix = (byte) prefix;
|
||||
Main.item[itemid].noGrabDelay = 1;
|
||||
Main.item[itemid].noGrabDelay = 1;
|
||||
Main.item[itemid].velocity = Main.player[this.Index].velocity;
|
||||
NetMessage.SendData((int)PacketTypes.ItemDrop, -1, -1, "", itemid, 0f, 0f, 0f);
|
||||
NetMessage.SendData((int)PacketTypes.ItemOwner, -1, -1, "", itemid, 0f, 0f, 0f);
|
||||
|
|
|
|||
|
|
@ -1541,9 +1541,10 @@ namespace TShockAPI
|
|||
|
||||
Item[] inventory = player.TPlayer.inventory;
|
||||
Item[] armor = player.TPlayer.armor;
|
||||
Item[] dye = player.TPlayer.dye;
|
||||
for (int i = 0; i < NetItem.maxNetInventory; i++)
|
||||
{
|
||||
if (i < 49)
|
||||
if (i < NetItem.maxNetInventory - (NetItem.armorSlots + NetItem.dyeSlots))
|
||||
{
|
||||
Item item = new Item();
|
||||
if (inventory[i] != null && inventory[i].netID != 0)
|
||||
|
|
@ -1560,15 +1561,16 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if(i < (NetItem.maxNetInventory - (NetItem.armorSlots + NetItem.dyeSlots)))
|
||||
{
|
||||
Item item = new Item();
|
||||
if (armor[i - 48] != null && armor[i - 48].netID != 0)
|
||||
var index = i - (NetItem.maxNetInventory - (NetItem.armorSlots + NetItem.dyeSlots));
|
||||
if (armor[index] != null && armor[index].netID != 0)
|
||||
{
|
||||
item.netDefaults(armor[i - 48].netID);
|
||||
item.Prefix(armor[i - 48].prefix);
|
||||
item.netDefaults(armor[index].netID);
|
||||
item.Prefix(armor[index].prefix);
|
||||
item.AffixName();
|
||||
if (armor[i - 48].stack > item.maxStack)
|
||||
if (armor[index].stack > item.maxStack)
|
||||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
|
|
@ -1577,6 +1579,24 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (i < (NetItem.maxNetInventory - (NetItem.armorSlots + NetItem.dyeSlots)))
|
||||
{
|
||||
Item item = new Item();
|
||||
var index = i - (NetItem.maxNetInventory - NetItem.dyeSlots);
|
||||
if (dye[index] != null && dye[index].netID != 0)
|
||||
{
|
||||
item.netDefaults(dye[index].netID);
|
||||
item.Prefix(dye[index].prefix);
|
||||
item.AffixName();
|
||||
if (dye[index].stack > item.maxStack)
|
||||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove dye {0} ({1}) and then rejoin", item.name, dye[index].stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return check;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue