예제 #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
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
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
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
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);
			}
		}
	}
}