コード例 #1
0
ファイル: chat.cpp プロジェクト: edubart/otserv
void PrivateChatChannel::invitePlayer(Player* player, Player* invitePlayer)
{
	if (player != invitePlayer && addInvited(invitePlayer))
	{
		std::stringstream msg;
		msg << player->getName() << " invites you to " << playerSexAdjectiveString(player->getSex())
		    <<  " private chat channel.";
		invitePlayer->sendTextMessage(MSG_INFO_DESCR, msg.str().c_str());
		msg.str("");
		msg << invitePlayer->getName() << " has been invited.";
		player->sendTextMessage(MSG_INFO_DESCR, msg.str().c_str());
	}
}
コード例 #2
0
ファイル: chat.cpp プロジェクト: gianflogao/divinity-ots
void PrivateChatChannel::invitePlayer(Player* player, Player* invitePlayer)
{
	if(player != invitePlayer && addInvited(invitePlayer)){
		std::string msg;
		msg = player->getName();
		msg += " invites you to ";
		msg += (player->getSex() == PLAYERSEX_FEMALE ? "her" : "his");
		msg += " private chat channel.";
		invitePlayer->sendTextMessage(MSG_INFO_DESCR, msg.c_str());
		
		msg = invitePlayer->getName();
		msg += " has been invited.";
		player->sendTextMessage(MSG_INFO_DESCR, msg.c_str());
	}
}
コード例 #3
0
ファイル: chat.cpp プロジェクト: Alvaritos/forgottenserver
void PrivateChatChannel::invitePlayer(const Player& player, Player& invitePlayer)
{
	if (addInvited(invitePlayer)) {
		std::ostringstream ss;
		ss << player.getName() << " invites you to " << (player.getSex() == PLAYERSEX_FEMALE ? "her" : "his") << " private chat channel.";
		invitePlayer.sendTextMessage(MSG_INFO_DESCR, ss.str());

		ss.str("");
		ss << invitePlayer.getName() << " has been invited.";
		player.sendTextMessage(MSG_INFO_DESCR, ss.str());

		for (const auto& it : users) {
			it.second->sendChannelEvent(id, invitePlayer.getName(), CHANNELEVENT_INVITE);
		}
	}
}
コード例 #4
0
ファイル: chat.cpp プロジェクト: Codex-NG/thecrystalserver
void PrivateChatChannel::invitePlayer(Player* player, Player* invitePlayer)
{
	if(player == invitePlayer || !addInvited(invitePlayer))
		return;

	std::stringstream msg;
	msg << player->getName() << " invites you to " << (player->getSex(false) ? "his" : "her") << " private chat channel.";
	invitePlayer->sendTextMessage(MSG_INFO_DESCR, msg.str().c_str());

	msg.str("");
	msg << invitePlayer->getName() << " has been invited.";
	player->sendTextMessage(MSG_INFO_DESCR, msg.str().c_str());

	Player* tmpPlayer = NULL;
	for(UsersMap::iterator cit = m_users.begin(); cit != m_users.end(); ++cit)
	{
		if((tmpPlayer = cit->second->getPlayer()))
			tmpPlayer->sendChannelEvent(m_id, invitePlayer->getName(), CHANNELEVENT_INVITE);
	}
}
コード例 #5
0
ファイル: chat.cpp プロジェクト: 24312108k/forgottenserver
void PrivateChatChannel::invitePlayer(Player* player, Player* invitePlayer)
{
	if (player != invitePlayer && addInvited(invitePlayer)) {
		std::string msg = player->getName();
		msg += " invites you to ";
		msg += (player->getSex() == PLAYERSEX_FEMALE ? "her" : "his");
		msg += " private chat channel.";
		invitePlayer->sendTextMessage(MSG_INFO_DESCR, msg);

		msg = invitePlayer->getName();
		msg += " has been invited.";
		player->sendTextMessage(MSG_INFO_DESCR, msg);

		for (auto cit = m_users.begin(); cit != m_users.end(); ++cit) {
			Player* tmpPlayer = cit->second->getPlayer();
			if (tmpPlayer) {
				tmpPlayer->sendChannelEvent(m_id, invitePlayer->getName(), CHANNELEVENT_INVITE);
			}
		}
	}
}