コード例 #1
0
ファイル: AccountCommands.cpp プロジェクト: armm77/AscEmu
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;
}
コード例 #2
0
ファイル: AccountCommands.cpp プロジェクト: armm77/AscEmu
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;
}