public static void BuildWalls(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGameDealer(state.Mobile)) return; game.ResetWalls(state.Mobile); }
public MahjongGeneralInfo( MahjongGame game ) : base(0xDA) { EnsureCapacity( 13 ); m_Stream.Write( (int) game.Serial ); m_Stream.Write( (byte) 0 ); m_Stream.Write( (byte) 0x5 ); m_Stream.Write( (short) 0 ); m_Stream.Write( (byte) 0 ); m_Stream.Write( (byte) ( ( game.ShowScores ? 0x1 : 0x0 ) | ( game.SpectatorVision ? 0x2 : 0x0 ) ) ); m_Stream.Write( (byte) game.Dices.First ); m_Stream.Write( (byte) game.Dices.Second ); m_Stream.Write( (byte) game.DealerIndicator.Wind ); m_Stream.Write( (short) game.DealerIndicator.Position.Y ); m_Stream.Write( (short) game.DealerIndicator.Position.X ); m_Stream.Write( (byte) game.DealerIndicator.Direction ); m_Stream.Write( (short) game.WallBreakIndicator.Position.Y ); m_Stream.Write( (short) game.WallBreakIndicator.Position.X ); }
public MahjongDealerIndicator( MahjongGame game, Point2D position, MahjongPieceDirection direction, MahjongWind wind ) { m_Game = game; m_Position = position; m_Direction = direction; m_Wind = wind; }
public MahjongJoinGame( MahjongGame game ) : base( 0xDA ) { EnsureCapacity( 9 ); m_Stream.Write( (int) game.Serial ); m_Stream.Write( (byte) 0 ); m_Stream.Write( (byte) 0x19 ); }
public MahjongWallBreakIndicator( MahjongGame game, GenericReader reader ) { m_Game = game; int version = reader.ReadInt(); m_Position = reader.ReadPoint2D(); }
public static void ExitGame(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null) return; Mobile from = state.Mobile; game.Players.LeaveGame(from); }
public static void AssignDealer(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGameDealer(state.Mobile)) return; int position = pvSrc.ReadByte(); game.Players.AssignDealer(position); }
public MahjongDices( MahjongGame game, GenericReader reader ) { m_Game = game; /*int version = */reader.ReadInt(); m_First = reader.ReadInt(); m_Second = reader.ReadInt(); }
public MahjongDices(MahjongGame game, GenericReader reader) { this.m_Game = game; int version = reader.ReadInt(); this.m_First = reader.ReadInt(); this.m_Second = reader.ReadInt(); }
public static void GivePoints(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGamePlayer(state.Mobile)) return; int to = pvSrc.ReadByte(); int amount = pvSrc.ReadInt32(); game.Players.TransferScore(state.Mobile, to, amount); }
public MahjongTile(MahjongGame game, int number, MahjongTileType value, Point2D position, int stackLevel, MahjongPieceDirection direction, bool flipped) { this.m_Game = game; this.m_Number = number; this.m_Value = value; this.m_Position = position; this.m_StackLevel = stackLevel; this.m_Direction = direction; this.m_Flipped = flipped; }
public MahjongDealerIndicator( MahjongGame game, GenericReader reader ) { m_Game = game; int version = reader.ReadInt(); m_Position = reader.ReadPoint2D(); m_Direction = (MahjongPieceDirection) reader.ReadInt(); m_Wind = (MahjongWind) reader.ReadInt(); }
public static void AssignDealer(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGameDealer(state.Mobile)) { return; } int position = pvSrc.ReadByte(); game.Players.AssignDealer(position); }
public static void ExitGame(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null) { return; } Mobile from = state.Mobile; game.Players.LeaveGame(from); }
public MahjongDealerIndicator(MahjongGame game, GenericReader reader) { m_Game = game; /*int version = */ reader.ReadInt(); m_Position = reader.ReadPoint2D(); m_Direction = (MahjongPieceDirection)reader.ReadInt(); m_Wind = (MahjongWind)reader.ReadInt(); }
public static void GivePoints(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGamePlayer(state.Mobile)) { return; } int to = pvSrc.ReadByte(); int amount = pvSrc.ReadInt32(); game.Players.TransferScore(state.Mobile, to, amount); }
public static void MoveWallBreakIndicator(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGameDealer(state.Mobile)) { return; } int y = pvSrc.ReadInt16(); int x = pvSrc.ReadInt16(); game.WallBreakIndicator.Move(new Point2D(x, y)); }
public MahjongTile(MahjongGame game, GenericReader reader) { this.m_Game = game; int version = reader.ReadInt(); this.m_Number = reader.ReadInt(); this.m_Value = (MahjongTileType)reader.ReadInt(); this.m_Position = reader.ReadPoint2D(); this.m_StackLevel = reader.ReadInt(); this.m_Direction = (MahjongPieceDirection)reader.ReadInt(); this.m_Flipped = reader.ReadBool(); }
public MahjongTile(MahjongGame game, GenericReader reader) { m_Game = game; int version = reader.ReadInt(); m_Number = reader.ReadInt(); m_Value = (MahjongTileType)reader.ReadInt(); m_Position = reader.ReadPoint2D(); m_StackLevel = reader.ReadInt(); m_Direction = (MahjongPieceDirection)reader.ReadInt(); m_Flipped = reader.ReadBool(); }
public static void ChangeOption(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGameDealer(state.Mobile)) return; pvSrc.ReadInt16(); pvSrc.ReadByte(); int options = pvSrc.ReadByte(); game.ShowScores = (options & 0x1) != 0; game.SpectatorVision = (options & 0x2) != 0; }
public MahjongPlayers(MahjongGame game, int maxPlayers, int baseScore) { m_Game = game; m_Spectators = new ArrayList(); m_Players = new Mobile[maxPlayers]; m_InGame = new bool[maxPlayers]; m_PublicHand = new bool[maxPlayers]; m_Scores = new int[maxPlayers]; for (int i = 0; i < m_Scores.Length; i++) m_Scores[i] = baseScore; }
public static void TogglePublicHand(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGamePlayer(state.Mobile)) { return; } pvSrc.ReadInt16(); pvSrc.ReadByte(); bool publicHand = pvSrc.ReadBoolean(); game.Players.SetPublic(game.Players.GetPlayerIndex(state.Mobile), publicHand); }
public MahjongPlayers(MahjongGame game, int maxPlayers, int baseScore) { m_Game = game; m_Spectators = new ArrayList(); m_Players = new Mobile[maxPlayers]; m_InGame = new bool[maxPlayers]; m_PublicHand = new bool[maxPlayers]; m_Scores = new int[maxPlayers]; for (int i = 0; i < m_Scores.Length; i++) { m_Scores[i] = baseScore; } }
public static void ChangeOption(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGameDealer(state.Mobile)) { return; } pvSrc.ReadInt16(); pvSrc.ReadByte(); int options = pvSrc.ReadByte(); game.ShowScores = (options & 0x1) != 0; game.SpectatorVision = (options & 0x2) != 0; }
public static void OpenSeat(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGameDealer(state.Mobile)) { return; } int position = pvSrc.ReadByte(); if (game.Players.GetPlayer(position) == state.Mobile) { return; } game.Players.OpenSeat(position); }
public static void MoveDealerIndicator(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGameDealer(state.Mobile)) { return; } MahjongPieceDirection direction = GetDirection(pvSrc.ReadByte()); MahjongWind wind = GetWind(pvSrc.ReadByte()); int y = pvSrc.ReadInt16(); int x = pvSrc.ReadInt16(); game.DealerIndicator.Move(new Point2D(x, y), direction, wind); }
public MahjongTilesInfo(MahjongGame game, Mobile to) : base(0xDA) { MahjongTile[] tiles = game.Tiles; MahjongPlayers players = game.Players; EnsureCapacity(11 + 9 * tiles.Length); m_Stream.Write(game.Serial); m_Stream.Write((byte)0); m_Stream.Write((byte)0x4); m_Stream.Write((short)tiles.Length); foreach (MahjongTile tile in tiles) { m_Stream.Write((byte)tile.Number); if (tile.Flipped) { int hand = tile.Dimensions.GetHandArea(); if (hand < 0 || players.IsPublic(hand) || players.GetPlayer(hand) == to || (game.SpectatorVision && players.IsSpectator(to))) { m_Stream.Write((byte)tile.Value); } else { m_Stream.Write((byte)0); } } else { m_Stream.Write((byte)0); } m_Stream.Write((short)tile.Position.Y); m_Stream.Write((short)tile.Position.X); m_Stream.Write((byte)tile.StackLevel); m_Stream.Write((byte)tile.Direction); m_Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0); } }
public static void OnPacket(NetState state, PacketReader pvSrc) { MahjongGame game = World.FindItem(pvSrc.ReadUInt32()) as MahjongGame; game?.Players.CheckPlayers(); pvSrc.ReadByte(); int cmd = pvSrc.ReadByte(); OnMahjongPacketReceive onReceive = GetSubCommandDelegate(cmd); if (onReceive != null) { onReceive(game, state, pvSrc); } else { pvSrc.Trace(state); } }
public MahjongPlayers(MahjongGame game, GenericReader reader) { this.m_Game = game; this.m_Spectators = new ArrayList(); int version = reader.ReadInt(); int seats = reader.ReadInt(); this.m_Players = new Mobile[seats]; this.m_InGame = new bool[seats]; this.m_PublicHand = new bool[seats]; this.m_Scores = new int[seats]; for (int i = 0; i < seats; i++) { this.m_Players[i] = reader.ReadMobile(); this.m_PublicHand[i] = reader.ReadBool(); this.m_Scores[i] = reader.ReadInt(); } this.m_DealerPosition = reader.ReadInt(); }
public MahjongTileInfo(MahjongTile tile, Mobile to) : base(0xDA) { MahjongGame game = tile.Game; MahjongPlayers players = game.Players; EnsureCapacity(18); Stream.Write(tile.Game.Serial); Stream.Write((byte)0); Stream.Write((byte)0x3); Stream.Write((byte)tile.Number); if (tile.Flipped) { int hand = tile.Dimensions.GetHandArea(); if (hand < 0 || players.IsPublic(hand) || players.GetPlayer(hand) == to || (game.SpectatorVision && players.IsSpectator(to))) { Stream.Write((byte)tile.Value); } else { Stream.Write((byte)0); } } else { Stream.Write((byte)0); } Stream.Write((short)tile.Position.Y); Stream.Write((short)tile.Position.X); Stream.Write((byte)tile.StackLevel); Stream.Write((byte)tile.Direction); Stream.Write(tile.Flipped ? (byte)0x10 : (byte)0x0); }
public MahjongPlayers(MahjongGame game, IGenericReader reader) { Game = game; m_Spectators = new List <Mobile>(); var version = reader.ReadInt(); var seats = reader.ReadInt(); m_Players = new Mobile[seats]; m_InGame = new bool[seats]; m_PublicHand = new bool[seats]; m_Scores = new int[seats]; for (var i = 0; i < seats; i++) { m_Players[i] = reader.ReadMobile(); m_PublicHand[i] = reader.ReadBool(); m_Scores[i] = reader.ReadInt(); } DealerPosition = reader.ReadInt(); }
public MahjongPlayers(MahjongGame game, GenericReader reader) { m_Game = game; m_Spectators = new ArrayList(); int version = reader.ReadInt(); int seats = reader.ReadInt(); m_Players = new Mobile[seats]; m_InGame = new bool[seats]; m_PublicHand = new bool[seats]; m_Scores = new int[seats]; for (int i = 0; i < seats; i++) { m_Players[i] = reader.ReadMobile(); m_PublicHand[i] = reader.ReadBool(); m_Scores[i] = reader.ReadInt(); } m_DealerPosition = reader.ReadInt(); }
public MahjongGeneralInfo(MahjongGame game) : base(0xDA) { EnsureCapacity(13); m_Stream.Write((int)game.Serial); m_Stream.Write((byte)0); m_Stream.Write((byte)0x5); m_Stream.Write((short)0); m_Stream.Write((byte)0); m_Stream.Write((byte)((game.ShowScores ? 0x1 : 0x0) | (game.SpectatorVision ? 0x2 : 0x0))); m_Stream.Write((byte)game.Dices.First); m_Stream.Write((byte)game.Dices.Second); m_Stream.Write((byte)game.DealerIndicator.Wind); m_Stream.Write((short)game.DealerIndicator.Position.Y); m_Stream.Write((short)game.DealerIndicator.Position.X); m_Stream.Write((byte)game.DealerIndicator.Direction); m_Stream.Write((short)game.WallBreakIndicator.Position.Y); m_Stream.Write((short)game.WallBreakIndicator.Position.X); }
public MahjongTilesInfo( MahjongGame game, Mobile to ) : base( 0xDA ) { MahjongTile[] tiles = game.Tiles; MahjongPlayers players = game.Players; EnsureCapacity( 11 + 9 * tiles.Length ); m_Stream.Write( (int) game.Serial ); m_Stream.Write( (byte) 0 ); m_Stream.Write( (byte) 0x4 ); m_Stream.Write( (short) tiles.Length ); foreach ( MahjongTile tile in tiles ) { m_Stream.Write( (byte) tile.Number ); if ( tile.Flipped ) { int hand = tile.Dimensions.GetHandArea(); if ( hand < 0 || players.IsPublic( hand ) || players.GetPlayer( hand ) == to || (game.SpectatorVision && players.IsSpectator( to )) ) m_Stream.Write( (byte)tile.Value ); else m_Stream.Write( (byte) 0 ); } else { m_Stream.Write( (byte) 0 ); } m_Stream.Write( (short) tile.Position.Y ); m_Stream.Write( (short) tile.Position.X ); m_Stream.Write( (byte) tile.StackLevel ); m_Stream.Write( (byte) tile.Direction ); m_Stream.Write( tile.Flipped ? (byte) 0x10 : (byte) 0x0 ); } }
public MahjongWallBreakIndicator(MahjongGame game, Point2D position) { m_Game = game; m_Position = position; }
public MahjongWallBreakIndicator( MahjongGame game, Point2D position ) { m_Game = game; m_Position = position; }
public ResetGameEntry(MahjongGame game) : base(6162) { m_Game = game; }
public MahjongPlayersInfo( MahjongGame game, Mobile to ) : base( 0xDA ) { MahjongPlayers players = game.Players; EnsureCapacity( 11 + 45 * players.Seats ); m_Stream.Write( (int) game.Serial ); m_Stream.Write( (byte) 0 ); m_Stream.Write( (byte) 0x2 ); m_Stream.Write( (byte) 0 ); m_Stream.Write( (byte) players.Seats ); int n = 0; for ( int i = 0; i < players.Seats; i++ ) { Mobile mobile = players.GetPlayer( i ); if ( mobile != null ) { m_Stream.Write( (int) mobile.Serial ); m_Stream.Write( players.DealerPosition == i ? (byte) 0x1 : (byte) 0x2 ); m_Stream.Write( (byte) i ); if ( game.ShowScores || mobile == to ) m_Stream.Write( (int) players.GetScore( i ) ); else m_Stream.Write( (int) 0 ); m_Stream.Write( (short) 0 ); m_Stream.Write( (byte) 0 ); m_Stream.Write( players.IsPublic( i ) ); m_Stream.WriteAsciiFixed( mobile.Name, 30 ); m_Stream.Write( !players.IsInGamePlayer( i ) ); n++; } else if ( game.ShowScores ) { m_Stream.Write( (int) 0 ); m_Stream.Write( (byte) 0x2 ); m_Stream.Write( (byte) i ); m_Stream.Write( (int) players.GetScore( i ) ); m_Stream.Write( (short) 0 ); m_Stream.Write( (byte) 0 ); m_Stream.Write( players.IsPublic( i ) ); m_Stream.WriteAsciiFixed( "", 30 ); m_Stream.Write( true ); n++; } } if ( n != players.Seats ) { m_Stream.Seek( 10, System.IO.SeekOrigin.Begin ); m_Stream.Write( (byte) n ); } }
public static void MoveDealerIndicator( MahjongGame game, NetState state, PacketReader pvSrc ) { if ( game == null || !game.Players.IsInGameDealer( state.Mobile ) ) return; MahjongPieceDirection direction = GetDirection( pvSrc.ReadByte() ); MahjongWind wind = GetWind( pvSrc.ReadByte() ); int y = pvSrc.ReadInt16(); int x = pvSrc.ReadInt16(); game.DealerIndicator.Move( new Point2D( x, y ), direction, wind ); }
public static void MoveTile( MahjongGame game, NetState state, PacketReader pvSrc ) { if ( game == null || !game.Players.IsInGamePlayer( state.Mobile ) ) return; int number = pvSrc.ReadByte(); if ( number < 0 || number >= game.Tiles.Length ) return; pvSrc.ReadByte(); // Current direction MahjongPieceDirection direction = GetDirection( pvSrc.ReadByte() ); pvSrc.ReadByte(); bool flip = pvSrc.ReadBoolean(); pvSrc.ReadInt16(); // Current Y pvSrc.ReadInt16(); // Current X pvSrc.ReadByte(); int y = pvSrc.ReadInt16(); int x = pvSrc.ReadInt16(); pvSrc.ReadByte(); game.Tiles[number].Move( new Point2D( x, y ), direction, flip, game.Players.GetPlayerIndex( state.Mobile ) ); }
public ResetGameEntry( MahjongGame game ) : base( 6162 ) { m_Game = game; }
public MahjongRelieve(MahjongGame game) : base(0xDA) { this.EnsureCapacity(9); this.m_Stream.Write((int)game.Serial); this.m_Stream.Write((byte)0); this.m_Stream.Write((byte)0x1A); }
public MahjongDices(MahjongGame game) { m_Game = game; m_First = Utility.Random(1, 6); m_Second = Utility.Random(1, 6); }
public static void MoveWallBreakIndicator( MahjongGame game, NetState state, PacketReader pvSrc ) { if ( game == null || !game.Players.IsInGameDealer( state.Mobile ) ) return; int y = pvSrc.ReadInt16(); int x = pvSrc.ReadInt16(); game.WallBreakIndicator.Move( new Point2D( x, y ) ); }
public static void RollDice( MahjongGame game, NetState state, PacketReader pvSrc ) { if ( game == null || !game.Players.IsInGamePlayer( state.Mobile ) ) return; game.Dices.RollDices( state.Mobile ); }
public static void TogglePublicHand( MahjongGame game, NetState state, PacketReader pvSrc ) { if ( game == null || !game.Players.IsInGamePlayer( state.Mobile ) ) return; pvSrc.ReadInt16(); pvSrc.ReadByte(); bool publicHand = pvSrc.ReadBoolean(); game.Players.SetPublic( game.Players.GetPlayerIndex( state.Mobile ), publicHand ); }
public MahjongPlayersInfo(MahjongGame game, Mobile to) : base(0xDA) { MahjongPlayers players = game.Players; EnsureCapacity(11 + 45 * players.Seats); m_Stream.Write(game.Serial); m_Stream.Write((byte)0); m_Stream.Write((byte)0x2); m_Stream.Write((byte)0); m_Stream.Write((byte)players.Seats); int n = 0; for (int i = 0; i < players.Seats; i++) { Mobile mobile = players.GetPlayer(i); if (mobile != null) { m_Stream.Write(mobile.Serial); m_Stream.Write(players.DealerPosition == i ? (byte)0x1 : (byte)0x2); m_Stream.Write((byte)i); if (game.ShowScores || mobile == to) { m_Stream.Write(players.GetScore(i)); } else { m_Stream.Write(0); } m_Stream.Write((short)0); m_Stream.Write((byte)0); m_Stream.Write(players.IsPublic(i)); m_Stream.WriteAsciiFixed(mobile.Name, 30); m_Stream.Write(!players.IsInGamePlayer(i)); n++; } else if (game.ShowScores) { m_Stream.Write(0); m_Stream.Write((byte)0x2); m_Stream.Write((byte)i); m_Stream.Write(players.GetScore(i)); m_Stream.Write((short)0); m_Stream.Write((byte)0); m_Stream.Write(players.IsPublic(i)); m_Stream.WriteAsciiFixed("", 30); m_Stream.Write(true); n++; } } if (n != players.Seats) { m_Stream.Seek(10, System.IO.SeekOrigin.Begin); m_Stream.Write((byte)n); } }
public static void ResetScores( MahjongGame game, NetState state, PacketReader pvSrc ) { if ( game == null || !game.Players.IsInGameDealer( state.Mobile ) ) return; game.Players.ResetScores( MahjongGame.BaseScore ); }
public static void OpenSeat( MahjongGame game, NetState state, PacketReader pvSrc ) { if ( game == null || !game.Players.IsInGameDealer( state.Mobile ) ) return; int position = pvSrc.ReadByte(); if ( game.Players.GetPlayer( position ) == state.Mobile ) return; game.Players.OpenSeat( position ); }
public MahjongDices(MahjongGame game) { this.m_Game = game; this.m_First = Utility.Random(1, 6); this.m_Second = Utility.Random(1, 6); }