public static void HandleData(GetDataEventArgs args, MemoryStream data, PvPPlayer player) { switch (args.MsgID) { case PacketTypes.PlayerHurtV2: PlayerHurt?.Invoke(typeof(DataHandler), new PlayerHurtArgs(args, data, player)); return; case PacketTypes.TogglePvp: PvPToggled?.Invoke(typeof(DataHandler), new TogglePvPArgs(player)); return; case PacketTypes.PlayerSlot: PlayerSlotUpdated?.Invoke(typeof(DataHandler), new PlayerSlotArgs(data, player)); return; case PacketTypes.PlayerDeathV2: PlayerDied?.Invoke(typeof(DataHandler), new PlayerDeathArgs(player)); return; case PacketTypes.ProjectileNew: ProjectileNew?.Invoke(typeof(DataHandler), new ProjectileNewArgs(args, data, player)); return; case PacketTypes.ProjectileDestroy: ProjectileDestroyed?.Invoke(typeof(DataHandler), new ProjectileDestroyArgs(data)); return; case PacketTypes.PlayerUpdate: PlayerUpdated?.Invoke(typeof(DataHandler), new PlayerUpdateArgs(data, player)); return; } }
public static void HandleData(GetDataEventArgs args, MemoryStream data, PvPPlayer player) { switch (args.MsgID) { case PacketTypes.PlayerHurtV2: if (new PlayerHurtArgs().ExtractData(args, data, player, out var playerhurt)) { PlayerHurt?.Invoke(typeof(DataHandler), playerhurt); } return; case PacketTypes.TogglePvp: if (new TogglePvPArgs().ExtractData(player, out var togglepvp)) { PvPToggled?.Invoke(typeof(DataHandler), togglepvp); } return; case PacketTypes.PlayerSlot: if (new PlayerSlotArgs().ExtractData(data, player, out var playerslot)) { SlotUpdate?.Invoke(typeof(DataHandler), playerslot); } return; case PacketTypes.PlayerDeathV2: if (new PlayerDeathArgs().ExtractData(player, out var playerdeath)) { PlayerDeath?.Invoke(typeof(DataHandler), playerdeath); } return; case PacketTypes.ProjectileNew: if (new ProjectileNewArgs().ExtractData(args, data, player, out var projectilenew)) { ProjectileNew?.Invoke(typeof(DataHandler), projectilenew); } return; case PacketTypes.ProjectileDestroy: if (new ProjectileDestroyArgs().ExtractData(data, out var projectiledestroy)) { ProjectileDestroyed?.Invoke(typeof(DataHandler), projectiledestroy); } return; case PacketTypes.PlayerUpdate: if (new PlayerUpdateArgs().ExtractData(data, player, out var playerupdate)) { PlayerUpdate?.Invoke(typeof(DataHandler), playerupdate); } return; } }