local T_TreeInstance ={
	MainNum = 4,
	[0]={
		Type = 0,
		MainName = "STR_CHALLENGE_COLUMN_1",
		SubNum = 4,
		[0]={
			Type=5,
			SubName = "STR_CHALLENGE_COLUMN_SUB2_5",
		},
		[1]={
			Type=1,
			SubName = "STR_CHALLENGE_COLUMN_SUB2_1"
		},
		[2]={
			Type=6,
			SubName = "STR_CHALLENGE_COLUMN_6"
		},
		[3]={
			Type=10,
			SubName = "STR_CHALLENGE_COLUMN_SUB2_7",
		},
	},
	[1]={
		Type=2,
		MainName = "STR_CHALLENGE_COLUMN_2", 
	},
	[2]={
		Type=0,
		MainName = "STR_CHALLENGE_COLUMN_5",
		SubNum = 3,
		[0]={
			Type=11,
			SubType=0,
			SubName = "STR_CHALLENGE_COLUMN_SUB5_1",
		},
		[1]={
			Type=11,
			SubType=1,
			SubName = "STR_CHALLENGE_COLUMN_SUB5_2",
		},
		[2]={
			Type=11,
			SubType=2,
			SubName = "STR_CHALLENGE_COLUMN_SUB5_3",
		},
		
	},
	[3] = {
		Type = 12,
		MainName = "STR_CHALLENGE_COLUMN_SURVIVOR",
	},
}

local T_TreeInstance_Passion ={
	MainNum = 3,
	[0]={
		Type = 0,
		MainName = "STR_CHALLENGE_COLUMN_1",
		SubNum = 4,
		[0]={
			Type=5,
			SubName = "STR_CHALLENGE_COLUMN_SUB2_5",
		},
		[1]={
			Type=1,
			SubName = "STR_CHALLENGE_COLUMN_SUB2_1"
		},
		[2]={
			Type=6,
			SubName = "STR_CHALLENGE_COLUMN_6"
		},
		[3]={
			Type=10,
			SubName = "STR_CHALLENGE_COLUMN_SUB2_6",
		},
	},
	[1]={
		Type=0,
		MainName = "STR_CHALLENGE_COLUMN_5",
		SubNum = 3,
		[0]={
			Type=11,
			SubType=0,
			SubName = "STR_CHALLENGE_COLUMN_SUB5_1",
		},
		[1]={
			Type=11,
			SubType=1,
			SubName = "STR_CHALLENGE_COLUMN_SUB5_2",
		},
		[2]={
			Type=11,
			SubType=2,
			SubName = "STR_CHALLENGE_COLUMN_SUB5_3",
		},
		
	},
	[2] = {
		Type = 12,
		MainName = "STR_CHALLENGE_COLUMN_SURVIVOR",
	},
}

local T_TreeInstance_New = {
	MainNum = 3,
	[0]={
		Type = 0,
		MainName = "STR_CHALLENGE_COLUMN_1",
		SubNum = 4,
		[0]={
			Type=5,
			SubName = "STR_CHALLENGE_COLUMN_SUB2_5",
		},
		[1]={
			Type=1,
			SubName = "STR_CHALLENGE_COLUMN_SUB2_1"
		},
		[2]={
			Type=6,
			SubName = "STR_CHALLENGE_COLUMN_6"
		},
		[3]={
			Type=10,
			SubName = "STR_CHALLENGE_COLUMN_SUB2_7",
		},
	},
	[1]={
		Type=0,
		MainName = "STR_CHALLENGE_COLUMN_5",
		SubNum = 3,
		[0]={
			Type=11,
			SubType=0,
			SubName = "STR_CHALLENGE_COLUMN_SUB5_1",
		},
		[1]={
			Type=11,
			SubType=1,
			SubName = "STR_CHALLENGE_COLUMN_SUB5_2",
		},
		[2]={
			Type=11,
			SubType=2,
			SubName = "STR_CHALLENGE_COLUMN_SUB5_3",
		},
		
	},
	[2] = {
		Type = 12,
		MainName = "STR_CHALLENGE_COLUMN_SURVIVOR",
	},
}

local T_TreeInstance_OldSoldier ={
	MainNum = 0,
	
	[0]={
		Type=2,
		MainName = "STR_CHALLENGE_COLUMN_2", 
	},
}


local T_InstanceEntrance ={
	Normal = 1,
	Passion = 1,
	New = 1,
	OldSoldier = 1,
}

local function GetTreeInstance(Index, Key, Value)
	local f = nil
	if(UserData_IsPassionServer() == true) then
		f=T_TreeInstance_Passion
	elseif(UserData_IsOldSoldierServer() == true) then
		f=T_TreeInstance_OldSoldier
	elseif(UserData_IsCoinsServer() == true) then
		f=T_TreeInstance_OldSoldier
	elseif (UserData_IsNewServer() == true) then
		f=T_TreeInstance_New
	else
		f=T_TreeInstance
	end 
	
	if(Value == nil) then
		local Temp = f[Index][Key]
		if(Temp ~= nil) then
			return Temp
		end
	else
		local Temp = f[Index][Key][Value]
		if(Temp ~= nil) then
			return Temp
		end
	end

	return 0
end


local function GetEntranceLevel()
	local Level = 120
	if(UserData_IsPassionServer() == true) then
		Level=T_InstanceEntrance.Passion
	elseif(UserData_IsOldSoldierServer() == true) then
		Level=T_InstanceEntrance.OldSoldier
	elseif(UserData_IsCoinsServer() == true) then
		Level=T_InstanceEntrance.OldSoldier
	elseif (UserData_IsNewServer() == true) then
		Level=T_InstanceEntrance.New
	else
		Level=T_InstanceEntrance.Normal
	end 
	
	return Level
end


local function GetTreeCount()
	if(UserData_IsPassionServer() == true) then
		return T_TreeInstance_Passion.MainNum
	elseif(UserData_IsNewServer() == true)  then
		return T_TreeInstance_New.MainNum
	elseif(UserData_IsOldSoldierServer() == true) then
		return T_TreeInstance_OldSoldier.MainNum
	elseif(UserData_IsCoinsServer() == true) then
		return T_TreeInstance_OldSoldier.MainNum
	else
		return T_TreeInstance.MainNum
	end 
end



local ChallengeBoss = {
	GetTreeInstance = GetTreeInstance,
	GetTreeCount = GetTreeCount,
	GetEntranceLevel = GetEntranceLevel,
}

ChallengeBoss_GetTreeInstance = ChallengeBoss.GetTreeInstance
ChallengeBoss_GetTreeCount = ChallengeBoss.GetTreeCount
ChallengeBoss_GetEntranceLevel = ChallengeBoss.GetEntranceLevel

return ChallengeBoss
