Removed Billing/VCard
This commit is contained in:
parent
72b495c03c
commit
01cc27a7df
|
@ -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
|
|
@ -98,9 +98,6 @@ enum
|
|||
|
||||
HEADER_GD_AUTH_LOGIN = 100,
|
||||
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_MYSHOP_PRICELIST_UPDATE = 108, ///< °¡°ÝÁ¤º¸ °»½Å ¿äû
|
||||
|
@ -229,12 +226,6 @@ enum
|
|||
|
||||
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_DELETE_OBJECT = 141,
|
||||
HEADER_DG_UPDATE_LAND = 142,
|
||||
|
@ -1013,9 +1004,7 @@ typedef struct SPacketGDAuthLogin
|
|||
char szLogin[LOGIN_MAX_LEN + 1];
|
||||
char szSocialID[SOCIAL_ID_MAX_LEN + 1];
|
||||
DWORD adwClientKey[4];
|
||||
BYTE bBillType;
|
||||
DWORD dwBillID;
|
||||
DWORD iPremiumTimes[PREMIUM_MAX_NUM];
|
||||
DWORD iPremiumTimes[PREMIUM_MAX_NUM];
|
||||
} TPacketGDAuthLogin;
|
||||
|
||||
typedef struct SPacketGDLoginByKey
|
||||
|
@ -1127,26 +1116,6 @@ typedef struct SPacketSetEventFlag
|
|||
LONG lValue;
|
||||
} 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
|
||||
{
|
||||
DWORD dwID;
|
||||
|
@ -1174,15 +1143,6 @@ typedef struct SPacketGDHammerOfTor
|
|||
DWORD delay;
|
||||
} 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
|
||||
{
|
||||
DWORD dwID;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
#include <common/billing.h>
|
||||
#include <common/building.h>
|
||||
#include <common/VnumHelper.h>
|
||||
#include "../../libgame/include/grid.h"
|
||||
|
@ -1143,7 +1142,6 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
|||
SPDLOG_DEBUG("AUTH_PEER ptr {}", (void*) peer);
|
||||
|
||||
m_pkAuthPeer = peer;
|
||||
SendAllLoginToBilling();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1286,10 +1284,9 @@ void CClientManager::QUERY_SETUP(CPeer * peer, DWORD dwHandle, const char * c_pD
|
|||
}
|
||||
|
||||
//
|
||||
// 로그인 및 빌링정보 보내기
|
||||
// Log in the player
|
||||
//
|
||||
TPacketLoginOnSetup * pck = (TPacketLoginOnSetup *) c_pData;;
|
||||
std::vector<TPacketBillingRepair> vec_repair;
|
||||
TPacketLoginOnSetup * pck = (TPacketLoginOnSetup *) c_pData;
|
||||
|
||||
for (DWORD c = 0; c < p->dwLoginCount; ++c, ++pck)
|
||||
{
|
||||
|
@ -1312,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);
|
||||
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
|
||||
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);
|
||||
CGuildManager::instance().OnSetup(peer);
|
||||
CPrivManager::instance().SendPrivOnSetup(peer);
|
||||
|
@ -1843,8 +1822,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();
|
||||
|
@ -1867,109 +1844,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)
|
||||
{
|
||||
CGuildManager::instance().DepositMoney(p->dwGuild, p->iGold);
|
||||
|
@ -1990,51 +1864,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));
|
||||
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)
|
||||
{
|
||||
using namespace building;
|
||||
|
@ -2124,28 +1953,6 @@ void CClientManager::UpdateLand(DWORD * pdw)
|
|||
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
|
||||
void CClientManager::BlockChat(TPacketBlockChat* p)
|
||||
{
|
||||
|
@ -2551,14 +2358,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;
|
||||
|
@ -2571,10 +2370,6 @@ void CClientManager::ProcessPackets(CPeer * peer)
|
|||
UpdateLand((DWORD *) data);
|
||||
break;
|
||||
|
||||
case HEADER_GD_VCARD:
|
||||
VCard((TPacketGDVCard *) data);
|
||||
break;
|
||||
|
||||
case HEADER_GD_MARRIAGE_ADD:
|
||||
MarriageAdd((TPacketMarriageAdd *) data);
|
||||
break;
|
||||
|
@ -2802,7 +2597,6 @@ void CClientManager::RemovePeer(CPeer * pPeer)
|
|||
if (pkLD->IsPlay())
|
||||
{
|
||||
pkLD->SetPlay(false);
|
||||
SendLoginToBilling(pkLD, false);
|
||||
}
|
||||
|
||||
if (pkLD->IsDeleted())
|
||||
|
@ -3163,7 +2957,6 @@ int CClientManager::Process()
|
|||
// Process network events
|
||||
event_base_loop(m_base, EVLOOP_NONBLOCK);
|
||||
|
||||
VCardProcess();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -344,12 +344,6 @@ class CClientManager : public singleton<CClientManager>
|
|||
void SetEventFlag(TPacketSetEventFlag* p);
|
||||
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 MarriageUpdate(TPacketMarriageUpdate * p);
|
||||
|
@ -382,10 +376,6 @@ class CClientManager : public singleton<CClientManager>
|
|||
void DeleteObject(DWORD dwID);
|
||||
void UpdateLand(DWORD * pdw);
|
||||
|
||||
// VCard
|
||||
void VCard(TPacketGDVCard * p);
|
||||
void VCardProcess();
|
||||
|
||||
// BLOCK_CHAT
|
||||
void BlockChat(TPacketBlockChat * p);
|
||||
// END_OF_BLOCK_CHAT
|
||||
|
@ -438,8 +428,6 @@ class CClientManager : public singleton<CClientManager>
|
|||
std::vector<building::TObjectProto> m_vec_kObjectProto;
|
||||
std::map<DWORD, building::TObject *> m_map_pkObjectTable;
|
||||
|
||||
std::queue<TPacketGDVCard> m_queue_vcard;
|
||||
|
||||
bool m_bShutdowned;
|
||||
|
||||
TPlayerTableCacheMap m_map_playerCache; // Ç÷¹À̾î id°¡ key
|
||||
|
|
|
@ -55,7 +55,6 @@ bool CClientManager::DeleteLogonAccount(const char * c_pszLogin, DWORD dwHandle)
|
|||
if (pkLD->IsPlay())
|
||||
{
|
||||
pkLD->SetPlay(false);
|
||||
SendLoginToBilling(pkLD, false);
|
||||
}
|
||||
|
||||
if (pkLD->IsDeleted())
|
||||
|
|
|
@ -237,7 +237,6 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad
|
|||
pTab = c->Get();
|
||||
|
||||
pkLD->SetPlay(true);
|
||||
SendLoginToBilling(pkLD, true);
|
||||
memcpy(pTab->aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(pTab->aiPremiumTimes));
|
||||
|
||||
peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_SUCCESS, dwHandle, sizeof(TPlayerTable));
|
||||
|
@ -643,7 +642,6 @@ void CClientManager::RESULT_PLAYER_LOAD(CPeer * peer, MYSQL_RES * pRes, ClientHa
|
|||
}
|
||||
|
||||
pkLD->SetPlay(true);
|
||||
SendLoginToBilling(pkLD, true);
|
||||
memcpy(tab.aiPremiumTimes, pkLD->GetPremiumPtr(), sizeof(tab.aiPremiumTimes));
|
||||
|
||||
peer->EncodeHeader(HEADER_DG_PLAYER_LOAD_SUCCESS, pkInfo->dwHandle, sizeof(TPlayerTable));
|
||||
|
|
|
@ -11,8 +11,6 @@ CLoginData::CLoginData()
|
|||
memset(m_szIP, 0, sizeof(m_szIP));
|
||||
m_bPlay = false;
|
||||
m_bDeleted = false;
|
||||
m_bBillType = 0;
|
||||
m_dwBillID = 0;
|
||||
m_lastPlayTime = 0;
|
||||
m_dwLastPlayerID = 0;
|
||||
|
||||
|
|
|
@ -29,12 +29,6 @@ class CLoginData
|
|||
void SetDeleted(bool bSet);
|
||||
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; }
|
||||
|
||||
void SetPremium(DWORD * paiPremiumTimes);
|
||||
|
@ -53,8 +47,6 @@ class CLoginData
|
|||
bool m_bPlay;
|
||||
bool m_bDeleted;
|
||||
|
||||
BYTE m_bBillType;
|
||||
DWORD m_dwBillID;
|
||||
time_t m_lastPlayTime;
|
||||
DWORD m_aiPremiumTimes[PREMIUM_MAX_NUM];
|
||||
|
||||
|
|
|
@ -3748,11 +3748,6 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
|
|||
item->SetCount(item->GetCount()-1);
|
||||
break;
|
||||
|
||||
case 90008: // VCARD
|
||||
case 90009: // VCARD
|
||||
VCardUse(this, this, item);
|
||||
break;
|
||||
|
||||
case ITEM_ELK_VNUM: // 돈꾸러미
|
||||
{
|
||||
int iGold = item->GetSocket(0);
|
||||
|
|
|
@ -75,8 +75,6 @@ BYTE g_bAuthServer = false;
|
|||
bool g_bCheckClientVersion = true;
|
||||
string g_stClientVersion = "1215955205";
|
||||
|
||||
BYTE g_bBilling = false;
|
||||
|
||||
string g_stAuthMasterIP;
|
||||
WORD g_wAuthMasterPort = 0;
|
||||
|
||||
|
@ -913,11 +911,6 @@ void config_init(const string& st_localeServiceName)
|
|||
continue;
|
||||
}
|
||||
|
||||
TOKEN("billing")
|
||||
{
|
||||
g_bBilling = true;
|
||||
}
|
||||
|
||||
TOKEN("quest_dir")
|
||||
{
|
||||
SPDLOG_INFO("QUEST_DIR SETTING : {}", value_string);
|
||||
|
|
|
@ -64,7 +64,6 @@ extern void LoadStateUserCount();
|
|||
extern bool g_bEmpireWhisper;
|
||||
|
||||
extern BYTE g_bAuthServer;
|
||||
extern BYTE g_bBilling;
|
||||
|
||||
extern BYTE PK_PROTECT_LEVEL;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "stdafx.h"
|
||||
#include <sstream>
|
||||
#include <common/billing.h>
|
||||
#include <common/length.h>
|
||||
|
||||
#include "db.h"
|
||||
|
@ -158,260 +157,10 @@ void DBManager::DeleteLoginData(CLoginData * pkLD)
|
|||
|
||||
SPDLOG_DEBUG("DeleteLoginData {} {}", pkLD->GetLogin(), (void*) pkLD);
|
||||
|
||||
mapLDBilling.erase(pkLD->GetLogin());
|
||||
|
||||
M2_DELETE(it->second);
|
||||
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)
|
||||
{
|
||||
TPacketGGLoginPing ptog;
|
||||
|
@ -444,8 +193,6 @@ void DBManager::SendAuthLogin(LPDESC d)
|
|||
trim_and_lower(r.login, ptod.szLogin, sizeof(ptod.szLogin));
|
||||
strlcpy(ptod.szSocialID, r.social_id, sizeof(ptod.szSocialID));
|
||||
ptod.dwLoginKey = d->GetLoginKey();
|
||||
ptod.bBillType = pkLD->GetBillType();
|
||||
ptod.dwBillID = pkLD->GetBillID();
|
||||
|
||||
memcpy(ptod.iPremiumTimes, pkLD->GetPremiumPtr(), sizeof(ptod.iPremiumTimes));
|
||||
memcpy(&ptod.adwClientKey, pkLD->GetClientKey(), sizeof(DWORD) * 4);
|
||||
|
@ -456,7 +203,7 @@ void DBManager::SendAuthLogin(LPDESC d)
|
|||
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();
|
||||
|
||||
|
@ -464,9 +211,6 @@ void DBManager::LoginPrepare(BYTE bBillType, DWORD dwBillID, int lRemainSecs, LP
|
|||
|
||||
pkLD->SetKey(d->GetLoginKey());
|
||||
pkLD->SetLogin(r.login);
|
||||
pkLD->SetBillType(bBillType);
|
||||
pkLD->SetBillID(dwBillID);
|
||||
pkLD->SetRemainSecs(lRemainSecs);
|
||||
pkLD->SetIP(d->GetHostName());
|
||||
pkLD->SetClientKey(pdwClientKey);
|
||||
|
||||
|
@ -508,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)
|
||||
{
|
||||
CReturnQueryInfo * qi = (CReturnQueryInfo *) pMsg->pvUserData;
|
||||
|
@ -626,7 +268,7 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
|||
M2_DELETE(pinfo);
|
||||
break;
|
||||
}
|
||||
//위치 변경 - By SeMinZ
|
||||
|
||||
d->SetLogin(pinfo->login);
|
||||
|
||||
SPDLOG_DEBUG("QID_AUTH_LOGIN: START {} {}", qi->dwIdent, (void*) get_pointer(d));
|
||||
|
@ -807,122 +449,15 @@ void DBManager::AnalyzeReturnQuery(SQLMsg * pMsg)
|
|||
|
||||
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);
|
||||
|
||||
LoginPrepare(d, pinfo->adwClientKey, aiPremiumTimes);
|
||||
M2_DELETE(pinfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
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:
|
||||
{
|
||||
LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(qi->dwIdent);
|
||||
|
@ -1014,37 +549,6 @@ void DBManager::SendMoneyLog(BYTE type, DWORD vnum, int gold)
|
|||
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분의 결제시간이 추가 되었습니다. (결제번호 %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);
|
||||
}
|
||||
}
|
||||
|
||||
size_t DBManager::EscapeString(char* dst, size_t dstSize, const char *src, size_t srcSize)
|
||||
{
|
||||
return m_sql_direct.EscapeString(dst, dstSize, src, srcSize);
|
||||
|
|
|
@ -16,8 +16,6 @@ enum
|
|||
QID_SAFEBOX_SIZE,
|
||||
QID_AUTH_LOGIN,
|
||||
QID_LOTTO,
|
||||
QID_BILLING_GET_TIME,
|
||||
QID_BILLING_CHECK,
|
||||
|
||||
// BLOCK_CHAT
|
||||
QID_BLOCK_CHAT_LIST,
|
||||
|
@ -28,15 +26,6 @@ enum
|
|||
// 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
|
||||
{
|
||||
public:
|
||||
|
@ -85,19 +74,13 @@ class DBManager : public singleton<DBManager>
|
|||
|
||||
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 SendLoginPing(const char * c_pszLogin);
|
||||
|
||||
void InsertLoginData(CLoginData * pkLD);
|
||||
void DeleteLoginData(CLoginData * pkLD);
|
||||
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 CountQueryResult() { return m_sql.CountResult(); }
|
||||
|
@ -116,8 +99,6 @@ class DBManager : public singleton<DBManager>
|
|||
bool m_bIsConnect;
|
||||
|
||||
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, ...)
|
||||
|
@ -156,9 +137,6 @@ template <class Functor> void DBManager::FuncAfterQuery(Functor f, const char* c
|
|||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
extern void SendBillingExpire(const char * c_pszLogin, BYTE bBillType, int iSecs, CLoginData * pkLD);
|
||||
extern void VCardUse(LPCHARACTER CardOwner, LPCHARACTER CardTaker, LPITEM item);
|
||||
|
||||
|
||||
// ACCOUNT_DB
|
||||
class AccountDB : public singleton<AccountDB>
|
||||
|
|
|
@ -121,8 +121,6 @@ void DESC::Initialize()
|
|||
m_dwProcCRC = 0;
|
||||
m_dwFileCRC = 0;
|
||||
|
||||
m_dwBillingExpireSecond = 0;
|
||||
|
||||
m_outtime = 0;
|
||||
m_playtime = 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)
|
||||
{
|
||||
if (m_seq_vector.size()>=20)
|
||||
|
|
|
@ -155,9 +155,6 @@ class DESC
|
|||
|
||||
void AssembleCRCMagicCube(BYTE bProcPiece, BYTE bFilePiece);
|
||||
|
||||
void SetBillingExpireSecond(DWORD dwSec);
|
||||
DWORD GetBillingExpireSecond();
|
||||
|
||||
void SetClientVersion(const char * c_pszTimestamp) { m_stClientVersion = c_pszTimestamp; }
|
||||
const char * GetClientVersion() { return m_stClientVersion.c_str(); }
|
||||
|
||||
|
@ -217,7 +214,6 @@ class DESC
|
|||
DWORD m_dwProcCRC;
|
||||
DWORD m_dwFileCRC;
|
||||
|
||||
DWORD m_dwBillingExpireSecond;
|
||||
std::string m_stClientVersion;
|
||||
std::string m_stMatrixCode;
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ void CLIENT_DESC::Destroy()
|
|||
CPartyManager::instance().DeleteAllParty();
|
||||
CPartyManager::instance().DisablePCParty();
|
||||
CGuildManager::instance().StopAllGuildWar();
|
||||
DBManager::instance().StopAllBilling();
|
||||
}
|
||||
|
||||
SPDLOG_DEBUG("SYSTEM: closing client socket.");
|
||||
|
|
|
@ -438,12 +438,6 @@ bool CExchange::Done()
|
|||
|
||||
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);
|
||||
|
||||
item->RemoveFromCharacter();
|
||||
|
|
|
@ -240,12 +240,6 @@ protected:
|
|||
|
||||
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 DeleteObject(const char * c_pData);
|
||||
void UpdateLand(const char * c_pData);
|
||||
|
|
|
@ -1823,90 +1823,6 @@ void CInputDB::UpdateLand(const char * 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("결재기간이 %d분 후 만료 됩니다."), (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)
|
||||
{
|
||||
extern void SendNotice(const char * c_pszBuf);
|
||||
|
@ -1920,61 +1836,6 @@ void CInputDB::Notice(const char * c_pData)
|
|||
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)
|
||||
{
|
||||
CGuildManager::instance().ReserveWarAdd(p);
|
||||
|
@ -2303,26 +2164,6 @@ int CInputDB::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
|||
SetEventFlag(c_pData);
|
||||
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:
|
||||
CreateObject(c_pData);
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "stdafx.h"
|
||||
#include <common/billing.h>
|
||||
#include "stdafx.h"
|
||||
#include "config.h"
|
||||
#include "desc_client.h"
|
||||
#include "desc_manager.h"
|
||||
|
@ -369,8 +368,6 @@ void CInputP2P::LoginPing(LPDESC d, const char * 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
|
||||
P2P_MANAGER::instance().Send(p, sizeof(TPacketGGLoginPing), d);
|
||||
}
|
||||
|
|
|
@ -244,12 +244,6 @@ void LogManager::BootLog(const char * c_pszHostName, BYTE 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)
|
||||
{
|
||||
Query("INSERT INTO fish_log%s VALUES(NOW(), %u, %d, %u, %d, %u, %u, %u)",
|
||||
|
|
|
@ -46,7 +46,6 @@ class LogManager : public singleton<LogManager>
|
|||
void ShoutLog(BYTE bChannel, BYTE bEmpire, const char * pszText);
|
||||
void LevelLog(LPCHARACTER pChar, unsigned int level, unsigned int playhour);
|
||||
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 QuestRewardLog(const char * c_pszQuestName, DWORD dwPID, DWORD dwLevel, int iValue1, int iValue2);
|
||||
void DetailLoginLog(bool isLogin, LPCHARACTER ch);
|
||||
|
|
|
@ -8,13 +8,9 @@ CLoginData::CLoginData()
|
|||
{
|
||||
m_dwKey = 0;
|
||||
memset(m_adwClientKey, 0, sizeof(m_adwClientKey));
|
||||
m_bBillType = 0;
|
||||
m_dwBillID = 0;
|
||||
m_dwConnectedPeerHandle = 0;
|
||||
m_dwLogonTime = 0;
|
||||
m_lRemainSecs = 0;
|
||||
memset(m_szIP, 0, sizeof(m_szIP));
|
||||
m_bBilling = false;
|
||||
m_bDeleted = false;
|
||||
memset(m_aiPremiumTimes, 0, sizeof(m_aiPremiumTimes));
|
||||
}
|
||||
|
@ -39,26 +35,6 @@ DWORD CLoginData::GetKey()
|
|||
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)
|
||||
{
|
||||
m_dwConnectedPeerHandle = dwHandle;
|
||||
|
@ -89,35 +65,6 @@ const char * CLoginData::GetIP()
|
|||
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)
|
||||
{
|
||||
m_bDeleted = bSet;
|
||||
|
|
|
@ -15,12 +15,6 @@ class CLoginData
|
|||
void SetLogin(const char * c_pszLogin);
|
||||
const char * GetLogin();
|
||||
|
||||
void SetBillType(BYTE bType);
|
||||
DWORD GetBillID();
|
||||
|
||||
void SetBillID(DWORD dwID);
|
||||
BYTE GetBillType();
|
||||
|
||||
void SetConnectedPeerHandle(DWORD dwHandle);
|
||||
DWORD GetConnectedPeerHandle();
|
||||
|
||||
|
@ -30,12 +24,6 @@ class CLoginData
|
|||
void SetIP(const char * c_pszIP);
|
||||
const char * GetIP();
|
||||
|
||||
void SetRemainSecs(int l);
|
||||
int GetRemainSecs();
|
||||
|
||||
void SetBilling(bool bOn);
|
||||
bool IsBilling();
|
||||
|
||||
void SetDeleted(bool bSet);
|
||||
bool IsDeleted();
|
||||
|
||||
|
@ -47,13 +35,9 @@ class CLoginData
|
|||
private:
|
||||
DWORD m_dwKey;
|
||||
DWORD m_adwClientKey[4];
|
||||
BYTE m_bBillType;
|
||||
DWORD m_dwBillID;
|
||||
DWORD m_dwConnectedPeerHandle;
|
||||
DWORD m_dwLogonTime;
|
||||
int m_lRemainSecs;
|
||||
char m_szIP[MAX_HOST_LENGTH+1];
|
||||
bool m_bBilling;
|
||||
bool m_bDeleted;
|
||||
std::string m_stLogin;
|
||||
int m_aiPremiumTimes[PREMIUM_MAX_NUM];
|
||||
|
|
|
@ -238,11 +238,6 @@ void heartbeat(LPHEART ht, int pulse)
|
|||
else
|
||||
{
|
||||
DESC_MANAGER::instance().ProcessExpiredLoginKey();
|
||||
DBManager::instance().FlushBilling();
|
||||
/*
|
||||
if (!(pulse % (ht->passes_per_sec * 600)))
|
||||
DBManager::instance().CheckBilling();
|
||||
*/
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -429,8 +424,6 @@ int main(int argc, char **argv)
|
|||
|
||||
if (g_bAuthServer)
|
||||
{
|
||||
DBManager::instance().FlushBilling(true);
|
||||
|
||||
int iLimit = DBManager::instance().CountQuery() / 50;
|
||||
int i = 0;
|
||||
|
||||
|
|
|
@ -341,36 +341,28 @@ int CShop::Buy(LPCHARACTER ch, BYTE pos)
|
|||
{
|
||||
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);
|
||||
item = NULL;
|
||||
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
|
||||
{
|
||||
char buf[512];
|
||||
item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
|
||||
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());
|
||||
LogManager::instance().ItemLog(ch, item, "SHOP_BUY", buf);
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
|
||||
r_item.pkItem = NULL;
|
||||
BroadcastUpdateItem(pos);
|
||||
|
|
Loading…
Reference in New Issue