#include "ItemForm.h"

using namespace ObjDataEdit;
//######################################################################################################
ReaderClass< DB_GameObjDbStruct >* ItemForm::ObjReader( )
{
	return GameObjDbStructEx::ObjReader_Item( );
}
//主要需要繼承的涵式
void    ItemForm::OnActive()
{
	
    static bool FirstTime = true;

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

	BaseForm::OnActive();

	FirstTime = false;

    CLB_RaceLimit->Items->Clear();
    for( unsigned int i = 0 ; i < Global::RaceName.size() ; i++ )
    {
        String* Str =  Global::RaceName[i].c_str();
        System::Object* AddItem[] = new System::Object*[1];
        AddItem[0] = Str;
        CLB_RaceLimit->Items->AddRange(AddItem);

    }

    CLB_VocLimit->Items->Clear();
    for( unsigned int i = 0 ; i < Global::JobName.size() ; i++ )
    {
        String* Str =  Global::JobName[i].c_str();
        System::Object* AddItem[] = new System::Object*[1];
        AddItem[0] = Str;
        CLB_VocLimit->Items->AddRange(AddItem);

    }

    CLB_SexLimit->Items->Clear();
    for( unsigned int i = 0 ; i < Global::SexName.size() ; i++ )
    {
        String* Str =  Global::SexName[i].c_str();
        System::Object* AddItem[] = new System::Object*[1];
        AddItem[0] = Str;
        CLB_SexLimit->Items->AddRange(AddItem);

    }
	SqlDataReader* myReader;

	//sqlCommand_Base->CommandText = "Select ID , Name from Table_String Where Type = '商品類別' ORDER BY  ID";
	sqlCommand_Base->CommandText = "select keystr,content from StringDB where LEFT(KeyStr,14) = 'SYS_STORE_TYPE' order by KeyStr";
	myReader = sqlCommand_Base->ExecuteReader();
	CB_SellType->Items->Clear();
	
	for( int i = 0 ; ; i++ )
	{                
		if( myReader->Read() == false )
			break;
		//int     Value =  myReader->GetInt32( 0 );
		String* KeyStr   = myReader->GetString( 0 );
		String* Content  = myReader->GetString( 1 );

		string tempStr = DotNetStr::StringToChar( KeyStr );
		const char* cKeyStr = tempStr.c_str();
		const char* cNumStr = strlen("SYS_STORE_TYPE_") + cKeyStr;
		if( i != atol( cNumStr ) )
			break;

		CB_SellType->Items->Add( Content );
	}
	myReader->Close();



	// 傢俱設定

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

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

	// 幣值設定
	{
		vector< std::string >	vecPriceType;
		sqlCommand_Base->CommandText = "Select Note from Table_SysKeyValue Where KeyStr LIKE 'SYS_PRICETYPE_ICONID_%' ORDER BY KeyStr";
		myReader = sqlCommand_Base->ExecuteReader();

		while( myReader->Read() )		
		{
			std::string sContent		=	DotNetStr::StringToChar( myReader->GetString( 0 ) );
			vecPriceType.push_back( sContent );
		}
		myReader->Close();

		CB_PricesType->Items->Clear();

		for( vector< std::string >::iterator it = vecPriceType.begin(); it != vecPriceType.end(); it++ )
		{
			String*		sContent		= new String( (*it).c_str() );
			CB_PricesType->Items->Add( sContent );
		}
	}
	
	sqlCommand_Base->CommandText = "Select ID , Name from Table_String Where Type = '種植模型' ORDER BY  ID";
	myReader = sqlCommand_Base->ExecuteReader();
	CB_PlantModelType->Items->Clear();	
	while( myReader->Read() )
	{                
		int     Value =  myReader->GetInt32( 0 );
		String* Str   =  myReader->GetString( 1 );

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


	sqlCommand_Base->CommandText = "Select ID , Name from Table_String Where Type = '寵物個性' ORDER BY  ID";
	myReader = sqlCommand_Base->ExecuteReader();
	CB_PetType->Items->Clear();	
	while( myReader->Read() )
	{                
		int     Value =  myReader->GetInt32( 0 );
		String* Str   =  myReader->GetString( 1 );

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


}
void    ItemForm::OnSelectObj( bool LockOk )
{
//    if( CheckModifyAndCheckOut() == false )
  //      return;

//    panel1->Enabled = LockOk;
    _ObjDB.GameData.Classification = EM_ObjectClass_Item;
	//_ObjDB.GameData.PricesType	= EM_ACPriceType_GameMoney;

    ObjectModeStruct Mode;
    int TempMode[20];

    Mode._Mode = 0;
    Mode.Sell = 1;
    TempMode[0] = Mode._Mode;
    Mode._Mode = 0;
    Mode.Logoutdel = 1;
    TempMode[1] = Mode._Mode;
    Mode._Mode = 0;
    Mode.Expense = 1;
    TempMode[2] = Mode._Mode;
    Mode._Mode = 0;
    Mode.PickupBound = 1;
    TempMode[3] = Mode._Mode;
	Mode._Mode = 0;
	Mode.HideCount = 1;
	TempMode[4] = Mode._Mode;
	Mode._Mode = 0;
	Mode.ChangeZoneDel = 1;
	TempMode[5] = Mode._Mode;
	Mode._Mode = 0;
	Mode.PkNoDrop = 1;
	TempMode[6] = Mode._Mode;
	Mode._Mode = 0;
	Mode.DepartmentStore = 1;
	TempMode[7] = Mode._Mode;
	Mode._Mode = 0;
	Mode.DepartmentStore_Free = 1;
	TempMode[8] = Mode._Mode;
	Mode._Mode = 0;
	Mode.ItemDrop_AllParty = 1;
	TempMode[9] = Mode._Mode;
	Mode._Mode = 0;
	Mode.UseWithoutFail = 1;
	TempMode[10] = Mode._Mode;
	Mode._Mode = 0;
	Mode.ItemDrop_Depart = 1;
	TempMode[11] = Mode._Mode;
	Mode._Mode = 0;
	Mode.Unique = 1;
	TempMode[12] = Mode._Mode;
	Mode._Mode = 0;
	Mode.EnableLockedItem = 1;
	TempMode[13] = Mode._Mode;
	Mode._Mode = 0;
	Mode.AutoUseItem = 1;
	TempMode[14] = Mode._Mode;
	Mode._Mode = 0;
	Mode.DisableMagicBox = 1;
	TempMode[15] = Mode._Mode;
	Mode._Mode = 0;
	Mode.HideMaxHeap = 1;
	TempMode[16] = Mode._Mode;




    for( int i = 0 ; i < CLBModeFlag1->Items->Count ; i ++ )
    {
        if( TempMode[i] & _ObjDB.GameData.Mode._Mode )
            CLBModeFlag1->SetItemChecked( i , true );
        else
            CLBModeFlag1->SetItemChecked( i , false );
    }
}
//輸出時額外設定
void    ItemForm::OnOutputObjSetting( DB_GameObjDbStruct* TempObj )
{
    TempObj->GameData.Classification = EM_ObjectClass_Item;
	TempObj->GameData.Item.Class = EM_Item_Normal;
	TempObj->GameData.Item.ImageEfficacyType = EM_ImageEfficacyType_None;
	//TempObj->GameData.PricesType	= EM_ACPriceType_GameMoney;
	
	int iVal = TempObj->GameData.PricesType;

	TempObj->GameData.Item.GuildResourceType = (GuildResourceTypeENUM)( TempObj->GameData.Item.GuildResourceType - 1 );


	if( TempObj->GameData.MaxHeap <= 0 )
		TempObj->GameData.MaxHeap = 1;
	TempObj->GameData.Item.SuitID = 0;

	if( TempObj->GameData.Item.ItemType == EM_ItemType_Plot )
		TempObj->GameData.Mode.PickupBound = 1;


	if( TempObj->GameData.Item.UseType == EM_ItemUseType_EqRefine 
		|| TempObj->GameData.Item.UseType == EM_ItemUseType_FixEq  
		|| TempObj->GameData.Item.UseType == EM_ItemUseType_Dissolution  
		|| TempObj->GameData.Item.UseType == EM_ItemUseType_Coloring  
		|| TempObj->GameData.Item.UseType == EM_ItemUseType_ClsEqSoulbound  )
		TempObj->GameData.Item.IsItemToItem = true;
	else
		TempObj->GameData.Item.IsItemToItem = false;

	if(		TempObj->GameData.BuyUnit == 0 
		||	TempObj->GameData.BuyUnit > TempObj->GameData.MaxHeap )
		TempObj->GameData.BuyUnit = TempObj->GameData.MaxHeap;


	//設定拍賣類別
	TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_EMPTY;
	TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_EMPTY;
	TempObj->GameData.ACSearchType[2] = _DEF_ACSEARCHTYPE_EMPTY;

	switch( TempObj->GameData.Item.ItemType )
	{
	case EM_ItemType_Ore             	: //礦石
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_STUFF;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_STUFF_MINE;
		break;

	case EM_ItemType_Wood            	: //木材
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_STUFF;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_STUFF_WOOD;
		break;

	case EM_ItemType_Herb            	: //藥草
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_STUFF;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_STUFF_HERB;

		break;

	case EM_ItemType_Hunt            	: //獵物
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_STUFF;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_STUFF_FOOD;

		break;

	case EM_ItemType_Seed            	: //種子
	case EM_ItemType_Flowerpot       	: //花盆
	case EM_ItemType_Crop            	: //作物
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_STUFF;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_STUFF_OTHERSTUFF;
		break;

	case EM_ItemType_Fish            	: //魚
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_STUFF;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_STUFF_OTHERSTUFF;

		break;

	case EM_ItemType_Tool            	: //採集工具
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_SPECIAL;
		//TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_STUFF_OTHERSTUFF;
		break;

	case EM_ItemType_Recipe_BlackSmith   : //配方 打鐵
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_RECIPE;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_RECIPE_BLACKSMITH;
		break;
	case EM_ItemType_Recipe_Carpenter    : //配方 木工
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_RECIPE;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_RECIPE_CARPENTER;
		break;
	case EM_ItemType_Recipe_Armor     	: //配方 製甲		
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_RECIPE;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_RECIPE_ARMOR;
		break;
	case EM_ItemType_Recipe_Tailor     	: //配方 裁縫
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_RECIPE;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_RECIPE_TAILOR;
		break;
	case EM_ItemType_Recipe_Alchemy     	: //配方 煉金		
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_RECIPE;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_RECIPE_ALCHEMY;
		break;
	case EM_ItemType_Recipe_Cook     	: //配方 烹飪
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_RECIPE;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_RECIPE_COOK;
		break;

	case EM_ItemType_Stuff           	: //製造材料
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_STUFF;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_STUFF_OTHERSTUFF;
		break;

	case EM_ItemType_Jewel           	: //衝等寶石
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_POWERUP;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_POWERUP_REFINE;
		break;


	//補給品
    case EM_ItemType_Food            	: //食物
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_SUPPLIES;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_SUPPLIES_FOOD;
		break;
    case EM_ItemType_SweetFood       	: //甜食
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_SUPPLIES;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_SUPPLIES_SWEETFOOD;
		break;
    case EM_ItemType_Water           	: //藥水
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_SUPPLIES;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_SUPPLIES_MEDICINE;
		break;

	case EM_ItemType_Rune:						//符文
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_STUFF;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_STUFF_MANUFACTIRERUNE;
		break;
	case EM_ItemType_SpecialRune:				//特殊符文
//		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_RUNE;
//		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_RUNE_SPECIAL;
		break;

	case EM_ItemType_SummonHorse		: //招換座騎
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_RIDE;
		break;
	case EM_ItemType_Furniture:
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_HOUSE;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_HOUSE_FURNITURE;
		break;
	case EM_ItemType_SmeltStone:
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_POWERUP;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_POWERUP_SMELTSTONE;
		break;
	case EM_ItemType_Contract:
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_HOUSE;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_HOUSE_CONTRACT;
		break;
	case EM_ItemType_Study:
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_HOUSE;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_HOUSE_STUDY;
		break;
	case EM_ItemType_MagicStone:
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_POWERUP;
		TempObj->GameData.ACSearchType[1] = _DEF_ACSEARCHTYPE_POWERUP_SMELTSTONE;
		break;
	case EM_ItemType_Collection:
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_COLLECTION;
		break;
	default:
		TempObj->GameData.ACSearchType[0] = _DEF_ACSEARCHTYPE_OTHER;
		break;
	}

	//-----------------------------------------------------
	//限制設定
	//-----------------------------------------------------
	if( TempObj->GameData.Limit.Race._Race == 0 )
		TempObj->GameData.Limit.Race._Race = -1;

	if( TempObj->GameData.Limit.Sex._Sex == 0 )
		TempObj->GameData.Limit.Sex._Sex = -1;

	if( TempObj->GameData.Limit.Voc._Voc == 0 )
		TempObj->GameData.Limit.Voc._Voc = -1;

	if( TempObj->GameData.Limit.Level <= 0 )
		TempObj->GameData.Limit.Level = 1;

	//-----------------------------------------------------
	//物品設定裝備類型
	//-----------------------------------------------------
	TempObj->GameData.ItemEqType._Skill = -1;
	//-----------------------------------------------------
	//標準價計算
	if(		TempObj->GameData.Item.IsStandardCost 
		&&	TempObj->GameData.PricesType == EM_ACPriceType_GameMoney )
	{

		//-----------------------------------------------------
		//標準價計算
		int RLv = TempObj->GameData.Item.ReferenceLv;
		if( RLv > 200 )
			RLv = 200;
		if( RLv <= 1 )
			RLv = 1;
		float	StandardCost = float( RoleDataEx::StandardCostTable[ RLv -1 ] ) /10;

		TempObj->GameData.Cost = StandardCost;
	}
	TempObj->GameData.Item.Pet.Property = (MagicResistENUM)(TempObj->GameData.Item.Pet.Property -1 );
}

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

	_IsValueChange = false;

	if( CB_PricesType->SelectedIndex == 0 )
	{
		TB_SpecialMoneyCost->Visible = false;
	}
	else
	{
		TB_SpecialMoneyCost->Visible = true;
	}

}
//######################################################################################################
System::Void ItemForm::ChangeMode(System::Object *  sender, System::EventArgs *  e)
{
    CheckedListBox* CBox = static_cast<CheckedListBox*>(sender);

    ObjectModeStruct Mode;
    int TempMode[20];

    Mode._Mode = 0;
    Mode.Sell = 1;
    TempMode[0] = Mode._Mode;
    Mode._Mode = 0;
    Mode.Logoutdel = 1;
    TempMode[1] = Mode._Mode;
    Mode._Mode = 0;
    Mode.Expense = 1;
    TempMode[2] = Mode._Mode;
    Mode._Mode = 0;
    Mode.PickupBound = 1;
    TempMode[3] = Mode._Mode;
    Mode._Mode = 0;
	Mode.HideCount = 1;
	TempMode[4] = Mode._Mode;
	Mode._Mode = 0;
	Mode.ChangeZoneDel = 1;
	TempMode[5] = Mode._Mode;
	Mode._Mode = 0;
	Mode.PkNoDrop = 1;
	TempMode[6] = Mode._Mode;
	Mode._Mode = 0;
	Mode.DepartmentStore = 1;
	TempMode[7] = Mode._Mode;
	Mode._Mode = 0;
	Mode.DepartmentStore_Free = 1;
	TempMode[8] = Mode._Mode;
	Mode._Mode = 0;
	Mode.ItemDrop_AllParty = 1;
	TempMode[9] = Mode._Mode;
	Mode._Mode = 0;
	Mode.UseWithoutFail = 1;
	TempMode[10] = Mode._Mode;
	Mode._Mode = 0;
	Mode.ItemDrop_Depart = 1;
	TempMode[11] = Mode._Mode;
	Mode._Mode = 0;
	Mode.Unique = 1;
	TempMode[12] = Mode._Mode;
	Mode._Mode = 0;
	Mode.EnableLockedItem = 1;
	TempMode[13] = Mode._Mode;
	Mode._Mode = 0;
	Mode.AutoUseItem = 1;
	TempMode[14] = Mode._Mode;
	Mode._Mode = 0;
	Mode.DisableMagicBox = 1;
	TempMode[15] = Mode._Mode;
	Mode._Mode = 0;
	Mode.HideMaxHeap = 1;
	TempMode[16] = Mode._Mode;

    int Flag = 0;
    for( int i = CBox->Items->Count - 1 ; i >= 0 ; i -- )
    {

        if( CBox->GetItemChecked( i ) == true )
            Flag = Flag + TempMode[ i ];
    }

	if( _ObjDB.GameData.Mode._Mode == Flag )
		return;

	if( CB_Lock->Checked == true )
		_ObjDB.IsModify = true;

    _ObjDB.GameData.Mode._Mode = Flag;
}

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

void ItemForm::OnValueChange( )
{
	_IsValueChange = true;
	OnSelectObj( true );

	static ItemUseType_ENUM LastUseType = (ItemUseType_ENUM)-1;
	DB_GameObjDbStruct __pin * TempObj = &_ObjDB;
//	static int LMagic = 0;
//	if( LMagic == TempObj->GameData.Item.IncMagic_Onuse )
//		return;

//	LMagic = TempObj->GameData.Item.IncMagic_Onuse;

	LB_Inc_Magic->Text = SearchObjName( TempObj->GameData.Item.IncMagic_Onuse );
	LB_CardName->Text = SearchObjName( TempObj->GameData.Item.CardID );
	LB_PetObjName->Text = SearchObjName( TempObj->GameData.Item.Pet.PetObjID );
	LB_DropListPacket->Text = SearchObjName( TempObj->GameData.Item.DropListPacket );
	LB_CollectionNPC->Text = SearchObjName( TempObj->GameData.Item.CollectionNPC );
	
	
	if( LastUseType != TempObj->GameData.Item.UseType )
	{
		LastUseType = TempObj->GameData.Item.UseType;
		GB_Coloring->Visible = false;
		GB_UseItem->Visible = false;
		GB_EqRefine->Visible = false;
		GB_FixEq->Visible = false;
		PL_UseSrvScript->Visible = false;
		PL_UseCliScript->Visible = false;
		GB_DigHole->Visible	= false;
		GB_DropListPacket->Visible = false;
		PL_CollectionNPC->Visible = true;

		switch( TempObj->GameData.Item.UseType )
		{
		case EM_ItemType_SummonHorse:
		case EM_ItemUseType_Magic:
			GB_UseItem->Visible = true;
			break;
		case EM_ItemUseType_CliScript:
			GB_UseItem->Visible = true;
			PL_UseCliScript->Visible = true;
			break;
		case EM_ItemUseType_SrvScript:
			GB_UseItem->Visible = true;
			PL_UseSrvScript->Visible = true;
			break;

		case EM_ItemUseType_EqRefine:		//衝等
			GB_EqRefine->Visible = true;
			break;

		case EM_ItemUseType_FixEq:			//修裝
			GB_FixEq->Visible = true;
			break;
		case EM_ItemUseType_Coloring:		
			GB_Coloring->Visible = true;
			break;

		case EM_ItemUseType_EQDigHole:
			GB_DigHole->Visible	= true;
			break;
		case EM_ItemUseType_UnPacket_DropList:
			GB_DropListPacket->Visible = true;
			break;

		}
	}
	
	if( TempObj->GameData.Item.ItemType == EM_ItemType_Furniture )
		GB_Furniture->Visible	= true;
	else
		GB_Furniture->Visible	= false;


	//-----------------------------------------------------
	//標準價計算
	int RLv = DotNetStr::StringToInt( TB_ReferenceLv->Text );
	if( RLv > 200 )
		RLv = 200;
	if( RLv <= 1 )
		RLv = 1;
	float	StandardCost = float( RoleDataEx::StandardCostTable[ RLv -1 ] ) /10;

	TB_StandardCost->Text = String::Format( "{0}" , __box( int( StandardCost+0.5 ) ) );

	if(		TempObj->GameData.Item.IsStandardCost 
		&&	TempObj->GameData.PricesType == EM_ACPriceType_GameMoney )
	{
		//TB_Cost->Enabled = false;
	}
	else
	{
		//TB_Cost->Enabled = true;
	}

	char	Buf[256];
	ItemDropStruct* DropAbility = TempObj->GameData.Item.DropItemAbility;
	sprintf( Buf , "%.3f%%" , float( DropAbility[0].Rate ) / 1000 );
	DropAbilityEx1->Text = Buf;
	sprintf( Buf , "%.3f%%" , float( DropAbility[1].Rate ) / 1000 );
	DropAbilityEx2->Text = Buf;
	sprintf( Buf , "%.3f%%" , float( DropAbility[2].Rate ) / 1000 );
	DropAbilityEx3->Text = Buf;
	sprintf( Buf , "%.3f%%" , float( DropAbility[3].Rate ) / 1000 );
	DropAbilityEx4->Text = Buf;
	sprintf( Buf , "%.3f%%" , float( DropAbility[4].Rate ) / 1000 );
	DropAbilityEx5->Text = Buf;
	sprintf( Buf , "%.3f%%" , float( DropAbility[5].Rate ) / 1000 );
	DropAbilityEx6->Text = Buf;

	DropAbilityName1->Text = SearchObjName( DropAbility[0].OrgID );
	DropAbilityName2->Text = SearchObjName( DropAbility[1].OrgID );
	DropAbilityName3->Text = SearchObjName( DropAbility[2].OrgID );
	DropAbilityName4->Text = SearchObjName( DropAbility[3].OrgID );
	DropAbilityName5->Text = SearchObjName( DropAbility[4].OrgID );
	DropAbilityName6->Text = SearchObjName( DropAbility[5].OrgID );

	LB_RandSeedName->Text = SearchObjName( TempObj->GameData.Item.Plant.Seed.RandSeed );

}

System::Void ItemForm::SelectColorClick(System::Object*  sender, System::EventArgs*  e)
{
	if( colorDialog1->ShowDialog() == ::DialogResult::OK )
	{
		unsigned ColorValue = colorDialog1->Color.A * 0x1000000 + colorDialog1->Color.R * 0x10000 + colorDialog1->Color.G * 0x100 + colorDialog1->Color.B;
		TextBox* tBox = static_cast<TextBox*>(sender);
		tBox->Text = String::Format( "0x{0:x}" , __box( ColorValue ) );
	};
}