示例#1
0
// Player Settings
QString GameDBStorage::GetWhereClause(MSqlBindings &bindings) const
{
    QString playerId(":PLAYERID");
    QString query("gameplayerid = " + playerId);

    bindings.insert(playerId, parent.getGamePlayerID());

    return query;
}
示例#2
0
void CPlayerLevels::AddLevel( const FData& level, const std::string& levelId, std::list<CLevel>& levelList )
{
	FData value;
	value = level.get("PlayerId",value);
	if(!value.isString())
	{
		return;
	}
	std::string playerId(value.asString());
	value = level.get("PlayerName",value);
	std::string playerName(value.asString());
	value = level.get("PlayerSource",value);
	std::string playerSource(value.asString());
	value = level.get("Name",value);
	std::string name(value.asString());
	value = level.get("Data",value);
	std::string ldata(value.asString());
	value = level.get("thumb",value);
	std::string lthumb(value.asString());
	value = level.get("RDate",value);
	std::string relativeDate(value.asString());
	value = level.get("SDate",value);
	std::string date(value.asString());
	value = level.get("Plays",value);
	int plays = value.asInt();
	value = level.get("Votes",value);
	int votes = value.asInt();
	value = level.get("Score",value);
	int score = value.asInt();
	value = level.get("Rating",value);
	float rating = value.asFloat();
	value = level.get("CustomData",value);

	CustomData	customData;
	Json::ValueIterator it = value.begin();
	for(; it != value.end(); it++)
	{
		customData.insert(std::make_pair(it.key().asString(), (*it).asString()));
	}
	
	levelList.push_back( CLevel(name, playerName, playerId,
						playerSource, ldata, lthumb, votes, plays,
						rating, score, date, relativeDate, customData, levelId));
}
示例#3
0
void KGameChat::returnPressed(const QString& text)
{
 if (!d->mFromPlayer) {
	qCWarning(GAMES_PRIVATE_KGAME) << ": You must set a player first!";
	return;
 }
 if (!d->mGame) {
	qCWarning(GAMES_PRIVATE_KGAME) << ": You must set a game first!";
	return;
 }

 qCDebug(GAMES_PRIVATE_KGAME) << "from:" << d->mFromPlayer->id() << "==" << d->mFromPlayer->name();

 int id = sendingEntry();

 if (isToGroupMessage(id)) {
	// note: there is currently no support for other groups than the players
	// group! It might be useful to send to other groups, too
	QString group = d->mFromPlayer->group();
	qCDebug(GAMES_PRIVATE_KGAME) << "send to group" << group;
	int sender = d->mFromPlayer->id();
	d->mGame->sendGroupMessage(text, messageId(), sender, group);

	//TODO
	//AB: this message is never received!! we need to connect to
	//KPlayer::networkData!!!
	//TODO
	
 } else {
	int toPlayer = 0;
	if (!isSendToAllMessage(id) && isToPlayerMessage(id)) {
		toPlayer = playerId(id);
		if (toPlayer == -1) {
			qCCritical(GAMES_PRIVATE_KGAME) << ": don't know that player "
					<< "- internal ERROR";
		}
	} 
	int receiver = toPlayer;
	int sender = d->mFromPlayer->id();
	d->mGame->sendMessage(text, messageId(), receiver, sender);
 }
}