Five character slots (AVA2 ENABLE_PLAYER_PER_ACCOUNT5)
PLAYER_PER_ACCOUNT 5: player_index.pid5 in the login/empire/monarch queries, char_change_empire sized by PLAYER_PER_ACCOUNT, slot check relaxed; client gate mt20261029. tools/player-slots5 adds pid5. tools/player-deleted-sync: PLAYER_DELETE copies with SELECT *, so player_deleted must match player column for column; the conqueror schema now adds its columns to player_deleted too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
31ebae050b
commit
96f8486306
@@ -11,7 +11,11 @@ enum EMisc
|
||||
IP_ADDRESS_LENGTH = 15,
|
||||
LOGIN_MAX_LEN = 30,
|
||||
PASSWD_MAX_LEN = 16,
|
||||
#ifdef ENABLE_PLAYER_PER_ACCOUNT5
|
||||
PLAYER_PER_ACCOUNT = 5,
|
||||
#else
|
||||
PLAYER_PER_ACCOUNT = 4,
|
||||
#endif
|
||||
ACCOUNT_STATUS_MAX_LEN = 8,
|
||||
CHARACTER_NAME_MAX_LEN = 24,
|
||||
#ifdef ENABLE_OFFLINESHOP_SYSTEM
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#define USE_MOB_CLAW_AS_DAGGER
|
||||
#endif
|
||||
#define ENABLE_CONQUEROR_LEVEL
|
||||
#define ENABLE_PLAYER_PER_ACCOUNT5
|
||||
#define UNLOCK_INVENTORY_WORLDARD
|
||||
#define ENABLE_OFFLINESHOP_SYSTEM
|
||||
#ifdef ENABLE_OFFLINESHOP_SYSTEM
|
||||
|
||||
@@ -1031,7 +1031,11 @@ void CClientManager::QUERY_EMPIRE_SELECT(CPeer * pkPeer, DWORD dwHandle, TEmpire
|
||||
sys_log(0, "EmpireSelect: %s", szQuery);
|
||||
{
|
||||
snprintf(szQuery, sizeof(szQuery),
|
||||
"SELECT pid1, pid2, pid3, pid4 FROM player_index%s WHERE id=%u", GetTablePostfix(), p->dwAccountID);
|
||||
"SELECT pid1, pid2, pid3, pid4"
|
||||
#ifdef ENABLE_PLAYER_PER_ACCOUNT5
|
||||
", pid5"
|
||||
#endif
|
||||
" FROM player_index%s WHERE id=%u", GetTablePostfix(), p->dwAccountID);
|
||||
|
||||
std::unique_ptr<SQLMsg> pmsg(CDBManager::instance().DirectQuery(szQuery));
|
||||
|
||||
@@ -4291,9 +4295,15 @@ void CClientManager::ChangeMonarchLord(CPeer * peer, DWORD dwHandle, TPacketChan
|
||||
char szQuery[1024];
|
||||
snprintf(szQuery, sizeof(szQuery),
|
||||
"SELECT a.name, NOW() FROM player%s AS a, player_index%s AS b WHERE (a.account_id=b.id AND a.id=%u AND b.empire=%u) AND "
|
||||
#ifdef ENABLE_PLAYER_PER_ACCOUNT5
|
||||
"(b.pid1=%u OR b.pid2=%u OR b.pid3=%u OR b.pid4=%u OR b.pid5=%u)",
|
||||
GetTablePostfix(), GetTablePostfix(), info->dwPID, info->bEmpire,
|
||||
info->dwPID, info->dwPID, info->dwPID, info->dwPID, info->dwPID);
|
||||
#else
|
||||
"(b.pid1=%u OR b.pid2=%u OR b.pid3=%u OR b.pid4=%u)",
|
||||
GetTablePostfix(), GetTablePostfix(), info->dwPID, info->bEmpire,
|
||||
info->dwPID, info->dwPID, info->dwPID, info->dwPID);
|
||||
#endif
|
||||
|
||||
SQLMsg * pMsg = CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER);
|
||||
|
||||
|
||||
@@ -157,7 +157,11 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG
|
||||
|
||||
sys_log(0, "LOGIN_BY_KEY success %s %lu %s", r.login, p->dwLoginKey, info->ip);
|
||||
char szQuery[QUERY_MAX_LEN];
|
||||
#ifdef ENABLE_PLAYER_PER_ACCOUNT5
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, pid5, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), r.id);
|
||||
#else
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), r.id);
|
||||
#endif
|
||||
CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info);
|
||||
}
|
||||
|
||||
@@ -179,7 +183,11 @@ void CClientManager::RESULT_LOGIN_BY_KEY(CPeer * peer, SQLMsg * msg)
|
||||
{
|
||||
DWORD account_id = info->pAccountTable->id;
|
||||
char szQuery[QUERY_MAX_LEN];
|
||||
#ifdef ENABLE_PLAYER_PER_ACCOUNT5
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, pid5, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), account_id);
|
||||
#else
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(), account_id);
|
||||
#endif
|
||||
std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER));
|
||||
|
||||
sys_log(0, "RESULT_LOGIN_BY_KEY FAIL player_index's NULL : ID:%d", account_id);
|
||||
@@ -231,7 +239,11 @@ void CClientManager::RESULT_PLAYER_INDEX_CREATE(CPeer * pkPeer, SQLMsg * msg)
|
||||
ClientHandleInfo * info = (ClientHandleInfo *) qi->pvData;
|
||||
|
||||
char szQuery[QUERY_MAX_LEN];
|
||||
#ifdef ENABLE_PLAYER_PER_ACCOUNT5
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, pid5, empire FROM player_index%s WHERE id=%u", GetTablePostfix(),
|
||||
#else
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT pid1, pid2, pid3, pid4, empire FROM player_index%s WHERE id=%u", GetTablePostfix(),
|
||||
#endif
|
||||
info->pAccountTable->id);
|
||||
CDBManager::instance().ReturnQuery(szQuery, QID_LOGIN_BY_KEY, pkPeer->GetHandle(), info);
|
||||
}
|
||||
|
||||
@@ -23,14 +23,19 @@ int CHARACTER::ChangeEmpire(BYTE empire)
|
||||
|
||||
char szQuery[1024+1];
|
||||
DWORD dwAID;
|
||||
DWORD dwPID[4];
|
||||
DWORD dwPID[PLAYER_PER_ACCOUNT];
|
||||
memset(dwPID, 0, sizeof(dwPID));
|
||||
|
||||
{
|
||||
// 1. 내 계정의 모든 pid를 얻어 온다
|
||||
snprintf(szQuery, sizeof(szQuery),
|
||||
#ifdef ENABLE_PLAYER_PER_ACCOUNT5
|
||||
"SELECT id, pid1, pid2, pid3, pid4, pid5 FROM player_index%s WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u OR pid5=%u AND empire=%u",
|
||||
get_table_postfix(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());
|
||||
#else
|
||||
"SELECT id, pid1, pid2, pid3, pid4 FROM player_index%s WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u AND empire=%u",
|
||||
get_table_postfix(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());
|
||||
#endif
|
||||
|
||||
std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(szQuery));
|
||||
|
||||
@@ -42,19 +47,18 @@ int CHARACTER::ChangeEmpire(BYTE empire)
|
||||
MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult);
|
||||
|
||||
str_to_number(dwAID, row[0]);
|
||||
str_to_number(dwPID[0], row[1]);
|
||||
str_to_number(dwPID[1], row[2]);
|
||||
str_to_number(dwPID[2], row[3]);
|
||||
str_to_number(dwPID[3], row[4]);
|
||||
for (int i = 0; i < PLAYER_PER_ACCOUNT; ++i)
|
||||
str_to_number(dwPID[i], row[i + 1]);
|
||||
}
|
||||
|
||||
const int loop = 4;
|
||||
// PORT: AVA2 kept 4 here, skipping the fifth character's guild/marriage check.
|
||||
const int loop = PLAYER_PER_ACCOUNT;
|
||||
|
||||
{
|
||||
// 2. 각 캐릭터의 길드 정보를 얻어온다.
|
||||
// 한 캐릭터라도 길드에 가입 되어 있다면, 제국 이동을 할 수 없다.
|
||||
DWORD dwGuildID[4];
|
||||
CGuild * pGuild[4];
|
||||
DWORD dwGuildID[PLAYER_PER_ACCOUNT];
|
||||
CGuild * pGuild[PLAYER_PER_ACCOUNT];
|
||||
SQLMsg * pMsg = NULL;
|
||||
|
||||
for (int i = 0; i < loop; ++i)
|
||||
@@ -102,8 +106,13 @@ int CHARACTER::ChangeEmpire(BYTE empire)
|
||||
|
||||
{
|
||||
// 4. db의 제국 정보를 업데이트 한다.
|
||||
#ifdef ENABLE_PLAYER_PER_ACCOUNT5
|
||||
snprintf(szQuery, sizeof(szQuery), "UPDATE player_index%s SET empire=%u WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u OR pid5=%u AND empire=%u",
|
||||
get_table_postfix(), empire, GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());
|
||||
#else
|
||||
snprintf(szQuery, sizeof(szQuery), "UPDATE player_index%s SET empire=%u WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u AND empire=%u",
|
||||
get_table_postfix(), empire, GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());
|
||||
#endif
|
||||
|
||||
std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(szQuery));
|
||||
|
||||
@@ -181,8 +190,13 @@ DWORD CHARACTER::GetAID() const
|
||||
char szQuery[1024+1];
|
||||
DWORD dwAID = 0;
|
||||
|
||||
#ifdef ENABLE_PLAYER_PER_ACCOUNT5
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT id FROM player_index%s WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u OR pid5=%u AND empire=%u",
|
||||
get_table_postfix(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());
|
||||
#else
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT id FROM player_index%s WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u AND empire=%u",
|
||||
get_table_postfix(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());
|
||||
#endif
|
||||
|
||||
SQLMsg* pMsg = DBManager::instance().DirectQuery(szQuery);
|
||||
|
||||
|
||||
@@ -571,9 +571,9 @@ typedef struct SPacketGTLogin
|
||||
|
||||
void CInputLogin::Entergame(LPDESC d, const char * data)
|
||||
{
|
||||
// PORT: wear40 moves dragon-soul/belt cells; older clients must not enter this world.
|
||||
// PORT: wear40 moves dragon-soul/belt cells; mt20261029 adds the conqueror fields and five slots; older clients must not enter this world.
|
||||
const char* revision=strstr(d->GetClientVersion(),"mt");
|
||||
if(!revision || atoi(revision+2)<20261028)
|
||||
if(!revision || atoi(revision+2)<20261029)
|
||||
{
|
||||
if(d->GetCharacter())d->GetCharacter()->ChatPacket(CHAT_TYPE_INFO,"Please update the client before entering the game.");
|
||||
d->DelayedDisconnect(1);return;
|
||||
|
||||
@@ -1034,11 +1034,13 @@ static void __LocaleService_Init_Taiwan()
|
||||
|
||||
static void __CheckPlayerSlot(const std::string& service_name)
|
||||
{
|
||||
#ifndef ENABLE_PLAYER_PER_ACCOUNT5
|
||||
if (PLAYER_PER_ACCOUNT != 4)
|
||||
{
|
||||
printf("<ERROR> PLAYER_PER_ACCOUNT = %d\n", PLAYER_PER_ACCOUNT);
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool LocaleService_Init(const std::string& c_rstServiceName)
|
||||
|
||||
Reference in New Issue
Block a user