本文整理汇总了C++中PrivateChatChannel::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ PrivateChatChannel::getId方法的具体用法?C++ PrivateChatChannel::getId怎么用?C++ PrivateChatChannel::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PrivateChatChannel
的用法示例。
在下文中一共展示了PrivateChatChannel::getId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendCreatureChannelSay
void Spectators::sendCreatureChannelSay(const Creature* creature, MessageClasses type, const std::string& text, uint16_t channelId, uint32_t statementId)
{
if(!owner)
return;
owner->sendCreatureChannelSay(creature, type, text, channelId, statementId);
PrivateChatChannel* tmp = g_chat.getPrivateChannel(owner->getPlayer());
if(!tmp || tmp->getId() != channelId)
return;
for(SpectatorList::iterator it = spectators.begin(); it != spectators.end(); ++it)
it->first->sendCreatureChannelSay(creature, type, text, channelId, statementId);
}
示例2: sendChannelMessage
void Spectators::sendChannelMessage(std::string author, std::string text, MessageClasses type, uint16_t channel)
{
if(!owner)
return;
owner->sendChannelMessage(author, text, type, channel);
PrivateChatChannel* tmp = g_chat.getPrivateChannel(owner->getPlayer());
if(!tmp || tmp->getId() != channel)
return;
for(SpectatorList::iterator it = spectators.begin(); it != spectators.end(); ++it)
it->first->sendChannelMessage(author, text, type, channel);
}
示例3: chat
void Spectators::chat(uint16_t channelId)
{
if(!owner)
return;
PrivateChatChannel* tmp = g_chat.getPrivateChannel(owner->getPlayer());
if(!tmp || tmp->getId() != channelId)
return;
for(SpectatorList::iterator it = spectators.begin(); it != spectators.end(); ++it)
{
it->first->sendClosePrivate(channelId);
it->first->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Chat has been disabled.", NULL, 0);
}
}
示例4: sendCreatePrivateChannel
void Spectators::sendCreatePrivateChannel(uint16_t channelId, const std::string& channelName)
{
if(!owner)
return;
owner->sendCreatePrivateChannel(channelId, channelName);
PrivateChatChannel* tmp = g_chat.getPrivateChannel(owner->getPlayer());
if(!tmp || tmp->getId() != channelId)
return;
for(SpectatorList::iterator it = spectators.begin(); it != spectators.end(); ++it)
{
it->first->sendCreatePrivateChannel(channelId, channelName);
it->first->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Chat has been enabled.", NULL, 0);
}
}
示例5: removeUserFromAllChannels
void Chat::removeUserFromAllChannels(const Player& player)
{
for (auto& it : normalChannels) {
it.second.removeUser(player);
}
for (const auto& it : partyChannels) {
it.second->removeUser(player);
}
for (const auto& it : guildChannels) {
it.second->removeUser(player);
}
for (const auto& it : privateChannels) {
PrivateChatChannel* channel = it.second;
channel->removeUser(player);
if (channel->getOwner() == player.getGUID()) {
deleteChannel(player, channel->getId());
}
}
}
示例6: removeUserFromAllChannels
void Chat::removeUserFromAllChannels(Player* player)
{
for (NormalChannelMap::iterator it = m_normalChannels.begin(), end = m_normalChannels.end(); it != end; ++it) {
it->second->removeUser(player);
}
for (PartyChannelMap::iterator it = m_partyChannels.begin(), end = m_partyChannels.end(); it != end; ++it) {
it->second->removeUser(player);
}
for (GuildChannelMap::iterator it = m_guildChannels.begin(), end = m_guildChannels.end(); it != end; ++it) {
it->second->removeUser(player);
}
for (PrivateChannelMap::iterator it = m_privateChannels.begin(), end = m_privateChannels.end(); it != end; ++it) {
PrivateChatChannel* channel = it->second;
channel->removeUser(player);
if (channel->getOwner() == player->getGUID()) {
deleteChannel(player, channel->getId());
}
}
}
示例7: handle
void Spectators::handle(ProtocolGame* client, const std::string& text, uint16_t channelId)
{
if(!owner)
return;
SpectatorList::iterator sit = spectators.find(client);
if(sit == spectators.end())
return;
PrivateChatChannel* channel = g_chat.getPrivateChannel(owner->getPlayer());
if(text[0] == '/')
{
StringVec t = explodeString(text.substr(1, text.length()), " ", true, 1);
toLowerCaseString(t[0]);
if(t[0] == "show")
{
std::stringstream s;
s << spectators.size() << " spectators. ";
for(SpectatorList::const_iterator it = spectators.begin(); it != spectators.end(); ++it)
{
if(it != spectators.begin())
s << " ,";
s << it->second.first;
}
s << ".";
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, s.str(), NULL, 0);
}
else if(t[0] == "name")
{
if(t.size() > 1)
{
if(t[1].length() > 2)
{
if(t[1].length() < 26)
{
t[1] += " [G]";
bool found = false;
for(SpectatorList::iterator iit = spectators.begin(); iit != spectators.end(); ++iit)
{
if(asLowerCaseString(iit->second.first) != asLowerCaseString(t[1]))
continue;
found = true;
break;
}
if(!found)
{
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Your name has been set to " + t[1] + ".", NULL, 0);
if(!auth && channel)
sendChannelMessage("", sit->second.first + " is now known as " + t[1] + ".", MSG_GAMEMASTER_CHANNEL, channel->getId());
StringVec::iterator mit = std::find(mutes.begin(), mutes.end(), asLowerCaseString(sit->second.first));
if(mit != mutes.end())
(*mit) = asLowerCaseString(t[1]);
sit->second.first = t[1];
sit->second.second = false;
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Specified name is already taken.", NULL, 0);
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Specified name is too long.", NULL, 0);
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Specified name is too short.", NULL, 0);
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Not enough param(s) given.", NULL, 0);
}
else if(t[0] == "auth")
{
if(t.size() > 1)
{
StringVec _t = explodeString(t[1], " ", true, 1);
if(_t.size() > 1)
{
Database* db = Database::getInstance();
DBQuery query;
query << "SELECT `id`, `salt`, `password` FROM `accounts` WHERE `name` " << db->getStringComparer() << db->escapeString(_t[0]) << " LIMIT 1";
if(DBResult* result = db->storeQuery(query.str()))
{
std::string password = result->getDataString("salt") + _t[1],
hash = result->getDataString("password");
uint32_t id = result->getDataInt("id");
result->free();
if(encryptTest(password, hash))
{
query.str("");
query << "SELECT `name` FROM `players` WHERE `account_id` = " << id << " ORDER BY `level` DESC LIMIT 1";
if((result = db->storeQuery(query.str())))
{
std::string nickname = result->getDataString("name");
result->free();
//.........这里部分代码省略.........