#include "StdAfx.h"
#include "Global.h"
#include "SelectAbilityForm.h"
#include <stdio.h>
#include "DotNetString.h"

using namespace ObjDataEdit;


void SelectAbilityForm::Init( )
{
	g_SelectAbilityForm = new SelectAbilityForm;
	g_SelectAbilityForm->CB_SelectType->SelectedIndex = 3;	
}

void SelectAbilityForm::ShowForm( )
{
	_IsAccept = false;
	this->ShowDialog();
}

bool	SelectAbilityForm::IsAccept( )
{
	return _IsAccept;
}

int		SelectAbilityForm::SelectID( )
{
	if( _IsAccept == false )
		return -1;
	if( _SubIDList->size() <= LB_SelectSubType->SelectedIndex )
		return -1;

	return (*_SubIDList)[ LB_SelectSubType->SelectedIndex ];
}

void	SelectAbilityForm::UpdateInfo( )
{
	static int LSelectTypeID = -1;
	int SelectTypeID = CB_SelectType->SelectedIndex;

	if( LSelectTypeID == SelectTypeID )
		return;

	_SubIDList->clear();

	switch( SelectTypeID )
	{
	case 0://五大屬性
		{
			_SubIDList->push_back( EM_WearEqType_None      );
			_SubIDList->push_back( EM_WearEqType_STR       );
			_SubIDList->push_back( EM_WearEqType_STA       );
			_SubIDList->push_back( EM_WearEqType_INT       );
			_SubIDList->push_back( EM_WearEqType_MND       );
			_SubIDList->push_back( EM_WearEqType_AGI       );
			_SubIDList->push_back( EM_WearEqType_AllState  );

			_SubIDList->push_back( EM_WearEqType_STR_Rate       );
			_SubIDList->push_back( EM_WearEqType_STA_Rate       );
			_SubIDList->push_back( EM_WearEqType_INT_Rate       );
			_SubIDList->push_back( EM_WearEqType_MND_Rate       );
			_SubIDList->push_back( EM_WearEqType_AGI_Rate       );
			_SubIDList->push_back( EM_WearEqType_AllState_Rate  );
		}						    
		break;
	case 1://上限提升
		{
			_SubIDList->push_back( EM_WearEqType_MaxHP     	);
			_SubIDList->push_back( EM_WearEqType_MaxMP     	);
			_SubIDList->push_back( EM_WearEqType_MaxHP_Rate );
			_SubIDList->push_back( EM_WearEqType_MaxMP_Rate );
		}
		break;
	case 2://回復率
		{
			_SubIDList->push_back( EM_WearEqType_ReHP     			);
			_SubIDList->push_back( EM_WearEqType_ReMP     			);
			_SubIDList->push_back( EM_WearEqType_ReSP_Per_Warrior	);
			_SubIDList->push_back( EM_WearEqType_ReSP_Per_Ranger	);
			_SubIDList->push_back( EM_WearEqType_ReSP_Per_Rogue		);

		}
		break;
	case 3://近戰強化
		{
			_SubIDList->push_back( EM_WearEqType_ATK				);
			_SubIDList->push_back( EM_WearEqType_DEF				);
			_SubIDList->push_back( EM_WearEqType_HitPoint			);
			_SubIDList->push_back( EM_WearEqType_DodgePoint			);
			_SubIDList->push_back( EM_WearEqType_PhyHitRate			);
			_SubIDList->push_back( EM_WearEqType_PhyDodgeRate		);

			_SubIDList->push_back( EM_WearEqType_CritRate			);
			_SubIDList->push_back( EM_WearEqType_CritPower			);
			_SubIDList->push_back( EM_WearEqType_ParryRate     		);
			_SubIDList->push_back( EM_WearEqType_ParryRate_Per 		);
			_SubIDList->push_back( EM_WearEqType_ShieldBlockRate	);
			_SubIDList->push_back( EM_WearEqType_DMG           		);
			_SubIDList->push_back( EM_WearEqType_DMG_Per       		);
			_SubIDList->push_back( EM_WearEqType_SecHand_HitRate	);
			_SubIDList->push_back( EM_WearEqType_SecHand_DMG_Per	);
			_SubIDList->push_back( EM_WearEqType_ATK_Per			);
			_SubIDList->push_back( EM_WearEqType_DEF_Per			);
			_SubIDList->push_back( EM_WearEqType_ResistCritRate		);
			_SubIDList->push_back( EM_WearEqType_ResistShieldBlock	);
			_SubIDList->push_back( EM_WearEqType_ResistParry		);
			_SubIDList->push_back( EM_WearEqType_SP_Warrior_Consume	);
			_SubIDList->push_back( EM_WearEqType_SP_Rogue_Consume	);
			_SubIDList->push_back( EM_WearEqType_SP_Ranger_Consume	);

		}
		break;
	case 4://魔法強化
		{
			_SubIDList->push_back( EM_WearEqType_MDMG				);
			_SubIDList->push_back( EM_WearEqType_MDEF				);
			_SubIDList->push_back( EM_WearEqType_MATK				);
			_SubIDList->push_back( EM_WearEqType_MDMG_Per			);
			
			_SubIDList->push_back( EM_WearEqType_MDEF_Rate			);
			_SubIDList->push_back( EM_WearEqType_MATK_Rate			);

			_SubIDList->push_back( EM_WearEqType_MagicCritRate		);
			_SubIDList->push_back( EM_WearEqType_MagicCritPower		);
			_SubIDList->push_back( EM_WearEqType_ManaDecrease		);
			_SubIDList->push_back( EM_WearEqType_MagicPow_AllMagic	);
			_SubIDList->push_back( EM_WearEqType_MagicPow_Earth  	);
			_SubIDList->push_back( EM_WearEqType_MagicPow_Water  	);
			_SubIDList->push_back( EM_WearEqType_MagicPow_Fire   	);
			_SubIDList->push_back( EM_WearEqType_MagicPow_Wind   	);
			_SubIDList->push_back( EM_WearEqType_MagicPow_Light  	);
			_SubIDList->push_back( EM_WearEqType_MagicPow_Darkness	);
			_SubIDList->push_back( EM_WearEqType_MDmgPoint			);
			_SubIDList->push_back( EM_WearEqType_HealPowerRate		);
			_SubIDList->push_back( EM_WearEqType_HealPoint			);
			_SubIDList->push_back( EM_WearEqType_ResistMagicCritRate);
			_SubIDList->push_back( EM_WearEqType_MagicHitPoint		);
			_SubIDList->push_back( EM_WearEqType_MagicDodgePoint	);
			_SubIDList->push_back( EM_WearEqType_MagicHitRate		);
			_SubIDList->push_back( EM_WearEqType_MagicDodgeRate		);
			
		}
		break;
	case 5://抗性強化
		{
			_SubIDList->push_back( EM_WearEqType_AllResist     		);
			_SubIDList->push_back( EM_WearEqType_Resist_Earth  		);
			_SubIDList->push_back( EM_WearEqType_Resist_Water  		);
			_SubIDList->push_back( EM_WearEqType_Resist_Fire   		);
			_SubIDList->push_back( EM_WearEqType_Resist_Wind   		);
			_SubIDList->push_back( EM_WearEqType_Resist_Light  		);
			_SubIDList->push_back( EM_WearEqType_Resist_Darkness	);
			_SubIDList->push_back( EM_WearEqType_AllResist_Per 		);
			_SubIDList->push_back( EM_WearEqType_Resist_Earth_Per  	);
			_SubIDList->push_back( EM_WearEqType_Resist_Water_Per  	);
			_SubIDList->push_back( EM_WearEqType_Resist_Fire_Per   	);
			_SubIDList->push_back( EM_WearEqType_Resist_Wind_Per   	);
			_SubIDList->push_back( EM_WearEqType_Resist_Light_Per  	);
			_SubIDList->push_back( EM_WearEqType_Resist_Darkness_Per);
		}
		break;
	case 6://特殊類
		{
			_SubIDList->push_back( EM_WearEqType_Durable					);
			_SubIDList->push_back( EM_WearEqType_Exp						);
			_SubIDList->push_back( EM_WearEqType_Exp_SubJob					);
			_SubIDList->push_back( EM_WearEqType_TP_Rate					);
			_SubIDList->push_back( EM_WearEqType_Treasure					);
			_SubIDList->push_back( EM_WearEqType_StealRate					);
			_SubIDList->push_back( EM_WearEqType_DropMoneyRate				);
			_SubIDList->push_back( EM_WearEqType_HateRate					);
			_SubIDList->push_back( EM_WearEqType_RangeAttackRange			);
			_SubIDList->push_back( EM_WearEqType_AttackRange				);
			_SubIDList->push_back( EM_WearEqType_SkillValue_GatherRate		);
			_SubIDList->push_back( EM_WearEqType_Gravity					);
			_SubIDList->push_back( EM_WearEqType_JumpRate					);
			_SubIDList->push_back( EM_WearEqType_DoubleAttack				);
			_SubIDList->push_back( EM_WearEqType_AddPlotExpRate				);
			_SubIDList->push_back( EM_WearEqType_AddPlotTPRate				);
			_SubIDList->push_back( EM_WearEqType_NPC_EXP_Rate				);
			_SubIDList->push_back( EM_WearEqType_NPC_TP_Rate				);
			_SubIDList->push_back( EM_WearEqType_Daily_EXP_Rate				);
			_SubIDList->push_back( EM_WearEqType_Daily_TP_Rate				);


		}
		break;
	case 7://裝甲強化
		{
			_SubIDList->push_back( EM_WearEqType_DEF_HeavyArmed	);
			_SubIDList->push_back( EM_WearEqType_DEF_LightArmed	);
			_SubIDList->push_back( EM_WearEqType_DEF_Leather	);
			_SubIDList->push_back( EM_WearEqType_DEF_Clothes	);
			_SubIDList->push_back( EM_WearEqType_DEF_Robe		);
			_SubIDList->push_back( EM_WearEqType_DEF_Shield		);
		}
		break;
	case 8://武器強化
		{
			_SubIDList->push_back( EM_WearEqType_DMG_AllRange	);
			_SubIDList->push_back( EM_WearEqType_DMG_Bow		);
			_SubIDList->push_back( EM_WearEqType_DMG_Cossbow	);
			_SubIDList->push_back( EM_WearEqType_DMG_Gun		);
			_SubIDList->push_back( EM_WearEqType_DMG_AllWeapon	);
			_SubIDList->push_back( EM_WearEqType_DMG_Unarmed	);
			_SubIDList->push_back( EM_WearEqType_DMG_Blade     	);
			_SubIDList->push_back( EM_WearEqType_DMG_Dagger    	);
			_SubIDList->push_back( EM_WearEqType_DMG_Wand      	);
			_SubIDList->push_back( EM_WearEqType_DMG_Axe       	);
			_SubIDList->push_back( EM_WearEqType_DMG_Bludgeon  	);
			_SubIDList->push_back( EM_WearEqType_DMG_Claymore  	);
			_SubIDList->push_back( EM_WearEqType_DMG_Staff     	);
			_SubIDList->push_back( EM_WearEqType_DMG_2H_Axe    	);
			_SubIDList->push_back( EM_WearEqType_DMG_2H_Hammer 	);
			_SubIDList->push_back( EM_WearEqType_DMG_Polearm	);

			_SubIDList->push_back( EM_WearEqType_Magic_EarthPower	);
			_SubIDList->push_back( EM_WearEqType_Magic_WaterhPower	);
			_SubIDList->push_back( EM_WearEqType_Magic_FirePower	);
			_SubIDList->push_back( EM_WearEqType_Magic_WindhPower	);
			_SubIDList->push_back( EM_WearEqType_Magic_LightPower	);
			_SubIDList->push_back( EM_WearEqType_Magic_DarkPower	);

		}
		break;
	case 9://武器速度強化
		{
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_AllRange	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Bow		);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Cossbow	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Gun		);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_AllWeapon	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Unarmed	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Blade     	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Dagger    	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Wand      	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Axe       	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Bludgeon  	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Claymore  	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Staff     	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_2H_Axe    	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_2H_Hammer 	);
			_SubIDList->push_back( EM_WearEqType_AttackSpeed_Polearm	);
		}
		break;
	case 10://裝備能力
		{
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Unarmed 		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Blade   		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Dagger  		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Wand    		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Axe     		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Bludgeon		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Claymore		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Staff   		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Axe_2H  		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Hammer_2H	);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Polearm		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Bow			);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_CossBow		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Gun			);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Throw		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_HeavyArmed	);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_LightArmed	);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Leather		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Clothes		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Robe			);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Shield		);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_Implement	);
			_SubIDList->push_back( EM_WearEqType_WearEqAbility_SecondHand	);
		}
		break;
	case 11://技能提升
		{
			_SubIDList->push_back( EM_WearEqType_SkillValue_Unarmed		);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Blade      	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Dagger     	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Wand       	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Axe        	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Bludgeon   	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Claymore   	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Staff      	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_2H_Axe     	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_2H_Hammer  	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Polearm		);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Bow			);
			_SubIDList->push_back( EM_WearEqType_SkillValue_CossBow		);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Gun			);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Define		);
			_SubIDList->push_back( EM_WearEqType_SkillValue_BlackSmith	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Carpenter	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_MakeArmor	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Tailor		);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Cook		);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Alchemy		);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Lumbering	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Herbalism	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Mining		);
			_SubIDList->push_back( EM_WearEqType_SkillValue_Fishing		);


			_SubIDList->push_back( EM_WearEqType_SkillValue_GatherRate		);
			_SubIDList->push_back( EM_WearEqType_SkillValue_LumberingRate	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_HerbalismRate	);
			_SubIDList->push_back( EM_WearEqType_SkillValue_MiningRate		);
			_SubIDList->push_back( EM_WearEqType_SkillValue_FishingRate		);
			
		}
		break;
	case 12://HQ機率
		{
			_SubIDList->push_back( EM_WearEqType_HQ_BlackSmith	);
			_SubIDList->push_back( EM_WearEqType_HQ_Carpenter	);
			_SubIDList->push_back( EM_WearEqType_HQ_MakeArmor	);
			_SubIDList->push_back( EM_WearEqType_HQ_Tailor		);
			_SubIDList->push_back( EM_WearEqType_HQ_Cook		);
			_SubIDList->push_back( EM_WearEqType_HQ_Alchemy		);
		}
		break;
	case 13://吸收值
		{
			_SubIDList->push_back( EM_WearEqType_MAbsorbRate    );
			_SubIDList->push_back( EM_WearEqType_AbsorbRate		);
			_SubIDList->push_back( EM_WearEqType_HealAbsorbRate	);
			_SubIDList->push_back( EM_WearEqType_MAbsorb		);
			_SubIDList->push_back( EM_WearEqType_Absorb			);
			_SubIDList->push_back( EM_WearEqType_HealAbsorb		);
		}
		break;
	case 14://速度強化
		{
			_SubIDList->push_back( EM_WearEqType_AtkSpeed		);
			_SubIDList->push_back( EM_WearEqType_MoveSpeed		);
			_SubIDList->push_back( EM_WearEqType_RideSpeed		);
			_SubIDList->push_back( EM_WearEqType_SpellSpeed_AllMagic);
		}
		break;
	case 15://其他
		{
			_SubIDList->push_back( EM_WearEqType_AttackPlayerPowerRate	);
			_SubIDList->push_back( EM_WearEqType_AttackNPCPowerRate		);
			_SubIDList->push_back( EM_WearEqType_PlayerDefRate			);
			_SubIDList->push_back( EM_WearEqType_NPCDefRate				);
			_SubIDList->push_back( EM_WearEqType_AEMagicPowerRate		);
			_SubIDList->push_back( EM_WearEqType_AEMagicDefRate			);
			_SubIDList->push_back( EM_WearEqType_GatherGenerateRate		);
			_SubIDList->push_back( EM_WearEqType_GatherSpeedRate		);
			_SubIDList->push_back( EM_WearEqType_GatherExpRate			);
			_SubIDList->push_back( EM_WearEqType_CraftSpeedRate			);
			_SubIDList->push_back( EM_WearEqType_CraftExpRate			);
		}
		break;
	}
	
	LB_SelectSubType->Items->Clear();
	for( unsigned i = 0 ; i < _SubIDList->size() ; i++ )
	{
		String* Str = GameObjDbStructEx::GetWearEqTypeENUMString( (WearEqTypeENUM)(*_SubIDList)[i] );
		LB_SelectSubType->Items->Add( Str );
	}
	
	LB_SelectSubType->SelectedIndex = 0;
}

System::Void SelectAbilityForm::SelectAbilityForm_Load(System::Object*  sender, System::EventArgs*  e)
{
	
}
System::Void SelectAbilityForm::Click_OK_Event(System::Object*  sender, System::EventArgs*  e)
{
	if( LB_SelectSubType->SelectedIndex >= 0 )
	{
		_IsAccept = true;
		Close();
	}
}

System::Void SelectAbilityForm::Click_Cancel_Event(System::Object*  sender, System::EventArgs*  e)
{
	_IsAccept = false;
	Close();
}

System::Void SelectAbilityForm::CB_SelectType_SelectedIndexChanged(System::Object*  sender, System::EventArgs*  e)
{
	UpdateInfo();
}