本文整理汇总了C++中PrivateChatChannel::talk方法的典型用法代码示例。如果您正苦于以下问题:C++ PrivateChatChannel::talk方法的具体用法?C++ PrivateChatChannel::talk怎么用?C++ PrivateChatChannel::talk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PrivateChatChannel
的用法示例。
在下文中一共展示了PrivateChatChannel::talk方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle
//.........这里部分代码省略.........
}
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();
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "You have authenticated as " + nickname + ".", NULL, 0);
if(channel)
sendChannelMessage("", sit->second.first + " authenticated as " + nickname + ".", MSG_GAMEMASTER_CHANNEL, channel->getId());
StringVec::iterator mit = std::find(mutes.begin(), mutes.end(), asLowerCaseString(sit->second.first));
if(mit != mutes.end())
(*mit) = asLowerCaseString(nickname);
sit->second.first = nickname;
sit->second.second = true;
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Your account has no characters yet.", NULL, 0);
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Invalid password.", NULL, 0);
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Invalid account name.", NULL, 0);
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Not enough param(s) given.", NULL, 0);
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Not enough param(s) given.", NULL, 0);
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "Command not found.", NULL, 0);
return;
}
if(!auth || sit->second.second)
{
StringVec::const_iterator mit = std::find(mutes.begin(), mutes.end(), asLowerCaseString(sit->second.first));
if(mit == mutes.end())
{
if(channel && channel->getId() == channelId)
channel->talk(sit->second.first, MSG_CHANNEL_HIGHLIGHT, text);
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "You are muted.", NULL, 0);
}
else
client->sendCreatureSay(owner->getPlayer(), MSG_PRIVATE, "This chat is protected, you have to authenticate first.", NULL, 0);
}