#pragma once
#include "ObjectStruct.h"
#include "ReaderClass/ReaderClass.h"
//----------------------------------------------------------------------------------------
struct	DB_GameObjDbIndexStruct
{   
	int     GUID;
	char    Name[32];
	int     ImageID;
	char	FuncName[32];
	char	DataGroup[32];
};
//----------------------------------------------------------------------------------------
struct DBProcRateStruct
{
	union
	{
		int Rate;
		struct
		{
			int SetDataOK   :1;
			int Set2DOK     :1;
			int Set3DOK     :1;
			int SetTextureOK:1;
			int TestOK      :1;
		};
	};    
};
//----------------------------------------------------------------------------------------
//劇情用資料
//----------------------------------------------------------------------------------------
struct DB_ScriptDBStruct
{
	int     Type;
	char    Script[8192];
	char    Name[64];
	char    Arg[128];
};
//----------------------------------------------------------------------------------------
//DB的游戲資料結構
//----------------------------------------------------------------------------------------
struct	DB_GameObjDbStruct
{   
	short   IsLock;
	short   IsModify;

	char    LastModifyDate[32];
	char    LastModifyAccount[32];
	char    LockAccount[32];
	char	DataGroup[ 32 ];//物件名稱

	int     Zone[3];      //所在區域

	DBProcRateStruct    ProcRate;


	DB_ScriptDBStruct ScriptInfo;

	GameObjDbStruct GameData;

	void Init(){ }
};
//----------------------------------------------------------------------------------------

struct	GameObjDbStructEx : public GameObjDbStruct
{
    //-----------------------------------------------------------------------------------------------
    //共用涵式
    bool IsEmpty( );

	bool IsNPC();
	bool IsQuestNPC();
    bool IsItem();
	bool IsItem_Pure();
    bool IsWeapon();
    bool IsArmor();
    bool IsKeyItem();
    bool IsMine();
    bool IsMagicBase();
	bool IsMagicCollect();
    bool IsShop();
	bool IsAttribute();
	bool IsFlagObj();
	bool IsRune();
	bool IsSuit();
	bool IsQuest();
	bool IsBody();
	bool IsImage();
	bool IsLearnMagic();
	bool IsPlayer();
	bool IsTitle();
	bool IsRecipe();
	bool IsTreasure();

	bool IsEquip();
	bool IsRestore();
	bool IsSpecial();
	//-----------------------------------------------------------------------------------------------
	//是輔助法術
	bool IsAssistMagic( );
	
	//-----------------------------------------------------------------------------------------------
	//檢查裝置能力與技能是否相符
	bool	CheckItemAndEqSkill( EqWearSkillStruct EqSkill );

    //-----------------------------------------------------------------------------------------------
    //取得此物件初始 Mode 設定
    ObjectModeStruct  GetModeFlag();

    //-----------------------------------------------------------------------------------------------
	static  char*	GetWearEqTypeENUMString( WearEqTypeENUM ID );	
	static	char*	GetWearEqTypeENUMNegativeString( WearEqTypeENUM ID );
	static	char*	GetWearEqTypeENUMPositiveString( WearEqTypeENUM ID );
	static	char*	GetWeaponTypeENUMString( GameObjectWeaponENUM Type );
	static	char*	GetWeaponPosENUMString( GameObjectWeaponPosENUM Pos );
	static	char*	GetArmorTypeENUMString( GameObjectArmorENUM Type );	
	static	char*	GetArmorPosENUMString( GameObjectArmorPosENUM Pos );
	static	char*	GetItemTypeENUMString( ItemType_ENUM Type );
	static	int		GetWearEqValue( GameObjectWearEqStruct& Ability, WearEqTypeENUM Type, int begin=0 );
	static	int		GetWeaponDMG( GameObjectWearEqStruct& Ability );
	static	int		GetArmorDEF( GameObjectWearEqStruct& Ability );
	static	int		GetWeaponAtkSpeed( GameObjectWearEqStruct& Ability );
	static	int		GetWearEqDurable( GameObjectWearEqStruct& Ability );
	static	char*	GetAddOnPosENUMString( AddonPosENUM& AddOnPos );

	//-----------------------------------------------------------------------------------------------
	//-----------------------------------------------------------------------------------------------
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_AddPower( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Armor( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Body( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Flag( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Image( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Item( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_KeyItem( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_LearnMagic( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_MagicBase( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Mine( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_NPC( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Player( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_QuestDetail( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_QuestNPC( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Recipe( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Rune( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Script( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Shop( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Suit( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Title( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Weapon( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Camp( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_Treasure( );
	static ReaderClass< DB_GameObjDbStruct >* ObjReader_MagicCollect( );
	
	//-----------------------------------------------------------------------------------------------
};