/// <summary> /// Gives the winner the book with the sum up of the game /// </summary> /// <param name="to">The winner of the game</param> public void GiveWinnerBook(Mobile to) { Mobile winner = to; Mobile loser = null; TimeSpan winTime = TimeSpan.Zero; TimeSpan looseTime = TimeSpan.Zero; int winnerScore = 0; int loserScore = 0; if (winner == m_Black) { loser = m_White; looseTime = m_WhiteTime; winTime = m_BlackTime; winnerScore = m_Board.GetScore(ChessColor.Black); loserScore = m_Board.GetScore(ChessColor.White); } else { loser = m_Black; looseTime = m_BlackTime; winTime = m_WhiteTime; winnerScore = m_Board.GetScore(ChessColor.White); loserScore = m_Board.GetScore(ChessColor.Black); } if (winner == null || loser == null) { return; } WinnerPaper paper = new WinnerPaper(winner, loser, DateTime.UtcNow - m_GameStart, winTime, looseTime, winnerScore, loserScore); to.AddToBackpack(paper); }
public void GiveUp(Mobile looser) { Mobile winner = null; TimeSpan winTime = TimeSpan.Zero; TimeSpan looseTime = TimeSpan.Zero; int winnerScore = 0; int looserScore = 0; if (looser == m_Black) { winner = m_White; looseTime = m_BlackTime; winTime = m_WhiteTime; winnerScore = m_Board.GetScore(ChessColor.White); looserScore = m_Board.GetScore(ChessColor.Black); } else { winner = m_Black; looseTime = m_WhiteTime; winTime = m_BlackTime; winnerScore = m_Board.GetScore(ChessColor.Black); looserScore = m_Board.GetScore(ChessColor.White); } if (winner == null || looser == null) { return; } WinnerPaper paper = new WinnerPaper(winner, looser, DateTime.Now - m_GameStart, winTime, looseTime, winnerScore, looserScore, true); if (winner.Backpack != null) { winner.Backpack.AddItem(paper); } }
/// <summary> /// Gives the winner the book with the sum up of the game /// </summary> /// <param name="to">The winner of the game</param> public void GiveWinnerBook( Mobile to ) { Mobile winner = to; Mobile looser = null; TimeSpan winTime = TimeSpan.Zero; TimeSpan looseTime = TimeSpan.Zero; int winnerScore = 0; int looserScore = 0; if ( winner == m_Black ) { looser = m_White; looseTime = m_WhiteTime; winTime = m_BlackTime; winnerScore = m_Board.GetScore( ChessColor.Black ); looserScore = m_Board.GetScore( ChessColor.White ); } else { looser = m_Black; looseTime = m_BlackTime; winTime = m_WhiteTime; winnerScore = m_Board.GetScore( ChessColor.White ); looserScore = m_Board.GetScore( ChessColor.Black ); } if ( winner == null || looser == null ) return; WinnerPaper paper = new WinnerPaper( winner, looser, DateTime.Now - m_GameStart, winTime, looseTime, winnerScore, looserScore, false ); if ( to.Backpack != null ) to.Backpack.AddItem( paper ); }