Merge branch 'general-devel' into feature/db-connectionstrings
This commit is contained in:
commit
1e25960600
7 changed files with 1170 additions and 970 deletions
|
|
@ -19,7 +19,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Terraria.ID;
|
using Terraria.ID;
|
||||||
using TShockAPI.Net;
|
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using TShockAPI.Localization;
|
using TShockAPI.Localization;
|
||||||
|
|
@ -29,6 +28,7 @@ using Terraria.DataStructures;
|
||||||
using Terraria.Localization;
|
using Terraria.Localization;
|
||||||
using TShockAPI.Models.PlayerUpdate;
|
using TShockAPI.Models.PlayerUpdate;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using OTAPI;
|
||||||
using Terraria.GameContent.Tile_Entities;
|
using Terraria.GameContent.Tile_Entities;
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
|
|
@ -137,6 +137,7 @@ namespace TShockAPI
|
||||||
GetDataHandlers.KillMe += OnKillMe;
|
GetDataHandlers.KillMe += OnKillMe;
|
||||||
GetDataHandlers.FishOutNPC += OnFishOutNPC;
|
GetDataHandlers.FishOutNPC += OnFishOutNPC;
|
||||||
GetDataHandlers.FoodPlatterTryPlacing += OnFoodPlatterTryPlacing;
|
GetDataHandlers.FoodPlatterTryPlacing += OnFoodPlatterTryPlacing;
|
||||||
|
OTAPI.Hooks.Chest.QuickStack += OnQuickStack;
|
||||||
|
|
||||||
|
|
||||||
// The following section is based off Player.PlaceThing_Tiles_PlaceIt and Player.PlaceThing_Tiles_PlaceIt_GetLegacyTileStyle.
|
// The following section is based off Player.PlaceThing_Tiles_PlaceIt and Player.PlaceThing_Tiles_PlaceIt_GetLegacyTileStyle.
|
||||||
|
|
@ -2564,8 +2565,8 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
//Generic bounds checking, though I'm not sure if anyone would willingly hack themselves outside the map?
|
//Generic bounds checking, though I'm not sure if anyone would willingly hack themselves outside the map?
|
||||||
if (args.NewPosition.X > Main.maxTilesX || args.NewPosition.X < 0
|
if (args.NewPosition.X > Main.maxTilesX *16 || args.NewPosition.X < 0
|
||||||
|| args.NewPosition.Y > Main.maxTilesY || args.NewPosition.Y < 0)
|
|| args.NewPosition.Y > Main.maxTilesY *16 || args.NewPosition.Y < 0)
|
||||||
{
|
{
|
||||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerPortalTeleport rejected teleport out of bounds from {0}", args.Player.Name));
|
TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerPortalTeleport rejected teleport out of bounds from {0}", args.Player.Name));
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
|
@ -2900,6 +2901,37 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when a player is trying to put an item into chest through Quick Stack.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
internal void OnQuickStack(object sender, OTAPI.Hooks.Chest.QuickStackEventArgs args)
|
||||||
|
{
|
||||||
|
var id = args.ChestIndex;
|
||||||
|
var plr = TShock.Players[args.PlayerId];
|
||||||
|
|
||||||
|
if (plr is not { Active: true })
|
||||||
|
{
|
||||||
|
args.Result = HookResult.Cancel;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plr.IsBeingDisabled())
|
||||||
|
{
|
||||||
|
TShock.Log.ConsoleDebug(GetString("Bouncer / OnQuickStack rejected from disable from {0}", plr.Name));
|
||||||
|
args.Result = HookResult.Cancel;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!plr.HasBuildPermission(Main.chest[id].x, Main.chest[id].y) && TShock.Config.Settings.RegionProtectChests)
|
||||||
|
{
|
||||||
|
TShock.Log.ConsoleDebug(GetString("Bouncer / OnQuickStack rejected from region protection? from {0}", plr.Name));
|
||||||
|
args.Result = HookResult.Cancel;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal void OnSecondUpdate()
|
internal void OnSecondUpdate()
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
|
|
|
||||||
|
|
@ -629,6 +629,24 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
HelpText = GetString("Shows the server's rules.")
|
HelpText = GetString("Shows the server's rules.")
|
||||||
});
|
});
|
||||||
|
add(new Command(ShowDeath, "death")
|
||||||
|
{
|
||||||
|
HelpText = GetString("Shows your number of deaths."),
|
||||||
|
AllowServer = false
|
||||||
|
});
|
||||||
|
add(new Command(ShowPVPDeath, "pvpdeath")
|
||||||
|
{
|
||||||
|
HelpText = GetString("Shows your number of PVP deaths."),
|
||||||
|
AllowServer = false
|
||||||
|
});
|
||||||
|
add(new Command(ShowAllDeath, "alldeath")
|
||||||
|
{
|
||||||
|
HelpText = GetString("Shows the number of deaths for all online players."),
|
||||||
|
});
|
||||||
|
add(new Command(ShowAllPVPDeath, "allpvpdeath")
|
||||||
|
{
|
||||||
|
HelpText = GetString("Shows the number of PVP deaths for all online players."),
|
||||||
|
});
|
||||||
|
|
||||||
TShockCommands = new ReadOnlyCollection<Command>(tshockCommands);
|
TShockCommands = new ReadOnlyCollection<Command>(tshockCommands);
|
||||||
}
|
}
|
||||||
|
|
@ -5815,6 +5833,49 @@ namespace TShockAPI
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ShowDeath(CommandArgs args)
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage(GetString($"*You were slain {args.Player.DeathsPVE} times."));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ShowPVPDeath(CommandArgs args)
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage(GetString($"*You were slain by other players {args.Player.DeathsPVP} times."));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ShowAllDeath(CommandArgs args)
|
||||||
|
{
|
||||||
|
if (TShock.Utils.GetActivePlayerCount() == 0)
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage(GetString("There are currently no players online."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var deathsRank = TShock.Players
|
||||||
|
.Where(p => p is { Active: true })
|
||||||
|
.OrderByDescending(x => x.DeathsPVE)
|
||||||
|
.Select(x => GetString($"*{x.Name} was slain {x.DeathsPVE} times."));
|
||||||
|
|
||||||
|
args.Player.SendErrorMessage(string.Join('\n',deathsRank));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ShowAllPVPDeath(CommandArgs args)
|
||||||
|
{
|
||||||
|
if (TShock.Utils.GetActivePlayerCount() == 0)
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage(GetString("There are currently no players online."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var deathsRank = TShock.Players
|
||||||
|
.Where(p => p is { Active: true })
|
||||||
|
.OrderByDescending(x => x.DeathsPVP)
|
||||||
|
.Select(x => GetString($"*{x.Name} was slain by other players {x.DeathsPVP} times."));
|
||||||
|
|
||||||
|
args.Player.SendErrorMessage(string.Join('\n',deathsRank));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion General Commands
|
#endregion General Commands
|
||||||
|
|
||||||
#region Game Commands
|
#region Game Commands
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,9 @@ namespace TShockAPI.DB
|
||||||
new SqlColumn("usedGummyWorm", MySqlDbType.Int32),
|
new SqlColumn("usedGummyWorm", MySqlDbType.Int32),
|
||||||
new SqlColumn("usedAmbrosia", MySqlDbType.Int32),
|
new SqlColumn("usedAmbrosia", MySqlDbType.Int32),
|
||||||
new SqlColumn("unlockedSuperCart", MySqlDbType.Int32),
|
new SqlColumn("unlockedSuperCart", MySqlDbType.Int32),
|
||||||
new SqlColumn("enabledSuperCart", MySqlDbType.Int32)
|
new SqlColumn("enabledSuperCart", MySqlDbType.Int32),
|
||||||
|
new SqlColumn("deathsPVE", MySqlDbType.Int32),
|
||||||
|
new SqlColumn("deathsPVP", MySqlDbType.Int32)
|
||||||
);
|
);
|
||||||
|
|
||||||
SqlTableCreator creator = new(db, db.GetSqlQueryBuilder());
|
SqlTableCreator creator = new(db, db.GetSqlQueryBuilder());
|
||||||
|
|
@ -132,6 +134,8 @@ namespace TShockAPI.DB
|
||||||
playerData.usedAmbrosia = reader.Get<int>("usedAmbrosia");
|
playerData.usedAmbrosia = reader.Get<int>("usedAmbrosia");
|
||||||
playerData.unlockedSuperCart = reader.Get<int>("unlockedSuperCart");
|
playerData.unlockedSuperCart = reader.Get<int>("unlockedSuperCart");
|
||||||
playerData.enabledSuperCart = reader.Get<int>("enabledSuperCart");
|
playerData.enabledSuperCart = reader.Get<int>("enabledSuperCart");
|
||||||
|
playerData.deathsPVE = reader.Get<int>("deathsPVE");
|
||||||
|
playerData.deathsPVP = reader.Get<int>("deathsPVP");
|
||||||
return playerData;
|
return playerData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -200,8 +204,8 @@ namespace TShockAPI.DB
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
database.Query(
|
database.Query(
|
||||||
"INSERT INTO tsCharacter (Account, Health, MaxHealth, Mana, MaxMana, Inventory, extraSlot, spawnX, spawnY, skinVariant, hair, hairDye, hairColor, pantsColor, shirtColor, underShirtColor, shoeColor, hideVisuals, skinColor, eyeColor, questsCompleted, usingBiomeTorches, happyFunTorchTime, unlockedBiomeTorches, currentLoadoutIndex,ateArtisanBread, usedAegisCrystal, usedAegisFruit, usedArcaneCrystal, usedGalaxyPearl, usedGummyWorm, usedAmbrosia, unlockedSuperCart, enabledSuperCart) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29, @30, @31, @32, @33);",
|
"INSERT INTO tsCharacter (Account, Health, MaxHealth, Mana, MaxMana, Inventory, extraSlot, spawnX, spawnY, skinVariant, hair, hairDye, hairColor, pantsColor, shirtColor, underShirtColor, shoeColor, hideVisuals, skinColor, eyeColor, questsCompleted, usingBiomeTorches, happyFunTorchTime, unlockedBiomeTorches, currentLoadoutIndex,ateArtisanBread, usedAegisCrystal, usedAegisFruit, usedArcaneCrystal, usedGalaxyPearl, usedGummyWorm, usedAmbrosia, unlockedSuperCart, enabledSuperCart, deathsPVE, deathsPVP) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29, @30, @31, @32, @33, @34, @35);",
|
||||||
player.Account.ID, playerData.health, playerData.maxHealth, playerData.mana, playerData.maxMana, string.Join("~", playerData.inventory), playerData.extraSlot, player.TPlayer.SpawnX, player.TPlayer.SpawnY, player.TPlayer.skinVariant, player.TPlayer.hair, player.TPlayer.hairDye, TShock.Utils.EncodeColor(player.TPlayer.hairColor), TShock.Utils.EncodeColor(player.TPlayer.pantsColor),TShock.Utils.EncodeColor(player.TPlayer.shirtColor), TShock.Utils.EncodeColor(player.TPlayer.underShirtColor), TShock.Utils.EncodeColor(player.TPlayer.shoeColor), TShock.Utils.EncodeBoolArray(player.TPlayer.hideVisibleAccessory), TShock.Utils.EncodeColor(player.TPlayer.skinColor),TShock.Utils.EncodeColor(player.TPlayer.eyeColor), player.TPlayer.anglerQuestsFinished, player.TPlayer.UsingBiomeTorches ? 1 : 0, player.TPlayer.happyFunTorchTime ? 1 : 0, player.TPlayer.unlockedBiomeTorches ? 1 : 0, player.TPlayer.CurrentLoadoutIndex, player.TPlayer.ateArtisanBread ? 1 : 0, player.TPlayer.usedAegisCrystal ? 1 : 0, player.TPlayer.usedAegisFruit ? 1 : 0, player.TPlayer.usedArcaneCrystal ? 1 : 0, player.TPlayer.usedGalaxyPearl ? 1 : 0, player.TPlayer.usedGummyWorm ? 1 : 0, player.TPlayer.usedAmbrosia ? 1 : 0, player.TPlayer.unlockedSuperCart ? 1 : 0, player.TPlayer.enabledSuperCart ? 1 : 0);
|
player.Account.ID, playerData.health, playerData.maxHealth, playerData.mana, playerData.maxMana, string.Join("~", playerData.inventory), playerData.extraSlot, player.TPlayer.SpawnX, player.TPlayer.SpawnY, player.TPlayer.skinVariant, player.TPlayer.hair, player.TPlayer.hairDye, TShock.Utils.EncodeColor(player.TPlayer.hairColor), TShock.Utils.EncodeColor(player.TPlayer.pantsColor),TShock.Utils.EncodeColor(player.TPlayer.shirtColor), TShock.Utils.EncodeColor(player.TPlayer.underShirtColor), TShock.Utils.EncodeColor(player.TPlayer.shoeColor), TShock.Utils.EncodeBoolArray(player.TPlayer.hideVisibleAccessory), TShock.Utils.EncodeColor(player.TPlayer.skinColor),TShock.Utils.EncodeColor(player.TPlayer.eyeColor), player.TPlayer.anglerQuestsFinished, player.TPlayer.UsingBiomeTorches ? 1 : 0, player.TPlayer.happyFunTorchTime ? 1 : 0, player.TPlayer.unlockedBiomeTorches ? 1 : 0, player.TPlayer.CurrentLoadoutIndex, player.TPlayer.ateArtisanBread ? 1 : 0, player.TPlayer.usedAegisCrystal ? 1 : 0, player.TPlayer.usedAegisFruit ? 1 : 0, player.TPlayer.usedArcaneCrystal ? 1 : 0, player.TPlayer.usedGalaxyPearl ? 1 : 0, player.TPlayer.usedGummyWorm ? 1 : 0, player.TPlayer.usedAmbrosia ? 1 : 0, player.TPlayer.unlockedSuperCart ? 1 : 0, player.TPlayer.enabledSuperCart ? 1 : 0, player.sscDeathsPVE, player.sscDeathsPVP);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
@ -214,8 +218,8 @@ namespace TShockAPI.DB
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
database.Query(
|
database.Query(
|
||||||
"UPDATE tsCharacter SET Health = @0, MaxHealth = @1, Mana = @2, MaxMana = @3, Inventory = @4, spawnX = @6, spawnY = @7, hair = @8, hairDye = @9, hairColor = @10, pantsColor = @11, shirtColor = @12, underShirtColor = @13, shoeColor = @14, hideVisuals = @15, skinColor = @16, eyeColor = @17, questsCompleted = @18, skinVariant = @19, extraSlot = @20, usingBiomeTorches = @21, happyFunTorchTime = @22, unlockedBiomeTorches = @23, currentLoadoutIndex = @24, ateArtisanBread = @25, usedAegisCrystal = @26, usedAegisFruit = @27, usedArcaneCrystal = @28, usedGalaxyPearl = @29, usedGummyWorm = @30, usedAmbrosia = @31, unlockedSuperCart = @32, enabledSuperCart = @33 WHERE Account = @5;",
|
"UPDATE tsCharacter SET Health = @0, MaxHealth = @1, Mana = @2, MaxMana = @3, Inventory = @4, spawnX = @6, spawnY = @7, hair = @8, hairDye = @9, hairColor = @10, pantsColor = @11, shirtColor = @12, underShirtColor = @13, shoeColor = @14, hideVisuals = @15, skinColor = @16, eyeColor = @17, questsCompleted = @18, skinVariant = @19, extraSlot = @20, usingBiomeTorches = @21, happyFunTorchTime = @22, unlockedBiomeTorches = @23, currentLoadoutIndex = @24, ateArtisanBread = @25, usedAegisCrystal = @26, usedAegisFruit = @27, usedArcaneCrystal = @28, usedGalaxyPearl = @29, usedGummyWorm = @30, usedAmbrosia = @31, unlockedSuperCart = @32, enabledSuperCart = @33, deathsPVE = @34, deathsPVP = @35 WHERE Account = @5;",
|
||||||
playerData.health, playerData.maxHealth, playerData.mana, playerData.maxMana, string.Join("~", playerData.inventory), player.Account.ID, player.TPlayer.SpawnX, player.TPlayer.SpawnY, player.TPlayer.hair, player.TPlayer.hairDye, TShock.Utils.EncodeColor(player.TPlayer.hairColor), TShock.Utils.EncodeColor(player.TPlayer.pantsColor), TShock.Utils.EncodeColor(player.TPlayer.shirtColor), TShock.Utils.EncodeColor(player.TPlayer.underShirtColor), TShock.Utils.EncodeColor(player.TPlayer.shoeColor), TShock.Utils.EncodeBoolArray(player.TPlayer.hideVisibleAccessory), TShock.Utils.EncodeColor(player.TPlayer.skinColor), TShock.Utils.EncodeColor(player.TPlayer.eyeColor), player.TPlayer.anglerQuestsFinished, player.TPlayer.skinVariant, player.TPlayer.extraAccessory ? 1 : 0, player.TPlayer.UsingBiomeTorches ? 1 : 0, player.TPlayer.happyFunTorchTime ? 1 : 0, player.TPlayer.unlockedBiomeTorches ? 1 : 0, player.TPlayer.CurrentLoadoutIndex, player.TPlayer.ateArtisanBread ? 1 : 0, player.TPlayer.usedAegisCrystal ? 1 : 0, player.TPlayer.usedAegisFruit ? 1 : 0, player.TPlayer.usedArcaneCrystal ? 1 : 0, player.TPlayer.usedGalaxyPearl ? 1 : 0, player.TPlayer.usedGummyWorm ? 1 : 0, player.TPlayer.usedAmbrosia ? 1 : 0, player.TPlayer.unlockedSuperCart ? 1 : 0, player.TPlayer.enabledSuperCart ? 1 : 0);
|
playerData.health, playerData.maxHealth, playerData.mana, playerData.maxMana, string.Join("~", playerData.inventory), player.Account.ID, player.TPlayer.SpawnX, player.TPlayer.SpawnY, player.TPlayer.hair, player.TPlayer.hairDye, TShock.Utils.EncodeColor(player.TPlayer.hairColor), TShock.Utils.EncodeColor(player.TPlayer.pantsColor), TShock.Utils.EncodeColor(player.TPlayer.shirtColor), TShock.Utils.EncodeColor(player.TPlayer.underShirtColor), TShock.Utils.EncodeColor(player.TPlayer.shoeColor), TShock.Utils.EncodeBoolArray(player.TPlayer.hideVisibleAccessory), TShock.Utils.EncodeColor(player.TPlayer.skinColor), TShock.Utils.EncodeColor(player.TPlayer.eyeColor), player.TPlayer.anglerQuestsFinished, player.TPlayer.skinVariant, player.TPlayer.extraAccessory ? 1 : 0, player.TPlayer.UsingBiomeTorches ? 1 : 0, player.TPlayer.happyFunTorchTime ? 1 : 0, player.TPlayer.unlockedBiomeTorches ? 1 : 0, player.TPlayer.CurrentLoadoutIndex, player.TPlayer.ateArtisanBread ? 1 : 0, player.TPlayer.usedAegisCrystal ? 1 : 0, player.TPlayer.usedAegisFruit ? 1 : 0, player.TPlayer.usedArcaneCrystal ? 1 : 0, player.TPlayer.usedGalaxyPearl ? 1 : 0, player.TPlayer.usedGummyWorm ? 1 : 0, player.TPlayer.usedAmbrosia ? 1 : 0, player.TPlayer.unlockedSuperCart ? 1 : 0, player.TPlayer.enabledSuperCart ? 1 : 0, player.sscDeathsPVE, player.sscDeathsPVP);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
@ -270,7 +274,7 @@ namespace TShockAPI.DB
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
database.Query(
|
database.Query(
|
||||||
"INSERT INTO tsCharacter (Account, Health, MaxHealth, Mana, MaxMana, Inventory, extraSlot, spawnX, spawnY, skinVariant, hair, hairDye, hairColor, pantsColor, shirtColor, underShirtColor, shoeColor, hideVisuals, skinColor, eyeColor, questsCompleted, usingBiomeTorches, happyFunTorchTime, unlockedBiomeTorches, currentLoadoutIndex, ateArtisanBread, usedAegisCrystal, usedAegisFruit, usedArcaneCrystal, usedGalaxyPearl, usedGummyWorm, usedAmbrosia, unlockedSuperCart, enabledSuperCart) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29, @30, @31, @32, @33);",
|
"INSERT INTO tsCharacter (Account, Health, MaxHealth, Mana, MaxMana, Inventory, extraSlot, spawnX, spawnY, skinVariant, hair, hairDye, hairColor, pantsColor, shirtColor, underShirtColor, shoeColor, hideVisuals, skinColor, eyeColor, questsCompleted, usingBiomeTorches, happyFunTorchTime, unlockedBiomeTorches, currentLoadoutIndex, ateArtisanBread, usedAegisCrystal, usedAegisFruit, usedArcaneCrystal, usedGalaxyPearl, usedGummyWorm, usedAmbrosia, unlockedSuperCart, enabledSuperCart) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21, @22, @23, @24, @25, @26, @27, @28, @29, @30, @31, @32, @33, @34, @35);",
|
||||||
player.Account.ID,
|
player.Account.ID,
|
||||||
playerData.health,
|
playerData.health,
|
||||||
playerData.maxHealth,
|
playerData.maxHealth,
|
||||||
|
|
@ -304,7 +308,10 @@ namespace TShockAPI.DB
|
||||||
playerData.usedGummyWorm,
|
playerData.usedGummyWorm,
|
||||||
playerData.usedAmbrosia,
|
playerData.usedAmbrosia,
|
||||||
playerData.unlockedSuperCart,
|
playerData.unlockedSuperCart,
|
||||||
playerData.enabledSuperCart);
|
playerData.enabledSuperCart,
|
||||||
|
playerData.deathsPVE,
|
||||||
|
playerData.deathsPVP
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
@ -317,7 +324,7 @@ namespace TShockAPI.DB
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
database.Query(
|
database.Query(
|
||||||
"UPDATE tsCharacter SET Health = @0, MaxHealth = @1, Mana = @2, MaxMana = @3, Inventory = @4, spawnX = @6, spawnY = @7, hair = @8, hairDye = @9, hairColor = @10, pantsColor = @11, shirtColor = @12, underShirtColor = @13, shoeColor = @14, hideVisuals = @15, skinColor = @16, eyeColor = @17, questsCompleted = @18, skinVariant = @19, extraSlot = @20, usingBiomeTorches = @21, happyFunTorchTime = @22, unlockedBiomeTorches = @23, currentLoadoutIndex = @24, ateArtisanBread = @25, usedAegisCrystal = @26, usedAegisFruit = @27, usedArcaneCrystal = @28, usedGalaxyPearl = @29, usedGummyWorm = @30, usedAmbrosia = @31, unlockedSuperCart = @32, enabledSuperCart = @33 WHERE Account = @5;",
|
"UPDATE tsCharacter SET Health = @0, MaxHealth = @1, Mana = @2, MaxMana = @3, Inventory = @4, spawnX = @6, spawnY = @7, hair = @8, hairDye = @9, hairColor = @10, pantsColor = @11, shirtColor = @12, underShirtColor = @13, shoeColor = @14, hideVisuals = @15, skinColor = @16, eyeColor = @17, questsCompleted = @18, skinVariant = @19, extraSlot = @20, usingBiomeTorches = @21, happyFunTorchTime = @22, unlockedBiomeTorches = @23, currentLoadoutIndex = @24, ateArtisanBread = @25, usedAegisCrystal = @26, usedAegisFruit = @27, usedArcaneCrystal = @28, usedGalaxyPearl = @29, usedGummyWorm = @30, usedAmbrosia = @31, unlockedSuperCart = @32, enabledSuperCart = @33, deathsPVE = @34, deathsPVP = @35 WHERE Account = @5;",
|
||||||
playerData.health,
|
playerData.health,
|
||||||
playerData.maxHealth,
|
playerData.maxHealth,
|
||||||
playerData.mana,
|
playerData.mana,
|
||||||
|
|
@ -351,7 +358,10 @@ namespace TShockAPI.DB
|
||||||
playerData.usedGummyWorm,
|
playerData.usedGummyWorm,
|
||||||
playerData.usedAmbrosia,
|
playerData.usedAmbrosia,
|
||||||
playerData.unlockedSuperCart,
|
playerData.unlockedSuperCart,
|
||||||
playerData.enabledSuperCart);
|
playerData.enabledSuperCart,
|
||||||
|
playerData.deathsPVE,
|
||||||
|
playerData.deathsPVP
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
|
|
@ -3776,7 +3776,8 @@ namespace TShockAPI
|
||||||
args.Player.SelectedItem.type != ItemID.SpectrePaintScraper &&
|
args.Player.SelectedItem.type != ItemID.SpectrePaintScraper &&
|
||||||
args.Player.SelectedItem.type != ItemID.SpectrePaintbrush &&
|
args.Player.SelectedItem.type != ItemID.SpectrePaintbrush &&
|
||||||
!args.Player.Accessories.Any(HasPaintSprayerAbilities) &&
|
!args.Player.Accessories.Any(HasPaintSprayerAbilities) &&
|
||||||
!args.Player.Inventory.Any(HasPaintSprayerAbilities))
|
!args.Player.Inventory.Any(HasPaintSprayerAbilities) &&
|
||||||
|
!args.TPlayer.bank4.item.Any(HasPaintSprayerAbilities)) //Void Bag
|
||||||
{
|
{
|
||||||
TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandlePaintTile rejected select consistency {0}", args.Player.Name));
|
TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandlePaintTile rejected select consistency {0}", args.Player.Name));
|
||||||
args.Player.SendData(PacketTypes.PaintTile, "", x, y, Main.tile[x, y].color());
|
args.Player.SendData(PacketTypes.PaintTile, "", x, y, Main.tile[x, y].color());
|
||||||
|
|
@ -3824,7 +3825,8 @@ namespace TShockAPI
|
||||||
args.Player.SelectedItem.type != ItemID.SpectrePaintScraper &&
|
args.Player.SelectedItem.type != ItemID.SpectrePaintScraper &&
|
||||||
args.Player.SelectedItem.type != ItemID.SpectrePaintbrush &&
|
args.Player.SelectedItem.type != ItemID.SpectrePaintbrush &&
|
||||||
!args.Player.Accessories.Any(HasPaintSprayerAbilities) &&
|
!args.Player.Accessories.Any(HasPaintSprayerAbilities) &&
|
||||||
!args.Player.Inventory.Any(HasPaintSprayerAbilities))
|
!args.Player.Inventory.Any(HasPaintSprayerAbilities)&&
|
||||||
|
!args.TPlayer.bank4.item.Any(HasPaintSprayerAbilities)) //Void Bag
|
||||||
{
|
{
|
||||||
TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandlePaintWall rejected selector consistency {0}", args.Player.Name));
|
TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandlePaintWall rejected selector consistency {0}", args.Player.Name));
|
||||||
args.Player.SendData(PacketTypes.PaintWall, "", x, y, Main.tile[x, y].wallColor());
|
args.Player.SendData(PacketTypes.PaintWall, "", x, y, Main.tile[x, y].wallColor());
|
||||||
|
|
@ -4328,6 +4330,15 @@ namespace TShockAPI
|
||||||
args.Player.Dead = true;
|
args.Player.Dead = true;
|
||||||
args.Player.RespawnTimer = TShock.Config.Settings.RespawnSeconds;
|
args.Player.RespawnTimer = TShock.Config.Settings.RespawnSeconds;
|
||||||
|
|
||||||
|
if (Main.ServerSideCharacter && !args.Player.HasPermission(Permissions.bypassssc))
|
||||||
|
{
|
||||||
|
if (pvp)
|
||||||
|
{
|
||||||
|
args.Player.sscDeathsPVP++;
|
||||||
|
}
|
||||||
|
args.Player.sscDeathsPVE++;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (NPC npc in Main.npc)
|
foreach (NPC npc in Main.npc)
|
||||||
{
|
{
|
||||||
if (npc.active && (npc.boss || npc.type == 13 || npc.type == 14 || npc.type == 15) &&
|
if (npc.active && (npc.boss || npc.type == 13 || npc.type == 14 || npc.type == 15) &&
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@ namespace TShockAPI
|
||||||
public int usedAmbrosia;
|
public int usedAmbrosia;
|
||||||
public int unlockedSuperCart;
|
public int unlockedSuperCart;
|
||||||
public int enabledSuperCart;
|
public int enabledSuperCart;
|
||||||
|
public int deathsPVE;
|
||||||
|
public int deathsPVP;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the default values for the inventory.
|
/// Sets the default values for the inventory.
|
||||||
|
|
@ -152,6 +154,8 @@ namespace TShockAPI
|
||||||
this.usedAmbrosia = player.TPlayer.usedAmbrosia ? 1 : 0;
|
this.usedAmbrosia = player.TPlayer.usedAmbrosia ? 1 : 0;
|
||||||
this.unlockedSuperCart = player.TPlayer.unlockedSuperCart ? 1 : 0;
|
this.unlockedSuperCart = player.TPlayer.unlockedSuperCart ? 1 : 0;
|
||||||
this.enabledSuperCart = player.TPlayer.enabledSuperCart ? 1 : 0;
|
this.enabledSuperCart = player.TPlayer.enabledSuperCart ? 1 : 0;
|
||||||
|
this.deathsPVE = player.TPlayer.numberOfDeathsPVE;
|
||||||
|
this.deathsPVP = player.TPlayer.numberOfDeathsPVP;
|
||||||
|
|
||||||
Item[] inventory = player.TPlayer.inventory;
|
Item[] inventory = player.TPlayer.inventory;
|
||||||
Item[] armor = player.TPlayer.armor;
|
Item[] armor = player.TPlayer.armor;
|
||||||
|
|
@ -293,6 +297,8 @@ namespace TShockAPI
|
||||||
player.TPlayer.usedAmbrosia = this.usedAmbrosia == 1;
|
player.TPlayer.usedAmbrosia = this.usedAmbrosia == 1;
|
||||||
player.TPlayer.unlockedSuperCart = this.unlockedSuperCart == 1;
|
player.TPlayer.unlockedSuperCart = this.unlockedSuperCart == 1;
|
||||||
player.TPlayer.enabledSuperCart = this.enabledSuperCart == 1;
|
player.TPlayer.enabledSuperCart = this.enabledSuperCart == 1;
|
||||||
|
player.sscDeathsPVE = this.deathsPVE;
|
||||||
|
player.sscDeathsPVP = this.deathsPVP;
|
||||||
|
|
||||||
if (extraSlot != null)
|
if (extraSlot != null)
|
||||||
player.TPlayer.extraAccessory = extraSlot.Value == 1 ? true : false;
|
player.TPlayer.extraAccessory = extraSlot.Value == 1 ? true : false;
|
||||||
|
|
|
||||||
|
|
@ -401,6 +401,48 @@ namespace TShockAPI
|
||||||
/// <summary>Determines if the player has finished the handshake (Sent all necessary packets for connection, such as Request World Data, Spawn Player, etc). A normal client would do all of this no problem.</summary>
|
/// <summary>Determines if the player has finished the handshake (Sent all necessary packets for connection, such as Request World Data, Spawn Player, etc). A normal client would do all of this no problem.</summary>
|
||||||
public bool FinishedHandshake = false;
|
public bool FinishedHandshake = false;
|
||||||
|
|
||||||
|
/// <summary>Server-side character's recorded death count.</summary>
|
||||||
|
public int sscDeathsPVE = 0;
|
||||||
|
|
||||||
|
/// <summary>Server-side character's recorded PVP death count.</summary>
|
||||||
|
public int sscDeathsPVP = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the player's total death count.
|
||||||
|
/// If server-side characters are enabled and player doesn't have bypass permission,
|
||||||
|
/// returns the server-stored value; otherwise returns the client's value.
|
||||||
|
/// </summary>
|
||||||
|
public int DeathsPVE
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (Main.ServerSideCharacter && !this.HasPermission(Permissions.bypassssc))
|
||||||
|
{
|
||||||
|
return sscDeathsPVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.TPlayer.numberOfDeathsPVE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the player's total PVP death count.
|
||||||
|
/// If server-side characters are enabled and player doesn't have bypass permission,
|
||||||
|
/// returns the server-stored value; otherwise returns the client's value.
|
||||||
|
/// </summary>
|
||||||
|
public int DeathsPVP
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (Main.ServerSideCharacter && !this.HasPermission(Permissions.bypassssc))
|
||||||
|
{
|
||||||
|
return sscDeathsPVP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.TPlayer.numberOfDeathsPVP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Checks to see if active throttling is happening on events by Bouncer. Rejects repeated events by malicious clients in a short window.</summary>
|
/// <summary>Checks to see if active throttling is happening on events by Bouncer. Rejects repeated events by malicious clients in a short window.</summary>
|
||||||
/// <returns>If the player is currently being throttled by Bouncer, or not.</returns>
|
/// <returns>If the player is currently being throttled by Bouncer, or not.</returns>
|
||||||
public bool IsBouncerThrottled()
|
public bool IsBouncerThrottled()
|
||||||
|
|
|
||||||
1948
i18n/template.pot
1948
i18n/template.pot
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue