bool CChar::Player_OnVerb( CScript &s, CTextConsole * pSrc ) // Execute command from script { ADDTOCALLSTACK("CChar::Player_OnVerb"); if ( !m_pPlayer ) return false; LPCTSTR pszKey = s.GetKey(); int cpVerb = FindTableSorted( pszKey, CCharPlayer::sm_szVerbKeys, COUNTOF(CCharPlayer::sm_szVerbKeys)-1 ); if ( cpVerb <= -1 ) { if ( ( !strnicmp(pszKey, "GUILD", 5) ) || ( !strnicmp(pszKey, "TOWN", 4) ) ) { bool bIsGuild = !strnicmp(pszKey, "GUILD", 5); pszKey += bIsGuild ? 5 : 4; if ( *pszKey == '.' ) { pszKey += 1; CItemStone *pMyGuild = Guild_Find(bIsGuild ? MEMORY_GUILD : MEMORY_TOWN); if ( pMyGuild ) { CScript sToParse(pszKey, s.GetArgRaw()); return pMyGuild->r_Verb(sToParse, pSrc); } } return false; } } switch ( cpVerb ) { case CPV_KICK: // "KICK" = kick and block the account return (IsClient() && GetClient()->addKick(pSrc)); case CPV_PASSWORD: // "PASSWORD" { // Set/Clear the password if ( pSrc != this ) { if ( pSrc->GetPrivLevel() <= GetPrivLevel() || pSrc->GetPrivLevel() < PLEVEL_Admin ) { pSrc->SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_MSG_ACC_PRIV)); return false; } } CAccount * pAccount = m_pPlayer->GetAccount(); ASSERT(pAccount != NULL); if ( !s.HasArgs() ) { pAccount->ClearPassword(); SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_MSG_ACC_PASSCLEAR)); SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_MSG_ACC_PASSCLEAR_RELOG)); g_Log.Event(LOGM_ACCOUNTS|LOGL_EVENT, "Account '%s', password cleared\n", pAccount->GetName()); } else { if ( pAccount->SetPassword(s.GetArgStr()) ) { SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_MSG_ACC_ACCEPTPASS)); g_Log.Event(LOGM_ACCOUNTS|LOGL_EVENT, "Account '%s', password set to '%s'\n", pAccount->GetName(), s.GetArgStr()); return true; } SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_MSG_ACC_INVALIDPASS)); } break; } default: return false; } return true; }