TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ TrySyncingMyPlayer()

static void Terraria.Main.TrySyncingMyPlayer ( )
inlinestaticprivate

Definition at line 17038 of file Main.cs.

17039 {
17040 //IL_0811: Unknown result type (might be due to invalid IL or missing references)
17041 //IL_0817: Unknown result type (might be due to invalid IL or missing references)
17043 bool syncedAnyInventoryContents = false;
17044 for (int i = 0; i < 59; i++)
17045 {
17046 if (Main.player[myPlayer].inventory[i].IsNetStateDifferent(player.inventory[i]))
17047 {
17049 NetMessage.SendData(5, -1, -1, null, myPlayer, PlayerItemSlotID.Inventory0 + i, Main.player[myPlayer].inventory[i].prefix);
17050 }
17051 }
17058 if (Main.player[myPlayer].trashItem.IsNetStateDifferent(player.trashItem))
17059 {
17061 NetMessage.SendData(5, -1, -1, null, myPlayer, PlayerItemSlotID.TrashItem, Main.player[myPlayer].trashItem.prefix);
17062 }
17071 if (Main.player[myPlayer].chest != player.chest && Main.player[myPlayer].chest < 0 && player.chest >= 0)
17072 {
17073 if (Main.player[myPlayer].editedChestName)
17074 {
17075 if (chest[player.chest] != null)
17076 {
17077 NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(chest[player.chest].name), Main.player[myPlayer].chest, 1f);
17078 }
17079 else
17080 {
17081 NetMessage.SendData(33, -1, -1, null, Main.player[myPlayer].chest);
17082 }
17083 Main.player[myPlayer].editedChestName = false;
17084 }
17085 else
17086 {
17087 NetMessage.SendData(33, -1, -1, null, Main.player[myPlayer].chest);
17088 }
17089 }
17090 if (Main.player[myPlayer].talkNPC != player.talkNPC)
17091 {
17092 NetMessage.SendData(40, -1, -1, null, myPlayer);
17093 }
17094 if ((Main.player[myPlayer].voidLensChest != player.voidLensChest) | (Main.player[myPlayer].piggyBankProjTracker != player.piggyBankProjTracker))
17095 {
17096 NetMessage.SendData(142, -1, -1, null, myPlayer);
17097 }
17098 if (LocalPlayer.tileEntityAnchor.interactEntityID != player.tileEntityAnchor.interactEntityID && LocalPlayer.tileEntityAnchor.interactEntityID < 0)
17099 {
17100 NetMessage.SendData(122, -1, -1, null, -1, myPlayer);
17101 }
17102 bool flag = false;
17103 if ((byte)Main.player[myPlayer].zone1 != (byte)player.zone1)
17104 {
17105 flag = true;
17106 }
17107 if ((byte)Main.player[myPlayer].zone2 != (byte)player.zone2)
17108 {
17109 flag = true;
17110 }
17111 if ((byte)Main.player[myPlayer].zone3 != (byte)player.zone3)
17112 {
17113 flag = true;
17114 }
17115 if ((byte)Main.player[myPlayer].zone4 != (byte)player.zone4)
17116 {
17117 flag = true;
17118 }
17119 if ((byte)Main.player[myPlayer].zone5 != (byte)player.zone5)
17120 {
17121 flag = true;
17122 }
17124 {
17125 flag = true;
17126 }
17127 if (flag)
17128 {
17129 NetMessage.SendData(36, -1, -1, null, myPlayer);
17130 }
17131 if (Main.player[myPlayer].statLife != player.statLife || Main.player[myPlayer].statLifeMax != player.statLifeMax)
17132 {
17133 Main.player[myPlayer].netLife = true;
17134 }
17135 if (Main.player[myPlayer].netLifeTime > 0)
17136 {
17137 Main.player[myPlayer].netLifeTime--;
17138 }
17139 else if (Main.player[myPlayer].netLife)
17140 {
17141 Main.player[myPlayer].netLife = false;
17142 Main.player[myPlayer].netLifeTime = 60;
17143 NetMessage.SendData(16, -1, -1, null, myPlayer);
17144 }
17145 if (Main.player[myPlayer].statMana != player.statMana || Main.player[myPlayer].statManaMax != player.statManaMax)
17146 {
17147 Main.player[myPlayer].netMana = true;
17148 }
17149 if (Main.player[myPlayer].netManaTime > 0)
17150 {
17151 Main.player[myPlayer].netManaTime--;
17152 }
17153 else if (Main.player[myPlayer].netMana)
17154 {
17155 Main.player[myPlayer].netMana = false;
17156 Main.player[myPlayer].netManaTime = 60;
17157 NetMessage.SendData(42, -1, -1, null, myPlayer);
17158 }
17159 bool flag2 = false;
17160 for (int j = 0; j < Player.maxBuffs; j++)
17161 {
17162 if (Main.player[myPlayer].buffType[j] != player.buffType[j])
17163 {
17164 flag2 = true;
17165 break;
17166 }
17167 }
17168 if (flag2)
17169 {
17170 NetMessage.SendData(50, -1, -1, null, myPlayer);
17171 NetMessage.SendData(13, -1, -1, null, myPlayer);
17172 }
17173 bool flag3 = false;
17174 if (Main.player[myPlayer].MinionRestTargetPoint != player.MinionRestTargetPoint)
17175 {
17176 flag3 = true;
17177 }
17178 if (flag3)
17179 {
17180 NetMessage.SendData(99, -1, -1, null, myPlayer);
17181 }
17182 bool flag4 = false;
17183 if (Main.player[myPlayer].MinionAttackTargetNPC != player.MinionAttackTargetNPC)
17184 {
17185 flag4 = true;
17186 }
17187 if (flag4)
17188 {
17189 NetMessage.SendData(115, -1, -1, null, myPlayer);
17190 }
17191 if (player.shieldRaised != Main.player[myPlayer].shieldRaised)
17192 {
17193 NetMessage.SendData(13, -1, -1, null, myPlayer);
17194 }
17196 {
17197 NetMessage.SendData(138);
17198 }
17200 clientPlayer = Main.player[myPlayer].clientClone();
17201 }
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)
Creates a NetworkText object from a string. Use this for text that can't be localized.
Represents text that will be sent over the network in multiplayer and displayed to the receiving user...
static void TrySyncingItemArray(ref bool syncedAnyInventoryContents, Item[] my, Item[] other, int slotOffset)
Definition Main.cs:17203
static Chest[] chest
Definition Main.cs:1844
static int myPlayer
The index in F:Terraria.Main.player of this client's Player. If this is 255, this client is the ser...
Definition Main.cs:1958
static Player clientPlayer
Used internally for network syncing. Use P:Terraria.Main.LocalPlayer to access the player for the loc...
Definition Main.cs:2167
static Player LocalPlayer
Retrieves the T:Terraria.Player object for the local user. Shorthand for F:Terraria....
Definition Main.cs:3001
static Player[] player
Definition Main.cs:1960
static bool CustomBiomesMatch(Player player, Player other)
static void SendClientChanges(Player player, Player clientPlayer)
This is where all ModPlayer hooks are gathered and called.

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.ModLoader.BiomeLoader.CustomBiomesMatch(), Terraria.ID.PlayerItemSlotID.Dye0, Terraria.Localization.NetworkText.FromLiteral(), 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.ModLoader.PlayerLoader.SendClientChanges(), Terraria.NetMessage.SendData(), Terraria.ID.PlayerItemSlotID.TrashItem, and Terraria.Main.TrySyncingItemArray().

Referenced by Terraria.Main.DoUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: