当前位置: 首页>>代码示例>>C++>>正文


C++ WorldSession::SystemMessage方法代码示例

本文整理汇总了C++中WorldSession::SystemMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldSession::SystemMessage方法的具体用法?C++ WorldSession::SystemMessage怎么用?C++ WorldSession::SystemMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WorldSession的用法示例。


在下文中一共展示了WorldSession::SystemMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleAccountMuteCommand

bool ChatHandler::HandleAccountMuteCommand(const char* args, WorldSession* m_session)
{
    if (!*args)
        return false;

    char* pAccount = (char*)args;
    char* pDuration = strchr(pAccount, ' ');
    if (pDuration == NULL)
        return false;
    *pDuration = 0;
    ++pDuration;

    uint32_t timeperiod = Util::GetTimePeriodFromString(pDuration);
    if (timeperiod == 0)
        return false;

    uint32 banned = (uint32)UNIXTIME + timeperiod;

    sLogonCommHandler.setAccountMute(pAccount, banned);

    std::string tsstr = Util::GetDateTimeStringFromTimeStamp(timeperiod + (uint32)UNIXTIME);
    GreenSystemMessage(m_session, "Account '%s' has been muted until %s. The change will be effective immediately.", pAccount,
                       tsstr.c_str());

    sGMLog.writefromsession(m_session, "mutex account %s until %s", pAccount, Util::GetDateTimeStringFromTimeStamp(timeperiod + (uint32)UNIXTIME).c_str());

    WorldSession* pSession = sWorld.getSessionByAccountName(pAccount);
    if (pSession != NULL)
    {
        pSession->m_muted = banned;
        pSession->SystemMessage("Your voice has been muted until %s by a GM. Until this time, you will not be able to speak in any form.", tsstr.c_str());
    }

    return true;
}
开发者ID:armm77,项目名称:AscEmu,代码行数:35,代码来源:AccountCommands.cpp

示例2: HandleAccountUnmuteCommand

bool ChatHandler::HandleAccountUnmuteCommand(const char* args, WorldSession* m_session)
{
    sLogonCommHandler.setAccountMute(args, 0);

    GreenSystemMessage(m_session, "Account '%s' has been unmuted.", args);
    sGMLog.writefromsession(m_session, "unmuted account %s", args);
    WorldSession* pSession = sWorld.getSessionByAccountName(args);
    if (pSession != NULL)
    {
        pSession->m_muted = 0;
        pSession->SystemMessage("Your voice has restored. You may speak again.");
    }

    return true;
}
开发者ID:armm77,项目名称:AscEmu,代码行数:15,代码来源:AccountCommands.cpp


注:本文中的WorldSession::SystemMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。