sync
This commit is contained in:
parent
b74725a707
commit
9eb49b0447
18 changed files with 242 additions and 165 deletions
|
|
@ -15,6 +15,7 @@ GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
@ -165,11 +166,12 @@ namespace TShockAPI
|
|||
var usingBiomeTorches = player.UsingBiomeTorches;
|
||||
player.UsingBiomeTorches = true;
|
||||
// BiomeTorchPlaceStyle returns the place style of the player's current biome's biome torch
|
||||
var biomeTorchPlaceStyle = player.BiomeTorchPlaceStyle(actualItemPlaceStyle);
|
||||
var type = 114514; // Not used
|
||||
player.BiomeTorchPlaceStyle(ref type ,ref actualItemPlaceStyle);
|
||||
// Reset UsingBiomeTorches value
|
||||
player.UsingBiomeTorches = usingBiomeTorches;
|
||||
|
||||
return biomeTorchPlaceStyle;
|
||||
return actualItemPlaceStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -720,7 +722,7 @@ namespace TShockAPI
|
|||
if (action == EditAction.KillTile && !Main.tileCut[tile.type] && !breakableTiles.Contains(tile.type) && args.Player.RecentFuse == 0)
|
||||
{
|
||||
// If the tile is an axe tile and they aren't selecting an axe, they're hacking.
|
||||
if (Main.tileAxe[tile.type] && ((args.Player.TPlayer.mount.Type != MountID.Drill && selectedItem.axe == 0) && !ItemID.Sets.Explosives[selectedItem.netID]))
|
||||
if (Main.tileAxe[tile.type] && ((args.Player.TPlayer.mount.Type != MountID.Drill && selectedItem.axe == 0) && !ItemID.Sets.Explosives[selectedItem.type]))
|
||||
{
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (axe) {0} {1} {2}", args.Player.Name, action, editData));
|
||||
args.Player.SendTileSquareCentered(tileX, tileY, 4);
|
||||
|
|
@ -728,7 +730,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
// If the tile is a hammer tile and they aren't selecting a hammer, they're hacking.
|
||||
else if (Main.tileHammer[tile.type] && ((args.Player.TPlayer.mount.Type != MountID.Drill && selectedItem.hammer == 0) && !ItemID.Sets.Explosives[selectedItem.netID]))
|
||||
else if (Main.tileHammer[tile.type] && ((args.Player.TPlayer.mount.Type != MountID.Drill && selectedItem.hammer == 0) && !ItemID.Sets.Explosives[selectedItem.type]))
|
||||
{
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (hammer) {0} {1} {2}", args.Player.Name, action, editData));
|
||||
args.Player.SendTileSquareCentered(tileX, tileY, 4);
|
||||
|
|
@ -740,7 +742,7 @@ namespace TShockAPI
|
|||
// also add an exception for snake coils, they can be removed when the player places a new one or after x amount of time
|
||||
// If the tile is part of the breakable when placing set, it might be getting broken by a placement.
|
||||
else if (tile.type != TileID.ItemFrame && tile.type != TileID.MysticSnakeRope
|
||||
&& !ItemID.Sets.Explosives[selectedItem.netID]
|
||||
&& !ItemID.Sets.Explosives[selectedItem.type]
|
||||
&& !TileID.Sets.BreakableWhenPlacing[tile.type]
|
||||
&& !Main.tileAxe[tile.type] && !Main.tileHammer[tile.type] && tile.wall == 0
|
||||
&& selectedItem.pick == 0 && selectedItem.type != ItemID.GravediggerShovel
|
||||
|
|
@ -757,7 +759,7 @@ namespace TShockAPI
|
|||
else if (action == EditAction.KillWall)
|
||||
{
|
||||
// If they aren't selecting a hammer, they could be hacking.
|
||||
if (selectedItem.hammer == 0 && !ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0 && selectedItem.createWall == 0)
|
||||
if (selectedItem.hammer == 0 && !ItemID.Sets.Explosives[selectedItem.type] && args.Player.RecentFuse == 0 && selectedItem.createWall == 0)
|
||||
{
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (hammer2) {0} {1} {2}", args.Player.Name, action, editData));
|
||||
args.Player.SendTileSquareCentered(tileX, tileY, 1);
|
||||
|
|
@ -774,11 +776,11 @@ namespace TShockAPI
|
|||
// Handle placement if the user is placing rope that comes from a ropecoil,
|
||||
// but have not created the ropecoil projectile recently or the projectile was not at the correct coordinate, or the tile that the projectile places does not match the rope it is suposed to place
|
||||
// projectile should be the same X coordinate as all tile places (Note by @Olink)
|
||||
if (ropeCoilPlacements.ContainsKey(selectedItem.netID) &&
|
||||
if (ropeCoilPlacements.ContainsKey(selectedItem.type) &&
|
||||
!args.Player.RecentlyCreatedProjectiles.Any(p => GetDataHandlers.projectileCreatesTile.ContainsKey(p.Type) && GetDataHandlers.projectileCreatesTile[p.Type] == editData &&
|
||||
!p.Killed && Math.Abs((int)(Main.projectile[p.Index].position.X / 16f) - tileX) <= Math.Abs(Main.projectile[p.Index].velocity.X)))
|
||||
{
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (inconceivable rope coil) {0} {1} {2} selectedItem:{3} itemCreateTile:{4}", args.Player.Name, action, editData, selectedItem.netID, selectedItem.createTile));
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (inconceivable rope coil) {0} {1} {2} selectedItem:{3} itemCreateTile:{4}", args.Player.Name, action, editData, selectedItem.type, selectedItem.createTile));
|
||||
args.Player.SendTileSquareCentered(tileX, tileY, 1);
|
||||
args.Handled = true;
|
||||
return;
|
||||
|
|
@ -796,7 +798,7 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
/// Handle placement action if the player is using an Ice Rod but not placing the iceblock.
|
||||
if (selectedItem.netID == ItemID.IceRod && editData != TileID.MagicalIceBlock)
|
||||
if (selectedItem.type == ItemID.IceRod && editData != TileID.MagicalIceBlock)
|
||||
{
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from using ice rod but not placing ice block {0} {1} {2}", args.Player.Name, action, editData));
|
||||
args.Player.SendTileSquareCentered(tileX, tileY, 4);
|
||||
|
|
@ -806,9 +808,9 @@ namespace TShockAPI
|
|||
if ((action == EditAction.PlaceTile || action == EditAction.ReplaceTile) && editData != selectedItem.createTile)
|
||||
{
|
||||
/// These would get caught up in the below check because Terraria does not set their createTile field.
|
||||
if (selectedItem.netID != ItemID.IceRod && selectedItem.netID != ItemID.DirtBomb && selectedItem.netID != ItemID.StickyBomb && (args.Player.TPlayer.mount.Type != MountID.DiggingMoleMinecart || editData != TileID.MinecartTrack))
|
||||
if (selectedItem.type != ItemID.IceRod && selectedItem.type != ItemID.DirtBomb && selectedItem.type != ItemID.StickyBomb && (args.Player.TPlayer.mount.Type != MountID.DiggingMoleMinecart || editData != TileID.MinecartTrack))
|
||||
{
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from tile placement not matching selected item createTile {0} {1} {2} selectedItemID:{3} createTile:{4}", args.Player.Name, action, editData, selectedItem.netID, selectedItem.createTile));
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from tile placement not matching selected item createTile {0} {1} {2} selectedItemID:{3} createTile:{4}", args.Player.Name, action, editData, selectedItem.type, selectedItem.createTile));
|
||||
args.Player.SendTileSquareCentered(tileX, tileY, 4);
|
||||
args.Handled = true;
|
||||
return;
|
||||
|
|
@ -817,7 +819,7 @@ namespace TShockAPI
|
|||
/// If they aren't selecting the item which creates the wall, they're hacking.
|
||||
if ((action == EditAction.PlaceWall || action == EditAction.ReplaceWall) && editData != selectedItem.createWall)
|
||||
{
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from wall placement not matching selected item createWall {0} {1} {2} selectedItemID:{3} createWall:{4}", args.Player.Name, action, editData, selectedItem.netID, selectedItem.createWall));
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from wall placement not matching selected item createWall {0} {1} {2} selectedItemID:{3} createWall:{4}", args.Player.Name, action, editData, selectedItem.type, selectedItem.createWall));
|
||||
args.Player.SendTileSquareCentered(tileX, tileY, 4);
|
||||
args.Handled = true;
|
||||
return;
|
||||
|
|
@ -917,7 +919,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (action == EditAction.KillTile || action == EditAction.KillWall && ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0)
|
||||
if (action == EditAction.KillTile || action == EditAction.KillWall && ItemID.Sets.Explosives[selectedItem.type] && args.Player.RecentFuse == 0)
|
||||
{
|
||||
args.Handled = false;
|
||||
return;
|
||||
|
|
@ -1156,7 +1158,7 @@ namespace TShockAPI
|
|||
|
||||
// stop the client from changing the item type of a drop but
|
||||
// only if the client isn't picking up the item
|
||||
if (Main.item[id].active && Main.item[id].netID != type)
|
||||
if (Main.item[id].active && Main.item[id].type != type)
|
||||
{
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnItemDrop rejected from item drop/pickup check from {0}", args.Player.Name));
|
||||
args.Player.SendData(PacketTypes.ItemDrop, "", id);
|
||||
|
|
@ -1695,13 +1697,13 @@ namespace TShockAPI
|
|||
|
||||
foreach (var npc in Main.npc)
|
||||
{
|
||||
if (npc.netID == NPCID.LunarTowerSolar)
|
||||
if (npc.type == NPCID.LunarTowerSolar)
|
||||
hasSolarTower = true;
|
||||
else if (npc.netID == NPCID.LunarTowerVortex)
|
||||
else if (npc.type == NPCID.LunarTowerVortex)
|
||||
hasVortexTower = true;
|
||||
else if (npc.netID == NPCID.LunarTowerNebula)
|
||||
else if (npc.type == NPCID.LunarTowerNebula)
|
||||
hasNebulaTower = true;
|
||||
else if (npc.netID == NPCID.LunarTowerStardust)
|
||||
else if (npc.type == NPCID.LunarTowerStardust)
|
||||
hasStardustTower = true;
|
||||
}
|
||||
|
||||
|
|
@ -2123,7 +2125,7 @@ namespace TShockAPI
|
|||
|
||||
if (detectedNPCBuffTimeCheat)
|
||||
{
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnNPCAddBuff rejected abnormal buff ({0}, last for {4}) added to {1} ({2}) from {3}.", type, npc.TypeName, npc.netID, args.Player.Name, time));
|
||||
TShock.Log.ConsoleDebug(GetString("Bouncer / OnNPCAddBuff rejected abnormal buff ({0}, last for {4}) added to {1} ({2}) from {3}.", type, npc.TypeName, npc.type, args.Player.Name, time));
|
||||
args.Player.Kick(GetString($"Added buff to {npc.TypeName} NPC abnormally."), true);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
|
@ -2404,8 +2406,11 @@ namespace TShockAPI
|
|||
|
||||
if (args.Player.SelectedItem.placeStyle != style)
|
||||
{
|
||||
var validTorch = args.Player.SelectedItem.createTile == TileID.Torches && args.Player.TPlayer.BiomeTorchPlaceStyle(args.Player.SelectedItem.placeStyle) == style;
|
||||
var validCampfire = args.Player.SelectedItem.createTile == TileID.Campfire && args.Player.TPlayer.BiomeCampfirePlaceStyle(args.Player.SelectedItem.placeStyle) == style;
|
||||
var uselessType = 114514;
|
||||
args.Player.TPlayer.BiomeTorchPlaceStyle(ref uselessType, ref args.Player.SelectedItem.placeStyle);
|
||||
|
||||
var validTorch = args.Player.SelectedItem.createTile == TileID.Torches && args.Player.SelectedItem.placeStyle == style;
|
||||
var validCampfire = args.Player.SelectedItem.createTile == TileID.Campfire && args.Player.SelectedItem.placeStyle == style;
|
||||
if (!args.Player.TPlayer.unlockedBiomeTorches || (!validTorch && !validCampfire))
|
||||
{
|
||||
TShock.Log.ConsoleError(GetString("Bouncer / OnPlaceObject rejected object placement with invalid style {1} (expected {2}) from {0}", args.Player.Name, style, args.Player.SelectedItem.placeStyle));
|
||||
|
|
@ -2994,19 +2999,19 @@ namespace TShockAPI
|
|||
{ BuffID.Daybreak, 300 }, // BuffID: 189 Solar Eruption Item ID: 3473, Daybreak Item ID: 3543
|
||||
{ BuffID.BetsysCurse, 600 }, // BuffID: 203
|
||||
{ BuffID.Oiled, 540 }, // BuffID: 204
|
||||
{ BuffID.BlandWhipEnemyDebuff, 240 }, // BuffID: 307
|
||||
{ BuffID.SwordWhipNPCDebuff, 240 }, // BuffID: 309
|
||||
//{ BuffID.BlandWhipEnemyDebuff, 240 }, // BuffID: 307
|
||||
//{ BuffID.SwordWhipNPCDebuff, 240 }, // BuffID: 309
|
||||
{ BuffID.ScytheWhipEnemyDebuff, 240 }, // BuffID: 310
|
||||
{ BuffID.FlameWhipEnemyDebuff, 240 }, // BuffID: 313
|
||||
{ BuffID.ThornWhipNPCDebuff, 240 }, // BuffID: 315
|
||||
{ BuffID.RainbowWhipNPCDebuff, 240 }, // BuffID: 316
|
||||
{ BuffID.MaceWhipNPCDebuff, 240 }, // BuffID: 319
|
||||
//{ BuffID.FlameWhipEnemyDebuff, 240 }, // BuffID: 313
|
||||
// { BuffID.ThornWhipNPCDebuff, 240 }, // BuffID: 315
|
||||
// { BuffID.RainbowWhipNPCDebuff, 240 }, // BuffID: 316
|
||||
// { BuffID.MaceWhipNPCDebuff, 240 }, // BuffID: 319
|
||||
{ BuffID.GelBalloonBuff, 1800 }, // BuffID: 320
|
||||
{ BuffID.OnFire3, 1200 }, // BuffID: 323
|
||||
{ BuffID.Frostburn2, 1200 }, // BuffID: 324
|
||||
{ BuffID.BoneWhipNPCDebuff, 240 }, // BuffID: 326
|
||||
//{ BuffID.BoneWhipNPCDebuff, 240 }, // BuffID: 326
|
||||
{ BuffID.TentacleSpike, 540 }, // BuffID: 337
|
||||
{ BuffID.CoolWhipNPCDebuff, 240 }, // BuffID: 340
|
||||
//{ BuffID.CoolWhipNPCDebuff, 240 }, // BuffID: 340
|
||||
{ BuffID.BloodButcherer, 540 }, // BuffID: 344
|
||||
{ BuffID.Shimmer, 100 }, // BuffID: 353
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1265,7 +1265,7 @@ namespace TShockAPI
|
|||
args.Player.SendInfoMessage(GetString($"Name: {(TShock.Config.Settings.UseServerName ? TShock.Config.Settings.ServerName : Main.worldName)}"));
|
||||
args.Player.SendInfoMessage(GetString("Size: {0}x{1}", Main.maxTilesX, Main.maxTilesY));
|
||||
args.Player.SendInfoMessage(GetString($"ID: {Main.worldID}"));
|
||||
args.Player.SendInfoMessage(GetString($"Seed: {WorldGen.currentWorldSeed}"));
|
||||
args.Player.SendInfoMessage(GetString($"Seed: {Main.ActiveWorldFileData.SeedText}"));
|
||||
args.Player.SendInfoMessage(GetString($"Mode: {Main.GameMode}"));
|
||||
args.Player.SendInfoMessage(GetString($"Path: {Main.worldPathName}"));
|
||||
}
|
||||
|
|
@ -2901,7 +2901,7 @@ namespace TShockAPI
|
|||
var npc = npcs[0];
|
||||
if (npc.type >= 1 && npc.type < Terraria.ID.NPCID.Count && npc.type != 113)
|
||||
{
|
||||
TSPlayer.Server.SpawnNPC(npc.netID, npc.FullName, amount, args.Player.TileX, args.Player.TileY, 50, 20);
|
||||
TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY, 50, 20);
|
||||
if (args.Silent)
|
||||
{
|
||||
args.Player.SendSuccessMessage(GetPluralString("Spawned {0} {1} time.", "Spawned {0} {1} times.", amount, npc.FullName, amount));
|
||||
|
|
@ -3141,7 +3141,7 @@ namespace TShockAPI
|
|||
var matches = new List<NPC>();
|
||||
foreach (var npc in Main.npc.Where(npc => npc.active))
|
||||
{
|
||||
var englishName = EnglishLanguage.GetNpcNameById(npc.netID);
|
||||
var englishName = EnglishLanguage.GetNpcNameById(npc.type);
|
||||
|
||||
if (string.Equals(npc.FullName, npcStr, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
string.Equals(englishName, npcStr, StringComparison.InvariantCultureIgnoreCase))
|
||||
|
|
@ -3841,7 +3841,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
args.Player.SendMultipleMatchError(items.Select(i => $"{i.Name}({i.netID})"));
|
||||
args.Player.SendMultipleMatchError(items.Select(i => $"{i.Name}({i.type})"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3892,7 +3892,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
args.Player.SendMultipleMatchError(items.Select(i => $"{i.Name}({i.netID})"));
|
||||
args.Player.SendMultipleMatchError(items.Select(i => $"{i.Name}({i.type})"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3937,7 +3937,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
args.Player.SendMultipleMatchError(items.Select(i => $"{i.Name}({i.netID})"));
|
||||
args.Player.SendMultipleMatchError(items.Select(i => $"{i.Name}({i.type})"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3963,7 +3963,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
args.Player.SendMultipleMatchError(items.Select(i => $"{i.Name}({i.netID})"));
|
||||
args.Player.SendMultipleMatchError(items.Select(i => $"{i.Name}({i.type})"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -5919,7 +5919,7 @@ namespace TShockAPI
|
|||
|
||||
if (Main.item[i].active && dX * dX + dY * dY <= radius * radius * 256f)
|
||||
{
|
||||
Main.item[i].active = false;
|
||||
Main.item[i].TurnToAir();
|
||||
everyone.SendData(PacketTypes.ItemDrop, "", i);
|
||||
cleared++;
|
||||
}
|
||||
|
|
@ -6109,13 +6109,13 @@ namespace TShockAPI
|
|||
user.SendMultipleMatchError(npcs.Select(n => $"{n.FullName}({n.type})"));
|
||||
return;
|
||||
}
|
||||
npcId = npcs[0].netID;
|
||||
npcId = npcs[0].type;
|
||||
}
|
||||
|
||||
int kills = 0;
|
||||
for (int i = 0; i < Main.npc.Length; i++)
|
||||
{
|
||||
if (Main.npc[i].active && ((npcId == 0 && !Main.npc[i].townNPC && Main.npc[i].netID != NPCID.TargetDummy) || Main.npc[i].netID == npcId))
|
||||
if (Main.npc[i].active && ((npcId == 0 && !Main.npc[i].townNPC && Main.npc[i].type != NPCID.TargetDummy) || Main.npc[i].type == npcId))
|
||||
{
|
||||
TSPlayer.Server.StrikeNPC(i, (int)(Main.npc[i].life + (Main.npc[i].defense * 0.6)), 0, 0);
|
||||
kills++;
|
||||
|
|
@ -6162,7 +6162,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (matchedItems.Count > 1)
|
||||
{
|
||||
args.Player.SendMultipleMatchError(matchedItems.Select(i => $"{i.Name}({i.netID})"));
|
||||
args.Player.SendMultipleMatchError(matchedItems.Select(i => $"{i.Name}({i.type})"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
|
@ -6255,13 +6255,13 @@ namespace TShockAPI
|
|||
}
|
||||
else
|
||||
{
|
||||
npcId = npcs[0].netID;
|
||||
npcId = npcs[0].type;
|
||||
}
|
||||
}
|
||||
int done = 0;
|
||||
for (int i = 0; i < Main.npc.Length; i++)
|
||||
{
|
||||
if (Main.npc[i].active && ((npcId == 0 && !Main.npc[i].townNPC) || (Main.npc[i].netID == npcId && Main.npc[i].townNPC)))
|
||||
if (Main.npc[i].active && ((npcId == 0 && !Main.npc[i].townNPC) || (Main.npc[i].type == npcId && Main.npc[i].townNPC)))
|
||||
{
|
||||
Main.npc[i].GivenName = args.Parameters[1];
|
||||
NetMessage.SendData(56, -1, -1, NetworkText.FromLiteral(args.Parameters[1]), i, 0f, 0f, 0f, 0);
|
||||
|
|
@ -6310,7 +6310,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (items.Count > 1)
|
||||
{
|
||||
args.Player.SendMultipleMatchError(items.Select(i => $"{i.Name}({i.netID})"));
|
||||
args.Player.SendMultipleMatchError(items.Select(i => $"{i.Name}({i.type})"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -71,7 +71,9 @@ namespace TShockAPI.DB
|
|||
new SqlColumn("unlockedSuperCart", MySqlDbType.Int32),
|
||||
new SqlColumn("enabledSuperCart", MySqlDbType.Int32),
|
||||
new SqlColumn("deathsPVE", MySqlDbType.Int32),
|
||||
new SqlColumn("deathsPVP", MySqlDbType.Int32)
|
||||
new SqlColumn("deathsPVP", MySqlDbType.Int32),
|
||||
new SqlColumn("voiceVariant", MySqlDbType.Int32),
|
||||
new SqlColumn("voicePitchOffset", MySqlDbType.Float)
|
||||
);
|
||||
|
||||
SqlTableCreator creator = new(db, db.GetSqlQueryBuilder());
|
||||
|
|
@ -136,6 +138,8 @@ namespace TShockAPI.DB
|
|||
playerData.enabledSuperCart = reader.Get<int>("enabledSuperCart");
|
||||
playerData.deathsPVE = reader.Get<int>("deathsPVE");
|
||||
playerData.deathsPVP = reader.Get<int>("deathsPVP");
|
||||
playerData.voiceVariant = reader.Get<int>("voiceVariant");
|
||||
playerData.voicePitchOffset = reader.Get<int>("voicePitchOffset");
|
||||
return playerData;
|
||||
}
|
||||
}
|
||||
|
|
@ -204,8 +208,8 @@ namespace TShockAPI.DB
|
|||
try
|
||||
{
|
||||
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, 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.sscDeathsPVE, player.sscDeathsPVP);
|
||||
"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, voiceVariant, voicePitchOffset) 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, @36, @37);",
|
||||
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, player.TPlayer.voiceVariant, player.TPlayer.voicePitchOffset);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -218,8 +222,8 @@ namespace TShockAPI.DB
|
|||
try
|
||||
{
|
||||
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, 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, player.sscDeathsPVE, player.sscDeathsPVP);
|
||||
"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, voiceVariant = @36, voicePitchOffset= @37 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, player.sscDeathsPVE, player.sscDeathsPVP, player.TPlayer.voiceVariant, player.TPlayer.voicePitchOffset);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -274,7 +278,7 @@ namespace TShockAPI.DB
|
|||
try
|
||||
{
|
||||
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, @34, @35);",
|
||||
"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, voiceVariant, voicePitchOffset) 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, @36, @37);",
|
||||
player.Account.ID,
|
||||
playerData.health,
|
||||
playerData.maxHealth,
|
||||
|
|
@ -310,7 +314,9 @@ namespace TShockAPI.DB
|
|||
playerData.unlockedSuperCart,
|
||||
playerData.enabledSuperCart,
|
||||
playerData.deathsPVE,
|
||||
playerData.deathsPVP
|
||||
playerData.deathsPVP,
|
||||
player.TPlayer.voiceVariant,
|
||||
player.TPlayer.voicePitchOffset
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -324,7 +330,7 @@ namespace TShockAPI.DB
|
|||
try
|
||||
{
|
||||
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, deathsPVE = @34, deathsPVP = @35 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, voiceVariant = @36, voicePitchOffset= @37 WHERE Account = @5;",
|
||||
playerData.health,
|
||||
playerData.maxHealth,
|
||||
playerData.mana,
|
||||
|
|
@ -360,7 +366,9 @@ namespace TShockAPI.DB
|
|||
playerData.unlockedSuperCart,
|
||||
playerData.enabledSuperCart,
|
||||
playerData.deathsPVE,
|
||||
playerData.deathsPVP
|
||||
playerData.deathsPVP,
|
||||
player.TPlayer.voiceVariant,
|
||||
player.TPlayer.voicePitchOffset
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,16 +20,15 @@ using System;
|
|||
using System.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Text.RegularExpressions;
|
||||
using BCrypt.Net;
|
||||
using System.Security.Cryptography;
|
||||
using TShockAPI.DB.Queries;
|
||||
using TShockAPI.Hooks;
|
||||
|
||||
namespace TShockAPI.DB
|
||||
{
|
||||
extern alias BCryptNext;
|
||||
|
||||
/// <summary>UserAccountManager - Methods for dealing with database user accounts and other related functionality within TShock.</summary>
|
||||
public class UserAccountManager
|
||||
{
|
||||
|
|
@ -465,14 +464,14 @@ namespace TShockAPI.DB
|
|||
{
|
||||
try
|
||||
{
|
||||
if (BCrypt.Net.BCrypt.Verify(password, Password))
|
||||
if (BCryptNext::BCrypt.Net.BCrypt.Verify(password, Password))
|
||||
{
|
||||
// If necessary, perform an upgrade to the highest work factor.
|
||||
UpgradePasswordWorkFactor(password);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (SaltParseException)
|
||||
catch (BCryptNext::BCrypt.Net.SaltParseException)
|
||||
{
|
||||
TShock.Log.ConsoleError(GetString($"Unable to verify the password hash for user {Name} ({ID})"));
|
||||
return false;
|
||||
|
|
@ -520,12 +519,12 @@ namespace TShockAPI.DB
|
|||
}
|
||||
try
|
||||
{
|
||||
Password = BCrypt.Net.BCrypt.HashPassword(password.Trim(), TShock.Config.Settings.BCryptWorkFactor);
|
||||
Password = BCryptNext::BCrypt.Net.BCrypt.HashPassword(password.Trim(), TShock.Config.Settings.BCryptWorkFactor);
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
TShock.Log.ConsoleError(GetString("Invalid BCrypt work factor in config file! Creating new hash using default work factor."));
|
||||
Password = BCrypt.Net.BCrypt.HashPassword(password.Trim());
|
||||
Password = BCryptNext::BCrypt.Net.BCrypt.HashPassword(password.Trim());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -539,7 +538,7 @@ namespace TShockAPI.DB
|
|||
int minLength = TShock.Config.Settings.MinimumPasswordLength;
|
||||
throw new ArgumentOutOfRangeException("password", GetString($"Password must be at least {minLength} characters."));
|
||||
}
|
||||
Password = BCrypt.Net.BCrypt.HashPassword(password.Trim(), workFactor);
|
||||
Password = BCryptNext::BCrypt.Net.BCrypt.HashPassword(password.Trim(), workFactor);
|
||||
}
|
||||
|
||||
#region IEquatable
|
||||
|
|
|
|||
|
|
@ -2435,6 +2435,8 @@ namespace TShockAPI
|
|||
byte playerid = args.Data.ReadInt8();
|
||||
// 0-3 male; 4-7 female
|
||||
int skinVariant = args.Data.ReadByte();
|
||||
int voiceVariant = args.Data.ReadByte();
|
||||
float voicePitchOffset = args.Data.ReadSingle();
|
||||
var hair = args.Data.ReadInt8();
|
||||
string name = args.Data.ReadString();
|
||||
byte hairDye = args.Data.ReadInt8();
|
||||
|
|
@ -2509,6 +2511,8 @@ namespace TShockAPI
|
|||
args.Player.TPlayer.hairColor = hairColor;
|
||||
args.Player.TPlayer.hairDye = hairDye;
|
||||
args.Player.TPlayer.skinVariant = skinVariant;
|
||||
args.Player.TPlayer.voiceVariant = voiceVariant;
|
||||
args.Player.TPlayer.voicePitchOffset = voicePitchOffset;
|
||||
args.Player.TPlayer.skinColor = skinColor;
|
||||
args.Player.TPlayer.eyeColor = eyeColor;
|
||||
args.Player.TPlayer.pantsColor = pantsColor;
|
||||
|
|
@ -4418,7 +4422,7 @@ namespace TShockAPI
|
|||
TEDisplayDoll displayDoll = tileEntity as TEDisplayDoll;
|
||||
if (displayDoll != null)
|
||||
{
|
||||
oldItem = displayDoll._items[slot];
|
||||
//oldItem = displayDoll._items[slot];
|
||||
if (isDye)
|
||||
oldItem = displayDoll._dyes[slot];
|
||||
|
||||
|
|
|
|||
|
|
@ -15,10 +15,12 @@ namespace TShockAPI.Handlers.NetModules
|
|||
/// An unknown field. If this does not have a value of '0' the packet should be rejected.
|
||||
/// </summary>
|
||||
public byte UnknownField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ID of the item being sacrificed
|
||||
/// </summary>
|
||||
public ushort ItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Stack size of the item being sacrificed
|
||||
/// </summary>
|
||||
|
|
@ -49,10 +51,11 @@ namespace TShockAPI.Handlers.NetModules
|
|||
/// <param name="rejectPacket"></param>
|
||||
public void HandlePacket(TSPlayer player, out bool rejectPacket)
|
||||
{
|
||||
if (!Main.GameModeInfo.IsJourneyMode)
|
||||
if (!Main.IsJourneyMode)
|
||||
{
|
||||
TShock.Log.ConsoleDebug(
|
||||
GetString($"NetModuleHandler received attempt to unlock sacrifice while not in journey mode from {player.Name}")
|
||||
GetString(
|
||||
$"NetModuleHandler received attempt to unlock sacrifice while not in journey mode from {player.Name}")
|
||||
);
|
||||
|
||||
rejectPacket = true;
|
||||
|
|
@ -62,7 +65,8 @@ namespace TShockAPI.Handlers.NetModules
|
|||
if (UnknownField != 0)
|
||||
{
|
||||
TShock.Log.ConsoleDebug(
|
||||
GetString($"CreativeUnlocksHandler received non-vanilla unlock request. Random field value: {UnknownField} but should be 0 from {player.Name}")
|
||||
GetString(
|
||||
$"CreativeUnlocksHandler received non-vanilla unlock request. Random field value: {UnknownField} but should be 0 from {player.Name}")
|
||||
);
|
||||
|
||||
rejectPacket = true;
|
||||
|
|
@ -78,7 +82,8 @@ namespace TShockAPI.Handlers.NetModules
|
|||
|
||||
var totalSacrificed = TShock.ResearchDatastore.SacrificeItem(ItemId, Amount, player);
|
||||
|
||||
var response = NetCreativeUnlocksModule.SerializeItemSacrifice(ItemId, totalSacrificed);
|
||||
var response =
|
||||
NetCreativeUnlocksPlayerReportModule.SerializeSacrificeRequest(player.Index, ItemId, totalSacrificed);
|
||||
NetManager.Instance.Broadcast(response);
|
||||
|
||||
rejectPacket = false;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ namespace TShockAPI
|
|||
UnTaint(player);
|
||||
|
||||
// No matter the player type, we do a check when a player is holding an item that's banned.
|
||||
if (DataModel.ItemIsBanned(EnglishLanguage.GetItemNameById(player.TPlayer.inventory[player.TPlayer.selectedItem].netID), player))
|
||||
if (DataModel.ItemIsBanned(EnglishLanguage.GetItemNameById(player.TPlayer.inventory[player.TPlayer.selectedItem].type), player))
|
||||
{
|
||||
string itemName = player.TPlayer.inventory[player.TPlayer.selectedItem].Name;
|
||||
player.Disable(GetString($"holding banned item: {itemName}"), disableFlags);
|
||||
|
|
@ -157,7 +157,7 @@ namespace TShockAPI
|
|||
TSPlayer player = args.Player;
|
||||
string itemName = player.TPlayer.inventory[args.SelectedItem].Name;
|
||||
|
||||
if (DataModel.ItemIsBanned(EnglishLanguage.GetItemNameById(player.TPlayer.inventory[args.SelectedItem].netID), args.Player))
|
||||
if (DataModel.ItemIsBanned(EnglishLanguage.GetItemNameById(player.TPlayer.inventory[args.SelectedItem].type), args.Player))
|
||||
{
|
||||
player.TPlayer.controlUseItem = false;
|
||||
player.Disable(GetString($"holding banned item: {itemName}"), disableFlags);
|
||||
|
|
@ -204,7 +204,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
if (DataModel.ItemIsBanned(EnglishLanguage.GetItemNameById(args.Player.SelectedItem.netID), args.Player))
|
||||
if (DataModel.ItemIsBanned(EnglishLanguage.GetItemNameById(args.Player.SelectedItem.type), args.Player))
|
||||
{
|
||||
args.Player.SendTileSquareCentered(args.X, args.Y, 4);
|
||||
args.Handled = true;
|
||||
|
|
|
|||
|
|
@ -94,37 +94,71 @@ namespace TShockAPI
|
|||
/// <summary>
|
||||
/// 180 - The inventory size (inventory, held item, armour, dies, coins, ammo, piggy, safe, and trash)
|
||||
/// </summary>
|
||||
public static readonly int MaxInventory = InventorySlots + ArmorSlots + DyeSlots + MiscEquipSlots + MiscDyeSlots + PiggySlots +
|
||||
SafeSlots + ForgeSlots + VoidSlots + TrashSlots + (LoadoutArmorSlots * 3) +
|
||||
public static readonly int MaxInventory = InventorySlots + ArmorSlots + DyeSlots + MiscEquipSlots +
|
||||
MiscDyeSlots + PiggySlots +
|
||||
SafeSlots + ForgeSlots + VoidSlots + TrashSlots +
|
||||
(LoadoutArmorSlots * 3) +
|
||||
(LoadoutDyeSlots * 3);
|
||||
|
||||
public static readonly Tuple<int, int> InventoryIndex = new Tuple<int, int>(0, InventorySlots);
|
||||
public static readonly Tuple<int, int> ArmorIndex = new Tuple<int, int>(InventoryIndex.Item2, InventoryIndex.Item2 + ArmorSlots);
|
||||
public static readonly Tuple<int, int> DyeIndex = new Tuple<int, int>(ArmorIndex.Item2, ArmorIndex.Item2 + DyeSlots);
|
||||
public static readonly Tuple<int, int> MiscEquipIndex = new Tuple<int, int>(DyeIndex.Item2, DyeIndex.Item2 + MiscEquipSlots);
|
||||
public static readonly Tuple<int, int> MiscDyeIndex = new Tuple<int, int>(MiscEquipIndex.Item2, MiscEquipIndex.Item2 + MiscDyeSlots);
|
||||
public static readonly Tuple<int, int> PiggyIndex = new Tuple<int, int>(MiscDyeIndex.Item2, MiscDyeIndex.Item2 + PiggySlots);
|
||||
public static readonly Tuple<int, int> SafeIndex = new Tuple<int, int>(PiggyIndex.Item2, PiggyIndex.Item2 + SafeSlots);
|
||||
public static readonly Tuple<int, int> TrashIndex = new Tuple<int, int>(SafeIndex.Item2, SafeIndex.Item2 + TrashSlots);
|
||||
public static readonly Tuple<int, int> ForgeIndex = new Tuple<int, int>(TrashIndex.Item2, TrashIndex.Item2 + ForgeSlots);
|
||||
public static readonly Tuple<int, int> VoidIndex = new Tuple<int, int>(ForgeIndex.Item2, ForgeIndex.Item2 + VoidSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout1Armor = new Tuple<int, int>(VoidIndex.Item2, VoidIndex.Item2 + LoadoutArmorSlots);
|
||||
public static readonly Tuple<int, int> Loadout1Dye = new Tuple<int, int>(Loadout1Armor.Item2, Loadout1Armor.Item2 + LoadoutDyeSlots);
|
||||
public static readonly Tuple<int, int> ArmorIndex =
|
||||
new Tuple<int, int>(InventoryIndex.Item2, InventoryIndex.Item2 + ArmorSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout2Armor = new Tuple<int, int>(Loadout1Dye.Item2, Loadout1Dye.Item2 + LoadoutArmorSlots);
|
||||
public static readonly Tuple<int, int> Loadout2Dye = new Tuple<int, int>(Loadout2Armor.Item2, Loadout2Armor.Item2 + LoadoutDyeSlots);
|
||||
public static readonly Tuple<int, int> DyeIndex =
|
||||
new Tuple<int, int>(ArmorIndex.Item2, ArmorIndex.Item2 + DyeSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout3Armor = new Tuple<int, int>(Loadout2Dye.Item2, Loadout2Dye.Item2 + LoadoutArmorSlots);
|
||||
public static readonly Tuple<int, int> Loadout3Dye = new Tuple<int, int>(Loadout3Armor.Item2, Loadout3Armor.Item2 + LoadoutDyeSlots);
|
||||
public static readonly Tuple<int, int> MiscEquipIndex =
|
||||
new Tuple<int, int>(DyeIndex.Item2, DyeIndex.Item2 + MiscEquipSlots);
|
||||
|
||||
public static readonly Tuple<int, int> MiscDyeIndex =
|
||||
new Tuple<int, int>(MiscEquipIndex.Item2, MiscEquipIndex.Item2 + MiscDyeSlots);
|
||||
|
||||
public static readonly Tuple<int, int> PiggyIndex =
|
||||
new Tuple<int, int>(MiscDyeIndex.Item2, MiscDyeIndex.Item2 + PiggySlots);
|
||||
|
||||
public static readonly Tuple<int, int> SafeIndex =
|
||||
new Tuple<int, int>(PiggyIndex.Item2, PiggyIndex.Item2 + SafeSlots);
|
||||
|
||||
public static readonly Tuple<int, int> TrashIndex =
|
||||
new Tuple<int, int>(SafeIndex.Item2, SafeIndex.Item2 + TrashSlots);
|
||||
|
||||
public static readonly Tuple<int, int> ForgeIndex =
|
||||
new Tuple<int, int>(TrashIndex.Item2, TrashIndex.Item2 + ForgeSlots);
|
||||
|
||||
public static readonly Tuple<int, int> VoidIndex =
|
||||
new Tuple<int, int>(ForgeIndex.Item2, ForgeIndex.Item2 + VoidSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout1Armor =
|
||||
new Tuple<int, int>(VoidIndex.Item2, VoidIndex.Item2 + LoadoutArmorSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout1Dye =
|
||||
new Tuple<int, int>(Loadout1Armor.Item2, Loadout1Armor.Item2 + LoadoutDyeSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout2Armor =
|
||||
new Tuple<int, int>(Loadout1Dye.Item2, Loadout1Dye.Item2 + LoadoutArmorSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout2Dye =
|
||||
new Tuple<int, int>(Loadout2Armor.Item2, Loadout2Armor.Item2 + LoadoutDyeSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout3Armor =
|
||||
new Tuple<int, int>(Loadout2Dye.Item2, Loadout2Dye.Item2 + LoadoutArmorSlots);
|
||||
|
||||
public static readonly Tuple<int, int> Loadout3Dye =
|
||||
new Tuple<int, int>(Loadout3Armor.Item2, Loadout3Armor.Item2 + LoadoutDyeSlots);
|
||||
|
||||
[JsonProperty("netID")]
|
||||
private int _netId;
|
||||
|
||||
[JsonProperty("prefix")]
|
||||
private byte _prefixId;
|
||||
|
||||
[JsonProperty("stack")]
|
||||
private int _stack;
|
||||
|
||||
[JsonProperty("favorited")]
|
||||
private bool _favorited;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the net ID.
|
||||
/// </summary>
|
||||
|
|
@ -149,17 +183,28 @@ namespace TShockAPI
|
|||
get { return _stack; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the favorited.
|
||||
/// </summary>
|
||||
public bool Favorited
|
||||
{
|
||||
get { return _favorited; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="NetItem"/>.
|
||||
/// </summary>
|
||||
/// <param name="netId">The net ID.</param>
|
||||
/// <param name="stack">The stack.</param>
|
||||
/// <param name="prefixId">The prefix ID.</param>
|
||||
public NetItem(int netId, int stack = 1, byte prefixId = 0)
|
||||
/// <param name="favorited">The favorited.</param>
|
||||
public NetItem(int netId, int stack = 1, byte prefixId = 0, bool favorited = false)
|
||||
{
|
||||
_netId = netId;
|
||||
_stack = stack;
|
||||
_prefixId = prefixId;
|
||||
_favorited = favorited;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -168,9 +213,10 @@ namespace TShockAPI
|
|||
/// <param name="item">Item in the game.</param>
|
||||
public NetItem(Item item)
|
||||
{
|
||||
_netId = item.netID;
|
||||
_netId = item.type;
|
||||
_stack = item.stack;
|
||||
_prefixId = item.prefix;
|
||||
_favorited = item.favorited;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -184,6 +230,7 @@ namespace TShockAPI
|
|||
item.netDefaults(_netId);
|
||||
item.stack = _stack;
|
||||
item.prefix = _prefixId;
|
||||
item.favorited = _favorited;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
|
@ -194,7 +241,7 @@ namespace TShockAPI
|
|||
/// <returns></returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0},{1},{2}", _netId, _stack, _prefixId);
|
||||
return String.Format("{0},{1},{2},{3}", _netId, _stack, _prefixId, _favorited ? 1 : 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -216,8 +263,9 @@ namespace TShockAPI
|
|||
int netId = Int32.Parse(comp[0]);
|
||||
int stack = Int32.Parse(comp[1]);
|
||||
byte prefixId = Byte.Parse(comp[2]);
|
||||
bool favorited = Int32.Parse(comp[3]) == 1;
|
||||
|
||||
return new NetItem(netId, stack, prefixId);
|
||||
return new NetItem(netId, stack, prefixId, favorited);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -229,7 +277,7 @@ namespace TShockAPI
|
|||
{
|
||||
return item == null
|
||||
? new NetItem()
|
||||
: new NetItem(item.netID, item.stack, item.prefix);
|
||||
: new NetItem(item.type, item.stack, item.prefix, item.favorited);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ namespace TShockAPI
|
|||
public int spawnY = -1;
|
||||
public int? extraSlot;
|
||||
public int? skinVariant;
|
||||
public int? voiceVariant;
|
||||
public float? voicePitchOffset;
|
||||
public int? hair;
|
||||
public byte hairDye;
|
||||
public Color? hairColor;
|
||||
|
|
@ -130,6 +132,8 @@ namespace TShockAPI
|
|||
this.spawnY = player.TPlayer.SpawnY;
|
||||
extraSlot = player.TPlayer.extraAccessory ? 1 : 0;
|
||||
this.skinVariant = player.TPlayer.skinVariant;
|
||||
this.voiceVariant = player.TPlayer.voiceVariant;
|
||||
this.voicePitchOffset = player.TPlayer.voicePitchOffset;
|
||||
this.hair = player.TPlayer.hair;
|
||||
this.hairDye = player.TPlayer.hairDye;
|
||||
this.hairColor = player.TPlayer.hairColor;
|
||||
|
|
@ -304,6 +308,10 @@ namespace TShockAPI
|
|||
player.TPlayer.extraAccessory = extraSlot.Value == 1 ? true : false;
|
||||
if (this.skinVariant != null)
|
||||
player.TPlayer.skinVariant = this.skinVariant.Value;
|
||||
if (this.voiceVariant != null)
|
||||
player.TPlayer.voiceVariant = this.voiceVariant.Value;
|
||||
if (this.voicePitchOffset != null)
|
||||
player.TPlayer.voicePitchOffset = this.voicePitchOffset.Value;
|
||||
if (this.hair != null)
|
||||
player.TPlayer.hair = this.hair.Value;
|
||||
if (this.hairColor != null)
|
||||
|
|
@ -333,10 +341,11 @@ namespace TShockAPI
|
|||
//0-58
|
||||
player.TPlayer.inventory[i].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.inventory[i].netID != 0)
|
||||
if (player.TPlayer.inventory[i].type!= 0)
|
||||
{
|
||||
player.TPlayer.inventory[i].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.inventory[i].prefix = this.inventory[i].PrefixId;
|
||||
player.TPlayer.inventory[i].favorited = this.inventory[i].Favorited;
|
||||
}
|
||||
}
|
||||
else if (i < NetItem.ArmorIndex.Item2)
|
||||
|
|
@ -345,7 +354,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.ArmorIndex.Item1;
|
||||
player.TPlayer.armor[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.armor[index].netID != 0)
|
||||
if (player.TPlayer.armor[index].type != 0)
|
||||
{
|
||||
player.TPlayer.armor[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.armor[index].prefix = (byte)this.inventory[i].PrefixId;
|
||||
|
|
@ -357,7 +366,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.DyeIndex.Item1;
|
||||
player.TPlayer.dye[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.dye[index].netID != 0)
|
||||
if (player.TPlayer.dye[index].type != 0)
|
||||
{
|
||||
player.TPlayer.dye[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.dye[index].prefix = (byte)this.inventory[i].PrefixId;
|
||||
|
|
@ -369,7 +378,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.MiscEquipIndex.Item1;
|
||||
player.TPlayer.miscEquips[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.miscEquips[index].netID != 0)
|
||||
if (player.TPlayer.miscEquips[index].type != 0)
|
||||
{
|
||||
player.TPlayer.miscEquips[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.miscEquips[index].prefix = (byte)this.inventory[i].PrefixId;
|
||||
|
|
@ -381,7 +390,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.MiscDyeIndex.Item1;
|
||||
player.TPlayer.miscDyes[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.miscDyes[index].netID != 0)
|
||||
if (player.TPlayer.miscDyes[index].type != 0)
|
||||
{
|
||||
player.TPlayer.miscDyes[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.miscDyes[index].prefix = (byte)this.inventory[i].PrefixId;
|
||||
|
|
@ -393,7 +402,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.PiggyIndex.Item1;
|
||||
player.TPlayer.bank.item[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.bank.item[index].netID != 0)
|
||||
if (player.TPlayer.bank.item[index].type != 0)
|
||||
{
|
||||
player.TPlayer.bank.item[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.bank.item[index].prefix = (byte)this.inventory[i].PrefixId;
|
||||
|
|
@ -405,7 +414,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.SafeIndex.Item1;
|
||||
player.TPlayer.bank2.item[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.bank2.item[index].netID != 0)
|
||||
if (player.TPlayer.bank2.item[index].type != 0)
|
||||
{
|
||||
player.TPlayer.bank2.item[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.bank2.item[index].prefix = (byte)this.inventory[i].PrefixId;
|
||||
|
|
@ -417,7 +426,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.TrashIndex.Item1;
|
||||
player.TPlayer.trashItem.netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.trashItem.netID != 0)
|
||||
if (player.TPlayer.trashItem.type != 0)
|
||||
{
|
||||
player.TPlayer.trashItem.stack = this.inventory[i].Stack;
|
||||
player.TPlayer.trashItem.prefix = (byte)this.inventory[i].PrefixId;
|
||||
|
|
@ -429,7 +438,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.ForgeIndex.Item1;
|
||||
player.TPlayer.bank3.item[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.bank3.item[index].netID != 0)
|
||||
if (player.TPlayer.bank3.item[index].type != 0)
|
||||
{
|
||||
player.TPlayer.bank3.item[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.bank3.item[index].Prefix((byte)this.inventory[i].PrefixId);
|
||||
|
|
@ -441,7 +450,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.VoidIndex.Item1;
|
||||
player.TPlayer.bank4.item[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.bank4.item[index].netID != 0)
|
||||
if (player.TPlayer.bank4.item[index].type != 0)
|
||||
{
|
||||
player.TPlayer.bank4.item[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.bank4.item[index].Prefix((byte)this.inventory[i].PrefixId);
|
||||
|
|
@ -452,7 +461,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.Loadout1Armor.Item1;
|
||||
player.TPlayer.Loadouts[0].Armor[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.Loadouts[0].Armor[index].netID != 0)
|
||||
if (player.TPlayer.Loadouts[0].Armor[index].type != 0)
|
||||
{
|
||||
player.TPlayer.Loadouts[0].Armor[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.Loadouts[0].Armor[index].Prefix((byte)this.inventory[i].PrefixId);
|
||||
|
|
@ -463,7 +472,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.Loadout1Dye.Item1;
|
||||
player.TPlayer.Loadouts[0].Dye[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.Loadouts[0].Dye[index].netID != 0)
|
||||
if (player.TPlayer.Loadouts[0].Dye[index].type != 0)
|
||||
{
|
||||
player.TPlayer.Loadouts[0].Dye[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.Loadouts[0].Dye[index].Prefix((byte)this.inventory[i].PrefixId);
|
||||
|
|
@ -474,7 +483,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.Loadout2Armor.Item1;
|
||||
player.TPlayer.Loadouts[1].Armor[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.Loadouts[1].Armor[index].netID != 0)
|
||||
if (player.TPlayer.Loadouts[1].Armor[index].type != 0)
|
||||
{
|
||||
player.TPlayer.Loadouts[1].Armor[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.Loadouts[1].Armor[index].Prefix((byte)this.inventory[i].PrefixId);
|
||||
|
|
@ -485,7 +494,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.Loadout2Dye.Item1;
|
||||
player.TPlayer.Loadouts[1].Dye[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.Loadouts[1].Dye[index].netID != 0)
|
||||
if (player.TPlayer.Loadouts[1].Dye[index].type != 0)
|
||||
{
|
||||
player.TPlayer.Loadouts[1].Dye[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.Loadouts[1].Dye[index].Prefix((byte)this.inventory[i].PrefixId);
|
||||
|
|
@ -496,7 +505,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.Loadout3Armor.Item1;
|
||||
player.TPlayer.Loadouts[2].Armor[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.Loadouts[2].Armor[index].netID != 0)
|
||||
if (player.TPlayer.Loadouts[2].Armor[index].type != 0)
|
||||
{
|
||||
player.TPlayer.Loadouts[2].Armor[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.Loadouts[2].Armor[index].Prefix((byte)this.inventory[i].PrefixId);
|
||||
|
|
@ -507,7 +516,7 @@ namespace TShockAPI
|
|||
var index = i - NetItem.Loadout3Dye.Item1;
|
||||
player.TPlayer.Loadouts[2].Dye[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.Loadouts[2].Dye[index].netID != 0)
|
||||
if (player.TPlayer.Loadouts[2].Dye[index].type != 0)
|
||||
{
|
||||
player.TPlayer.Loadouts[2].Dye[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.Loadouts[2].Dye[index].Prefix((byte)this.inventory[i].PrefixId);
|
||||
|
|
@ -708,7 +717,7 @@ namespace TShockAPI
|
|||
|
||||
NetMessage.SendData(39, player.Index, -1, NetworkText.Empty, 400);
|
||||
|
||||
if (Main.GameModeInfo.IsJourneyMode)
|
||||
if (Main.IsJourneyMode)
|
||||
{
|
||||
var sacrificedItems = TShock.ResearchDatastore.GetSacrificedItems();
|
||||
for(int i = 0; i < ItemID.Count; i++)
|
||||
|
|
@ -719,7 +728,7 @@ namespace TShockAPI
|
|||
amount = sacrificedItems[i];
|
||||
}
|
||||
|
||||
var response = NetCreativeUnlocksModule.SerializeItemSacrifice(i, amount);
|
||||
var response = NetCreativeUnlocksPlayerReportModule.SerializeSacrificeRequest(player.Index,i, amount);
|
||||
NetManager.Instance.SendToClient(response, player.Index);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -989,7 +989,7 @@ namespace TShockAPI
|
|||
{"muted", player.mute },
|
||||
{"position", player.TileX + "," + player.TileY},
|
||||
{"inventory", string.Join(", ", inventory.Select(p => (p.Name + ":" + p.stack)))},
|
||||
{"armor", string.Join(", ", equipment.Select(p => (p.netID + ":" + p.prefix)))},
|
||||
{"armor", string.Join(", ", equipment.Select(p => (p.type + ":" + p.prefix)))},
|
||||
{"dyes", string.Join(", ", dyes.Select(p => (p.Name)))},
|
||||
{"buffs", string.Join(", ", player.TPlayer.buffType)}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
|
@ -123,10 +123,6 @@ namespace TShockAPI.Sockets
|
|||
}
|
||||
}
|
||||
|
||||
void ISocket.SendQueuedPackets()
|
||||
{
|
||||
}
|
||||
|
||||
void ISocket.AsyncSend(byte[] data, int offset, int size, SocketSendCallback callback, object state)
|
||||
{
|
||||
byte[] array = LegacyNetBufferPool.RequestBuffer(data, offset, size);
|
||||
|
|
|
|||
|
|
@ -494,9 +494,9 @@ namespace TShockAPI
|
|||
// From above: this is slots 0-58 in the inventory.
|
||||
// 0-58
|
||||
Item item = new Item();
|
||||
if (inventory[i] != null && inventory[i].netID != 0)
|
||||
if (inventory[i] != null && inventory[i].type != 0)
|
||||
{
|
||||
item.netDefaults(inventory[i].netID);
|
||||
item.netDefaults(inventory[i].type);
|
||||
item.Prefix(inventory[i].prefix);
|
||||
item.AffixName();
|
||||
if (inventory[i].stack > item.maxStack || inventory[i].stack < 0)
|
||||
|
|
@ -514,9 +514,9 @@ namespace TShockAPI
|
|||
// 59-78
|
||||
var index = i - NetItem.ArmorIndex.Item1;
|
||||
Item item = new Item();
|
||||
if (armor[index] != null && armor[index].netID != 0)
|
||||
if (armor[index] != null && armor[index].type != 0)
|
||||
{
|
||||
item.netDefaults(armor[index].netID);
|
||||
item.netDefaults(armor[index].type);
|
||||
item.Prefix(armor[index].prefix);
|
||||
item.AffixName();
|
||||
if (armor[index].stack > item.maxStack || armor[index].stack < 0)
|
||||
|
|
@ -534,9 +534,9 @@ namespace TShockAPI
|
|||
// 79-88
|
||||
var index = i - NetItem.DyeIndex.Item1;
|
||||
Item item = new Item();
|
||||
if (dye[index] != null && dye[index].netID != 0)
|
||||
if (dye[index] != null && dye[index].type != 0)
|
||||
{
|
||||
item.netDefaults(dye[index].netID);
|
||||
item.netDefaults(dye[index].type);
|
||||
item.Prefix(dye[index].prefix);
|
||||
item.AffixName();
|
||||
if (dye[index].stack > item.maxStack || dye[index].stack < 0)
|
||||
|
|
@ -554,9 +554,9 @@ namespace TShockAPI
|
|||
// 89-93
|
||||
var index = i - NetItem.MiscEquipIndex.Item1;
|
||||
Item item = new Item();
|
||||
if (miscEquips[index] != null && miscEquips[index].netID != 0)
|
||||
if (miscEquips[index] != null && miscEquips[index].type != 0)
|
||||
{
|
||||
item.netDefaults(miscEquips[index].netID);
|
||||
item.netDefaults(miscEquips[index].type);
|
||||
item.Prefix(miscEquips[index].prefix);
|
||||
item.AffixName();
|
||||
if (miscEquips[index].stack > item.maxStack || miscEquips[index].stack < 0)
|
||||
|
|
@ -574,9 +574,9 @@ namespace TShockAPI
|
|||
// 93-98
|
||||
var index = i - NetItem.MiscDyeIndex.Item1;
|
||||
Item item = new Item();
|
||||
if (miscDyes[index] != null && miscDyes[index].netID != 0)
|
||||
if (miscDyes[index] != null && miscDyes[index].type != 0)
|
||||
{
|
||||
item.netDefaults(miscDyes[index].netID);
|
||||
item.netDefaults(miscDyes[index].type);
|
||||
item.Prefix(miscDyes[index].prefix);
|
||||
item.AffixName();
|
||||
if (miscDyes[index].stack > item.maxStack || miscDyes[index].stack < 0)
|
||||
|
|
@ -594,9 +594,9 @@ namespace TShockAPI
|
|||
// 98-138
|
||||
var index = i - NetItem.PiggyIndex.Item1;
|
||||
Item item = new Item();
|
||||
if (piggy[index] != null && piggy[index].netID != 0)
|
||||
if (piggy[index] != null && piggy[index].type != 0)
|
||||
{
|
||||
item.netDefaults(piggy[index].netID);
|
||||
item.netDefaults(piggy[index].type);
|
||||
item.Prefix(piggy[index].prefix);
|
||||
item.AffixName();
|
||||
|
||||
|
|
@ -615,9 +615,9 @@ namespace TShockAPI
|
|||
// 138-178
|
||||
var index = i - NetItem.SafeIndex.Item1;
|
||||
Item item = new Item();
|
||||
if (safe[index] != null && safe[index].netID != 0)
|
||||
if (safe[index] != null && safe[index].type != 0)
|
||||
{
|
||||
item.netDefaults(safe[index].netID);
|
||||
item.netDefaults(safe[index].type);
|
||||
item.Prefix(safe[index].prefix);
|
||||
item.AffixName();
|
||||
|
||||
|
|
@ -635,9 +635,9 @@ namespace TShockAPI
|
|||
{
|
||||
// 178-179
|
||||
Item item = new Item();
|
||||
if (trash != null && trash.netID != 0)
|
||||
if (trash != null && trash.type != 0)
|
||||
{
|
||||
item.netDefaults(trash.netID);
|
||||
item.netDefaults(trash.type);
|
||||
item.Prefix(trash.prefix);
|
||||
item.AffixName();
|
||||
|
||||
|
|
@ -656,9 +656,9 @@ namespace TShockAPI
|
|||
// 179-220
|
||||
var index = i - NetItem.ForgeIndex.Item1;
|
||||
Item item = new Item();
|
||||
if (forge[index] != null && forge[index].netID != 0)
|
||||
if (forge[index] != null && forge[index].type != 0)
|
||||
{
|
||||
item.netDefaults(forge[index].netID);
|
||||
item.netDefaults(forge[index].type);
|
||||
item.Prefix(forge[index].prefix);
|
||||
item.AffixName();
|
||||
|
||||
|
|
@ -677,9 +677,9 @@ namespace TShockAPI
|
|||
// 220-260
|
||||
var index = i - NetItem.VoidIndex.Item1;
|
||||
Item item = new Item();
|
||||
if (voidVault[index] != null && voidVault[index].netID != 0)
|
||||
if (voidVault[index] != null && voidVault[index].type != 0)
|
||||
{
|
||||
item.netDefaults(voidVault[index].netID);
|
||||
item.netDefaults(voidVault[index].type);
|
||||
item.Prefix(voidVault[index].prefix);
|
||||
item.AffixName();
|
||||
|
||||
|
|
@ -697,9 +697,9 @@ namespace TShockAPI
|
|||
{
|
||||
var index = i - NetItem.Loadout1Armor.Item1;
|
||||
Item item = new Item();
|
||||
if (loadout1Armor[index] != null && loadout1Armor[index].netID != 0)
|
||||
if (loadout1Armor[index] != null && loadout1Armor[index].type != 0)
|
||||
{
|
||||
item.netDefaults(loadout1Armor[index].netID);
|
||||
item.netDefaults(loadout1Armor[index].type);
|
||||
item.Prefix(loadout1Armor[index].prefix);
|
||||
item.AffixName();
|
||||
|
||||
|
|
@ -717,9 +717,9 @@ namespace TShockAPI
|
|||
{
|
||||
var index = i - NetItem.Loadout1Dye.Item1;
|
||||
Item item = new Item();
|
||||
if (loadout1Dye[index] != null && loadout1Dye[index].netID != 0)
|
||||
if (loadout1Dye[index] != null && loadout1Dye[index].type != 0)
|
||||
{
|
||||
item.netDefaults(loadout1Dye[index].netID);
|
||||
item.netDefaults(loadout1Dye[index].type);
|
||||
item.Prefix(loadout1Dye[index].prefix);
|
||||
item.AffixName();
|
||||
|
||||
|
|
@ -737,9 +737,9 @@ namespace TShockAPI
|
|||
{
|
||||
var index = i - NetItem.Loadout2Armor.Item1;
|
||||
Item item = new Item();
|
||||
if (loadout2Armor[index] != null && loadout2Armor[index].netID != 0)
|
||||
if (loadout2Armor[index] != null && loadout2Armor[index].type != 0)
|
||||
{
|
||||
item.netDefaults(loadout2Armor[index].netID);
|
||||
item.netDefaults(loadout2Armor[index].type);
|
||||
item.Prefix(loadout2Armor[index].prefix);
|
||||
item.AffixName();
|
||||
|
||||
|
|
@ -757,9 +757,9 @@ namespace TShockAPI
|
|||
{
|
||||
var index = i - NetItem.Loadout2Dye.Item1;
|
||||
Item item = new Item();
|
||||
if (loadout2Dye[index] != null && loadout2Dye[index].netID != 0)
|
||||
if (loadout2Dye[index] != null && loadout2Dye[index].type != 0)
|
||||
{
|
||||
item.netDefaults(loadout2Dye[index].netID);
|
||||
item.netDefaults(loadout2Dye[index].type);
|
||||
item.Prefix(loadout2Dye[index].prefix);
|
||||
item.AffixName();
|
||||
|
||||
|
|
@ -777,9 +777,9 @@ namespace TShockAPI
|
|||
{
|
||||
var index = i - NetItem.Loadout3Armor.Item1;
|
||||
Item item = new Item();
|
||||
if (loadout3Armor[index] != null && loadout3Armor[index].netID != 0)
|
||||
if (loadout3Armor[index] != null && loadout3Armor[index].type != 0)
|
||||
{
|
||||
item.netDefaults(loadout3Armor[index].netID);
|
||||
item.netDefaults(loadout3Armor[index].type);
|
||||
item.Prefix(loadout3Armor[index].prefix);
|
||||
item.AffixName();
|
||||
|
||||
|
|
@ -797,9 +797,9 @@ namespace TShockAPI
|
|||
{
|
||||
var index = i - NetItem.Loadout3Dye.Item1;
|
||||
Item item = new Item();
|
||||
if (loadout3Dye[index] != null && loadout3Dye[index].netID != 0)
|
||||
if (loadout3Dye[index] != null && loadout3Dye[index].type != 0)
|
||||
{
|
||||
item.netDefaults(loadout3Dye[index].netID);
|
||||
item.netDefaults(loadout3Dye[index].type);
|
||||
item.Prefix(loadout3Dye[index].prefix);
|
||||
item.AffixName();
|
||||
|
||||
|
|
@ -1759,7 +1759,7 @@ namespace TShockAPI
|
|||
private Item GiveItemDirectly_FillIntoOccupiedSlot(Item item, int slot)
|
||||
{
|
||||
var inv = this.TPlayer.inventory;
|
||||
if (inv[slot].type <= 0 || inv[slot].stack >= inv[slot].maxStack || !item.IsTheSameAs(inv[slot]))
|
||||
if (inv[slot].type <= 0 || inv[slot].stack >= inv[slot].maxStack || item.IsNotTheSameAs(inv[slot]))
|
||||
return item;
|
||||
|
||||
if (item.stack + inv[slot].stack <= inv[slot].maxStack)
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace TShockAPI
|
|||
/// <summary>VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info.</summary>
|
||||
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
/// <summary>VersionCodename - The version codename is displayed when the server starts. Inspired by software codenames conventions.</summary>
|
||||
public static readonly string VersionCodename = "Hopefully SSC works somewhat correctly now edition";
|
||||
public static readonly string VersionCodename = "!!! You are using a dangerous testing version !!!";
|
||||
|
||||
/// <summary>SavePath - This is the path TShock saves its data in. This path is relative to the TerrariaServer.exe (not in ServerPlugins).</summary>
|
||||
public static string SavePath = "tshock";
|
||||
|
|
@ -1028,7 +1028,7 @@ namespace TShockAPI
|
|||
Console.WriteLine(GetString("This token will display until disabled by verification. ({0}setup)", Commands.Specifier));
|
||||
Console.ResetColor();
|
||||
}
|
||||
|
||||
Log.ConsoleError(GetString("!!! You are using a dangerous testing version !!!"));
|
||||
Regions.Reload();
|
||||
Warps.ReloadWarps();
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
|
||||
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3">
|
||||
<Aliases>BCryptNext</Aliases>
|
||||
</PackageReference>
|
||||
<PackageReference Include="GetText.NET" Version="8.0.5" />
|
||||
<PackageReference Include="MySql.Data" Version="9.1.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
|
||||
|
|
|
|||
|
|
@ -931,7 +931,7 @@ namespace TShockAPI
|
|||
/// <returns>The <paramref name="item"/> NetID surrounded by the item tag with proper stack/prefix data.</returns>
|
||||
public string ItemTag(Item item)
|
||||
{
|
||||
int netID = item.netID;
|
||||
int netID = item.type;
|
||||
int stack = item.stack;
|
||||
int prefix = item.prefix;
|
||||
string options = stack > 1 ? "/s" + stack : prefix != 0 ? "/p" + prefix : "";
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</None>
|
||||
<PackageReference Include="System.IO.Packaging" Version="10.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CheckMsgfmtCallable">
|
||||
|
|
|
|||
Binary file not shown.
BIN
lib/OTAPI.dll
BIN
lib/OTAPI.dll
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue