forked from metin2/server
Removed unused highscore Lua & DB functions
This commit is contained in:
parent
05a1406c7c
commit
0c86f802ca
|
@ -174,8 +174,6 @@ guild.level
|
|||
guild.name
|
||||
guild.war_bet
|
||||
guild.war_enter
|
||||
highscore.register
|
||||
highscore.show
|
||||
horse.advance
|
||||
horse.feed
|
||||
horse.get_grade
|
||||
|
|
|
@ -49,7 +49,6 @@ enum
|
|||
HEADER_GD_ADD_AFFECT = 32,
|
||||
HEADER_GD_REMOVE_AFFECT = 33,
|
||||
|
||||
HEADER_GD_HIGHSCORE_REGISTER = 34,
|
||||
HEADER_GD_ITEM_FLUSH = 35,
|
||||
|
||||
HEADER_GD_PARTY_CREATE = 36,
|
||||
|
@ -847,14 +846,6 @@ typedef struct SPacketGDRemoveAffect
|
|||
BYTE bApplyOn;
|
||||
} TPacketGDRemoveAffect;
|
||||
|
||||
typedef struct SPacketGDHighscore
|
||||
{
|
||||
DWORD dwPID;
|
||||
LONG lValue;
|
||||
char cDir;
|
||||
char szBoard[21];
|
||||
} TPacketGDHighscore;
|
||||
|
||||
typedef struct SPacketPartyCreate
|
||||
{
|
||||
DWORD dwLeaderPID;
|
||||
|
|
|
@ -2475,10 +2475,6 @@ void CClientManager::ProcessPackets(CPeer * peer)
|
|||
QUERY_REMOVE_AFFECT(peer, (TPacketGDRemoveAffect *) data);
|
||||
break;
|
||||
|
||||
case HEADER_GD_HIGHSCORE_REGISTER:
|
||||
QUERY_HIGHSCORE_REGISTER(peer, (TPacketGDHighscore *) data);
|
||||
break;
|
||||
|
||||
case HEADER_GD_PARTY_CREATE:
|
||||
QUERY_PARTY_CREATE(peer, (TPacketPartyCreate*) data);
|
||||
break;
|
||||
|
@ -2922,11 +2918,6 @@ int CClientManager::AnalyzeQueryResult(SQLMsg * msg)
|
|||
RESULT_SAFEBOX_CHANGE_PASSWORD_SECOND(peer, msg);
|
||||
break;
|
||||
|
||||
case QID_HIGHSCORE_REGISTER:
|
||||
SPDLOG_DEBUG("QUERY_RESULT: HEADER_GD_HIGHSCORE_REGISTER {}", (void*) msg);
|
||||
RESULT_HIGHSCORE_REGISTER(peer, msg);
|
||||
break;
|
||||
|
||||
case QID_SAFEBOX_SAVE:
|
||||
case QID_ITEM_SAVE:
|
||||
case QID_ITEM_DESTROY:
|
||||
|
|
|
@ -310,9 +310,6 @@ class CClientManager : public singleton<CClientManager>
|
|||
|
||||
void SendPartyOnSetup(CPeer * peer);
|
||||
|
||||
void QUERY_HIGHSCORE_REGISTER(CPeer * peer, TPacketGDHighscore* data);
|
||||
void RESULT_HIGHSCORE_REGISTER(CPeer * pkPeer, SQLMsg * msg);
|
||||
|
||||
void QUERY_FLUSH_CACHE(CPeer * pkPeer, const char * c_pData);
|
||||
|
||||
void QUERY_PARTY_CREATE(CPeer * peer, TPacketPartyCreate* p);
|
||||
|
|
|
@ -1200,76 +1200,6 @@ void CClientManager::QUERY_REMOVE_AFFECT(CPeer * peer, TPacketGDRemoveAffect * p
|
|||
CDBManager::instance().AsyncQuery(queryStr);
|
||||
}
|
||||
|
||||
|
||||
void CClientManager::QUERY_HIGHSCORE_REGISTER(CPeer* peer, TPacketGDHighscore * data)
|
||||
{
|
||||
char szQuery[128];
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT value FROM highscore%s WHERE board='%s' AND pid = %u", GetTablePostfix(), data->szBoard, data->dwPID);
|
||||
|
||||
SPDLOG_DEBUG("HEADER_GD_HIGHSCORE_REGISTER: PID {}", data->dwPID);
|
||||
|
||||
ClientHandleInfo * pi = new ClientHandleInfo(0);
|
||||
strlcpy(pi->login, data->szBoard, sizeof(pi->login));
|
||||
pi->account_id = (DWORD)data->lValue;
|
||||
pi->player_id = data->dwPID;
|
||||
pi->account_index = (data->cDir > 0);
|
||||
|
||||
CDBManager::instance().ReturnQuery(szQuery, QID_HIGHSCORE_REGISTER, peer->GetHandle(), pi);
|
||||
}
|
||||
|
||||
void CClientManager::RESULT_HIGHSCORE_REGISTER(CPeer * pkPeer, SQLMsg * msg)
|
||||
{
|
||||
CQueryInfo * qi = (CQueryInfo *) msg->pvUserData;
|
||||
ClientHandleInfo * pi = (ClientHandleInfo *) qi->pvData;
|
||||
//DWORD dwHandle = pi->dwHandle;
|
||||
|
||||
char szBoard[21];
|
||||
strlcpy(szBoard, pi->login, sizeof(szBoard));
|
||||
int value = (int)pi->account_id;
|
||||
|
||||
SQLResult * res = msg->Get();
|
||||
|
||||
if (res->uiNumRows == 0)
|
||||
{
|
||||
// 새로운 하이스코어를 삽입
|
||||
char buf[256];
|
||||
snprintf(buf, sizeof(buf), "INSERT INTO highscore%s VALUES('%s', %u, %d)", GetTablePostfix(), szBoard, pi->player_id, value);
|
||||
CDBManager::instance().AsyncQuery(buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!res->pSQLResult)
|
||||
{
|
||||
delete pi;
|
||||
return;
|
||||
}
|
||||
|
||||
MYSQL_ROW row = mysql_fetch_row(res->pSQLResult);
|
||||
if (row && row[0])
|
||||
{
|
||||
int current_value = 0; str_to_number(current_value, row[0]);
|
||||
if (pi->account_index && current_value >= value || !pi->account_index && current_value <= value)
|
||||
{
|
||||
value = current_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[256];
|
||||
snprintf(buf, sizeof(buf), "REPLACE INTO highscore%s VALUES('%s', %u, %d)", GetTablePostfix(), szBoard, pi->player_id, value);
|
||||
CDBManager::instance().AsyncQuery(buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[256];
|
||||
snprintf(buf, sizeof(buf), "INSERT INTO highscore%s VALUES('%s', %u, %d)", GetTablePostfix(), szBoard, pi->player_id, value);
|
||||
CDBManager::instance().AsyncQuery(buf);
|
||||
}
|
||||
}
|
||||
// TODO: 이곳에서 하이스코어가 업데이트 되었는지 체크하여 공지를 뿌려야한다.
|
||||
delete pi;
|
||||
}
|
||||
|
||||
void CClientManager::InsertLogoutPlayer(DWORD pid)
|
||||
{
|
||||
TLogoutPlayerMap::iterator it = m_map_logout.find(pid);
|
||||
|
|
|
@ -20,19 +20,18 @@ enum QID
|
|||
QID_ITEM_DESTROY, // 11
|
||||
QID_QUEST_SAVE, // 12
|
||||
QID_PLAYER_SAVE, // 13
|
||||
QID_HIGHSCORE_REGISTER, // 14
|
||||
QID_PLAYER_DELETE, // 15
|
||||
QID_LOGIN_BY_KEY, // 16
|
||||
QID_PLAYER_INDEX_CREATE, // 17
|
||||
QID_ITEM_AWARD_LOAD, // 18
|
||||
QID_ITEM_AWARD_TAKEN, // 19
|
||||
QID_GUILD_RANKING, // 20
|
||||
QID_PLAYER_DELETE, // 14
|
||||
QID_LOGIN_BY_KEY, // 15
|
||||
QID_PLAYER_INDEX_CREATE, // 16
|
||||
QID_ITEM_AWARD_LOAD, // 17
|
||||
QID_ITEM_AWARD_TAKEN, // 18
|
||||
QID_GUILD_RANKING, // 19
|
||||
|
||||
// MYSHOP_PRICE_LIST
|
||||
QID_ITEMPRICE_SAVE, ///< 21, 아이템 가격정보 저장 쿼리
|
||||
QID_ITEMPRICE_DESTROY, ///< 22, 아이템 가격정보 삭제 쿼리
|
||||
QID_ITEMPRICE_LOAD_FOR_UPDATE, ///< 23, 가격정보 업데이트를 위한 아이템 가격정보 로드 쿼리
|
||||
QID_ITEMPRICE_LOAD, ///< 24, 아이템 가격정보 로드 쿼리
|
||||
QID_ITEMPRICE_SAVE, ///< 20, 아이템 가격정보 저장 쿼리
|
||||
QID_ITEMPRICE_DESTROY, ///< 21, 아이템 가격정보 삭제 쿼리
|
||||
QID_ITEMPRICE_LOAD_FOR_UPDATE, ///< 22, 가격정보 업데이트를 위한 아이템 가격정보 로드 쿼리
|
||||
QID_ITEMPRICE_LOAD, ///< 22, 아이템 가격정보 로드 쿼리
|
||||
// END_OF_MYSHOP_PRICE_LIST
|
||||
};
|
||||
|
||||
|
|
|
@ -973,39 +973,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
|||
}
|
||||
break;
|
||||
|
||||
case QID_HIGHSCORE_REGISTER:
|
||||
{
|
||||
THighscoreRegisterQueryInfo * info = (THighscoreRegisterQueryInfo *) qi->pvData;
|
||||
bool bQuery = true;
|
||||
|
||||
if (pMsg->Get()->uiNumRows)
|
||||
{
|
||||
MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);
|
||||
|
||||
if (row && row[0])
|
||||
{
|
||||
int iCur = 0;
|
||||
str_to_number(iCur, row[0]);
|
||||
|
||||
if ((info->bOrder && iCur >= info->iValue) ||
|
||||
(!info->bOrder && iCur <= info->iValue))
|
||||
bQuery = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (bQuery)
|
||||
Query("REPLACE INTO highscore%s VALUES('%s', %u, %d)",
|
||||
get_table_postfix(), info->szBoard, info->dwPID, info->iValue);
|
||||
|
||||
M2_DELETE(info);
|
||||
}
|
||||
break;
|
||||
|
||||
case QID_HIGHSCORE_SHOW:
|
||||
{
|
||||
}
|
||||
break;
|
||||
|
||||
// BLOCK_CHAT
|
||||
case QID_BLOCK_CHAT_LIST:
|
||||
{
|
||||
|
|
|
@ -16,8 +16,6 @@ enum
|
|||
QID_SAFEBOX_SIZE,
|
||||
QID_AUTH_LOGIN,
|
||||
QID_LOTTO,
|
||||
QID_HIGHSCORE_REGISTER,
|
||||
QID_HIGHSCORE_SHOW,
|
||||
QID_BILLING_GET_TIME,
|
||||
QID_BILLING_CHECK,
|
||||
|
||||
|
@ -162,13 +160,6 @@ template <class Functor> void DBManager::FuncAfterQuery(Functor f, const char* c
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
typedef struct SHighscoreRegisterQueryInfo
|
||||
{
|
||||
char szBoard[20+1];
|
||||
DWORD dwPID;
|
||||
int iValue;
|
||||
bool bOrder;
|
||||
} THighscoreRegisterQueryInfo;
|
||||
|
||||
extern void SendBillingExpire(const char * c_pszLogin, BYTE bBillType, int iSecs, CLoginData * pkLD);
|
||||
extern void VCardUse(LPCHARACTER CardOwner, LPCHARACTER CardTaker, LPITEM item);
|
||||
|
|
|
@ -649,26 +649,6 @@ void Take(fishing_event_info* info, LPCHARACTER ch)
|
|||
{
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이번에 잡은 물고기의 길이는 %.2fcm"), item->GetSocket(0)/100.f);
|
||||
}
|
||||
|
||||
if (quest::CQuestManager::instance().GetEventFlag("fishevent") > 0 && (info->fish_id == 5 || info->fish_id == 6))
|
||||
{
|
||||
// 이벤트 중이므로 기록한다.
|
||||
|
||||
TPacketGDHighscore p;
|
||||
p.dwPID = ch->GetPlayerID();
|
||||
p.lValue = item->GetSocket(0);
|
||||
|
||||
if (info->fish_id == 5)
|
||||
{
|
||||
strlcpy(p.szBoard, LC_TEXT("낚시이벤트월척붕어"), sizeof(p.szBoard));
|
||||
}
|
||||
else if (info->fish_id == 6)
|
||||
{
|
||||
strlcpy(p.szBoard, LC_TEXT("낚시이벤트잉어"), sizeof(p.szBoard));
|
||||
}
|
||||
|
||||
db_clientdesc->DBPacket(HEADER_GD_HIGHSCORE_REGISTER, 0, &p, sizeof(TPacketGDHighscore));
|
||||
}
|
||||
}
|
||||
|
||||
int map_idx = ch->GetMapIndex();
|
||||
|
|
|
@ -200,35 +200,6 @@ namespace quest
|
|||
}
|
||||
}
|
||||
|
||||
int highscore_show(lua_State* L)
|
||||
{
|
||||
CQuestManager & q = CQuestManager::instance();
|
||||
const char * pszBoardName = lua_tostring(L, 1);
|
||||
DWORD mypid = q.GetCurrentCharacterPtr()->GetPlayerID();
|
||||
bool bOrder = (int) lua_tonumber(L, 2) != 0 ? true : false;
|
||||
|
||||
DBManager::instance().ReturnQuery(QID_HIGHSCORE_SHOW, mypid, NULL,
|
||||
"SELECT h.pid, p.name, h.value FROM highscore%s as h, player%s as p WHERE h.board = '%s' AND h.pid = p.id ORDER BY h.value %s LIMIT 10",
|
||||
get_table_postfix(), get_table_postfix(), pszBoardName, bOrder ? "DESC" : "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int highscore_register(lua_State* L)
|
||||
{
|
||||
CQuestManager & q = CQuestManager::instance();
|
||||
|
||||
THighscoreRegisterQueryInfo * qi = M2_NEW THighscoreRegisterQueryInfo;
|
||||
|
||||
strlcpy(qi->szBoard, lua_tostring(L, 1), sizeof(qi->szBoard));
|
||||
qi->dwPID = q.GetCurrentCharacterPtr()->GetPlayerID();
|
||||
qi->iValue = (int) lua_tonumber(L, 2);
|
||||
qi->bOrder = (int) lua_tonumber(L, 3);
|
||||
|
||||
DBManager::instance().ReturnQuery(QID_HIGHSCORE_REGISTER, qi->dwPID, qi,
|
||||
"SELECT value FROM highscore%s WHERE board='%s' AND pid=%u", get_table_postfix(), qi->szBoard, qi->dwPID);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// "member" Lua functions
|
||||
//
|
||||
|
@ -496,17 +467,6 @@ namespace quest
|
|||
AddLuaFunctionTable("member", member_functions);
|
||||
}
|
||||
|
||||
{
|
||||
luaL_reg highscore_functions[] =
|
||||
{
|
||||
{ "register", highscore_register },
|
||||
{ "show", highscore_show },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
AddLuaFunctionTable("highscore", highscore_functions);
|
||||
}
|
||||
|
||||
{
|
||||
luaL_reg mob_functions[] =
|
||||
{
|
||||
|
|
|
@ -228,8 +228,6 @@ guild.get_name
|
|||
guild.war_bet
|
||||
guild.is_bet
|
||||
guild.get_warp_war_list
|
||||
highscore.register
|
||||
highscore.show
|
||||
mob.spawn
|
||||
mob.spawn_group
|
||||
q.setstate
|
||||
|
@ -335,8 +333,6 @@ guild.get_reserve_war_table
|
|||
guild.get_name
|
||||
guild.war_bet
|
||||
guild.is_bet
|
||||
highscore.register
|
||||
highscore.show
|
||||
mob.spawn
|
||||
mob.spawn_group
|
||||
q.setstate
|
||||
|
|
Loading…
Reference in New Issue