forked from metin2/server
Merge branch 'nightly' into comment-encoding
This commit is contained in:
commit
341bef9aba
@ -41,8 +41,6 @@ tstr IMPLEMENTOR
|
|||||||
tint IMPLEMENTOR
|
tint IMPLEMENTOR
|
||||||
tcon IMPLEMENTOR
|
tcon IMPLEMENTOR
|
||||||
mob_ld IMPLEMENTOR
|
mob_ld IMPLEMENTOR
|
||||||
pcbang_check IMPLEMENTOR
|
|
||||||
pcbang_update IMPLEMENTOR
|
|
||||||
setqf IMPLEMENTOR
|
setqf IMPLEMENTOR
|
||||||
delqf IMPLEMENTOR
|
delqf IMPLEMENTOR
|
||||||
effect IMPLEMENTOR
|
effect IMPLEMENTOR
|
||||||
|
@ -174,8 +174,6 @@ guild.level
|
|||||||
guild.name
|
guild.name
|
||||||
guild.war_bet
|
guild.war_bet
|
||||||
guild.war_enter
|
guild.war_enter
|
||||||
highscore.register
|
|
||||||
highscore.show
|
|
||||||
horse.advance
|
horse.advance
|
||||||
horse.feed
|
horse.feed
|
||||||
horse.get_grade
|
horse.get_grade
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
#ifndef __INC_METIN_II_COMMON_BILLING_H__
|
|
||||||
#define __INC_METIN_II_COMMON_BILLING_H__
|
|
||||||
|
|
||||||
enum EBillingTypes
|
|
||||||
{
|
|
||||||
BILLING_NONE,
|
|
||||||
BILLING_IP_FREE,
|
|
||||||
BILLING_FREE,
|
|
||||||
BILLING_IP_TIME,
|
|
||||||
BILLING_IP_DAY,
|
|
||||||
BILLING_TIME,
|
|
||||||
BILLING_DAY,
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -333,6 +333,8 @@ enum ELimitTypes
|
|||||||
LIMIT_DEX,
|
LIMIT_DEX,
|
||||||
LIMIT_INT,
|
LIMIT_INT,
|
||||||
LIMIT_CON,
|
LIMIT_CON,
|
||||||
|
|
||||||
|
// TODO: Remove this and re-check the validity of item_proto afterwards
|
||||||
LIMIT_PCBANG,
|
LIMIT_PCBANG,
|
||||||
|
|
||||||
/// 착용 여부와 상관 없이 실시간으로 시간 차감 (socket0에 소멸 시간이 박힘: unix_timestamp 타입)
|
/// 착용 여부와 상관 없이 실시간으로 시간 차감 (socket0에 소멸 시간이 박힘: unix_timestamp 타입)
|
||||||
|
@ -16,8 +16,6 @@ enum EMisc
|
|||||||
ABILITY_MAX_NUM = 50,
|
ABILITY_MAX_NUM = 50,
|
||||||
EMPIRE_MAX_NUM = 4,
|
EMPIRE_MAX_NUM = 4,
|
||||||
BANWORD_MAX_LEN = 24,
|
BANWORD_MAX_LEN = 24,
|
||||||
SMS_MAX_LEN = 80,
|
|
||||||
MOBILE_MAX_LEN = 32,
|
|
||||||
SOCIAL_ID_MAX_LEN = 18,
|
SOCIAL_ID_MAX_LEN = 18,
|
||||||
MAP_ALLOW_MAX_LEN = 128,
|
MAP_ALLOW_MAX_LEN = 128,
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ enum
|
|||||||
HEADER_GD_ADD_AFFECT = 32,
|
HEADER_GD_ADD_AFFECT = 32,
|
||||||
HEADER_GD_REMOVE_AFFECT = 33,
|
HEADER_GD_REMOVE_AFFECT = 33,
|
||||||
|
|
||||||
HEADER_GD_HIGHSCORE_REGISTER = 34,
|
|
||||||
HEADER_GD_ITEM_FLUSH = 35,
|
HEADER_GD_ITEM_FLUSH = 35,
|
||||||
|
|
||||||
HEADER_GD_PARTY_CREATE = 36,
|
HEADER_GD_PARTY_CREATE = 36,
|
||||||
@ -63,7 +62,6 @@ enum
|
|||||||
HEADER_GD_RELOAD_PROTO = 43,
|
HEADER_GD_RELOAD_PROTO = 43,
|
||||||
|
|
||||||
HEADER_GD_CHANGE_NAME = 44,
|
HEADER_GD_CHANGE_NAME = 44,
|
||||||
HEADER_GD_SMS = 45,
|
|
||||||
|
|
||||||
HEADER_GD_GUILD_CHANGE_LADDER_POINT = 46,
|
HEADER_GD_GUILD_CHANGE_LADDER_POINT = 46,
|
||||||
HEADER_GD_GUILD_USE_SKILL = 47,
|
HEADER_GD_GUILD_USE_SKILL = 47,
|
||||||
@ -99,9 +97,6 @@ enum
|
|||||||
|
|
||||||
HEADER_GD_AUTH_LOGIN = 100,
|
HEADER_GD_AUTH_LOGIN = 100,
|
||||||
HEADER_GD_LOGIN_BY_KEY = 101,
|
HEADER_GD_LOGIN_BY_KEY = 101,
|
||||||
HEADER_GD_BILLING_EXPIRE = 104,
|
|
||||||
HEADER_GD_VCARD = 105,
|
|
||||||
HEADER_GD_BILLING_CHECK = 106,
|
|
||||||
HEADER_GD_MALL_LOAD = 107,
|
HEADER_GD_MALL_LOAD = 107,
|
||||||
|
|
||||||
HEADER_GD_MYSHOP_PRICELIST_UPDATE = 108, ///< 가격정보 갱신 요청
|
HEADER_GD_MYSHOP_PRICELIST_UPDATE = 108, ///< 가격정보 갱신 요청
|
||||||
@ -109,12 +104,6 @@ enum
|
|||||||
|
|
||||||
HEADER_GD_BLOCK_CHAT = 110,
|
HEADER_GD_BLOCK_CHAT = 110,
|
||||||
|
|
||||||
// PCBANG_IP_LIST_BY_AUTH
|
|
||||||
HEADER_GD_PCBANG_REQUEST_IP_LIST = 111,
|
|
||||||
HEADER_GD_PCBANG_CLEAR_IP_LIST = 112,
|
|
||||||
HEADER_GD_PCBANG_INSERT_IP = 113,
|
|
||||||
// END_OF_PCBANG_IP_LIST_BY_AUTH
|
|
||||||
|
|
||||||
HEADER_GD_HAMMER_OF_TOR = 114,
|
HEADER_GD_HAMMER_OF_TOR = 114,
|
||||||
HEADER_GD_RELOAD_ADMIN = 115, ///<운영자 정보 요청
|
HEADER_GD_RELOAD_ADMIN = 115, ///<운영자 정보 요청
|
||||||
HEADER_GD_BREAK_MARRIAGE = 116, ///< 결혼 파기
|
HEADER_GD_BREAK_MARRIAGE = 116, ///< 결혼 파기
|
||||||
@ -129,8 +118,6 @@ enum
|
|||||||
HEADER_GD_DEC_MONARCH_MONEY = 125,
|
HEADER_GD_DEC_MONARCH_MONEY = 125,
|
||||||
|
|
||||||
HEADER_GD_CHANGE_MONARCH_LORD = 126,
|
HEADER_GD_CHANGE_MONARCH_LORD = 126,
|
||||||
HEADER_GD_BLOCK_COUNTRY_IP = 127, // 광대역 IP-Block
|
|
||||||
HEADER_GD_BLOCK_EXCEPTION = 128, // 광대역 IP-Block 예외
|
|
||||||
|
|
||||||
HEADER_GD_REQ_CHANGE_GUILD_MASTER = 129,
|
HEADER_GD_REQ_CHANGE_GUILD_MASTER = 129,
|
||||||
|
|
||||||
@ -238,12 +225,6 @@ enum
|
|||||||
|
|
||||||
HEADER_DG_CHANGE_CHARACTER_PRIV = 127,
|
HEADER_DG_CHANGE_CHARACTER_PRIV = 127,
|
||||||
|
|
||||||
HEADER_DG_BILLING_REPAIR = 128,
|
|
||||||
HEADER_DG_BILLING_EXPIRE = 129,
|
|
||||||
HEADER_DG_BILLING_LOGIN = 130,
|
|
||||||
HEADER_DG_VCARD = 131,
|
|
||||||
HEADER_DG_BILLING_CHECK = 132,
|
|
||||||
|
|
||||||
HEADER_DG_CREATE_OBJECT = 140,
|
HEADER_DG_CREATE_OBJECT = 140,
|
||||||
HEADER_DG_DELETE_OBJECT = 141,
|
HEADER_DG_DELETE_OBJECT = 141,
|
||||||
HEADER_DG_UPDATE_LAND = 142,
|
HEADER_DG_UPDATE_LAND = 142,
|
||||||
@ -272,8 +253,6 @@ enum
|
|||||||
|
|
||||||
HEADER_DG_CHANGE_MONARCH_LORD_ACK = 169,
|
HEADER_DG_CHANGE_MONARCH_LORD_ACK = 169,
|
||||||
HEADER_DG_UPDATE_MONARCH_INFO = 170,
|
HEADER_DG_UPDATE_MONARCH_INFO = 170,
|
||||||
HEADER_DG_BLOCK_COUNTRY_IP = 171, // 광대역 IP-Block
|
|
||||||
HEADER_DG_BLOCK_EXCEPTION = 172, // 광대역 IP-Block 예외 account
|
|
||||||
|
|
||||||
HEADER_DG_ACK_CHANGE_GUILD_MASTER = 173,
|
HEADER_DG_ACK_CHANGE_GUILD_MASTER = 173,
|
||||||
|
|
||||||
@ -441,7 +420,6 @@ typedef struct SPlayerTable
|
|||||||
|
|
||||||
BYTE skill_group;
|
BYTE skill_group;
|
||||||
LONG lAlignment;
|
LONG lAlignment;
|
||||||
char szMobile[MOBILE_MAX_LEN + 1];
|
|
||||||
|
|
||||||
WORD stat_reset_count;
|
WORD stat_reset_count;
|
||||||
|
|
||||||
@ -851,14 +829,6 @@ typedef struct SPacketGDRemoveAffect
|
|||||||
BYTE bApplyOn;
|
BYTE bApplyOn;
|
||||||
} TPacketGDRemoveAffect;
|
} TPacketGDRemoveAffect;
|
||||||
|
|
||||||
typedef struct SPacketGDHighscore
|
|
||||||
{
|
|
||||||
DWORD dwPID;
|
|
||||||
LONG lValue;
|
|
||||||
char cDir;
|
|
||||||
char szBoard[21];
|
|
||||||
} TPacketGDHighscore;
|
|
||||||
|
|
||||||
typedef struct SPacketPartyCreate
|
typedef struct SPacketPartyCreate
|
||||||
{
|
{
|
||||||
DWORD dwLeaderPID;
|
DWORD dwLeaderPID;
|
||||||
@ -997,14 +967,6 @@ typedef struct SPacketGuildLadderPoint
|
|||||||
LONG lChange;
|
LONG lChange;
|
||||||
} TPacketGuildLadderPoint;
|
} TPacketGuildLadderPoint;
|
||||||
|
|
||||||
typedef struct SPacketGDSMS
|
|
||||||
{
|
|
||||||
char szFrom[CHARACTER_NAME_MAX_LEN + 1];
|
|
||||||
char szTo[CHARACTER_NAME_MAX_LEN + 1];
|
|
||||||
char szMobile[MOBILE_MAX_LEN + 1];
|
|
||||||
char szMsg[SMS_MAX_LEN + 1];
|
|
||||||
} TPacketGDSMS;
|
|
||||||
|
|
||||||
typedef struct SPacketGuildUseSkill
|
typedef struct SPacketGuildUseSkill
|
||||||
{
|
{
|
||||||
DWORD dwGuild;
|
DWORD dwGuild;
|
||||||
@ -1032,9 +994,7 @@ typedef struct SPacketGDAuthLogin
|
|||||||
char szLogin[LOGIN_MAX_LEN + 1];
|
char szLogin[LOGIN_MAX_LEN + 1];
|
||||||
char szSocialID[SOCIAL_ID_MAX_LEN + 1];
|
char szSocialID[SOCIAL_ID_MAX_LEN + 1];
|
||||||
DWORD adwClientKey[4];
|
DWORD adwClientKey[4];
|
||||||
BYTE bBillType;
|
DWORD iPremiumTimes[PREMIUM_MAX_NUM];
|
||||||
DWORD dwBillID;
|
|
||||||
DWORD iPremiumTimes[PREMIUM_MAX_NUM];
|
|
||||||
} TPacketGDAuthLogin;
|
} TPacketGDAuthLogin;
|
||||||
|
|
||||||
typedef struct SPacketGDLoginByKey
|
typedef struct SPacketGDLoginByKey
|
||||||
@ -1146,26 +1106,6 @@ typedef struct SPacketSetEventFlag
|
|||||||
LONG lValue;
|
LONG lValue;
|
||||||
} TPacketSetEventFlag;
|
} TPacketSetEventFlag;
|
||||||
|
|
||||||
typedef struct SPacketBillingLogin
|
|
||||||
{
|
|
||||||
DWORD dwLoginKey;
|
|
||||||
BYTE bLogin;
|
|
||||||
} TPacketBillingLogin;
|
|
||||||
|
|
||||||
typedef struct SPacketBillingRepair
|
|
||||||
{
|
|
||||||
DWORD dwLoginKey;
|
|
||||||
char szLogin[LOGIN_MAX_LEN + 1];
|
|
||||||
char szHost[MAX_HOST_LENGTH + 1];
|
|
||||||
} TPacketBillingRepair;
|
|
||||||
|
|
||||||
typedef struct SPacketBillingExpire
|
|
||||||
{
|
|
||||||
char szLogin[LOGIN_MAX_LEN + 1];
|
|
||||||
BYTE bBillType;
|
|
||||||
DWORD dwRemainSeconds;
|
|
||||||
} TPacketBillingExpire;
|
|
||||||
|
|
||||||
typedef struct SPacketLoginOnSetup
|
typedef struct SPacketLoginOnSetup
|
||||||
{
|
{
|
||||||
DWORD dwID;
|
DWORD dwID;
|
||||||
@ -1193,15 +1133,6 @@ typedef struct SPacketGDHammerOfTor
|
|||||||
DWORD delay;
|
DWORD delay;
|
||||||
} TPacketGDHammerOfTor;
|
} TPacketGDHammerOfTor;
|
||||||
|
|
||||||
typedef struct SPacketGDVCard
|
|
||||||
{
|
|
||||||
DWORD dwID;
|
|
||||||
char szSellCharacter[CHARACTER_NAME_MAX_LEN + 1];
|
|
||||||
char szSellAccount[LOGIN_MAX_LEN + 1];
|
|
||||||
char szBuyCharacter[CHARACTER_NAME_MAX_LEN + 1];
|
|
||||||
char szBuyAccount[LOGIN_MAX_LEN + 1];
|
|
||||||
} TPacketGDVCard;
|
|
||||||
|
|
||||||
typedef struct SGuildReserve
|
typedef struct SGuildReserve
|
||||||
{
|
{
|
||||||
DWORD dwID;
|
DWORD dwID;
|
||||||
@ -1306,15 +1237,6 @@ typedef struct
|
|||||||
LONG lDuration;
|
LONG lDuration;
|
||||||
} TPacketBlockChat;
|
} TPacketBlockChat;
|
||||||
|
|
||||||
// PCBANG_IP_LIST
|
|
||||||
typedef struct SPacketPCBangIP
|
|
||||||
{
|
|
||||||
DWORD id;
|
|
||||||
DWORD ip;
|
|
||||||
} TPacketPCBangIP;
|
|
||||||
// END_OF_PCBANG_IP_LIST
|
|
||||||
|
|
||||||
|
|
||||||
//ADMIN_MANAGER
|
//ADMIN_MANAGER
|
||||||
typedef struct TAdminInfo
|
typedef struct TAdminInfo
|
||||||
{
|
{
|
||||||
@ -1379,26 +1301,6 @@ typedef struct tChangeMonarchLordACK
|
|||||||
char szDate[32];
|
char szDate[32];
|
||||||
} TPacketChangeMonarchLordACK;
|
} TPacketChangeMonarchLordACK;
|
||||||
|
|
||||||
// Block Country Ip
|
|
||||||
typedef struct tBlockCountryIp
|
|
||||||
{
|
|
||||||
DWORD ip_from;
|
|
||||||
DWORD ip_to;
|
|
||||||
} TPacketBlockCountryIp;
|
|
||||||
|
|
||||||
enum EBlockExceptionCommand
|
|
||||||
{
|
|
||||||
BLOCK_EXCEPTION_CMD_ADD = 1,
|
|
||||||
BLOCK_EXCEPTION_CMD_DEL = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Block Exception Account
|
|
||||||
typedef struct tBlockException
|
|
||||||
{
|
|
||||||
BYTE cmd; // 1 == add, 2 == delete
|
|
||||||
char login[LOGIN_MAX_LEN + 1];
|
|
||||||
}TPacketBlockException;
|
|
||||||
|
|
||||||
typedef struct tChangeGuildMaster
|
typedef struct tChangeGuildMaster
|
||||||
{
|
{
|
||||||
DWORD dwGuildID;
|
DWORD dwGuildID;
|
||||||
|
@ -1,214 +0,0 @@
|
|||||||
// vim:ts=4 sw=4
|
|
||||||
/*********************************************************************
|
|
||||||
* date : 2007.05.31
|
|
||||||
* file : BlockCountry.cpp
|
|
||||||
* author : mhh
|
|
||||||
* description :
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
#include "BlockCountry.h"
|
|
||||||
|
|
||||||
#include "DBManager.h"
|
|
||||||
|
|
||||||
#define DO_ALL_BLOCK_IP(iter) \
|
|
||||||
for ((iter) = m_block_ip.begin(); (iter) != m_block_ip.end(); ++(iter))
|
|
||||||
|
|
||||||
#define DO_ALL_BLOCK_EXCEPTION(iter) \
|
|
||||||
for ((iter) = m_block_exception.begin(); (iter) != m_block_exception.end(); ++(iter))
|
|
||||||
|
|
||||||
CBlockCountry::CBlockCountry()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CBlockCountry::~CBlockCountry()
|
|
||||||
{
|
|
||||||
BLOCK_IP *block_ip;
|
|
||||||
BLOCK_IP_VECTOR::iterator iter;
|
|
||||||
|
|
||||||
DO_ALL_BLOCK_IP(iter)
|
|
||||||
{
|
|
||||||
block_ip = *iter;
|
|
||||||
delete block_ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_block_ip.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool CBlockCountry::Load()
|
|
||||||
{
|
|
||||||
// load blocked ip
|
|
||||||
{
|
|
||||||
char szQuery[256];
|
|
||||||
snprintf(szQuery, sizeof(szQuery), "SELECT IP_FROM, IP_TO, COUNTRY_NAME FROM iptocountry");
|
|
||||||
SQLMsg * pMsg = CDBManager::instance().DirectQuery(szQuery, SQL_ACCOUNT);
|
|
||||||
|
|
||||||
if (pMsg->Get()->uiNumRows == 0)
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR(" DirectQuery failed({})", szQuery);
|
|
||||||
delete pMsg;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MYSQL_ROW row;
|
|
||||||
for (int n = 0; (row = mysql_fetch_row(pMsg->Get()->pSQLResult)) != NULL; ++n)
|
|
||||||
{
|
|
||||||
BLOCK_IP *block_ip = new BLOCK_IP;
|
|
||||||
block_ip->ip_from = strtoul(row[0], NULL, 10);
|
|
||||||
block_ip->ip_to = strtoul(row[1], NULL, 10);
|
|
||||||
strlcpy(block_ip->country, row[2], sizeof(block_ip->country));
|
|
||||||
|
|
||||||
m_block_ip.push_back(block_ip);
|
|
||||||
SPDLOG_DEBUG("BLOCKED_IP : {} - {}", block_ip->ip_from, block_ip->ip_to);
|
|
||||||
|
|
||||||
}
|
|
||||||
delete pMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// load block exception account
|
|
||||||
{
|
|
||||||
char szQuery[256];
|
|
||||||
snprintf(szQuery, sizeof(szQuery), "SELECT login FROM block_exception");
|
|
||||||
SQLMsg * pMsg = CDBManager::instance().DirectQuery(szQuery, SQL_ACCOUNT);
|
|
||||||
|
|
||||||
if (pMsg->Get()->uiNumRows == 0)
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR(" DirectQuery failed({})", szQuery);
|
|
||||||
delete pMsg;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
MYSQL_ROW row;
|
|
||||||
for (int n = 0; (row = mysql_fetch_row(pMsg->Get()->pSQLResult)) != NULL; ++n)
|
|
||||||
{
|
|
||||||
const char *login = row[0];
|
|
||||||
|
|
||||||
m_block_exception.push_back(strdup(login));
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("BLOCK_EXCEPTION = {}", login);
|
|
||||||
|
|
||||||
}
|
|
||||||
delete pMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CBlockCountry::IsBlockedCountryIp(const char *user_ip)
|
|
||||||
{
|
|
||||||
BLOCK_IP* block_ip;
|
|
||||||
BLOCK_IP_VECTOR::iterator iter;
|
|
||||||
struct in_addr st_addr;
|
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
if (0 == inet_aton(user_ip, &st_addr))
|
|
||||||
#else
|
|
||||||
unsigned int in_address;
|
|
||||||
in_address = inet_addr(user_ip);
|
|
||||||
st_addr.s_addr = in_address;
|
|
||||||
if (INADDR_NONE == in_address)
|
|
||||||
#endif
|
|
||||||
return true; // 아이피가 괴상하니 일단 블럭처리
|
|
||||||
|
|
||||||
DO_ALL_BLOCK_IP(iter)
|
|
||||||
{
|
|
||||||
block_ip = *iter;
|
|
||||||
|
|
||||||
if (st_addr.s_addr >= block_ip->ip_from && st_addr.s_addr <= block_ip->ip_to)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CBlockCountry::SendBlockedCountryIp(CPeer *peer)
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("SendBlockedCountryIp start");
|
|
||||||
BLOCK_IP *block_ip;
|
|
||||||
BLOCK_IP_VECTOR::iterator iter;
|
|
||||||
TPacketBlockCountryIp packet;
|
|
||||||
|
|
||||||
DO_ALL_BLOCK_IP(iter)
|
|
||||||
{
|
|
||||||
block_ip = *iter;
|
|
||||||
|
|
||||||
packet.ip_from = block_ip->ip_from;
|
|
||||||
packet.ip_to = block_ip->ip_to;
|
|
||||||
|
|
||||||
peer->EncodeHeader(HEADER_DG_BLOCK_COUNTRY_IP, 0, sizeof(TPacketBlockCountryIp));
|
|
||||||
peer->Encode(&packet, sizeof(packet));
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("[DONE] CBlockCountry::SendBlockedCountryIp() : count = {}",
|
|
||||||
m_block_ip.size());
|
|
||||||
SPDLOG_DEBUG("SendBlockedCountryIp end");
|
|
||||||
} /* end of CBlockCountry::SendBlockedCountryIp() */
|
|
||||||
|
|
||||||
|
|
||||||
void CBlockCountry::SendBlockException(CPeer *peer)
|
|
||||||
{
|
|
||||||
BLOCK_EXCEPTION_VECTOR::iterator iter;
|
|
||||||
|
|
||||||
DO_ALL_BLOCK_EXCEPTION(iter)
|
|
||||||
{
|
|
||||||
const char *login = *iter;
|
|
||||||
|
|
||||||
this->SendBlockExceptionOne(peer, login, BLOCK_EXCEPTION_CMD_ADD);
|
|
||||||
}
|
|
||||||
} /* end of CBlockCountry::SendBlockException() */
|
|
||||||
|
|
||||||
void CBlockCountry::SendBlockExceptionOne(CPeer *peer, const char *login, BYTE cmd)
|
|
||||||
{
|
|
||||||
if (NULL == peer || NULL == login)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (BLOCK_EXCEPTION_CMD_ADD != cmd && BLOCK_EXCEPTION_CMD_DEL != cmd)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TPacketBlockException packet;
|
|
||||||
|
|
||||||
packet.cmd = cmd;
|
|
||||||
strlcpy(packet.login, login, sizeof(packet.login));
|
|
||||||
|
|
||||||
peer->EncodeHeader(HEADER_DG_BLOCK_EXCEPTION, 0, sizeof(TPacketBlockException));
|
|
||||||
peer->Encode(&packet, sizeof(packet));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CBlockCountry::AddBlockException(const char *login)
|
|
||||||
{
|
|
||||||
BLOCK_EXCEPTION_VECTOR::iterator iter;
|
|
||||||
DO_ALL_BLOCK_EXCEPTION(iter)
|
|
||||||
{
|
|
||||||
const char *saved_login = *iter;
|
|
||||||
|
|
||||||
if (!strcmp(saved_login, login))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_block_exception.push_back(strdup(login));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CBlockCountry::DelBlockException(const char *login)
|
|
||||||
{
|
|
||||||
BLOCK_EXCEPTION_VECTOR::iterator iter;
|
|
||||||
DO_ALL_BLOCK_EXCEPTION(iter)
|
|
||||||
{
|
|
||||||
const char *saved_login = *iter;
|
|
||||||
|
|
||||||
if (!strcmp(saved_login, login))
|
|
||||||
{
|
|
||||||
::free((void*)saved_login);
|
|
||||||
m_block_exception.erase(iter);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
// vim: ts=4 sw=4
|
|
||||||
// Date : 2007.05.31
|
|
||||||
// File : BlockCountry.h
|
|
||||||
// Author : mhh
|
|
||||||
// Description :
|
|
||||||
|
|
||||||
#ifndef __INC_METIN_II_BLOCKCOUNTRY_H__
|
|
||||||
#define __INC_METIN_II_BLOCKCOUNTRY_H__
|
|
||||||
|
|
||||||
#include "Peer.h"
|
|
||||||
|
|
||||||
#define MAX_COUNTRY_NAME_LENGTH 50
|
|
||||||
|
|
||||||
class CBlockCountry : public singleton<CBlockCountry>
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
struct BLOCK_IP
|
|
||||||
{
|
|
||||||
DWORD ip_from;
|
|
||||||
DWORD ip_to;
|
|
||||||
char country[MAX_COUNTRY_NAME_LENGTH + 1];
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::vector<BLOCK_IP*> BLOCK_IP_VECTOR;
|
|
||||||
BLOCK_IP_VECTOR m_block_ip;
|
|
||||||
|
|
||||||
typedef std::vector<const char*> BLOCK_EXCEPTION_VECTOR;
|
|
||||||
BLOCK_EXCEPTION_VECTOR m_block_exception;
|
|
||||||
|
|
||||||
public:
|
|
||||||
CBlockCountry();
|
|
||||||
~CBlockCountry();
|
|
||||||
|
|
||||||
public:
|
|
||||||
bool Load();
|
|
||||||
bool IsBlockedCountryIp(const char *user_ip);
|
|
||||||
void SendBlockedCountryIp(CPeer *peer);
|
|
||||||
void SendBlockException(CPeer *peer);
|
|
||||||
void SendBlockExceptionOne(CPeer *peer, const char *login, BYTE cmd);
|
|
||||||
void AddBlockException(const char *login);
|
|
||||||
void DelBlockException(const char *login);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,6 +1,5 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include <common/billing.h>
|
|
||||||
#include <common/building.h>
|
#include <common/building.h>
|
||||||
#include <common/VnumHelper.h>
|
#include <common/VnumHelper.h>
|
||||||
#include "../../libgame/include/grid.h"
|
#include "../../libgame/include/grid.h"
|
||||||
@ -17,7 +16,6 @@
|
|||||||
#include "ItemAwardManager.h"
|
#include "ItemAwardManager.h"
|
||||||
#include "Marriage.h"
|
#include "Marriage.h"
|
||||||
#include "Monarch.h"
|
#include "Monarch.h"
|
||||||
#include "BlockCountry.h"
|
|
||||||
#include "ItemIDRangeManager.h"
|
#include "ItemIDRangeManager.h"
|
||||||
#include "Cache.h"
|
#include "Cache.h"
|
||||||
#ifdef __AUCTION__
|
#ifdef __AUCTION__
|
||||||
@ -1144,7 +1142,6 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
|||||||
SPDLOG_DEBUG("AUTH_PEER ptr {}", (void*) peer);
|
SPDLOG_DEBUG("AUTH_PEER ptr {}", (void*) peer);
|
||||||
|
|
||||||
m_pkAuthPeer = peer;
|
m_pkAuthPeer = peer;
|
||||||
SendAllLoginToBilling();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1287,10 +1284,9 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// 로그인 및 빌링정보 보내기
|
// Log in the player
|
||||||
//
|
//
|
||||||
TPacketLoginOnSetup * pck = (TPacketLoginOnSetup *) c_pData;;
|
TPacketLoginOnSetup * pck = (TPacketLoginOnSetup *) c_pData;
|
||||||
std::vector<TPacketBillingRepair> vec_repair;
|
|
||||||
|
|
||||||
for (DWORD c = 0; c < p->dwLoginCount; ++c, ++pck)
|
for (DWORD c = 0; c < p->dwLoginCount; ++c, ++pck)
|
||||||
{
|
{
|
||||||
@ -1313,29 +1309,11 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
|||||||
{
|
{
|
||||||
SPDLOG_DEBUG("SETUP: login {} {} login_key {} host {}", pck->dwID, pck->szLogin, pck->dwLoginKey, pck->szHost);
|
SPDLOG_DEBUG("SETUP: login {} {} login_key {} host {}", pck->dwID, pck->szLogin, pck->dwLoginKey, pck->szHost);
|
||||||
pkLD->SetPlay(true);
|
pkLD->SetPlay(true);
|
||||||
|
|
||||||
if (m_pkAuthPeer)
|
|
||||||
{
|
|
||||||
TPacketBillingRepair pck_repair;
|
|
||||||
pck_repair.dwLoginKey = pkLD->GetKey();
|
|
||||||
strlcpy(pck_repair.szLogin, pck->szLogin, sizeof(pck_repair.szLogin));
|
|
||||||
strlcpy(pck_repair.szHost, pck->szHost, sizeof(pck_repair.szHost));
|
|
||||||
vec_repair.push_back(pck_repair);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SPDLOG_DEBUG("SETUP: login_fail {} {} login_key {}", pck->dwID, pck->szLogin, pck->dwLoginKey);
|
SPDLOG_DEBUG("SETUP: login_fail {} {} login_key {}", pck->dwID, pck->szLogin, pck->dwLoginKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pkAuthPeer && !vec_repair.empty())
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("REPAIR size {}", vec_repair.size());
|
|
||||||
|
|
||||||
m_pkAuthPeer->EncodeHeader(HEADER_DG_BILLING_REPAIR, 0, sizeof(DWORD) + sizeof(TPacketBillingRepair) * vec_repair.size());
|
|
||||||
m_pkAuthPeer->EncodeDWORD(vec_repair.size());
|
|
||||||
m_pkAuthPeer->Encode(&vec_repair[0], sizeof(TPacketBillingRepair) * vec_repair.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
SendPartyOnSetup(peer);
|
SendPartyOnSetup(peer);
|
||||||
CGuildManager::instance().OnSetup(peer);
|
CGuildManager::instance().OnSetup(peer);
|
||||||
CPrivManager::instance().SendPrivOnSetup(peer);
|
CPrivManager::instance().SendPrivOnSetup(peer);
|
||||||
@ -1687,22 +1665,6 @@ void CClientManager::QUERY_FLUSH_CACHE(CPeer * pkPeer, const char * c_pData)
|
|||||||
delete pkCache;
|
delete pkCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::QUERY_SMS(CPeer * pkPeer, TPacketGDSMS * pack)
|
|
||||||
{
|
|
||||||
char szQuery[QUERY_MAX_LEN];
|
|
||||||
|
|
||||||
char szMsg[256+1];
|
|
||||||
//unsigned int len = CDBManager::instance().EscapeString(szMsg, pack->szMsg, strlen(pack->szMsg), SQL_ACCOUNT);
|
|
||||||
unsigned int len = CDBManager::instance().EscapeString(szMsg, pack->szMsg, strlen(pack->szMsg));
|
|
||||||
szMsg[len] = '\0';
|
|
||||||
|
|
||||||
snprintf(szQuery, sizeof(szQuery),
|
|
||||||
"INSERT INTO sms_pool (server, sender, receiver, mobile, msg) VALUES(%d, '%s', '%s', '%s', '%s')",
|
|
||||||
(m_iPlayerIDStart + 2) / 3, pack->szFrom, pack->szTo, pack->szMobile, szMsg);
|
|
||||||
|
|
||||||
CDBManager::instance().AsyncQuery(szQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CClientManager::QUERY_RELOAD_PROTO()
|
void CClientManager::QUERY_RELOAD_PROTO()
|
||||||
{
|
{
|
||||||
if (!InitializeTables())
|
if (!InitializeTables())
|
||||||
@ -1844,8 +1806,6 @@ void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDA
|
|||||||
|
|
||||||
pkLD->SetKey(p->dwLoginKey);
|
pkLD->SetKey(p->dwLoginKey);
|
||||||
pkLD->SetClientKey(p->adwClientKey);
|
pkLD->SetClientKey(p->adwClientKey);
|
||||||
pkLD->SetBillType(p->bBillType);
|
|
||||||
pkLD->SetBillID(p->dwBillID);
|
|
||||||
pkLD->SetPremium(p->iPremiumTimes);
|
pkLD->SetPremium(p->iPremiumTimes);
|
||||||
|
|
||||||
TAccountTable & r = pkLD->GetAccountRef();
|
TAccountTable & r = pkLD->GetAccountRef();
|
||||||
@ -1868,109 +1828,6 @@ void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::BillingExpire(TPacketBillingExpire * p)
|
|
||||||
{
|
|
||||||
char key[LOGIN_MAX_LEN + 1];
|
|
||||||
trim_and_lower(p->szLogin, key, sizeof(key));
|
|
||||||
|
|
||||||
switch (p->bBillType)
|
|
||||||
{
|
|
||||||
case BILLING_IP_TIME:
|
|
||||||
case BILLING_IP_DAY:
|
|
||||||
{
|
|
||||||
DWORD dwIPID = 0;
|
|
||||||
str_to_number(dwIPID, p->szLogin);
|
|
||||||
|
|
||||||
TLogonAccountMap::iterator it = m_map_kLogonAccount.begin();
|
|
||||||
|
|
||||||
while (it != m_map_kLogonAccount.end())
|
|
||||||
{
|
|
||||||
CLoginData * pkLD = (it++)->second;
|
|
||||||
|
|
||||||
if (pkLD->GetBillID() == dwIPID)
|
|
||||||
{
|
|
||||||
CPeer * pkPeer = GetPeer(pkLD->GetConnectedPeerHandle());
|
|
||||||
|
|
||||||
if (pkPeer)
|
|
||||||
{
|
|
||||||
strlcpy(p->szLogin, pkLD->GetAccountRef().login, sizeof(p->szLogin));
|
|
||||||
pkPeer->EncodeHeader(HEADER_DG_BILLING_EXPIRE, 0, sizeof(TPacketBillingExpire));
|
|
||||||
pkPeer->Encode(p, sizeof(TPacketBillingExpire));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BILLING_TIME:
|
|
||||||
case BILLING_DAY:
|
|
||||||
{
|
|
||||||
TLogonAccountMap::iterator it = m_map_kLogonAccount.find(key);
|
|
||||||
|
|
||||||
if (it != m_map_kLogonAccount.end())
|
|
||||||
{
|
|
||||||
CLoginData * pkLD = it->second;
|
|
||||||
|
|
||||||
CPeer * pkPeer = GetPeer(pkLD->GetConnectedPeerHandle());
|
|
||||||
|
|
||||||
if (pkPeer)
|
|
||||||
{
|
|
||||||
pkPeer->EncodeHeader(HEADER_DG_BILLING_EXPIRE, 0, sizeof(TPacketBillingExpire));
|
|
||||||
pkPeer->Encode(p, sizeof(TPacketBillingExpire));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CClientManager::BillingCheck(const char * data)
|
|
||||||
{
|
|
||||||
if (!m_pkAuthPeer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
time_t curTime = GetCurrentTime();
|
|
||||||
|
|
||||||
DWORD dwCount = *(DWORD *) data;
|
|
||||||
data += sizeof(DWORD);
|
|
||||||
|
|
||||||
std::vector<DWORD> vec;
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("BillingCheck: size {}", dwCount);
|
|
||||||
|
|
||||||
for (DWORD i = 0; i < dwCount; ++i)
|
|
||||||
{
|
|
||||||
DWORD dwKey = *(DWORD *) data;
|
|
||||||
data += sizeof(DWORD);
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("BillingCheck: {}", dwKey);
|
|
||||||
|
|
||||||
TLoginDataByLoginKey::iterator it = m_map_pkLoginData.find(dwKey);
|
|
||||||
|
|
||||||
if (it == m_map_pkLoginData.end())
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("BillingCheck: key not exist: {}", dwKey);
|
|
||||||
vec.push_back(dwKey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CLoginData * pkLD = it->second;
|
|
||||||
|
|
||||||
if (!pkLD->IsPlay() && curTime - pkLD->GetLastPlayTime() > 180)
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("BillingCheck: not login: {}", dwKey);
|
|
||||||
vec.push_back(dwKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pkAuthPeer->EncodeHeader(HEADER_DG_BILLING_CHECK, 0, sizeof(DWORD) + sizeof(DWORD) * vec.size());
|
|
||||||
m_pkAuthPeer->EncodeDWORD(vec.size());
|
|
||||||
|
|
||||||
if (!vec.empty())
|
|
||||||
m_pkAuthPeer->Encode(&vec[0], sizeof(DWORD) * vec.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CClientManager::GuildDepositMoney(TPacketGDGuildMoney* p)
|
void CClientManager::GuildDepositMoney(TPacketGDGuildMoney* p)
|
||||||
{
|
{
|
||||||
CGuildManager::instance().DepositMoney(p->dwGuild, p->iGold);
|
CGuildManager::instance().DepositMoney(p->dwGuild, p->iGold);
|
||||||
@ -1991,51 +1848,6 @@ void CClientManager::GuildWarBet(TPacketGDGuildWarBet * p)
|
|||||||
CGuildManager::instance().Bet(p->dwWarID, p->szLogin, p->dwGold, p->dwGuild);
|
CGuildManager::instance().Bet(p->dwWarID, p->szLogin, p->dwGold, p->dwGuild);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::SendAllLoginToBilling()
|
|
||||||
{
|
|
||||||
if (!m_pkAuthPeer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::vector<TPacketBillingRepair> vec;
|
|
||||||
TPacketBillingRepair p;
|
|
||||||
|
|
||||||
TLogonAccountMap::iterator it = m_map_kLogonAccount.begin();
|
|
||||||
|
|
||||||
while (it != m_map_kLogonAccount.end())
|
|
||||||
{
|
|
||||||
CLoginData * pkLD = (it++)->second;
|
|
||||||
|
|
||||||
p.dwLoginKey = pkLD->GetKey();
|
|
||||||
strlcpy(p.szLogin, pkLD->GetAccountRef().login, sizeof(p.szLogin));
|
|
||||||
strlcpy(p.szHost, pkLD->GetIP(), sizeof(p.szHost));
|
|
||||||
SPDLOG_DEBUG("SendAllLoginToBilling {} {}", pkLD->GetAccountRef().login, pkLD->GetIP());
|
|
||||||
vec.push_back(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!vec.empty())
|
|
||||||
{
|
|
||||||
m_pkAuthPeer->EncodeHeader(HEADER_DG_BILLING_REPAIR, 0, sizeof(DWORD) + sizeof(TPacketBillingRepair) * vec.size());
|
|
||||||
m_pkAuthPeer->EncodeDWORD(vec.size());
|
|
||||||
m_pkAuthPeer->Encode(&vec[0], sizeof(TPacketBillingRepair) * vec.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CClientManager::SendLoginToBilling(CLoginData * pkLD, bool bLogin)
|
|
||||||
{
|
|
||||||
if (!m_pkAuthPeer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TPacketBillingLogin p;
|
|
||||||
|
|
||||||
p.dwLoginKey = pkLD->GetKey();
|
|
||||||
p.bLogin = bLogin ? 1 : 0;
|
|
||||||
|
|
||||||
DWORD dwCount = 1;
|
|
||||||
m_pkAuthPeer->EncodeHeader(HEADER_DG_BILLING_LOGIN, 0, sizeof(DWORD) + sizeof(TPacketBillingLogin));
|
|
||||||
m_pkAuthPeer->EncodeDWORD(dwCount);
|
|
||||||
m_pkAuthPeer->Encode(&p, sizeof(TPacketBillingLogin));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CClientManager::CreateObject(TPacketGDCreateObject * p)
|
void CClientManager::CreateObject(TPacketGDCreateObject * p)
|
||||||
{
|
{
|
||||||
using namespace building;
|
using namespace building;
|
||||||
@ -2125,28 +1937,6 @@ void CClientManager::UpdateLand(DWORD * pdw)
|
|||||||
ForwardPacket(HEADER_DG_UPDATE_LAND, p, sizeof(building::TLand));
|
ForwardPacket(HEADER_DG_UPDATE_LAND, p, sizeof(building::TLand));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::VCard(TPacketGDVCard * p)
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("VCARD: {} {} {} {} {}",
|
|
||||||
p->dwID, p->szSellCharacter, p->szSellAccount, p->szBuyCharacter, p->szBuyAccount);
|
|
||||||
|
|
||||||
m_queue_vcard.push(*p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CClientManager::VCardProcess()
|
|
||||||
{
|
|
||||||
if (!m_pkAuthPeer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
while (!m_queue_vcard.empty())
|
|
||||||
{
|
|
||||||
m_pkAuthPeer->EncodeHeader(HEADER_DG_VCARD, 0, sizeof(TPacketGDVCard));
|
|
||||||
m_pkAuthPeer->Encode(&m_queue_vcard.front(), sizeof(TPacketGDVCard));
|
|
||||||
|
|
||||||
m_queue_vcard.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// BLOCK_CHAT
|
// BLOCK_CHAT
|
||||||
void CClientManager::BlockChat(TPacketBlockChat* p)
|
void CClientManager::BlockChat(TPacketBlockChat* p)
|
||||||
{
|
{
|
||||||
@ -2476,10 +2266,6 @@ void CClientManager::ProcessPackets(CPeer * peer)
|
|||||||
QUERY_REMOVE_AFFECT(peer, (TPacketGDRemoveAffect *) data);
|
QUERY_REMOVE_AFFECT(peer, (TPacketGDRemoveAffect *) data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_GD_HIGHSCORE_REGISTER:
|
|
||||||
QUERY_HIGHSCORE_REGISTER(peer, (TPacketGDHighscore *) data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_GD_PARTY_CREATE:
|
case HEADER_GD_PARTY_CREATE:
|
||||||
QUERY_PARTY_CREATE(peer, (TPacketPartyCreate*) data);
|
QUERY_PARTY_CREATE(peer, (TPacketPartyCreate*) data);
|
||||||
break;
|
break;
|
||||||
@ -2512,10 +2298,6 @@ void CClientManager::ProcessPackets(CPeer * peer)
|
|||||||
QUERY_CHANGE_NAME(peer, dwHandle, (TPacketGDChangeName *) data);
|
QUERY_CHANGE_NAME(peer, dwHandle, (TPacketGDChangeName *) data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_GD_SMS:
|
|
||||||
QUERY_SMS(peer, (TPacketGDSMS *) data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_GD_AUTH_LOGIN:
|
case HEADER_GD_AUTH_LOGIN:
|
||||||
QUERY_AUTH_LOGIN(peer, dwHandle, (TPacketGDAuthLogin *) data);
|
QUERY_AUTH_LOGIN(peer, dwHandle, (TPacketGDAuthLogin *) data);
|
||||||
break;
|
break;
|
||||||
@ -2556,14 +2338,6 @@ void CClientManager::ProcessPackets(CPeer * peer)
|
|||||||
SetEventFlag((TPacketSetEventFlag*) data);
|
SetEventFlag((TPacketSetEventFlag*) data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_GD_BILLING_EXPIRE:
|
|
||||||
BillingExpire((TPacketBillingExpire *) data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_GD_BILLING_CHECK:
|
|
||||||
BillingCheck(data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_GD_CREATE_OBJECT:
|
case HEADER_GD_CREATE_OBJECT:
|
||||||
CreateObject((TPacketGDCreateObject *) data);
|
CreateObject((TPacketGDCreateObject *) data);
|
||||||
break;
|
break;
|
||||||
@ -2576,10 +2350,6 @@ void CClientManager::ProcessPackets(CPeer * peer)
|
|||||||
UpdateLand((DWORD *) data);
|
UpdateLand((DWORD *) data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_GD_VCARD:
|
|
||||||
VCard((TPacketGDVCard *) data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_GD_MARRIAGE_ADD:
|
case HEADER_GD_MARRIAGE_ADD:
|
||||||
MarriageAdd((TPacketMarriageAdd *) data);
|
MarriageAdd((TPacketMarriageAdd *) data);
|
||||||
break;
|
break;
|
||||||
@ -2672,17 +2442,6 @@ void CClientManager::ProcessPackets(CPeer * peer)
|
|||||||
ChangeMonarchLord(peer, dwHandle, (TPacketChangeMonarchLord*)data);
|
ChangeMonarchLord(peer, dwHandle, (TPacketChangeMonarchLord*)data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_GD_BLOCK_COUNTRY_IP:
|
|
||||||
SPDLOG_DEBUG("HEADER_GD_BLOCK_COUNTRY_IP received");
|
|
||||||
CBlockCountry::instance().SendBlockedCountryIp(peer);
|
|
||||||
CBlockCountry::instance().SendBlockException(peer);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_GD_BLOCK_EXCEPTION:
|
|
||||||
SPDLOG_DEBUG("HEADER_GD_BLOCK_EXCEPTION received");
|
|
||||||
BlockException((TPacketBlockException*) data);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_GD_REQ_SPARE_ITEM_ID_RANGE :
|
case HEADER_GD_REQ_SPARE_ITEM_ID_RANGE :
|
||||||
SendSpareItemIDRange(peer);
|
SendSpareItemIDRange(peer);
|
||||||
break;
|
break;
|
||||||
@ -2818,7 +2577,6 @@ void CClientManager::RemovePeer(CPeer * pPeer)
|
|||||||
if (pkLD->IsPlay())
|
if (pkLD->IsPlay())
|
||||||
{
|
{
|
||||||
pkLD->SetPlay(false);
|
pkLD->SetPlay(false);
|
||||||
SendLoginToBilling(pkLD, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkLD->IsDeleted())
|
if (pkLD->IsDeleted())
|
||||||
@ -2934,11 +2692,6 @@ int CClientManager::AnalyzeQueryResult(SQLMsg * msg)
|
|||||||
RESULT_SAFEBOX_CHANGE_PASSWORD_SECOND(peer, msg);
|
RESULT_SAFEBOX_CHANGE_PASSWORD_SECOND(peer, msg);
|
||||||
break;
|
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_SAFEBOX_SAVE:
|
||||||
case QID_ITEM_SAVE:
|
case QID_ITEM_SAVE:
|
||||||
case QID_ITEM_DESTROY:
|
case QID_ITEM_DESTROY:
|
||||||
@ -3184,7 +2937,6 @@ int CClientManager::Process()
|
|||||||
// Process network events
|
// Process network events
|
||||||
event_base_loop(m_base, EVLOOP_NONBLOCK);
|
event_base_loop(m_base, EVLOOP_NONBLOCK);
|
||||||
|
|
||||||
VCardProcess();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4190,43 +3942,6 @@ void CClientManager::ChangeMonarchLord(CPeer * peer, DWORD dwHandle, TPacketChan
|
|||||||
delete pMsg;
|
delete pMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientManager::BlockException(TPacketBlockException *data)
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("[BLOCK_EXCEPTION] CMD({}) login({})", data->cmd, data->login);
|
|
||||||
|
|
||||||
// save sql
|
|
||||||
{
|
|
||||||
char buf[1024];
|
|
||||||
|
|
||||||
switch (data->cmd)
|
|
||||||
{
|
|
||||||
case BLOCK_EXCEPTION_CMD_ADD:
|
|
||||||
snprintf(buf, sizeof(buf), "INSERT INTO block_exception VALUES('%s')", data->login);
|
|
||||||
CDBManager::instance().AsyncQuery(buf, SQL_ACCOUNT);
|
|
||||||
CBlockCountry::instance().AddBlockException(data->login);
|
|
||||||
break;
|
|
||||||
case BLOCK_EXCEPTION_CMD_DEL:
|
|
||||||
snprintf(buf, sizeof(buf), "DELETE FROM block_exception VALUES('%s')", data->login);
|
|
||||||
CDBManager::instance().AsyncQuery(buf, SQL_ACCOUNT);
|
|
||||||
CBlockCountry::instance().DelBlockException(data->login);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for (itertype(m_peerList) it = m_peerList.begin(); it != m_peerList.end(); ++it)
|
|
||||||
{
|
|
||||||
CPeer *peer = *it;
|
|
||||||
|
|
||||||
if (!peer->GetChannel())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
CBlockCountry::instance().SendBlockExceptionOne(peer, data->login, data->cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CClientManager::SendSpareItemIDRange(CPeer* peer)
|
void CClientManager::SendSpareItemIDRange(CPeer* peer)
|
||||||
{
|
{
|
||||||
peer->SendSpareItemIDRange();
|
peer->SendSpareItemIDRange();
|
||||||
|
@ -310,9 +310,6 @@ class CClientManager : public singleton<CClientManager>
|
|||||||
|
|
||||||
void SendPartyOnSetup(CPeer * peer);
|
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_FLUSH_CACHE(CPeer * pkPeer, const char * c_pData);
|
||||||
|
|
||||||
void QUERY_PARTY_CREATE(CPeer * peer, TPacketPartyCreate* p);
|
void QUERY_PARTY_CREATE(CPeer * peer, TPacketPartyCreate* p);
|
||||||
@ -327,7 +324,6 @@ class CClientManager : public singleton<CClientManager>
|
|||||||
void QUERY_CHANGE_NAME(CPeer * peer, DWORD dwHandle, TPacketGDChangeName * p);
|
void QUERY_CHANGE_NAME(CPeer * peer, DWORD dwHandle, TPacketGDChangeName * p);
|
||||||
void GetPlayerFromRes(TPlayerTable * player_table, MYSQL_RES* res);
|
void GetPlayerFromRes(TPlayerTable * player_table, MYSQL_RES* res);
|
||||||
|
|
||||||
void QUERY_SMS(CPeer * pkPeer, TPacketGDSMS * p);
|
|
||||||
void QUERY_LOGIN_KEY(CPeer * pkPeer, TPacketGDLoginKey * p);
|
void QUERY_LOGIN_KEY(CPeer * pkPeer, TPacketGDLoginKey * p);
|
||||||
|
|
||||||
void AddGuildPriv(TPacketGiveGuildPriv* p);
|
void AddGuildPriv(TPacketGiveGuildPriv* p);
|
||||||
@ -347,12 +343,6 @@ class CClientManager : public singleton<CClientManager>
|
|||||||
void SetEventFlag(TPacketSetEventFlag* p);
|
void SetEventFlag(TPacketSetEventFlag* p);
|
||||||
void SendEventFlagsOnSetup(CPeer* peer);
|
void SendEventFlagsOnSetup(CPeer* peer);
|
||||||
|
|
||||||
void BillingExpire(TPacketBillingExpire * p);
|
|
||||||
void BillingCheck(const char * data);
|
|
||||||
|
|
||||||
void SendAllLoginToBilling();
|
|
||||||
void SendLoginToBilling(CLoginData * pkLD, bool bLogin);
|
|
||||||
|
|
||||||
// 결혼
|
// 결혼
|
||||||
void MarriageAdd(TPacketMarriageAdd * p);
|
void MarriageAdd(TPacketMarriageAdd * p);
|
||||||
void MarriageUpdate(TPacketMarriageUpdate * p);
|
void MarriageUpdate(TPacketMarriageUpdate * p);
|
||||||
@ -385,10 +375,6 @@ class CClientManager : public singleton<CClientManager>
|
|||||||
void DeleteObject(DWORD dwID);
|
void DeleteObject(DWORD dwID);
|
||||||
void UpdateLand(DWORD * pdw);
|
void UpdateLand(DWORD * pdw);
|
||||||
|
|
||||||
// VCard
|
|
||||||
void VCard(TPacketGDVCard * p);
|
|
||||||
void VCardProcess();
|
|
||||||
|
|
||||||
// BLOCK_CHAT
|
// BLOCK_CHAT
|
||||||
void BlockChat(TPacketBlockChat * p);
|
void BlockChat(TPacketBlockChat * p);
|
||||||
// END_OF_BLOCK_CHAT
|
// END_OF_BLOCK_CHAT
|
||||||
@ -441,8 +427,6 @@ class CClientManager : public singleton<CClientManager>
|
|||||||
std::vector<building::TObjectProto> m_vec_kObjectProto;
|
std::vector<building::TObjectProto> m_vec_kObjectProto;
|
||||||
std::map<DWORD, building::TObject *> m_map_pkObjectTable;
|
std::map<DWORD, building::TObject *> m_map_pkObjectTable;
|
||||||
|
|
||||||
std::queue<TPacketGDVCard> m_queue_vcard;
|
|
||||||
|
|
||||||
bool m_bShutdowned;
|
bool m_bShutdowned;
|
||||||
|
|
||||||
TPlayerTableCacheMap m_map_playerCache; // 플레이어 id가 key
|
TPlayerTableCacheMap m_map_playerCache; // 플레이어 id가 key
|
||||||
@ -545,7 +529,6 @@ class CClientManager : public singleton<CClientManager>
|
|||||||
//END_MONARCH
|
//END_MONARCH
|
||||||
|
|
||||||
void ChangeMonarchLord(CPeer* peer, DWORD dwHandle, TPacketChangeMonarchLord* info);
|
void ChangeMonarchLord(CPeer* peer, DWORD dwHandle, TPacketChangeMonarchLord* info);
|
||||||
void BlockException(TPacketBlockException *data);
|
|
||||||
|
|
||||||
void SendSpareItemIDRange(CPeer* peer);
|
void SendSpareItemIDRange(CPeer* peer);
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@ bool CClientManager::DeleteLogonAccount(const char * c_pszLogin, DWORD dwHandle)
|
|||||||
if (pkLD->IsPlay())
|
if (pkLD->IsPlay())
|
||||||
{
|
{
|
||||||
pkLD->SetPlay(false);
|
pkLD->SetPlay(false);
|
||||||
SendLoginToBilling(pkLD, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkLD->IsDeleted())
|
if (pkLD->IsDeleted())
|
||||||
|
@ -6,11 +6,8 @@
|
|||||||
#include "Main.h"
|
#include "Main.h"
|
||||||
#include "QID.h"
|
#include "QID.h"
|
||||||
#include "ItemAwardManager.h"
|
#include "ItemAwardManager.h"
|
||||||
#include "HB.h"
|
|
||||||
#include "Cache.h"
|
#include "Cache.h"
|
||||||
|
|
||||||
extern bool g_bHotBackup;
|
|
||||||
|
|
||||||
extern std::string g_stLocale;
|
extern std::string g_stLocale;
|
||||||
extern int g_test_server;
|
extern int g_test_server;
|
||||||
|
|
||||||
@ -195,9 +192,6 @@ void CClientManager::PutPlayerCache(TPlayerTable * pNew)
|
|||||||
m_map_playerCache.insert(TPlayerTableCacheMap::value_type(pNew->id, c));
|
m_map_playerCache.insert(TPlayerTableCacheMap::value_type(pNew->id, c));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_bHotBackup)
|
|
||||||
PlayerHB::instance().Put(pNew->id);
|
|
||||||
|
|
||||||
c->Put(pNew);
|
c->Put(pNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +237,6 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad
|
|||||||
pTab = c->Get();
|
pTab = c->Get();
|
||||||
|
|
||||||
pkLD->SetPlay(true);
|
pkLD->SetPlay(true);
|
||||||
SendLoginToBilling(pkLD, true);
|
|
||||||
memcpy(pTab->aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(pTab->aiPremiumTimes));
|
memcpy(pTab->aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(pTab->aiPremiumTimes));
|
||||||
|
|
||||||
peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_SUCCESS, dwHandle, sizeof(TPlayerTable));
|
peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_SUCCESS, dwHandle, sizeof(TPlayerTable));
|
||||||
@ -364,7 +357,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad
|
|||||||
"id,name,job,voice,dir,x,y,z,map_index,exit_x,exit_y,exit_map_index,hp,mp,stamina,random_hp,random_sp,playtime,"
|
"id,name,job,voice,dir,x,y,z,map_index,exit_x,exit_y,exit_map_index,hp,mp,stamina,random_hp,random_sp,playtime,"
|
||||||
"gold,level,level_step,st,ht,dx,iq,exp,"
|
"gold,level,level_step,st,ht,dx,iq,exp,"
|
||||||
"stat_point,skill_point,sub_skill_point,stat_reset_count,part_base,part_hair,"
|
"stat_point,skill_point,sub_skill_point,stat_reset_count,part_base,part_hair,"
|
||||||
"skill_level,quickslot,skill_group,alignment,mobile,horse_level,horse_riding,horse_hp,horse_hp_droptime,horse_stamina,"
|
"skill_level,quickslot,skill_group,alignment,horse_level,horse_riding,horse_hp,horse_hp_droptime,horse_stamina,"
|
||||||
"UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(last_play),horse_skill_point FROM player%s WHERE id=%d",
|
"UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(last_play),horse_skill_point FROM player%s WHERE id=%d",
|
||||||
GetTablePostfix(), packet->player_id);
|
GetTablePostfix(), packet->player_id);
|
||||||
|
|
||||||
@ -454,7 +447,7 @@ bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab)
|
|||||||
// "id,name,job,voice,dir,x,y,z,map_index,exit_x,exit_y,exit_map_index,hp,mp,stamina,random_hp,random_sp,playtime,"
|
// "id,name,job,voice,dir,x,y,z,map_index,exit_x,exit_y,exit_map_index,hp,mp,stamina,random_hp,random_sp,playtime,"
|
||||||
// "gold,level,level_step,st,ht,dx,iq,exp,"
|
// "gold,level,level_step,st,ht,dx,iq,exp,"
|
||||||
// "stat_point,skill_point,sub_skill_point,stat_reset_count,part_base,part_hair,"
|
// "stat_point,skill_point,sub_skill_point,stat_reset_count,part_base,part_hair,"
|
||||||
// "skill_level,quickslot,skill_group,alignment,mobile,horse_level,horse_riding,horse_hp,horse_stamina FROM player%s WHERE id=%d",
|
// "skill_level,quickslot,skill_group,alignment,horse_level,horse_riding,horse_hp,horse_stamina FROM player%s WHERE id=%d",
|
||||||
str_to_number(pkTab->id, row[col++]);
|
str_to_number(pkTab->id, row[col++]);
|
||||||
strlcpy(pkTab->name, row[col++], sizeof(pkTab->name));
|
strlcpy(pkTab->name, row[col++], sizeof(pkTab->name));
|
||||||
str_to_number(pkTab->job, row[col++]);
|
str_to_number(pkTab->job, row[col++]);
|
||||||
@ -505,13 +498,6 @@ bool CreatePlayerTableFromRes(MYSQL_RES * res, TPlayerTable * pkTab)
|
|||||||
str_to_number(pkTab->skill_group, row[col++]);
|
str_to_number(pkTab->skill_group, row[col++]);
|
||||||
str_to_number(pkTab->lAlignment, row[col++]);
|
str_to_number(pkTab->lAlignment, row[col++]);
|
||||||
|
|
||||||
if (row[col])
|
|
||||||
{
|
|
||||||
strlcpy(pkTab->szMobile, row[col], sizeof(pkTab->szMobile));
|
|
||||||
}
|
|
||||||
|
|
||||||
col++;
|
|
||||||
|
|
||||||
str_to_number(pkTab->horse.bLevel, row[col++]);
|
str_to_number(pkTab->horse.bLevel, row[col++]);
|
||||||
str_to_number(pkTab->horse.bRiding, row[col++]);
|
str_to_number(pkTab->horse.bRiding, row[col++]);
|
||||||
str_to_number(pkTab->horse.sHealth, row[col++]);
|
str_to_number(pkTab->horse.sHealth, row[col++]);
|
||||||
@ -649,7 +635,6 @@ void CClientManager::RESULT_PLAYER_LOAD(CPeer * peer, MYSQL_RES * pRes, ClientHa
|
|||||||
}
|
}
|
||||||
|
|
||||||
pkLD->SetPlay(true);
|
pkLD->SetPlay(true);
|
||||||
SendLoginToBilling(pkLD, true);
|
|
||||||
memcpy(tab.aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(tab.aiPremiumTimes));
|
memcpy(tab.aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(tab.aiPremiumTimes));
|
||||||
|
|
||||||
peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_SUCCESS, pkInfo->dwHandle, sizeof(TPlayerTable));
|
peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_SUCCESS, pkInfo->dwHandle, sizeof(TPlayerTable));
|
||||||
@ -1206,76 +1191,6 @@ void CClientManager::QUERY_REMOVE_AFFECT(CPeer * peer, TPacketGDRemoveAffect * p
|
|||||||
CDBManager::instance().AsyncQuery(queryStr);
|
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)
|
void CClientManager::InsertLogoutPlayer(DWORD pid)
|
||||||
{
|
{
|
||||||
TLogoutPlayerMap::iterator it = m_map_logout.find(pid);
|
TLogoutPlayerMap::iterator it = m_map_logout.find(pid);
|
||||||
|
@ -23,7 +23,6 @@ enum eSQL_SLOT
|
|||||||
SQL_PLAYER,
|
SQL_PLAYER,
|
||||||
SQL_ACCOUNT,
|
SQL_ACCOUNT,
|
||||||
SQL_COMMON,
|
SQL_COMMON,
|
||||||
SQL_HOTBACKUP,
|
|
||||||
SQL_MAX_NUM,
|
SQL_MAX_NUM,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,86 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
#include "HB.h"
|
|
||||||
#include "Main.h"
|
|
||||||
#include "DBManager.h"
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
PlayerHB::PlayerHB()
|
|
||||||
{
|
|
||||||
m_iExpireTime = 3600; // 1 hour hotbackup default.
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerHB::~PlayerHB()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PlayerHB::Initialize()
|
|
||||||
{
|
|
||||||
char szQuery[128];
|
|
||||||
snprintf(szQuery, sizeof(szQuery), "SHOW CREATE TABLE player%s", GetTablePostfix());
|
|
||||||
|
|
||||||
std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery));
|
|
||||||
|
|
||||||
if (pMsg->Get()->uiNumRows == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);
|
|
||||||
m_stCreateTableQuery = row[1];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// @version 05/07/05 Bang2ni - id 에 해당하는 data 가 없을 때 쿼리하고 data 를 insert 하는코드 추가.
|
|
||||||
//
|
|
||||||
void PlayerHB::Put(DWORD id)
|
|
||||||
{
|
|
||||||
itertype(m_map_data) it = m_map_data.find(id);
|
|
||||||
|
|
||||||
if (it == m_map_data.end())
|
|
||||||
{
|
|
||||||
Query(id);
|
|
||||||
m_map_data.insert(std::pair< DWORD, time_t >(id, get_dword_time()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time(0) - it->second > m_iExpireTime)
|
|
||||||
Query(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// @version 05/07/05 Bang2ni - Query string 버퍼가 작아서 늘려줌.
|
|
||||||
//
|
|
||||||
bool PlayerHB::Query(DWORD id)
|
|
||||||
{
|
|
||||||
time_t ct = time(0);
|
|
||||||
struct tm curr_tm = *localtime(&ct);
|
|
||||||
char szTableName[64];
|
|
||||||
snprintf(szTableName, sizeof(szTableName), "hb_%02d%02d%02d%02d_player%s",
|
|
||||||
curr_tm.tm_year - 100, curr_tm.tm_mon + 1, curr_tm.tm_mday, curr_tm.tm_hour, GetTablePostfix());
|
|
||||||
|
|
||||||
char szQuery[4096];
|
|
||||||
|
|
||||||
if (m_stTableName.compare(szTableName))
|
|
||||||
{
|
|
||||||
char szFind[32];
|
|
||||||
snprintf(szFind, sizeof(szFind), "CREATE TABLE `player%s`", GetTablePostfix());
|
|
||||||
int pos = m_stCreateTableQuery.find(szFind);
|
|
||||||
|
|
||||||
if (pos < 0)
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("cannot find {} ", szFind);
|
|
||||||
// SPDLOG_ERROR("cannot find {} in {}", szFind, m_stCreateTableQuery.c_str());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(szQuery, sizeof(szQuery), "CREATE TABLE IF NOT EXISTS %s%s", szTableName, m_stCreateTableQuery.c_str() + strlen(szFind));
|
|
||||||
// SPDLOG_DEBUG("{}", szQuery);
|
|
||||||
std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery, SQL_HOTBACKUP));
|
|
||||||
m_stTableName = szTableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(szQuery, sizeof(szQuery), "REPLACE INTO %s SELECT * FROM %splayer%s WHERE id=%u", m_stTableName.c_str(), GetPlayerDBName(), GetTablePostfix(), id);
|
|
||||||
CDBManager::instance().AsyncQuery(szQuery, SQL_HOTBACKUP);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
// vim:ts=8 sw=4
|
|
||||||
#ifndef __INC_METIN_II_PLAYERHB_H__
|
|
||||||
#define __INC_METIN_II_PLAYERHB_H__
|
|
||||||
|
|
||||||
class PlayerHB : public singleton<PlayerHB>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PlayerHB();
|
|
||||||
virtual ~PlayerHB();
|
|
||||||
|
|
||||||
bool Initialize();
|
|
||||||
|
|
||||||
void Put(DWORD id);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool Query(DWORD id);
|
|
||||||
|
|
||||||
std::map<DWORD, time_t> m_map_data;
|
|
||||||
std::string m_stCreateTableQuery;
|
|
||||||
std::string m_stTableName;
|
|
||||||
int m_iExpireTime;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -11,8 +11,6 @@ CLoginData::CLoginData()
|
|||||||
memset(m_szIP, 0, sizeof(m_szIP));
|
memset(m_szIP, 0, sizeof(m_szIP));
|
||||||
m_bPlay = false;
|
m_bPlay = false;
|
||||||
m_bDeleted = false;
|
m_bDeleted = false;
|
||||||
m_bBillType = 0;
|
|
||||||
m_dwBillID = 0;
|
|
||||||
m_lastPlayTime = 0;
|
m_lastPlayTime = 0;
|
||||||
m_dwLastPlayerID = 0;
|
m_dwLastPlayerID = 0;
|
||||||
|
|
||||||
|
@ -29,12 +29,6 @@ class CLoginData
|
|||||||
void SetDeleted(bool bSet);
|
void SetDeleted(bool bSet);
|
||||||
bool IsDeleted();
|
bool IsDeleted();
|
||||||
|
|
||||||
void SetBillID(DWORD id) { m_dwBillID = id; }
|
|
||||||
DWORD GetBillID() { return m_dwBillID; }
|
|
||||||
|
|
||||||
void SetBillType(BYTE type) { m_bBillType = type; }
|
|
||||||
BYTE GetBillType() { return m_bBillType; }
|
|
||||||
|
|
||||||
time_t GetLastPlayTime() { return m_lastPlayTime; }
|
time_t GetLastPlayTime() { return m_lastPlayTime; }
|
||||||
|
|
||||||
void SetPremium(DWORD * paiPremiumTimes);
|
void SetPremium(DWORD * paiPremiumTimes);
|
||||||
@ -53,8 +47,6 @@ class CLoginData
|
|||||||
bool m_bPlay;
|
bool m_bPlay;
|
||||||
bool m_bDeleted;
|
bool m_bDeleted;
|
||||||
|
|
||||||
BYTE m_bBillType;
|
|
||||||
DWORD m_dwBillID;
|
|
||||||
time_t m_lastPlayTime;
|
time_t m_lastPlayTime;
|
||||||
DWORD m_aiPremiumTimes[PREMIUM_MAX_NUM];
|
DWORD m_aiPremiumTimes[PREMIUM_MAX_NUM];
|
||||||
|
|
||||||
|
@ -5,12 +5,10 @@
|
|||||||
#include "ClientManager.h"
|
#include "ClientManager.h"
|
||||||
#include "GuildManager.h"
|
#include "GuildManager.h"
|
||||||
#include "ItemAwardManager.h"
|
#include "ItemAwardManager.h"
|
||||||
#include "HB.h"
|
|
||||||
#include "PrivManager.h"
|
#include "PrivManager.h"
|
||||||
#include "MoneyLog.h"
|
#include "MoneyLog.h"
|
||||||
#include "Marriage.h"
|
#include "Marriage.h"
|
||||||
#include "Monarch.h"
|
#include "Monarch.h"
|
||||||
#include "BlockCountry.h"
|
|
||||||
#include "ItemIDRangeManager.h"
|
#include "ItemIDRangeManager.h"
|
||||||
#include <version.h>
|
#include <version.h>
|
||||||
#ifdef __AUCTION__
|
#ifdef __AUCTION__
|
||||||
@ -28,7 +26,6 @@ std::string g_stLocale = "euckr";
|
|||||||
std::string g_stPlayerDBName = "";
|
std::string g_stPlayerDBName = "";
|
||||||
|
|
||||||
|
|
||||||
bool g_bHotBackup = false;
|
|
||||||
BOOL g_test_server = false;
|
BOOL g_test_server = false;
|
||||||
|
|
||||||
//단위 초
|
//단위 초
|
||||||
@ -70,14 +67,12 @@ int main()
|
|||||||
CConfig Config;
|
CConfig Config;
|
||||||
CDBManager DBManager;
|
CDBManager DBManager;
|
||||||
CClientManager ClientManager;
|
CClientManager ClientManager;
|
||||||
PlayerHB player_hb;
|
|
||||||
CGuildManager GuildManager;
|
CGuildManager GuildManager;
|
||||||
CPrivManager PrivManager;
|
CPrivManager PrivManager;
|
||||||
CMoneyLog MoneyLog;
|
CMoneyLog MoneyLog;
|
||||||
ItemAwardManager ItemAwardManager;
|
ItemAwardManager ItemAwardManager;
|
||||||
marriage::CManager MarriageManager;
|
marriage::CManager MarriageManager;
|
||||||
CMonarch Monarch;
|
CMonarch Monarch;
|
||||||
CBlockCountry BlockCountry;
|
|
||||||
CItemIDRangeManager ItemIDRangeManager;
|
CItemIDRangeManager ItemIDRangeManager;
|
||||||
#ifdef __AUCTION__
|
#ifdef __AUCTION__
|
||||||
AuctionManager auctionManager;
|
AuctionManager auctionManager;
|
||||||
@ -87,7 +82,6 @@ int main()
|
|||||||
|
|
||||||
GuildManager.Initialize();
|
GuildManager.Initialize();
|
||||||
MarriageManager.Initialize();
|
MarriageManager.Initialize();
|
||||||
BlockCountry.Load();
|
|
||||||
ItemIDRangeManager.Build();
|
ItemIDRangeManager.Build();
|
||||||
#ifdef __AUCTION__
|
#ifdef __AUCTION__
|
||||||
AuctionManager::instance().Initialize();
|
AuctionManager::instance().Initialize();
|
||||||
@ -170,27 +164,8 @@ int Start()
|
|||||||
{
|
{
|
||||||
g_stLocale = szBuf;
|
g_stLocale = szBuf;
|
||||||
SPDLOG_INFO("LOCALE set to {}", g_stLocale.c_str());
|
SPDLOG_INFO("LOCALE set to {}", g_stLocale.c_str());
|
||||||
|
|
||||||
// CHINA_DISABLE_HOTBACKUP
|
|
||||||
if ("gb2312" == g_stLocale)
|
|
||||||
{
|
|
||||||
SPDLOG_INFO("CIBN_LOCALE: DISABLE_HOTBACKUP");
|
|
||||||
g_bHotBackup = false;
|
|
||||||
}
|
|
||||||
// END_OF_CHINA_DISABLE_HOTBACKUP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int iDisableHotBackup;
|
|
||||||
if (CConfig::instance().GetValue("DISABLE_HOTBACKUP", &iDisableHotBackup))
|
|
||||||
{
|
|
||||||
if (iDisableHotBackup)
|
|
||||||
{
|
|
||||||
SPDLOG_INFO("CONFIG: DISABLE_HOTBACKUP");
|
|
||||||
g_bHotBackup = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!CConfig::instance().GetValue("TABLE_POSTFIX", szBuf, 256))
|
if (!CConfig::instance().GetValue("TABLE_POSTFIX", szBuf, 256))
|
||||||
{
|
{
|
||||||
SPDLOG_WARN("TABLE_POSTFIX not configured use default");
|
SPDLOG_WARN("TABLE_POSTFIX not configured use default");
|
||||||
@ -324,35 +299,6 @@ int Start()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CConfig::instance().GetValue("SQL_HOTBACKUP", line, 256))
|
|
||||||
{
|
|
||||||
sscanf(line, " %s %s %s %s %d ", szAddr, szDB, szUser, szPassword, &iPort);
|
|
||||||
SPDLOG_DEBUG("connecting to MySQL server (hotbackup)");
|
|
||||||
|
|
||||||
int iRetry = 5;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (CDBManager::instance().Connect(SQL_HOTBACKUP, szAddr, iPort, szDB, szUser, szPassword))
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG(" OK");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDLOG_DEBUG(" failed, retrying in 5 seconds");
|
|
||||||
SPDLOG_ERROR(" failed, retrying in 5 seconds");
|
|
||||||
sleep(5);
|
|
||||||
}
|
|
||||||
while (iRetry--);
|
|
||||||
|
|
||||||
SPDLOG_INFO("Success HOTBACKUP");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("SQL_HOTBACKUP not configured");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CClientManager::instance().Initialize())
|
if (!CClientManager::instance().Initialize())
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("ClientManager initialization failed");
|
SPDLOG_ERROR("ClientManager initialization failed");
|
||||||
@ -361,12 +307,6 @@ int Start()
|
|||||||
|
|
||||||
SPDLOG_INFO("ClientManager initialization OK");
|
SPDLOG_INFO("ClientManager initialization OK");
|
||||||
|
|
||||||
if (!PlayerHB::instance().Initialize())
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("cannot initialize player hotbackup");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
signal(SIGUSR1, emergency_sig);
|
signal(SIGUSR1, emergency_sig);
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,19 +20,18 @@ enum QID
|
|||||||
QID_ITEM_DESTROY, // 11
|
QID_ITEM_DESTROY, // 11
|
||||||
QID_QUEST_SAVE, // 12
|
QID_QUEST_SAVE, // 12
|
||||||
QID_PLAYER_SAVE, // 13
|
QID_PLAYER_SAVE, // 13
|
||||||
QID_HIGHSCORE_REGISTER, // 14
|
QID_PLAYER_DELETE, // 14
|
||||||
QID_PLAYER_DELETE, // 15
|
QID_LOGIN_BY_KEY, // 15
|
||||||
QID_LOGIN_BY_KEY, // 16
|
QID_PLAYER_INDEX_CREATE, // 16
|
||||||
QID_PLAYER_INDEX_CREATE, // 17
|
QID_ITEM_AWARD_LOAD, // 17
|
||||||
QID_ITEM_AWARD_LOAD, // 18
|
QID_ITEM_AWARD_TAKEN, // 18
|
||||||
QID_ITEM_AWARD_TAKEN, // 19
|
QID_GUILD_RANKING, // 19
|
||||||
QID_GUILD_RANKING, // 20
|
|
||||||
|
|
||||||
// MYSHOP_PRICE_LIST
|
// MYSHOP_PRICE_LIST
|
||||||
QID_ITEMPRICE_SAVE, ///< 21, 아이템 가격정보 저장 쿼리
|
QID_ITEMPRICE_SAVE, ///< 20, 아이템 가격정보 저장 쿼리
|
||||||
QID_ITEMPRICE_DESTROY, ///< 22, 아이템 가격정보 삭제 쿼리
|
QID_ITEMPRICE_DESTROY, ///< 21, 아이템 가격정보 저장 쿼리
|
||||||
QID_ITEMPRICE_LOAD_FOR_UPDATE, ///< 23, 가격정보 업데이트를 위한 아이템 가격정보 로드 쿼리
|
QID_ITEMPRICE_LOAD_FOR_UPDATE, ///< 22, 가격정보 업데이트를 위한 아이템 가격정보 로드 쿼리
|
||||||
QID_ITEMPRICE_LOAD, ///< 24, 아이템 가격정보 로드 쿼리
|
QID_ITEMPRICE_LOAD, ///< 22, 아이템 가격정보 로드 쿼리
|
||||||
// END_OF_MYSHOP_PRICE_LIST
|
// END_OF_MYSHOP_PRICE_LIST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,150 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* date : 2007.05.31
|
|
||||||
* file : block_country.cpp
|
|
||||||
* author : mhh
|
|
||||||
* description :
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _block_country_cpp_
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "constants.h"
|
|
||||||
#include "block_country.h"
|
|
||||||
|
|
||||||
#define DEC_ITER(iter) std::vector<T_BLOCK_IP*>::iterator iter
|
|
||||||
#define DO_ALL_BLOCKED_IP(iter) for ((iter)=s_blocked_ip.begin(); (iter)!=s_blocked_ip.end(); ++(iter))
|
|
||||||
|
|
||||||
#define DEC_EXCEPTION_ITER(iter) std::set<std::string>::iterator iter
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DWORD ip_from;
|
|
||||||
DWORD ip_to;
|
|
||||||
} T_BLOCK_IP;
|
|
||||||
|
|
||||||
//--------------------------------------
|
|
||||||
// static variables
|
|
||||||
std::vector<T_BLOCK_IP*> s_blocked_ip;
|
|
||||||
std::set<std::string> s_block_exception;
|
|
||||||
// static variables
|
|
||||||
//--------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------
|
|
||||||
// static functions
|
|
||||||
static void __add_block_exception(const char *login)
|
|
||||||
{
|
|
||||||
SPDLOG_TRACE("BLOCK_EXCEPTION_ADD : {}", login);
|
|
||||||
|
|
||||||
DEC_EXCEPTION_ITER(iter);
|
|
||||||
std::string string_login(login);
|
|
||||||
|
|
||||||
iter = s_block_exception.find(string_login);
|
|
||||||
|
|
||||||
// can not find
|
|
||||||
if (iter==s_block_exception.end())
|
|
||||||
{
|
|
||||||
s_block_exception.insert(string_login);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __del_block_exception(const char *login)
|
|
||||||
{
|
|
||||||
SPDLOG_TRACE("BLOCK_EXCEPTION_DEL : {}", login);
|
|
||||||
|
|
||||||
DEC_EXCEPTION_ITER(iter);
|
|
||||||
std::string string_login(login);
|
|
||||||
|
|
||||||
iter = s_block_exception.find(string_login);
|
|
||||||
|
|
||||||
// ok : find
|
|
||||||
if (iter!=s_block_exception.end())
|
|
||||||
{
|
|
||||||
s_block_exception.erase(iter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// static functions
|
|
||||||
//--------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void add_blocked_country_ip(TPacketBlockCountryIp *data)
|
|
||||||
{
|
|
||||||
T_BLOCK_IP *block_ip = M2_NEW T_BLOCK_IP;
|
|
||||||
|
|
||||||
block_ip->ip_from = data->ip_from;
|
|
||||||
block_ip->ip_to = data->ip_to;
|
|
||||||
|
|
||||||
s_blocked_ip.push_back(block_ip);
|
|
||||||
|
|
||||||
SPDLOG_TRACE("BLOCKED_IP = {} - {}", block_ip->ip_from, block_ip->ip_to);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void block_exception(TPacketBlockException *data)
|
|
||||||
{
|
|
||||||
if (NULL==data) return;
|
|
||||||
|
|
||||||
if (BLOCK_EXCEPTION_CMD_ADD!=data->cmd && BLOCK_EXCEPTION_CMD_DEL!=data->cmd)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
switch (data->cmd)
|
|
||||||
{
|
|
||||||
case BLOCK_EXCEPTION_CMD_ADD:
|
|
||||||
__add_block_exception(data->login);
|
|
||||||
break;
|
|
||||||
case BLOCK_EXCEPTION_CMD_DEL:
|
|
||||||
__del_block_exception(data->login);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_blocked_country_ip(const char *user_ip)
|
|
||||||
{
|
|
||||||
DEC_ITER(iter);
|
|
||||||
T_BLOCK_IP *block_ip;
|
|
||||||
DWORD ip_number;
|
|
||||||
struct in_addr st_addr;
|
|
||||||
|
|
||||||
#ifndef __WIN32__
|
|
||||||
if (0 == inet_aton(user_ip, &st_addr))
|
|
||||||
#else
|
|
||||||
unsigned int in_address;
|
|
||||||
in_address = inet_addr(user_ip);
|
|
||||||
st_addr.s_addr = in_address;
|
|
||||||
if (INADDR_NONE == in_address)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
SPDLOG_INFO("BLOCKED_COUNTRY_IP ({}) : YES", user_ip);
|
|
||||||
return true; // 아이피가 괴상하니 일단 블럭처리
|
|
||||||
}
|
|
||||||
ip_number = htonl(st_addr.s_addr);
|
|
||||||
|
|
||||||
DO_ALL_BLOCKED_IP(iter)
|
|
||||||
{
|
|
||||||
block_ip = *iter;
|
|
||||||
if ( block_ip->ip_from <= ip_number && ip_number <= block_ip->ip_to )
|
|
||||||
{
|
|
||||||
SPDLOG_INFO("BLOCKED_COUNTRY_IP ({}) : YES", user_ip);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("BLOCKED_COUNTRY_IP ({}) : NO", user_ip);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_block_exception(const char *login)
|
|
||||||
{
|
|
||||||
std::string login_string(login);
|
|
||||||
std::set<std::string>::iterator iter;
|
|
||||||
|
|
||||||
iter = s_block_exception.find(login_string);
|
|
||||||
if (iter != s_block_exception.end())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
/*********************************************************************
|
|
||||||
* date : 2007.05.31
|
|
||||||
* file : block_country.h
|
|
||||||
* author : mhh
|
|
||||||
* description :
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _block_country_h_
|
|
||||||
#define _block_country_h_
|
|
||||||
|
|
||||||
|
|
||||||
void add_blocked_country_ip(TPacketBlockCountryIp *data);
|
|
||||||
void block_exception(TPacketBlockException *data);
|
|
||||||
bool is_blocked_country_ip(const char *user_ip);
|
|
||||||
bool is_block_exception(const char *login);
|
|
||||||
|
|
||||||
#endif // _block_country_h_
|
|
||||||
|
|
@ -48,7 +48,6 @@
|
|||||||
#include "castle.h"
|
#include "castle.h"
|
||||||
#include "arena.h"
|
#include "arena.h"
|
||||||
#include "horsename_manager.h"
|
#include "horsename_manager.h"
|
||||||
#include "pcbang.h"
|
|
||||||
#include "gm.h"
|
#include "gm.h"
|
||||||
#include "map_location.h"
|
#include "map_location.h"
|
||||||
#include "BlueDragon_Binder.h"
|
#include "BlueDragon_Binder.h"
|
||||||
@ -259,8 +258,6 @@ void CHARACTER::Initialize()
|
|||||||
m_dwQuestByVnum = 0;
|
m_dwQuestByVnum = 0;
|
||||||
m_pQuestItem = NULL;
|
m_pQuestItem = NULL;
|
||||||
|
|
||||||
m_szMobileAuth[0] = '\0';
|
|
||||||
|
|
||||||
m_dwUnderGuildWarInfoMessageTime = get_dword_time()-60000;
|
m_dwUnderGuildWarInfoMessageTime = get_dword_time()-60000;
|
||||||
|
|
||||||
m_bUnderRefine = false;
|
m_bUnderRefine = false;
|
||||||
@ -307,8 +304,6 @@ void CHARACTER::Initialize()
|
|||||||
memset(m_adwMobSkillCooltime, 0, sizeof(m_adwMobSkillCooltime));
|
memset(m_adwMobSkillCooltime, 0, sizeof(m_adwMobSkillCooltime));
|
||||||
// END_OF_MOB_SKILL_COOLTIME
|
// END_OF_MOB_SKILL_COOLTIME
|
||||||
|
|
||||||
m_isinPCBang = false;
|
|
||||||
|
|
||||||
// ARENA
|
// ARENA
|
||||||
m_pArena = NULL;
|
m_pArena = NULL;
|
||||||
m_nPotionLimit = quest::CQuestManager::instance().GetEventFlag("arena_potion_limit_count");
|
m_nPotionLimit = quest::CQuestManager::instance().GetEventFlag("arena_potion_limit_count");
|
||||||
@ -1222,9 +1217,6 @@ void CHARACTER::CreatePlayerProto(TPlayerTable & tab)
|
|||||||
for (int i = 0; i < QUICKSLOT_MAX_NUM; ++i)
|
for (int i = 0; i < QUICKSLOT_MAX_NUM; ++i)
|
||||||
tab.quickslot[i] = m_quickslot[i];
|
tab.quickslot[i] = m_quickslot[i];
|
||||||
|
|
||||||
if (m_stMobile.length() && !*m_szMobileAuth)
|
|
||||||
strlcpy(tab.szMobile, m_stMobile.c_str(), sizeof(tab.szMobile));
|
|
||||||
|
|
||||||
memcpy(tab.parts, m_pointsInstant.parts, sizeof(tab.parts));
|
memcpy(tab.parts, m_pointsInstant.parts, sizeof(tab.parts));
|
||||||
|
|
||||||
// REMOVE_REAL_SKILL_LEVLES
|
// REMOVE_REAL_SKILL_LEVLES
|
||||||
@ -1314,9 +1306,6 @@ void CHARACTER::Disconnect(const char * c_pszReason)
|
|||||||
{
|
{
|
||||||
int playTime = GetRealPoint(POINT_PLAYTIME) - m_dwLoginPlayTime;
|
int playTime = GetRealPoint(POINT_PLAYTIME) - m_dwLoginPlayTime;
|
||||||
LogManager::instance().LoginLog(false, GetDesc()->GetAccountTable().id, GetPlayerID(), GetLevel(), GetJob(), playTime);
|
LogManager::instance().LoginLog(false, GetDesc()->GetAccountTable().id, GetPlayerID(), GetLevel(), GetJob(), playTime);
|
||||||
|
|
||||||
if (LC_IsBrazil() != true)
|
|
||||||
CPCBangManager::instance().Log(GetDesc()->GetHostName(), GetPlayerID(), playTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pWarMap)
|
if (m_pWarMap)
|
||||||
@ -1555,8 +1544,6 @@ void CHARACTER::MainCharacterPacket()
|
|||||||
strlcpy(mainChrPacket.szBGMName, bgmInfo.name.c_str(), sizeof(mainChrPacket.szBGMName));
|
strlcpy(mainChrPacket.szBGMName, bgmInfo.name.c_str(), sizeof(mainChrPacket.szBGMName));
|
||||||
GetDesc()->Packet(&mainChrPacket, sizeof(TPacketGCMainCharacter3_BGM));
|
GetDesc()->Packet(&mainChrPacket, sizeof(TPacketGCMainCharacter3_BGM));
|
||||||
}
|
}
|
||||||
//if (m_stMobile.length())
|
|
||||||
// ChatPacket(CHAT_TYPE_COMMAND, "sms");
|
|
||||||
}
|
}
|
||||||
// END_OF_SUPPORT_BGM
|
// END_OF_SUPPORT_BGM
|
||||||
else
|
else
|
||||||
@ -1574,9 +1561,6 @@ void CHARACTER::MainCharacterPacket()
|
|||||||
pack.skill_group = GetSkillGroup();
|
pack.skill_group = GetSkillGroup();
|
||||||
strlcpy(pack.szName, GetName(), sizeof(pack.szName));
|
strlcpy(pack.szName, GetName(), sizeof(pack.szName));
|
||||||
GetDesc()->Packet(&pack, sizeof(TPacketGCMainCharacter));
|
GetDesc()->Packet(&pack, sizeof(TPacketGCMainCharacter));
|
||||||
|
|
||||||
if (m_stMobile.length())
|
|
||||||
ChatPacket(CHAT_TYPE_COMMAND, "sms");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1796,8 +1780,6 @@ void CHARACTER::SetPlayerProto(const TPlayerTable * t)
|
|||||||
if (GetLevel() < PK_PROTECT_LEVEL)
|
if (GetLevel() < PK_PROTECT_LEVEL)
|
||||||
m_bPKMode = PK_MODE_PROTECT;
|
m_bPKMode = PK_MODE_PROTECT;
|
||||||
|
|
||||||
m_stMobile = t->szMobile;
|
|
||||||
|
|
||||||
SetHorseData(t->horse);
|
SetHorseData(t->horse);
|
||||||
|
|
||||||
if (GetHorseLevel() > 0)
|
if (GetHorseLevel() > 0)
|
||||||
@ -2242,11 +2224,6 @@ void CHARACTER::ComputePoints()
|
|||||||
SetPoint(POINT_HP_RECOVERY, lHPRecovery);
|
SetPoint(POINT_HP_RECOVERY, lHPRecovery);
|
||||||
SetPoint(POINT_SP_RECOVERY, lSPRecovery);
|
SetPoint(POINT_SP_RECOVERY, lSPRecovery);
|
||||||
|
|
||||||
// PC_BANG_ITEM_ADD
|
|
||||||
SetPoint(POINT_PC_BANG_EXP_BONUS, 0);
|
|
||||||
SetPoint(POINT_PC_BANG_DROP_BONUS, 0);
|
|
||||||
// END_PC_BANG_ITEM_ADD
|
|
||||||
|
|
||||||
int iMaxHP, iMaxSP;
|
int iMaxHP, iMaxSP;
|
||||||
int iMaxStamina;
|
int iMaxStamina;
|
||||||
|
|
||||||
@ -3478,14 +3455,10 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast
|
|||||||
val = GetPoint(type);
|
val = GetPoint(type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// PC_BANG_ITEM_ADD
|
|
||||||
case POINT_PC_BANG_EXP_BONUS :
|
|
||||||
case POINT_PC_BANG_DROP_BONUS :
|
|
||||||
case POINT_RAMADAN_CANDY_BONUS_EXP:
|
case POINT_RAMADAN_CANDY_BONUS_EXP:
|
||||||
SetPoint(type, amount);
|
SetPoint(type, amount);
|
||||||
val = GetPoint(type);
|
val = GetPoint(type);
|
||||||
break;
|
break;
|
||||||
// END_PC_BANG_ITEM_ADD
|
|
||||||
|
|
||||||
case POINT_EXP_DOUBLE_BONUS: // 71
|
case POINT_EXP_DOUBLE_BONUS: // 71
|
||||||
case POINT_GOLD_DOUBLE_BONUS: // 72
|
case POINT_GOLD_DOUBLE_BONUS: // 72
|
||||||
@ -3759,9 +3732,6 @@ void CHARACTER::ApplyPoint(BYTE bApplyType, int iVal)
|
|||||||
case APPLY_NORMAL_HIT_DEFEND_BONUS:
|
case APPLY_NORMAL_HIT_DEFEND_BONUS:
|
||||||
// END_OF_DEPEND_BONUS_ATTRIBUTES
|
// END_OF_DEPEND_BONUS_ATTRIBUTES
|
||||||
|
|
||||||
case APPLY_PC_BANG_EXP_BONUS :
|
|
||||||
case APPLY_PC_BANG_DROP_BONUS :
|
|
||||||
|
|
||||||
case APPLY_RESIST_WARRIOR :
|
case APPLY_RESIST_WARRIOR :
|
||||||
case APPLY_RESIST_ASSASSIN :
|
case APPLY_RESIST_ASSASSIN :
|
||||||
case APPLY_RESIST_SURA :
|
case APPLY_RESIST_SURA :
|
||||||
@ -5955,16 +5925,6 @@ void CHARACTER::SetGuild(CGuild* pGuild)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHARACTER::SendGreetMessage()
|
|
||||||
{
|
|
||||||
typeof(DBManager::instance().GetGreetMessage()) v = DBManager::instance().GetGreetMessage();
|
|
||||||
|
|
||||||
for (itertype(v) it = v.begin(); it != v.end(); ++it)
|
|
||||||
{
|
|
||||||
ChatPacket(CHAT_TYPE_NOTICE, it->c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CHARACTER::BeginStateEmpty()
|
void CHARACTER::BeginStateEmpty()
|
||||||
{
|
{
|
||||||
MonsterLog("!");
|
MonsterLog("!");
|
||||||
|
@ -260,7 +260,8 @@ enum EPointTypes
|
|||||||
POINT_NORMAL_HIT_DEFEND_BONUS, // 124 평타 방어 데미지
|
POINT_NORMAL_HIT_DEFEND_BONUS, // 124 평타 방어 데미지
|
||||||
// END_OF_DEFEND_BONUS_ATTRIBUTES
|
// END_OF_DEFEND_BONUS_ATTRIBUTES
|
||||||
|
|
||||||
// PC_BANG_ITEM_ADD
|
// TODO: check if the PC_BANG_* bonuses can be safely removed
|
||||||
|
// PC_BANG_ITEM_ADD
|
||||||
POINT_PC_BANG_EXP_BONUS, // 125 PC방 전용 경험치 보너스
|
POINT_PC_BANG_EXP_BONUS, // 125 PC방 전용 경험치 보너스
|
||||||
POINT_PC_BANG_DROP_BONUS, // 126 PC방 전용 드롭률 보너스
|
POINT_PC_BANG_DROP_BONUS, // 126 PC방 전용 드롭률 보너스
|
||||||
// END_PC_BANG_ITEM_ADD
|
// END_PC_BANG_ITEM_ADD
|
||||||
@ -740,7 +741,6 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
|
|||||||
|
|
||||||
void ChatPacket(BYTE type, const char *format, ...);
|
void ChatPacket(BYTE type, const char *format, ...);
|
||||||
void MonsterChat(BYTE bMonsterChatType);
|
void MonsterChat(BYTE bMonsterChatType);
|
||||||
void SendGreetMessage();
|
|
||||||
|
|
||||||
void ResetPoint(int iLv);
|
void ResetPoint(int iLv);
|
||||||
|
|
||||||
@ -789,8 +789,6 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
|
|||||||
DWORD m_dwPlayStartTime;
|
DWORD m_dwPlayStartTime;
|
||||||
BYTE m_bAddChrState;
|
BYTE m_bAddChrState;
|
||||||
bool m_bSkipSave;
|
bool m_bSkipSave;
|
||||||
std::string m_stMobile;
|
|
||||||
char m_szMobileAuth[5];
|
|
||||||
BYTE m_bChatCounter;
|
BYTE m_bChatCounter;
|
||||||
|
|
||||||
// End of Basic Points
|
// End of Basic Points
|
||||||
@ -1746,15 +1744,6 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
|
|||||||
static const char msc_szChangeItemAttrCycleFlag[]; ///< 아이템 속성병경 가능 주기의 Quest Flag 이름
|
static const char msc_szChangeItemAttrCycleFlag[]; ///< 아이템 속성병경 가능 주기의 Quest Flag 이름
|
||||||
// END_OF_CHANGE_ITEM_ATTRIBUTES
|
// END_OF_CHANGE_ITEM_ATTRIBUTES
|
||||||
|
|
||||||
// PC_BANG_ITEM_ADD
|
|
||||||
private :
|
|
||||||
bool m_isinPCBang;
|
|
||||||
|
|
||||||
public :
|
|
||||||
bool SetPCBang(bool flag) { m_isinPCBang = flag; return m_isinPCBang; }
|
|
||||||
bool IsPCBang() const { return m_isinPCBang; }
|
|
||||||
// END_PC_BANG_ITEM_ADD
|
|
||||||
|
|
||||||
// NEW_HAIR_STYLE_ADD
|
// NEW_HAIR_STYLE_ADD
|
||||||
public :
|
public :
|
||||||
bool ItemProcess_Hair(LPITEM item, int iDestCell);
|
bool ItemProcess_Hair(LPITEM item, int iDestCell);
|
||||||
|
@ -2394,13 +2394,6 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int iExp)
|
|||||||
iExp += (iExp * 50 / 100);
|
iExp += (iExp * 50 / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PC방 아템 경치 보너스
|
|
||||||
if (to->GetPoint(POINT_PC_BANG_EXP_BONUS) > 0)
|
|
||||||
{
|
|
||||||
if (to->IsPCBang() == true)
|
|
||||||
iExp += (iExp * to->GetPoint(POINT_PC_BANG_EXP_BONUS)/100);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 결혼 보너스
|
// 결혼 보너스
|
||||||
iExp += iExp * to->GetMarriageBonus(UNIQUE_ITEM_MARRIAGE_EXP_BONUS) / 100;
|
iExp += iExp * to->GetMarriageBonus(UNIQUE_ITEM_MARRIAGE_EXP_BONUS) / 100;
|
||||||
}
|
}
|
||||||
@ -2417,13 +2410,6 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int iExp)
|
|||||||
iExp += iExp;
|
iExp += iExp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PC방 아템 경치 보너스
|
|
||||||
if (to->GetPoint(POINT_PC_BANG_EXP_BONUS) > 0)
|
|
||||||
{
|
|
||||||
if (to->IsPCBang() == true)
|
|
||||||
iExp += (iExp * to->GetPoint(POINT_PC_BANG_EXP_BONUS)/100);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 결혼 보너스
|
// 결혼 보너스
|
||||||
iExp += iExp * to->GetMarriageBonus(UNIQUE_ITEM_MARRIAGE_EXP_BONUS) / 100;
|
iExp += iExp * to->GetMarriageBonus(UNIQUE_ITEM_MARRIAGE_EXP_BONUS) / 100;
|
||||||
}
|
}
|
||||||
@ -2440,13 +2426,6 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int iExp)
|
|||||||
iExp += (iExp * 20 / 100);
|
iExp += (iExp * 20 / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PC방 아템 경치 보너스
|
|
||||||
if (to->GetPoint(POINT_PC_BANG_EXP_BONUS) > 0)
|
|
||||||
{
|
|
||||||
if (to->IsPCBang() == true)
|
|
||||||
iExp += (iExp * to->GetPoint(POINT_PC_BANG_EXP_BONUS)/100);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 결혼 보너스
|
// 결혼 보너스
|
||||||
iExp += iExp * to->GetMarriageBonus(UNIQUE_ITEM_MARRIAGE_EXP_BONUS) / 100;
|
iExp += iExp * to->GetMarriageBonus(UNIQUE_ITEM_MARRIAGE_EXP_BONUS) / 100;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "castle.h"
|
#include "castle.h"
|
||||||
#include "BattleArena.h"
|
#include "BattleArena.h"
|
||||||
#include "arena.h"
|
#include "arena.h"
|
||||||
#include "pcbang.h"
|
|
||||||
#include "threeway_war.h"
|
#include "threeway_war.h"
|
||||||
|
|
||||||
#include "safebox.h"
|
#include "safebox.h"
|
||||||
@ -2219,19 +2218,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// PC_BANG_ITEM_ADD
|
|
||||||
if (item->IsPCBangItem() == true)
|
|
||||||
{
|
|
||||||
// PC방인지 체크해서 처리
|
|
||||||
if (CPCBangManager::instance().IsPCBangIP(GetDesc()->GetHostName()) == false)
|
|
||||||
{
|
|
||||||
// PC방이 아님!
|
|
||||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("\xC0\xCC \xBE\xC6\xC0\xCC\xC5\xDB\xC0\xBA PC\xB9\xE6\xBF\xA1\xBC\xAD\xB8\xB8 \xBB\xE7\xBF\xEB\xC7\xD2 \xBC\xF6 \xC0\xD6\xBD\xC0\xB4\xCF\xB4\xD9."));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// END_PC_BANG_ITEM_ADD
|
|
||||||
|
|
||||||
AddAffect(AFFECT_EXP_BONUS_EURO_FREE, aApplyInfo[item->GetValue(1)].bPointType, item->GetValue(2), 0, item->GetValue(3), 0, false, true);
|
AddAffect(AFFECT_EXP_BONUS_EURO_FREE, aApplyInfo[item->GetValue(1)].bPointType, item->GetValue(2), 0, item->GetValue(3), 0, false, true);
|
||||||
item->SetCount(item->GetCount() - 1);
|
item->SetCount(item->GetCount() - 1);
|
||||||
}
|
}
|
||||||
@ -3762,11 +3748,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
|||||||
item->SetCount(item->GetCount()-1);
|
item->SetCount(item->GetCount()-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 90008: // VCARD
|
|
||||||
case 90009: // VCARD
|
|
||||||
VCardUse(this, this, item);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ITEM_ELK_VNUM: // 돈꾸러미
|
case ITEM_ELK_VNUM: // 돈꾸러미
|
||||||
{
|
{
|
||||||
int iGold = item->GetSocket(0);
|
int iGold = item->GetSocket(0);
|
||||||
@ -4880,19 +4861,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// PC_BANG_ITEM_ADD
|
|
||||||
if (item->IsPCBangItem() == true)
|
|
||||||
{
|
|
||||||
// PC방인지 체크해서 처리
|
|
||||||
if (CPCBangManager::instance().IsPCBangIP(GetDesc()->GetHostName()) == false)
|
|
||||||
{
|
|
||||||
// PC방이 아님!
|
|
||||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("\xC0\xCC \xBE\xC6\xC0\xCC\xC5\xDB\xC0\xBA PC\xB9\xE6\xBF\xA1\xBC\xAD\xB8\xB8 \xBB\xE7\xBF\xEB\xC7\xD2 \xBC\xF6 \xC0\xD6\xBD\xC0\xB4\xCF\xB4\xD9."));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// END_PC_BANG_ITEM_ADD
|
|
||||||
|
|
||||||
AddAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].bPointType, item->GetValue(2), 0, item->GetValue(3), 0, false);
|
AddAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].bPointType, item->GetValue(2), 0, item->GetValue(3), 0, false);
|
||||||
item->SetCount(item->GetCount() - 1);
|
item->SetCount(item->GetCount() - 1);
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,6 @@ ACMD(do_user_horse_ride);
|
|||||||
ACMD(do_user_horse_back);
|
ACMD(do_user_horse_back);
|
||||||
ACMD(do_user_horse_feed);
|
ACMD(do_user_horse_feed);
|
||||||
|
|
||||||
ACMD(do_pcbang_update);
|
|
||||||
ACMD(do_pcbang_check);
|
|
||||||
|
|
||||||
// ADD_COMMAND_SLOW_STUN
|
// ADD_COMMAND_SLOW_STUN
|
||||||
ACMD(do_slow);
|
ACMD(do_slow);
|
||||||
ACMD(do_stun);
|
ACMD(do_stun);
|
||||||
@ -114,8 +111,6 @@ ACMD(do_cancel_guild_war);
|
|||||||
ACMD(do_guild_state);
|
ACMD(do_guild_state);
|
||||||
|
|
||||||
ACMD(do_pkmode);
|
ACMD(do_pkmode);
|
||||||
ACMD(do_mobile);
|
|
||||||
ACMD(do_mobile_auth);
|
|
||||||
ACMD(do_messenger_auth);
|
ACMD(do_messenger_auth);
|
||||||
|
|
||||||
ACMD(do_getqf);
|
ACMD(do_getqf);
|
||||||
@ -444,9 +439,6 @@ struct command_info cmd_info[] =
|
|||||||
{ "horse_unsummon", do_horse_unsummon, 0, POS_DEAD, GM_HIGH_WIZARD },
|
{ "horse_unsummon", do_horse_unsummon, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||||
{ "horse_set_stat", do_horse_set_stat, 0, POS_DEAD, GM_HIGH_WIZARD },
|
{ "horse_set_stat", do_horse_set_stat, 0, POS_DEAD, GM_HIGH_WIZARD },
|
||||||
|
|
||||||
{ "pcbang_update", do_pcbang_update, 0, POS_DEAD, GM_LOW_WIZARD },
|
|
||||||
{ "pcbang_check", do_pcbang_check, 0, POS_DEAD, GM_LOW_WIZARD },
|
|
||||||
|
|
||||||
{ "emotion_allow", do_emotion_allow, 0, POS_FIGHTING, GM_PLAYER },
|
{ "emotion_allow", do_emotion_allow, 0, POS_FIGHTING, GM_PLAYER },
|
||||||
{ "kiss", do_emotion, 0, POS_FIGHTING, GM_PLAYER },
|
{ "kiss", do_emotion, 0, POS_FIGHTING, GM_PLAYER },
|
||||||
{ "slap", do_emotion, 0, POS_FIGHTING, GM_PLAYER },
|
{ "slap", do_emotion, 0, POS_FIGHTING, GM_PLAYER },
|
||||||
|
@ -2006,8 +2006,6 @@ static const char* FN_point_string(int apply_number)
|
|||||||
case POINT_NORMAL_HIT_DAMAGE_BONUS: return LC_TEXT("\xC6\xF2\xC5\xB8 \xB5\xA5\xB9\xCC\xC1\xF6 %d%%");
|
case POINT_NORMAL_HIT_DAMAGE_BONUS: return LC_TEXT("\xC6\xF2\xC5\xB8 \xB5\xA5\xB9\xCC\xC1\xF6 %d%%");
|
||||||
case POINT_SKILL_DEFEND_BONUS: return LC_TEXT("\xBD\xBA\xC5\xB3 \xB5\xA5\xB9\xCC\xC1\xF6 \xC0\xFA\xC7\xD7 %d%%");
|
case POINT_SKILL_DEFEND_BONUS: return LC_TEXT("\xBD\xBA\xC5\xB3 \xB5\xA5\xB9\xCC\xC1\xF6 \xC0\xFA\xC7\xD7 %d%%");
|
||||||
case POINT_NORMAL_HIT_DEFEND_BONUS: return LC_TEXT("\xC6\xF2\xC5\xB8 \xB5\xA5\xB9\xCC\xC1\xF6 \xC0\xFA\xC7\xD7 %d%%");
|
case POINT_NORMAL_HIT_DEFEND_BONUS: return LC_TEXT("\xC6\xF2\xC5\xB8 \xB5\xA5\xB9\xCC\xC1\xF6 \xC0\xFA\xC7\xD7 %d%%");
|
||||||
// case POINT_PC_BANG_EXP_BONUS: return LC_TEXT("");
|
|
||||||
// case POINT_PC_BANG_DROP_BONUS: return LC_TEXT("");
|
|
||||||
// case POINT_EXTRACT_HP_PCT: return LC_TEXT("");
|
// case POINT_EXTRACT_HP_PCT: return LC_TEXT("");
|
||||||
case POINT_RESIST_WARRIOR: return LC_TEXT("\xB9\xAB\xBB\xE7\xB0\xF8\xB0\xDD\xBF\xA1 %d%% \xC0\xFA\xC7\xD7");
|
case POINT_RESIST_WARRIOR: return LC_TEXT("\xB9\xAB\xBB\xE7\xB0\xF8\xB0\xDD\xBF\xA1 %d%% \xC0\xFA\xC7\xD7");
|
||||||
case POINT_RESIST_ASSASSIN: return LC_TEXT("\xC0\xDA\xB0\xB4\xB0\xF8\xB0\xDD\xBF\xA1 %d%% \xC0\xFA\xC7\xD7");
|
case POINT_RESIST_ASSASSIN: return LC_TEXT("\xC0\xDA\xB0\xB4\xB0\xF8\xB0\xDD\xBF\xA1 %d%% \xC0\xFA\xC7\xD7");
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "BattleArena.h"
|
#include "BattleArena.h"
|
||||||
#include "xmas_event.h"
|
#include "xmas_event.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "pcbang.h"
|
|
||||||
#include "threeway_war.h"
|
#include "threeway_war.h"
|
||||||
#include "unique_item.h"
|
#include "unique_item.h"
|
||||||
#include "DragonSoul.h"
|
#include "DragonSoul.h"
|
||||||
@ -82,52 +81,6 @@ void Command_ApplyAffect(LPCHARACTER ch, const char* argument, const char* affec
|
|||||||
}
|
}
|
||||||
// END_OF_ADD_COMMAND_SLOW_STUN
|
// END_OF_ADD_COMMAND_SLOW_STUN
|
||||||
|
|
||||||
ACMD(do_pcbang_update)
|
|
||||||
{
|
|
||||||
char arg1[256];
|
|
||||||
one_argument(argument, arg1, sizeof(arg1));
|
|
||||||
|
|
||||||
unsigned int PCBangID = 0;
|
|
||||||
|
|
||||||
if (*arg1 == '\0')
|
|
||||||
PCBangID = 0;
|
|
||||||
else
|
|
||||||
str_to_number(PCBangID, arg1);
|
|
||||||
|
|
||||||
if (PCBangID == 0)
|
|
||||||
{
|
|
||||||
CPCBangManager::instance().RequestUpdateIPList(0);
|
|
||||||
ch->ChatPacket(CHAT_TYPE_INFO, "PCBang Info Update For All");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CPCBangManager::instance().RequestUpdateIPList(PCBangID);
|
|
||||||
ch->ChatPacket(CHAT_TYPE_INFO, "PCBang Info Update For %u", PCBangID);
|
|
||||||
}
|
|
||||||
|
|
||||||
TPacketPCBangUpdate packet;
|
|
||||||
packet.bHeader = HEADER_GG_PCBANG_UPDATE;
|
|
||||||
packet.ulPCBangID = PCBangID;
|
|
||||||
|
|
||||||
P2P_MANAGER::instance().Send(&packet, sizeof(TPacketPCBangUpdate));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ACMD(do_pcbang_check)
|
|
||||||
{
|
|
||||||
char arg1[256];
|
|
||||||
one_argument(argument, arg1, sizeof(arg1));
|
|
||||||
|
|
||||||
if (CPCBangManager::instance().IsPCBangIP(arg1) == true)
|
|
||||||
{
|
|
||||||
ch->ChatPacket(CHAT_TYPE_INFO, "%s is a PCBang IP", arg1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ch->ChatPacket(CHAT_TYPE_INFO, "%s is not a PCBang IP", arg1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ACMD(do_stun)
|
ACMD(do_stun)
|
||||||
{
|
{
|
||||||
Command_ApplyAffect(ch, argument, "stun", COMMANDAFFECT_STUN);
|
Command_ApplyAffect(ch, argument, "stun", COMMANDAFFECT_STUN);
|
||||||
@ -2099,11 +2052,6 @@ ACMD(do_reload)
|
|||||||
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
|
||||||
ch->ChatPacket(CHAT_TYPE_INFO, "Reloading notice string.");
|
|
||||||
DBManager::instance().LoadDBString();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'q':
|
case 'q':
|
||||||
ch->ChatPacket(CHAT_TYPE_INFO, "Reloading quest.");
|
ch->ChatPacket(CHAT_TYPE_INFO, "Reloading quest.");
|
||||||
quest::CQuestManager::instance().Reload();
|
quest::CQuestManager::instance().Reload();
|
||||||
@ -2133,9 +2081,6 @@ ACMD(do_reload)
|
|||||||
|
|
||||||
ch->ChatPacket(CHAT_TYPE_INFO, "Reloading prototype tables,");
|
ch->ChatPacket(CHAT_TYPE_INFO, "Reloading prototype tables,");
|
||||||
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
||||||
|
|
||||||
ch->ChatPacket(CHAT_TYPE_INFO, "Reloading notice string.");
|
|
||||||
DBManager::instance().LoadDBString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,6 @@ BYTE g_bAuthServer = false;
|
|||||||
bool g_bCheckClientVersion = true;
|
bool g_bCheckClientVersion = true;
|
||||||
string g_stClientVersion = "1215955205";
|
string g_stClientVersion = "1215955205";
|
||||||
|
|
||||||
BYTE g_bBilling = false;
|
|
||||||
|
|
||||||
string g_stAuthMasterIP;
|
string g_stAuthMasterIP;
|
||||||
WORD g_wAuthMasterPort = 0;
|
WORD g_wAuthMasterPort = 0;
|
||||||
|
|
||||||
@ -913,11 +911,6 @@ void config_init(const string& st_localeServiceName)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOKEN("billing")
|
|
||||||
{
|
|
||||||
g_bBilling = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
TOKEN("quest_dir")
|
TOKEN("quest_dir")
|
||||||
{
|
{
|
||||||
SPDLOG_INFO("QUEST_DIR SETTING : {}", value_string);
|
SPDLOG_INFO("QUEST_DIR SETTING : {}", value_string);
|
||||||
|
@ -64,7 +64,6 @@ extern void LoadStateUserCount();
|
|||||||
extern bool g_bEmpireWhisper;
|
extern bool g_bEmpireWhisper;
|
||||||
|
|
||||||
extern BYTE g_bAuthServer;
|
extern BYTE g_bAuthServer;
|
||||||
extern BYTE g_bBilling;
|
|
||||||
|
|
||||||
extern BYTE PK_PROTECT_LEVEL;
|
extern BYTE PK_PROTECT_LEVEL;
|
||||||
|
|
||||||
|
@ -893,6 +893,7 @@ const TApplyInfo aApplyInfo[MAX_APPLY_NUM] =
|
|||||||
{ POINT_NORMAL_HIT_DEFEND_BONUS }, // 74
|
{ POINT_NORMAL_HIT_DEFEND_BONUS }, // 74
|
||||||
// END_OF_DEFEND_BONUS_ATTRIBUTES
|
// END_OF_DEFEND_BONUS_ATTRIBUTES
|
||||||
|
|
||||||
|
// TODO: check if these can be safely removed
|
||||||
// PC_BANG_ITEM_ADD
|
// PC_BANG_ITEM_ADD
|
||||||
{ POINT_PC_BANG_EXP_BONUS }, // 75
|
{ POINT_PC_BANG_EXP_BONUS }, // 75
|
||||||
{ POINT_PC_BANG_DROP_BONUS }, // 76
|
{ POINT_PC_BANG_DROP_BONUS }, // 76
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <common/billing.h>
|
|
||||||
#include <common/length.h>
|
#include <common/length.h>
|
||||||
|
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
@ -17,7 +16,6 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "login_data.h"
|
#include "login_data.h"
|
||||||
#include "locale_service.h"
|
#include "locale_service.h"
|
||||||
#include "pcbang.h"
|
|
||||||
#include "spam.h"
|
#include "spam.h"
|
||||||
|
|
||||||
extern std::string g_stBlockDate;
|
extern std::string g_stBlockDate;
|
||||||
@ -38,11 +36,6 @@ bool DBManager::Connect(const char * host, const int port, const char * user, co
|
|||||||
if (!m_sql_direct.Setup(host, user, pwd, db, g_stLocale.c_str(), true, port))
|
if (!m_sql_direct.Setup(host, user, pwd, db, g_stLocale.c_str(), true, port))
|
||||||
SPDLOG_ERROR("cannot open direct sql connection to host {}", host);
|
SPDLOG_ERROR("cannot open direct sql connection to host {}", host);
|
||||||
|
|
||||||
if (m_bIsConnect && !g_bAuthServer)
|
|
||||||
{
|
|
||||||
LoadDBString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_bIsConnect;
|
return m_bIsConnect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,260 +157,10 @@ void DBManager::DeleteLoginData(CLoginData * pkLD)
|
|||||||
|
|
||||||
SPDLOG_DEBUG("DeleteLoginData {} {}", pkLD->GetLogin(), (void*) pkLD);
|
SPDLOG_DEBUG("DeleteLoginData {} {}", pkLD->GetLogin(), (void*) pkLD);
|
||||||
|
|
||||||
mapLDBilling.erase(pkLD->GetLogin());
|
|
||||||
|
|
||||||
M2_DELETE(it->second);
|
M2_DELETE(it->second);
|
||||||
m_map_pkLoginData.erase(it);
|
m_map_pkLoginData.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBManager::SetBilling(DWORD dwKey, bool bOn, bool bSkipPush)
|
|
||||||
{
|
|
||||||
std::map<DWORD, CLoginData *>::iterator it = m_map_pkLoginData.find(dwKey);
|
|
||||||
|
|
||||||
if (it == m_map_pkLoginData.end())
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("cannot find login key {}", dwKey);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLoginData * ld = it->second;
|
|
||||||
|
|
||||||
itertype(mapLDBilling) it2 = mapLDBilling.find(ld->GetLogin());
|
|
||||||
|
|
||||||
if (it2 != mapLDBilling.end())
|
|
||||||
if (it2->second != ld)
|
|
||||||
DeleteLoginData(it2->second);
|
|
||||||
|
|
||||||
mapLDBilling.insert(std::make_pair(ld->GetLogin(), ld));
|
|
||||||
|
|
||||||
if (ld->IsBilling() && !bOn && !bSkipPush)
|
|
||||||
PushBilling(ld);
|
|
||||||
|
|
||||||
SendLoginPing(ld->GetLogin());
|
|
||||||
ld->SetBilling(bOn);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DBManager::PushBilling(CLoginData * pkLD)
|
|
||||||
{
|
|
||||||
TUseTime t;
|
|
||||||
|
|
||||||
t.dwUseSec = (get_dword_time() - pkLD->GetLogonTime()) / 1000;
|
|
||||||
|
|
||||||
if (t.dwUseSec <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pkLD->SetLogonTime();
|
|
||||||
int lRemainSecs = pkLD->GetRemainSecs() - t.dwUseSec;
|
|
||||||
pkLD->SetRemainSecs(std::max(0, lRemainSecs));
|
|
||||||
|
|
||||||
t.dwLoginKey = pkLD->GetKey();
|
|
||||||
t.bBillType = pkLD->GetBillType();
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("BILLING: PUSH {} {} type {}", pkLD->GetLogin(), t.dwUseSec, t.bBillType);
|
|
||||||
|
|
||||||
if (t.bBillType == BILLING_IP_FREE || t.bBillType == BILLING_IP_TIME || t.bBillType == BILLING_IP_DAY)
|
|
||||||
snprintf(t.szLogin, sizeof(t.szLogin), "%u", pkLD->GetBillID());
|
|
||||||
else
|
|
||||||
strlcpy(t.szLogin, pkLD->GetLogin(), sizeof(t.szLogin));
|
|
||||||
|
|
||||||
strlcpy(t.szIP, pkLD->GetIP(), sizeof(t.szIP));
|
|
||||||
|
|
||||||
m_vec_kUseTime.push_back(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DBManager::FlushBilling(bool bForce)
|
|
||||||
{
|
|
||||||
if (bForce)
|
|
||||||
{
|
|
||||||
std::map<DWORD, CLoginData *>::iterator it = m_map_pkLoginData.begin();
|
|
||||||
|
|
||||||
while (it != m_map_pkLoginData.end())
|
|
||||||
{
|
|
||||||
CLoginData * pkLD = (it++)->second;
|
|
||||||
|
|
||||||
if (pkLD->IsBilling())
|
|
||||||
PushBilling(pkLD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_vec_kUseTime.empty())
|
|
||||||
{
|
|
||||||
DWORD dwCount = 0;
|
|
||||||
|
|
||||||
std::vector<TUseTime>::iterator it = m_vec_kUseTime.begin();
|
|
||||||
|
|
||||||
while (it != m_vec_kUseTime.end())
|
|
||||||
{
|
|
||||||
TUseTime * p = &(*(it++));
|
|
||||||
|
|
||||||
// DISABLE_OLD_BILLING_CODE
|
|
||||||
if (!g_bBilling)
|
|
||||||
{
|
|
||||||
++dwCount;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Query("INSERT GameTimeLog (login, type, logon_time, logout_time, use_time, ip, server) "
|
|
||||||
"VALUES('%s', %u, DATE_SUB(NOW(), INTERVAL %u SECOND), NOW(), %u, '%s', '%s')",
|
|
||||||
p->szLogin, p->bBillType, p->dwUseSec, p->dwUseSec, p->szIP, g_stHostname.c_str());
|
|
||||||
// DISABLE_OLD_BILLING_CODE_END
|
|
||||||
|
|
||||||
switch (p->bBillType)
|
|
||||||
{
|
|
||||||
case BILLING_FREE:
|
|
||||||
case BILLING_IP_FREE:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BILLING_DAY:
|
|
||||||
{
|
|
||||||
if (!bForce)
|
|
||||||
{
|
|
||||||
TUseTime * pInfo = M2_NEW TUseTime;
|
|
||||||
memcpy(pInfo, p, sizeof(TUseTime));
|
|
||||||
ReturnQuery(QID_BILLING_CHECK, 0, pInfo,
|
|
||||||
"SELECT UNIX_TIMESTAMP(LimitDt)-UNIX_TIMESTAMP(NOW()),LimitTime FROM GameTime WHERE UserID='%s'", p->szLogin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BILLING_TIME:
|
|
||||||
{
|
|
||||||
Query("UPDATE GameTime SET LimitTime=LimitTime-%u WHERE UserID='%s'", p->dwUseSec, p->szLogin);
|
|
||||||
|
|
||||||
if (!bForce)
|
|
||||||
{
|
|
||||||
TUseTime * pInfo = M2_NEW TUseTime;
|
|
||||||
memcpy(pInfo, p, sizeof(TUseTime));
|
|
||||||
ReturnQuery(QID_BILLING_CHECK, 0, pInfo,
|
|
||||||
"SELECT UNIX_TIMESTAMP(LimitDt)-UNIX_TIMESTAMP(NOW()),LimitTime FROM GameTime WHERE UserID='%s'", p->szLogin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BILLING_IP_DAY:
|
|
||||||
{
|
|
||||||
if (!bForce)
|
|
||||||
{
|
|
||||||
TUseTime * pInfo = M2_NEW TUseTime;
|
|
||||||
memcpy(pInfo, p, sizeof(TUseTime));
|
|
||||||
ReturnQuery(QID_BILLING_CHECK, 0, pInfo,
|
|
||||||
"SELECT UNIX_TIMESTAMP(LimitDt)-UNIX_TIMESTAMP(NOW()),LimitTime FROM GameTimeIP WHERE ipid=%s", p->szLogin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BILLING_IP_TIME:
|
|
||||||
{
|
|
||||||
Query("UPDATE GameTimeIP SET LimitTime=LimitTime-%u WHERE ipid=%s", p->dwUseSec, p->szLogin);
|
|
||||||
|
|
||||||
if (!bForce)
|
|
||||||
{
|
|
||||||
TUseTime * pInfo = M2_NEW TUseTime;
|
|
||||||
memcpy(pInfo, p, sizeof(TUseTime));
|
|
||||||
ReturnQuery(QID_BILLING_CHECK, 0, pInfo,
|
|
||||||
"SELECT UNIX_TIMESTAMP(LimitDt)-UNIX_TIMESTAMP(NOW()),LimitTime FROM GameTimeIP WHERE ipid=%s", p->szLogin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bForce && ++dwCount >= 1000)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dwCount < m_vec_kUseTime.size())
|
|
||||||
{
|
|
||||||
int nNewSize = m_vec_kUseTime.size() - dwCount;
|
|
||||||
memcpy(&m_vec_kUseTime[0], &m_vec_kUseTime[dwCount], sizeof(TUseTime) * nNewSize);
|
|
||||||
m_vec_kUseTime.resize(nNewSize);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_vec_kUseTime.clear();
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("FLUSH_USE_TIME: count {}", dwCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_vec_kUseTime.size() < 10240)
|
|
||||||
{
|
|
||||||
DWORD dwCurTime = get_dword_time();
|
|
||||||
|
|
||||||
std::map<DWORD, CLoginData *>::iterator it = m_map_pkLoginData.begin();
|
|
||||||
|
|
||||||
while (it != m_map_pkLoginData.end())
|
|
||||||
{
|
|
||||||
CLoginData * pkLD = (it++)->second;
|
|
||||||
|
|
||||||
if (!pkLD->IsBilling())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
switch (pkLD->GetBillType())
|
|
||||||
{
|
|
||||||
case BILLING_IP_FREE:
|
|
||||||
case BILLING_FREE:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BILLING_IP_DAY:
|
|
||||||
case BILLING_DAY:
|
|
||||||
case BILLING_IP_TIME:
|
|
||||||
case BILLING_TIME:
|
|
||||||
if (pkLD->GetRemainSecs() < 0)
|
|
||||||
{
|
|
||||||
DWORD dwSecsConnected = (dwCurTime - pkLD->GetLogonTime()) / 1000;
|
|
||||||
|
|
||||||
if (dwSecsConnected % 10 == 0)
|
|
||||||
SendBillingExpire(pkLD->GetLogin(), BILLING_DAY, 0, pkLD);
|
|
||||||
}
|
|
||||||
else if (pkLD->GetRemainSecs() <= 600) // if remain seconds lower than 10 minutes
|
|
||||||
{
|
|
||||||
DWORD dwSecsConnected = (dwCurTime - pkLD->GetLogonTime()) / 1000;
|
|
||||||
|
|
||||||
if (dwSecsConnected >= 60) // 60 second cycle
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("BILLING 1 {} remain {} connected secs {}",
|
|
||||||
pkLD->GetLogin(), pkLD->GetRemainSecs(), dwSecsConnected);
|
|
||||||
PushBilling(pkLD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DWORD dwSecsConnected = (dwCurTime - pkLD->GetLogonTime()) / 1000;
|
|
||||||
|
|
||||||
if (dwSecsConnected > (DWORD) (pkLD->GetRemainSecs() - 600) || dwSecsConnected >= 600)
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("BILLING 2 {} remain {} connected secs {}",
|
|
||||||
pkLD->GetLogin(), pkLD->GetRemainSecs(), dwSecsConnected);
|
|
||||||
PushBilling(pkLD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DBManager::CheckBilling()
|
|
||||||
{
|
|
||||||
std::vector<DWORD> vec;
|
|
||||||
vec.push_back(0); // 카운트를 위해 미리 비워둔다.
|
|
||||||
|
|
||||||
itertype(m_map_pkLoginData) it = m_map_pkLoginData.begin();
|
|
||||||
|
|
||||||
while (it != m_map_pkLoginData.end())
|
|
||||||
{
|
|
||||||
CLoginData * pkLD = (it++)->second;
|
|
||||||
|
|
||||||
if (pkLD->IsBilling())
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("BILLING: CHECK {}", pkLD->GetKey());
|
|
||||||
vec.push_back(pkLD->GetKey());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vec[0] = vec.size() - 1; // 비워둔 곳에 사이즈를 넣는다, 사이즈 자신은 제외해야 하므로 -1
|
|
||||||
db_clientdesc->DBPacket(HEADER_GD_BILLING_CHECK, 0, &vec[0], sizeof(DWORD) * vec.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DBManager::SendLoginPing(const char * c_pszLogin)
|
void DBManager::SendLoginPing(const char * c_pszLogin)
|
||||||
{
|
{
|
||||||
TPacketGGLoginPing ptog;
|
TPacketGGLoginPing ptog;
|
||||||
@ -450,8 +193,6 @@ void DBManager::SendAuthLogin(LPDESC d)
|
|||||||
trim_and_lower(r.login, ptod.szLogin, sizeof(ptod.szLogin));
|
trim_and_lower(r.login, ptod.szLogin, sizeof(ptod.szLogin));
|
||||||
strlcpy(ptod.szSocialID, r.social_id, sizeof(ptod.szSocialID));
|
strlcpy(ptod.szSocialID, r.social_id, sizeof(ptod.szSocialID));
|
||||||
ptod.dwLoginKey = d->GetLoginKey();
|
ptod.dwLoginKey = d->GetLoginKey();
|
||||||
ptod.bBillType = pkLD->GetBillType();
|
|
||||||
ptod.dwBillID = pkLD->GetBillID();
|
|
||||||
|
|
||||||
memcpy(ptod.iPremiumTimes, pkLD->GetPremiumPtr(), sizeof(ptod.iPremiumTimes));
|
memcpy(ptod.iPremiumTimes, pkLD->GetPremiumPtr(), sizeof(ptod.iPremiumTimes));
|
||||||
memcpy(&ptod.adwClientKey, pkLD->GetClientKey(), sizeof(DWORD) * 4);
|
memcpy(&ptod.adwClientKey, pkLD->GetClientKey(), sizeof(DWORD) * 4);
|
||||||
@ -462,7 +203,7 @@ void DBManager::SendAuthLogin(LPDESC d)
|
|||||||
SendLoginPing(r.login);
|
SendLoginPing(r.login);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBManager::LoginPrepare(BYTE bBillType, DWORD dwBillID, int lRemainSecs, LPDESC d, DWORD * pdwClientKey, int * paiPremiumTimes)
|
void DBManager::LoginPrepare(LPDESC d, DWORD * pdwClientKey, int * paiPremiumTimes)
|
||||||
{
|
{
|
||||||
const TAccountTable & r = d->GetAccountTable();
|
const TAccountTable & r = d->GetAccountTable();
|
||||||
|
|
||||||
@ -470,9 +211,6 @@ void DBManager::LoginPrepare(BYTE bBillType, DWORD dwBillID, int lRemainSecs, LP
|
|||||||
|
|
||||||
pkLD->SetKey(d->GetLoginKey());
|
pkLD->SetKey(d->GetLoginKey());
|
||||||
pkLD->SetLogin(r.login);
|
pkLD->SetLogin(r.login);
|
||||||
pkLD->SetBillType(bBillType);
|
|
||||||
pkLD->SetBillID(dwBillID);
|
|
||||||
pkLD->SetRemainSecs(lRemainSecs);
|
|
||||||
pkLD->SetIP(d->GetHostName());
|
pkLD->SetIP(d->GetHostName());
|
||||||
pkLD->SetClientKey(pdwClientKey);
|
pkLD->SetClientKey(pdwClientKey);
|
||||||
|
|
||||||
@ -514,108 +252,6 @@ void DBManager::LoginPrepare(BYTE bBillType, DWORD dwBillID, int lRemainSecs, LP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetGameTimeIP(MYSQL_RES * pRes, BYTE & bBillType, DWORD & dwBillID, int & seconds, const char * c_pszIP)
|
|
||||||
{
|
|
||||||
if (!pRes)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
MYSQL_ROW row = mysql_fetch_row(pRes);
|
|
||||||
int col = 0;
|
|
||||||
|
|
||||||
str_to_number(dwBillID, row[col++]);
|
|
||||||
|
|
||||||
int ip_start = 0;
|
|
||||||
str_to_number(ip_start, row[col++]);
|
|
||||||
|
|
||||||
int ip_end = 0;
|
|
||||||
str_to_number(ip_end, row[col++]);
|
|
||||||
|
|
||||||
int type = 0;
|
|
||||||
str_to_number(type, row[col++]);
|
|
||||||
|
|
||||||
str_to_number(seconds, row[col++]);
|
|
||||||
|
|
||||||
int day_seconds = 0;
|
|
||||||
str_to_number(day_seconds, row[col++]);
|
|
||||||
|
|
||||||
char szIP[MAX_HOST_LENGTH + 1];
|
|
||||||
strlcpy(szIP, c_pszIP, sizeof(szIP));
|
|
||||||
|
|
||||||
char * p = strrchr(szIP, '.');
|
|
||||||
++p;
|
|
||||||
|
|
||||||
int ip_postfix = 0;
|
|
||||||
str_to_number(ip_postfix, p);
|
|
||||||
int valid_ip = false;
|
|
||||||
|
|
||||||
if (ip_start <= ip_postfix && ip_end >= ip_postfix)
|
|
||||||
valid_ip = true;
|
|
||||||
|
|
||||||
bBillType = BILLING_NONE;
|
|
||||||
|
|
||||||
if (valid_ip)
|
|
||||||
{
|
|
||||||
if (type == -1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (type == 0)
|
|
||||||
bBillType = BILLING_IP_FREE;
|
|
||||||
else if (day_seconds > 0)
|
|
||||||
{
|
|
||||||
bBillType = BILLING_IP_DAY;
|
|
||||||
seconds = day_seconds;
|
|
||||||
}
|
|
||||||
else if (seconds > 0)
|
|
||||||
bBillType = BILLING_IP_TIME;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetGameTime(MYSQL_RES * pRes, BYTE & bBillType, int & seconds)
|
|
||||||
{
|
|
||||||
if (!pRes)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
MYSQL_ROW row = mysql_fetch_row(pRes);
|
|
||||||
SPDLOG_DEBUG("GetGameTime {} {} {}", row[0], row[1], row[2]);
|
|
||||||
|
|
||||||
int type = 0;
|
|
||||||
str_to_number(type, row[0]);
|
|
||||||
str_to_number(seconds, row[1]);
|
|
||||||
int day_seconds = 0;
|
|
||||||
str_to_number(day_seconds, row[2]);
|
|
||||||
bBillType = BILLING_NONE;
|
|
||||||
|
|
||||||
if (type == -1)
|
|
||||||
return false;
|
|
||||||
else if (type == 0)
|
|
||||||
bBillType = BILLING_FREE;
|
|
||||||
else if (day_seconds > 0)
|
|
||||||
{
|
|
||||||
bBillType = BILLING_DAY;
|
|
||||||
seconds = day_seconds;
|
|
||||||
}
|
|
||||||
else if (seconds > 0)
|
|
||||||
bBillType = BILLING_TIME;
|
|
||||||
|
|
||||||
if (!g_bBilling)
|
|
||||||
bBillType = BILLING_FREE;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendBillingExpire(const char * c_pszLogin, BYTE bBillType, int iSecs, CLoginData * pkLD)
|
|
||||||
{
|
|
||||||
TPacketBillingExpire ptod;
|
|
||||||
|
|
||||||
strlcpy(ptod.szLogin, c_pszLogin, sizeof(ptod.szLogin));
|
|
||||||
ptod.bBillType = bBillType;
|
|
||||||
ptod.dwRemainSeconds = std::max(0, iSecs);
|
|
||||||
db_clientdesc->DBPacket(HEADER_GD_BILLING_EXPIRE, 0, &ptod, sizeof(TPacketBillingExpire));
|
|
||||||
SPDLOG_DEBUG("BILLING: EXPIRE {} type {} sec {} ptr {}", c_pszLogin, bBillType, iSecs, (void*) pkLD);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
||||||
{
|
{
|
||||||
CReturnQueryInfo * qi = (CReturnQueryInfo *) pMsg->pvUserData;
|
CReturnQueryInfo * qi = (CReturnQueryInfo *) pMsg->pvUserData;
|
||||||
@ -632,7 +268,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
|||||||
M2_DELETE(pinfo);
|
M2_DELETE(pinfo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//위치 변경 - By SeMinZ
|
// Change Location
|
||||||
d->SetLogin(pinfo->login);
|
d->SetLogin(pinfo->login);
|
||||||
|
|
||||||
SPDLOG_DEBUG("QID_AUTH_LOGIN: START {} {}", qi->dwIdent, (void*) get_pointer(d));
|
SPDLOG_DEBUG("QID_AUTH_LOGIN: START {} {}", qi->dwIdent, (void*) get_pointer(d));
|
||||||
@ -813,122 +449,15 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
|||||||
|
|
||||||
d->SetMatrixCode(szMatrixCode);
|
d->SetMatrixCode(szMatrixCode);
|
||||||
|
|
||||||
if (!g_bBilling)
|
|
||||||
{
|
|
||||||
LoginPrepare(BILLING_FREE, 0, 0, d, pinfo->adwClientKey, aiPremiumTimes);
|
|
||||||
//By SeMinZ
|
|
||||||
M2_DELETE(pinfo);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("QID_AUTH_LOGIN: SUCCESS {}", pinfo->login);
|
SPDLOG_DEBUG("QID_AUTH_LOGIN: SUCCESS {}", pinfo->login);
|
||||||
|
|
||||||
|
LoginPrepare(d, pinfo->adwClientKey, aiPremiumTimes);
|
||||||
|
M2_DELETE(pinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QID_BILLING_GET_TIME:
|
|
||||||
{
|
|
||||||
TPacketCGLogin3 * pinfo = (TPacketCGLogin3 *) qi->pvData;
|
|
||||||
LPDESC d = DESC_MANAGER::instance().FindByLoginKey(qi->dwIdent);
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("QID_BILLING_GET_TIME: START ident {} d {}", qi->dwIdent, (void*) get_pointer(d));
|
|
||||||
|
|
||||||
if (d)
|
|
||||||
{
|
|
||||||
if (pMsg->Get()->uiNumRows == 0)
|
|
||||||
{
|
|
||||||
if (g_bBilling)
|
|
||||||
LoginFailure(d, "NOBILL");
|
|
||||||
else
|
|
||||||
LoginPrepare(BILLING_FREE, 0, 0, d, pinfo->adwClientKey);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int seconds = 0;
|
|
||||||
BYTE bBillType = BILLING_NONE;
|
|
||||||
|
|
||||||
if (!GetGameTime(pMsg->Get()->pSQLResult, bBillType, seconds))
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("QID_BILLING_GET_TIME: BLOCK");
|
|
||||||
LoginFailure(d, "BLOCK");
|
|
||||||
}
|
|
||||||
else if (bBillType == BILLING_NONE)
|
|
||||||
{
|
|
||||||
LoginFailure(d, "NOBILL");
|
|
||||||
SPDLOG_DEBUG("QID_BILLING_GET_TIME: NO TIME");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LoginPrepare(bBillType, 0, seconds, d, pinfo->adwClientKey);
|
|
||||||
SPDLOG_DEBUG("QID_BILLING_GET_TIME: SUCCESS");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
M2_DELETE(pinfo);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QID_BILLING_CHECK:
|
|
||||||
{
|
|
||||||
TUseTime * pinfo = (TUseTime *) qi->pvData;
|
|
||||||
int iRemainSecs = 0;
|
|
||||||
|
|
||||||
CLoginData * pkLD = NULL;
|
|
||||||
|
|
||||||
if (pMsg->Get()->uiNumRows > 0)
|
|
||||||
{
|
|
||||||
MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);
|
|
||||||
|
|
||||||
int iLimitDt = 0;
|
|
||||||
str_to_number(iLimitDt, row[0]);
|
|
||||||
|
|
||||||
int iLimitTime = 0;
|
|
||||||
str_to_number(iLimitTime, row[1]);
|
|
||||||
|
|
||||||
pkLD = GetLoginData(pinfo->dwLoginKey);
|
|
||||||
|
|
||||||
if (pkLD)
|
|
||||||
{
|
|
||||||
switch (pkLD->GetBillType())
|
|
||||||
{
|
|
||||||
case BILLING_TIME:
|
|
||||||
if (iLimitTime <= 600 && iLimitDt > 0)
|
|
||||||
{
|
|
||||||
iRemainSecs = iLimitDt;
|
|
||||||
pkLD->SetBillType(BILLING_DAY);
|
|
||||||
pinfo->bBillType = BILLING_DAY;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
iRemainSecs = iLimitTime;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BILLING_IP_TIME:
|
|
||||||
if (iLimitTime <= 600 && iLimitDt > 0)
|
|
||||||
{
|
|
||||||
iRemainSecs = iLimitDt;
|
|
||||||
pkLD->SetBillType(BILLING_IP_DAY);
|
|
||||||
pinfo->bBillType = BILLING_IP_DAY;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
iRemainSecs = iLimitTime;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BILLING_DAY:
|
|
||||||
case BILLING_IP_DAY:
|
|
||||||
iRemainSecs = iLimitDt;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pkLD->SetRemainSecs(iRemainSecs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SendBillingExpire(pinfo->szLogin, pinfo->bBillType, std::max(0, iRemainSecs), pkLD);
|
|
||||||
M2_DELETE(pinfo);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QID_SAFEBOX_SIZE:
|
case QID_SAFEBOX_SIZE:
|
||||||
{
|
{
|
||||||
LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(qi->dwIdent);
|
LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(qi->dwIdent);
|
||||||
@ -946,34 +475,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QID_DB_STRING:
|
|
||||||
{
|
|
||||||
m_map_dbstring.clear();
|
|
||||||
m_vec_GreetMessage.clear();
|
|
||||||
|
|
||||||
for (uint i = 0; i < pMsg->Get()->uiNumRows; ++i)
|
|
||||||
{
|
|
||||||
MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);
|
|
||||||
//ch->SetSafeboxSize(SAFEBOX_PAGE_SIZE * atoi(row[0]));
|
|
||||||
if (row[0] && row[1])
|
|
||||||
{
|
|
||||||
m_map_dbstring.insert(make_pair(std::string(row[0]), std::string(row[1])));
|
|
||||||
SPDLOG_DEBUG("DBSTR '{}' '{}'", row[0], row[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (m_map_dbstring.find("GREET") != m_map_dbstring.end())
|
|
||||||
{
|
|
||||||
std::istringstream is(m_map_dbstring["GREET"]);
|
|
||||||
while (!is.eof())
|
|
||||||
{
|
|
||||||
std::string str;
|
|
||||||
getline(is, str);
|
|
||||||
m_vec_GreetMessage.push_back(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QID_LOTTO:
|
case QID_LOTTO:
|
||||||
{
|
{
|
||||||
LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(qi->dwIdent);
|
LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(qi->dwIdent);
|
||||||
@ -1006,39 +507,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
|||||||
}
|
}
|
||||||
break;
|
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
|
// BLOCK_CHAT
|
||||||
case QID_BLOCK_CHAT_LIST:
|
case QID_BLOCK_CHAT_LIST:
|
||||||
{
|
{
|
||||||
@ -1062,73 +530,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
|||||||
break;
|
break;
|
||||||
// END_OF_BLOCK_CHAT
|
// END_OF_BLOCK_CHAT
|
||||||
|
|
||||||
// PCBANG_IP_LIST
|
|
||||||
case QID_PCBANG_IP_LIST_CHECK:
|
|
||||||
{
|
|
||||||
const std::string PCBANG_IP_TABLE_NAME("pcbang_ip");
|
|
||||||
|
|
||||||
if (pMsg->Get()->uiNumRows > 0)
|
|
||||||
{
|
|
||||||
MYSQL_ROW row;
|
|
||||||
bool isFinded = false;
|
|
||||||
|
|
||||||
while ((row = mysql_fetch_row(pMsg->Get()->pSQLResult)))
|
|
||||||
{
|
|
||||||
const char* c_szName = row[0];
|
|
||||||
const char* c_szUpdateTime = row[12];
|
|
||||||
|
|
||||||
SPDLOG_TRACE("{}:{}", c_szName, c_szUpdateTime);
|
|
||||||
|
|
||||||
if (PCBANG_IP_TABLE_NAME == c_szName)
|
|
||||||
{
|
|
||||||
isFinded = true;
|
|
||||||
|
|
||||||
static std::string s_stLastTime;
|
|
||||||
if (s_stLastTime != c_szUpdateTime)
|
|
||||||
{
|
|
||||||
s_stLastTime = c_szUpdateTime;
|
|
||||||
SPDLOG_DEBUG("'{}' mysql table is UPDATED({})", PCBANG_IP_TABLE_NAME, c_szUpdateTime);
|
|
||||||
ReturnQuery(QID_PCBANG_IP_LIST_SELECT, 0, NULL, "SELECT pcbang_id, ip FROM %s;", PCBANG_IP_TABLE_NAME.c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("'{}' mysql table is NOT updated({})", PCBANG_IP_TABLE_NAME, c_szUpdateTime);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isFinded)
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("'{}' mysql table CANNOT FIND", PCBANG_IP_TABLE_NAME);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (test_server)
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("'{}' mysql table is NOT EXIST", PCBANG_IP_TABLE_NAME);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QID_PCBANG_IP_LIST_SELECT:
|
|
||||||
{
|
|
||||||
if (pMsg->Get()->uiNumRows > 0)
|
|
||||||
{
|
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
while ((row = mysql_fetch_row(pMsg->Get()->pSQLResult)))
|
|
||||||
{
|
|
||||||
CPCBangManager::instance().InsertIP(row[0], row[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
SPDLOG_TRACE("PCBANG_IP_LIST is EMPTY");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
// END_OF_PCBANG_IP_LIST
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
SPDLOG_ERROR("FATAL ERROR!!! Unhandled return query id {}", qi->iType);
|
SPDLOG_ERROR("FATAL ERROR!!! Unhandled return query id {}", qi->iType);
|
||||||
break;
|
break;
|
||||||
@ -1137,25 +538,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
|||||||
M2_DELETE(qi);
|
M2_DELETE(qi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBManager::LoadDBString()
|
|
||||||
{
|
|
||||||
ReturnQuery(QID_DB_STRING, 0, NULL, "SELECT name, text FROM string%s", get_table_postfix());
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string& DBManager::GetDBString(const std::string& key)
|
|
||||||
{
|
|
||||||
static std::string null_str = "";
|
|
||||||
itertype(m_map_dbstring) it = m_map_dbstring.find(key);
|
|
||||||
if (it == m_map_dbstring.end())
|
|
||||||
return null_str;
|
|
||||||
return it->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<std::string>& DBManager::GetGreetMessage()
|
|
||||||
{
|
|
||||||
return m_vec_GreetMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DBManager::SendMoneyLog(BYTE type, DWORD vnum, int gold)
|
void DBManager::SendMoneyLog(BYTE type, DWORD vnum, int gold)
|
||||||
{
|
{
|
||||||
if (!gold)
|
if (!gold)
|
||||||
@ -1167,46 +549,6 @@ void DBManager::SendMoneyLog(BYTE type, DWORD vnum, int gold)
|
|||||||
db_clientdesc->DBPacket(HEADER_GD_MONEY_LOG, 0, &p, sizeof(p));
|
db_clientdesc->DBPacket(HEADER_GD_MONEY_LOG, 0, &p, sizeof(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCardUse(LPCHARACTER CardOwner, LPCHARACTER CardTaker, LPITEM item)
|
|
||||||
{
|
|
||||||
TPacketGDVCard p;
|
|
||||||
|
|
||||||
p.dwID = item->GetSocket(0);
|
|
||||||
strlcpy(p.szSellCharacter, CardOwner->GetName(), sizeof(p.szSellCharacter));
|
|
||||||
strlcpy(p.szSellAccount, CardOwner->GetDesc()->GetAccountTable().login, sizeof(p.szSellAccount));
|
|
||||||
strlcpy(p.szBuyCharacter, CardTaker->GetName(), sizeof(p.szBuyCharacter));
|
|
||||||
strlcpy(p.szBuyAccount, CardTaker->GetDesc()->GetAccountTable().login, sizeof(p.szBuyAccount));
|
|
||||||
|
|
||||||
db_clientdesc->DBPacket(HEADER_GD_VCARD, 0, &p, sizeof(TPacketGDVCard));
|
|
||||||
|
|
||||||
CardTaker->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d\xBA\xD0\xC0\xC7 \xB0\xE1\xC1\xA6\xBD\xC3\xB0\xA3\xC0\xCC \xC3\xDF\xB0\xA1 \xB5\xC7\xBE\xFA\xBD\xC0\xB4\xCF\xB4\xD9. (\xB0\xE1\xC1\xA6\xB9\xF8\xC8\xA3 %d)"), item->GetSocket(1) / 60, item->GetSocket(0));
|
|
||||||
|
|
||||||
LogManager::instance().VCardLog(p.dwID, CardTaker->GetX(), CardTaker->GetY(), g_stHostname.c_str(),
|
|
||||||
CardOwner->GetName(), CardOwner->GetDesc()->GetHostName(),
|
|
||||||
CardTaker->GetName(), CardTaker->GetDesc()->GetHostName());
|
|
||||||
|
|
||||||
ITEM_MANAGER::instance().RemoveItem(item);
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("VCARD_TAKE: {} {} -> {}", p.dwID, CardOwner->GetName(), CardTaker->GetName());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DBManager::StopAllBilling()
|
|
||||||
{
|
|
||||||
for (itertype(m_map_pkLoginData) it = m_map_pkLoginData.begin(); it != m_map_pkLoginData.end(); ++it)
|
|
||||||
{
|
|
||||||
SetBilling(it->first, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DBManager::RequestBlockException(const char *login, int cmd)
|
|
||||||
{
|
|
||||||
TPacketBlockException packet;
|
|
||||||
|
|
||||||
packet.cmd = cmd;
|
|
||||||
strlcpy(packet.login, login, sizeof(packet.login));
|
|
||||||
db_clientdesc->DBPacket(HEADER_GD_BLOCK_EXCEPTION, 0, &packet, sizeof(packet));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t DBManager::EscapeString(char* dst, size_t dstSize, const char *src, size_t srcSize)
|
size_t DBManager::EscapeString(char* dst, size_t dstSize, const char *src, size_t srcSize)
|
||||||
{
|
{
|
||||||
return m_sql_direct.EscapeString(dst, dstSize, src, srcSize);
|
return m_sql_direct.EscapeString(dst, dstSize, src, srcSize);
|
||||||
|
@ -14,37 +14,14 @@ enum
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
QID_SAFEBOX_SIZE,
|
QID_SAFEBOX_SIZE,
|
||||||
QID_DB_STRING,
|
|
||||||
QID_AUTH_LOGIN,
|
QID_AUTH_LOGIN,
|
||||||
QID_LOTTO,
|
QID_LOTTO,
|
||||||
QID_HIGHSCORE_REGISTER,
|
|
||||||
QID_HIGHSCORE_SHOW,
|
|
||||||
QID_BILLING_GET_TIME,
|
|
||||||
QID_BILLING_CHECK,
|
|
||||||
|
|
||||||
// BLOCK_CHAT
|
// BLOCK_CHAT
|
||||||
QID_BLOCK_CHAT_LIST,
|
QID_BLOCK_CHAT_LIST,
|
||||||
// END_OF_BLOCK_CHAT
|
// END_OF_BLOCK_CHAT
|
||||||
|
|
||||||
// PCBANG_IP_LIST
|
|
||||||
QID_PCBANG_IP_LIST_CHECK,
|
|
||||||
QID_PCBANG_IP_LIST_SELECT,
|
|
||||||
// END_OF_PCBANG_IP_LIST
|
|
||||||
|
|
||||||
// PROTECT_CHILD_FOR_NEWCIBN
|
|
||||||
QID_PROTECT_CHILD,
|
|
||||||
// END_PROTECT_CHILD_FOR_NEWCIBN
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct SUseTime
|
|
||||||
{
|
|
||||||
DWORD dwLoginKey;
|
|
||||||
char szLogin[LOGIN_MAX_LEN+1];
|
|
||||||
BYTE bBillType;
|
|
||||||
DWORD dwUseSec;
|
|
||||||
char szIP[MAX_HOST_LENGTH+1];
|
|
||||||
} TUseTime;
|
|
||||||
|
|
||||||
class CQueryInfo
|
class CQueryInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -93,32 +70,18 @@ class DBManager : public singleton<DBManager>
|
|||||||
|
|
||||||
void SendMoneyLog(BYTE type, DWORD vnum, int gold);
|
void SendMoneyLog(BYTE type, DWORD vnum, int gold);
|
||||||
|
|
||||||
void LoginPrepare(BYTE bBillType, DWORD dwBillID, int lRemainSecs, LPDESC d, DWORD * pdwClientKey, int * paiPremiumTimes = NULL);
|
void LoginPrepare(LPDESC d, DWORD * pdwClientKey, int * paiPremiumTimes = NULL);
|
||||||
void SendAuthLogin(LPDESC d);
|
void SendAuthLogin(LPDESC d);
|
||||||
void SendLoginPing(const char * c_pszLogin);
|
void SendLoginPing(const char * c_pszLogin);
|
||||||
|
|
||||||
void InsertLoginData(CLoginData * pkLD);
|
void InsertLoginData(CLoginData * pkLD);
|
||||||
void DeleteLoginData(CLoginData * pkLD);
|
void DeleteLoginData(CLoginData * pkLD);
|
||||||
CLoginData * GetLoginData(DWORD dwKey);
|
CLoginData * GetLoginData(DWORD dwKey);
|
||||||
void SetBilling(DWORD dwKey, bool bOn, bool bSkipPush = false);
|
|
||||||
void PushBilling(CLoginData * pkLD);
|
|
||||||
void FlushBilling(bool bForce=false);
|
|
||||||
void CheckBilling();
|
|
||||||
|
|
||||||
void StopAllBilling(); // 20050503.ipkn.DB-AUTH 접속 종료시 빌링 테이블 모두 지우기 (재연결시 복구함)
|
|
||||||
|
|
||||||
DWORD CountQuery() { return m_sql.CountQuery(); }
|
DWORD CountQuery() { return m_sql.CountQuery(); }
|
||||||
DWORD CountQueryResult() { return m_sql.CountResult(); }
|
DWORD CountQueryResult() { return m_sql.CountResult(); }
|
||||||
void ResetQueryResult() { m_sql.ResetQueryFinished(); }
|
void ResetQueryResult() { m_sql.ResetQueryFinished(); }
|
||||||
|
|
||||||
// BLOCK EXCEPTION
|
|
||||||
void RequestBlockException(const char *login, int cmd);
|
|
||||||
// BLOCK EXCEPTION
|
|
||||||
|
|
||||||
void LoadDBString();
|
|
||||||
const std::string & GetDBString(const std::string& key);
|
|
||||||
const std::vector<std::string> & GetGreetMessage();
|
|
||||||
|
|
||||||
template<class Functor> void FuncQuery(Functor f, const char * c_pszFormat, ...); // 결과를 f인자로 호출함 (SQLMsg *) 알아서 해제됨
|
template<class Functor> void FuncQuery(Functor f, const char * c_pszFormat, ...); // 결과를 f인자로 호출함 (SQLMsg *) 알아서 해제됨
|
||||||
template<class Functor> void FuncAfterQuery(Functor f, const char * c_pszFormat, ...); // 끝나고 나면 f가 호출됨 void f(void) 형태
|
template<class Functor> void FuncAfterQuery(Functor f, const char * c_pszFormat, ...); // 끝나고 나면 f가 호출됨 void f(void) 형태
|
||||||
|
|
||||||
@ -131,11 +94,7 @@ class DBManager : public singleton<DBManager>
|
|||||||
CAsyncSQL m_sql_direct;
|
CAsyncSQL m_sql_direct;
|
||||||
bool m_bIsConnect;
|
bool m_bIsConnect;
|
||||||
|
|
||||||
std::map<std::string, std::string> m_map_dbstring;
|
|
||||||
std::vector<std::string> m_vec_GreetMessage;
|
|
||||||
std::map<DWORD, CLoginData *> m_map_pkLoginData;
|
std::map<DWORD, CLoginData *> m_map_pkLoginData;
|
||||||
std::map<std::string, CLoginData *> mapLDBilling;
|
|
||||||
std::vector<TUseTime> m_vec_kUseTime;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Functor> void DBManager::FuncQuery(Functor f, const char* c_pszFormat, ...)
|
template <class Functor> void DBManager::FuncQuery(Functor f, const char* c_pszFormat, ...)
|
||||||
@ -173,16 +132,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);
|
|
||||||
|
|
||||||
|
|
||||||
// ACCOUNT_DB
|
// ACCOUNT_DB
|
||||||
|
@ -121,8 +121,6 @@ void DESC::Initialize()
|
|||||||
m_dwProcCRC = 0;
|
m_dwProcCRC = 0;
|
||||||
m_dwFileCRC = 0;
|
m_dwFileCRC = 0;
|
||||||
|
|
||||||
m_dwBillingExpireSecond = 0;
|
|
||||||
|
|
||||||
m_outtime = 0;
|
m_outtime = 0;
|
||||||
m_playtime = 0;
|
m_playtime = 0;
|
||||||
m_offtime = 0;
|
m_offtime = 0;
|
||||||
@ -725,16 +723,6 @@ void DESC::AssembleCRCMagicCube(BYTE bProcPiece, BYTE bFilePiece)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DESC::SetBillingExpireSecond(DWORD dwSec)
|
|
||||||
{
|
|
||||||
m_dwBillingExpireSecond = dwSec;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD DESC::GetBillingExpireSecond()
|
|
||||||
{
|
|
||||||
return m_dwBillingExpireSecond;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DESC::push_seq(BYTE hdr, BYTE seq)
|
void DESC::push_seq(BYTE hdr, BYTE seq)
|
||||||
{
|
{
|
||||||
if (m_seq_vector.size()>=20)
|
if (m_seq_vector.size()>=20)
|
||||||
|
@ -155,9 +155,6 @@ class DESC
|
|||||||
|
|
||||||
void AssembleCRCMagicCube(BYTE bProcPiece, BYTE bFilePiece);
|
void AssembleCRCMagicCube(BYTE bProcPiece, BYTE bFilePiece);
|
||||||
|
|
||||||
void SetBillingExpireSecond(DWORD dwSec);
|
|
||||||
DWORD GetBillingExpireSecond();
|
|
||||||
|
|
||||||
void SetClientVersion(const char * c_pszTimestamp) { m_stClientVersion = c_pszTimestamp; }
|
void SetClientVersion(const char * c_pszTimestamp) { m_stClientVersion = c_pszTimestamp; }
|
||||||
const char * GetClientVersion() { return m_stClientVersion.c_str(); }
|
const char * GetClientVersion() { return m_stClientVersion.c_str(); }
|
||||||
|
|
||||||
@ -217,7 +214,6 @@ class DESC
|
|||||||
DWORD m_dwProcCRC;
|
DWORD m_dwProcCRC;
|
||||||
DWORD m_dwFileCRC;
|
DWORD m_dwFileCRC;
|
||||||
|
|
||||||
DWORD m_dwBillingExpireSecond;
|
|
||||||
std::string m_stClientVersion;
|
std::string m_stClientVersion;
|
||||||
std::string m_stMatrixCode;
|
std::string m_stMatrixCode;
|
||||||
|
|
||||||
|
@ -75,7 +75,6 @@ void CLIENT_DESC::Destroy()
|
|||||||
CPartyManager::instance().DeleteAllParty();
|
CPartyManager::instance().DeleteAllParty();
|
||||||
CPartyManager::instance().DisablePCParty();
|
CPartyManager::instance().DisablePCParty();
|
||||||
CGuildManager::instance().StopAllGuildWar();
|
CGuildManager::instance().StopAllGuildWar();
|
||||||
DBManager::instance().StopAllBilling();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SPDLOG_DEBUG("SYSTEM: closing client socket.");
|
SPDLOG_DEBUG("SYSTEM: closing client socket.");
|
||||||
|
@ -438,12 +438,6 @@ bool CExchange::Done()
|
|||||||
|
|
||||||
assert(empty_pos >= 0);
|
assert(empty_pos >= 0);
|
||||||
|
|
||||||
if (item->GetVnum() == 90008 || item->GetVnum() == 90009) // VCARD
|
|
||||||
{
|
|
||||||
VCardUse(m_pOwner, victim, item);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pOwner->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255);
|
m_pOwner->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255);
|
||||||
|
|
||||||
item->RemoveFromCharacter();
|
item->RemoveFromCharacter();
|
||||||
|
@ -649,26 +649,6 @@ void Take(fishing_event_info* info, LPCHARACTER ch)
|
|||||||
{
|
{
|
||||||
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("\xC0\xCC\xB9\xF8\xBF\xA1 \xC0\xE2\xC0\xBA \xB9\xB0\xB0\xED\xB1\xE2\xC0\xC7 \xB1\xE6\xC0\xCC\xB4\xC2 %.2fcm"), item->GetSocket(0)/100.f);
|
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("\xC0\xCC\xB9\xF8\xBF\xA1 \xC0\xE2\xC0\xBA \xB9\xB0\xB0\xED\xB1\xE2\xC0\xC7 \xB1\xE6\xC0\xCC\xB4\xC2 %.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("\xB3\xAC\xBD\xC3\xC0\xCC\xBA\xA5\xC6\xAE\xBF\xF9\xC3\xB4\xBA\xD8\xBE\xEE"), sizeof(p.szBoard));
|
|
||||||
}
|
|
||||||
else if (info->fish_id == 6)
|
|
||||||
{
|
|
||||||
strlcpy(p.szBoard, LC_TEXT("\xB3\xAC\xBD\xC3\xC0\xCC\xBA\xA5\xC6\xAE\xC0\xD7\xBE\xEE"), sizeof(p.szBoard));
|
|
||||||
}
|
|
||||||
|
|
||||||
db_clientdesc->DBPacket(HEADER_GD_HIGHSCORE_REGISTER, 0, &p, sizeof(TPacketGDHighscore));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int map_idx = ch->GetMapIndex();
|
int map_idx = ch->GetMapIndex();
|
||||||
|
@ -435,7 +435,6 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
|||||||
{
|
{
|
||||||
LoadStateUserCount();
|
LoadStateUserCount();
|
||||||
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
||||||
DBManager::instance().LoadDBString();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -451,10 +450,6 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
|||||||
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
|
||||||
DBManager::instance().LoadDBString();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'q':
|
case 'q':
|
||||||
quest::CQuestManager::instance().Reload();
|
quest::CQuestManager::instance().Reload();
|
||||||
break;
|
break;
|
||||||
@ -543,20 +538,6 @@ int CInputHandshake::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!stBuf.compare(0, 15, "BLOCK_EXCEPTION"))
|
|
||||||
{
|
|
||||||
// BLOCK_EXCEPTION cmd(add=1, del=2) login
|
|
||||||
std::istringstream is(stBuf);
|
|
||||||
std::string dummy_string;
|
|
||||||
std::string login_string;
|
|
||||||
int cmd;
|
|
||||||
|
|
||||||
is >> dummy_string >> cmd >> login_string;
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("block_exception {}:{}", login_string.c_str(), cmd);
|
|
||||||
DBManager::instance().RequestBlockException(login_string.c_str(), cmd);
|
|
||||||
stResult = "BLOCK_EXCEPTION_YES";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,12 +240,6 @@ protected:
|
|||||||
|
|
||||||
void SetEventFlag(const char* c_pData);
|
void SetEventFlag(const char* c_pData);
|
||||||
|
|
||||||
void BillingRepair(const char * c_pData);
|
|
||||||
void BillingExpire(const char * c_pData);
|
|
||||||
void BillingLogin(const char * c_pData);
|
|
||||||
void BillingCheck(const char * c_pData);
|
|
||||||
void VCard(const char * c_pData);
|
|
||||||
|
|
||||||
void CreateObject(const char * c_pData);
|
void CreateObject(const char * c_pData);
|
||||||
void DeleteObject(const char * c_pData);
|
void DeleteObject(const char * c_pData);
|
||||||
void UpdateLand(const char * c_pData);
|
void UpdateLand(const char * c_pData);
|
||||||
@ -268,8 +262,6 @@ protected:
|
|||||||
|
|
||||||
void ChangeMonarchLord(TPacketChangeMonarchLordACK* data);
|
void ChangeMonarchLord(TPacketChangeMonarchLordACK* data);
|
||||||
void UpdateMonarchInfo(TMonarchInfo* data);
|
void UpdateMonarchInfo(TMonarchInfo* data);
|
||||||
void AddBlockCountryIp(TPacketBlockCountryIp * data);
|
|
||||||
void BlockException(TPacketBlockException * data);
|
|
||||||
|
|
||||||
// MYSHOP_PRICE_LIST
|
// MYSHOP_PRICE_LIST
|
||||||
/// 아이템 가격정보 리스트 요청에 대한 응답 패킷(HEADER_DG_MYSHOP_PRICELIST_RES) 처리함수
|
/// 아이템 가격정보 리스트 요청에 대한 응답 패킷(HEADER_DG_MYSHOP_PRICELIST_RES) 처리함수
|
||||||
@ -316,7 +308,6 @@ class CInputP2P : public CInputProcessor
|
|||||||
void Disconnect(const char * c_pData);
|
void Disconnect(const char * c_pData);
|
||||||
void MessengerAdd(const char * c_pData);
|
void MessengerAdd(const char * c_pData);
|
||||||
void MessengerRemove(const char * c_pData);
|
void MessengerRemove(const char * c_pData);
|
||||||
void MessengerMobile(const char * c_pData);
|
|
||||||
void FindPosition(LPDESC d, const char* c_pData);
|
void FindPosition(LPDESC d, const char* c_pData);
|
||||||
void WarpCharacter(const char* c_pData);
|
void WarpCharacter(const char* c_pData);
|
||||||
void GuildWarZoneMapIndex(const char* c_pData);
|
void GuildWarZoneMapIndex(const char* c_pData);
|
||||||
@ -325,7 +316,6 @@ class CInputP2P : public CInputProcessor
|
|||||||
void XmasWarpSantaReply(const char * c_pData);
|
void XmasWarpSantaReply(const char * c_pData);
|
||||||
void LoginPing(LPDESC d, const char * c_pData);
|
void LoginPing(LPDESC d, const char * c_pData);
|
||||||
void BlockChat(const char * c_pData);
|
void BlockChat(const char * c_pData);
|
||||||
void PCBangUpdate(const char* c_pData);
|
|
||||||
void IamAwake(LPDESC d, const char * c_pData);
|
void IamAwake(LPDESC d, const char * c_pData);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -32,14 +32,12 @@
|
|||||||
#include "monarch.h"
|
#include "monarch.h"
|
||||||
#include "affect.h"
|
#include "affect.h"
|
||||||
#include "castle.h"
|
#include "castle.h"
|
||||||
#include "block_country.h"
|
|
||||||
#include "motion.h"
|
#include "motion.h"
|
||||||
|
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#include "horsename_manager.h"
|
#include "horsename_manager.h"
|
||||||
#include "pcbang.h"
|
|
||||||
#include "gm.h"
|
#include "gm.h"
|
||||||
#include "panama.h"
|
#include "panama.h"
|
||||||
#include "map_location.h"
|
#include "map_location.h"
|
||||||
@ -421,11 +419,6 @@ void CInputDB::PlayerLoad(LPDESC d, const char * data)
|
|||||||
{
|
{
|
||||||
LogManager::instance().LoginLog(true,
|
LogManager::instance().LoginLog(true,
|
||||||
ch->GetDesc()->GetAccountTable().id, ch->GetPlayerID(), ch->GetLevel(), ch->GetJob(), ch->GetRealPoint(POINT_PLAYTIME));
|
ch->GetDesc()->GetAccountTable().id, ch->GetPlayerID(), ch->GetLevel(), ch->GetJob(), ch->GetRealPoint(POINT_PLAYTIME));
|
||||||
|
|
||||||
if (LC_IsBrazil() != true )
|
|
||||||
{
|
|
||||||
ch->SetPCBang(CPCBangManager::instance().IsPCBangIP(ch->GetDesc()->GetHostName()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -998,16 +991,8 @@ void CInputDB::Boot(const char* data)
|
|||||||
CMobManager::instance().DumpRegenCount("mob_count");
|
CMobManager::instance().DumpRegenCount("mob_count");
|
||||||
}
|
}
|
||||||
|
|
||||||
CPCBangManager::instance().RequestUpdateIPList(0);
|
|
||||||
|
|
||||||
// castle_boot
|
// castle_boot
|
||||||
castle_boot();
|
castle_boot();
|
||||||
|
|
||||||
// request blocked_country_ip
|
|
||||||
{
|
|
||||||
db_clientdesc->DBPacket(HEADER_GD_BLOCK_COUNTRY_IP, 0, NULL, 0);
|
|
||||||
SPDLOG_TRACE("<sent HEADER_GD_BLOCK_COUNTRY_IP>");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EVENTINFO(quest_login_event_info)
|
EVENTINFO(quest_login_event_info)
|
||||||
@ -1838,90 +1823,6 @@ void CInputDB::UpdateLand(const char * c_pData)
|
|||||||
CManager::instance().UpdateLand((TLand *) c_pData);
|
CManager::instance().UpdateLand((TLand *) c_pData);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Billing
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void CInputDB::BillingRepair(const char * c_pData)
|
|
||||||
{
|
|
||||||
DWORD dwCount = *(DWORD *) c_pData;
|
|
||||||
c_pData += sizeof(DWORD);
|
|
||||||
|
|
||||||
TPacketBillingRepair * p = (TPacketBillingRepair *) c_pData;
|
|
||||||
|
|
||||||
for (DWORD i = 0; i < dwCount; ++i, ++p)
|
|
||||||
{
|
|
||||||
CLoginData * pkLD = M2_NEW CLoginData;
|
|
||||||
|
|
||||||
pkLD->SetKey(p->dwLoginKey);
|
|
||||||
pkLD->SetLogin(p->szLogin);
|
|
||||||
pkLD->SetIP(p->szHost);
|
|
||||||
|
|
||||||
SPDLOG_INFO("BILLING: REPAIR {} host {}", p->szLogin, p->szHost);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CInputDB::BillingExpire(const char * c_pData)
|
|
||||||
{
|
|
||||||
TPacketBillingExpire * p = (TPacketBillingExpire *) c_pData;
|
|
||||||
|
|
||||||
LPDESC d = DESC_MANAGER::instance().FindByLoginName(p->szLogin);
|
|
||||||
|
|
||||||
if (!d)
|
|
||||||
return;
|
|
||||||
|
|
||||||
LPCHARACTER ch = d->GetCharacter();
|
|
||||||
|
|
||||||
if (p->dwRemainSeconds <= 60)
|
|
||||||
{
|
|
||||||
int i = std::max<int>(5, p->dwRemainSeconds);
|
|
||||||
SPDLOG_INFO("BILLING_EXPIRE: {} {}", p->szLogin, p->dwRemainSeconds);
|
|
||||||
d->DelayedDisconnect(i);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((p->dwRemainSeconds - d->GetBillingExpireSecond()) > 60)
|
|
||||||
{
|
|
||||||
d->SetBillingExpireSecond(p->dwRemainSeconds);
|
|
||||||
|
|
||||||
if (ch)
|
|
||||||
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("\xB0\xE1\xC0\xE7\xB1\xE2\xB0\xA3\xC0\xCC %d\xBA\xD0 \xC8\xC4 \xB8\xB8\xB7\xE1 \xB5\xCB\xB4\xCF\xB4\xD9."), (p->dwRemainSeconds / 60));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CInputDB::BillingLogin(const char * c_pData)
|
|
||||||
{
|
|
||||||
if (NULL == c_pData)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TPacketBillingLogin * p;
|
|
||||||
|
|
||||||
DWORD dwCount = *(DWORD *) c_pData;
|
|
||||||
c_pData += sizeof(DWORD);
|
|
||||||
|
|
||||||
p = (TPacketBillingLogin *) c_pData;
|
|
||||||
|
|
||||||
for (DWORD i = 0; i < dwCount; ++i, ++p)
|
|
||||||
{
|
|
||||||
DBManager::instance().SetBilling(p->dwLoginKey, p->bLogin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CInputDB::BillingCheck(const char * c_pData)
|
|
||||||
{
|
|
||||||
DWORD size = *(DWORD *) c_pData;
|
|
||||||
c_pData += sizeof(DWORD);
|
|
||||||
|
|
||||||
for (DWORD i = 0; i < size; ++i)
|
|
||||||
{
|
|
||||||
DWORD dwKey = *(DWORD *) c_pData;
|
|
||||||
c_pData += sizeof(DWORD);
|
|
||||||
|
|
||||||
SPDLOG_INFO("BILLING: NOT_LOGIN {}", dwKey);
|
|
||||||
DBManager::instance().SetBilling(dwKey, 0, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CInputDB::Notice(const char * c_pData)
|
void CInputDB::Notice(const char * c_pData)
|
||||||
{
|
{
|
||||||
extern void SendNotice(const char * c_pszBuf);
|
extern void SendNotice(const char * c_pszBuf);
|
||||||
@ -1935,61 +1836,6 @@ void CInputDB::Notice(const char * c_pData)
|
|||||||
SendNotice(szBuf);
|
SendNotice(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputDB::VCard(const char * c_pData)
|
|
||||||
{
|
|
||||||
TPacketGDVCard * p = (TPacketGDVCard *) c_pData;
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("VCARD: {} {} {} {} {}", p->dwID, p->szSellCharacter, p->szSellAccount, p->szBuyCharacter, p->szBuyAccount);
|
|
||||||
|
|
||||||
std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT sell_account, buy_account, time FROM vcard WHERE id=%u", p->dwID));
|
|
||||||
if (pmsg->Get()->uiNumRows != 1)
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("VCARD_FAIL: no data");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
|
|
||||||
|
|
||||||
if (strcmp(row[0], p->szSellAccount))
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("VCARD_FAIL: sell account differ {}", row[0]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!row[1] || *row[1])
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("VCARD_FAIL: buy account already exist");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int time = 0;
|
|
||||||
str_to_number(time, row[2]);
|
|
||||||
|
|
||||||
if (!row[2] || time < 0)
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("VCARD_FAIL: time null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<SQLMsg> pmsg1(DBManager::instance().DirectQuery("UPDATE GameTime SET LimitTime=LimitTime+%d WHERE UserID='%s'", time, p->szBuyAccount));
|
|
||||||
|
|
||||||
if (pmsg1->Get()->uiAffectedRows == 0 || pmsg1->Get()->uiAffectedRows == (uint32_t)-1)
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("VCARD_FAIL: cannot modify GameTime table");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<SQLMsg> pmsg2(DBManager::instance().DirectQuery("UPDATE vcard,GameTime SET sell_pid='%s', buy_pid='%s', buy_account='%s', sell_time=NOW(), new_time=GameTime.LimitTime WHERE vcard.id=%u AND GameTime.UserID='%s'", p->szSellCharacter, p->szBuyCharacter, p->szBuyAccount, p->dwID, p->szBuyAccount));
|
|
||||||
|
|
||||||
if (pmsg2->Get()->uiAffectedRows == 0 || pmsg2->Get()->uiAffectedRows == (uint32_t)-1)
|
|
||||||
{
|
|
||||||
SPDLOG_ERROR("VCARD_FAIL: cannot modify vcard table");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDLOG_DEBUG("VCARD_SUCCESS: {} {}", p->szBuyAccount, p->szBuyCharacter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CInputDB::GuildWarReserveAdd(TGuildWarReserve * p)
|
void CInputDB::GuildWarReserveAdd(TGuildWarReserve * p)
|
||||||
{
|
{
|
||||||
CGuildManager::instance().ReserveWarAdd(p);
|
CGuildManager::instance().ReserveWarAdd(p);
|
||||||
@ -2318,26 +2164,6 @@ int CInputDB::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
|||||||
SetEventFlag(c_pData);
|
SetEventFlag(c_pData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_DG_BILLING_REPAIR:
|
|
||||||
BillingRepair(c_pData);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_DG_BILLING_EXPIRE:
|
|
||||||
BillingExpire(c_pData);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_DG_BILLING_LOGIN:
|
|
||||||
BillingLogin(c_pData);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_DG_BILLING_CHECK:
|
|
||||||
BillingCheck(c_pData);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_DG_VCARD:
|
|
||||||
VCard(c_pData);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_DG_CREATE_OBJECT:
|
case HEADER_DG_CREATE_OBJECT:
|
||||||
CreateObject(c_pData);
|
CreateObject(c_pData);
|
||||||
break;
|
break;
|
||||||
@ -2426,13 +2252,6 @@ int CInputDB::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
|||||||
UpdateMonarchInfo((TMonarchInfo*)c_pData);
|
UpdateMonarchInfo((TMonarchInfo*)c_pData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_DG_BLOCK_COUNTRY_IP:
|
|
||||||
this->AddBlockCountryIp((TPacketBlockCountryIp *) c_pData);
|
|
||||||
break;
|
|
||||||
case HEADER_DG_BLOCK_EXCEPTION:
|
|
||||||
this->BlockException((TPacketBlockException *) c_pData);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_DG_ACK_CHANGE_GUILD_MASTER :
|
case HEADER_DG_ACK_CHANGE_GUILD_MASTER :
|
||||||
this->GuildChangeMaster((TPacketChangeGuildMaster*) c_pData);
|
this->GuildChangeMaster((TPacketChangeGuildMaster*) c_pData);
|
||||||
break;
|
break;
|
||||||
@ -2588,16 +2407,6 @@ void CInputDB::UpdateMonarchInfo(TMonarchInfo* info)
|
|||||||
SPDLOG_INFO("MONARCH INFO UPDATED");
|
SPDLOG_INFO("MONARCH INFO UPDATED");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputDB::AddBlockCountryIp(TPacketBlockCountryIp * data)
|
|
||||||
{
|
|
||||||
add_blocked_country_ip(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CInputDB::BlockException(TPacketBlockException *data)
|
|
||||||
{
|
|
||||||
block_exception(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CInputDB::GuildChangeMaster(TPacketChangeGuildMaster* p)
|
void CInputDB::GuildChangeMaster(TPacketChangeGuildMaster* p)
|
||||||
{
|
{
|
||||||
CGuildManager::instance().ChangeMaster(p->dwGuildID);
|
CGuildManager::instance().ChangeMaster(p->dwGuildID);
|
||||||
@ -2655,4 +2464,4 @@ void CInputDB::RespondChannelStatus(LPDESC desc, const char* pcData)
|
|||||||
BYTE bSuccess = 1;
|
BYTE bSuccess = 1;
|
||||||
desc->Packet(&bSuccess, sizeof(bSuccess));
|
desc->Packet(&bSuccess, sizeof(bSuccess));
|
||||||
desc->SetChannelStatusRequested(false);
|
desc->SetChannelStatusRequested(false);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "arena.h"
|
#include "arena.h"
|
||||||
#include "OXEvent.h"
|
#include "OXEvent.h"
|
||||||
#include "priv_manager.h"
|
#include "priv_manager.h"
|
||||||
#include "block_country.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "horsename_manager.h"
|
#include "horsename_manager.h"
|
||||||
#include "MarkManager.h"
|
#include "MarkManager.h"
|
||||||
@ -140,20 +139,6 @@ void CInputLogin::LoginByKey(LPDESC d, const char * data)
|
|||||||
char login[LOGIN_MAX_LEN + 1];
|
char login[LOGIN_MAX_LEN + 1];
|
||||||
trim_and_lower(pinfo->login, login, sizeof(login));
|
trim_and_lower(pinfo->login, login, sizeof(login));
|
||||||
|
|
||||||
// is blocked ip?
|
|
||||||
{
|
|
||||||
SPDLOG_TRACE("check_blocked_country_start");
|
|
||||||
|
|
||||||
if (!is_block_exception(login) && is_blocked_country_ip(d->GetHostName()))
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("BLOCK_COUNTRY_IP ({})", d->GetHostName());
|
|
||||||
d->SetPhase(PHASE_CLOSE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SPDLOG_TRACE("check_blocked_country_end");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_bNoMoreClient)
|
if (g_bNoMoreClient)
|
||||||
{
|
{
|
||||||
TPacketGCLoginFailure failurePacket;
|
TPacketGCLoginFailure failurePacket;
|
||||||
@ -622,8 +607,6 @@ void CInputLogin::Entergame(LPDESC d, const char * data)
|
|||||||
p2.channel = g_bChannel;
|
p2.channel = g_bChannel;
|
||||||
d->Packet(&p2, sizeof(p2));
|
d->Packet(&p2, sizeof(p2));
|
||||||
|
|
||||||
ch->SendGreetMessage();
|
|
||||||
|
|
||||||
_send_bonus_info(ch);
|
_send_bonus_info(ch);
|
||||||
|
|
||||||
for (int i = 0; i <= PREMIUM_MAX_NUM; ++i)
|
for (int i = 0; i <= PREMIUM_MAX_NUM; ++i)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <common/billing.h>
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "desc_client.h"
|
#include "desc_client.h"
|
||||||
#include "desc_manager.h"
|
#include "desc_manager.h"
|
||||||
@ -17,7 +16,6 @@
|
|||||||
#include "castle.h"
|
#include "castle.h"
|
||||||
#include "locale_service.h"
|
#include "locale_service.h"
|
||||||
#include "questmanager.h"
|
#include "questmanager.h"
|
||||||
#include "pcbang.h"
|
|
||||||
#include "skill.h"
|
#include "skill.h"
|
||||||
#include "threeway_war.h"
|
#include "threeway_war.h"
|
||||||
|
|
||||||
@ -370,8 +368,6 @@ void CInputP2P::LoginPing(LPDESC d, const char * c_pData)
|
|||||||
{
|
{
|
||||||
TPacketGGLoginPing * p = (TPacketGGLoginPing *) c_pData;
|
TPacketGGLoginPing * p = (TPacketGGLoginPing *) c_pData;
|
||||||
|
|
||||||
SendBillingExpire(p->szLogin, BILLING_DAY, 0, NULL);
|
|
||||||
|
|
||||||
if (!g_pkAuthMasterDesc) // If I am master, I have to broadcast
|
if (!g_pkAuthMasterDesc) // If I am master, I have to broadcast
|
||||||
P2P_MANAGER::instance().Send(p, sizeof(TPacketGGLoginPing), d);
|
P2P_MANAGER::instance().Send(p, sizeof(TPacketGGLoginPing), d);
|
||||||
}
|
}
|
||||||
@ -396,13 +392,6 @@ void CInputP2P::BlockChat(const char * c_pData)
|
|||||||
// END_OF_BLOCK_CHAT
|
// END_OF_BLOCK_CHAT
|
||||||
//
|
//
|
||||||
|
|
||||||
void CInputP2P::PCBangUpdate(const char* c_pData)
|
|
||||||
{
|
|
||||||
TPacketPCBangUpdate* p = (TPacketPCBangUpdate*)c_pData;
|
|
||||||
|
|
||||||
CPCBangManager::instance().RequestUpdateIPList(p->ulPCBangID);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CInputP2P::IamAwake(LPDESC d, const char * c_pData)
|
void CInputP2P::IamAwake(LPDESC d, const char * c_pData)
|
||||||
{
|
{
|
||||||
std::string hostNames;
|
std::string hostNames;
|
||||||
@ -522,10 +511,6 @@ int CInputP2P::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
|||||||
MonarchTransfer(d, c_pData);
|
MonarchTransfer(d, c_pData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_GG_PCBANG_UPDATE :
|
|
||||||
PCBangUpdate(c_pData);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HEADER_GG_CHECK_AWAKENESS:
|
case HEADER_GG_CHECK_AWAKENESS:
|
||||||
IamAwake(d, c_pData);
|
IamAwake(d, c_pData);
|
||||||
break;
|
break;
|
||||||
|
@ -1129,7 +1129,7 @@ bool CItem::AddSocket()
|
|||||||
|
|
||||||
void CItem::AlterToSocketItem(int iSocketCount)
|
void CItem::AlterToSocketItem(int iSocketCount)
|
||||||
{
|
{
|
||||||
if (iSocketCount >= ITEM_SOCKET_MAX_NUM)
|
if (iSocketCount > ITEM_SOCKET_MAX_NUM)
|
||||||
{
|
{
|
||||||
SPDLOG_ERROR("Invalid Socket Count {}, set to maximum", (int) ITEM_SOCKET_MAX_NUM);
|
SPDLOG_ERROR("Invalid Socket Count {}, set to maximum", (int) ITEM_SOCKET_MAX_NUM);
|
||||||
iSocketCount = ITEM_SOCKET_MAX_NUM;
|
iSocketCount = ITEM_SOCKET_MAX_NUM;
|
||||||
@ -1831,18 +1831,6 @@ bool CItem::CanPutInto(LPITEM item)
|
|||||||
return 50623 + type == GetVnum();
|
return 50623 + type == GetVnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
// PC_BANG_ITEM_ADD
|
|
||||||
bool CItem::IsPCBangItem()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i)
|
|
||||||
{
|
|
||||||
if (m_pProto->aLimits[i].bType == LIMIT_PCBANG)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// END_PC_BANG_ITEM_ADD
|
|
||||||
|
|
||||||
bool CItem::CheckItemUseLevel(int nLevel)
|
bool CItem::CheckItemUseLevel(int nLevel)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i)
|
for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i)
|
||||||
|
@ -18,8 +18,6 @@ class CItem : public CEntity
|
|||||||
|
|
||||||
bool CheckItemUseLevel(int nLevel);
|
bool CheckItemUseLevel(int nLevel);
|
||||||
|
|
||||||
bool IsPCBangItem();
|
|
||||||
|
|
||||||
int FindApplyValue(BYTE bApplyType);
|
int FindApplyValue(BYTE bApplyType);
|
||||||
|
|
||||||
bool IsStackable() { return (GetFlag() & ITEM_FLAG_STACKABLE)?true:false; }
|
bool IsStackable() { return (GetFlag() & ITEM_FLAG_STACKABLE)?true:false; }
|
||||||
|
@ -817,14 +817,6 @@ bool ITEM_MANAGER::GetDropPct(LPCHARACTER pkChr, LPCHARACTER pkKiller, OUT int&
|
|||||||
iDeltaPercent += iDeltaPercent;
|
iDeltaPercent += iDeltaPercent;
|
||||||
// END_OF_ADD_PREMIUM
|
// END_OF_ADD_PREMIUM
|
||||||
|
|
||||||
// PC_BANG_ITEM_ADD
|
|
||||||
if (pkKiller->GetPoint(POINT_PC_BANG_DROP_BONUS) > 0)
|
|
||||||
{
|
|
||||||
if (pkKiller->IsPCBang() == true)
|
|
||||||
iDeltaPercent += iDeltaPercent * pkKiller->GetPoint(POINT_PC_BANG_DROP_BONUS)/100;
|
|
||||||
}
|
|
||||||
// END_PC_BANG_ITEM_ADD
|
|
||||||
|
|
||||||
iRandRange = 4000000;
|
iRandRange = 4000000;
|
||||||
iRandRange = iRandRange * 100 /
|
iRandRange = iRandRange * 100 /
|
||||||
(100 +
|
(100 +
|
||||||
|
@ -128,12 +128,6 @@ void LogManager::HackCRCLog(const char * c_pszHackName, const char * c_pszLogin,
|
|||||||
Query("INSERT INTO hack_crc_log (time, login, name, ip, server, why, crc) VALUES(NOW(), '%s', '%s', '%s', '%s', '%s', %u)", c_pszLogin, c_pszName, c_pszIP, g_stHostname.c_str(), c_pszHackName, dwCRC);
|
Query("INSERT INTO hack_crc_log (time, login, name, ip, server, why, crc) VALUES(NOW(), '%s', '%s', '%s', '%s', '%s', %u)", c_pszLogin, c_pszName, c_pszIP, g_stHostname.c_str(), c_pszHackName, dwCRC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogManager::PCBangLoginLog(DWORD dwPCBangID, const char* c_szPCBangIP, DWORD dwPlayerID, DWORD dwPlayTime)
|
|
||||||
{
|
|
||||||
Query("INSERT INTO pcbang_loginlog (time, pcbang_id, ip, pid, play_time) VALUES (NOW(), %u, '%s', %u, %u)",
|
|
||||||
dwPCBangID, c_szPCBangIP, dwPlayerID, dwPlayTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LogManager::GoldBarLog(DWORD dwPID, DWORD dwItemID, GOLDBAR_HOW eHow, const char* c_pszHint)
|
void LogManager::GoldBarLog(DWORD dwPID, DWORD dwItemID, GOLDBAR_HOW eHow, const char* c_pszHint)
|
||||||
{
|
{
|
||||||
char szHow[32+1];
|
char szHow[32+1];
|
||||||
@ -250,12 +244,6 @@ void LogManager::BootLog(const char * c_pszHostName, BYTE bChannel)
|
|||||||
c_pszHostName, bChannel);
|
c_pszHostName, bChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogManager::VCardLog(DWORD vcard_id, DWORD x, DWORD y, const char * hostname, const char * giver_name, const char * giver_ip, const char * taker_name, const char * taker_ip)
|
|
||||||
{
|
|
||||||
Query("INSERT DELAYED INTO vcard_log (vcard_id, x, y, hostname, giver_name, giver_ip, taker_name, taker_ip) VALUES(%u, %u, %u, '%s', '%s', '%s', '%s', '%s')",
|
|
||||||
vcard_id, x, y, hostname, giver_name, giver_ip, taker_name, taker_ip);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LogManager::FishLog(DWORD dwPID, int prob_idx, int fish_id, int fish_level, DWORD dwMiliseconds, DWORD dwVnum, DWORD dwValue)
|
void LogManager::FishLog(DWORD dwPID, int prob_idx, int fish_id, int fish_level, DWORD dwMiliseconds, DWORD dwVnum, DWORD dwValue)
|
||||||
{
|
{
|
||||||
Query("INSERT INTO fish_log%s VALUES(NOW(), %u, %d, %u, %d, %u, %u, %u)",
|
Query("INSERT INTO fish_log%s VALUES(NOW(), %u, %d, %u, %d, %u, %u, %u)",
|
||||||
|
@ -38,7 +38,6 @@ class LogManager : public singleton<LogManager>
|
|||||||
void HackLog(const char * c_pszHackName, LPCHARACTER ch);
|
void HackLog(const char * c_pszHackName, LPCHARACTER ch);
|
||||||
void HackCRCLog(const char * c_pszHackName, const char * c_pszLogin, const char * c_pszName, const char * c_pszIP, DWORD dwCRC);
|
void HackCRCLog(const char * c_pszHackName, const char * c_pszLogin, const char * c_pszName, const char * c_pszIP, DWORD dwCRC);
|
||||||
void GoldBarLog(DWORD dwPID, DWORD dwItemID, GOLDBAR_HOW eHow, const char * c_pszHint);
|
void GoldBarLog(DWORD dwPID, DWORD dwItemID, GOLDBAR_HOW eHow, const char * c_pszHint);
|
||||||
void PCBangLoginLog(DWORD dwPCBangID, const char * c_szPCBangIP, DWORD dwPlayerID, DWORD dwPlayTime);
|
|
||||||
void CubeLog(DWORD dwPID, DWORD x, DWORD y, DWORD item_vnum, DWORD item_uid, int item_count, bool success);
|
void CubeLog(DWORD dwPID, DWORD x, DWORD y, DWORD item_vnum, DWORD item_uid, int item_count, bool success);
|
||||||
void GMCommandLog(DWORD dwPID, const char * szName, const char * szIP, BYTE byChannel, const char * szCommand);
|
void GMCommandLog(DWORD dwPID, const char * szName, const char * szIP, BYTE byChannel, const char * szCommand);
|
||||||
void SpeedHackLog(DWORD pid, DWORD x, DWORD y, int hack_count);
|
void SpeedHackLog(DWORD pid, DWORD x, DWORD y, int hack_count);
|
||||||
@ -47,7 +46,6 @@ class LogManager : public singleton<LogManager>
|
|||||||
void ShoutLog(BYTE bChannel, BYTE bEmpire, const char * pszText);
|
void ShoutLog(BYTE bChannel, BYTE bEmpire, const char * pszText);
|
||||||
void LevelLog(LPCHARACTER pChar, unsigned int level, unsigned int playhour);
|
void LevelLog(LPCHARACTER pChar, unsigned int level, unsigned int playhour);
|
||||||
void BootLog(const char * c_pszHostName, BYTE bChannel);
|
void BootLog(const char * c_pszHostName, BYTE bChannel);
|
||||||
void VCardLog(DWORD vcard_id, DWORD x, DWORD y, const char * hostname, const char * giver_name, const char * giver_ip, const char * taker_name, const char * taker_ip);
|
|
||||||
void FishLog(DWORD dwPID, int prob_idx, int fish_id, int fish_level, DWORD dwMiliseconds, DWORD dwVnum = false, DWORD dwValue = 0);
|
void FishLog(DWORD dwPID, int prob_idx, int fish_id, int fish_level, DWORD dwMiliseconds, DWORD dwVnum = false, DWORD dwValue = 0);
|
||||||
void QuestRewardLog(const char * c_pszQuestName, DWORD dwPID, DWORD dwLevel, int iValue1, int iValue2);
|
void QuestRewardLog(const char * c_pszQuestName, DWORD dwPID, DWORD dwLevel, int iValue1, int iValue2);
|
||||||
void DetailLoginLog(bool isLogin, LPCHARACTER ch);
|
void DetailLoginLog(bool isLogin, LPCHARACTER ch);
|
||||||
|
@ -8,13 +8,9 @@ CLoginData::CLoginData()
|
|||||||
{
|
{
|
||||||
m_dwKey = 0;
|
m_dwKey = 0;
|
||||||
memset(m_adwClientKey, 0, sizeof(m_adwClientKey));
|
memset(m_adwClientKey, 0, sizeof(m_adwClientKey));
|
||||||
m_bBillType = 0;
|
|
||||||
m_dwBillID = 0;
|
|
||||||
m_dwConnectedPeerHandle = 0;
|
m_dwConnectedPeerHandle = 0;
|
||||||
m_dwLogonTime = 0;
|
m_dwLogonTime = 0;
|
||||||
m_lRemainSecs = 0;
|
|
||||||
memset(m_szIP, 0, sizeof(m_szIP));
|
memset(m_szIP, 0, sizeof(m_szIP));
|
||||||
m_bBilling = false;
|
|
||||||
m_bDeleted = false;
|
m_bDeleted = false;
|
||||||
memset(m_aiPremiumTimes, 0, sizeof(m_aiPremiumTimes));
|
memset(m_aiPremiumTimes, 0, sizeof(m_aiPremiumTimes));
|
||||||
}
|
}
|
||||||
@ -39,26 +35,6 @@ DWORD CLoginData::GetKey()
|
|||||||
return m_dwKey;
|
return m_dwKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoginData::SetBillType(BYTE bType)
|
|
||||||
{
|
|
||||||
m_bBillType = bType;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD CLoginData::GetBillID()
|
|
||||||
{
|
|
||||||
return m_dwBillID;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLoginData::SetBillID(DWORD dwID)
|
|
||||||
{
|
|
||||||
m_dwBillID = dwID;
|
|
||||||
}
|
|
||||||
|
|
||||||
BYTE CLoginData::GetBillType()
|
|
||||||
{
|
|
||||||
return m_bBillType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLoginData::SetConnectedPeerHandle(DWORD dwHandle)
|
void CLoginData::SetConnectedPeerHandle(DWORD dwHandle)
|
||||||
{
|
{
|
||||||
m_dwConnectedPeerHandle = dwHandle;
|
m_dwConnectedPeerHandle = dwHandle;
|
||||||
@ -89,35 +65,6 @@ const char * CLoginData::GetIP()
|
|||||||
return m_szIP;
|
return m_szIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoginData::SetRemainSecs(int l)
|
|
||||||
{
|
|
||||||
m_lRemainSecs = l;
|
|
||||||
SPDLOG_DEBUG("SetRemainSecs {} {} type {}", m_stLogin, m_lRemainSecs, m_bBillType);
|
|
||||||
}
|
|
||||||
|
|
||||||
int CLoginData::GetRemainSecs()
|
|
||||||
{
|
|
||||||
return m_lRemainSecs;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLoginData::SetBilling(bool bOn)
|
|
||||||
{
|
|
||||||
if (bOn)
|
|
||||||
{
|
|
||||||
SPDLOG_DEBUG("BILLING: ON {} key {} ptr {}", m_stLogin, m_dwKey, (void*) this);
|
|
||||||
SetLogonTime();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
SPDLOG_DEBUG("BILLING: OFF {} key {} ptr {}", m_stLogin, m_dwKey, (void*) this);
|
|
||||||
|
|
||||||
m_bBilling = bOn;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CLoginData::IsBilling()
|
|
||||||
{
|
|
||||||
return m_bBilling;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLoginData::SetDeleted(bool bSet)
|
void CLoginData::SetDeleted(bool bSet)
|
||||||
{
|
{
|
||||||
m_bDeleted = bSet;
|
m_bDeleted = bSet;
|
||||||
|
@ -15,12 +15,6 @@ class CLoginData
|
|||||||
void SetLogin(const char * c_pszLogin);
|
void SetLogin(const char * c_pszLogin);
|
||||||
const char * GetLogin();
|
const char * GetLogin();
|
||||||
|
|
||||||
void SetBillType(BYTE bType);
|
|
||||||
DWORD GetBillID();
|
|
||||||
|
|
||||||
void SetBillID(DWORD dwID);
|
|
||||||
BYTE GetBillType();
|
|
||||||
|
|
||||||
void SetConnectedPeerHandle(DWORD dwHandle);
|
void SetConnectedPeerHandle(DWORD dwHandle);
|
||||||
DWORD GetConnectedPeerHandle();
|
DWORD GetConnectedPeerHandle();
|
||||||
|
|
||||||
@ -30,12 +24,6 @@ class CLoginData
|
|||||||
void SetIP(const char * c_pszIP);
|
void SetIP(const char * c_pszIP);
|
||||||
const char * GetIP();
|
const char * GetIP();
|
||||||
|
|
||||||
void SetRemainSecs(int l);
|
|
||||||
int GetRemainSecs();
|
|
||||||
|
|
||||||
void SetBilling(bool bOn);
|
|
||||||
bool IsBilling();
|
|
||||||
|
|
||||||
void SetDeleted(bool bSet);
|
void SetDeleted(bool bSet);
|
||||||
bool IsDeleted();
|
bool IsDeleted();
|
||||||
|
|
||||||
@ -47,13 +35,9 @@ class CLoginData
|
|||||||
private:
|
private:
|
||||||
DWORD m_dwKey;
|
DWORD m_dwKey;
|
||||||
DWORD m_adwClientKey[4];
|
DWORD m_adwClientKey[4];
|
||||||
BYTE m_bBillType;
|
|
||||||
DWORD m_dwBillID;
|
|
||||||
DWORD m_dwConnectedPeerHandle;
|
DWORD m_dwConnectedPeerHandle;
|
||||||
DWORD m_dwLogonTime;
|
DWORD m_dwLogonTime;
|
||||||
int m_lRemainSecs;
|
|
||||||
char m_szIP[MAX_HOST_LENGTH+1];
|
char m_szIP[MAX_HOST_LENGTH+1];
|
||||||
bool m_bBilling;
|
|
||||||
bool m_bDeleted;
|
bool m_bDeleted;
|
||||||
std::string m_stLogin;
|
std::string m_stLogin;
|
||||||
int m_aiPremiumTimes[PREMIUM_MAX_NUM];
|
int m_aiPremiumTimes[PREMIUM_MAX_NUM];
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
#include "BattleArena.h"
|
#include "BattleArena.h"
|
||||||
#include "over9refine.h"
|
#include "over9refine.h"
|
||||||
#include "horsename_manager.h"
|
#include "horsename_manager.h"
|
||||||
#include "pcbang.h"
|
|
||||||
#include "MarkManager.h"
|
#include "MarkManager.h"
|
||||||
#include "spam.h"
|
#include "spam.h"
|
||||||
#include "panama.h"
|
#include "panama.h"
|
||||||
@ -239,11 +238,6 @@ void heartbeat(LPHEART ht, int pulse)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DESC_MANAGER::instance().ProcessExpiredLoginKey();
|
DESC_MANAGER::instance().ProcessExpiredLoginKey();
|
||||||
DBManager::instance().FlushBilling();
|
|
||||||
/*
|
|
||||||
if (!(pulse % (ht->passes_per_sec * 600)))
|
|
||||||
DBManager::instance().CheckBilling();
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -366,7 +360,6 @@ int main(int argc, char **argv)
|
|||||||
COXEventManager OXEvent_manager;
|
COXEventManager OXEvent_manager;
|
||||||
CMonarch Monarch;
|
CMonarch Monarch;
|
||||||
CHorseNameManager horsename_manager;
|
CHorseNameManager horsename_manager;
|
||||||
CPCBangManager pcbang_manager;
|
|
||||||
|
|
||||||
DESC_MANAGER desc_manager;
|
DESC_MANAGER desc_manager;
|
||||||
|
|
||||||
@ -431,8 +424,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (g_bAuthServer)
|
if (g_bAuthServer)
|
||||||
{
|
{
|
||||||
DBManager::instance().FlushBilling(true);
|
|
||||||
|
|
||||||
int iLimit = DBManager::instance().CountQuery() / 50;
|
int iLimit = DBManager::instance().CountQuery() / 50;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -109,7 +109,6 @@ void MessengerManager::Logout(MessengerManager::keyA account)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_Relation.erase(account);
|
m_Relation.erase(account);
|
||||||
//m_map_stMobile.erase(account);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessengerManager::RequestToAdd(LPCHARACTER ch, LPCHARACTER target)
|
void MessengerManager::RequestToAdd(LPCHARACTER ch, LPCHARACTER target)
|
||||||
|
@ -293,7 +293,6 @@ enum
|
|||||||
HEADER_GG_MESSENGER_REMOVE = 11,
|
HEADER_GG_MESSENGER_REMOVE = 11,
|
||||||
HEADER_GG_FIND_POSITION = 12,
|
HEADER_GG_FIND_POSITION = 12,
|
||||||
HEADER_GG_WARP_CHARACTER = 13,
|
HEADER_GG_WARP_CHARACTER = 13,
|
||||||
HEADER_GG_MESSENGER_MOBILE = 14,
|
|
||||||
HEADER_GG_GUILD_WAR_ZONE_MAP_INDEX = 15,
|
HEADER_GG_GUILD_WAR_ZONE_MAP_INDEX = 15,
|
||||||
HEADER_GG_TRANSFER = 16,
|
HEADER_GG_TRANSFER = 16,
|
||||||
HEADER_GG_XMAS_WARP_SANTA = 17,
|
HEADER_GG_XMAS_WARP_SANTA = 17,
|
||||||
@ -303,11 +302,9 @@ enum
|
|||||||
HEADER_GG_CHECK_CLIENT_VERSION = 21,
|
HEADER_GG_CHECK_CLIENT_VERSION = 21,
|
||||||
HEADER_GG_BLOCK_CHAT = 22,
|
HEADER_GG_BLOCK_CHAT = 22,
|
||||||
|
|
||||||
HEADER_GG_BLOCK_EXCEPTION = 24,
|
|
||||||
HEADER_GG_SIEGE = 25,
|
HEADER_GG_SIEGE = 25,
|
||||||
HEADER_GG_MONARCH_NOTICE = 26,
|
HEADER_GG_MONARCH_NOTICE = 26,
|
||||||
HEADER_GG_MONARCH_TRANSFER = 27,
|
HEADER_GG_MONARCH_TRANSFER = 27,
|
||||||
HEADER_GG_PCBANG_UPDATE = 28,
|
|
||||||
|
|
||||||
HEADER_GG_CHECK_AWAKENESS = 29,
|
HEADER_GG_CHECK_AWAKENESS = 29,
|
||||||
};
|
};
|
||||||
@ -432,11 +429,6 @@ typedef struct SPacketGGXmasWarpSantaReply
|
|||||||
BYTE bChannel;
|
BYTE bChannel;
|
||||||
} TPacketGGXmasWarpSantaReply;
|
} TPacketGGXmasWarpSantaReply;
|
||||||
|
|
||||||
typedef struct SMessengerData
|
|
||||||
{
|
|
||||||
char szMobile[MOBILE_MAX_LEN + 1];
|
|
||||||
} TMessengerData;
|
|
||||||
|
|
||||||
typedef struct SPacketGGMessenger
|
typedef struct SPacketGGMessenger
|
||||||
{
|
{
|
||||||
BYTE bHeader;
|
BYTE bHeader;
|
||||||
@ -444,13 +436,6 @@ typedef struct SPacketGGMessenger
|
|||||||
char szCompanion[CHARACTER_NAME_MAX_LEN + 1];
|
char szCompanion[CHARACTER_NAME_MAX_LEN + 1];
|
||||||
} TPacketGGMessenger;
|
} TPacketGGMessenger;
|
||||||
|
|
||||||
typedef struct SPacketGGMessengerMobile
|
|
||||||
{
|
|
||||||
BYTE bHeader;
|
|
||||||
char szName[CHARACTER_NAME_MAX_LEN + 1];
|
|
||||||
char szMobile[MOBILE_MAX_LEN + 1];
|
|
||||||
} TPacketGGMessengerMobile;
|
|
||||||
|
|
||||||
typedef struct SPacketGGFindPosition
|
typedef struct SPacketGGFindPosition
|
||||||
{
|
{
|
||||||
BYTE header;
|
BYTE header;
|
||||||
@ -1438,8 +1423,7 @@ enum
|
|||||||
MESSENGER_SUBHEADER_GC_LIST,
|
MESSENGER_SUBHEADER_GC_LIST,
|
||||||
MESSENGER_SUBHEADER_GC_LOGIN,
|
MESSENGER_SUBHEADER_GC_LOGIN,
|
||||||
MESSENGER_SUBHEADER_GC_LOGOUT,
|
MESSENGER_SUBHEADER_GC_LOGOUT,
|
||||||
MESSENGER_SUBHEADER_GC_INVITE,
|
MESSENGER_SUBHEADER_GC_INVITE
|
||||||
MESSENGER_SUBHEADER_GC_MOBILE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct packet_messenger
|
typedef struct packet_messenger
|
||||||
@ -2131,12 +2115,6 @@ typedef struct SPacketGGMonarchTransfer
|
|||||||
LONG y;
|
LONG y;
|
||||||
} TPacketMonarchGGTransfer;
|
} TPacketMonarchGGTransfer;
|
||||||
|
|
||||||
typedef struct SPacketGGPCBangUpdate
|
|
||||||
{
|
|
||||||
BYTE bHeader;
|
|
||||||
ULONG ulPCBangID;
|
|
||||||
} TPacketPCBangUpdate;
|
|
||||||
|
|
||||||
typedef struct SPacketGGCheckAwakeness
|
typedef struct SPacketGGCheckAwakeness
|
||||||
{
|
{
|
||||||
BYTE bHeader;
|
BYTE bHeader;
|
||||||
|
@ -242,7 +242,6 @@ CPacketInfoGG::CPacketInfoGG()
|
|||||||
Set(HEADER_GG_MESSENGER_REMOVE, sizeof(TPacketGGMessenger), "MessengerRemove", false);
|
Set(HEADER_GG_MESSENGER_REMOVE, sizeof(TPacketGGMessenger), "MessengerRemove", false);
|
||||||
Set(HEADER_GG_FIND_POSITION, sizeof(TPacketGGFindPosition), "FindPosition", false);
|
Set(HEADER_GG_FIND_POSITION, sizeof(TPacketGGFindPosition), "FindPosition", false);
|
||||||
Set(HEADER_GG_WARP_CHARACTER, sizeof(TPacketGGWarpCharacter), "WarpCharacter", false);
|
Set(HEADER_GG_WARP_CHARACTER, sizeof(TPacketGGWarpCharacter), "WarpCharacter", false);
|
||||||
Set(HEADER_GG_MESSENGER_MOBILE, sizeof(TPacketGGMessengerMobile), "MessengerMobile", false);
|
|
||||||
Set(HEADER_GG_GUILD_WAR_ZONE_MAP_INDEX, sizeof(TPacketGGGuildWarMapIndex), "GuildWarMapIndex", false);
|
Set(HEADER_GG_GUILD_WAR_ZONE_MAP_INDEX, sizeof(TPacketGGGuildWarMapIndex), "GuildWarMapIndex", false);
|
||||||
Set(HEADER_GG_TRANSFER, sizeof(TPacketGGTransfer), "Transfer", false);
|
Set(HEADER_GG_TRANSFER, sizeof(TPacketGGTransfer), "Transfer", false);
|
||||||
Set(HEADER_GG_XMAS_WARP_SANTA, sizeof(TPacketGGXmasWarpSanta), "XmasWarpSanta", false);
|
Set(HEADER_GG_XMAS_WARP_SANTA, sizeof(TPacketGGXmasWarpSanta), "XmasWarpSanta", false);
|
||||||
@ -258,7 +257,6 @@ CPacketInfoGG::CPacketInfoGG()
|
|||||||
|
|
||||||
Set(HEADER_GG_MONARCH_NOTICE, sizeof(TPacketGGMonarchNotice), "MonarchNotice", false);
|
Set(HEADER_GG_MONARCH_NOTICE, sizeof(TPacketGGMonarchNotice), "MonarchNotice", false);
|
||||||
Set(HEADER_GG_MONARCH_TRANSFER, sizeof(TPacketMonarchGGTransfer), "MonarchTransfer", false);
|
Set(HEADER_GG_MONARCH_TRANSFER, sizeof(TPacketMonarchGGTransfer), "MonarchTransfer", false);
|
||||||
Set(HEADER_GG_PCBANG_UPDATE, sizeof(TPacketPCBangUpdate), "PCBangUpdate", false);
|
|
||||||
Set(HEADER_GG_CHECK_AWAKENESS, sizeof(TPacketGGCheckAwakeness), "CheckAwakeness", false);
|
Set(HEADER_GG_CHECK_AWAKENESS, sizeof(TPacketGGCheckAwakeness), "CheckAwakeness", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
#include "constants.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "locale_service.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "db.h"
|
|
||||||
#include "pcbang.h"
|
|
||||||
|
|
||||||
CPCBangManager::CPCBangManager()
|
|
||||||
{
|
|
||||||
m_minSavablePlayTime = 10;
|
|
||||||
m_map_ip.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPCBangManager::InsertIP(const char* c_szID, const char* c_szIP)
|
|
||||||
{
|
|
||||||
PCBang_IP ip = __GetIPFromString(c_szIP);
|
|
||||||
PCBang_ID id = __GetIDFromString(c_szID);
|
|
||||||
|
|
||||||
m_map_ip.insert(std::map<PCBang_IP, PCBang_ID>::value_type(ip, id));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CPCBangManager::Log(const char* c_szIP, DWORD pid, time_t playTime)
|
|
||||||
{
|
|
||||||
if (playTime < m_minSavablePlayTime)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::map<PCBang_IP, PCBang_ID>::iterator f = m_map_ip.find(__GetIPFromString(c_szIP));
|
|
||||||
|
|
||||||
if (m_map_ip.end() == f)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
LogManager::instance().PCBangLoginLog(f->second, c_szIP, pid, playTime);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CPCBangManager::RequestUpdateIPList(PCBang_ID id)
|
|
||||||
{
|
|
||||||
if ( LC_IsYMIR() == true || LC_IsKorea() == true )
|
|
||||||
{
|
|
||||||
if ( id == 0 )
|
|
||||||
{
|
|
||||||
DBManager::instance().ReturnQuery(QID_PCBANG_IP_LIST_CHECK, 0, NULL, "show table status");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DBManager::instance().ReturnQuery(QID_PCBANG_IP_LIST_SELECT, 0, NULL, "SELECT pcbang_id, ip FROM pcbang_ip WHERE pcbang_id=%u", id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CPCBangManager::IsPCBangIP(const char* c_szIP)
|
|
||||||
{
|
|
||||||
if (!c_szIP)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
PCBang_IP ip = __GetIPFromString(c_szIP);
|
|
||||||
std::map<PCBang_IP, PCBang_ID>::iterator f = m_map_ip.find(ip);
|
|
||||||
|
|
||||||
if (m_map_ip.end() == f)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
PCBang_ID CPCBangManager::__GetIDFromString(const char* c_szID)
|
|
||||||
{
|
|
||||||
PCBang_ID id = 0;
|
|
||||||
str_to_number(id, c_szID);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
PCBang_IP CPCBangManager::__GetIPFromString(const char* c_szIP)
|
|
||||||
{
|
|
||||||
int nums[4];
|
|
||||||
sscanf(c_szIP, "%d.%d.%d.%d", nums+0, nums+1, nums+2, nums+3);
|
|
||||||
|
|
||||||
return (nums[0]<<24)|(nums[1]<<16)|(nums[2]<<8)|nums[3];
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
|
|
||||||
typedef unsigned int PCBang_IP;
|
|
||||||
typedef unsigned int PCBang_ID;
|
|
||||||
|
|
||||||
class CPCBangManager : public singleton<CPCBangManager>
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
std::map<PCBang_IP, PCBang_ID> m_map_ip;
|
|
||||||
|
|
||||||
time_t m_minSavablePlayTime;
|
|
||||||
|
|
||||||
PCBang_ID __GetIDFromString(const char* c_szID);
|
|
||||||
PCBang_IP __GetIPFromString(const char* c_szIP);
|
|
||||||
|
|
||||||
public:
|
|
||||||
CPCBangManager();
|
|
||||||
|
|
||||||
void InsertIP(const char* c_szID, const char* c_szIP);
|
|
||||||
|
|
||||||
bool Log(const char* c_szIP, DWORD pid, time_t playTime);
|
|
||||||
|
|
||||||
void RequestUpdateIPList(PCBang_ID id);
|
|
||||||
|
|
||||||
bool IsPCBangIP(const char* c_szIP);
|
|
||||||
};
|
|
||||||
|
|
@ -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
|
// "member" Lua functions
|
||||||
//
|
//
|
||||||
@ -496,17 +467,6 @@ namespace quest
|
|||||||
AddLuaFunctionTable("member", member_functions);
|
AddLuaFunctionTable("member", member_functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
luaL_reg highscore_functions[] =
|
|
||||||
{
|
|
||||||
{ "register", highscore_register },
|
|
||||||
{ "show", highscore_show },
|
|
||||||
{ NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
AddLuaFunctionTable("highscore", highscore_functions);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
luaL_reg mob_functions[] =
|
luaL_reg mob_functions[] =
|
||||||
{
|
{
|
||||||
|
@ -341,36 +341,28 @@ int CShop::Buy(LPCHARACTER ch, BYTE pos)
|
|||||||
{
|
{
|
||||||
m_pkPC->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255);
|
m_pkPC->SyncQuickslot(QUICKSLOT_TYPE_ITEM, item->GetCell(), 255);
|
||||||
|
|
||||||
if (item->GetVnum() == 90008 || item->GetVnum() == 90009) // VCARD
|
char buf[512];
|
||||||
|
|
||||||
|
if (item->GetVnum() >= 80003 && item->GetVnum() <= 80007)
|
||||||
{
|
{
|
||||||
VCardUse(m_pkPC, ch, item);
|
snprintf(buf, sizeof(buf), "%s FROM: %u TO: %u PRICE: %u", item->GetName(), ch->GetPlayerID(), m_pkPC->GetPlayerID(), dwPrice);
|
||||||
item = NULL;
|
LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), SHOP_BUY, buf);
|
||||||
|
LogManager::instance().GoldBarLog(m_pkPC->GetPlayerID(), item->GetID(), SHOP_SELL, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item->RemoveFromCharacter();
|
||||||
|
if (item->IsDragonSoul())
|
||||||
|
item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos));
|
||||||
else
|
else
|
||||||
{
|
item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
|
||||||
char buf[512];
|
ITEM_MANAGER::instance().FlushDelayedSave(item);
|
||||||
|
|
||||||
if (item->GetVnum() >= 80003 && item->GetVnum() <= 80007)
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), "%s FROM: %u TO: %u PRICE: %u", item->GetName(), ch->GetPlayerID(), m_pkPC->GetPlayerID(), dwPrice);
|
|
||||||
LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), SHOP_BUY, buf);
|
|
||||||
LogManager::instance().GoldBarLog(m_pkPC->GetPlayerID(), item->GetID(), SHOP_SELL, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
item->RemoveFromCharacter();
|
|
||||||
if (item->IsDragonSoul())
|
|
||||||
item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos));
|
|
||||||
else
|
|
||||||
item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
|
|
||||||
ITEM_MANAGER::instance().FlushDelayedSave(item);
|
|
||||||
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s %u(%s) %u %u", item->GetName(), m_pkPC->GetPlayerID(), m_pkPC->GetName(), dwPrice, item->GetCount());
|
snprintf(buf, sizeof(buf), "%s %u(%s) %u %u", item->GetName(), m_pkPC->GetPlayerID(), m_pkPC->GetName(), dwPrice, item->GetCount());
|
||||||
LogManager::instance().ItemLog(ch, item, "SHOP_BUY", buf);
|
LogManager::instance().ItemLog(ch, item, "SHOP_BUY", buf);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s %u(%s) %u %u", item->GetName(), ch->GetPlayerID(), ch->GetName(), dwPrice, item->GetCount());
|
snprintf(buf, sizeof(buf), "%s %u(%s) %u %u", item->GetName(), ch->GetPlayerID(), ch->GetName(), dwPrice, item->GetCount());
|
||||||
LogManager::instance().ItemLog(m_pkPC, item, "SHOP_SELL", buf);
|
LogManager::instance().ItemLog(m_pkPC, item, "SHOP_SELL", buf);
|
||||||
}
|
|
||||||
|
|
||||||
r_item.pkItem = NULL;
|
r_item.pkItem = NULL;
|
||||||
BroadcastUpdateItem(pos);
|
BroadcastUpdateItem(pos);
|
||||||
|
@ -228,8 +228,6 @@ guild.get_name
|
|||||||
guild.war_bet
|
guild.war_bet
|
||||||
guild.is_bet
|
guild.is_bet
|
||||||
guild.get_warp_war_list
|
guild.get_warp_war_list
|
||||||
highscore.register
|
|
||||||
highscore.show
|
|
||||||
mob.spawn
|
mob.spawn
|
||||||
mob.spawn_group
|
mob.spawn_group
|
||||||
q.setstate
|
q.setstate
|
||||||
@ -335,8 +333,6 @@ guild.get_reserve_war_table
|
|||||||
guild.get_name
|
guild.get_name
|
||||||
guild.war_bet
|
guild.war_bet
|
||||||
guild.is_bet
|
guild.is_bet
|
||||||
highscore.register
|
|
||||||
highscore.show
|
|
||||||
mob.spawn
|
mob.spawn
|
||||||
mob.spawn_group
|
mob.spawn_group
|
||||||
q.setstate
|
q.setstate
|
||||||
|
Loading…
Reference in New Issue
Block a user