private void OnDraw(CoreMessage msg) { GamePacketWriter packet = GamePacketFactory.Create(msg.Message); int player = msg.Reader.ReadByte(); int count = msg.Reader.ReadByte(); packet.Write((byte)player); packet.Write((byte)count); for (int i = 0; i < count; i++) { uint code = msg.Reader.ReadUInt32(); if ((code & 0x80000000) != 0) { packet.Write(code); } else { packet.Write(0); } } SendToPlayer(msg, player); Game.SendToAllBut(packet, player); }
private void OnMove(CoreMessage msg) { byte[] raw = msg.Reader.ReadBytes(16); int pc = raw[4]; int pl = raw[5]; int cc = raw[8]; int cl = raw[9]; int cs = raw[10]; int cp = raw[11]; SendToPlayer(msg, cc); GamePacketWriter packet = GamePacketFactory.Create(msg.Message); packet.Write(raw); if (!Convert.ToBoolean((cl & ((int)CardLocation.Grave + (int)CardLocation.Overlay))) && Convert.ToBoolean((cl & ((int)CardLocation.Deck + (int)CardLocation.Hand))) || Convert.ToBoolean((cp & (int)CardPosition.FaceDown))) { packet.SetPosition(2); packet.Write(0); } Game.SendToAllBut(packet, cc); if (cl != 0 && (cl & 0x80) == 0 && (cl != pl || pc != cc)) { Game.RefreshSingle(cc, cl, cs); } }
private void OnTagSwap(CoreMessage msg) { GamePacketWriter packet = GamePacketFactory.Create(GameMessage.TagSwap); int player = msg.Reader.ReadByte(); packet.Write((byte)player); packet.Write(msg.Reader.ReadByte()); // mcount int ecount = msg.Reader.ReadByte(); packet.Write((byte)ecount); packet.Write(msg.Reader.ReadByte()); // pcount int hcount = msg.Reader.ReadByte(); packet.Write((byte)hcount); packet.Write(msg.Reader.ReadBytes(4)); // topcode for (int i = 0; i < hcount + ecount; i++) { uint code = msg.Reader.ReadUInt32(); if ((code & 0x80000000) != 0) { packet.Write(code); } else { packet.Write(0); } } SendToPlayer(msg, player); Game.SendToAllBut(packet, player); Game.RefreshExtra(player); Game.RefreshMonsters(0, 0x81fff); Game.RefreshMonsters(1, 0x81fff); Game.RefreshSpells(0, 0x681fff); Game.RefreshSpells(1, 0x681fff); Game.RefreshHand(0, 0x181fff); Game.RefreshHand(1, 0x181fff); }
private void OnShuffleHand(CoreMessage msg) { GamePacketWriter packet = GamePacketFactory.Create(msg.Message); int player = msg.Reader.ReadByte(); int count = msg.Reader.ReadByte(); packet.Write((byte)player); packet.Write((byte)count); msg.Reader.ReadBytes(count * 4); for (int i = 0; i < count; i++) { packet.Write(0); } SendToPlayer(msg, player); Game.SendToAllBut(packet, player); Game.RefreshHand(player, 0x181fff); }
private void OnShuffleHand(CoreMessage msg) { GameServerPacket packet = new GameServerPacket(msg.Message); int player = msg.Reader.ReadByte(); int count = msg.Reader.ReadByte(); packet.Write((byte)player); packet.Write((byte)count); msg.Reader.ReadBytes(count * 4); for (int i = 0; i < count; i++) { packet.Write(0); } SendToPlayer(msg, player); Game.SendToAllBut(packet, player); Game.RefreshHand(player, 0x181fff, false); }
private void OnHint(CoreMessage msg) { int type = msg.Reader.ReadByte(); int player = msg.Reader.ReadByte(); msg.Reader.ReadInt32(); byte[] buffer = msg.CreateBuffer(); GamePacketWriter packet = GamePacketFactory.Create(msg.Message); packet.Write(buffer); switch (type) { case 1: case 2: case 3: case 4: case 5: Game.CurPlayers[player].Send(packet); break; case 6: case 7: case 8: case 9: Game.SendToAllBut(packet, player); break; case 10: if (Game.IsTag) { Game.CurPlayers[player].Send(packet); } else { Game.SendToAll(packet); } break; } }
private void OnTagSwap(CoreMessage msg) { GameServerPacket packet = new GameServerPacket(GameMessage.TagSwap); int player = msg.Reader.ReadByte(); packet.Write((byte)player); packet.Write(msg.Reader.ReadBytes(2)); int count = msg.Reader.ReadByte(); packet.Write((byte)count); packet.Write(msg.Reader.ReadBytes(4)); for (int i = 0; i < count; i++) { uint code = msg.Reader.ReadUInt32(); if ((code & 0x80000000) != 0) { packet.Write(code); } else { packet.Write(0); } } SendToPlayer(msg, player); Game.SendToAllBut(packet, player); Game.RefreshExtra(player); Game.RefreshMonsters(0, 0x81fff, false); Game.RefreshMonsters(1, 0x81fff, false); Game.RefreshSpells(0, 0x681fff, false); Game.RefreshSpells(1, 0x681fff, false); Game.RefreshHand(0, 0x181fff, false); Game.RefreshHand(1, 0x181fff, false); }