int Team5_DB::GetUserInfo(char *Name, UserInfo &RetInfo) { RetInfo.ID = GetUserID(Name); if (RetInfo.ID < 0) { printf("GetUserInfo Error\n"); return -1; } strcpy(RetInfo.Name, Name); if (GetUserPassword(Name, RetInfo.Password)) { printf("GetUserInfo Error\n"); return -1; } RetInfo.Score = GetUserScore(Name); if (RetInfo.Score < 0) { printf("GetUserInfo Error\n"); return -1; } RetInfo.Rank = GetUserRank(Name); if (RetInfo.Rank < 0) { printf("GetUserInfo Error\n"); return -1; } return 0; }
// 级别 LPCTSTR GetUserLevelStr(int nUserId) { UNREFERENCED_PARAMETER(nUserId); int score = GetUserScore(nUserId); if (score < 10) { return _T("包身工"); } else if (score < 25) { return _T("短工"); } else if (score < 40) { return _T("长工"); } else if (score < 80) { return _T("佃户"); } else if (score < 140) { return _T("贫农"); } else if (score < 230) { return _T("渔夫"); } else if (score < 365) { return _T("猎人"); } else if (score < 500) { return _T("中农"); } else if (score < 700) { return _T("富农"); } else if (score < 1000) { return _T("掌柜"); } else if (score < 1500) { return _T("商人"); } else if (score < 2200) { return _T("衙役"); } else if (score < 3000) { return _T("小财主"); } else if (score < 4000) { return _T("大财主"); } else if (score < 5500) { return _T("小地主"); } else if (score < 7700) { return _T("大地主"); } else if (score < 10000) { return _T("知县"); } else if (score < 14000) { return _T("通判"); } else if (score < 20000) { return _T("知府"); } else if (score < 30000) { return _T("总督"); } else if (score < 45000) { return _T("巡抚"); } else if (score < 70000) { return _T("丞相"); } else { return _T("帝王"); } }
ModResult OnUserRegister(LocalUser* user) { if (IsAntirandomExempt(user)) { return MOD_RES_PASSTHRU; } unsigned int score = GetUserScore(user); if (score > this->Threshold) { std::string method = "allowed because no action was set"; switch (this->BanAction) { case ANTIRANDOM_ACT_KILL: { ServerInstance->Users->QuitUser(user, this->BanReason); method="Killed"; break; } case ANTIRANDOM_ACT_ZLINE: { ZLine* zl = new ZLine(ServerInstance->Time(), this->BanDuration, ServerInstance->Config->ServerName, this->BanReason.c_str(), user->GetIPString()); if (ServerInstance->XLines->AddLine(zl,user)) ServerInstance->XLines->ApplyLines(); else delete zl; method="Z-Lined"; break; } case ANTIRANDOM_ACT_GLINE: { GLine* gl = new GLine(ServerInstance->Time(), this->BanDuration, ServerInstance->Config->ServerName, this->BanReason.c_str(), "*", user->GetIPString()); if (ServerInstance->XLines->AddLine(gl,user)) ServerInstance->XLines->ApplyLines(); else delete gl; method="G-Lined"; break; } } if (this->ShowFailedConnects) { std::string realhost = user->GetFullRealHost(); ServerInstance->SNO->WriteGlobalSno('a', "Connection from %s (%s) was %s by m_antirandom with a score of %d - which exceeds threshold of %d", realhost.c_str(), user->GetIPString(), method.c_str(), score, this->Threshold); ServerInstance->Logs->Log("CONFIG",DEFAULT, "Connection from %s (%s) was %s by m_antirandom with a score of %d - which exceeds threshold of %d", realhost.c_str(), user->GetIPString(), method.c_str(), score, this->Threshold); } return MOD_RES_DENY; } return MOD_RES_PASSTHRU; }