Fixed SSC. Note that SSC will NOT work with UUID login before join. UUID login before join has been disabled during SSC unless the player has the "tshock.ignore.ssc" permission.
Removed IncrementKills()
This commit is contained in:
parent
2d66265afd
commit
3a3e053d43
5 changed files with 233 additions and 169 deletions
|
|
@ -405,14 +405,6 @@ namespace TShockAPI
|
|||
{
|
||||
HelpText = "Sets the spawn rate of NPCs."
|
||||
});
|
||||
add(new Command(Permissions.invade, PumpkinMoon, "pumpkinmoon", "pmoon")
|
||||
{
|
||||
HelpText = "Starts a Pumpkin Moon at the specified wave."
|
||||
});
|
||||
add(new Command(Permissions.invade, FrostMoon, "frostmoon", "fmoon")
|
||||
{
|
||||
HelpText = "Starts a Frost Moon at the specified wave."
|
||||
});
|
||||
add(new Command(Permissions.clearangler, ClearAnglerQuests, "clearangler")
|
||||
{
|
||||
HelpText = "Resets the list of users who have completed an angler quest that day."
|
||||
|
|
@ -1864,83 +1856,88 @@ namespace TShockAPI
|
|||
TSPlayer.All.SendInfoMessage("{0} {1}ed an eclipse.", args.Player.Name, Main.eclipse ? "start" : "stopp");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void Invade(CommandArgs args)
|
||||
{
|
||||
if (Main.invasionSize <= 0)
|
||||
{
|
||||
if (args.Parameters.Count != 1)
|
||||
if (args.Parameters.Count < 1)
|
||||
{
|
||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}invade <invasion type>", Specifier);
|
||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}invade <invasion type> [wave]", Specifier);
|
||||
return;
|
||||
}
|
||||
|
||||
int wave = 1;
|
||||
switch (args.Parameters[0].ToLower())
|
||||
{
|
||||
case "goblin":
|
||||
case "goblins":
|
||||
case "goblin army":
|
||||
TSPlayer.All.SendInfoMessage("{0} has started a goblin army invasion.", args.Player.Name);
|
||||
TShock.StartInvasion(1);
|
||||
break;
|
||||
|
||||
case "snowman":
|
||||
case "snowmen":
|
||||
case "snow legion":
|
||||
TSPlayer.All.SendInfoMessage("{0} has started a snow legion invasion.", args.Player.Name);
|
||||
TShock.StartInvasion(2);
|
||||
break;
|
||||
|
||||
case "pirate":
|
||||
case "pirates":
|
||||
TSPlayer.All.SendInfoMessage("{0} has started a pirate invasion.", args.Player.Name);
|
||||
TShock.StartInvasion(3);
|
||||
break;
|
||||
|
||||
case "pumpkin":
|
||||
case "pumpkinmoon":
|
||||
if (args.Parameters.Count > 1)
|
||||
{
|
||||
if (!int.TryParse(args.Parameters[1], out wave) || wave <= 0)
|
||||
{
|
||||
args.Player.SendErrorMessage("Invalid wave!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TSPlayer.Server.SetPumpkinMoon(true);
|
||||
Main.bloodMoon = false;
|
||||
NPC.waveKills = 0f;
|
||||
NPC.waveCount = wave;
|
||||
TSPlayer.All.SendInfoMessage("{0} started the pumpkin moon at wave {1}!", args.Player.Name, wave);
|
||||
break;
|
||||
|
||||
case "frost":
|
||||
case "frostmoon":
|
||||
if (args.Parameters.Count > 1)
|
||||
{
|
||||
if (!int.TryParse(args.Parameters[1], out wave) || wave <= 0)
|
||||
{
|
||||
args.Player.SendErrorMessage("Invalid wave!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TSPlayer.Server.SetFrostMoon(true);
|
||||
Main.bloodMoon = false;
|
||||
NPC.waveKills = 0f;
|
||||
NPC.waveCount = wave;
|
||||
TSPlayer.All.SendInfoMessage("{0} started the frost moon at wave {1}!", args.Player.Name, wave);
|
||||
break;
|
||||
|
||||
case "martian":
|
||||
case "martians":
|
||||
TSPlayer.All.SendInfoMessage("{0} has started a martian invasion.", args.Player.Name);
|
||||
TShock.StartInvasion(4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TSPlayer.All.SendInfoMessage("{0} has ended the invasion.", args.Player.Name);
|
||||
TSPlayer.All.SendInfoMessage("{0} has ended the invasion.", args.Player.Name);
|
||||
Main.invasionSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static void PumpkinMoon(CommandArgs args)
|
||||
{
|
||||
int wave = 1;
|
||||
if (args.Parameters.Count != 0)
|
||||
{
|
||||
if (!int.TryParse(args.Parameters[0], out wave) || wave <= 0)
|
||||
{
|
||||
args.Player.SendErrorMessage("Invalid wave!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TSPlayer.Server.SetPumpkinMoon(true);
|
||||
Main.bloodMoon = false;
|
||||
NPC.waveKills = 0f;
|
||||
NPC.waveCount = wave;
|
||||
TSPlayer.All.SendInfoMessage("{0} started the pumpkin moon at wave {1}!", args.Player.Name, wave);
|
||||
}
|
||||
|
||||
private static void FrostMoon(CommandArgs args)
|
||||
{
|
||||
int wave = 1;
|
||||
if (args.Parameters.Count != 0)
|
||||
{
|
||||
if (!int.TryParse(args.Parameters[0], out wave) || wave <= 0)
|
||||
{
|
||||
args.Player.SendErrorMessage("Invalid wave!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TSPlayer.Server.SetFrostMoon(true);
|
||||
Main.bloodMoon = false;
|
||||
NPC.waveKills = 0f;
|
||||
NPC.waveCount = wave;
|
||||
TSPlayer.All.SendInfoMessage("{0} started the frost moon at wave {1}!", args.Player.Name, wave);
|
||||
}
|
||||
|
||||
private static void ClearAnglerQuests(CommandArgs args)
|
||||
{
|
||||
if (args.Parameters.Count > 0)
|
||||
|
|
|
|||
|
|
@ -1443,23 +1443,22 @@ namespace TShockAPI
|
|||
|
||||
if (user != null && !TShock.Config.DisableUUIDLogin)
|
||||
{
|
||||
if(user.UUID == args.Player.UUID)
|
||||
if (user.UUID == args.Player.UUID)
|
||||
{
|
||||
args.Player.PlayerData = TShock.CharacterDB.GetPlayerData(args.Player, user.ID);
|
||||
|
||||
if (args.Player.State == 1)
|
||||
args.Player.State = 2;
|
||||
NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index);
|
||||
|
||||
args.Player.PlayerData = TShock.CharacterDB.GetPlayerData(args.Player, user.ID);
|
||||
|
||||
var group = TShock.Utils.GetGroup(user.Group);
|
||||
|
||||
if (Main.ServerSideCharacter)
|
||||
{
|
||||
if (group.HasPermission(Permissions.bypassssc))
|
||||
if (!group.HasPermission(Permissions.bypassssc))
|
||||
{
|
||||
args.Player.IgnoreActionsForClearingTrashCan = false;
|
||||
return true;
|
||||
}
|
||||
args.Player.PlayerData.RestoreCharacter(args.Player);
|
||||
}
|
||||
args.Player.LoginFailsBySsi = false;
|
||||
|
||||
|
|
@ -1480,7 +1479,7 @@ namespace TShockAPI
|
|||
args.Player.PlayerData.CopyCharacter(args.Player);
|
||||
TShock.CharacterDB.InsertPlayerData(args.Player);
|
||||
}
|
||||
args.Player.SendMessage("Authenticated as " + args.Player.Name + " successfully.", Color.LimeGreen);
|
||||
args.Player.SendSuccessMessage("Authenticated as " + user.Name + " successfully.");
|
||||
TShock.Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user " + args.Player.Name + ".");
|
||||
Hooks.PlayerHooks.OnPlayerPostLogin(args.Player);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -13,20 +13,35 @@ namespace TShockAPI
|
|||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public struct NetItem
|
||||
{
|
||||
/// <summary>
|
||||
/// The size of the player's inventory (inventory, coins, ammo, trash)
|
||||
/// </summary>
|
||||
public static readonly int InventorySlots = 59;
|
||||
|
||||
/// <summary>
|
||||
/// The number of armor slots.
|
||||
/// </summary>
|
||||
public static readonly int ArmorSlots = 16;
|
||||
public static readonly int ArmorSlots = 20;
|
||||
|
||||
/// <summary>
|
||||
/// The number of other equippable items
|
||||
/// </summary>
|
||||
public static readonly int MiscEquipSlots = 5;
|
||||
|
||||
/// <summary>
|
||||
/// The number of dye slots.
|
||||
/// </summary>
|
||||
public static readonly int DyeSlots = 8;
|
||||
public static readonly int DyeSlots = 10;
|
||||
|
||||
/// <summary>
|
||||
/// The inventory size.
|
||||
/// The number of other dye slots (for <see cref="MiscEquipSlots"/>)
|
||||
/// </summary>
|
||||
public static readonly int MaxInventory = 83;
|
||||
public static readonly int MiscDyeSlots = 5;
|
||||
|
||||
/// <summary>
|
||||
/// The inventory size (including armour, dies, coins, ammo, and trash)
|
||||
/// </summary>
|
||||
public static readonly int MaxInventory = 99;
|
||||
|
||||
[JsonProperty("netID")]
|
||||
private int _netId;
|
||||
|
|
|
|||
|
|
@ -1108,7 +1108,7 @@ namespace TShockAPI
|
|||
|
||||
public void StoreSlot(int slot, int netID, byte prefix, int stack)
|
||||
{
|
||||
if(slot > (this.inventory.Length - 1)) //if the slot is out of range then dont save
|
||||
if (slot > (this.inventory.Length - 1)) //if the slot is out of range then dont save
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -1147,21 +1147,40 @@ namespace TShockAPI
|
|||
Item[] inventory = player.TPlayer.inventory;
|
||||
Item[] armor = player.TPlayer.armor;
|
||||
Item[] dye = player.TPlayer.dye;
|
||||
Item[] miscEqups = player.TPlayer.miscEquips;
|
||||
Item[] miscDyes = player.TPlayer.miscDyes;
|
||||
for (int i = 0; i < NetItem.MaxInventory; i++)
|
||||
{
|
||||
if (i < NetItem.MaxInventory - (NetItem.ArmorSlots + NetItem.DyeSlots))
|
||||
if (i < NetItem.InventorySlots)
|
||||
{
|
||||
//0-58
|
||||
this.inventory[i] = (NetItem)inventory[i];
|
||||
}
|
||||
else if (i < NetItem.MaxInventory - NetItem.DyeSlots)
|
||||
else if (i < NetItem.InventorySlots
|
||||
+ NetItem.DyeSlots + NetItem.MiscDyeSlots + NetItem.MiscEquipSlots)
|
||||
{
|
||||
var index = i - (NetItem.MaxInventory - (NetItem.ArmorSlots + NetItem.DyeSlots));
|
||||
//59-78
|
||||
var index = i - NetItem.InventorySlots;
|
||||
this.inventory[i] = (NetItem)armor[index];
|
||||
}
|
||||
else if (i < NetItem.MaxInventory - NetItem.MiscEquipSlots - NetItem.MiscDyeSlots)
|
||||
{
|
||||
//79-88
|
||||
var index = i - (NetItem.MaxInventory -
|
||||
(NetItem.DyeSlots + NetItem.MiscDyeSlots + NetItem.MiscEquipSlots));
|
||||
this.inventory[i] = (NetItem)dye[index];
|
||||
}
|
||||
else if (i < NetItem.MaxInventory - NetItem.MiscEquipSlots)
|
||||
{
|
||||
//89-93
|
||||
var index = i - (NetItem.MaxInventory - (NetItem.MiscDyeSlots + NetItem.MiscEquipSlots));
|
||||
this.inventory[i] = (NetItem)miscEqups[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
var index = i - (NetItem.MaxInventory - NetItem.DyeSlots);
|
||||
this.inventory[i] = (NetItem)dye[index];
|
||||
//93-98
|
||||
var index = i - (NetItem.MaxInventory - NetItem.MiscDyeSlots);
|
||||
this.inventory[i] = (NetItem)miscDyes[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1206,8 +1225,9 @@ namespace TShockAPI
|
|||
|
||||
for (int i = 0; i < NetItem.MaxInventory; i++)
|
||||
{
|
||||
if (i < NetItem.MaxInventory - (NetItem.ArmorSlots + NetItem.DyeSlots))
|
||||
if (i < NetItem.InventorySlots)
|
||||
{
|
||||
//0-58
|
||||
player.TPlayer.inventory[i].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.inventory[i].netID != 0)
|
||||
|
|
@ -1216,9 +1236,11 @@ namespace TShockAPI
|
|||
player.TPlayer.inventory[i].prefix = this.inventory[i].PrefixId;
|
||||
}
|
||||
}
|
||||
else if (i < NetItem.MaxInventory - NetItem.DyeSlots)
|
||||
else if (i < NetItem.InventorySlots
|
||||
+ NetItem.DyeSlots + NetItem.MiscDyeSlots + NetItem.MiscEquipSlots)
|
||||
{
|
||||
var index = i - (NetItem.MaxInventory - (NetItem.ArmorSlots + NetItem.DyeSlots));
|
||||
//59-78
|
||||
var index = i - NetItem.InventorySlots;
|
||||
player.TPlayer.armor[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.armor[index].netID != 0)
|
||||
|
|
@ -1227,9 +1249,11 @@ namespace TShockAPI
|
|||
player.TPlayer.armor[index].prefix = (byte)this.inventory[i].PrefixId;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (i < NetItem.MaxInventory - NetItem.MiscEquipSlots - NetItem.MiscDyeSlots)
|
||||
{
|
||||
var index = i - (NetItem.MaxInventory - NetItem.DyeSlots);
|
||||
//79-88
|
||||
var index = i - (NetItem.MaxInventory -
|
||||
(NetItem.DyeSlots + NetItem.MiscDyeSlots + NetItem.MiscEquipSlots));
|
||||
player.TPlayer.dye[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.dye[index].netID != 0)
|
||||
|
|
@ -1238,69 +1262,89 @@ namespace TShockAPI
|
|||
player.TPlayer.dye[index].prefix = (byte)this.inventory[i].PrefixId;
|
||||
}
|
||||
}
|
||||
else if (i < NetItem.MaxInventory - NetItem.MiscEquipSlots)
|
||||
{
|
||||
//89-93
|
||||
var index = i - (NetItem.MaxInventory - (NetItem.MiscDyeSlots + NetItem.MiscEquipSlots));
|
||||
player.TPlayer.miscEquips[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.miscEquips[index].netID != 0)
|
||||
{
|
||||
player.TPlayer.miscEquips[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.miscEquips[index].prefix = (byte)this.inventory[i].PrefixId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//93-98
|
||||
var index = i - (NetItem.MaxInventory - NetItem.MiscDyeSlots);
|
||||
player.TPlayer.miscDyes[index].netDefaults(this.inventory[i].NetId);
|
||||
|
||||
if (player.TPlayer.miscDyes[index].netID != 0)
|
||||
{
|
||||
player.TPlayer.miscDyes[index].stack = this.inventory[i].Stack;
|
||||
player.TPlayer.miscDyes[index].prefix = (byte)this.inventory[i].PrefixId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < 59; k++)
|
||||
float slot = 0f;
|
||||
for (int k = 0; k < NetItem.InventorySlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].inventory[k].name, player.Index, (float)k, (float)Main.player[player.Index].inventory[k].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].inventory[k].name, player.Index, slot, (float)Main.player[player.Index].inventory[k].prefix, 0f, 0);
|
||||
slot++;
|
||||
}
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[0].name, player.Index, 59f, (float)Main.player[player.Index].armor[0].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[1].name, player.Index, 60f, (float)Main.player[player.Index].armor[1].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[2].name, player.Index, 61f, (float)Main.player[player.Index].armor[2].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[3].name, player.Index, 62f, (float)Main.player[player.Index].armor[3].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[4].name, player.Index, 63f, (float)Main.player[player.Index].armor[4].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[5].name, player.Index, 64f, (float)Main.player[player.Index].armor[5].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[6].name, player.Index, 65f, (float)Main.player[player.Index].armor[6].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[7].name, player.Index, 66f, (float)Main.player[player.Index].armor[7].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[8].name, player.Index, 67f, (float)Main.player[player.Index].armor[8].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[9].name, player.Index, 68f, (float)Main.player[player.Index].armor[9].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[10].name, player.Index, 69f, (float)Main.player[player.Index].armor[10].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[11].name, player.Index, 70f, (float)Main.player[player.Index].armor[11].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[12].name, player.Index, 71f, (float)Main.player[player.Index].armor[12].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[13].name, player.Index, 72f, (float)Main.player[player.Index].armor[13].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[14].name, player.Index, 73f, (float)Main.player[player.Index].armor[14].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[15].name, player.Index, 74f, (float)Main.player[player.Index].armor[15].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[0].name, player.Index, 75f, (float)Main.player[player.Index].dye[0].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[1].name, player.Index, 76f, (float)Main.player[player.Index].dye[1].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[2].name, player.Index, 77f, (float)Main.player[player.Index].dye[2].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[3].name, player.Index, 78f, (float)Main.player[player.Index].dye[3].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[4].name, player.Index, 79f, (float)Main.player[player.Index].dye[4].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[5].name, player.Index, 80f, (float)Main.player[player.Index].dye[5].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[6].name, player.Index, 81f, (float)Main.player[player.Index].dye[6].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[7].name, player.Index, 82f, (float)Main.player[player.Index].dye[7].prefix, 0f, 0);
|
||||
for (int k = 0; k < NetItem.ArmorSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[k].name, player.Index, slot, (float)Main.player[player.Index].armor[k].prefix, 0f, 0);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.DyeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[k].name, player.Index, slot, (float)Main.player[player.Index].dye[k].prefix, 0f, 0);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.MiscEquipSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].miscEquips[k].name, player.Index, slot, (float)Main.player[player.Index].miscEquips[k].prefix, 0f, 0);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.MiscDyeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].miscDyes[k].name, player.Index, slot, (float)Main.player[player.Index].miscDyes[k].prefix, 0f, 0);
|
||||
slot++;
|
||||
}
|
||||
|
||||
NetMessage.SendData(4, -1, -1, player.Name, player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(42, -1, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(16, -1, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
|
||||
for (int k = 0; k < 59; k++)
|
||||
slot = 0f;
|
||||
for (int k = 0; k < NetItem.InventorySlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].inventory[k].name, player.Index, (float)k, (float)Main.player[player.Index].inventory[k].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].inventory[k].name, player.Index, slot, (float)Main.player[player.Index].inventory[k].prefix, 0f, 0);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.ArmorSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].armor[k].name, player.Index, slot, (float)Main.player[player.Index].armor[k].prefix, 0f, 0);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.DyeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].dye[k].name, player.Index, slot, (float)Main.player[player.Index].dye[k].prefix, 0f, 0);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.MiscEquipSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].miscEquips[k].name, player.Index, slot, (float)Main.player[player.Index].miscEquips[k].prefix, 0f, 0);
|
||||
slot++;
|
||||
}
|
||||
for (int k = 0; k < NetItem.MiscDyeSlots; k++)
|
||||
{
|
||||
NetMessage.SendData(5, -1, -1, Main.player[player.Index].miscDyes[k].name, player.Index, slot, (float)Main.player[player.Index].miscDyes[k].prefix, 0f, 0);
|
||||
slot++;
|
||||
}
|
||||
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[0].name, player.Index, 59f, (float)Main.player[player.Index].armor[0].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[1].name, player.Index, 60f, (float)Main.player[player.Index].armor[1].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[2].name, player.Index, 61f, (float)Main.player[player.Index].armor[2].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[3].name, player.Index, 62f, (float)Main.player[player.Index].armor[3].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[4].name, player.Index, 63f, (float)Main.player[player.Index].armor[4].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[5].name, player.Index, 64f, (float)Main.player[player.Index].armor[5].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[6].name, player.Index, 65f, (float)Main.player[player.Index].armor[6].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[7].name, player.Index, 66f, (float)Main.player[player.Index].armor[7].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[8].name, player.Index, 67f, (float)Main.player[player.Index].armor[8].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[9].name, player.Index, 68f, (float)Main.player[player.Index].armor[9].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[10].name, player.Index, 69f, (float)Main.player[player.Index].armor[10].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[11].name, player.Index, 70f, (float)Main.player[player.Index].armor[11].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[12].name, player.Index, 71f, (float)Main.player[player.Index].armor[12].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[13].name, player.Index, 72f, (float)Main.player[player.Index].armor[13].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[14].name, player.Index, 73f, (float)Main.player[player.Index].armor[14].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].armor[15].name, player.Index, 74f, (float)Main.player[player.Index].armor[15].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[0].name, player.Index, 75f, (float)Main.player[player.Index].dye[0].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[1].name, player.Index, 76f, (float)Main.player[player.Index].dye[1].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[2].name, player.Index, 77f, (float)Main.player[player.Index].dye[2].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[3].name, player.Index, 78f, (float)Main.player[player.Index].dye[3].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[4].name, player.Index, 79f, (float)Main.player[player.Index].dye[4].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[5].name, player.Index, 80f, (float)Main.player[player.Index].dye[5].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[6].name, player.Index, 81f, (float)Main.player[player.Index].dye[6].prefix, 0f, 0);
|
||||
NetMessage.SendData(5, player.Index, -1, Main.player[player.Index].dye[7].name, player.Index, 82f, (float)Main.player[player.Index].dye[7].prefix, 0f, 0);
|
||||
NetMessage.SendData(4, player.Index, -1, player.Name, player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(42, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
NetMessage.SendData(16, player.Index, -1, "", player.Index, 0f, 0f, 0f, 0);
|
||||
|
|
|
|||
|
|
@ -1351,7 +1351,6 @@ namespace TShockAPI
|
|||
{
|
||||
if (Config.InfiniteInvasion)
|
||||
{
|
||||
IncrementKills();
|
||||
if (Main.invasionSize < 10)
|
||||
{
|
||||
Main.invasionSize = 20000000;
|
||||
|
|
@ -1553,42 +1552,6 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>KillCount - Invasion kill count local storage variable.</summary>
|
||||
private static int KillCount;
|
||||
|
||||
/// <summary>IncrementKills - Increments the number of kills used in invasion tracking.</summary>
|
||||
//TODO: Why is this in TShock at all, still?
|
||||
public static void IncrementKills()
|
||||
{
|
||||
KillCount++;
|
||||
Random r = new Random();
|
||||
int random = r.Next(5);
|
||||
if (KillCount % 100 == 0)
|
||||
{
|
||||
switch (random)
|
||||
{
|
||||
case 0:
|
||||
Utils.Broadcast(string.Format("You call that a lot? {0} goblins killed!", KillCount), Color.Green);
|
||||
break;
|
||||
case 1:
|
||||
Utils.Broadcast(string.Format("Fatality! {0} goblins killed!", KillCount), Color.Green);
|
||||
break;
|
||||
case 2:
|
||||
Utils.Broadcast(string.Format("Number of 'noobs' killed to date: {0}", KillCount), Color.Green);
|
||||
break;
|
||||
case 3:
|
||||
Utils.Broadcast(string.Format("Duke Nukem would be proud. {0} goblins killed.", KillCount), Color.Green);
|
||||
break;
|
||||
case 4:
|
||||
Utils.Broadcast(string.Format("You call that a lot? {0} goblins killed!", KillCount), Color.Green);
|
||||
break;
|
||||
case 5:
|
||||
Utils.Broadcast(string.Format("{0} copies of Call of Duty smashed.", KillCount), Color.Green);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>CheckProjectilePermission - Checks if a projectile is banned.</summary>
|
||||
/// <param name="player">player - The TSPlayer object that created the projectile.</param>
|
||||
/// <param name="index">index - The projectile index.</param>
|
||||
|
|
@ -1819,10 +1782,14 @@ namespace TShockAPI
|
|||
Item[] inventory = player.TPlayer.inventory;
|
||||
Item[] armor = player.TPlayer.armor;
|
||||
Item[] dye = player.TPlayer.dye;
|
||||
Item[] miscEquips = player.TPlayer.miscEquips;
|
||||
Item[] miscDyes = player.TPlayer.miscDyes;
|
||||
|
||||
for (int i = 0; i < NetItem.MaxInventory; i++)
|
||||
{
|
||||
if (i < NetItem.MaxInventory - (NetItem.ArmorSlots + NetItem.DyeSlots))
|
||||
if (i < NetItem.InventorySlots)
|
||||
{
|
||||
//0-58
|
||||
Item item = new Item();
|
||||
if (inventory[i] != null && inventory[i].netID != 0)
|
||||
{
|
||||
|
|
@ -1838,10 +1805,12 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (i < (NetItem.MaxInventory - (NetItem.ArmorSlots + NetItem.DyeSlots)))
|
||||
else if (i < NetItem.InventorySlots
|
||||
+ NetItem.DyeSlots + NetItem.MiscDyeSlots + NetItem.MiscEquipSlots)
|
||||
{
|
||||
//59-78
|
||||
Item item = new Item();
|
||||
var index = i - (NetItem.MaxInventory - (NetItem.ArmorSlots + NetItem.DyeSlots));
|
||||
var index = i - NetItem.InventorySlots;
|
||||
if (armor[index] != null && armor[index].netID != 0)
|
||||
{
|
||||
item.netDefaults(armor[index].netID);
|
||||
|
|
@ -1856,10 +1825,12 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (i < (NetItem.MaxInventory - (NetItem.ArmorSlots + NetItem.DyeSlots)))
|
||||
else if (i < NetItem.MaxInventory - NetItem.MiscEquipSlots - NetItem.MiscDyeSlots)
|
||||
{
|
||||
//79-88
|
||||
Item item = new Item();
|
||||
var index = i - (NetItem.MaxInventory - NetItem.DyeSlots);
|
||||
var index = i - (NetItem.MaxInventory -
|
||||
(NetItem.DyeSlots + NetItem.MiscDyeSlots + NetItem.MiscEquipSlots));
|
||||
if (dye[index] != null && dye[index].netID != 0)
|
||||
{
|
||||
item.netDefaults(dye[index].netID);
|
||||
|
|
@ -1874,6 +1845,44 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (i < NetItem.MaxInventory - NetItem.MiscEquipSlots)
|
||||
{
|
||||
//89-93
|
||||
Item item = new Item();
|
||||
var index = i - (NetItem.MaxInventory - (NetItem.MiscDyeSlots + NetItem.MiscEquipSlots));
|
||||
if (miscEquips[index] != null && miscEquips[index].netID != 0)
|
||||
{
|
||||
item.netDefaults(miscEquips[index].netID);
|
||||
item.Prefix(miscEquips[index].prefix);
|
||||
item.AffixName();
|
||||
if (miscEquips[index].stack > item.maxStack)
|
||||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove item {0} ({1}) and then rejoin", item.name, dye[index].stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//93-98
|
||||
Item item = new Item();
|
||||
var index = i - (NetItem.MaxInventory - NetItem.MiscDyeSlots);
|
||||
if (miscDyes[index] != null && miscDyes[index].netID != 0)
|
||||
{
|
||||
item.netDefaults(miscDyes[index].netID);
|
||||
item.Prefix(miscDyes[index].prefix);
|
||||
item.AffixName();
|
||||
if (miscDyes[index].stack > item.maxStack)
|
||||
{
|
||||
check = true;
|
||||
player.SendMessage(
|
||||
String.Format("Stack cheat detected. Remove item dye {0} ({1}) and then rejoin", item.name, dye[index].stack),
|
||||
Color.Cyan);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return check;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue