using System; using ACE.Server.Entity.Chess; namespace ACE.Server.WorldObjects { partial class Player { public ChessMatch ChessMatch; /// /// Joins a chess game /// /// The guid of the chess board public void HandleActionChessJoin(uint boardGuid) { var chessboard = CurrentLandblock.GetObject(boardGuid) as Game; if (chessboard == null) return; chessboard.ActOnUse(this); } /// /// Performs a move in a chess game /// /// The chessboard x/y coordinate moving piece from /// The chessboard x/y coordinate moving piece to public void HandleActionChessMove(ChessPieceCoord from, ChessPieceCoord to) { //Console.WriteLine($"{Name}.HandleActionChessMove({from}, {to})"); if (ChessMatch != null) ChessMatch.MoveEnqueue(this, from, to); } public void HandleActionChessMovePass() { //Console.WriteLine($"{Name}.HandleActionChessMovePass()"); if (ChessMatch != null) ChessMatch.MovePassEnqueue(this); } /// /// Called when the 'Resign' button is clicked /// public void HandleActionChessQuit() { //Console.WriteLine($"{Name}.HandleActionChessQuit()"); if (ChessMatch != null) ChessMatch.QuitEnqueue(this); } /// /// Offer or confirm a stalemate /// /// if FALSE, retract the stalemate offer public void HandleActionChessStalemate(bool stalemate) { //Console.WriteLine($"{Name}.HandleActionChessStalemate({stalemate})"); if (ChessMatch != null) ChessMatch.StalemateEnqueue(this, stalemate); } } }