pass compile; add void vault code
This commit is contained in:
parent
43f586cde5
commit
1ed95c737e
10 changed files with 112 additions and 75 deletions
|
|
@ -2144,7 +2144,12 @@ namespace TShockAPI
|
|||
|
||||
private static void ToggleExpert(CommandArgs args)
|
||||
{
|
||||
Main.expertMode = !Main.expertMode;
|
||||
const int NormalMode = 0;
|
||||
const int ExpertMode = 1;
|
||||
if (Main.GameMode != ExpertMode)
|
||||
Main.GameMode = ExpertMode;
|
||||
else if (Main.GameMode == ExpertMode)
|
||||
Main.GameMode = NormalMode;
|
||||
TSPlayer.All.SendData(PacketTypes.WorldInfo);
|
||||
args.Player.SendSuccessMessage("Expert mode is now {0}.", Main.expertMode ? "on" : "off");
|
||||
}
|
||||
|
|
@ -2274,7 +2279,7 @@ namespace TShockAPI
|
|||
return;
|
||||
case "wof":
|
||||
case "wall of flesh":
|
||||
if (Main.wof >= 0)
|
||||
if (Main.wofNPCIndex != -1)
|
||||
{
|
||||
args.Player.SendErrorMessage("There is already a Wall of Flesh!");
|
||||
return;
|
||||
|
|
@ -2347,7 +2352,7 @@ namespace TShockAPI
|
|||
}
|
||||
else if (npc.type == 113)
|
||||
{
|
||||
if (Main.wof >= 0 || (args.Player.Y / 16f < (Main.maxTilesY - 205)))
|
||||
if (Main.wofNPCIndex != -1 || (args.Player.Y / 16f < (Main.maxTilesY - 205)))
|
||||
{
|
||||
args.Player.SendErrorMessage("Can't spawn Wall of Flesh!");
|
||||
return;
|
||||
|
|
@ -4148,9 +4153,8 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
Main.windSpeed = speed;
|
||||
Main.windSpeedSet = speed;
|
||||
Main.windSpeedSpeed = 0f;
|
||||
Main.windSpeedCurrent = speed;
|
||||
Main.windSpeedTarget = 0f;
|
||||
TSPlayer.All.SendData(PacketTypes.WorldInfo);
|
||||
TSPlayer.All.SendInfoMessage("{0} changed the wind speed to {1}.", args.Player.Name, speed);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ namespace TShockAPI.DB
|
|||
{
|
||||
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) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20);",
|
||||
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.hideVisual), TShock.Utils.EncodeColor(player.TPlayer.skinColor),TShock.Utils.EncodeColor(player.TPlayer.eyeColor), player.TPlayer.anglerQuestsFinished);
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -189,7 +189,7 @@ namespace TShockAPI.DB
|
|||
{
|
||||
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 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.hideVisual), TShock.Utils.EncodeColor(player.TPlayer.skinColor), TShock.Utils.EncodeColor(player.TPlayer.eyeColor), player.TPlayer.anglerQuestsFinished, player.TPlayer.skinVariant, player.TPlayer.extraAccessory ? 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);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ namespace TShockAPI
|
|||
/// <summary>
|
||||
/// The slot edited
|
||||
/// </summary>
|
||||
public byte Slot { get; set; }
|
||||
public short Slot { get; set; }
|
||||
/// <summary>
|
||||
/// The stack edited
|
||||
/// </summary>
|
||||
|
|
@ -246,7 +246,7 @@ namespace TShockAPI
|
|||
/// PlayerSlot - called at a PlayerSlot event
|
||||
/// </summary>
|
||||
public static HandlerList<PlayerSlotEventArgs> PlayerSlot = new HandlerList<PlayerSlotEventArgs>();
|
||||
private static bool OnPlayerSlot(TSPlayer player, MemoryStream data, byte _plr, byte _slot, short _stack, byte _prefix, short _type)
|
||||
private static bool OnPlayerSlot(TSPlayer player, MemoryStream data, byte _plr, short _slot, short _stack, byte _prefix, short _type)
|
||||
{
|
||||
if (PlayerSlot == null)
|
||||
return false;
|
||||
|
|
@ -1843,11 +1843,11 @@ namespace TShockAPI
|
|||
args.Player.TPlayer.shirtColor = shirtColor;
|
||||
args.Player.TPlayer.underShirtColor = underShirtColor;
|
||||
args.Player.TPlayer.shoeColor = shoeColor;
|
||||
args.Player.TPlayer.hideVisual = new bool[10];
|
||||
args.Player.TPlayer.hideVisibleAccessory = new bool[10];
|
||||
for (int i = 0; i < 8; i++)
|
||||
args.Player.TPlayer.hideVisual[i] = hideVisual[i];
|
||||
args.Player.TPlayer.hideVisibleAccessory[i] = hideVisual[i];
|
||||
for (int i = 8; i < 10; i++)
|
||||
args.Player.TPlayer.hideVisual[i] = hideVisual2[i];
|
||||
args.Player.TPlayer.hideVisibleAccessory[i] = hideVisual2[i];
|
||||
args.Player.TPlayer.hideMisc = hideMisc;
|
||||
args.Player.TPlayer.extraAccessory = extraSlot;
|
||||
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, args.Player.Index, NetworkText.FromLiteral(args.Player.Name), args.Player.Index);
|
||||
|
|
@ -1873,7 +1873,7 @@ namespace TShockAPI
|
|||
private static bool HandlePlayerSlot(GetDataHandlerArgs args)
|
||||
{
|
||||
byte plr = args.Data.ReadInt8();
|
||||
byte slot = args.Data.ReadInt8();
|
||||
short slot = args.Data.ReadInt16();
|
||||
short stack = args.Data.ReadInt16();
|
||||
byte prefix = args.Data.ReadInt8();
|
||||
short type = args.Data.ReadInt16();
|
||||
|
|
@ -3383,7 +3383,7 @@ namespace TShockAPI
|
|||
TileID.Candles,
|
||||
TileID.CorruptGrass,
|
||||
TileID.Dirt,
|
||||
TileID.FleshGrass,
|
||||
TileID.CrimsonGrass,
|
||||
TileID.Grass,
|
||||
TileID.HallowedGrass,
|
||||
TileID.MagicalIceBlock,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
TShock, a server mod for Terraria
|
||||
Copyright (C) 2011-2019 Pryaxis & TShock Contributors
|
||||
|
||||
|
|
@ -39,13 +39,13 @@ namespace TShockAPI.Localization
|
|||
{
|
||||
var culture = Language.ActiveCulture;
|
||||
|
||||
var skip = culture == GameCulture.English;
|
||||
var skip = culture == GameCulture.FromCultureName(GameCulture.CultureName.English);
|
||||
|
||||
try
|
||||
{
|
||||
if (!skip)
|
||||
{
|
||||
LanguageManager.Instance.SetLanguage(GameCulture.English);
|
||||
LanguageManager.Instance.SetLanguage(GameCulture.FromCultureName(GameCulture.CultureName.English));
|
||||
}
|
||||
|
||||
for (var i = -48; i < Main.maxItemTypes; i++)
|
||||
|
|
|
|||
|
|
@ -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.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -46,6 +46,11 @@ namespace TShockAPI
|
|||
/// </summary>
|
||||
public static readonly int ForgeSlots = SafeSlots;
|
||||
|
||||
/// <summary>
|
||||
/// 40 - The number of slots in a void vault
|
||||
/// </summary>
|
||||
public static readonly int VoidSlots = ForgeSlots;
|
||||
|
||||
/// <summary>
|
||||
/// 59 - The size of the player's inventory (inventory, coins, ammo, held item)
|
||||
/// </summary>
|
||||
|
|
@ -79,7 +84,7 @@ 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 + 1;
|
||||
public static readonly int MaxInventory = InventorySlots + ArmorSlots + DyeSlots + MiscEquipSlots + MiscDyeSlots + PiggySlots + SafeSlots + ForgeSlots + VoidSlots + 1;
|
||||
|
||||
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);
|
||||
|
|
@ -90,6 +95,7 @@ namespace TShockAPI
|
|||
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);
|
||||
|
||||
[JsonProperty("netID")]
|
||||
private int _netId;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace TShockAPI
|
|||
this.shirtColor = player.TPlayer.shirtColor;
|
||||
this.underShirtColor = player.TPlayer.underShirtColor;
|
||||
this.shoeColor = player.TPlayer.shoeColor;
|
||||
this.hideVisuals = player.TPlayer.hideVisual;
|
||||
this.hideVisuals = player.TPlayer.hideVisibleAccessory;
|
||||
this.skinColor = player.TPlayer.skinColor;
|
||||
this.eyeColor = player.TPlayer.eyeColor;
|
||||
this.questsCompleted = player.TPlayer.anglerQuestsFinished;
|
||||
|
|
@ -120,6 +120,7 @@ namespace TShockAPI
|
|||
Item[] piggy = player.TPlayer.bank.item;
|
||||
Item[] safe = player.TPlayer.bank2.item;
|
||||
Item[] forge = player.TPlayer.bank3.item;
|
||||
Item[] voidVault = player.TPlayer.bank4.item;
|
||||
Item trash = player.TPlayer.trashItem;
|
||||
|
||||
for (int i = 0; i < NetItem.MaxInventory; i++)
|
||||
|
|
@ -170,12 +171,17 @@ namespace TShockAPI
|
|||
//179-219
|
||||
this.inventory[i] = (NetItem)trash;
|
||||
}
|
||||
else
|
||||
else if (i < NetItem.ForgeIndex.Item2)
|
||||
{
|
||||
//220
|
||||
var index = i - NetItem.ForgeIndex.Item1;
|
||||
this.inventory[i] = (NetItem)forge[index];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//220
|
||||
var index = i - NetItem.VoidIndex.Item1;
|
||||
this.inventory[i] = (NetItem)voidVault[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -222,9 +228,9 @@ namespace TShockAPI
|
|||
player.TPlayer.eyeColor = this.eyeColor.Value;
|
||||
|
||||
if (this.hideVisuals != null)
|
||||
player.TPlayer.hideVisual = this.hideVisuals;
|
||||
player.TPlayer.hideVisibleAccessory = this.hideVisuals;
|
||||
else
|
||||
player.TPlayer.hideVisual = new bool[player.TPlayer.hideVisual.Length];
|
||||
player.TPlayer.hideVisibleAccessory = new bool[player.TPlayer.hideVisibleAccessory.Length];
|
||||
|
||||
for (int i = 0; i < NetItem.MaxInventory; i++)
|
||||
{
|
||||
|
|
@ -323,7 +329,7 @@ namespace TShockAPI
|
|||
player.TPlayer.trashItem.prefix = (byte)this.inventory[i].PrefixId;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (i < NetItem.ForgeIndex.Item2)
|
||||
{
|
||||
//220
|
||||
var index = i - NetItem.ForgeIndex.Item1;
|
||||
|
|
@ -334,7 +340,18 @@ namespace TShockAPI
|
|||
player.TPlayer.bank3.item[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.bank3.item[index].Prefix((byte)this.inventory[i].PrefixId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//260
|
||||
var index = i - NetItem.VoidIndex.Item1;
|
||||
player.TPlayer.bank4.item[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.bank4.item[index].netID != 0)
|
||||
{
|
||||
player.TPlayer.bank4.item[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.bank4.item[index].Prefix((byte)this.inventory[i].PrefixId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -380,6 +397,11 @@ namespace TShockAPI
|
|||
NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].bank3.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank3.item[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.VoidSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, NetworkText.FromLiteral(Main.player[player.Index].bank4.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank4.item[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
|
||||
|
||||
NetMessage.SendData(4, -1, -1, NetworkText.FromLiteral(player.Name), player.Index, 0f, 0f, 0f, 0);
|
||||
|
|
@ -428,6 +450,11 @@ namespace TShockAPI
|
|||
NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].bank3.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank3.item[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.VoidSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, player.Index, -1, NetworkText.FromLiteral(Main.player[player.Index].bank4.item[k].Name), player.Index, slot, (float)Main.player[player.Index].bank4.item[k].prefix);
|
||||
slot++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -126,10 +126,10 @@ namespace TShockAPI
|
|||
if (task.direct)
|
||||
{
|
||||
OnSaveWorld(new WorldSaveEventArgs());
|
||||
WorldFile.saveWorld(task.resetTime);
|
||||
WorldFile.SaveWorld(task.resetTime);
|
||||
}
|
||||
else
|
||||
WorldFile.saveWorld(task.resetTime);
|
||||
WorldFile.SaveWorld(task.resetTime);
|
||||
TShock.Utils.Broadcast("World saved.", Color.Yellow);
|
||||
TShock.Log.Info(string.Format("World saved at ({0})", Main.worldPathName));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
TShock, a server mod for Terraria
|
||||
Copyright (C) 2011-2019 Pryaxis & TShock Contributors
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ namespace TShockAPI.Sockets
|
|||
|
||||
private void ListenLoop(object unused)
|
||||
{
|
||||
while (this._isListening && !Netplay.disconnect)
|
||||
while (this._isListening && !Netplay.Disconnect)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1110,7 +1110,7 @@ namespace TShockAPI
|
|||
/// <returns>True if allowed, otherwise false</returns>
|
||||
private bool OnCreep(int tileType)
|
||||
{
|
||||
if (!Config.AllowCrimsonCreep && (tileType == TileID.Dirt || tileType == TileID.FleshWeeds
|
||||
if (!Config.AllowCrimsonCreep && (tileType == TileID.Dirt || tileType == TileID.CrimsonGrass
|
||||
|| TileID.Sets.Crimson[tileType]))
|
||||
{
|
||||
return false;
|
||||
|
|
@ -1669,7 +1669,7 @@ namespace TShockAPI
|
|||
file.ServerPassword = _cliPassword;
|
||||
}
|
||||
|
||||
Netplay.spamCheck = false;
|
||||
Netplay.SpamCheck = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ namespace TShockAPI
|
|||
var found = new List<Item>();
|
||||
Item item = new Item();
|
||||
string nameLower = name.ToLowerInvariant();
|
||||
var checkEnglish = Language.ActiveCulture != GameCulture.English;
|
||||
var checkEnglish = Language.ActiveCulture != GameCulture.FromCultureName(GameCulture.CultureName.English);
|
||||
|
||||
for (int i = 1; i < Main.maxItemTypes; i++)
|
||||
{
|
||||
|
|
@ -471,7 +471,7 @@ namespace TShockAPI
|
|||
TShock.Utils.Broadcast(reason, Color.Red);
|
||||
|
||||
// Disconnect after kick as that signifies server is exiting and could cause a race
|
||||
Netplay.disconnect = true;
|
||||
Netplay.Disconnect = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue