forked from metin2/server
1
0
Fork 0

Removed PCBang/iCafe code

This commit is contained in:
Exynox 2024-03-30 18:55:44 +02:00
parent 0c86f802ca
commit 72b495c03c
26 changed files with 6 additions and 392 deletions

View File

@ -41,8 +41,6 @@ tstr IMPLEMENTOR
tint IMPLEMENTOR
tcon IMPLEMENTOR
mob_ld IMPLEMENTOR
pcbang_check IMPLEMENTOR
pcbang_update IMPLEMENTOR
setqf IMPLEMENTOR
delqf IMPLEMENTOR
effect IMPLEMENTOR

View File

@ -333,6 +333,8 @@ enum ELimitTypes
LIMIT_DEX,
LIMIT_INT,
LIMIT_CON,
// TODO: Remove this and re-check the validity of item_proto afterwards
LIMIT_PCBANG,
/// 착용 여부와 상관 없이 실시간으로 시간 차감 (socket0에 소멸 시간이 박힘: unix_timestamp 타입)

View File

@ -108,12 +108,6 @@ enum
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_RELOAD_ADMIN = 115, ///<운영자 정보 요청
HEADER_GD_BREAK_MARRIAGE = 116, ///< 결혼 파기
@ -1293,15 +1287,6 @@ typedef struct
LONG lDuration;
} TPacketBlockChat;
// PCBANG_IP_LIST
typedef struct SPacketPCBangIP
{
DWORD id;
DWORD ip;
} TPacketPCBangIP;
// END_OF_PCBANG_IP_LIST
//ADMIN_MANAGER
typedef struct TAdminInfo
{

View File

@ -48,7 +48,6 @@
#include "castle.h"
#include "arena.h"
#include "horsename_manager.h"
#include "pcbang.h"
#include "gm.h"
#include "map_location.h"
#include "BlueDragon_Binder.h"
@ -307,8 +306,6 @@ void CHARACTER::Initialize()
memset(m_adwMobSkillCooltime, 0, sizeof(m_adwMobSkillCooltime));
// END_OF_MOB_SKILL_COOLTIME
m_isinPCBang = false;
// ARENA
m_pArena = NULL;
m_nPotionLimit = quest::CQuestManager::instance().GetEventFlag("arena_potion_limit_count");
@ -1314,9 +1311,6 @@ void CHARACTER::Disconnect(const char * c_pszReason)
{
int playTime = GetRealPoint(POINT_PLAYTIME) - m_dwLoginPlayTime;
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)
@ -2242,11 +2236,6 @@ void CHARACTER::ComputePoints()
SetPoint(POINT_HP_RECOVERY, lHPRecovery);
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 iMaxStamina;
@ -3478,14 +3467,10 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast
val = GetPoint(type);
break;
// PC_BANG_ITEM_ADD
case POINT_PC_BANG_EXP_BONUS :
case POINT_PC_BANG_DROP_BONUS :
case POINT_RAMADAN_CANDY_BONUS_EXP:
SetPoint(type, amount);
val = GetPoint(type);
break;
// END_PC_BANG_ITEM_ADD
case POINT_EXP_DOUBLE_BONUS: // 71
case POINT_GOLD_DOUBLE_BONUS: // 72
@ -3759,9 +3744,6 @@ void CHARACTER::ApplyPoint(BYTE bApplyType, int iVal)
case APPLY_NORMAL_HIT_DEFEND_BONUS:
// END_OF_DEPEND_BONUS_ATTRIBUTES
case APPLY_PC_BANG_EXP_BONUS :
case APPLY_PC_BANG_DROP_BONUS :
case APPLY_RESIST_WARRIOR :
case APPLY_RESIST_ASSASSIN :
case APPLY_RESIST_SURA :

View File

@ -260,10 +260,12 @@ enum EPointTypes
POINT_NORMAL_HIT_DEFEND_BONUS, // 124 평타 방어 데미지
// END_OF_DEFEND_BONUS_ATTRIBUTES
// 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_DROP_BONUS, // 126 PC방 전용 드롭률 보너스
// END_PC_BANG_ITEM_ADD
POINT_RAMADAN_CANDY_BONUS_EXP, // 라마단 사탕 경험치 증가용
POINT_ENERGY = 128, // 128 기력
@ -1745,15 +1747,6 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
static const char msc_szChangeItemAttrCycleFlag[]; ///< 아이템 속성병경 가능 주기의 Quest Flag 이름
// 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
public :
bool ItemProcess_Hair(LPITEM item, int iDestCell);

View File

@ -2394,13 +2394,6 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int iExp)
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;
}
@ -2417,13 +2410,6 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int 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;
}
@ -2440,13 +2426,6 @@ static void GiveExp(LPCHARACTER from, LPCHARACTER to, int iExp)
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;
}

View File

@ -34,7 +34,6 @@
#include "castle.h"
#include "BattleArena.h"
#include "arena.h"
#include "pcbang.h"
#include "threeway_war.h"
#include "safebox.h"
@ -2219,19 +2218,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
}
else
{
// PC_BANG_ITEM_ADD
if (item->IsPCBangItem() == true)
{
// PC방인지 체크해서 처리
if (CPCBangManager::instance().IsPCBangIP(GetDesc()->GetHostName()) == false)
{
// PC방이 아님!
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이 아이템은 PC방에서만 사용할 수 있습니다."));
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);
item->SetCount(item->GetCount() - 1);
}
@ -4880,19 +4866,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
}
else
{
// PC_BANG_ITEM_ADD
if (item->IsPCBangItem() == true)
{
// PC방인지 체크해서 처리
if (CPCBangManager::instance().IsPCBangIP(GetDesc()->GetHostName()) == false)
{
// PC방이 아님!
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이 아이템은 PC방에서만 사용할 수 있습니다."));
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);
item->SetCount(item->GetCount() - 1);
}

View File

@ -10,9 +10,6 @@ ACMD(do_user_horse_ride);
ACMD(do_user_horse_back);
ACMD(do_user_horse_feed);
ACMD(do_pcbang_update);
ACMD(do_pcbang_check);
// ADD_COMMAND_SLOW_STUN
ACMD(do_slow);
ACMD(do_stun);
@ -444,9 +441,6 @@ struct command_info cmd_info[] =
{ "horse_unsummon", do_horse_unsummon, 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 },
{ "kiss", do_emotion, 0, POS_FIGHTING, GM_PLAYER },
{ "slap", do_emotion, 0, POS_FIGHTING, GM_PLAYER },

View File

@ -2006,8 +2006,6 @@ static const char* FN_point_string(int apply_number)
case POINT_NORMAL_HIT_DAMAGE_BONUS: return LC_TEXT("평타 데미지 %d%%");
case POINT_SKILL_DEFEND_BONUS: return LC_TEXT("스킬 데미지 저항 %d%%");
case POINT_NORMAL_HIT_DEFEND_BONUS: return LC_TEXT("평타 데미지 저항 %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_RESIST_WARRIOR: return LC_TEXT("무사공격에 %d%% 저항");
case POINT_RESIST_ASSASSIN: return LC_TEXT("자객공격에 %d%% 저항");

View File

@ -32,7 +32,6 @@
#include "BattleArena.h"
#include "xmas_event.h"
#include "log.h"
#include "pcbang.h"
#include "threeway_war.h"
#include "unique_item.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
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)
{
Command_ApplyAffect(ch, argument, "stun", COMMANDAFFECT_STUN);

View File

@ -893,6 +893,7 @@ const TApplyInfo aApplyInfo[MAX_APPLY_NUM] =
{ POINT_NORMAL_HIT_DEFEND_BONUS }, // 74
// END_OF_DEFEND_BONUS_ATTRIBUTES
// TODO: check if these can be safely removed
// PC_BANG_ITEM_ADD
{ POINT_PC_BANG_EXP_BONUS }, // 75
{ POINT_PC_BANG_DROP_BONUS }, // 76

View File

@ -17,7 +17,6 @@
#include "log.h"
#include "login_data.h"
#include "locale_service.h"
#include "pcbang.h"
#include "spam.h"
extern std::string g_stBlockDate;
@ -996,73 +995,6 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
break;
// 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:
SPDLOG_ERROR("FATAL ERROR!!! Unhandled return query id {}", qi->iType);
break;

View File

@ -23,11 +23,6 @@ enum
QID_BLOCK_CHAT_LIST,
// 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

View File

@ -323,7 +323,6 @@ class CInputP2P : public CInputProcessor
void XmasWarpSantaReply(const char * c_pData);
void LoginPing(LPDESC d, const char * c_pData);
void BlockChat(const char * c_pData);
void PCBangUpdate(const char* c_pData);
void IamAwake(LPDESC d, const char * c_pData);
protected:

View File

@ -38,7 +38,6 @@
#include "log.h"
#include "horsename_manager.h"
#include "pcbang.h"
#include "gm.h"
#include "panama.h"
#include "map_location.h"
@ -420,11 +419,6 @@ void CInputDB::PlayerLoad(LPDESC d, const char * data)
{
LogManager::instance().LoginLog(true,
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()));
}
}
}
@ -997,8 +991,6 @@ void CInputDB::Boot(const char* data)
CMobManager::instance().DumpRegenCount("mob_count");
}
CPCBangManager::instance().RequestUpdateIPList(0);
// castle_boot
castle_boot();
}

View File

@ -17,7 +17,6 @@
#include "castle.h"
#include "locale_service.h"
#include "questmanager.h"
#include "pcbang.h"
#include "skill.h"
#include "threeway_war.h"
@ -396,13 +395,6 @@ void CInputP2P::BlockChat(const char * c_pData)
// 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)
{
std::string hostNames;
@ -522,10 +514,6 @@ int CInputP2P::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
MonarchTransfer(d, c_pData);
break;
case HEADER_GG_PCBANG_UPDATE :
PCBangUpdate(c_pData);
break;
case HEADER_GG_CHECK_AWAKENESS:
IamAwake(d, c_pData);
break;

View File

@ -1831,18 +1831,6 @@ bool CItem::CanPutInto(LPITEM item)
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)
{
for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i)

View File

@ -18,8 +18,6 @@ class CItem : public CEntity
bool CheckItemUseLevel(int nLevel);
bool IsPCBangItem();
int FindApplyValue(BYTE bApplyType);
bool IsStackable() { return (GetFlag() & ITEM_FLAG_STACKABLE)?true:false; }

View File

@ -817,14 +817,6 @@ bool ITEM_MANAGER::GetDropPct(LPCHARACTER pkChr, LPCHARACTER pkKiller, OUT int&
iDeltaPercent += iDeltaPercent;
// 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 = iRandRange * 100 /
(100 +

View File

@ -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);
}
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)
{
char szHow[32+1];

View File

@ -38,7 +38,6 @@ class LogManager : public singleton<LogManager>
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 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 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);

View File

@ -49,7 +49,6 @@
#include "BattleArena.h"
#include "over9refine.h"
#include "horsename_manager.h"
#include "pcbang.h"
#include "MarkManager.h"
#include "spam.h"
#include "panama.h"
@ -366,7 +365,6 @@ int main(int argc, char **argv)
COXEventManager OXEvent_manager;
CMonarch Monarch;
CHorseNameManager horsename_manager;
CPCBangManager pcbang_manager;
DESC_MANAGER desc_manager;

View File

@ -306,7 +306,6 @@ enum
HEADER_GG_SIEGE = 25,
HEADER_GG_MONARCH_NOTICE = 26,
HEADER_GG_MONARCH_TRANSFER = 27,
HEADER_GG_PCBANG_UPDATE = 28,
HEADER_GG_CHECK_AWAKENESS = 29,
};
@ -2130,12 +2129,6 @@ typedef struct SPacketGGMonarchTransfer
LONG y;
} TPacketMonarchGGTransfer;
typedef struct SPacketGGPCBangUpdate
{
BYTE bHeader;
ULONG ulPCBangID;
} TPacketPCBangUpdate;
typedef struct SPacketGGCheckAwakeness
{
BYTE bHeader;

View File

@ -258,7 +258,6 @@ CPacketInfoGG::CPacketInfoGG()
Set(HEADER_GG_MONARCH_NOTICE, sizeof(TPacketGGMonarchNotice), "MonarchNotice", 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);
}

View File

@ -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];
}

View File

@ -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);
};