Fix torchflags

UsingBiomeTorches: Whether or not the player has the torchgod biometorches ability enabled
HappyFunTorchTime: Whether or not the player has fought the torchgod before (for logic that checks for torchgod spawning)
unlockedBiomeTorches: Whether or not the player has the torchgod biome torches ability unlocked
This commit is contained in:
Quinci135 2021-05-23 04:48:01 -07:00
parent 6856c867dd
commit 5581bf5e45
4 changed files with 26 additions and 15 deletions

View file

@ -49,6 +49,8 @@ namespace TShockAPI
public Color? eyeColor;
public bool[] hideVisuals;
public int questsCompleted;
public int usingBiomeTorches;
public int happyFunTorchTime = 1;
public int unlockedBiomeTorches;
public PlayerData(TSPlayer player)
@ -115,6 +117,8 @@ namespace TShockAPI
this.skinColor = player.TPlayer.skinColor;
this.eyeColor = player.TPlayer.eyeColor;
this.questsCompleted = player.TPlayer.anglerQuestsFinished;
this.usingBiomeTorches = player.TPlayer.UsingBiomeTorches ? 1 : 0;
this.happyFunTorchTime = player.TPlayer.happyFunTorchTime ? 1 : 0;
this.unlockedBiomeTorches = player.TPlayer.unlockedBiomeTorches ? 1 : 0;
Item[] inventory = player.TPlayer.inventory;
@ -210,6 +214,9 @@ namespace TShockAPI
player.sY = this.spawnY;
player.TPlayer.hairDye = this.hairDye;
player.TPlayer.anglerQuestsFinished = this.questsCompleted;
player.TPlayer.UsingBiomeTorches = this.usingBiomeTorches == 1;
player.TPlayer.happyFunTorchTime = this.happyFunTorchTime == 1;
player.TPlayer.unlockedBiomeTorches = this.unlockedBiomeTorches == 1;
if (extraSlot != null)
player.TPlayer.extraAccessory = extraSlot.Value == 1 ? true : false;
@ -237,12 +244,6 @@ namespace TShockAPI
else
player.TPlayer.hideVisibleAccessory = new bool[player.TPlayer.hideVisibleAccessory.Length];
if (this.unlockedBiomeTorches != null)
{
player.TPlayer.unlockedBiomeTorches = this.unlockedBiomeTorches == 1 ? true : false;
player.TPlayer.UsingBiomeTorches = this.unlockedBiomeTorches == 1 ? true : false;
}
for (int i = 0; i < NetItem.MaxInventory; i++)
{
if (i < NetItem.InventoryIndex.Item2)