public PBEBattle(PBEBattlePacket packet) { BattleFormat = packet.BattleFormat; BattleTerrain = packet.BattleTerrain; Weather = packet.Weather; Settings = packet.Settings; Teams = new PBETeams(this, packet, out ReadOnlyCollection <PBETrainer> trainers); Trainers = trainers; }
// Remote battle internal PBETeams(PBEBattle battle, PBEBattlePacket packet, out ReadOnlyCollection <PBETrainer> trainers) { var allTrainers = new List <PBETrainer>(); _team0 = new PBETeam(battle, packet.Teams[0], allTrainers); _team1 = new PBETeam(battle, packet.Teams[1], allTrainers); _team0.OpposingTeam = _team1; _team1.OpposingTeam = _team0; trainers = new ReadOnlyCollection <PBETrainer>(allTrainers); }
public NetworkClient(PBEClient client, PBEBattlePacket bp, byte battleId, string name) : base(name) { var b = new PBEBattle(bp); Battle = b; if (battleId != byte.MaxValue) { Trainer = b.Trainers[battleId]; } BattleView = new BattleView(this); client.Battle = b; _client = client; client.Disconnected += OnDisconnected; client.Error += OnError; client.PacketReceived += OnPacketReceived; Send(new PBEResponsePacket()); }