169 lines
5.6 KiB
C++
169 lines
5.6 KiB
C++
|
|
#include "StdAfx.h"
|
|||
|
|
#include "gachapon_test.h"
|
|||
|
|
#include "DnCommonDef.h"
|
|||
|
|
|
|||
|
|
DNTableFileFormat* gachapon_test::s_pItemTable = NULL;
|
|||
|
|
DNTableFileFormat* gachapon_test::s_pGachaTable = NULL;
|
|||
|
|
DNTableFileFormat* gachapon_test::s_pItemDropTable = NULL;
|
|||
|
|
DNTableFileFormat* gachapon_test::s_pPartsTable = NULL;
|
|||
|
|
|
|||
|
|
#define ITEM_T gachapon_test::s_pItemTable
|
|||
|
|
#define GACHA_T gachapon_test::s_pGachaTable
|
|||
|
|
#define ITEMDROP_T gachapon_test::s_pItemDropTable
|
|||
|
|
#define PARTS_T gachapon_test::s_pPartsTable
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20><><EFBFBD>ǵǾ<C7B5><C7BE>ִ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
const int NUM_GACHA_PARTS = 6;
|
|||
|
|
|
|||
|
|
|
|||
|
|
gachapon_test::gachapon_test(void)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
gachapon_test::~gachapon_test(void)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void gachapon_test::SetUpTestCase( void )
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>켱<EFBFBD><ECBCB1><EFBFBD><EFBFBD> <20>˻<EFBFBD><CBBB>ϰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>⺻ <20><><EFBFBD>ҽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ã<>´<EFBFBD>.
|
|||
|
|
// ItemTable_Quest, ItemTable_Event, ItemTable_Equipment, ItemTable_Cash <20>ø<EFBFBD><C3B8><EFBFBD><EEBAB0> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ƽ<EFBFBD> <20>ε<EFBFBD> <20><>.
|
|||
|
|
s_pItemTable = LoadExtFile( "ItemTable.dnt" );
|
|||
|
|
s_pGachaTable = LoadExtFile( "GachaJP.dnt", "_GachaNum" );
|
|||
|
|
s_pItemDropTable = LoadExtFile( "ItemDropTable.dnt" );
|
|||
|
|
// PartsTable_Event, PartsTable_Equipment, PartsTable_Cash <20>ø<EFBFBD><C3B8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ƽ<EFBFBD> <20>ε<EFBFBD> <20><>.
|
|||
|
|
s_pPartsTable = LoadExtFile( "PartsTable.dnt" );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void gachapon_test::TearDownTestCase( void )
|
|||
|
|
{
|
|||
|
|
SAFE_DELETE( s_pItemTable );
|
|||
|
|
SAFE_DELETE( s_pGachaTable );
|
|||
|
|
SAFE_DELETE( s_pItemDropTable );
|
|||
|
|
SAFE_DELETE( s_pPartsTable );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void gachapon_test::SetUp( void )
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void gachapon_test::TearDown( void )
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
TEST_F( gachapon_test, GACHAPON_RESULT_ITEM_MATCH_JOB )
|
|||
|
|
{
|
|||
|
|
// <20>Ϻ<EFBFBD><CFBA><EFBFBD> <20>븸<EFBFBD><EBB8B8> <20><><EFBFBD>쿡<EFBFBD><ECBFA1> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
if( false == ( g_strNation == _T("JPN") || g_strNation == _T("TWN") ) )
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
char acBuffer[ 256 ] = { 0 };
|
|||
|
|
|
|||
|
|
// <20><>í<EFBFBD><C3AD> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><> <20><><EFBFBD>̵<EFBFBD><CCB5><EFBFBD> <20><> <20>ƿ´<C6BF>.
|
|||
|
|
vector<int> vlShopIDs;
|
|||
|
|
set<int> setShopIDs;
|
|||
|
|
for( int i = 0; i < GACHA_T->GetItemCount(); ++i )
|
|||
|
|
{
|
|||
|
|
int iItemID = GACHA_T->GetItemID( i );
|
|||
|
|
vlShopIDs.push_back( GACHA_T->GetFieldFromLablePtr( iItemID, "_GachaNum" )->GetInteger() );
|
|||
|
|
setShopIDs.insert( vlShopIDs.back() );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
TCHAR atcBuf[ 256 ] = { 0 };
|
|||
|
|
{
|
|||
|
|
_stprintf_s( atcBuf, _T("{GachaShopID:%d, Note:<3A><>í<EFBFBD><C3AD> <20><> <20><><EFBFBD>̵<EFBFBD><CCB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4<><34><EFBFBD><EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD> <20>մϴ<D5B4>.}"), vlShopIDs.front() );
|
|||
|
|
SCOPED_TRACE( atcBuf );
|
|||
|
|
EXPECT_TRUE( (vlShopIDs.size() % 4) == 0 );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
set<int>::iterator iter = setShopIDs.begin();
|
|||
|
|
for( iter; iter != setShopIDs.end(); ++iter )
|
|||
|
|
{
|
|||
|
|
int iShopID = *iter;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><EFBFBD> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><DBB5><EFBFBD> <20><><EFBFBD>Ƶд<C6B5>.
|
|||
|
|
vector<int> vlGachaTableIDs;
|
|||
|
|
GACHA_T->GetItemIDListFromField( "_GachaNum", iShopID, vlGachaTableIDs );
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20><>í<EFBFBD><C3AD> <20><>ȣ <20>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD><EFBFBD> <20>ݵ<EFBFBD><DDB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ʒ<EFBFBD><C6B7><EFBFBD> <20><><EFBFBD><EFBFBD> Ŭ<><C5AC><EFBFBD><EFBFBD> <20><><EFBFBD>̵<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20>ԷµǾ<C2B5><C7BE><EFBFBD> <20>մϴ<D5B4>!!
|
|||
|
|
int iNumTableIDs = (int)vlGachaTableIDs.size();
|
|||
|
|
for( int iTableID = 0; iTableID < iNumTableIDs; ++iTableID )
|
|||
|
|
{
|
|||
|
|
int iGachaTableID = vlGachaTableIDs.at( iTableID );
|
|||
|
|
int iNeedJobClassID = iTableID+1;
|
|||
|
|
for( int iPart = 0; iPart < NUM_GACHA_PARTS; ++iPart )
|
|||
|
|
{
|
|||
|
|
sprintf_s( acBuffer, "_LinkedDrop%d", iPart+1 );
|
|||
|
|
int iLinkedDropTableID = GACHA_T->GetFieldFromLablePtr( iGachaTableID, acBuffer )->GetInteger();
|
|||
|
|
if( 0 == iLinkedDropTableID || 1 == iLinkedDropTableID ) // <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̺<EFBFBD> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> ã<><C3A3><EFBFBD><EFBFBD> 1<><31> <20><><EFBFBD><EFBFBD>...(??)
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
// TODO: <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̺<EFBFBD> <20><><EFBFBD>Ͱ<EFBFBD><CDB0><EFBFBD> 8<>ܰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.. <20><><EFBFBD>Ŀ<EFBFBD> <20>ʿ<EFBFBD><CABF>ϸ<EFBFBD> ó<><C3B3><EFBFBD>ؾ<EFBFBD> <20><>û<EFBFBD><C3BB> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
|
|||
|
|
vector<int> vlToCalcDropTableIDs;
|
|||
|
|
vlToCalcDropTableIDs.push_back( iLinkedDropTableID );
|
|||
|
|
|
|||
|
|
for( int i = 0; i < (int)vlToCalcDropTableIDs.size(); ++i )
|
|||
|
|
{
|
|||
|
|
int iDropTableID = vlToCalcDropTableIDs.at( i );
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20><EFBFBD><D7B8><EFBFBD> 20<32><30>
|
|||
|
|
for( int iLabel = 0; iLabel <= 20; ++iLabel )
|
|||
|
|
{
|
|||
|
|
sprintf_s( acBuffer, "_IsGroup%d", iLabel );
|
|||
|
|
int iIsGroup = ITEMDROP_T->GetFieldFromLablePtr( iDropTableID, acBuffer )->GetInteger();
|
|||
|
|
if( iIsGroup == 1 )
|
|||
|
|
{
|
|||
|
|
sprintf_s( acBuffer, "_Item%dIndex", iLabel );
|
|||
|
|
int iReferenceDropTableID = ITEMDROP_T->GetFieldFromLablePtr( iDropTableID, acBuffer )->GetInteger();
|
|||
|
|
|
|||
|
|
if( 0 == iReferenceDropTableID )
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
vlToCalcDropTableIDs.push_back( iReferenceDropTableID );
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
sprintf_s( acBuffer, "_Item%dIndex", iLabel );
|
|||
|
|
int iItemTableID = ITEMDROP_T->GetFieldFromLablePtr( iDropTableID, acBuffer )->GetInteger();
|
|||
|
|
|
|||
|
|
if( 0 == iItemTableID )
|
|||
|
|
continue;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD> <20>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>´<EFBFBD>.
|
|||
|
|
// 0<><30> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̱ <20>н<EFBFBD><D0BD>ϰ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>õǰ<C3B5> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>´°<C2B4> Ȯ<><C8AE><EFBFBD>Ѵ<EFBFBD>.
|
|||
|
|
int iItemNeedJobClassID = 0;
|
|||
|
|
string strNeedJobClassID = ITEM_T->GetFieldFromLablePtr( iItemTableID, "_NeedJobClass" )->GetString();
|
|||
|
|
{
|
|||
|
|
SecureZeroMemory( atcBuf, sizeof(atcBuf) );
|
|||
|
|
_stprintf_s( atcBuf, _T("{ItemTableID:%d, Note:<3A><>í<EFBFBD><C3AD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڵ尡 <20>ϳ<EFBFBD><CFB3><EFBFBD> <20>־<EFBFBD><D6BE><EFBFBD> <20>մϴ<D5B4>.}"), iItemTableID );
|
|||
|
|
SCOPED_TRACE( atcBuf );
|
|||
|
|
EXPECT_TRUE( string::npos == strNeedJobClassID.find_first_of( ';' ) || strNeedJobClassID == "0" );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
iItemNeedJobClassID = atoi( strNeedJobClassID.c_str() );
|
|||
|
|
|
|||
|
|
if( 0 != iItemNeedJobClassID )
|
|||
|
|
{
|
|||
|
|
SecureZeroMemory( atcBuf, sizeof(atcBuf) );
|
|||
|
|
_stprintf_s( atcBuf, _T("{GachaTableID:%d, GachaTableJobID:%d, ItemTableID:%d, ItemTableJobID:%d, Note:<3A><>í<EFBFBD><C3AD> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ȣ<EFBFBD><C8A3> <20><><EFBFBD><EFBFBD> <20>ʽ<EFBFBD><CABD>ϴ<EFBFBD>.}"),
|
|||
|
|
iGachaTableID, iNeedJobClassID, iItemTableID, iItemNeedJobClassID );
|
|||
|
|
SCOPED_TRACE( atcBuf );
|
|||
|
|
EXPECT_TRUE( iNeedJobClassID == iItemNeedJobClassID );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ÿ<><C5B8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Ÿ<><EFBFBD> <20>¾ƾ<C2BE> <20><>.
|
|||
|
|
int iPartIndexInTable = PARTS_T->GetFieldFromLablePtr( iItemTableID, "_Parts" )->GetInteger();
|
|||
|
|
EXPECT_TRUE( iPartIndexInTable == iPart );
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|