Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ TrySyncingMyPlayer()

static void Terraria.Main.TrySyncingMyPlayer ( )
inlinestaticprivate

Definition at line 16356 of file Main.cs.

16357 {
16359 bool syncedAnyInventoryContents = false;
16360 for (int i = 0; i < 59; i++)
16361 {
16362 if (Main.player[myPlayer].inventory[i].IsNotTheSameAs(player.inventory[i]))
16363 {
16365 NetMessage.SendData(5, -1, -1, null, myPlayer, PlayerItemSlotID.Inventory0 + i, (int)Main.player[myPlayer].inventory[i].prefix);
16366 }
16367 }
16374 if (Main.player[myPlayer].trashItem.IsNotTheSameAs(player.trashItem))
16375 {
16377 NetMessage.SendData(5, -1, -1, null, myPlayer, PlayerItemSlotID.TrashItem, (int)Main.player[myPlayer].trashItem.prefix);
16378 }
16387 if (Main.player[myPlayer].chest != player.chest && Main.player[myPlayer].chest < 0 && player.chest >= 0)
16388 {
16389 if (Main.player[myPlayer].editedChestName)
16390 {
16391 if (chest[player.chest] != null)
16392 {
16393 NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(chest[player.chest].name), Main.player[myPlayer].chest, 1f);
16394 }
16395 else
16396 {
16397 NetMessage.SendData(33, -1, -1, null, Main.player[myPlayer].chest);
16398 }
16399 Main.player[myPlayer].editedChestName = false;
16400 }
16401 else
16402 {
16403 NetMessage.SendData(33, -1, -1, null, Main.player[myPlayer].chest);
16404 }
16405 }
16406 if (Main.player[myPlayer].talkNPC != player.talkNPC)
16407 {
16408 NetMessage.SendData(40, -1, -1, null, myPlayer);
16409 }
16410 if (false | (Main.player[myPlayer].voidLensChest != player.voidLensChest) | (Main.player[myPlayer].piggyBankProjTracker != player.piggyBankProjTracker))
16411 {
16412 NetMessage.SendData(142, -1, -1, null, myPlayer);
16413 }
16414 if (LocalPlayer.tileEntityAnchor.interactEntityID != player.tileEntityAnchor.interactEntityID && LocalPlayer.tileEntityAnchor.interactEntityID < 0)
16415 {
16416 NetMessage.SendData(122, -1, -1, null, -1, myPlayer);
16417 }
16418 bool flag = false;
16419 if ((byte)Main.player[myPlayer].zone1 != (byte)player.zone1)
16420 {
16421 flag = true;
16422 }
16423 if ((byte)Main.player[myPlayer].zone2 != (byte)player.zone2)
16424 {
16425 flag = true;
16426 }
16427 if ((byte)Main.player[myPlayer].zone3 != (byte)player.zone3)
16428 {
16429 flag = true;
16430 }
16431 if ((byte)Main.player[myPlayer].zone4 != (byte)player.zone4)
16432 {
16433 flag = true;
16434 }
16435 if ((byte)Main.player[myPlayer].zone5 != (byte)player.zone5)
16436 {
16437 flag = true;
16438 }
16439 if (flag)
16440 {
16441 NetMessage.SendData(36, -1, -1, null, myPlayer);
16442 }
16443 if (Main.player[myPlayer].statLife != player.statLife || Main.player[myPlayer].statLifeMax != player.statLifeMax)
16444 {
16445 Main.player[myPlayer].netLife = true;
16446 }
16447 if (Main.player[myPlayer].netLifeTime > 0)
16448 {
16449 Main.player[myPlayer].netLifeTime--;
16450 }
16451 else if (Main.player[myPlayer].netLife)
16452 {
16453 Main.player[myPlayer].netLife = false;
16454 Main.player[myPlayer].netLifeTime = 60;
16455 NetMessage.SendData(16, -1, -1, null, myPlayer);
16456 }
16457 if (Main.player[myPlayer].statMana != player.statMana || Main.player[myPlayer].statManaMax != player.statManaMax)
16458 {
16459 Main.player[myPlayer].netMana = true;
16460 }
16461 if (Main.player[myPlayer].netManaTime > 0)
16462 {
16463 Main.player[myPlayer].netManaTime--;
16464 }
16465 else if (Main.player[myPlayer].netMana)
16466 {
16467 Main.player[myPlayer].netMana = false;
16468 Main.player[myPlayer].netManaTime = 60;
16469 NetMessage.SendData(42, -1, -1, null, myPlayer);
16470 }
16471 bool flag2 = false;
16472 for (int j = 0; j < Player.maxBuffs; j++)
16473 {
16474 if (Main.player[myPlayer].buffType[j] != player.buffType[j])
16475 {
16476 flag2 = true;
16477 break;
16478 }
16479 }
16480 if (flag2)
16481 {
16482 NetMessage.SendData(50, -1, -1, null, myPlayer);
16483 NetMessage.SendData(13, -1, -1, null, myPlayer);
16484 }
16485 bool flag3 = false;
16486 if (Main.player[myPlayer].MinionRestTargetPoint != player.MinionRestTargetPoint)
16487 {
16488 flag3 = true;
16489 }
16490 if (flag3)
16491 {
16492 NetMessage.SendData(99, -1, -1, null, myPlayer);
16493 }
16494 bool flag4 = false;
16495 if (Main.player[myPlayer].MinionAttackTargetNPC != player.MinionAttackTargetNPC)
16496 {
16497 flag4 = true;
16498 }
16499 if (flag4)
16500 {
16501 NetMessage.SendData(115, -1, -1, null, myPlayer);
16502 }
16503 if (player.shieldRaised != Main.player[myPlayer].shieldRaised)
16504 {
16505 NetMessage.SendData(13, -1, -1, null, myPlayer);
16506 }
16508 {
16509 NetMessage.SendData(138);
16510 }
16511 clientPlayer = Main.player[myPlayer].clientClone();
16512 }
static readonly int Loadout1_Armor_0
static readonly int Loadout3_Dye_0
static readonly int Loadout2_Dye_0
static readonly int Loadout1_Dye_0
static readonly int Loadout3_Armor_0
static readonly int Loadout2_Armor_0
static readonly int TrashItem
static readonly int Inventory0
static NetworkText FromLiteral(string text)
static void TrySyncingItemArray(ref bool syncedAnyInventoryContents, Item[] my, Item[] other, int slotOffset)
Definition Main.cs:16514
static Chest[] chest
Definition Main.cs:1699
static int myPlayer
Definition Main.cs:1801
static Player clientPlayer
Definition Main.cs:2085
static Player LocalPlayer
Definition Main.cs:2829
static Player[] player
Definition Main.cs:1803

References Terraria.ID.PlayerItemSlotID.Armor0, Terraria.ID.PlayerItemSlotID.Bank1_0, Terraria.ID.PlayerItemSlotID.Bank2_0, Terraria.ID.PlayerItemSlotID.Bank3_0, Terraria.ID.PlayerItemSlotID.Bank4_0, Terraria.Main.chest, Terraria.Main.clientPlayer, Terraria.ID.PlayerItemSlotID.Dye0, Terraria.Localization.NetworkText.FromLiteral(), System.Text.RegularExpressions.i, Terraria.ID.PlayerItemSlotID.Inventory0, Terraria.ID.PlayerItemSlotID.Loadout1_Armor_0, Terraria.ID.PlayerItemSlotID.Loadout1_Dye_0, Terraria.ID.PlayerItemSlotID.Loadout2_Armor_0, Terraria.ID.PlayerItemSlotID.Loadout2_Dye_0, Terraria.ID.PlayerItemSlotID.Loadout3_Armor_0, Terraria.ID.PlayerItemSlotID.Loadout3_Dye_0, Terraria.Main.LocalPlayer, Terraria.Player.maxBuffs, Terraria.ID.PlayerItemSlotID.Misc0, Terraria.ID.PlayerItemSlotID.MiscDye0, Terraria.Main.myPlayer, Terraria.Main.player, Terraria.NetMessage.SendData(), Terraria.ID.PlayerItemSlotID.TrashItem, and Terraria.Main.TrySyncingItemArray().

Referenced by Terraria.Main.DoUpdate().