#include "QuestDetailForm.h"
using namespace ObjDataEdit;

//######################################################################################################
//主要需要繼承的涵式
ReaderClass< DB_GameObjDbStruct >* QuestDetailForm::ObjReader( )
{
	return GameObjDbStructEx::ObjReader_QuestDetail( );
}
//-----------------------------------------------------------------------------------------------------------------
int QuestDetailForm::GetStringID( const char* pSource, const char* pKey )
{
	if( pSource == NULL || pKey == NULL )
		return 0;

	int iSourceLen	= strlen( pSource );
	int iKeyLen		= strlen( pKey );
	int iValueLen	= iSourceLen - iKeyLen;

	char szValue[1024];

	ZeroMemory( szValue, sizeof( szValue ));
	memcpy( szValue, pSource + iKeyLen, iValueLen );

	int iVal		= atoi( szValue );

	return iVal;
}
//-----------------------------------------------------------------------------------------------------------------
void    QuestDetailForm::OnActive()
{
    static bool FirstTime = true;

    //設定種族職業資訊
    if( FirstTime  == false )
        return;

	

	FirstTime = false;

	BaseForm::OnActive();

	Reload_AttrTable();

    AddItemFromDataBase();


	SqlDataReader* myReader;

	// 讀取資料並放入資料庫介面中
	
	// 任務分類

		map< int, std::string >	mapQuestDir;


		sqlCommand_Base->CommandText = "Select KeyStr, content from StringDB Where KeyStr LIKE 'QUEST_DIR_%' ORDER BY KeyStr";
		myReader = sqlCommand_Base->ExecuteReader();
		comboBox1->Items->Clear();
		while( myReader->Read() )
		{                
			std::string sKey			=	DotNetStr::StringToChar( myReader->GetString( 0 ) );
			std::string sContent		=	DotNetStr::StringToChar( myReader->GetString( 1 ) );

			int		iID			=	GetStringID( sKey.c_str(), "QUEST_DIR_" );
			mapQuestDir[ iID ]	=	sContent;
			//comboBox1->Items->Add( Str );
		}
		myReader->Close();

		for( map< int, std::string >::iterator it = mapQuestDir.begin(); it != mapQuestDir.end(); it++ )
		{
			String*		sContent		= new String( (it->second).c_str() );
			comboBox1->Items->Add( sContent );
		}
	
	// 任務類型
		sqlCommand_Base->CommandText = "Select content from StringDB Where KeyStr LIKE 'QUEST_TYPE_%' ORDER BY KeyStr";
		myReader = sqlCommand_Base->ExecuteReader();
		comboBox2->Items->Clear();
		while( myReader->Read() )
		{                
			//int     Value =  myReader->GetInt32( 0 );
			String* Str   =  myReader->GetString( 0 );

			comboBox2->Items->Add( Str );
		}
		myReader->Close();

	// 需求物品前置字串
		for( int i=0; i<10; i++ )
		{
			char szControlName[64];
			sprintf( szControlName, "iRequest_ItemStr%d", (i+1) );

			System::Windows::Forms::ComboBox* pComboBox = static_cast<ComboBox*> ( BaseForm::GetEditByTagName( this , szControlName  ) );

			sqlCommand_Base->CommandText = "Select content from StringDB Where KeyStr LIKE 'Q_REQUEST_ITEMSTR_%' ORDER BY KeyStr";
			myReader = sqlCommand_Base->ExecuteReader();
			pComboBox->Items->Clear();
			while( myReader->Read() )
			{                
				//int     Value =  myReader->GetInt32( 0 );
				String* Str   =  myReader->GetString( 0 );
				pComboBox->Items->Add( Str );
			}
			myReader->Close();
		}

	// 打倒目標前置字串
		for( int i=0; i<5; i++ )
		{
			char szControlName[64];
			sprintf( szControlName, "iRequest_KillStr%d", (i+1) );

			System::Windows::Forms::ComboBox* pComboBox = static_cast<ComboBox*> ( BaseForm::GetEditByTagName( this , szControlName  ) );

			sqlCommand_Base->CommandText = "Select content from StringDB Where KeyStr LIKE 'Q_REQUEST_KILLSTR_%' ORDER BY KeyStr";
			myReader = sqlCommand_Base->ExecuteReader();
			pComboBox->Items->Clear();
			while( myReader->Read() )
			{                
				//int     Value =  myReader->GetInt32( 0 );
				String* Str   =  myReader->GetString( 0 );
				pComboBox->Items->Add( Str );
			}
			myReader->Close();
		}

	// 群組限制字串
		sqlCommand_Base->CommandText = "Select content from StringDB Where KeyStr LIKE 'Q_GROUPNAME_%' ORDER BY KeyStr";
		myReader = sqlCommand_Base->ExecuteReader();
		comboBox9->Items->Clear();
		while( myReader->Read() )
		{                
			String* Str   =  myReader->GetString( 0 );
			comboBox9->Items->Add( Str );
		}
		myReader->Close();
	
	// 聲望群組
		sqlCommand_Base->CommandText = "Select content from StringDB Where KeyStr LIKE 'REP_NAME_%' ORDER BY KeyStr";
		myReader = sqlCommand_Base->ExecuteReader();
		CB_REPGROUP1->Items->Clear();
		CB_REPGROUP2->Items->Clear();
		CB_REPLIMIT->Items->Clear();
		while( myReader->Read() )
		{                
			String* Str   =  myReader->GetString( 0 );
			CB_REPGROUP1->Items->Add( Str );
			CB_REPGROUP2->Items->Add( Str );
			CB_REPLIMIT->Items->Add( Str );
		}
		myReader->Close();


		CB_RewardCoinType->Items->Clear();
		// 幣值設定
		sqlCommand_Base->CommandText = "Select Note from Table_SysKeyValue Where KeyStr LIKE 'SYS_PRICETYPE_ICONID_%' ORDER BY KeyStr";
		myReader= sqlCommand_Base->ExecuteReader();

		while( myReader->Read() )		
		{
			String* Str = myReader->GetString( 0 );
			CB_RewardCoinType->Items->Add( Str );
		}
		myReader->Close();

		CB_RequestCoinType->Items->Clear();
		// 幣值設定
		sqlCommand_Base->CommandText = "Select Note from Table_SysKeyValue Where KeyStr LIKE 'SYS_PRICETYPE_ICONID_%' ORDER BY KeyStr";
		myReader= sqlCommand_Base->ExecuteReader();

		while( myReader->Read() )		
		{
			String* Str = myReader->GetString( 0 );
			CB_RequestCoinType->Items->Add( Str );
		}
		myReader->Close();








}
void    QuestDetailForm::OnSelectObj( bool LockOk )
{
    _ObjDB.GameData.Classification = EM_ObjectClass_QuestDetail;
    //panel1->Enabled = LockOk;
}
//輸出時額外設定
void    QuestDetailForm::OnOutputObjSetting( DB_GameObjDbStruct* TempObj )
{
    TempObj->GameData.Classification = EM_ObjectClass_QuestDetail;

	ZeroMemory( TempObj->GameData.QuestDetail.iQuestProvider, sizeof( TempObj->GameData.QuestDetail.iQuestProvider ) );

	// 設定連結關希
	map< int, set< int > >::iterator it = _mapQuestProviderLink->find( TempObj->GameData.GUID );
	if( it != _mapQuestProviderLink->end() )
	{
		int iCount = 0;
		for( set< int >::iterator itQuestNPCID = it->second.begin(); itQuestNPCID != it->second.end(); itQuestNPCID++ )
		{
			if( iCount < 5 )
			{
				TempObj->GameData.QuestDetail.iQuestProvider[ iCount ] = *itQuestNPCID;
				iCount++;
			}
		}
	}
}

void    QuestDetailForm::OnTimeProc()
{
	if( _IsValueChange == false )
		return;

	_IsValueChange = false;

	DB_GameObjDbStruct __pin * TempObj = &_ObjDB;
	
	int iLV		= TempObj->GameData.QuestDetail.iCheck_LV;
	int iExp	= TempObj->GameData.QuestDetail.iReward_Exp;
	int iTP		= TempObj->GameData.QuestDetail.iReward_TP;
	int iMoney	= TempObj->GameData.QuestDetail.iReward_Money;


	if( iExp == 25 && iMoney == 25 )
		CB_RewardDifficult->SelectedIndex = 1;
	else
	if( iExp == 50 && iMoney == 50 )
		CB_RewardDifficult->SelectedIndex = 2;
	else
	if( iExp == 75 && iMoney == 75 )
		CB_RewardDifficult->SelectedIndex = 3;
	else
	if( iExp == 100 && iMoney == 100 )
		CB_RewardDifficult->SelectedIndex = 4;
	else
	if( iExp == 150 && iMoney == 150 )
		CB_RewardDifficult->SelectedIndex = 5;
	else
	if( iExp == 200 && iMoney == 200 )
		CB_RewardDifficult->SelectedIndex = 6;
	else
		CB_RewardDifficult->SelectedIndex = 0;

	//LB_MONEY
	//LB_EXP
	int iCalEXP		= 0;
	int iCalMoney	= 0;
	int iCalTP		= 0;

	if( RoleDataEx::PlotExpTable.size() > (unsigned)(iLV - 1) )
		iCalEXP		= (float) RoleDataEx::PlotExpTable[ ( iLV - 1 ) ] * ( (float)iExp / 100 );

	if( RoleDataEx::PlotMoneyTable.size() > (unsigned)(iLV - 1) )
		iCalMoney	= (float) RoleDataEx::PlotMoneyTable[ ( iLV - 1 ) ] * ( (float)iMoney / 100 );

	iCalTP			= iCalEXP * ( (float)iTP / 100 );
	//int iCalEXP		= 100;
	//int iCalMoney		= 100;


	char Buf[256];

	sprintf( Buf , "%d" , iCalEXP );	
	LB_EXP->Text			= Buf;

	sprintf( Buf , "%d" , iCalMoney );	
	LB_MONEY->Text			= Buf;

	sprintf( Buf , "%d" , iCalTP );	
	LB_TP->Text			= Buf;


	// 顯示提式
	LB_ClickItem1->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[0], false );
	LB_ClickItem2->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[1], false );
	LB_ClickItem3->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[2], false );
	LB_ClickItem4->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[3], false );
	LB_ClickItem5->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[4], false );
	LB_ClickItem6->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[5], false );
	LB_ClickItem7->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[6], false );
	LB_ClickItem8->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[7], false );
	LB_ClickItem9->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[8], false );
	LB_ClickItem10->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[9], false );

	LB_ClickToGet1->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_GetItem[0], false );
	LB_ClickToGet2->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_GetItem[1], false );
	LB_ClickToGet3->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_GetItem[2], false );
	LB_ClickToGet4->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_GetItem[3], false );
	LB_ClickToGet5->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_GetItem[4], false );
	LB_ClickToGet6->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_GetItem[5], false );
	LB_ClickToGet7->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_GetItem[6], false );
	LB_ClickToGet8->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_GetItem[7], false );
	LB_ClickToGet9->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_GetItem[8], false );
	LB_ClickToGet10->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_GetItem[9], false );

	LB_KillObj1->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[0], false );
	LB_KillObj2->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[1], false );
	LB_KillObj3->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[2], false );
	LB_KillObj4->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[3], false );
	LB_KillObj5->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[4], false );
	LB_KillObj6->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[5], false );
	LB_KillObj7->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[6], false );
	LB_KillObj8->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[7], false );
	LB_KillObj9->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[8], false );
	LB_KillObj10->Text		= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[9], false );

	LB_KillObjToGet1->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_GetItem[0], false );
	LB_KillObjToGet2->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_GetItem[1], false );
	LB_KillObjToGet3->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_GetItem[2], false );
	LB_KillObjToGet4->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_GetItem[3], false );
	LB_KillObjToGet5->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_GetItem[4], false );
	LB_KillObjToGet6->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_GetItem[5], false );
	LB_KillObjToGet7->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_GetItem[6], false );
	LB_KillObjToGet8->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_GetItem[7], false );
	LB_KillObjToGet9->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_GetItem[8], false );
	LB_KillObjToGet10->Text	= SearchObjName( TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_GetItem[9], false );
	
	LB_RequestItem1->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_ItemID[0], false );
	LB_RequestItem2->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_ItemID[1], false );
	LB_RequestItem3->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_ItemID[2], false );
	LB_RequestItem4->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_ItemID[3], false );
	LB_RequestItem5->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_ItemID[4], false );
	LB_RequestItem6->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_ItemID[5], false );
	LB_RequestItem7->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_ItemID[6], false );
	LB_RequestItem8->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_ItemID[7], false );
	LB_RequestItem9->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_ItemID[8], false );
	LB_RequestItem10->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_ItemID[9], false );

	LB_RequestKill1->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_KillID[0], false );
	LB_RequestKill2->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_KillID[1], false );
	LB_RequestKill3->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_KillID[2], false );
	LB_RequestKill4->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_KillID[3], false );
	LB_RequestKill5->Text		= SearchObjName( TempObj->GameData.QuestDetail.iRequest_KillID[4], false );

	LB_Reward1->Text			= SearchObjName( TempObj->GameData.QuestDetail.iReward_ItemID[0], false );
	LB_Reward2->Text			= SearchObjName( TempObj->GameData.QuestDetail.iReward_ItemID[1], false );
	LB_Reward3->Text			= SearchObjName( TempObj->GameData.QuestDetail.iReward_ItemID[2], false );
	LB_Reward4->Text			= SearchObjName( TempObj->GameData.QuestDetail.iReward_ItemID[3], false );
	LB_Reward5->Text			= SearchObjName( TempObj->GameData.QuestDetail.iReward_ItemID[4], false );

	LB_RewardChoice1->Text		= SearchObjName( TempObj->GameData.QuestDetail.iReward_ChoiceID[0], false );
	LB_RewardChoice2->Text		= SearchObjName( TempObj->GameData.QuestDetail.iReward_ChoiceID[1], false );
	LB_RewardChoice3->Text		= SearchObjName( TempObj->GameData.QuestDetail.iReward_ChoiceID[2], false );
	LB_RewardChoice4->Text		= SearchObjName( TempObj->GameData.QuestDetail.iReward_ChoiceID[3], false );
	LB_RewardChoice5->Text		= SearchObjName( TempObj->GameData.QuestDetail.iReward_ChoiceID[4], false );

	LB_Check1->Text				= SearchObjName( TempObj->GameData.QuestDetail.iCheck_ObjID[0], false );
	LB_Check2->Text				= SearchObjName( TempObj->GameData.QuestDetail.iCheck_ObjID[1], false );
	LB_Check3->Text				= SearchObjName( TempObj->GameData.QuestDetail.iCheck_ObjID[2], false );
	LB_Check4->Text				= SearchObjName( TempObj->GameData.QuestDetail.iCheck_ObjID[3], false );
	LB_Check5->Text				= SearchObjName( TempObj->GameData.QuestDetail.iCheck_ObjID[4], false );

	LB_Accept1->Text			= SearchObjName( TempObj->GameData.QuestDetail.iAccept_ItemID[0], false );
	LB_Accept2->Text			= SearchObjName( TempObj->GameData.QuestDetail.iAccept_ItemID[1], false );
	LB_Accept3->Text			= SearchObjName( TempObj->GameData.QuestDetail.iAccept_ItemID[2], false );
	LB_Accept4->Text			= SearchObjName( TempObj->GameData.QuestDetail.iAccept_ItemID[3], false );
	LB_Accept5->Text			= SearchObjName( TempObj->GameData.QuestDetail.iAccept_ItemID[4], false );


	// 有開重覆解任務才能設定群組及時間回報限制
	//----------------------------------------------
		if( comboBox3->SelectedIndex == 0 )
		{
			comboBox8->Enabled = false;
			comboBox9->Enabled = false;
		}
		else
		{
			comboBox8->Enabled		= true;
			comboBox9->Enabled		= true;
		}

	// 有開限定聲望才能設定聲望值
	//----------------------------------------------
		if( CB_REPLIMIT->SelectedIndex == 0 )
		{
			textBox5->Enabled = false;
		}
		else
		{
			textBox5->Enabled = true;
		}

	// 有開限定聲望才能設定聲望值
	//----------------------------------------------
		if( CB_REPGROUP1->SelectedIndex == 0 )
		{
			textBox125->Enabled = false;
		}
		else
		{
			textBox125->Enabled	= true;
		}

		if( CB_REPGROUP2->SelectedIndex == 0 )
		{
			textBox94->Enabled = false;
		}
		else
		{
			textBox94->Enabled = true;
		}

	// 特定每日任務群組才有等級限制
		if( comboBox9->SelectedIndex == 1 )
		{
			label31->Visible = true;
			textBox95->Visible = true;
		}
		else
		{
			label31->Visible	= false;
			textBox95->Visible	= false;
			if( TempObj->GameData.QuestDetail.iQuestGroupLV != 0 )
			{
				TempObj->GameData.QuestDetail.iQuestGroupLV = 0;
				textBox95->Text		= "0";
			}
			
		}
}

void    QuestDetailForm::OnValueChange()
{
	_IsValueChange = true;
    //PrintQuestInfo();	
}
//######################################################################################################
//--------------------------------------------------------------------------------------------
void QuestDetailForm::AddItemFromDataBase()
{
    SqlDataReader* myReader = NULL;

    // Quest 條件 職業檢查 [ comboBox_Check_Class1 ] [ comboBox_Check_Class2 ]
    //------------------------------------------------------------------------

    sqlCommand_Base->CommandText = "Select GUID , Name from FightArg where Type = 1";
    myReader = sqlCommand_Base->ExecuteReader();

    System::Object* AddItem[] = new System::Object*[1];
    AddItem[0] = S"待選";
    comboBox_Check_Class1->Items->AddRange( AddItem );
    comboBox_Check_Class2->Items->AddRange( AddItem );

    while( myReader->Read())
    {
        String* Str =  myReader->GetString( 1 ) ;
        System::Object* AddItem[] = new System::Object*[1];
        AddItem[0] = Str;
        comboBox_Check_Class1->Items->AddRange( AddItem );
        comboBox_Check_Class2->Items->AddRange( AddItem );
    }

    myReader->Close();



}

//--------------------------------------------------------------------------------------------

void QuestDetailForm::PrintQuestInfo()
{
	/*
    char szTemp[1024];
    char szQuest[2048];
    bool bSetting = false;

    DB_GameObjDbStruct __pin * pObjDB = &_ObjDB;

    ZeroMemory( szQuest, sizeof( szQuest ) );

    // Quest Name
    sprintf( szTemp, "%s\r\n\r\n", pObjDB->GameData.Name );
    strcat( szQuest, szTemp );

    // Quest Desc		
    strcat( szQuest, "Descption:\r\n" );
    sprintf( szTemp, "%s\r\n\r\n", pObjDB->GameData.QuestDetail.szQuest_Desc );
    strcat( szQuest, szTemp );


    textBox_QuestInfo->Text = szQuest;
    ZeroMemory( szQuest, sizeof( szQuest ) );


    // Quest 接受條件
    //-------------------------------------------------------------------------------------------------------------------------------------------------
    ZeroMemory( szTemp, sizeof( szTemp ) );	
    sprintf( szTemp, "%s接受任務條件:\r\n--------------------------------------------------\r\n", szTemp );
    bSetting = false;
	*/

    // 等級檢查
	/*
    if( pObjDB->GameData.QuestDetail.iCheck_BaseLV != 0 )
    {
        int iMinLV = pObjDB->GameData.QuestDetail.iCheck_BaseLV - pObjDB->GameData.QuestDetail.iCheck_RangeLV;
        int iMaxLV = pObjDB->GameData.QuestDetail.iCheck_BaseLV + pObjDB->GameData.QuestDetail.iCheck_RangeLV;
        sprintf( szTemp, "%s  限定等級: %d 至 %d\r\n", szTemp,  iMinLV, iMaxLV );
        bSetting = true;
    }
	*/
/*
    // 職業檢查
    if( pObjDB->GameData.QuestDetail.iCheck_Class_Type != 0 )
    {
        //__gc* pText = comboBox_Check_Class1->Text;
        switch( pObjDB->GameData.QuestDetail.iCheck_Class_Type ) 
        {
        case 1:
            sprintf( szTemp, "%s  限定主職: %d\r\n", szTemp,  pObjDB->GameData.QuestDetail.iCheck_Class1 );
            break;
        case 2:
            sprintf( szTemp, "%s  限定副職: %d\r\n", szTemp, pObjDB->GameData.QuestDetail.iCheck_Class1 );
            break;
        }

        bSetting = true;
    }

    // 性別
    if( pObjDB->GameData.QuestDetail.iCheck_Sex != 0 )
    {
        if( pObjDB->GameData.QuestDetail.iCheck_Sex == 1 )
            strcat( szTemp, "  限定性別: 男\r\n" );

        if( pObjDB->GameData.QuestDetail.iCheck_Sex == 2 )
            strcat( szTemp, "  限定性別: 女\r\n" );
        bSetting = true;
    }

    // Title
    if(  pObjDB->GameData.QuestDetail.iCheck_Title != 0 )
    {


    }

    // Flag
    if( pObjDB->GameData.QuestDetail.iCheck_Flag[0] != 0 )
    {
        bSetting = true;

        sprintf( szTemp, "%s  需要FLAG: %d" , szTemp , pObjDB->GameData.QuestDetail.iCheck_Flag[0] ); 
        if( pObjDB->GameData.QuestDetail.iCheck_Flag[1] != 0 )
            sprintf( szTemp, "%s %d", szTemp, pObjDB->GameData.QuestDetail.iCheck_Flag[1] );

        if( pObjDB->GameData.QuestDetail.iCheck_Flag[2] != 0 )
            sprintf( szTemp, "%s %d", szTemp, pObjDB->GameData.QuestDetail.iCheck_Flag[2] );

        sprintf( szTemp, "%s\r\n" ,szTemp );
    }

    // 時間
    if( pObjDB->GameData.QuestDetail.iCheck_Time != 0 )
    {
        bSetting = true;
        sprintf( szTemp, "%s  開啟接受任務時間: %d\r\n", szTemp ,  pObjDB->GameData.QuestDetail.iCheck_Time ); 
    }

    // 名聲
    if( pObjDB->GameData.QuestDetail.iCheck_Rep != 0 )
    {
        bSetting = true;
        sprintf( szTemp, "%s  須要名聲: %d\r\n",szTemp,  pObjDB->GameData.QuestDetail.iCheck_Rep ); 
    }

    sprintf( szTemp, "%s\r\n", szTemp );

    if( bSetting == true )
    {
        strcat( szQuest, szTemp );
    }

    // Quest 接受任務後給予物品或狀態
    //-------------------------------------------------------------------------------------------------------------------------------------------------
    ZeroMemory( szTemp, sizeof( szTemp ) );
    sprintf( szTemp, "\r\n接受任務後給予物品或狀態:\r\n--------------------------------------------------\r\n" );
    bSetting = false;


    // 給予物品
    if( pObjDB->GameData.QuestDetail.iAccept_ItemID[0] != 0 )
    {
        sprintf( szTemp, "%s  給予物品: %d - %d", szTemp, pObjDB->GameData.QuestDetail.iAccept_ItemID[0], pObjDB->GameData.QuestDetail.iAccept_ItemVal[0] );
        for( int i=1; i<=4; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iAccept_ItemID[i] != 0 )
                sprintf( szTemp, "%s, %d - %d", szTemp, pObjDB->GameData.QuestDetail.iAccept_ItemID[i], pObjDB->GameData.QuestDetail.iAccept_ItemVal[i] );
            else
                break;
        }
        sprintf( szTemp, "%s\r\n", szTemp );
        bSetting = true;
    }

    // 打開Flag
    if( pObjDB->GameData.QuestDetail.iAccept_FlagOn[0] != 0 )
    {
        sprintf( szTemp, "%s  打開Flag: %d", szTemp, pObjDB->GameData.QuestDetail.iAccept_FlagOn[0] );
        for( int i=1; i<=2; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iAccept_FlagOn[i] != 0 )
                sprintf( szTemp, "%s, %d", szTemp, pObjDB->GameData.QuestDetail.iAccept_FlagOn[i] );
            else
                break;
        }
        sprintf( szTemp, "%s\r\n", szTemp );
        bSetting = true;
    }

    // 關掉Flag
    if( pObjDB->GameData.QuestDetail.iAccept_FlagOff[0] != 0 )
    {
        sprintf( szTemp, "%s  關掉Flag: %d", szTemp, pObjDB->GameData.QuestDetail.iAccept_FlagOff[0] );
        for( int i=1; i<=2; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iAccept_FlagOff[i] != 0 )
                sprintf( szTemp, "%s, %d", szTemp, pObjDB->GameData.QuestDetail.iAccept_FlagOff[i] );
            else
                break;
        }
        sprintf( szTemp, "%s\r\n", szTemp );
        bSetting = true;
    }

    if( bSetting == true )
    {
        strcat( szQuest, szTemp );
    }

    // Quest 接任務後所會產生的狀態
    //-------------------------------------------------------------------------------------------------------------------------------------------------
    ZeroMemory( szTemp, sizeof( szTemp ) );
    sprintf( szTemp, "\r\n接任務後所會產生的狀態:\r\n--------------------------------------------------\r\n" );
    bool bAfterAcceptProcSetting = false;


    // 點擊物件
    if( pObjDB->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[0] )
    {
        for( int i=0; i<=4; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[i] != 0 )
            {
                sprintf		( szTemp, "%s  點擊物件[ %d ], 會有:[ %0.2f ]% 機會, 取得物件[ %d ], [ %d ]個\r\n", szTemp,
                    pObjDB->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[i],
                    pObjDB->GameData.QuestDetail.iProcess_ClickToGetItem_ProcPercent[i],
                    pObjDB->GameData.QuestDetail.iProcess_ClickToGetItem_GetItem[i],
                    pObjDB->GameData.QuestDetail.iProcess_ClickToGetItem_GetItemVal[i]
                    );
            }
            else
                break;
        }

        bAfterAcceptProcSetting = true;
    }

    // 打倒物件
    if( pObjDB->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[0] )
    {
        for( int i=0; i<=4; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[i] != 0 )
            {
                sprintf		( szTemp, "%s  殺死物件[ %d ], 會有:[ %0.2f ]% 機會, 取得物件[ %d ], [ %d ]個\r\n", szTemp,
                    pObjDB->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[i],
                    pObjDB->GameData.QuestDetail.iProcess_KilltoGetItem_ProcPercent[i],
                    pObjDB->GameData.QuestDetail.iProcess_KilltoGetItem_GetItem[i],
                    pObjDB->GameData.QuestDetail.iProcess_KilltoGetItem_GetItemVal[i]
                    );
            }
            else
                break;
        }

        bAfterAcceptProcSetting = true;
    }

    if( bAfterAcceptProcSetting == true )
    {
        strcat( szQuest, szTemp );
    }

    // Quest 完成任務的條件
    //-------------------------------------------------------------------------------------------------------------------------------------------------
    ZeroMemory( szTemp, sizeof( szTemp ) );
    sprintf( szTemp, "\r\n完成任務的條件:\r\n--------------------------------------------------\r\n" );
    bSetting = false;


    // 需要物品
    if( pObjDB->GameData.QuestDetail.iRequest_ItemID[0] != 0 )
    {
        sprintf( szTemp, "%s  需要物品: %d - %d", szTemp, pObjDB->GameData.QuestDetail.iRequest_ItemID[0], pObjDB->GameData.QuestDetail.iRequest_ItemVal[0] );
        for( int i=1; i<=4; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iRequest_ItemID[i] != 0 )
                sprintf( szTemp, "%s, %d - %d", szTemp, pObjDB->GameData.QuestDetail.iRequest_ItemID[i], pObjDB->GameData.QuestDetail.iRequest_ItemVal[i] );
            else
                break;
        }
        sprintf( szTemp, "%s\r\n", szTemp );
        bSetting = true;
    }

    // 需要打倒
    if( pObjDB->GameData.QuestDetail.iRequest_KillID[0] != 0 )
    {
        sprintf( szTemp, "%s  打倒目標: %d - %d", szTemp, pObjDB->GameData.QuestDetail.iRequest_KillID[0], pObjDB->GameData.QuestDetail.iRequest_KillVal[0] );
        for( int i=1; i<=4; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iRequest_ItemID[i] != 0 )
                sprintf( szTemp, "%s, %d - %d", szTemp, pObjDB->GameData.QuestDetail.iRequest_KillID[i], pObjDB->GameData.QuestDetail.iRequest_KillVal[i] );
            else
                break;
        }
        sprintf( szTemp, "%s\r\n", szTemp );
        bSetting = true;
    }

    // 需要金錢
    if( pObjDB->GameData.QuestDetail.iRequest_Money != 0 )
    {
        sprintf( szTemp, "%s  需要金錢: %d\r\n",szTemp, pObjDB->GameData.QuestDetail.iRequest_Money );
        bSetting = true;
    }

    // 限定時間
    if( pObjDB->GameData.QuestDetail.iRequest_Timer != 0 )
    {
        sprintf( szTemp, "%s  限定時間: %d\r\n",szTemp, pObjDB->GameData.QuestDetail.iRequest_Timer );
        bSetting = true;
    }

    if( bSetting == true )
    {
        strcat( szQuest, szTemp );
    }

    // 完成任務後, 所接收的獎賞
    //--------------------------------------------------------------------------------------------------------------
    ZeroMemory( szTemp, sizeof( szTemp ) );
    sprintf( szTemp, "\r\n完成任務後, 所接收的獎賞:\r\n--------------------------------------------------\r\n" );		
    bSetting = false;

    // 獎勵物品
    if( pObjDB->GameData.QuestDetail.iReward_ItemID[0] != 0 )
    {
        sprintf( szTemp, "%s  獎勵物品: %d %d", szTemp, pObjDB->GameData.QuestDetail.iReward_ItemID[0], pObjDB->GameData.QuestDetail.iReward_ItemVal[0] );
        for( int i=1; i<=4; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iReward_ItemID[i] != 0 )
                sprintf( szTemp, "%s, %d %d", szTemp, pObjDB->GameData.QuestDetail.iReward_ItemID[i], pObjDB->GameData.QuestDetail.iReward_ItemVal[i] );
            else
                break;
        }
        sprintf( szTemp, "%s\r\n", szTemp );
        bSetting = true;
    }

    // 選則物品
    if( pObjDB->GameData.QuestDetail.iReward_ChoiceID[0] != 0 )
    {
        sprintf( szTemp, "%s  從中選一個物品: %d - %d", szTemp, pObjDB->GameData.QuestDetail.iReward_ChoiceID[0], pObjDB->GameData.QuestDetail.iReward_ChoiceVal[0] );
        for( int i=1; i<=4; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iReward_ChoiceID[i] != 0 )
                sprintf( szTemp, "%s, %d - %d", szTemp, pObjDB->GameData.QuestDetail.iReward_ChoiceID[i], pObjDB->GameData.QuestDetail.iReward_ChoiceVal[i] );
            else
                break;
        }
        sprintf( szTemp, "%s\r\n", szTemp );
        bSetting = true;
    }

    // 給予技能
    if( pObjDB->GameData.QuestDetail.iReward_Spell[0] != 0 )
    {
        sprintf( szTemp, "%s  獎勵技能: %d" , szTemp, pObjDB->GameData.QuestDetail.iReward_Spell[0] );
        for( int i=1; i<=4; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iReward_Spell[i] != 0 )
                sprintf( szTemp, "%s, %d", szTemp, pObjDB->GameData.QuestDetail.iReward_Spell[i] );
            else
                break;
        }
        sprintf( szTemp, "%s\r\n", szTemp );
        bSetting = true;
    }

    // 獎勵金錢
    if( pObjDB->GameData.QuestDetail.iReward_Money != 0 )
    {
        sprintf( szTemp, "%s  獎勵金錢: %d\r\n",szTemp, pObjDB->GameData.QuestDetail.iReward_Money );
        bSetting = true;
    }

    // 獎勵EXP
    if( pObjDB->GameData.QuestDetail.iReward_Exp != 0 )
    {
        sprintf( szTemp, "%s  獎勵EXP: %d\r\n",szTemp, pObjDB->GameData.QuestDetail.iReward_Exp );
        bSetting = true;
    }

    // 獎勵名聲
    if( pObjDB->GameData.QuestDetail.iReward_Rep != 0 )
    {
        sprintf( szTemp, "%s  獎勵名聲: %d\r\n",szTemp, pObjDB->GameData.QuestDetail.iReward_Rep );
        bSetting = true;
    }

    if( bSetting == true )
    {
        strcat( szQuest, szTemp );
    }

    // 完成任務後設定 FLAG 狀態
    //-------------------------------------------------------------------------------------------------------------------------------------------------
    ZeroMemory( szTemp, sizeof( szTemp ) );
    bSetting = false;
    sprintf( szTemp, "\r\n完成任務後設定 FLAG 狀態:\r\n--------------------------------------------------\r\n" );



    // 打開Flag
    if( pObjDB->GameData.QuestDetail.iComplete_FlagOn[0] != 0 )
    {
        sprintf( szTemp, "%s  打開Flag: %d", szTemp, pObjDB->GameData.QuestDetail.iComplete_FlagOn[0] );
        for( int i=1; i<=2; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iComplete_FlagOn[i] != 0 )
                sprintf( szTemp, "%s, %d", szTemp, pObjDB->GameData.QuestDetail.iComplete_FlagOn[i] );
            else
                break;
        }
        sprintf( szTemp, "%s\r\n", szTemp );
        bSetting = true;
    }

    // 關掉Flag
    if( pObjDB->GameData.QuestDetail.iComplete_FlagOff[0] != 0 )
    {
        sprintf( szTemp, "%s  關掉Flag: %d", szTemp, pObjDB->GameData.QuestDetail.iComplete_FlagOff[0] );
        for( int i=1; i<=2; i++ )
        {
            if( pObjDB->GameData.QuestDetail.iComplete_FlagOff[i] != 0 )
                sprintf( szTemp, "%s, %d", szTemp, pObjDB->GameData.QuestDetail.iComplete_FlagOff[i] );
            else
                break;
        }
        sprintf( szTemp, "%s\r\n", szTemp );
        bSetting = true;
    }

    if( bSetting == true )
    {
        strcat( szQuest, szTemp );
    }

    // 執行劇情設定
    //-------------------------------------------------------------------------------------------------------------------------------------------------
    ZeroMemory( szTemp, sizeof( szTemp ) );
    sprintf( szTemp, "\r\n執行劇情設定:\r\n--------------------------------------------------\r\n" );

    bSetting = false;

    if( strlen( (const char*)pObjDB->GameData.QuestDetail.szScript_OnBegin ) != 0 ) 
    {
        sprintf( szTemp, "%s  OnBegin: %s\n", szTemp, pObjDB->GameData.QuestDetail.szScript_OnBegin );
        bSetting = true;
    }

    if( strlen( (const char*)pObjDB->GameData.QuestDetail.szScript_OnAccept ) != 0 )
    {
        sprintf( szTemp, "%s  OnAccept: %s\n", szTemp, pObjDB->GameData.QuestDetail.szScript_OnAccept );
        bSetting = true;
    }

    if( strlen( (const char*)pObjDB->GameData.QuestDetail.szScript_OnComplete ) != 0 )
    {
        sprintf( szTemp, "%s  OnComplete: %s\n", szTemp, pObjDB->GameData.QuestDetail.szScript_OnComplete );
        bSetting = true;
    }

    if( bSetting == true )
    {
        strcat( szQuest, szTemp );
    }


    textBox_QuestCheck->Text = szQuest;
	*/

}

Void QuestDetailForm::CheckClassType_SelectedIndexChanged	(System::Object *  sender, System::EventArgs *  e)
{
	GetIndex_SelectedIndexChanged( sender, e );
	ComboBox* Box = static_cast<ComboBox*>(sender);

	comboBox_Check_Class1->SelectedIndex	= 0;
	comboBox_Check_Class2->SelectedIndex	= 0;

	switch( Box->SelectedIndex ) 
	{
	case 0: // 不限制
		comboBox_Check_Class_Type->BackColor = System::Drawing::Color::Gainsboro;
		comboBox_Check_Class1->Visible = false;
		comboBox_Check_Class2->Visible = false;
		label_Check_Class1->Visible	= false;
		label_Check_Class2->Visible	= false;
		break; 
	case 1: // 限定主職
		comboBox_Check_Class_Type->BackColor = System::Drawing::SystemColors::Window;


		label_Check_Class1->Visible	= true;
		label_Check_Class1->Text		= S"主職";
		comboBox_Check_Class1->Visible = true;

		label_Check_Class2->Visible	= false;
		comboBox_Check_Class2->Visible = false;

		break;
	case 2: // 限定副職
		comboBox_Check_Class_Type->BackColor = System::Drawing::SystemColors::Window;

		label_Check_Class1->Visible	= true;
		label_Check_Class1->Text		= S"副職";
		comboBox_Check_Class1->Visible = true;

		label_Check_Class2->Visible	= false;
		comboBox_Check_Class2->Visible = false;
		break;
	case 3: // 限定主副職
		comboBox_Check_Class_Type->BackColor = System::Drawing::SystemColors::Window;


		label_Check_Class1->Visible	= true;
		label_Check_Class1->Text		= S"主職";
		comboBox_Check_Class1->Visible = true;

		label_Check_Class2->Visible	= true;
		label_Check_Class2->Text		= S"副職";
		comboBox_Check_Class2->Visible = true;
		break;

	case 4: // 其中一職業
		comboBox_Check_Class_Type->BackColor = System::Drawing::SystemColors::Window;


		label_Check_Class1->Visible	= true;
		label_Check_Class1->Text		= S"職業";
		comboBox_Check_Class1->Visible = true;

		label_Check_Class2->Visible	= false;
		comboBox_Check_Class2->Visible = false;
		break;

	case 5: // 其中二職業
		comboBox_Check_Class_Type->BackColor = System::Drawing::SystemColors::Window;


		label_Check_Class1->Visible	= true;
		comboBox_Check_Class1->Visible = true;
		label_Check_Class1->Text		= S"職業1";


		label_Check_Class2->Visible	= true;
		comboBox_Check_Class2->Visible = true;
		label_Check_Class2->Text		= S"職業2";

		break;

	}
}
Void QuestDetailForm::OnValue_ValueChanged					(System::Object *  sender, System::EventArgs *  e)
{
	GetValue_ValueChanged( sender, e );
}

Void QuestDetailForm::OnText_QuestLinkValueChanged					(System::Object *  sender, System::EventArgs *  e)
{
	TextBox* Edit	= static_cast<TextBox*>(sender);

	// 取得原本資料
		ReaderClass< DB_GameObjDbStruct >*  Reader		= ObjReader( );
		DB_GameObjDbStruct __pin *			TempObj		= &_ObjDB;

		String*								Tag			= static_cast<String*>(Edit->Tag);

		if( Tag != NULL || Tag->Length == 0 )
		{
			//Tag = String::Copy( Tag );
			if( Tag->Chars[0] == '#' )
			{
				Tag = Tag->Remove( 0 , 1 );
			}
		}

		int	iOLDNPCID	= Reader->Read( TempObj, DotNetStr::StringToChar( Tag ) );


	// Save it
		GetIntValue_TextChanged( sender, e );

	

	if( Edit->Text->Length != 0 ) 
	{
		char				utf8_1 __gc[]	= Encoding::Default->GetBytes( Edit->Text );
		char __pin			*Str			= &utf8_1[0];
		float Value							= (float)atof( Str );

		if( Value != 0 )
		{
			Edit->BackColor = System::Drawing::SystemColors::Window;
			//Reader->Write( Data , Name , Value );

			int									iQuestID	= 0;
			int									iNPCID		= Value;

			// 檢查 NPC 在不在
			if( SearchObjName( iNPCID,  false ) != "" )
			{
				if( iNPCID == 0 )
				{
					// 刪除, 檢查現在任務還有沒有關於該 NPC 的條件

					bool bFound = false;

					// 檢查

					if( bFound == false )
					{
						for( int i=0; i< _MAX_SIZE_QUEST_ITEM; i++ )
						{
							int iObjID = TempObj->GameData.QuestDetail.iRequest_KillID[ i ];

							if( iObjID == iOLDNPCID )
							{
								bFound = true;
								break;
							}
						}
					}

					if( bFound == false )
					{
						for( int i=0; i< _MAX_SIZE_QUEST_ITEM; i++ )
						{
							int iObjID = TempObj->GameData.QuestDetail.iProcess_KilltoGetItem_ObjID[ i ];

							if( iObjID == iOLDNPCID )
							{
								bFound = true;
								break;
							}
						}
					}

					if( bFound == false )
					{
						for( int i=0; i< _MAX_SIZE_QUEST_ITEM; i++ )
						{
							int iObjID = TempObj->GameData.QuestDetail.iProcess_ClickToGetItem_ObjID[ i ];

							if( iObjID == iOLDNPCID )
							{
								bFound = true;
								break;
							}
						}
					}

					if( bFound == false )
					{
						// 目前任務已經沒有和該 NPC 有關連性, 刪除相關連結在　QuestLink Table


					}
					
				}
				else
				{
					// 新增, 檢查關希表中有沒有該筆條件

				}

				

			}







		}
		else
		{
			Edit->BackColor = System::Drawing::Color::Gainsboro;
			Edit->Text = "";

		}
	}
	else
	{
		Edit->BackColor = System::Drawing::Color::Gainsboro;
		Edit->Text = "";
		//Reader->Write( Data , Name , 0 );
	}
}

Void QuestDetailForm::OnText_ValueChanged					(System::Object *  sender, System::EventArgs *  e)
{
	// Save it
	GetIntValue_TextChanged( sender, e );

	TextBox* Edit	= static_cast<TextBox*>(sender);

	if( Edit->Text->Length != 0 ) 
	{
		char				utf8_1 __gc[]	= Encoding::Default->GetBytes( Edit->Text );
		char __pin			*Str			= &utf8_1[0];
		float Value							= (float)atof( Str );

		if( Value != 0 )
		{
			Edit->BackColor = System::Drawing::SystemColors::Window;
			//Reader->Write( Data , Name , Value );
		}
		else
		{
			Edit->BackColor = System::Drawing::Color::Gainsboro;
			Edit->Text = "";

		}
	}
	else
	{
		Edit->BackColor = System::Drawing::Color::Gainsboro;
		Edit->Text = "";
		//Reader->Write( Data , Name , 0 );
	}
}


Void QuestDetailForm::OnCombox_SelIndexChanged				(System::Object *  sender, System::EventArgs *  e)
{
	GetIndex_SelectedIndexChanged( sender, e );

	ComboBox* Box = static_cast<ComboBox*>(sender);


	if( Box->SelectedIndex == 0 )
	{
		Box->BackColor = System::Drawing::Color::Gainsboro;
	}
	else
	{
		Box->BackColor = System::Drawing::SystemColors::Window;
	}
}

Void QuestDetailForm::OnText_TextChanged				(System::Object *  sender, System::EventArgs *  e)
{
	TextBox* Edit = static_cast<TextBox*>(sender);

	if( Edit->Text->Length != 0 && Edit->MaxLength != 0 )
	{
		
		char utf8_1 __gc[] = Encoding::Default->GetBytes( Edit->Text );
		char __pin *Str = &utf8_1[0];

		if( (int)strlen( Str ) >= Edit->MaxLength )
		{
 			UpDate_DataToDisplay();
			return;
		}
	}

	GetStr_TextChanged( sender, e );

	
	DWORD dwLen		= Edit->Text->Length;

	if( Edit->Text->Length != 0 )
	{

		//DWORD dwStrlen = strlen( Str );

		
		Edit->BackColor = System::Drawing::SystemColors::Window;
	}
	else
	{
		Edit->BackColor = System::Drawing::Color::Gainsboro;
		Edit->Text = "";
	}

}

int     QuestDetailForm::ObjSize(  )
{
	GameObjDbStruct *P = NULL;
	int Size = sizeof( GameObjDbStruct ) - sizeof( P->Temp ) +  sizeof( P->QuestDetail ) + 3;
	Size = Size & 0xfffffC;
	return Size;
}

Void QuestDetailForm::CB_RewardDifficult_SelectedIndexChanged(System::Object*  sender, System::EventArgs*  e)
{
	DB_GameObjDbStruct __pin * TempObj = &_ObjDB;

	TextBox* Exp	= textBox_RewardExp;
	TextBox* Money	= textBox_RewardMoney;

	switch( CB_RewardDifficult->SelectedIndex )
	{
	case 1:	Exp->Text =  S"25"; Money->Text =  S"25"; break;
	case 2:	Exp->Text =  S"50"; Money->Text =  S"50"; break;
	case 3:	Exp->Text =  S"75"; Money->Text =  S"75"; break;
	case 4:	Exp->Text =  S"100"; Money->Text =  S"100"; break;
	case 5:	Exp->Text =  S"150"; Money->Text =  S"150"; break;
	case 6:	Exp->Text =  S"200"; Money->Text =  S"200"; break;
	}
}
