removed billing
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "common/billing.h"
|
||||
#include "common/building.h"
|
||||
#include "common/VnumHelper.h"
|
||||
#include "libgame/grid.h"
|
||||
@@ -1056,7 +1055,6 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
||||
sys_log(0, "AUTH_PEER ptr %p", peer);
|
||||
|
||||
m_pkAuthPeer = peer;
|
||||
SendAllLoginToBilling();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1202,7 +1200,6 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
||||
// 로그인 및 빌링정보 보내기
|
||||
//
|
||||
TPacketLoginOnSetup * pck = (TPacketLoginOnSetup *) c_pData;;
|
||||
std::vector<TPacketBillingRepair> vec_repair;
|
||||
|
||||
for (DWORD c = 0; c < p->dwLoginCount; ++c, ++pck)
|
||||
{
|
||||
@@ -1225,29 +1222,11 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
||||
{
|
||||
sys_log(0, "SETUP: login %u %s login_key %u host %s", pck->dwID, pck->szLogin, pck->dwLoginKey, pck->szHost);
|
||||
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
|
||||
sys_log(0, "SETUP: login_fail %u %s login_key %u", pck->dwID, pck->szLogin, pck->dwLoginKey);
|
||||
}
|
||||
|
||||
if (m_pkAuthPeer && !vec_repair.empty())
|
||||
{
|
||||
sys_log(0, "REPAIR size %d", 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);
|
||||
CGuildManager::instance().OnSetup(peer);
|
||||
CPrivManager::instance().SendPrivOnSetup(peer);
|
||||
@@ -1765,8 +1744,6 @@ void CClientManager::QUERY_AUTH_LOGIN(CPeer * pkPeer, DWORD dwHandle, TPacketGDA
|
||||
|
||||
pkLD->SetKey(p->dwLoginKey);
|
||||
pkLD->SetClientKey(p->adwClientKey);
|
||||
pkLD->SetBillType(p->bBillType);
|
||||
pkLD->SetBillID(p->dwBillID);
|
||||
pkLD->SetPremium(p->iPremiumTimes);
|
||||
|
||||
TAccountTable & r = pkLD->GetAccountRef();
|
||||
@@ -1789,109 +1766,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;
|
||||
|
||||
sys_log(0, "BillingCheck: size %u", dwCount);
|
||||
|
||||
for (DWORD i = 0; i < dwCount; ++i)
|
||||
{
|
||||
DWORD dwKey = *(DWORD *) data;
|
||||
data += sizeof(DWORD);
|
||||
|
||||
sys_log(0, "BillingCheck: %u", dwKey);
|
||||
|
||||
TLoginDataByLoginKey::iterator it = m_map_pkLoginData.find(dwKey);
|
||||
|
||||
if (it == m_map_pkLoginData.end())
|
||||
{
|
||||
sys_log(0, "BillingCheck: key not exist: %u", dwKey);
|
||||
vec.push_back(dwKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
CLoginData * pkLD = it->second;
|
||||
|
||||
if (!pkLD->IsPlay() && curTime - pkLD->GetLastPlayTime() > 180)
|
||||
{
|
||||
sys_log(0, "BillingCheck: not login: %u", 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)
|
||||
{
|
||||
CGuildManager::instance().DepositMoney(p->dwGuild, p->iGold);
|
||||
@@ -1912,51 +1786,6 @@ void CClientManager::GuildWarBet(TPacketGDGuildWarBet * p)
|
||||
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));
|
||||
sys_log(0, "SendAllLoginToBilling %s %s", 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)
|
||||
{
|
||||
using namespace building;
|
||||
@@ -2536,14 +2365,6 @@ void CClientManager::ProcessPackets(CPeer * peer)
|
||||
SetEventFlag((TPacketSetEventFlag*) data);
|
||||
break;
|
||||
|
||||
case HEADER_GD_BILLING_EXPIRE:
|
||||
BillingExpire((TPacketBillingExpire *) data);
|
||||
break;
|
||||
|
||||
case HEADER_GD_BILLING_CHECK:
|
||||
BillingCheck(data);
|
||||
break;
|
||||
|
||||
case HEADER_GD_CREATE_OBJECT:
|
||||
CreateObject((TPacketGDCreateObject *) data);
|
||||
break;
|
||||
@@ -2743,7 +2564,6 @@ void CClientManager::RemovePeer(CPeer * pPeer)
|
||||
if (pkLD->IsPlay())
|
||||
{
|
||||
pkLD->SetPlay(false);
|
||||
SendLoginToBilling(pkLD, false);
|
||||
}
|
||||
|
||||
if (pkLD->IsDeleted())
|
||||
|
||||
Reference in New Issue
Block a user