Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1363 lines
40 KiB
C++
1363 lines
40 KiB
C++
#include "stdafx.h"
|
||
#include "SessionData.h"
|
||
#include "SessionDataMgr.h"
|
||
|
||
#include "StoreData.h"
|
||
#include "CharacterData.h"
|
||
|
||
#include "AdminDataMgr.h"
|
||
|
||
#include "StoreDataMgr.h"
|
||
#include "CharacterDataMgr.h"
|
||
|
||
|
||
#include <Network/Dispatch/LoginDispatch.h>
|
||
#include <Network/Dispatch/GameDispatch.h>
|
||
#include <Network/Dispatch/AuthDispatch.h>
|
||
#include <Network/Dispatch/UIDDispatch.h>
|
||
|
||
#include <Network/SendPacket/SendServerInfo.h>
|
||
|
||
#include <GameTime/GameTimeDBMgr.h>
|
||
|
||
#include <Community/Guild/GuildDB.h>
|
||
#include <Community/Guild/GuildDBMgr.h>
|
||
|
||
#include <DB/DBComponent.h>
|
||
#include <DB/GameDBComponent.h>
|
||
#include <Log/ServerLog.h>
|
||
#include <Network/Packet/PacketStruct/ServerInfo.h>
|
||
|
||
#include <Utility/Debug/PerformanceCheck.h>
|
||
#include <Utility/Setup/ServerSetup.h>
|
||
|
||
namespace DBAgent
|
||
{
|
||
namespace DataStorage
|
||
{
|
||
|
||
const char* g_szSessionStateString[CSessionData::SE_MAX_STATE] =
|
||
{
|
||
"NONE",
|
||
"USER_ENABLED",
|
||
"USER_DISABLED",
|
||
"MOVE",
|
||
"CHAR_ENABLED",
|
||
"CHAR_DISABLED"
|
||
};
|
||
|
||
RequestData::RequestData()
|
||
{
|
||
m_dwRequestKey = m_dwSelectedCID = m_dwServerID = m_dwSessionID = 0;
|
||
m_PeerAddress.S_un.S_addr = 0;
|
||
|
||
memset(m_szAccount, 0, sizeof(char) * MaxName);
|
||
memset(m_szPassword, 0, sizeof(char) * MaxPass);
|
||
}
|
||
|
||
RequestData::RequestData(unsigned long dwRequestKey, unsigned long dwSelectedCID,
|
||
unsigned long dwServerID, unsigned long dwSessionID,
|
||
IN_ADDR peerAddr, const char* szAccountName, const char* szPassword)
|
||
: m_dwRequestKey(dwRequestKey), m_dwSelectedCID(dwSelectedCID),
|
||
m_dwServerID(dwServerID), m_dwSessionID(dwSessionID),
|
||
m_PeerAddress(peerAddr)
|
||
{
|
||
if(0 != szAccountName && strlen(szAccountName) > 0)
|
||
{
|
||
strcpy(m_szAccount, szAccountName);
|
||
}
|
||
else
|
||
{
|
||
memset(m_szAccount, 0, sizeof(char) * MaxName);
|
||
}
|
||
|
||
if(0 != szPassword && strlen(szPassword) > 0)
|
||
{
|
||
strcpy(m_szPassword, szPassword);
|
||
}
|
||
else
|
||
{
|
||
memset(m_szPassword, 0, sizeof(char) * MaxPass);
|
||
}
|
||
}
|
||
|
||
|
||
CSessionData::CSessionData()
|
||
: m_nUnifiedStoreInfoNum(0),
|
||
m_nUnifiedCharDataNum(0),
|
||
m_dwUID(0),
|
||
m_dwCID(0),
|
||
m_dwSessionID(0),
|
||
m_dwServerID(0),
|
||
m_eSessionState(SE_NONE),
|
||
m_dwFlags(0),
|
||
m_lpCharacterData(0),
|
||
m_lpStoreData(0),
|
||
m_cAdminLevel(0),
|
||
m_cOldServerGroupID(0),
|
||
m_cTransferedCharCount(UCHAR_MAX),
|
||
m_cNewZone(0),
|
||
m_dwPlayTime(0)
|
||
{
|
||
memset(&m_PremiumService, 0, sizeof(PREMIUMSERVICE));
|
||
memset(&m_UserInfo, 0, sizeof(USER_INFO));
|
||
memset(m_CharView, 0, sizeof(CHAR_VIEW) * USER_INFO::MAX_CHAR_NUM);
|
||
memset(m_szAccount, 0, sizeof(char) * CHAR_INFOST::MAX_ACCOUNT_LEN);
|
||
memset(&m_NewPos, 0, sizeof(POS));
|
||
|
||
memset(m_UnifiedStoreInfo, 0, sizeof(UnifiedStoreInfo) * PktUnifiedCharInfo::MAX_STORE_INFO);
|
||
memset(m_UnifiedCharData, 0, sizeof(UnifiedCharData) * PktUnifiedCharInfo::MAX_CHAR_DATA);
|
||
|
||
memset(m_SaveEnemy, 0, sizeof(SaveEnemy)*SaveEnemy::MAX_SAVING_ENEMY);
|
||
|
||
m_RemoteAddress.S_un.S_addr = 0;
|
||
}
|
||
|
||
CSessionData::~CSessionData()
|
||
{
|
||
m_RequestQueue.clear();
|
||
}
|
||
|
||
|
||
bool CSessionData::GetCharView(unsigned long dwCID, CHAR_VIEW& charView_Out)
|
||
{
|
||
for(unsigned int nCount = 0; nCount < USER_INFO::MAX_CHAR_NUM; ++nCount)
|
||
{
|
||
if(m_CharView[nCount].CID == dwCID)
|
||
{
|
||
charView_Out = m_CharView[nCount];
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
// WORK_LIST 2.3 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
bool CSessionData::SetCharViewGID(unsigned long dwCID, unsigned long dwGID)
|
||
{
|
||
for(unsigned int nCount = 0; nCount < USER_INFO::MAX_CHAR_NUM; ++nCount)
|
||
{
|
||
if(m_CharView[nCount].CID == dwCID)
|
||
{
|
||
m_CharView[nCount].GID = dwGID;
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
bool CSessionData::SetCharViewFame(unsigned long dwCID, unsigned long dwFame)
|
||
{
|
||
for(unsigned int nCount = 0; nCount < USER_INFO::MAX_CHAR_NUM; ++nCount)
|
||
{
|
||
if(m_CharView[nCount].CID == dwCID)
|
||
{
|
||
m_CharView[nCount].Fame = dwFame;
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
bool CSessionData::HasCharacter(unsigned long dwCID) const
|
||
{
|
||
if(0 != dwCID)
|
||
{
|
||
for (int nCount = 0; nCount < USER_INFO::MAX_CHAR_NUM; ++nCount)
|
||
{
|
||
if (dwCID == m_UserInfo.CharID[nCount])
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
bool CSessionData::GetPlayTimeFromDB(CDBComponent& DBComponent)
|
||
{
|
||
if (GameRYL::CHINA != CServerSetup::GetInstance().GetNationType())
|
||
{
|
||
m_dwPlayTime = 0;
|
||
return true;
|
||
}
|
||
|
||
using namespace DBComponent;
|
||
|
||
if (!GameDB::GetPlayTime(DBComponent, m_dwUID, &m_dwPlayTime))
|
||
{
|
||
SERLOG1(g_Log, "UID:%10u / ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ε<EFBFBD> <20><><EFBFBD><EFBFBD> : GetPlayTime ȣ<><C8A3> <20><><EFBFBD><EFBFBD>", m_dwUID);
|
||
return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
bool CSessionData::GetPremiumServiceFromDB(CDBComponent& DBComponent)
|
||
{
|
||
memset(&m_PremiumService, 0, sizeof(PREMIUMSERVICE));
|
||
|
||
using namespace DBComponent;
|
||
|
||
if (!GameDB::GetPremiumService(DBComponent, m_dwUID, m_PremiumService))
|
||
{
|
||
// SERLOG1(g_Log, "UID:%10u / <20><><EFBFBD><EFBFBD><EFBFBD>̾<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ƴ<EFBFBD>", m_dwUID);
|
||
return false;
|
||
}
|
||
|
||
if(m_PremiumService.lPremiumTime == 0)
|
||
m_PremiumService.iPremiumType = 0;
|
||
|
||
return true;
|
||
}
|
||
|
||
bool CSessionData::GetUserInfoFromDB(CDBComponent& DBComponent)
|
||
{
|
||
PERFORMANCE_CHECK(FunctionTimingCheck);
|
||
|
||
memset(&m_UserInfo, 0, sizeof(USER_INFO));
|
||
memset(m_CharView, 0, sizeof(CHAR_VIEW) * USER_INFO::MAX_CHAR_NUM);
|
||
|
||
using namespace DBComponent;
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
bool bFirstLoadUserInfoResult =
|
||
GameDB::GetUserInfo(DBComponent, m_dwUID, m_UserInfo, m_cOldServerGroupID, true);
|
||
|
||
if (!bFirstLoadUserInfoResult)
|
||
{
|
||
if(!GameDB::InsertUser(DBComponent, m_dwUID, m_cOldServerGroupID))
|
||
{
|
||
SERLOG3(g_Log, "UID:%10u / ServerGroupID:%d / <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : %s",
|
||
m_dwUID, m_cOldServerGroupID, DBComponent.GetErrorString());
|
||
|
||
return false;
|
||
}
|
||
}
|
||
|
||
if (!bFirstLoadUserInfoResult &&
|
||
!GameDB::GetUserInfo(DBComponent, m_dwUID, m_UserInfo, m_cOldServerGroupID))
|
||
{
|
||
SERLOG3(g_Log, "UID:%10u / ServerGroupID:%d / <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : %s",
|
||
m_dwUID, m_cOldServerGroupID, DBComponent.GetErrorString());
|
||
}
|
||
else
|
||
{
|
||
bool bGetViewResult = true;
|
||
|
||
for (int nCount = 0; nCount < USER_INFO::MAX_CHAR_NUM; ++nCount)
|
||
{
|
||
if (0 != m_UserInfo.CharID[nCount] &&
|
||
!GameDB::GetCharView(DBComponent, m_UserInfo.CharID[nCount], &m_CharView[nCount]))
|
||
{
|
||
SERLOG5(g_Log, "UID:%10u / ServerGroupID:%d / CID:%10u / Slot:%d / ij<><C4B3><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : %s",
|
||
m_dwUID, m_cOldServerGroupID, m_UserInfo.CharID[nCount], nCount, DBComponent.GetErrorString());
|
||
/*
|
||
// edith 2010.01.03 <20><><EFBFBD>ʷ<EFBFBD> <20><>Ʈ<EFBFBD><C6AE>ũ<EFBFBD><C5A9> DB<44><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GetCharView<65><77> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>
|
||
// GameDB<44><42> UserInfo<66><6F> CID<49><44> 0<><30><EFBFBD><EFBFBD> <20>ʱ<EFBFBD>ȭ <20>غ<EFBFBD><D8BA><EFBFBD> <20><><EFBFBD>߿<EFBFBD> DB<44><42> CID<49><44> 0<><30> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20>Ǿ<EFBFBD>
|
||
// ij<><C4B3><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD> <20><><EFBFBD>װ<EFBFBD> <20>ƴ<EFBFBD>.
|
||
|
||
m_UserInfo.CharID[nCount] = 0;
|
||
if (!GameDB::UpdateUser(DBComponent, m_dwUID, &m_UserInfo))
|
||
{
|
||
bGetViewResult = false;
|
||
}
|
||
*/
|
||
bGetViewResult = false;
|
||
}
|
||
}
|
||
|
||
if(bGetViewResult)
|
||
{
|
||
INFLOG2(g_Log, "UID:%10u / ServerGroupID:%d / <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||
m_dwUID, m_cOldServerGroupID);
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
bool CSessionData::GetUnifiedInfo(CDBComponent& DBComponent, unsigned long UserID_In)
|
||
{
|
||
using namespace DBComponent;
|
||
|
||
memset(m_UnifiedStoreInfo, 0, sizeof(UnifiedStoreInfo) * PktUnifiedCharInfo::MAX_STORE_INFO);
|
||
|
||
m_nUnifiedStoreInfoNum = PktUnifiedCharInfo::MAX_STORE_INFO;
|
||
|
||
return GameDB::GetUnifiedItemStoreInfo(DBComponent, UserID_In, m_UnifiedStoreInfo, m_nUnifiedStoreInfoNum);
|
||
}
|
||
|
||
bool CSessionData::GetUnifiedDataFromDB(CDBComponent& DBComponent)
|
||
{
|
||
// UnifiedStoreInfo / UnifiedCharData <20><> <20>о <20><><EFBFBD>ǿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||
memset(m_UnifiedStoreInfo, 0, sizeof(UnifiedStoreInfo) * PktUnifiedCharInfo::MAX_STORE_INFO);
|
||
memset(m_UnifiedCharData, 0, sizeof(UnifiedCharData) * PktUnifiedCharInfo::MAX_CHAR_DATA);
|
||
|
||
m_nUnifiedStoreInfoNum = PktUnifiedCharInfo::MAX_STORE_INFO;
|
||
m_nUnifiedCharDataNum = PktUnifiedCharInfo::MAX_CHAR_DATA;
|
||
|
||
using namespace DBComponent;
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>б<EFBFBD>.
|
||
if(!GameDB::GetUnifiedItemStoreInfo(DBComponent, m_dwUID, m_UnifiedStoreInfo, m_nUnifiedStoreInfoNum))
|
||
{
|
||
ERRLOG2(g_Log, "UID:%10u / <20><><EFBFBD><EFBFBD> â<><C3A2> <20><><EFBFBD><EFBFBD> <20>о<EFBFBD><D0BE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : %s", m_dwUID, DBComponent.GetErrorString());
|
||
}
|
||
else if(!GameDB::GetUnifiedCharList(DBComponent, m_dwUID, m_UnifiedCharData, m_nUnifiedCharDataNum))
|
||
{
|
||
ERRLOG2(g_Log, "UID:%10u / <20><><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>о<EFBFBD><D0BE><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : %s", m_dwUID, DBComponent.GetErrorString());
|
||
}
|
||
else
|
||
{
|
||
unsigned char cAgentServerType = static_cast<unsigned char>(
|
||
CServerSetup::GetInstance().GetAgentServerType());
|
||
|
||
bool bHasUnifiedStoreInfo = HasUnifiedStoreInfo(cAgentServerType);
|
||
|
||
switch(cAgentServerType)
|
||
{
|
||
case UnifiedConst::Part2Unified:
|
||
|
||
m_cOldServerGroupID = UnifiedConst::Part2Unified;
|
||
|
||
if(!GetUserInfoFromDB(DBComponent))
|
||
{
|
||
ERRLOG2(g_Log, "UID:%10u / <20><><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : %s",
|
||
m_dwUID, DBComponent.GetErrorString());
|
||
}
|
||
else
|
||
{
|
||
unsigned char cAgentServerType =
|
||
static_cast<unsigned char>(CServerSetup::GetInstance().GetAgentServerType());
|
||
|
||
if (m_UserInfo.FirstLogin & UnifiedConst::SELECTED_PART2)
|
||
{
|
||
// â<><C3A2><EFBFBD><EFBFBD> <20>̹<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> â<><C3A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ʿ䰡 <20><><EFBFBD><EFBFBD>.
|
||
memset(m_UnifiedStoreInfo, 0, sizeof(UnifiedStoreInfo) * PktUnifiedCharInfo::MAX_STORE_INFO);
|
||
m_nUnifiedStoreInfoNum = 0;
|
||
}
|
||
else
|
||
{
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ID<49><44> <20><><EFBFBD><EFBFBD> <20>߰輭<DFB0><E8BCAD>Ÿ<EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>߸<EFBFBD><DFB8><EFBFBD>.
|
||
UnifiedStoreInfo* lpStorePos = m_UnifiedStoreInfo;
|
||
UnifiedStoreInfo* lpStoreEnd = m_UnifiedStoreInfo + m_nUnifiedStoreInfoNum;
|
||
|
||
for(; lpStorePos < lpStoreEnd; )
|
||
{
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> â<><C3A2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>ʿ<EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||
if(cAgentServerType <= lpStorePos->cOldServerGroupID)
|
||
{
|
||
memmove(lpStorePos, lpStorePos + 1, sizeof(UnifiedStoreInfo) * (lpStoreEnd - lpStorePos - 1));
|
||
--m_nUnifiedStoreInfoNum;
|
||
|
||
lpStoreEnd = m_UnifiedStoreInfo + m_nUnifiedStoreInfoNum;
|
||
}
|
||
else
|
||
{
|
||
++lpStorePos;
|
||
}
|
||
}
|
||
|
||
// â<><C3A2><EFBFBD><EFBFBD> <20><><EFBFBD>ų<EFBFBD>, â<><C3A2><EFBFBD><EFBFBD> <20>־ <20>ڱ<EFBFBD> â<><C3A2><EFBFBD><EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD>쿡<EFBFBD><ECBFA1>,
|
||
// â<><C3A2><EFBFBD><EFBFBD> <20>̹<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> ó<><C3B3> <20><> <20>ش<EFBFBD>.
|
||
if (0 == m_nUnifiedStoreInfoNum ||
|
||
(1 == m_nUnifiedStoreInfoNum && m_UnifiedStoreInfo->cOldServerGroupID == cAgentServerType))
|
||
{
|
||
m_UserInfo.FirstLogin |= UnifiedConst::SELECTED_PART2;
|
||
DBComponent::GameDB::UpdateUserFirstLogin(DBComponent, m_dwUID, m_UserInfo.FirstLogin);
|
||
}
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ID<49><44> <20><><EFBFBD><EFBFBD> <20>߰輭<DFB0><E8BCAD>Ÿ<EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>߸<EFBFBD><DFB8><EFBFBD>.
|
||
UnifiedCharData* lpCharPos = m_UnifiedCharData;
|
||
UnifiedCharData* lpCharEnd = m_UnifiedCharData+ m_nUnifiedCharDataNum;
|
||
|
||
for(; lpCharPos < lpCharEnd; )
|
||
{
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>.
|
||
if(cAgentServerType < lpCharPos->cOldServerGroupID)
|
||
{
|
||
memmove(lpCharPos, lpCharPos + 1, sizeof(UnifiedStoreInfo) * (lpCharEnd - lpCharPos - 1));
|
||
--m_nUnifiedCharDataNum;
|
||
|
||
lpCharEnd = m_UnifiedCharData+ m_nUnifiedCharDataNum;
|
||
}
|
||
else
|
||
{
|
||
++lpCharPos;
|
||
}
|
||
}
|
||
|
||
INFLOG4(g_Log, "UID:%10u / FirstLogin:%d / ReadStoreInfo:%d / ReadCharData:%d / <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>дµ<D0B4> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>",
|
||
m_dwUID, m_UserInfo.FirstLogin, m_nUnifiedStoreInfoNum, m_nUnifiedCharDataNum);
|
||
|
||
return true;
|
||
}
|
||
break;
|
||
|
||
case UnifiedConst::Part2Selectable:
|
||
|
||
if (0 == m_nUnifiedStoreInfoNum ||
|
||
(1 == m_nUnifiedStoreInfoNum && bHasUnifiedStoreInfo))
|
||
{
|
||
m_cOldServerGroupID = UnifiedConst::Part2Selectable;
|
||
|
||
memset(m_UnifiedStoreInfo, 0, sizeof(UnifiedStoreInfo) * PktUnifiedCharInfo::MAX_STORE_INFO);
|
||
m_nUnifiedStoreInfoNum = 0;
|
||
}
|
||
else
|
||
{
|
||
m_cOldServerGroupID = 1;
|
||
}
|
||
|
||
INFLOG3(g_Log, "UID:%10u / ReadStoreInfo:%d / ReadCharData:%d / <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>дµ<D0B4> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>",
|
||
m_dwUID, m_nUnifiedStoreInfoNum, m_nUnifiedCharDataNum);
|
||
|
||
return true;
|
||
}
|
||
}
|
||
|
||
m_nUnifiedStoreInfoNum = 0;
|
||
m_nUnifiedCharDataNum = 0;
|
||
|
||
m_cOldServerGroupID = 0;
|
||
return false;
|
||
}
|
||
|
||
void CSessionData::SetRequestData(const RequestData& reqData)
|
||
{
|
||
m_dwSessionID = reqData.m_dwSessionID;
|
||
m_dwServerID = reqData.m_dwServerID;
|
||
m_RemoteAddress = reqData.m_PeerAddress;
|
||
|
||
strcpy(m_szAccount, reqData.m_szAccount);
|
||
}
|
||
|
||
|
||
bool CSessionData::UserEnable(CDBComponent& DBComponent, unsigned long dwUID)
|
||
{
|
||
if (SE_USER_ENABLED == m_eSessionState || SE_CHAR_ENABLED == m_eSessionState)
|
||
{
|
||
LogUserDataError("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ȱ<><C8B0>ȭ <20>õ<EFBFBD> <20><><EFBFBD><EFBFBD>", LOG_FFL);
|
||
}
|
||
// DB<44><42><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>並 <20><><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD>.
|
||
else if (GetUserInfoFromDB(DBComponent))
|
||
{
|
||
// <20><><EFBFBD><EFBFBD> Ȱ<><C8B0>ȭ.
|
||
SetSessionState(SE_USER_ENABLED);
|
||
INFLOG1(g_Log, "UID:%10u / <20><><EFBFBD><EFBFBD> Ȱ<><C8B0>ȭ", m_dwUID);
|
||
|
||
// <20><EFBFBD><EEBFB5> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||
m_cAdminLevel = CAdminDataMgr::GetInstance().GetAdminLevel(m_dwUID, m_RemoteAddress);
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20><> <20>ø<EFBFBD>.
|
||
GET_SINGLE_DISPATCH(lpAuthDispatch,
|
||
CAuthDispatch, CAuthDispatch::GetDispatchTable());
|
||
|
||
if(0 != lpAuthDispatch)
|
||
{
|
||
lpAuthDispatch->IncUserNum();
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
bool CSessionData::UserDisable()
|
||
{
|
||
if (SE_USER_ENABLED == m_eSessionState || SE_MOVE == m_eSessionState)
|
||
{
|
||
// <20><><EFBFBD><EFBFBD> <20><>Ȱ<EFBFBD><C8B0>ȭ <20><><EFBFBD><EFBFBD> <20><>ȯ
|
||
SetSessionState(SE_USER_DISABLED);
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20><>Ȱ<EFBFBD><C8B0>ȭ <20><><EFBFBD><EFBFBD>
|
||
SendPacket::UpdateUIDTable(PktUUT::UpdateUIDTableUserLogout,
|
||
m_szAccount, NULL, m_dwUID, m_dwCID, m_dwSessionID, m_dwServerID, m_RemoteAddress);
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
||
GET_SINGLE_DISPATCH(lpAuthDispatch,
|
||
CAuthDispatch, CAuthDispatch::GetDispatchTable());
|
||
|
||
if(0 != lpAuthDispatch)
|
||
{
|
||
lpAuthDispatch->DecUserNum();
|
||
}
|
||
|
||
// Ȥ<><C8A4> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20>ε<EFBFBD><CEB5>Ǿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ε<EFBFBD><CEB5>Ѵ<EFBFBD>.
|
||
UnloadData();
|
||
GetBilling().ClearBilling();
|
||
}
|
||
else
|
||
{
|
||
LogUserDataError("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ȱ<EFBFBD><C8B0>ȭ <20>õ<EFBFBD> <20><><EFBFBD><EFBFBD>", LOG_FFL);
|
||
return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
bool CSessionData::UserMove()
|
||
{
|
||
if (SE_USER_ENABLED == m_eSessionState)
|
||
{
|
||
// ij<><C4B3><EFBFBD><EFBFBD> <20>̵<EFBFBD>
|
||
SetSessionState(SE_MOVE);
|
||
SendPacket::UpdateUIDTable(PktUUT::UpdateUIDTableUserMove,
|
||
m_szAccount, NULL, m_dwUID, m_dwCID, m_dwSessionID, m_dwServerID, m_RemoteAddress);
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
||
GET_SINGLE_DISPATCH(lpAuthDispatch,
|
||
CAuthDispatch, CAuthDispatch::GetDispatchTable());
|
||
|
||
if(0 != lpAuthDispatch)
|
||
{
|
||
lpAuthDispatch->DecUserNum();
|
||
}
|
||
|
||
UnloadData();
|
||
}
|
||
else
|
||
{
|
||
LogUserDataError("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̵<EFBFBD> <20>õ<EFBFBD> <20><><EFBFBD><EFBFBD>", LOG_FFL);
|
||
return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
bool CSessionData::LoadData(unsigned long dwCID)
|
||
{
|
||
DBDataError eStoreDataError = DATA_SUCCEEDED;
|
||
DBDataError eCharacterDataError = DATA_SUCCEEDED;
|
||
|
||
// â<><C3A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ε<EFBFBD> (â<><C3A2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ų<EFBFBD>, <20>ٸ<EFBFBD> UID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>쿡<EFBFBD><ECBFA1> <20>ε<EFBFBD>)
|
||
if(0 == m_lpStoreData || m_dwUID != m_lpStoreData->GetUID())
|
||
{
|
||
if(0 != m_lpStoreData)
|
||
{
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ݳ<EFBFBD>
|
||
CStoreDataMgr::GetInstance().UnloadData(*this, m_lpStoreData);
|
||
m_lpStoreData = 0;
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ε<EFBFBD>
|
||
eStoreDataError = CStoreDataMgr::GetInstance().LoadData(*this,
|
||
UnifiedStoreKey(m_dwUID, m_cOldServerGroupID), m_lpStoreData);
|
||
}
|
||
|
||
// ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ε<EFBFBD> (ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ų<EFBFBD>, <20>ٸ<EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>쿡<EFBFBD><ECBFA1> <20>ε<EFBFBD>)
|
||
if(0 == m_lpCharacterData || dwCID != m_lpCharacterData->GetCID())
|
||
{
|
||
if(0 != m_lpCharacterData)
|
||
{
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ݳ<EFBFBD>
|
||
CCharacterDataMgr::GetInstance().UnloadData(*this, m_lpCharacterData);
|
||
m_lpCharacterData = 0;
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ε<EFBFBD>
|
||
eCharacterDataError =
|
||
CCharacterDataMgr::GetInstance().LoadData(*this, dwCID, m_lpCharacterData);
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD> ó<><C3B3>
|
||
if (eStoreDataError != DATA_SUCCEEDED ||
|
||
eCharacterDataError != DATA_SUCCEEDED)
|
||
{
|
||
// <20><><EFBFBD><EFBFBD>ó<EFBFBD><C3B3>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Unload<61>ϰ<EFBFBD> <20>α<CEB1> <20><><EFBFBD>´<EFBFBD>.
|
||
if(0 != m_lpStoreData && eStoreDataError == DATA_SUCCEEDED)
|
||
{
|
||
CStoreDataMgr::GetInstance().UnloadData(*this, m_lpStoreData);
|
||
m_lpStoreData = 0;
|
||
}
|
||
|
||
if(0 != m_lpCharacterData && eCharacterDataError == DATA_SUCCEEDED)
|
||
{
|
||
CCharacterDataMgr::GetInstance().UnloadData(*this, m_lpCharacterData);
|
||
m_lpCharacterData = 0;
|
||
}
|
||
|
||
ERRLOG5(g_Log, "UID:%10u / ServerGroupID:%d / CID:%10u / Store:%s / Character:%s / â<><C3A2>, ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ε<EFBFBD> <20><><EFBFBD><EFBFBD>.",
|
||
m_dwUID, m_cOldServerGroupID, dwCID,
|
||
g_szDBDataErrorString[eStoreDataError],
|
||
g_szDBDataErrorString[eCharacterDataError]);
|
||
|
||
return false;
|
||
}
|
||
|
||
m_dwCID = dwCID;
|
||
return true;
|
||
}
|
||
|
||
void CSessionData::UnloadData()
|
||
{
|
||
if(0 != m_lpStoreData)
|
||
{
|
||
CStoreDataMgr::GetInstance().UnloadData(*this, m_lpStoreData);
|
||
m_lpStoreData = 0;
|
||
}
|
||
|
||
if(0 != m_lpCharacterData)
|
||
{
|
||
CCharacterDataMgr::GetInstance().UnloadData(*this, m_lpCharacterData);
|
||
m_lpCharacterData = 0;
|
||
}
|
||
|
||
m_dwCID = 0;
|
||
}
|
||
|
||
bool CSessionData::CharEnable(unsigned long dwCID, unsigned long dwServerID)
|
||
{
|
||
if (SE_USER_ENABLED != m_eSessionState && SE_CHAR_ENABLED != m_eSessionState)
|
||
{
|
||
if(LoadData(dwCID))
|
||
{
|
||
// <20>̵<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ
|
||
UpdateMoveZone();
|
||
|
||
// edith 2008.12.4 <20>α<EFBFBD><CEB1><EFBFBD> Ÿ<>Ӱ<EFBFBD><D3B0>ű<EFBFBD><C5B1><EFBFBD> <20>߰<EFBFBD>
|
||
// ij<><C4B3><EFBFBD>Ͱ<EFBFBD> Enable <20><> <20><><EFBFBD>¸<EFBFBD> <20><><EFBFBD>缭<EFBFBD><E7BCAD><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1>ε<EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD>.
|
||
CTime timeLogin = CTime::GetCurrentTime();
|
||
TIME* pLoginTime = m_lpCharacterData->GetLoginTime();
|
||
if(pLoginTime)
|
||
{
|
||
pLoginTime->Year = timeLogin.GetYear();
|
||
pLoginTime->Month = timeLogin.GetMonth();
|
||
pLoginTime->Day = timeLogin.GetDay();
|
||
pLoginTime->Hour = timeLogin.GetHour();
|
||
pLoginTime->Minute = timeLogin.GetMinute();
|
||
pLoginTime->Second = timeLogin.GetSecond();
|
||
}
|
||
|
||
// <20><>Ÿ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>Լ<EFBFBD> ȣ<><C8A3> <20>ʿ<EFBFBD>)
|
||
m_dwServerID = dwServerID;
|
||
m_lpCharacterData->SetServerID(dwServerID);
|
||
|
||
// ij<><C4B3><EFBFBD><EFBFBD> Ȱ<><C8B0>ȭ
|
||
SetSessionState(SE_CHAR_ENABLED);
|
||
LogCharData("ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ȱ<><C8B0>ȭ");
|
||
|
||
GET_MULTI_DISPATCH(lpGameDispatch, dwServerID,
|
||
CGameDispatch, CGameDispatch::GetDispatchTable());
|
||
|
||
if(0 != lpGameDispatch)
|
||
{
|
||
lpGameDispatch->IncCharNum(m_lpCharacterData->GetRace());
|
||
}
|
||
|
||
return true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
SERLOG4(g_Log, "UID:%10u / CID:%10u / ServerID:0x%08X / ST:%s / ij<><C4B3><EFBFBD><EFBFBD> Ȱ<><C8B0>ȭ <20>õ<EFBFBD> <20><><EFBFBD><EFBFBD> : "
|
||
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>°<EFBFBD> <20>̻<EFBFBD><CCBB>մϴ<D5B4>.", m_dwUID, dwCID, dwServerID, g_szSessionStateString[m_eSessionState]);
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
bool CSessionData::CharDisable(unsigned long dwCID, unsigned long dwServerID)
|
||
{
|
||
if (SE_CHAR_ENABLED == m_eSessionState)
|
||
{
|
||
if (m_dwCID != dwCID || m_dwServerID != dwServerID)
|
||
{
|
||
SERLOG5(g_Log, "UID:%10u / CID:%10u / ServerID:0x%08X / DisableCID:%10u / DisableServerID:0x%08X / "
|
||
"ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ȱ<EFBFBD><C8B0>ȭ <20><><EFBFBD><EFBFBD> : <20>ٸ<EFBFBD> ij<><C4B3><EFBFBD>ͷ<EFBFBD>, Ȥ<><C8A4> <20>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ȱ<EFBFBD><C8B0>ȭ <20>õ<EFBFBD>",
|
||
m_dwUID, m_dwCID, m_dwServerID, dwCID, dwServerID);
|
||
}
|
||
else
|
||
{
|
||
int nRace = (0 != m_lpCharacterData) ? m_lpCharacterData->GetRace() : -1;
|
||
|
||
// ij<><C4B3><EFBFBD><EFBFBD> <20><>Ȱ<EFBFBD><C8B0>ȭ <20><><EFBFBD><EFBFBD>
|
||
SendPacket::UpdateUIDTable(PktUUT::UpdateUIDTableCharLogout,
|
||
m_szAccount, NULL, m_dwUID, m_dwCID, m_dwSessionID, m_dwServerID, m_RemoteAddress);
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ݳ<EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҿ<EFBFBD><D2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȴ<EFBFBD>.
|
||
UnloadData();
|
||
|
||
// ij<><C4B3><EFBFBD><EFBFBD> <20><>Ȱ<EFBFBD><C8B0>ȭ (<28>Լ<EFBFBD> ȣ<><C8A3> <20>Ŀ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>)
|
||
SetSessionState(SE_CHAR_DISABLED);
|
||
|
||
GET_MULTI_DISPATCH(lpGameDispatch, dwServerID,
|
||
CGameDispatch, CGameDispatch::GetDispatchTable());
|
||
|
||
if(0 != lpGameDispatch)
|
||
{
|
||
lpGameDispatch->DecCharNum(nRace);
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>! <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0<><30><EFBFBD><EFBFBD> Ŭ<><C5AC><EFBFBD><EFBFBD>!
|
||
m_dwCID = 0;
|
||
m_dwServerID = 0;
|
||
m_cNewZone = 0;
|
||
GetBilling().ClearBilling();
|
||
return true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
LogCharDataError("ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ȱ<EFBFBD><C8B0>ȭ <20>õ<EFBFBD> <20><><EFBFBD><EFBFBD>", LOG_FFL);
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
bool CSessionData::CharMove(unsigned long dwCID, unsigned long dwServerID)
|
||
{
|
||
if (SE_CHAR_ENABLED == m_eSessionState)
|
||
{
|
||
if (m_dwCID != dwCID || m_dwServerID != dwServerID)
|
||
{
|
||
SERLOG5(g_Log, "UID:%10u / CID:%10u / ServerID:0x%08X / DisableCID:%10u / DisableServerID:0x%08X / "
|
||
"ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̵<EFBFBD> <20><><EFBFBD><EFBFBD> : <20>ٸ<EFBFBD> ij<><C4B3><EFBFBD>ͷ<EFBFBD>, Ȥ<><C8A4> <20>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ȱ<EFBFBD><C8B0>ȭ <20>õ<EFBFBD>",
|
||
m_dwUID, m_dwCID, m_dwServerID, dwCID, dwServerID);
|
||
}
|
||
else
|
||
{
|
||
int nRace = (0 != m_lpCharacterData) ? m_lpCharacterData->GetRace() : -1;
|
||
|
||
// ij<><C4B3><EFBFBD><EFBFBD> <20>̵<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
SendPacket::UpdateUIDTable(PktUUT::UpdateUIDTableCharLogout,
|
||
m_szAccount, NULL, m_dwUID, m_dwCID, m_dwSessionID, m_dwServerID, m_RemoteAddress);
|
||
|
||
LogCharData("ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̵<EFBFBD>");
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ݳ<EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҿ<EFBFBD><D2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȴ<EFBFBD>.
|
||
UnloadData();
|
||
|
||
// ij<><C4B3><EFBFBD><EFBFBD> <20>̵<EFBFBD>(<28>Լ<EFBFBD> ȣ<><C8A3> <20>ڿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
SetSessionState(SE_MOVE);
|
||
|
||
GET_MULTI_DISPATCH(lpGameDispatch, dwServerID,
|
||
CGameDispatch, CGameDispatch::GetDispatchTable());
|
||
|
||
if(0 != lpGameDispatch)
|
||
{
|
||
lpGameDispatch->DecCharNum(nRace);
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>! <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0<><30><EFBFBD><EFBFBD> Ŭ<><C5AC><EFBFBD><EFBFBD>!
|
||
m_dwCID = 0;
|
||
m_dwServerID = 0;
|
||
GetBilling().ClearBilling();
|
||
return true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
LogCharDataError("ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̵<EFBFBD> <20>õ<EFBFBD> <20><><EFBFBD><EFBFBD>", LOG_FFL);
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// <20><> <20>̵<EFBFBD> <20><><EFBFBD><EFBFBD> <20>κ<EFBFBD>
|
||
|
||
// <20><> <20>̵<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
bool CSessionData::SetMoveZone(unsigned char cZone, const POS& Pos)
|
||
{
|
||
if (!CheckCharZone(cZone))
|
||
{
|
||
return false;
|
||
}
|
||
|
||
m_cNewZone = cZone;
|
||
m_NewPos = Pos;
|
||
|
||
return true;
|
||
}
|
||
|
||
// <20><> <20>̵<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ
|
||
void CSessionData::UpdateMoveZone()
|
||
{
|
||
if (0 != m_cNewZone && 0 != m_lpCharacterData)
|
||
{
|
||
CHAR_POS charPos;
|
||
|
||
charPos.LastPoint = m_NewPos;
|
||
charPos.SavePoint = m_NewPos;
|
||
|
||
m_lpCharacterData->SetPos(charPos);
|
||
}
|
||
|
||
m_cNewZone = 0;
|
||
}
|
||
|
||
// ij<><C4B3><EFBFBD><EFBFBD> <20><> üũ
|
||
bool CSessionData::CheckCharZone(unsigned char cZone)
|
||
{
|
||
if(this->m_cAdminLevel)
|
||
{
|
||
return true;
|
||
}
|
||
|
||
bool bResult = false;
|
||
|
||
// edith 2009.07.30 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||
int nRace = (0 != m_lpCharacterData) ? m_lpCharacterData->GetRace() : -1;
|
||
if(nRace == CClass::HUMAN)
|
||
{
|
||
if(cZone == SERVER_ID::ZONE2 || cZone == SERVER_ID::ZONE5)
|
||
return false;
|
||
}
|
||
else if(nRace == CClass::AKHAN)
|
||
{
|
||
if(cZone == SERVER_ID::ZONE1 || cZone == SERVER_ID::ZONE4)
|
||
return false;
|
||
}
|
||
|
||
if (cZone == SERVER_ID::ZONE1 || cZone == SERVER_ID::ZONE2 || cZone == SERVER_ID::ZONE4 || cZone == SERVER_ID::ZONE5)
|
||
{
|
||
// <20><>Ʈ1<C6AE><31><EFBFBD><EFBFBD> 2<><32> <20>߰<EFBFBD><DFB0><EFBFBD> <20>⺻<EFBFBD><E2BABB><EFBFBD><EFBFBD>
|
||
bResult = true;
|
||
}
|
||
else if (cZone == SERVER_ID::CAPITAL || cZone == SERVER_ID::ZONE12 || cZone == SERVER_ID::PRISON)
|
||
{
|
||
// <20><>Ʈ2<C6AE><32><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
bResult = true;
|
||
}
|
||
else if (cZone == SERVER_ID::STONE_WAR1 || cZone == SERVER_ID::STONE_WAR2 || cZone == SERVER_ID::STONE_WAR3)
|
||
{
|
||
// <20><>ũī<C5A9><C4AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
if (true == CServerSetup::GetInstance().UseContents(GameRYL::STONE_BATTLE))
|
||
{
|
||
bResult = true;
|
||
}
|
||
}
|
||
else if (cZone == SERVER_ID::ZONE9)
|
||
bResult = true;
|
||
|
||
|
||
/*
|
||
else if (cZone == SERVER_ID::ZONE9)
|
||
{
|
||
// <20>ű<EFBFBD><C5B1><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
if (true == CServerSetup::GetInstance().UseContents(GameRYL::NEWZONE_ZONE9))
|
||
{
|
||
bResult = true;
|
||
}
|
||
}
|
||
*/
|
||
return bResult;
|
||
}
|
||
|
||
// edith 2008.02.28 ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>
|
||
unsigned char CSessionData::GetCharStartZone(char cRace)
|
||
{
|
||
if(cRace == CHAR_CREATE::HUMAN)
|
||
return SERVER_ID::ZONE1;
|
||
|
||
// else if(cRace == CHAR_CREATE::AKHAN)
|
||
return SERVER_ID::ZONE2;
|
||
|
||
// return SERVER_ID::ZONE12;
|
||
}
|
||
|
||
void CSessionData::LogUserData(const char* szMessage)
|
||
{
|
||
RULLOG5(g_Log, "UID:%10u / ServerID:0x%08X / ST:%s / IP:%15s / %s",
|
||
m_dwUID, m_dwServerID, g_szSessionStateString[m_eSessionState],
|
||
inet_ntoa(m_RemoteAddress), szMessage);
|
||
}
|
||
|
||
void CSessionData::LogCharData(const char* szMessage)
|
||
{
|
||
if(0 != m_lpCharacterData)
|
||
{
|
||
RULLOG9(g_Log, "UID:%10u / CID:%10u / ServerID:0x%08X / ST:%s / "
|
||
"IP:%15s / DataCID:%10u / Name:%-16s / Lev:%3d / %s",
|
||
m_dwUID, m_dwCID, m_dwServerID, g_szSessionStateString[m_eSessionState],
|
||
inet_ntoa(m_RemoteAddress), m_lpCharacterData->GetCID(),
|
||
m_lpCharacterData->GetName(), m_lpCharacterData->GetInfo().Level, szMessage);
|
||
}
|
||
else
|
||
{
|
||
LogUserData(szMessage);
|
||
}
|
||
}
|
||
|
||
void CSessionData::LogUserDataError(const char* szMessage, const char* szRoutine,
|
||
const char* szFile, int nLine)
|
||
{
|
||
g_Log.DetailLog(LOG_ERROR, szRoutine, szFile, nLine,
|
||
"UID:%10u / ServerID:0x%08X / ST:%s / IP:%15s / %s",
|
||
m_dwUID, m_dwServerID, g_szSessionStateString[m_eSessionState],
|
||
inet_ntoa(m_RemoteAddress), szMessage);
|
||
}
|
||
|
||
void CSessionData::LogCharDataError(const char* szMessage, const char* szRoutine,
|
||
const char* szFile, int nLine)
|
||
{
|
||
if(0 != m_lpCharacterData)
|
||
{
|
||
g_Log.DetailLog(LOG_ERROR, szRoutine, szFile, nLine,
|
||
"UID:%10u / CID:%10u / ServerID:0x%08X / ST:%s / "
|
||
"IP:%15s / DataCID:%10u / Name:%-16s / Lev:%3d / %s",
|
||
m_dwUID, m_dwCID, m_dwServerID, g_szSessionStateString[m_eSessionState],
|
||
inet_ntoa(m_RemoteAddress), m_lpCharacterData->GetCID(),
|
||
m_lpCharacterData->GetName(), m_lpCharacterData->GetInfo().Level, szMessage);
|
||
}
|
||
else
|
||
{
|
||
LogUserDataError(szMessage, szRoutine, szFile, nLine);
|
||
}
|
||
}
|
||
|
||
//! <20><>û ť <20><><EFBFBD><EFBFBD> (dwRequestKey<65><79> 0<≯<EFBFBD> <20><><EFBFBD><EFBFBD>)
|
||
void CSessionData::PushRequest(const RequestData& reqData)
|
||
{
|
||
m_RequestQueue.push_back(reqData);
|
||
}
|
||
|
||
RequestData CSessionData::PopRequest()
|
||
{
|
||
RequestData data;
|
||
|
||
if(m_RequestQueue.empty())
|
||
{
|
||
data.m_dwRequestKey = 0;
|
||
data.m_dwServerID = 0;
|
||
data.m_dwSelectedCID = 0;
|
||
}
|
||
else
|
||
{
|
||
data = m_RequestQueue.front();
|
||
m_RequestQueue.pop_front();
|
||
}
|
||
|
||
return data;
|
||
}
|
||
|
||
const UnifiedCharData* CSessionData::GetUnifiedCharData(unsigned long dwCID) const
|
||
{
|
||
const UnifiedCharData* lpPos = m_UnifiedCharData;
|
||
const UnifiedCharData* lpEnd = m_UnifiedCharData + m_nUnifiedCharDataNum;
|
||
|
||
for(; lpPos != lpEnd; ++lpPos)
|
||
{
|
||
if (lpPos->dwNewCID == dwCID)
|
||
{
|
||
return lpPos;
|
||
}
|
||
}
|
||
|
||
return 0;
|
||
}
|
||
|
||
bool CSessionData::HasUnifiedStoreInfo(unsigned char cOldServerGroupID)
|
||
{
|
||
const UnifiedStoreInfo* lpPos = m_UnifiedStoreInfo;
|
||
const UnifiedStoreInfo* lpEnd = m_UnifiedStoreInfo + m_nUnifiedStoreInfoNum;
|
||
|
||
for(; lpPos != lpEnd; ++lpPos)
|
||
{
|
||
if(lpPos->cOldServerGroupID == cOldServerGroupID)
|
||
{
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
bool CSessionData::ChangeUnifiedStoreInfoGroup(CDBComponent& DBComponent,
|
||
unsigned char cOldServerGroupID,
|
||
unsigned char cNewServerGroupID)
|
||
{
|
||
CStoreDataMgr& storeDataMgr = CStoreDataMgr::GetInstance();
|
||
UnifiedStoreKey storeKey(m_dwUID, cOldServerGroupID);
|
||
|
||
if (HasUnifiedStoreInfo(cOldServerGroupID) &&
|
||
!storeDataMgr.IsDataLoginDB(storeKey) &&
|
||
!storeDataMgr.IsDataLogoutDB(storeKey))
|
||
{
|
||
// â<><C3A2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> â<><C3A2><EFBFBD>̰<EFBFBD>, ij<><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ִ°<D6B4><C2B0><EFBFBD>
|
||
// Ȯ<><C8AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||
|
||
// cOldServerGroupID<49><44> â<><C3A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cChangedServerGroupID<49><44> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||
// cOldServerGroupID<49><44> â<><C3A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL<4C><4C> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||
if(!DBComponent::GameDB::ChangeUnifiedItemStoreGroup(
|
||
DBComponent, storeKey.first, cOldServerGroupID, cNewServerGroupID))
|
||
{
|
||
// â<><C3A2> <20><EFBFBD> <20><>ȣ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
ERRLOG2(g_Log, "UID:%10u / SelectedServerGroupID:%d / <20><><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : â<><C3A2> <20><EFBFBD> <20><>ȣ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||
storeKey.first, cOldServerGroupID);
|
||
}
|
||
else
|
||
{
|
||
// 3. <20><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD> UnifiedStoreInfo<66><6F> <20><><EFBFBD>缭 <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||
UnifiedStoreInfo* lpPos = m_UnifiedStoreInfo;
|
||
UnifiedStoreInfo* lpEnd = m_UnifiedStoreInfo + m_nUnifiedStoreInfoNum;
|
||
|
||
for(; lpPos != lpEnd; ++lpPos)
|
||
{
|
||
if (lpPos->cOldServerGroupID == cOldServerGroupID)
|
||
{
|
||
lpPos->cOldServerGroupID = cNewServerGroupID;
|
||
break;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ERRLOG2(g_Log, "UID:%10u / SelectedServerGroupID:%d / <20><><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20>߸<EFBFBD><DFB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||
storeKey.first, storeKey.second);
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
bool CSessionData::ChangeUnifiedCharServerGroupID(CDBComponent& DBComponent, unsigned long dwUID,
|
||
unsigned long dwCID, unsigned char cOldServerGroupID)
|
||
{
|
||
if (0 != GetUnifiedCharData(dwCID))
|
||
{
|
||
if (!DBComponent::GameDB::UpdateUnifiedCharServerGroupID(
|
||
DBComponent, dwUID, dwCID, cOldServerGroupID))
|
||
{
|
||
// <20><><EFBFBD><EFBFBD> <20>α<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
ERRLOG3(g_Log, "UID:%10u / CID:%10u / ServerGroupID:%d / <20><><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ID<49><44><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||
dwUID, dwCID, cOldServerGroupID);
|
||
}
|
||
else
|
||
{
|
||
UnifiedCharData* lpPos = m_UnifiedCharData;
|
||
UnifiedCharData* lpEnd = m_UnifiedCharData + m_nUnifiedCharDataNum;
|
||
|
||
for(; lpPos != lpEnd; ++lpPos)
|
||
{
|
||
if (lpPos->dwNewCID == dwCID)
|
||
{
|
||
// <20><EFBFBD><DEB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||
lpPos->cOldServerGroupID = cOldServerGroupID;
|
||
break;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ERRLOG3(g_Log, "UID:%10u / CID:%10u / ServerGroupID:%d / <20><><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20>߸<EFBFBD><DFB8><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||
dwUID, dwCID, cOldServerGroupID);
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
|
||
bool CSessionData::DelUnifiedCharData(unsigned long dwCID)
|
||
{
|
||
UnifiedCharData* lpPos = m_UnifiedCharData;
|
||
UnifiedCharData* lpEnd = m_UnifiedCharData + m_nUnifiedCharDataNum;
|
||
|
||
for(; lpPos != lpEnd; ++lpPos)
|
||
{
|
||
if (lpPos->dwNewCID == dwCID)
|
||
{
|
||
memmove(lpPos, lpPos + 1, lpEnd - lpPos - 1);
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
bool CSessionData::UpdateCharacterBinding(CDBComponent& DBComponent,
|
||
unsigned long dwSelectedCID[USER_INFO::MAX_CHAR_NUM])
|
||
{
|
||
// UserInfo<66><6F> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||
USER_INFO userInfo = m_UserInfo;
|
||
|
||
unsigned char cSelectedCount = 0;
|
||
|
||
for(int nCount = 0; nCount < USER_INFO::MAX_CHAR_NUM; ++nCount)
|
||
{
|
||
if(0 == userInfo.CharID[nCount] && 0 != dwSelectedCID[nCount])
|
||
{
|
||
userInfo.CharID[nCount] = dwSelectedCID[nCount];
|
||
++cSelectedCount;
|
||
}
|
||
}
|
||
|
||
// UserInfo<66><6F> DB<44><42> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD>Ѵ<EFBFBD>.
|
||
if (0 != memcmp(&m_UserInfo, &userInfo, sizeof(USER_INFO)))
|
||
{
|
||
if (!DBComponent::GameDB::UpdateUser(DBComponent, m_dwUID, &userInfo))
|
||
{
|
||
// DB<44><42><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>!
|
||
return false;
|
||
}
|
||
else
|
||
{
|
||
m_UserInfo = userInfo;
|
||
}
|
||
}
|
||
|
||
// ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ȸ<><C8B8><EFBFBD><EFBFBD> DB<44><42> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||
m_cTransferedCharCount += cSelectedCount;
|
||
UpdateTransferedCharCount(DBComponent);
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20>並 <20>ٽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD>.
|
||
bool bGetViewResult = true;
|
||
|
||
for (int nCount = 0; nCount < USER_INFO::MAX_CHAR_NUM; ++nCount)
|
||
{
|
||
if (0 != m_UserInfo.CharID[nCount] &&
|
||
!DBComponent::GameDB::GetCharView(DBComponent, m_UserInfo.CharID[nCount], &m_CharView[nCount]))
|
||
{
|
||
SERLOG5(g_Log, "UID:%10u / ServerGroupID:%d / CID:%10u / Slot:%d / ij<><C4B3><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : %s",
|
||
m_dwUID, m_cOldServerGroupID, m_UserInfo.CharID[nCount], nCount, DBComponent.GetErrorString());
|
||
|
||
bGetViewResult = false;
|
||
}
|
||
}
|
||
|
||
if(bGetViewResult)
|
||
{
|
||
INFLOG2(g_Log, "UID:%10u / ServerGroupID:%d / <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||
m_dwUID, m_cOldServerGroupID);
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
CClass::RaceType CSessionData::CheckUnifiedCharRace(unsigned long dwSelectedCID[USER_INFO::MAX_CHAR_NUM])
|
||
{
|
||
CClass::RaceType eLastRace = CClass::MAX_RACE;
|
||
CClass::RaceType eCharRace = CClass::MAX_RACE;
|
||
|
||
unsigned long dwCheckCID[USER_INFO::MAX_CHAR_NUM];
|
||
memset(dwCheckCID, 0, sizeof(unsigned long) * USER_INFO::MAX_CHAR_NUM);
|
||
|
||
for(int nCount = 0; nCount < USER_INFO::MAX_CHAR_NUM; ++nCount)
|
||
{
|
||
if(0 != m_UserInfo.CharID[nCount])
|
||
{
|
||
dwCheckCID[nCount] = m_UserInfo.CharID[nCount];
|
||
}
|
||
else if(0 != dwSelectedCID[nCount])
|
||
{
|
||
dwCheckCID[nCount] = dwSelectedCID[nCount];
|
||
}
|
||
}
|
||
|
||
for(int nCount = 0; nCount < USER_INFO::MAX_CHAR_NUM; ++nCount)
|
||
{
|
||
if(0 != dwCheckCID[nCount])
|
||
{
|
||
UnifiedCharData* lpPos = m_UnifiedCharData;
|
||
UnifiedCharData* lpEnd = m_UnifiedCharData + m_nUnifiedCharDataNum;
|
||
|
||
for(; lpPos != lpEnd; ++lpPos)
|
||
{
|
||
if (lpPos->dwNewCID == dwCheckCID[nCount])
|
||
{
|
||
eCharRace = CClass::GetRace(static_cast<unsigned char>(lpPos->sClass));
|
||
|
||
if(eLastRace == CClass::MAX_RACE)
|
||
{
|
||
eLastRace = eCharRace;
|
||
}
|
||
else if(eLastRace != eCharRace)
|
||
{
|
||
// ij<><C4B3><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٸ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȵȴ<C8B5>.
|
||
return CClass::MAX_RACE;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
return eLastRace;
|
||
}
|
||
|
||
|
||
unsigned char CSessionData::GetTransferedCharCount(CDBComponent& DBComponent)
|
||
{
|
||
if (UCHAR_MAX == m_cTransferedCharCount)
|
||
{
|
||
OleDB::PARAM_INFO paramInfo;
|
||
memset(¶mInfo, 0, sizeof(OleDB::PARAM_INFO));
|
||
|
||
paramInfo.ColNum = 1;
|
||
paramInfo.eParamIO[0] = DBPARAMIO_INPUT;
|
||
paramInfo.ColType[0] = DBTYPE_I4;
|
||
paramInfo.ColSize[0] = sizeof(unsigned long);
|
||
|
||
// DB<44><42><EFBFBD><EFBFBD> <20>ε<EFBFBD>
|
||
if (!DBComponent.ExecuteQueryWithParams(
|
||
"SELECT TransferCharCount FROM UserFirstLoginInfo WHERE UID=?",
|
||
reinterpret_cast<char*>(&m_dwUID), paramInfo))
|
||
{
|
||
ERRLOG2(g_Log, "UID:%10u / ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ȸ<><C8B8> <20>ε<EFBFBD> <20><><EFBFBD><EFBFBD> : DB<44><42><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : %s",
|
||
m_dwUID, DBComponent.GetErrorString());
|
||
}
|
||
else if (!DBComponent.GetData(&m_cTransferedCharCount))
|
||
{
|
||
ERRLOG2(g_Log, "UID:%10u / ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ȸ<><C8B8> <20>ε<EFBFBD> <20><><EFBFBD><EFBFBD> : DB GetData <20><><EFBFBD><EFBFBD> : %s",
|
||
m_dwUID, DBComponent.GetErrorString());
|
||
}
|
||
}
|
||
|
||
return m_cTransferedCharCount;
|
||
}
|
||
|
||
bool CSessionData::UpdateTransferedCharCount(CDBComponent& DBComponent)
|
||
{
|
||
// DB<44><42> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||
OleDB::PARAM_INFO paramInfo;
|
||
memset(¶mInfo, 0, sizeof(OleDB::PARAM_INFO));
|
||
|
||
paramInfo.ColNum = 2;
|
||
paramInfo.eParamIO[0] = DBPARAMIO_INPUT;
|
||
paramInfo.ColType[0] = DBTYPE_UI1;
|
||
paramInfo.ColSize[0] = sizeof(unsigned char);
|
||
|
||
paramInfo.eParamIO[1] = DBPARAMIO_INPUT;
|
||
paramInfo.ColType[1] = DBTYPE_I4;
|
||
paramInfo.ColSize[1] = sizeof(unsigned long);
|
||
|
||
#pragma pack(1)
|
||
|
||
struct UpdateTransferCharCountParam
|
||
{
|
||
unsigned char m_cTransferedCharCount;
|
||
unsigned long m_dwUID;
|
||
};
|
||
|
||
#pragma pack()
|
||
|
||
UpdateTransferCharCountParam paramData;
|
||
|
||
paramData.m_cTransferedCharCount = m_cTransferedCharCount;
|
||
paramData.m_dwUID = m_dwUID;
|
||
|
||
// DB<44><42><EFBFBD><EFBFBD> <20>ε<EFBFBD>
|
||
if (!DBComponent.ExecuteQueryWithParams(
|
||
"UPDATE UserFirstLoginInfo SET TransferCharCount=? WHERE UID=?",
|
||
reinterpret_cast<char*>(¶mData), paramInfo))
|
||
{
|
||
ERRLOG2(g_Log, "UID:%10u / ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ȸ<><C8B8> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD> : DB<44><42><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : %s",
|
||
m_dwUID, DBComponent.GetErrorString());
|
||
|
||
return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
|
||
bool CSessionData::GetRealmPointCheck()
|
||
{
|
||
DBAgent::DataStorage::CCharacterData* lpCharacterData = GetCharacterData();
|
||
|
||
// <20><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD> ij<><C4B3><EFBFBD>Ͱ<EFBFBD> <20>αƿ<D7BE> <20>ɶ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD>.
|
||
|
||
if(lpCharacterData)
|
||
{
|
||
unsigned char cRealmPoint = lpCharacterData->GetRealmPoint();
|
||
|
||
// <20><><EFBFBD><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̰<EFBFBD>.
|
||
if(CGameTimeDBMgr::GetInstance().GetCurrentGameTime(GameTime::REALM)==GameTime::RT_REALM_WAR
|
||
|| CGameTimeDBMgr::GetInstance().GetCurrentGameTime(GameTime::REALM)==GameTime::RT_REALM_WAR_END_5)
|
||
{
|
||
// ij<><C4B3><EFBFBD>Ϳ<EFBFBD> <20>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ӽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||
if(!lpCharacterData->GetRealmCheckPoint())
|
||
{
|
||
// 1<><31><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>ش<EFBFBD>. <20><><EFBFBD>⼭ AddRealmPoint<6E><74> <20>ش<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// <20>α<EFBFBD><CEB1><EFBFBD><EFBFBD><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/2<><32> <20>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߸<EFBFBD> <20>ش<EFBFBD>.
|
||
/*
|
||
// edith 2010.01.10 <20>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20>ִ<EFBFBD> <20>κ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
// <20>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ŵư<C5B5>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ְ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD>.
|
||
RealmPoint::AddRealmPoint(this, 1);
|
||
*/
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD> <20><>ũ<EFBFBD><C5A9>.
|
||
// <20>̷<EFBFBD><CCB7><EFBFBD><EFBFBD><EFBFBD> AddRealmPoint <20>Լ<EFBFBD><D4BC><EFBFBD> ȣ<><C8A3><EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD><EFBFBD> 1<>̰<EFBFBD> <20>αƿ<D7BE><C6BF><EFBFBD> ȣ<><C8A3><EFBFBD>ؼ<EFBFBD>
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> 2<≯<EFBFBD> <20>ٷ<EFBFBD> <20>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD> <20>ʰ<EFBFBD>
|
||
// <20><><EFBFBD><EFBFBD>üũ <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> 1<><31><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>༭ <20><><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1>ν<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ְ<EFBFBD> <20>ϱ<EFBFBD> <20><><EFBFBD>ѷ<EFBFBD><D1B7><EFBFBD>
|
||
// <20><> <20>αƿ<D7BE><C6BF><EFBFBD> AddRealmPoint <20>Լ<EFBFBD><D4BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD> <20><>Ȳ<EFBFBD>̳<EFBFBD> <20>ƴϳĸ<CFB3> <20>˻<EFBFBD>
|
||
// <20>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>Լ<EFBFBD><D4BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||
if(cRealmPoint<lpCharacterData->GetRealmPoint())
|
||
{
|
||
lpCharacterData->SetRealmCheckPoint(1);
|
||
lpCharacterData->SetRealmPoint(cRealmPoint);
|
||
lpCharacterData->SetRealmMinute(0);
|
||
}
|
||
else
|
||
{
|
||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD>ų<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD>Ȱ<EFBFBD> <20><><EFBFBD><EFBFBD>.
|
||
// <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>.
|
||
// edith 2008.12.4 <20>α<EFBFBD><CEB1><EFBFBD> Ÿ<><C5B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3>
|
||
TIME* pTime = lpCharacterData->GetLoginTime();
|
||
// TIME* pTime = lpCharacterData->GetLogoutTime();
|
||
|
||
if(pTime)
|
||
{
|
||
CTime timeCurrent = CTime::GetCurrentTime();
|
||
|
||
CTime timeLogin(pTime->Year, pTime->Month, pTime->Day, pTime->Hour, pTime->Minute, pTime->Second, pTime->MSecond);
|
||
|
||
CTimeSpan ts = timeCurrent - timeLogin;
|
||
|
||
unsigned char cMinute = lpCharacterData->GetRealmMinute();
|
||
|
||
lpCharacterData->SetRealmMinute((unsigned char)(ts.GetTotalMinutes()+cMinute));
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// edith 2010.01.02 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD> <20>Լ<EFBFBD>.
|
||
unsigned int GID = lpCharacterData->GetGID();
|
||
Guild::CGuildDB* lpGuild = static_cast<Guild::CGuildDB*>(
|
||
Guild::CGuildDBMgr::GetInstance().GetGuild( GID ));
|
||
|
||
if(lpGuild)
|
||
{
|
||
unsigned char MaxNum = lpGuild->GetMaxMemberNum();
|
||
unsigned char CurNum = lpGuild->GetCurrentMemberNum();
|
||
lpCharacterData->SetRealmPoint(MaxNum/10);
|
||
}
|
||
else
|
||
lpCharacterData->SetRealmPoint(0);
|
||
|
||
|
||
CTime timeLogin = CTime::GetCurrentTime();
|
||
|
||
TIME* pLoggoutTime = lpCharacterData->GetLogoutTime();
|
||
|
||
if(pLoggoutTime)
|
||
{
|
||
pLoggoutTime->Year = timeLogin.GetYear();
|
||
pLoggoutTime->Month = timeLogin.GetMonth();
|
||
pLoggoutTime->Day = timeLogin.GetDay();
|
||
pLoggoutTime->Hour = timeLogin.GetHour();
|
||
pLoggoutTime->Minute = timeLogin.GetMinute();
|
||
pLoggoutTime->Second = timeLogin.GetSecond();
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
|
||
|
||
}
|
||
} |