#include "MagicCollectForm.h"
using namespace ObjDataEdit;
//######################################################################################################
//主要需要繼承的涵式
ReaderClass< DB_GameObjDbStruct >* MagicCollectForm::ObjReader( )
{
	return  GameObjDbStructEx::ObjReader_MagicCollect( );
}
void    MagicCollectForm::OnActive()
{
	static bool FirstTime = true;
	if( FirstTime  == false )
		return;

	BaseForm::OnActive();

	FirstTime = false;

	CB_MagicCheckFuncType1->Items->Clear();
	CB_MagicCheckFuncType2->Items->Clear();
	CB_MagicCheckFuncType3->Items->Clear();
	CB_MagicCheckFuncType4->Items->Clear();
	CB_MagicCheckFuncType5->Items->Clear();
	CB_MagicCheckFuncType6->Items->Clear();
	CB_MagicCheckFuncType7->Items->Clear();
	CB_MagicCheckFuncType8->Items->Clear();
	CB_MagicCheckFuncType9->Items->Clear();
	CB_MagicCheckFuncType10->Items->Clear();
	CB_MagicCheckFuncType11->Items->Clear();
	CB_MagicCheckFuncType12->Items->Clear();

	for( int i = 0 ; i < EM_MagicCheck_MaxCount ; i++ )
	{
		String* Str = GameObjDbStructEx::GetMagicCheckFunctionENUMString( (MagicCheckFunctionENUM)i );
		CB_MagicCheckFuncType1->Items->Add( Str );
		CB_MagicCheckFuncType2->Items->Add( Str );
		CB_MagicCheckFuncType3->Items->Add( Str );
		CB_MagicCheckFuncType4->Items->Add( Str );
		CB_MagicCheckFuncType5->Items->Add( Str );
		CB_MagicCheckFuncType6->Items->Add( Str );
		CB_MagicCheckFuncType7->Items->Add( Str );
		CB_MagicCheckFuncType8->Items->Add( Str );
		CB_MagicCheckFuncType9->Items->Add( Str );
		CB_MagicCheckFuncType10->Items->Add( Str );
		CB_MagicCheckFuncType11->Items->Add( Str );
		CB_MagicCheckFuncType12->Items->Add( Str );
	} 


	_MagicHelpInfo->Add( LB_MagicArgInfo1 );
	_MagicHelpInfo->Add( LB_MagicArgInfo2 );
	_MagicHelpInfo->Add( LB_MagicArgInfo3 );
	_MagicHelpInfo->Add( LB_MagicArgInfo4 );
	_MagicHelpInfo->Add( LB_MagicArgInfo5 );
	_MagicHelpInfo->Add( LB_MagicArgInfo6 );
	_MagicHelpInfo->Add( LB_MagicArgInfo7 );
	_MagicHelpInfo->Add( LB_MagicArgInfo8 );
	_MagicHelpInfo->Add( LB_MagicArgInfo9 );
	_MagicHelpInfo->Add( LB_MagicArgInfo10);
	_MagicHelpInfo->Add( LB_MagicArgInfo11);
	_MagicHelpInfo->Add( LB_MagicArgInfo12);


	SqlDataReader* myReader;
	sqlCommand_Base->CommandText = "Select ID , Name from Table_String Where Type = '法術群組' ORDER BY  ID";
	myReader = sqlCommand_Base->ExecuteReader();
	CB_MagicBaseGroup->Items->Clear();
	CB_MagicBaseGroup->Items->Add( S"無" );
	while( myReader->Read() )
	{                
		String* Str = myReader->GetString( 1 );
		CB_MagicBaseGroup->Items->Add( Str );
	}
	myReader->Close();

	//////////////////////////////////////////////////////////////////////////
	sqlCommand_Base->CommandText = "Select ID , Name from Table_String Where Type = '寵物技能類型' ORDER BY  ID";
	myReader = sqlCommand_Base->ExecuteReader();
	CB_PetSkillType->Items->Clear();	
	CB_PetSkillType->Items->Add( S"非寵物技能" );
	while( myReader->Read() )
	{                
		int     Value =  myReader->GetInt32( 0 );
		String* Str   =  myReader->GetString( 1 );

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

}
void    MagicCollectForm::OnSelectObj( bool LockOk )
{
    _ObjDB.GameData.Classification = EM_ObjectClass_MagicCollect;
//    panel1->Enabled = LockOk;
}
void    MagicCollectForm::OnOutputObjSetting( DB_GameObjDbStruct* TempObj )
{
    TempObj->GameData.Classification = EM_ObjectClass_MagicCollect;
	TempObj->GameData.MagicCol.JobInfo.Job = EM_Vocation_None;
	TempObj->GameData.MagicCol.ComboType = (MagicComboTypeENUM)(TempObj->GameData.MagicCol.ComboType-1);
	TempObj->GameData.MagicCol.PetSkillType--;
}
void    MagicCollectForm::OnTimeProc()
{

}
int     MagicCollectForm::ObjSize(  )
{
    //int Size = sizeof( GameObjDbStruct );
	GameObjDbStruct *P = NULL;
	int Size = sizeof( GameObjDbStruct ) - sizeof( P->Temp ) +  sizeof( P->MagicCol ) + 3;
	Size = Size & 0xfffffC;

    return Size;
}
void    MagicCollectForm::OnValueChange()
{
	DB_GameObjDbStruct __pin * TempObj = &_ObjDB;
	LB_MagicBase1->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[0][0].MagicBaseID );
	LB_MagicBase2->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[0][1].MagicBaseID );
	LB_MagicBase3->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[0][2].MagicBaseID );
	LB_MagicBase4->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[0][3].MagicBaseID );
	LB_MagicBase5->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[1][0].MagicBaseID );
	LB_MagicBase6->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[1][1].MagicBaseID );
	LB_MagicBase7->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[1][2].MagicBaseID );
	LB_MagicBase8->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[1][3].MagicBaseID );
	LB_MagicBase9->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[2][0].MagicBaseID );
	LB_MagicBase10->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[2][1].MagicBaseID );
	LB_MagicBase11->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[2][2].MagicBaseID );
	LB_MagicBase12->Text =  SearchObjName( TempObj->GameData.MagicCol.Magic[2][3].MagicBaseID );
	LB_NextMagicID->Text =  SearchObjName( TempObj->GameData.MagicCol.NextMagicID );
	LB_SuitPassiveSkill->Text =  SearchObjName( TempObj->GameData.MagicCol.SuitPassiveSkill );

	for( int i = 0 ; i < 2 ; i++ )
	{
		TextBox*	MagicNeedValue;
		Label*		MagicNeed;

		MagicSpellNeedTypeENUM	Type	= TempObj->GameData.MagicCol.Need[i].Type;
		int						Value	= TempObj->GameData.MagicCol.Need[i].Value;

		if( i == 0 )
		{
			MagicNeedValue	=	TB_MagicNeedValue1;
			MagicNeed		=	LB_MagicNeed1;
		}
		else
		{
			MagicNeedValue	=	TB_MagicNeedValue2;
			MagicNeed		=	LB_MagicNeed2;
		}

		switch( Type )
		{
		case EM_MagicSpellNeedType_Weapon:				//需求 自己裝 武器
		case EM_MagicSpellNeedType_EQ:					//需求 自己裝 裝備
		case EM_MagicSpellNeedType_Suit:				//需求 自己裝 套裝
		case EM_MagicSpellNeedType_Buf:					//需求 自己有 法術Buf
		case EM_MagicSpellNeedType_Buf_Target:			//需求 目標有 法術Buf
		case EM_MagicSpellNeedType_NoBuf:				//需求 自己沒有 法術Buf
		case EM_MagicSpellNeedType_NoBuf_Target:		//需求 目標沒有 法術Buf
			{
				MagicNeedValue->Show();
				MagicNeed->Show();
				MagicNeed->Text =  SearchObjName( Value );
				break;
			}
		case EM_MagicSpellNeedType_None:				//無需求
		case EM_MagicSpellNeedType_WeaponType_Unarmed:	//需求 自己裝 武器類型 空手
		case EM_MagicSpellNeedType_WeaponType_Blade:    //需求 自己裝 武器類型 單手劍
		case EM_MagicSpellNeedType_WeaponType_Dagger:   //需求 自己裝 武器類型 匕首
		case EM_MagicSpellNeedType_WeaponType_Wand:     //需求 自己裝 武器類型 權杖
		case EM_MagicSpellNeedType_WeaponType_Axe:      //需求 自己裝 武器類型 單手斧
		case EM_MagicSpellNeedType_WeaponType_Bludgeon: //需求 自己裝 武器類型 鎚棍棒
		case EM_MagicSpellNeedType_WeaponType_Claymore: //需求 自己裝 武器類型 雙手劍
		case EM_MagicSpellNeedType_WeaponType_Staff:    //需求 自己裝 武器類型 杖
		case EM_MagicSpellNeedType_WeaponType_2H_Axe:   //需求 自己裝 武器類型 雙手斧
		case EM_MagicSpellNeedType_WeaponType_2H_Hammer://需求 自己裝 武器類型 雙手鎚
		case EM_MagicSpellNeedType_WeaponType_Polearm:	//需求 自己裝 武器類型 槍(長矛)
		case EM_MagicSpellNeedType_WeaponType_SwordType://需求 自己裝 武器類型 劍類(單雙手)
		case EM_MagicSpellNeedType_WeaponType_AxeType:  //需求 自己裝 武器類型 斧類(單雙手)
		case EM_MagicSpellNeedType_WeaponType_LongDistWeapon:	//需求 長距離武器
		case EM_MagicSpellNeedType_NotAttak:			//需求 自己非戰鬥
		case EM_MagicSpellNeedType_Attack:				//需求 自己戰鬥
		case EM_MagicSpellNeedType_Critical:			//需求 自己爆擊
		case EM_MagicSpellNeedType_BeCritical:			//需求 自己被爆擊
		case EM_MagicSpellNeedType_Dodge:				//需求 自己閃避
		case EM_MagicSpellNeedType_Miss:				//需求 自己Miss
		case EM_MagicSpellNeedType_Parry:				//需求 自己格擋
		case EM_MagicSpellNeedType_BeParry:				//需求 自己被格擋

		case EM_MagicSpellNeedType_NotAttack_Target:	//需求 目標非戰鬥
		case EM_MagicSpellNeedType_Attack_Target:		//需求 目標戰鬥
		case EM_MagicSpellNeedType_BeDodge:

			{
				MagicNeedValue->Hide();
				MagicNeed->Hide();
				break;
			}
		case EM_MagicSpellNeedType_Distance:				//需求 距離目標
		case EM_MagicSpellNeedType_SelfHp_Smaller_Percent:	//需求 HP百分比小於
		case EM_MagicSpellNeedType_SelfHp_Greater_Percent:	//需求 HP百分比大於
		case EM_MagicSpellNeedType_Self_SoulPoint:			//需求 靈魂值
			{
				MagicNeedValue->Show();
				MagicNeed->Hide();
				break;
			}
		case EM_MagicSpellNeedType_Self_Job:				//需求 職業
		case EM_MagicSpellNeedType_Self_MainJob:
			{
				MagicNeedValue->Show();
				MagicNeed->Show();

				if( unsigned( Value ) < 32 )
					MagicNeed->Text =  (String*) RoleDataEx::VocStr[ Value ];
				else
					MagicNeed->Text = "無此職業";

				break;
			}
		case EM_MagicSpellNeedType_BuffGroup:			//需求 自己擁有某 Buff Group
			{
				MagicNeedValue->Show();
				MagicNeed->Show();
				//MagicNeed->Text =  SearchObjName( Value );
				if( CB_MagicBaseGroup->Items->Count <= Value )
					MagicNeed->Text = "錯誤";
				else
				{
					String* Str = CB_MagicBaseGroup->Items->Item[ Value ]->ToString();
					MagicNeed->Text = Str;
				}
				break;
			}

		}
	}

	for( int i = 0 ; i < 12 ; i++ )
	{
		MagicCollectCondition Condition = TempObj->GameData.MagicCol.Magic_List[i];
		Label* label = static_cast<Label*>(_MagicHelpInfo->Item[i] );
		switch( Condition.FuncType )
		{
		case EM_MagicCheck_None:			//"無"									
		case EM_MagicCheck_Rand:			//"亂數"									
			label->Text = "";
			break;
		case EM_MagicCheck_Self_Eq:			//"自己裝備( 機率 , 裝備號碼 )"			
		case EM_MagicCheck_Target_Eq:		//"目標裝備( 機率 , 裝備號碼 )"			
		case EM_MagicCheck_Self_Item:		//"自己物品( 機率 , 物品 or 重要物品 )"	
		case EM_MagicCheck_Target_Item:		//"目標物品( 機率 , 物品 or 重要物品 )"	
		case EM_MagicCheck_Self_Buff:		//"自己Buff( 機率 , 擁有某Buff )"			
		case EM_MagicCheck_Target_Buff:		//"目標Buff( 機率 , 擁有某Buff )"	
		case EM_MagicCheck_Self_Skill:		//"自己學會某技能( 機率 , 法術ID )"	
			label->Text = SearchObjName( Condition.Arg[1] );
			break;
		case EM_MagicCheck_Self_EqType:		//"自己裝備類型( 機率 , 裝備類型 )"			
		case EM_MagicCheck_Target_EqType:	//"目標裝備類型( 機率 , 裝備類型 )"			
			label->Text = GameObjDbStructEx::GetWeaponTypeENUMString( (GameObjectWeaponENUM)Condition.Arg[1] );
			break;
		case EM_MagicCheck_Self_Position:	//"自己位置( 機率 , 位置辨別碼 )"			
		case EM_MagicCheck_Target_Position:	//"目標位置( 機率 , 位置辨別碼 )"			
			label->Text = "";
			break;
		case EM_MagicCheck_Self_Fight:		//"自己戰鬥( 機率 , 0非戰鬥/1戰鬥  )"		
		case EM_MagicCheck_Target_Fight:	//"目標戰鬥( 機率 , 0非戰鬥/1戰鬥  )"
			label->Text = "";
			break;
		case EM_MagicCheck_Target_Race:		//"目標種族( 機率 , 種族ID  )"			
			label->Text = (String*)RoleDataEx::RaceStr[ Condition.Arg[1] ];
			break;
		case EM_MagicCheck_Self_HP:			//"自己HP低於( 機率 , HP百分比 )"		
			label->Text = "";
			break;
		case EM_MagicCheck_Time:			//"時間( 機率 , 時間 )"					
		case EM_MagicCheck_Weather:			//"氣候( 機率 , 氣候辨別碼 )"				
			label->Text = "";
			break;
		case EM_MagicCheck_Self_BuffGroup:	//"自己Buff Group( 機率 , 擁有某Buff群組 )"			
		case EM_MagicCheck_Target_BuffGroup://"目標Buff Group( 機率 , 擁有某Buff群組 )"			
			if( CB_MagicBaseGroup->Items->Count <= Condition.Arg[1] )
				label->Text = "錯誤";
			else
			{
				String* Str = CB_MagicBaseGroup->Items->Item[ Condition.Arg[1] ]->ToString();
				label->Text = Str;
			}
			break;
		}
	}

	//////////////////////////////////////////////////////////////////////////

	switch( TempObj->GameData.MagicCol.Cost[0].Type )
	{
	case EM_MagicSpellCostType_None:				//無消耗
		{
			LB_MagicCost->Hide();
			TB_MagicCostValue->Hide();
			break;
		}
	case EM_MagicSpellCostType_HP:					//消耗 HP
	case EM_MagicSpellCostType_MP:					//消耗 MP
	case EM_MagicSpellCostType_HP_Per:				//消耗 HP百分比
	case EM_MagicSpellCostType_MP_Per:				//消耗 MP百分比
	case EM_MagicSpellCostType_SP_Warrior:			//消耗 SP 戰士(-1表示全部)
	case EM_MagicSpellCostType_SP_Ranger:			//消耗 SP 遊俠(-1表示全部)
	case EM_MagicSpellCostType_SP_Rogue:			//消耗 SP 盜賊(-1表示全部)
	case EM_MagicSpellCostType_StomachPoint:		//消耗 飽食度
	case EM_MagicSpellCostType_Ammo_Gun:			//消耗 子彈
	case EM_MagicSpellCostType_Ammo_Bow:			//消耗 弓箭矢
	case EM_MagicSpellCostType_Ammo_CossBow:		//消耗 十字弓箭矢
	case EM_MagicSpellCostType_Ammo_Throw:			//消耗 投擲物
	case EM_MagicSpellCostType_Ammo_All:			//消耗 投擲物
	case EM_MagicSpellCostType_SoulPoint:
		{
			LB_MagicCost->Hide();
			TB_MagicCostValue->Show();

			break;
		}
	case EM_MagicSpellCostType_Item:				//消耗 物品
		{
			TB_MagicCostValue->Show();
			LB_MagicCost->Show();
			LB_MagicCost->Text =  SearchObjName( TempObj->GameData.MagicCol.Cost[0].Value );

			break;
		}
	}

	switch( TempObj->GameData.MagicCol.Cost[1].Type )
	{
	case EM_MagicSpellCostType_None:				//無消耗
		{
			LB_MagicCost1->Hide();
			TB_MagicCostValue1->Hide();
			break;
		}
	case EM_MagicSpellCostType_HP:					//消耗 HP
	case EM_MagicSpellCostType_MP:					//消耗 MP
	case EM_MagicSpellCostType_HP_Per:				//消耗 HP百分比
	case EM_MagicSpellCostType_MP_Per:				//消耗 MP百分比
	case EM_MagicSpellCostType_SP_Warrior:			//消耗 SP 戰士(-1表示全部)
	case EM_MagicSpellCostType_SP_Ranger:			//消耗 SP 遊俠(-1表示全部)
	case EM_MagicSpellCostType_SP_Rogue:			//消耗 SP 盜賊(-1表示全部)
	case EM_MagicSpellCostType_StomachPoint:		//消耗 飽食度
	case EM_MagicSpellCostType_Ammo_Gun:			//消耗 子彈
	case EM_MagicSpellCostType_Ammo_Bow:			//消耗 弓箭矢
	case EM_MagicSpellCostType_Ammo_CossBow:		//消耗 十字弓箭矢
	case EM_MagicSpellCostType_Ammo_Throw:			//消耗 投擲物
	case EM_MagicSpellCostType_Ammo_All:			//消耗 投擲物
	case EM_MagicSpellCostType_SoulPoint:			//
		{
			LB_MagicCost1->Hide();
			TB_MagicCostValue1->Show();

			break;
		}
	case EM_MagicSpellCostType_Item:				//消耗 物品
		{
			TB_MagicCostValue1->Show();
			LB_MagicCost1->Show();
			LB_MagicCost1->Text =  SearchObjName( TempObj->GameData.MagicCol.Cost[1].Value );

			break;
		}
	}



	//////////////////////////////////////////////////////////////////////////
	if( TempObj->GameData.MagicCol.TargetType == EM_Releation_Plot )
	{
		//LB_MagicShootTarget->Show();
		//TB_MagicShootTarget->Show();
		PL_ShootTargetScript->Show();
		PL_ShootTargetScript->Location = System::Drawing::Point(3, 125);

		LB_AttackDistance->Hide();
		CB_AttackDistance->Hide();
	}
	else
	{
		//LB_MagicShootTarget->Hide();
		//TB_MagicShootTarget->Hide();
		PL_ShootTargetScript->Hide();
		LB_AttackDistance->Show();
		CB_AttackDistance->Show();

	}

	if(				TempObj->GameData.MagicCol.RangeType == EM_MagicEffect_Target 
				||	TempObj->GameData.MagicCol.RangeType == EM_MagicEffect_Plot	)
	{
		CB_Range->Hide();
		CB_RangeType->Hide();
		TB_EffectCount->Hide();
		LB_Range->Hide();
		LB_RangeCount->Hide();
		LB_RangeType->Hide();
		CB_DecreaseArg->Hide();
		LB_DecreaseArg->Hide();

		//LB_SelectTargetScript->Hide();
		//TB_SelectTargetScript->Hide();
		PL_SelectTargetScript->Hide();
		PL_SelectTargetScript->Location = System::Drawing::Point(3,102);

		if( TempObj->GameData.MagicCol.RangeType == EM_MagicEffect_Plot )
		{
			//LB_SelectTargetScript->Show();
			//TB_SelectTargetScript->Show();
			PL_SelectTargetScript->Show();
			PL_SelectTargetScript->Location = System::Drawing::Point(3,75);
		}
		else
		{
			//LB_SelectTargetScript->Hide();
			//TB_SelectTargetScript->Hide();
			PL_SelectTargetScript->Hide();
		}
	}
	else
	{
		//LB_SelectTargetScript->Hide();
		//TB_SelectTargetScript->Hide();
		PL_SelectTargetScript->Hide();
		PL_SelectTargetScript->Location = System::Drawing::Point(3,102);

		CB_Range->Show();
		CB_RangeType->Show();
		TB_EffectCount->Show();
		LB_Range->Show();
		LB_RangeCount->Show();
		LB_RangeType->Show();
		CB_DecreaseArg->Show();
		LB_DecreaseArg->Show();
		if( TempObj->GameData.MagicCol.IsShareDamage )
			LB_DecreaseArg->Text = "最低威力%";
		else
			LB_DecreaseArg->Text = "遞減威力%";
	}

	switch( TempObj->GameData.MagicCol.HitRateFunc )
	{
	case EM_HitRateFunc_Base:				//定值
		CB_HitRateArg2->Visible = false;
		break;
	case EM_HitRateFunc_DLV:				//等級差
		CB_HitRateArg2->Visible = true;
		break;
	case EM_HitRateFunc_DLVxDLV:
		CB_HitRateArg2->Visible = true;
		break;
	case EM_HitRateFunc_DecPerPersion:		//依人次降低
		CB_HitRateArg2->Visible = true;
		break;
	case EM_HitRateFunc_Shoot:
		CB_HitRateArg2->Visible = true;
		break;
	}

	if( TempObj->GameData.MagicCol.SpellCount <= 1 )
	{
		LB_NextSpellTime->Visible = false;
		CB_NextSpellTime->Visible = false;
	}
	else
	{
		LB_NextSpellTime->Visible = true;
		CB_NextSpellTime->Visible = true;
	}

}


//######################################################################################################
System::Void MagicCollectForm::ColdownClassChange(System::Object*  sender, System::EventArgs*  e) 
{
	int ClassID = CB_ColdownClass->SelectedIndex;
	int TypeID = CB_ColdownType->SelectedIndex;

	CB_ColdownType->Items->Clear();

	switch( ClassID )
	{
	case EM_MagicColdownClass_None	:		//沒有
		CB_ColdownType->Items->Add( S"無" );
		break;
	case EM_MagicColdownClass_Job	:		//職業類型
		{
			CB_ColdownType->Items->Add( S"大絕-1" );
			CB_ColdownType->Items->Add( S"大絕-2" );
			CB_ColdownType->Items->Add( S"大絕-3" );
			CB_ColdownType->Items->Add( S"大絕-4" );
			CB_ColdownType->Items->Add( S"大絕-5" );

			SqlDataReader* myReader;
			sqlCommand_Base->CommandText = "Select ID , Name from Table_String Where Type = '冷卻類型' ORDER BY  ID";
			myReader = sqlCommand_Base->ExecuteReader();
			while( myReader->Read() )
			{                
				String* Str = myReader->GetString( 1 );
				CB_ColdownType->Items->Add( Str );
			}
			myReader->Close();			
		}
		break;
	case EM_MagicColdownClass_EQ	:		//裝備類型
		CB_ColdownType->Items->Add( S"頭" );
		CB_ColdownType->Items->Add( S"手套" );
		CB_ColdownType->Items->Add( S"鞋子" );
		CB_ColdownType->Items->Add( S"上衣" );
		CB_ColdownType->Items->Add( S"褲子" );
		CB_ColdownType->Items->Add( S"背部" );
		CB_ColdownType->Items->Add( S"腰帶" );
		CB_ColdownType->Items->Add( S"肩甲" );
		CB_ColdownType->Items->Add( S"項鍊" );
		CB_ColdownType->Items->Add( S"戒子" );
		CB_ColdownType->Items->Add( S"耳飾" );
		CB_ColdownType->Items->Add( S"武器" );
		CB_ColdownType->Items->Add( S"弓" );
		CB_ColdownType->Items->Add( S"其它1" );
		CB_ColdownType->Items->Add( S"其它2" );
		break;
	case EM_MagicColdownClass_Item	:		//物品類型
		SqlDataReader* myReader;
		sqlCommand_Base->CommandText = "Select ID , Name from Table_String Where Type = '物品冷卻類型' ORDER BY  ID";
		myReader = sqlCommand_Base->ExecuteReader();
		while( myReader->Read() )
		{                
			String* Str = myReader->GetString( 1 );
			CB_ColdownType->Items->Add( Str );
		}
		myReader->Close();	
		/*
		CB_ColdownType->Items->Add( S"食物-1" );
		CB_ColdownType->Items->Add( S"食物-2" );
		CB_ColdownType->Items->Add( S"食物-3" );
		CB_ColdownType->Items->Add( S"藥水-1" );
		CB_ColdownType->Items->Add( S"藥水-2" );
		CB_ColdownType->Items->Add( S"藥水-3" );
		CB_ColdownType->Items->Add( S"其他1" );
		CB_ColdownType->Items->Add( S"其他2" );
		CB_ColdownType->Items->Add( S"其他3" );
		CB_ColdownType->Items->Add( S"其他4" );
		CB_ColdownType->Items->Add( S"其他5" );
		CB_ColdownType->Items->Add( S"其他6" );
		CB_ColdownType->Items->Add( S"其他7" );
		CB_ColdownType->Items->Add( S"其他8" );
		CB_ColdownType->Items->Add( S"其他9" );
		CB_ColdownType->Items->Add( S"其他10" );
		CB_ColdownType->Items->Add( S"其他11" );
		CB_ColdownType->Items->Add( S"其他12" );
		CB_ColdownType->Items->Add( S"其他13" );
		CB_ColdownType->Items->Add( S"其他14" );
		CB_ColdownType->Items->Add( S"其他15" );
		CB_ColdownType->Items->Add( S"其他16" );
		CB_ColdownType->Items->Add( S"其他17" );
		CB_ColdownType->Items->Add( S"其他18" );
		CB_ColdownType->Items->Add( S"其他19" );
		CB_ColdownType->Items->Add( S"其他20" );
		CB_ColdownType->Items->Add( S"其他21" );
		CB_ColdownType->Items->Add( S"其他22" );
		CB_ColdownType->Items->Add( S"其他23" );
		CB_ColdownType->Items->Add( S"其他24" );
*/
		break;
	}
	if( CB_ColdownType->Items->Count > TypeID )
		CB_ColdownType->SelectedIndex = TypeID;
	else
		CB_ColdownType->SelectedIndex = 0;
	GetIndex_SelectedIndexChanged( sender , e );

}

