source/MainGUI.cpp
/**
 * Slot which is emitted when the statspage finished parsing the playerinformation.
 *
 * @param player The player with every available information from the statspage.
 */
Slot which is emitted when the statspage finished parsing the playerinformation.
@param player The player with every available information from the statspage.
Slot which is emitted when the statspage finished parsing the playerinformation . @param player The player with every available information from the statspage .
void MainGUI::receivedPlayerInformation (Player *player)
{
    QList<Player*> players = gproxy->getPlayers();
    for (int i = 0; i < players.count(); i++)
    {
        if (players.at(i)->getName() == player->getName())
        {
            player->setPlayerId(players.at(i)->getPlayerId());
            players[i] = player;
            if (players[i]->getGamesPlayed() == 0)
            {
                addMessage(ColoredMessage("[WARNING] ", ColoredMessage::WARNING), true, true, false);
                addMessage(players[i]->getName(), true, false, false);
                addMessage(ColoredMessage(" hasn't played any games on GhostGraz yet.",
                        ColoredMessage::WARNING), true, false, true);
                gproxy->SendLocalChat("[WARNING] " + players[i]->getName().getMessage()
                        + " hasn't played any games with the bot yet.");
            }
            else if (players[i]->getStayPercent() < 80)
            {
                addMessage(ColoredMessage("[WARNING] ", ColoredMessage::WARNING), true, true, false);
                addMessage(players[i]->getName(), true, false, false);
                addMessage(ColoredMessage(" has a stay ratio below 80%. ("
                        + QString::number(players[i]->getStayPercent(), 'f', 2) + "%)",
                        ColoredMessage::WARNING), true, false, true);
                gproxy->SendLocalChat("WARNING: " + players[i]->getName().getMessage()
                        + " has a stay ratio below 80%. ("
                        + QString::number(players[i]->getStayPercent(), 'f', 2) + "%)");
            }
            if(gproxy->getConfig()->getBoolean("joinstats")){
                addMessage(ColoredMessage("[Statspage] ", ColoredMessage::GPROXY),true, true, false);
                addMessage(players[i]->getName(), true, false, false);
                addMessage(ColoredMessage(" has stats of: " +  QString::number(players[i]->getGamesPlayed()) + " g with " +  QString::number(players[i]->getWinPercent(),'f',2) + "% of win. Stay of: " +  QString::number(players[i]->getStayPercent(),'f',2) + "% "),true, false, true);
                gproxy->SendLocalChat("[Statspage]: " + players[i]->getName().getMessage() + " has stats of: " + QString::number(players[i]->getGamesPlayed()) + " g with " + QString::number(players[i]->getWinPercent(),'f',2) + "% of win. Stay of: " + QString::number(players[i]->getStayPercent(),'f',2) + "%");
            }
            break;
        }
    }
    gproxy->setPlayers(players);
    widget.channelList->repaint();
}
void MainGUI :: receivedPlayerInformation ( Player * player ) { QList < Player * > players = gproxy -> getPlayers ( ) ; for ( int i = 0 ; i < players . count ( ) ; i ++ ) { if ( players . at ( i ) -> getName ( ) == player -> getName ( ) ) { player -> setPlayerId ( players . at ( i ) -> getPlayerId ( ) ) ; players [ i ] = player ; if ( players [ i ] -> getGamesPlayed ( ) == 0 ) { addMessage ( ColoredMessage ( " " , ColoredMessage :: WARNING ) , true , true , false ) ; addMessage ( players [ i ] -> getName ( ) , true , false , false ) ; addMessage ( ColoredMessage ( " " , ColoredMessage :: WARNING ) , true , false , true ) ; gproxy -> SendLocalChat ( " " + players [ i ] -> getName ( ) . getMessage ( ) + " " ) ; } else if ( players [ i ] -> getStayPercent ( ) < 80 ) { addMessage ( ColoredMessage ( " " , ColoredMessage :: WARNING ) , true , true , false ) ; addMessage ( players [ i ] -> getName ( ) , true , false , false ) ; addMessage ( ColoredMessage ( " " + QString :: number ( players [ i ] -> getStayPercent ( ) , ' ' , 2 ) + " " , ColoredMessage :: WARNING ) , true , false , true ) ; gproxy -> SendLocalChat ( " " + players [ i ] -> getName ( ) . getMessage ( ) + " " + QString :: number ( players [ i ] -> getStayPercent ( ) , ' ' , 2 ) + " " ) ; } if ( gproxy -> getConfig ( ) -> getBoolean ( " " ) ) { addMessage ( ColoredMessage ( " " , ColoredMessage :: GPROXY ) , true , true , false ) ; addMessage ( players [ i ] -> getName ( ) , true , false , false ) ; addMessage ( ColoredMessage ( " " + QString :: number ( players [ i ] -> getGamesPlayed ( ) ) + " " + QString :: number ( players [ i ] -> getWinPercent ( ) , ' ' , 2 ) + " " + QString :: number ( players [ i ] -> getStayPercent ( ) , ' ' , 2 ) + " " ) , true , false , true ) ; gproxy -> SendLocalChat ( " " + players [ i ] -> getName ( ) . getMessage ( ) + " " + QString :: number ( players [ i ] -> getGamesPlayed ( ) ) + " " + QString :: number ( players [ i ] -> getWinPercent ( ) , ' ' , 2 ) + " " + QString :: number ( players [ i ] -> getStayPercent ( ) , ' ' , 2 ) + " " ) ; } break ; } } gproxy -> setPlayers ( players ) ; widget . channelList -> repaint ( ) ; }
Slot which is emitted when the statspage finished parsing the playerinformation.
Slot which is emitted when the statspage finished parsing the playerinformation .