public override void HandlePacket(BinaryReader reader, int whoAmI) { PacketMessageType message = (PacketMessageType)reader.ReadByte(); byte player = reader.ReadByte(); MagicalPlayer modPlayer = Main.player[player].GetModPlayer <MagicalPlayer>(); switch (message) { case PacketMessageType.All: modPlayer.EquipShoeSlot.Item = ItemIO.Receive(reader); modPlayer.VanityShoeSlot.Item = ItemIO.Receive(reader); modPlayer.ShoeDyeSlot.Item = ItemIO.Receive(reader); if (Main.netMode == NetmodeID.Server) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.All); packet.Write(player); ItemIO.Send(modPlayer.EquipShoeSlot.Item, packet); ItemIO.Send(modPlayer.VanityShoeSlot.Item, packet); ItemIO.Send(modPlayer.ShoeDyeSlot.Item, packet); packet.Send(-1, whoAmI); } break; case PacketMessageType.EquipShoeSlot: modPlayer.EquipShoeSlot.Item = ItemIO.Receive(reader); if (Main.netMode == NetmodeID.Server) { modPlayer.SendSingleItemPacket(PacketMessageType.EquipShoeSlot, modPlayer.EquipShoeSlot.Item, -1, whoAmI); } break; case PacketMessageType.VanityShoeSlot: modPlayer.VanityShoeSlot.Item = ItemIO.Receive(reader); if (Main.netMode == NetmodeID.Server) { modPlayer.SendSingleItemPacket(PacketMessageType.VanityShoeSlot, modPlayer.VanityShoeSlot.Item, -1, whoAmI); } break; case PacketMessageType.ShoeDyeSlot: modPlayer.ShoeDyeSlot.Item = ItemIO.Receive(reader); if (Main.netMode == NetmodeID.Server) { modPlayer.SendSingleItemPacket(PacketMessageType.ShoeDyeSlot, modPlayer.ShoeDyeSlot.Item, -1, whoAmI); } break; default: Logger.InfoFormat("Magical Things: Unknown message type: ", DisplayName); //ErrorLogger.Log("Magical Things: Unknown message type: " + message); break; } }
private void SendClientRawDataResponse( ClientConnection clientConnection, ClientRequest clientRequest, PacketMessageType messageType, byte[] data, int part) { PacketMessage message = new PacketMessage(messageType, part, data); ClientResponse clientResponse = new ClientResponse(clientRequest.Id, message); clientConnection.SendResponse(clientResponse); }
public override void HandlePacket(BinaryReader reader, int whoAmI) { PacketMessageType message = (PacketMessageType)reader.ReadByte(); byte player = reader.ReadByte(); WingSlotPlayer modPlayer = Main.player[player].GetModPlayer <WingSlotPlayer>(); switch (message) { case PacketMessageType.All: modPlayer.EquipSlot.Item = ItemIO.Receive(reader); modPlayer.VanitySlot.Item = ItemIO.Receive(reader); modPlayer.DyeSlot.Item = ItemIO.Receive(reader); if (Main.netMode == 2) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.All); packet.Write(player); ItemIO.Send(modPlayer.EquipSlot.Item, packet); ItemIO.Send(modPlayer.VanitySlot.Item, packet); ItemIO.Send(modPlayer.DyeSlot.Item, packet); packet.Send(-1, whoAmI); } break; case PacketMessageType.EquipSlot: modPlayer.EquipSlot.Item = ItemIO.Receive(reader); if (Main.netMode == 2) { modPlayer.SendSingleItemPacket(PacketMessageType.EquipSlot, modPlayer.EquipSlot.Item, -1, whoAmI); } break; case PacketMessageType.VanitySlot: modPlayer.VanitySlot.Item = ItemIO.Receive(reader); if (Main.netMode == 2) { modPlayer.SendSingleItemPacket(PacketMessageType.VanitySlot, modPlayer.VanitySlot.Item, -1, whoAmI); } break; case PacketMessageType.DyeSlot: modPlayer.DyeSlot.Item = ItemIO.Receive(reader); if (Main.netMode == 2) { modPlayer.SendSingleItemPacket(PacketMessageType.DyeSlot, modPlayer.DyeSlot.Item, -1, whoAmI); } break; default: Logger.InfoFormat("[Wing Slot] Unknown message type: {0}", message); break; } }
public override void HandlePacket(BinaryReader reader, int whoAmI) { PacketMessageType msgType = (PacketMessageType)reader.ReadByte(); Player player; PlayerAssist modPlayer; switch (msgType) { // Sent from Client to Server case PacketMessageType.RequestHideBoss: //if (Main.netMode == NetmodeID.MultiplayerClient) //{ // Main.NewText("Huh? RequestHideBoss on client?"); //} string bossKey = reader.ReadString(); bool hide = reader.ReadBoolean(); if (hide) { WorldAssist.HiddenBosses.Add(bossKey); } else { WorldAssist.HiddenBosses.Remove(bossKey); } if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(MessageID.WorldData); } //else // ErrorLogger.Log("BossChecklist: Why is RequestHideBoss on Client/SP?"); break; case PacketMessageType.RequestClearHidden: //if (Main.netMode == NetmodeID.MultiplayerClient) //{ // Main.NewText("Huh? RequestClearHidden on client?"); //} WorldAssist.HiddenBosses.Clear(); if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(MessageID.WorldData); } //else // ErrorLogger.Log("BossChecklist: Why is RequestHideBoss on Client/SP?"); break; case PacketMessageType.SendRecordsToServer: player = Main.player[whoAmI]; Console.WriteLine($"Receiving boss records from the joined player {player.name}!"); for (int i = 0; i < bossTracker.SortedBosses.Count; i++) { BossStats bossStats = ServerCollectedRecords[whoAmI][i]; bossStats.kills = reader.ReadInt32(); bossStats.deaths = reader.ReadInt32(); bossStats.durationBest = reader.ReadInt32(); bossStats.durationPrev = reader.ReadInt32(); bossStats.healthLossBest = reader.ReadInt32(); bossStats.healthLossPrev = reader.ReadInt32(); bossStats.hitsTakenBest = reader.ReadInt32(); bossStats.hitsTakenPrev = reader.ReadInt32(); bossStats.dodgeTimeBest = reader.ReadInt32(); //Console.WriteLine($"Establishing {player.name}'s records for {bossTracker.SortedBosses[i].name} to the server"); } break; case PacketMessageType.RecordUpdate: player = Main.LocalPlayer; modPlayer = player.GetModPlayer <PlayerAssist>(); //Server just sent us information about what boss just got killed and its records shall be updated //Since we did packet.Send(toClient: i);, you can use LocalPlayer here int npcPos = reader.ReadInt32(); BossStats specificRecord = modPlayer.AllBossRecords[npcPos].stat; // Get the Player's records specificRecord.NetRecieve(reader, player, npcPos); // The records will be updated through the reader (player and npcPos needed for new record) //Update the serverrecords too so they can be used later // TODO? send it as a single entry? ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.SendRecordsToServer); for (int i = 0; i < bossTracker.SortedBosses.Count; i++) { BossStats stat = modPlayer.AllBossRecords[i].stat; packet.Write(stat.kills); packet.Write(stat.deaths); packet.Write(stat.durationBest); packet.Write(stat.durationPrev); packet.Write(stat.hitsTakenBest); packet.Write(stat.hitsTakenPrev); packet.Write(stat.dodgeTimeBest); packet.Write(stat.healthLossBest); packet.Write(stat.healthLossPrev); } packet.Send(); // To server (ORDER MATTERS FOR reader) break; case (PacketMessageType.WorldRecordUpdate): npcPos = reader.ReadInt32(); WorldStats worldRecords = WorldAssist.worldRecords[npcPos].stat; // Get the Player's records worldRecords.NetRecieve(reader); // The records will be updated through the reader (player and npcPos needed for new record) break; default: Logger.Error("Unknown Message type: " + msgType); break; } }
public override void HandlePacket(BinaryReader reader, int whoAmI) { byte playerNumber; GradiusModPlayer modPlayer; PacketMessageType msgType = (PacketMessageType)reader.ReadByte(); switch (msgType) { case PacketMessageType.GradiusModSyncPlayer: playerNumber = reader.ReadByte(); modPlayer = Main.player[playerNumber].GetModPlayer <GradiusModPlayer>(); modPlayer.isFreezing = reader.ReadBoolean(); modPlayer.rotateMode = reader.ReadInt32(); modPlayer.revolveDirection = reader.ReadInt32(); modPlayer.wasHolding = reader.ReadBoolean(); modPlayer.forceBase = reader.ReadBoolean(); modPlayer.needleForce = reader.ReadBoolean(); modPlayer.optionOne = reader.ReadBoolean(); modPlayer.optionTwo = reader.ReadBoolean(); modPlayer.optionThree = reader.ReadBoolean(); modPlayer.optionFour = reader.ReadBoolean(); modPlayer.normalOption = reader.ReadBoolean(); modPlayer.freezeOption = reader.ReadBoolean(); modPlayer.rotateOption = reader.ReadBoolean(); int listCount = reader.ReadInt32(); for (int i = 0; i < listCount; i++) { modPlayer.optionFlightPath.Add(reader.ReadVector2()); } break; case PacketMessageType.ClientChangesFreezeOption: playerNumber = reader.ReadByte(); modPlayer = Main.player[playerNumber].GetModPlayer <GradiusModPlayer>(); modPlayer.isFreezing = reader.ReadBoolean(); if (Main.netMode == NetmodeID.Server) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesFreezeOption); packet.Write(playerNumber); packet.Write(modPlayer.isFreezing); packet.Send(-1, playerNumber); } break; case PacketMessageType.ClientChangesRotateOption: playerNumber = reader.ReadByte(); modPlayer = Main.player[playerNumber].GetModPlayer <GradiusModPlayer>(); modPlayer.rotateMode = reader.ReadInt32(); modPlayer.revolveDirection = reader.ReadInt32(); if (Main.netMode == NetmodeID.Server) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesRotateOption); packet.Write(playerNumber); packet.Write(modPlayer.rotateMode); packet.Write(modPlayer.revolveDirection); packet.Write(modPlayer.wasHolding); packet.Send(-1, playerNumber); } break; } }
public PacketMessage(PacketMessageType type, int part, byte[] data) { Type = type; Part = part; Data = data; }
public override void HandlePacket(BinaryReader reader, int whoAmI) { PacketMessageType msgType = (PacketMessageType)reader.ReadByte(); switch (msgType) { case PacketMessageType.GradiusModSyncPlayer: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).isFreezing = reader.ReadBoolean(); GradiusPlayer(playerIndex).rotateMode = reader.ReadInt32(); GradiusPlayer(playerIndex).revolveDirection = reader.ReadSByte(); GradiusPlayer(playerIndex).wasHolding = reader.ReadBoolean(); GradiusPlayer(playerIndex).forceBase = reader.ReadBoolean(); GradiusPlayer(playerIndex).needleForce = reader.ReadBoolean(); GradiusPlayer(playerIndex).optionOne = reader.ReadBoolean(); GradiusPlayer(playerIndex).optionTwo = reader.ReadBoolean(); GradiusPlayer(playerIndex).optionThree = reader.ReadBoolean(); GradiusPlayer(playerIndex).optionFour = reader.ReadBoolean(); GradiusPlayer(playerIndex).normalOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).freezeOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).rotateOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).optionSeed = reader.ReadBoolean(); GradiusPlayer(playerIndex).seedRotateDirection = reader.ReadSByte(); GradiusPlayer(playerIndex).chargeMultiple = reader.ReadBoolean(); GradiusPlayer(playerIndex).chargeMode = reader.ReadInt32(); GradiusPlayer(playerIndex).aimOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).searchOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).isSearching = reader.ReadBoolean(); GradiusPlayer(playerIndex).recurveOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).spreadOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).turretOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).isTurreting = reader.ReadBoolean(); break; } case PacketMessageType.ClientChangesFreezeOption: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).isFreezing = reader.ReadBoolean(); GradiusPlayer(playerIndex).wasHolding = reader.ReadBoolean(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesFreezeOption); packet.Write(playerIndex); packet.Write(GradiusPlayer(playerIndex).isFreezing); packet.Write(GradiusPlayer(playerIndex).wasHolding); packet.Send(-1, playerIndex); } break; } case PacketMessageType.ClientChangesRotateOption: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).rotateMode = reader.ReadInt32(); GradiusPlayer(playerIndex).revolveDirection = reader.ReadSByte(); GradiusPlayer(playerIndex).wasHolding = reader.ReadBoolean(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesRotateOption); packet.Write(playerIndex); packet.Write(GradiusPlayer(playerIndex).rotateMode); packet.Write(GradiusPlayer(playerIndex).revolveDirection); packet.Write(GradiusPlayer(playerIndex).wasHolding); packet.Send(-1, playerIndex); } break; } case PacketMessageType.ClientChangesSeedDirection: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).seedRotateDirection = reader.ReadSByte(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesSeedDirection); packet.Write(playerIndex); packet.Write(GradiusPlayer(playerIndex).seedRotateDirection); packet.Send(-1, playerIndex); } break; } case PacketMessageType.ClientChangesChargeMultiple: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).chargeMode = reader.ReadInt32(); GradiusPlayer(playerIndex).wasHolding = reader.ReadBoolean(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesChargeMultiple); packet.Write(playerIndex); packet.Write(GradiusPlayer(playerIndex).chargeMode); packet.Write(GradiusPlayer(playerIndex).wasHolding); packet.Send(-1, playerIndex); } break; } case PacketMessageType.SpawnRetaliationBullet: if (IsServer()) { Vector2 spawnPoint = reader.ReadVector2(); Vector2 spawnVelocity = reader.ReadVector2(); int dmg = reader.ReadInt32(); float kb = reader.ReadSingle(); Projectile.NewProjectile(spawnPoint, spawnVelocity, ModContent.ProjectileType <BacterionBullet>(), dmg, kb, Main.myPlayer); } break; case PacketMessageType.ClientChangesSearchOption: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).isSearching = reader.ReadBoolean(); GradiusPlayer(playerIndex).wasHolding = reader.ReadBoolean(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesSearchOption); packet.Write(playerIndex); packet.Write(GradiusPlayer(playerIndex).isSearching); packet.Write(GradiusPlayer(playerIndex).wasHolding); packet.Send(-1, playerIndex); } break; } case PacketMessageType.BroadcastSound: SoundPacketType soundPacketType = (SoundPacketType)reader.ReadByte(); switch (soundPacketType) { case SoundPacketType.Vanilla: { ushort soundType = reader.ReadUInt16(); Vector2 soundPosition = reader.ReadVector2(); byte soundStyle = reader.ReadByte(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.BroadcastSound); packet.Write((byte)SoundPacketType.Vanilla); packet.Write(soundType); packet.WriteVector2(soundPosition); packet.Write(soundStyle); packet.Send(); } else { Main.PlaySound(soundType, soundPosition, soundStyle); } break; } case SoundPacketType.Legacy: { string customSound = reader.ReadString(); Vector2 soundPosition = reader.ReadVector2(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.BroadcastSound); packet.Write((byte)SoundPacketType.Legacy); packet.Write(customSound); packet.WriteVector2(soundPosition); packet.Send(); } else { Main.PlaySound(GetLegacySoundSlot(SoundType.Custom, customSound), soundPosition); } break; } } break; case PacketMessageType.SpawnBoss: Vector2 initialPosition = reader.ReadVector2(); if (IsServer()) { Vector2 target = reader.ReadVector2(); int npcType = reader.ReadInt32(); bool center = reader.ReadBoolean(); int npcIndex = NewNPC(target.X, target.Y, npcType, center: center); NPC npc = Main.npc[npcIndex]; NetMessage.BroadcastChatMessage(NetworkText.FromKey(Language.GetTextValue("Announcement.HasAwoken", npc.GivenOrTypeName)), new Color(175, 75, 255)); ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.BroadcastSound); packet.Write((byte)SoundPacketType.Vanilla); packet.Write((ushort)SoundID.Roar); packet.WriteVector2(initialPosition); packet.Write((byte)0); packet.Send(); } break; case PacketMessageType.RecurveUpdatePositions: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).PopulateOptionFlight(); GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval - 1] = reader.ReadVector2(); GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 2 - 1] = reader.ReadVector2(); GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 3 - 1] = reader.ReadVector2(); GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 4 - 1] = reader.ReadVector2(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.RecurveUpdatePositions); packet.Write(playerIndex); packet.WriteVector2( GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval - 1] ); packet.WriteVector2( GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 2 - 1] ); packet.WriteVector2( GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 3 - 1] ); packet.WriteVector2( GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 4 - 1] ); packet.Send(-1, playerIndex); } break; } case PacketMessageType.ClientChangesTurretOption: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).isTurreting = reader.ReadBoolean(); GradiusPlayer(playerIndex).wasHolding = reader.ReadBoolean(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesFreezeOption); packet.Write(playerIndex); packet.Write(GradiusPlayer(playerIndex).isFreezing); packet.Write(GradiusPlayer(playerIndex).wasHolding); packet.Send(-1, playerIndex); } break; } } }
public override void HandlePacket(BinaryReader reader, int whoAmI) { PacketMessageType msgType = (PacketMessageType)reader.ReadByte(); switch (msgType) { case PacketMessageType.GradiusModSyncPlayer: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).isFreezing = reader.ReadBoolean(); GradiusPlayer(playerIndex).rotateMode = reader.ReadInt32(); GradiusPlayer(playerIndex).revolveDirection = reader.ReadSByte(); GradiusPlayer(playerIndex).wasHolding = reader.ReadBoolean(); GradiusPlayer(playerIndex).forceBase = reader.ReadBoolean(); GradiusPlayer(playerIndex).needleForce = reader.ReadBoolean(); GradiusPlayer(playerIndex).optionOne = reader.ReadBoolean(); GradiusPlayer(playerIndex).optionTwo = reader.ReadBoolean(); GradiusPlayer(playerIndex).optionThree = reader.ReadBoolean(); GradiusPlayer(playerIndex).optionFour = reader.ReadBoolean(); GradiusPlayer(playerIndex).normalOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).freezeOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).rotateOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).optionSeed = reader.ReadBoolean(); GradiusPlayer(playerIndex).seedRotateDirection = reader.ReadSByte(); GradiusPlayer(playerIndex).chargeMultiple = reader.ReadBoolean(); GradiusPlayer(playerIndex).chargeMode = reader.ReadInt32(); GradiusPlayer(playerIndex).aimOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).searchOption = reader.ReadBoolean(); GradiusPlayer(playerIndex).isSearching = reader.ReadBoolean(); GradiusPlayer(playerIndex).recurveOption = reader.ReadBoolean(); break; } case PacketMessageType.ClientChangesFreezeOption: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).isFreezing = reader.ReadBoolean(); GradiusPlayer(playerIndex).wasHolding = reader.ReadBoolean(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesFreezeOption); packet.Write(playerIndex); packet.Write(GradiusPlayer(playerIndex).isFreezing); packet.Write(GradiusPlayer(playerIndex).wasHolding); packet.Send(-1, playerIndex); } break; } case PacketMessageType.ClientChangesRotateOption: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).rotateMode = reader.ReadInt32(); GradiusPlayer(playerIndex).revolveDirection = reader.ReadSByte(); GradiusPlayer(playerIndex).wasHolding = reader.ReadBoolean(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesRotateOption); packet.Write(playerIndex); packet.Write(GradiusPlayer(playerIndex).rotateMode); packet.Write(GradiusPlayer(playerIndex).revolveDirection); packet.Write(GradiusPlayer(playerIndex).wasHolding); packet.Send(-1, playerIndex); } break; } case PacketMessageType.ClientChangesSeedDirection: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).seedRotateDirection = reader.ReadSByte(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesSeedDirection); packet.Write(playerIndex); packet.Write(GradiusPlayer(playerIndex).seedRotateDirection); packet.Send(-1, playerIndex); } break; } case PacketMessageType.ClientChangesChargeMultiple: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).chargeMode = reader.ReadInt32(); GradiusPlayer(playerIndex).wasHolding = reader.ReadBoolean(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesChargeMultiple); packet.Write(playerIndex); packet.Write(GradiusPlayer(playerIndex).chargeMode); packet.Write(GradiusPlayer(playerIndex).wasHolding); packet.Send(-1, playerIndex); } break; } case PacketMessageType.SpawnRetaliationBullet: if (IsServer()) { Vector2 spawnPoint = reader.ReadVector2(); Vector2 spawnVelocity = reader.ReadVector2(); int dmg = reader.ReadInt32(); float kb = reader.ReadSingle(); Projectile.NewProjectile(spawnPoint, spawnVelocity, ModContent.ProjectileType <BacterionBullet>(), dmg, kb, Main.myPlayer); } break; case PacketMessageType.ClientChangesSearchOption: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).isSearching = reader.ReadBoolean(); GradiusPlayer(playerIndex).wasHolding = reader.ReadBoolean(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.ClientChangesSearchOption); packet.Write(playerIndex); packet.Write(GradiusPlayer(playerIndex).isSearching); packet.Write(GradiusPlayer(playerIndex).wasHolding); packet.Send(-1, playerIndex); } break; } case PacketMessageType.BroadcastSound: ushort soundType = reader.ReadUInt16(); Vector2 soundPosition = reader.ReadVector2(); byte soundStyle = reader.ReadByte(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.BroadcastSound); packet.Write(soundType); packet.WriteVector2(soundPosition); packet.Write(soundStyle); packet.Send(-1, whoAmI); } else { Main.PlaySound(soundType, soundPosition, soundStyle); } break; case PacketMessageType.RecurveUpdatePositions: { byte playerIndex = reader.ReadByte(); GradiusPlayer(playerIndex).PopulateOptionFlight(); GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval - 1] = reader.ReadVector2(); GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 2 - 1] = reader.ReadVector2(); GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 3 - 1] = reader.ReadVector2(); GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 4 - 1] = reader.ReadVector2(); if (IsServer()) { ModPacket packet = GetPacket(); packet.Write((byte)PacketMessageType.RecurveUpdatePositions); packet.Write(playerIndex); packet.WriteVector2( GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval - 1] ); packet.WriteVector2( GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 2 - 1] ); packet.WriteVector2( GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 3 - 1] ); packet.WriteVector2( GradiusPlayer(playerIndex).optionFlightPath[OptionBaseObject.DistanceInterval * 4 - 1] ); packet.Send(-1, playerIndex); } break; } } }