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()); } }
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()); } }
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); } } }
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); } }
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); } } } }