-- 恶魔果实相关配置

-- 技能栏
local MagicQuick = {
	[0] = {
		-- 未开启时候的提示
		["Tip"] = "Get Thunder Nut to unlock",
	},
	[1] = {
		-- 未开启时候的提示
		["Tip"] = "Get Frozen Nut to unlock",
	},
	[2] = {
		-- 未开启时候的提示
		["Tip"] = "Get Lava Nut to unlock",
	},
}

local tRuneLevel = {}
	tRuneLevel["Max"] = "Max"
	tRuneLevel["Level"] = "STR_INI_LUA_DEVILFRUIT_RUNELEVEL"
	
local tRuneTips = {}
	tRuneTips[-1] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_0",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_0",["splitTip"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_SPLITTIP_0",}
	tRuneTips[1] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_1",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_1",}
	tRuneTips[2] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_2",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_2",}
	tRuneTips[3] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_3",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_3",}
	tRuneTips[5] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_4",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_4",}
	tRuneTips[6] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_5",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_5",}
	tRuneTips[7] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_6",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_6",}
	tRuneTips[8] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_7",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_7",}
	tRuneTips[9] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_8",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_8",}
	tRuneTips[10] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_9",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_9",}
	tRuneTips[11] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_10",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_10",}
	tRuneTips[12] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_11",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_11",}
	tRuneTips[13] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_12",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_12",}
	tRuneTips[14] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_13",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_13",}
	tRuneTips[15] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_14",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_14",}
	tRuneTips[16] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_15",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_15",}
	tRuneTips[17] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_16",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_16",}
	tRuneTips[18] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_17",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_17",}
	tRuneTips[19] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_18",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_18",}
	tRuneTips[20] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_19",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_19",}
	tRuneTips[21] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_20",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_20",}
	tRuneTips[22] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_21",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_21",}
	tRuneTips[23] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_22",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_22",}
	tRuneTips[24] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_23",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_23",}
	tRuneTips[25] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_24",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_24",}
	tRuneTips[26] = {["name"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_NAME_25",["desc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_DESC_25",}
	
local tRuneScore = {}
	tRuneScore[0] = 50
	tRuneScore[1] = 100
	tRuneScore[2] = 150
	tRuneScore[3] = 200
	tRuneScore[4] = 250
	tRuneScore[5] = 300
	tRuneScore[6] = 350
	tRuneScore[7] = 400
	tRuneScore[8] = 450
	tRuneScore[9] = 600
	
-- 果实符文信息表
--基础信息（属性类型，属性值，评分，精修值，类型，等级，升级经验，升级花费，碎片）在daoqi_dict_type.dat里面
local RuneInfo= {
	--用于默认显示
	[-1] = {
		["image"]="PirateJX_FWspty",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
	},

	--dict_type为1007的符文信息.
	[1] = {
		["image"]="PirateJX_FW10",--符文图片
		["effect"]="PirateJX_ui9",---装备光效,专属符文才有
		--读取的技能type
		["Magic"] = {21510,21670},
		--对应读取的字段名称
		["Name"] = {{"range","status_data1","power"},{"percent","status_data0"}},
		--需要与Name个数匹配，0不转换，1伤害转换（30XXX这种的），2万分比转换，3将数值对1000求余，4将数值对1000整除，5千分比转换，6将数值对1000求余在转换千分比，7将数值对100求余
		["Damage"] = {{0,1,1},{0,0}},
	},
	--dict_type为2007的符文信息.
	[2] = {
		["image"]="PirateJX_FW11",--符文图片
		["effect"]="PirateJX_ui9",---装备光效,专属符文才有
		["Magic"] = {21520},
		["Name"] = {{"power"}},
		["Damage"] = {{2}},
	},

	--dict_type为3007的符文信息.
	[3] = {
		["image"]="PirateJX_FW5",--符文图片
		["effect"]="PirateJX_ui9",---装备光效,专属符文才有
		["Magic"] = {21530,22110},
		["Name"] = {{"range","distance","status_data0","power","status_data1","status_data2","step_secs"},{"percent","percent"}},
		["Damage"] = {{0,0,1,1,2,2,0},{3,4}},
	},
	-- dict_type为5007的符文信息.
	[5] = {
		["image"]="PirateJX_FW27",--符文图片
		["effect"]="PirateJX_ui7",---装备光效,专属符文才有
		["Magic"] = {21550},
		["Name"] = {{"status_data0"}},
		["Damage"] = {{0}},
	},
	--dict_type为6007的符文信息.
	[6] = {
		["image"]="PirateJX_FW2",--符文图片
		["effect"]="PirateJX_ui7",---装备光效,专属符文才有
		["Magic"] = {21560,22090},
		["Name"] = {{"range","status_data1","power","width","status_data0","status_data0"},{"percent","percent"}},
		["Damage"] = {{0,1,1,7,3,4},{3,4}},
	},
	--dict_type为7007的符文信息.
	[7] = {
		["image"]="PirateJX_FW7",--符文图片
		["effect"]="PirateJX_ui7",---装备光效,专属符文才有
		["Magic"] = {21570,21680},
		["Name"] = {{"range","status_data2","status_data1","power","status_data0"},{"percent"}},
		["Damage"] = {{0,0,1,1,0},{0}},
	},

	--dict_type为8007的符文信息.
	[8] = {
		["image"]="PirateJX_FW1",--符文图片
		["effect"]="PirateJX_ui7",---装备光效,专属符文才有
		["Magic"] = {21580,22100},
		["Name"] = {{"range","distance","status_data1","power","step_secs"},{"percent","percent"}},
		["Damage"] = {{0,0,1,1,6},{3,4}},
	},
	--dict_type为43007的符文信息.
	[9] = {
		["image"]="PirateJX_FW9",--符文图片
		["effect"]="PirateJX_ui8",---装备光效,专属符文才有
		["Magic"] = {21590},
		["Name"] = {{"power"}},
		["Damage"] = {{2}},
	},
	--dict_type为45007的符文信息.
	[10] = {
		["image"]="PirateJX_FW4",--符文图片
		["effect"]="PirateJX_ui8",---装备光效,专属符文才有
		["Magic"] = {21600,21690},
		["Name"] = {{"range","status_data0","power"},{"percent","percent"}},
		["Damage"] = {{0,1,1},{3,4}},
	},
	--dict_type为11007的符文信息.
	[11] = {
		["image"]="PirateJX_FW12",--符文图片
		["effect"]="PirateJX_ui8",---装备光效,专属符文才有
		["Magic"] = {21610,22080},
		["Name"] = {{"range","status_data0","power"},{"status_data1","percent"}},
		["Damage"] = {{0,1,1},{0,0}},
	},
	--dict_type为12007的符文信息.
	[12] = {
		["image"]="PirateJX_FW8",--符文图片
		["effect"]="PirateJX_ui8",---装备光效,专属符文才有
		["Magic"] = {21620,22070},
		["Name"] = {{"range","range","status_data0","power"},{"status_data1","percent"}},
		["Damage"] = {{0,0,1,1},{0,0}},
	},
	
	--dict_type为13007的符文信息.
	[13] = {
		["image"]="PirateJX_FW25",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21630},
		["Name"] = {{"power","step_secs"}},
		["Damage"] = {{2,0}},
	},
	--dict_type为14007的符文信息.
	[14] = {
		["image"]="PirateJX_FW23",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21640},
		["Name"] = {{"range","distance","status_data0","power","status_data2","step_secs"}},
		["Damage"] = {{0,0,1,1,0,0}},
	},
	--dict_type为15007的符文信息.
	[15] = {
		["image"]="PirateJX_FW24",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21650},
		["Name"] = {{"range","range","status_data0","power"}},
		["Damage"] = {{0,0,1,1}},
	},
	--dict_type为16007的符文信息.
	[16] = {
		["image"]="PirateJX_FW22",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21660,21700},
		["Name"] = {{"range","distance","status_data1","power"},{"percent","status_data0"}},
		["Damage"] = {{0,0,1,1},{0,0}},
	},
	--dict_type为17007的符文信息.
	[17] = {
		["image"]="PirateJX_FW15",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21730},
		["Name"] = {{"percent","power","step_secs"}},
		["Damage"] = {{0,5,0}},
	},

	--dict_type为18007的符文信息.
	[18] = {
		["image"]="PirateJX_FW16",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21740},
		["Name"] = {{"percent","power","step_secs"}},
		["Damage"] = {{0,2,0}},
	},
	--dict_type为19007的符文信息.
	[19] = {
		["image"]="PirateJX_FW18",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21750},
		["Name"] = {{"percent","power","step_secs"}},
		["Damage"] = {{0,2,0}},
	},
	--dict_type为20007的符文信息.
	[20] = {
		["image"]="PirateJX_FW26",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21760},
		["Name"] = {{"percent","power","step_secs"}},
		["Damage"] = {{0,0,0}},
	},
	--dict_type为21007的符文信息.
	[21] = {
		["image"]="PirateJX_FW21",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21770},
		["Name"] = {{"percent","power","step_secs"}},
		["Damage"] = {{0,0,0}},
	},
	--dict_type为22007的符文信息.
	[22] = {
		["image"]="PirateJX_FW20",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21780},
		["Name"] = {{"percent","power","step_secs"}},
		["Damage"] = {{0,0,0}},
	},

	--dict_type为23007的符文信息.
	[23] = {
		["image"]="PirateJX_FW19",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21790},
		["Name"] = {{"percent","power","step_secs"}},
		["Damage"] = {{0,0,0}},
	},
	--dict_type为24007的符文信息.
	[24] = {
		["image"]="PirateJX_FW17",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21800},
		["Name"] = {{"percent","power","step_secs"}},
		["Damage"] = {{0,0,0}},
	},
	--dict_type为25007的符文信息.
	[25] = {
		["image"]="PirateJX_FW13",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21810},
		["Name"] = {{"percent","power","step_secs"}},
		["Damage"] = {{0,0,0}},
	},
	--dict_type为26007的符文信息.
	[26] = {
		["image"]="PirateJX_FW14",--符文图片
		["effect"]="blank",---装备光效,专属符文才有
		["Magic"] = {21820},
		["Name"] = {{"percent","power","step_secs"}},
		["Damage"] = {{0,5,0}},
	},
	
}


-- 获取果实符文信息
local function GetRuneInfo( key1, key2, defValue)
	if key1 == nil or key1=="" then
		return defValue
	end

	local nLev = 0
	local nRuneType = -1
	
	if key1 > 0 then
		nLev = math.floor((math.floor(key1) % 1000) / 100)
		nRuneType = math.floor(math.floor(key1) / 1000)
	end
	
	local keyValue1 = RuneInfo[nRuneType]
	if keyValue1 == nil then
		return defValue
	end
	
	if key2 == nil or key2=="" then 
		return keyValue1
	end
	
	if key2 == "splitImg" then
		return "PirateJX_FWspty"
	elseif key2 == "splitTip" then
		return tRuneTips[-1]["splitTip"]
	elseif key2 == "name" then
		return tRuneTips[nRuneType]["name"]
	elseif key2 == "desc" then
		if key1 == -1 or tRuneTips[nRuneType] == nil or RuneInfo[nRuneType]["Magic"] == nil or RuneInfo[nRuneType]["Name"] == nil or RuneInfo[nRuneType]["Damage"] == nil then
			return LuaUIMgr_StringCodePage(g_objLuaUIMgr:GetCnRes(tRuneTips[-1]["desc"]))
		else
			local tTemp = {}
			
			for k,v in pairs(RuneInfo[nRuneType]["Magic"]) do
				local nType = v
				
				for m,n in pairs(RuneInfo[nRuneType]["Name"][k]) do
					local nData, bSuc = g_objMagicData:GetTypeDBField(nType, nLev, n)
					if (bSuc) then
						if RuneInfo[nRuneType]["Damage"][k][m] == 0 then
							table.insert(tTemp, nData)
						elseif RuneInfo[nRuneType]["Damage"][k][m] == 1 then
							table.insert(tTemp, nData % 30000)
						elseif RuneInfo[nRuneType]["Damage"][k][m] == 2 then
							table.insert(tTemp, nData / 100)
						elseif RuneInfo[nRuneType]["Damage"][k][m] == 3 then
							table.insert(tTemp, nData % 1000)
						elseif RuneInfo[nRuneType]["Damage"][k][m] == 4 then
							table.insert(tTemp, math.floor(nData / 1000))
						elseif RuneInfo[nRuneType]["Damage"][k][m] == 5 then
							table.insert(tTemp, nData / 10)
						elseif RuneInfo[nRuneType]["Damage"][k][m] == 6 then
							table.insert(tTemp, (nData % 1000) / 10)
						elseif RuneInfo[nRuneType]["Damage"][k][m] == 7 then
							table.insert(tTemp, nData % 100)
						end
					end
				end
			end
			
			local nScore = tRuneScore[nLev]
			local sLev = LuaUIMgr_StringCodePage(g_objLuaUIMgr:GetCnRes(tRuneLevel["Max"]))
			
			if nLev < 9 then
				sLev = string.format(LuaUIMgr_StringCodePage(g_objLuaUIMgr:GetCnRes(tRuneLevel["Level"])), nLev + 1)
			end
			
			return string.format(LuaUIMgr_StringCodePage(g_objLuaUIMgr:GetCnRes(tRuneTips[nRuneType]["desc"])), LuaUIMgr_StringCodePage(g_objLuaUIMgr:GetCnRes(tRuneTips[nRuneType]["name"])), sLev, nScore, table.unpack(tTemp))
		end
	end
	
	local keyValue2 = RuneInfo[nRuneType][key2]
	if keyValue2 == nil then
		return defValue
	end
	
	return keyValue2
end

local function GetRuneMagicInfo(idRune)
	idRune = math.floor(idRune / 1000)
	if RuneInfo[idRune] ~= nil then
		if RuneInfo[idRune]["Magic"] == nil then
			return "0"
		end
		
		return tostring(RuneInfo[idRune]["Magic"][1])
		
		-- local nNum = #RuneInfo[idRune]["Magic"]
		-- if nNum == 1 then
			-- local str = ""
			-- str = str .. RuneInfo[idRune]["Magic"][1]
			-- return str
		-- elseif nNum == 0 then
			-- return "0"
		-- else
			-- local str = ""
			-- for i,v in pairs(RuneInfo[idRune]["Magic"]) do
				-- str = str..v..","
			-- end

			-- return str
		-- end
	end
end

local RuneEffectInfo = {
	["PirateJX_ui52"] = {["OffsetX"] = 20,["OffsetY"] = 10,["OffsetZ"] = 20,},
	["PirateJX_ui53"] = {["OffsetX"] = 20,["OffsetY"] = 10,["OffsetZ"] = 20,},
	["PirateJX_ui54"] = {["OffsetX"] = 20,["OffsetY"] = 10,["OffsetZ"] = 20,},
	["PirateJX_ui55"] = {["OffsetX"] = 20,["OffsetY"] = 10,["OffsetZ"] = 20,},
	["PirateJX_ui56"] = {["OffsetX"] = 20,["OffsetY"] = 10,["OffsetZ"] = 20,},
	["PirateJX_ui57"] = {["OffsetX"] = 20,["OffsetY"] = 10,["OffsetZ"] = 20,},
}

local function GetRuneEffectOffset(strName, nType)
	return RuneEffectInfo[strName][nType]
end

-- 恶魔果实信息表
local FruitInfo= {
	--id为700的果实信息（这边设置为通用符文所属，在图鉴用）,700为固定id
	[700] = {
		["name"]="STR_INI_LUA_DEVILFRUIT_FRUITINFO_NAME_700",
		["image"]="PirateJX_Pic27",--果实图片
		["imageBig"]="PirateJX_FW4",--果实大图片
		["effect"]="PirateJX_ui3",--果实光效
		["selectedEffect"]="PirateJX_ui6",--左边按钮选中光效
		
		["bg"]="PirateJX_BG14",--对应恶魔果实背景图
		["SRLevel"]="PirateJX_Pic20",--评级
		["desc"]="STR_INI_LUA_DEVILFRUIT_FRUITINFO_DESC_700",

		["splitImg"]="PirateJX_FWspty",--果实碎片图片
		
		["initStar"]=1,--初始星级(最终星级=初始星级+等级,不能超过6)
		["maxLevel"]=4,--最高等级
		["RepairRate"] = 15, -- 一个碎片等于多少精修值
		-- 碎片对应的tip描述
		["SplitDesc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_SPLITTIP_0",
		
	},

	--id为701的果实信息
	[701] = {
			-- 外套
		["ClientStatus"] = 70004,
		["name"]="STR_INI_LUA_DEVILFRUIT_FRUITINFO_NAME_701",
		["image"]="PirateJX_Pic17",--果实图片
		["imageBig"]="blank",--果实大图片
		["effect"]="PirateJX_ui2",--果实光效
		["selectedEffect"]="PirateJX_ui5",--左边按钮选中光效
		
		["bg"]="PirateJX_BG15",--对应恶魔果实背景图
		["SRLevel"]="PirateJX_Pic20",--评级
		["desc"]="STR_INI_LUA_DEVILFRUIT_FRUITINFO_DESC_701",
		
		["splitImg"]="PirateJX_FWspty",--果实碎片图片
		--果实碎片tip
		["splitTip"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_SPLITTIP_0",


		["initStar"]=2,--初始星级(最终星级=初始星级+等级,不能超过6)
		["maxLevel"]=4,--最高等级
		["RepairRate"] = 15, -- 一个碎片等于多少精修值
		-- 碎片对应的tip描述
		["SplitDesc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_SPLITTIP_0",
		
	},
	--id为702的果实信息
	[702] = {
			-- 外套
		["ClientStatus"] = 70002,
		["name"]="STR_INI_LUA_DEVILFRUIT_FRUITINFO_NAME_702",
		["image"]="PirateJX_Pic16",--果实图片
		["imageBig"]="blank",--果实大图片
		["effect"]="PirateJX_ui1",--果实光效
		["selectedEffect"]="PirateJX_ui4",--左边按钮选中光效
		
		["bg"]="PirateJX_BG16",--对应恶魔果实背景图
		["SRLevel"]="PirateJX_Pic20",--评级
		["desc"]="STR_INI_LUA_DEVILFRUIT_FRUITINFO_DESC_702",
		
		["splitImg"]="PirateJX_FWspty",--果实碎片图片
		--果实碎片tip
		["splitTip"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_SPLITTIP_0",

		["initStar"]=2,--初始星级(最终星级=初始星级+等级,不能超过6)
		["maxLevel"]=4,--最高等级
		["RepairRate"] = 15, -- 一个碎片等于多少精修值
		-- 碎片对应的tip描述
		["SplitDesc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_SPLITTIP_0",
		
	},
	--id为703的果实信息
	[703] = {
			-- 外套
		["ClientStatus"] = 70003,
		["name"]="STR_INI_LUA_DEVILFRUIT_FRUITINFO_NAME_703",
		["image"]="PirateJX_Pic18",--果实图片
		["imageBig"]="blank",--果实大图片
		["effect"]="PirateJX_ui3",--果实光效
		["selectedEffect"]="PirateJX_ui6",--左边按钮选中光效
		
		["bg"]="PirateJX_BG14",--对应恶魔果实背景图
		["SRLevel"]="PirateJX_Pic20",--评级
		["desc"]="STR_INI_LUA_DEVILFRUIT_FRUITINFO_DESC_703",
		
		["splitImg"]="PirateJX_FWspty",--果实碎片图片
		--果实碎片tip
		["splitTip"]="STR_INI_LUA_DEVILFRUIT_RUNETIPS_SPLITTIP_0",

		["initStar"]=2,--初始星级(最终星级=初始星级+等级,不能超过6)
		["maxLevel"]=4,--最高等级
		["RepairRate"] = 15, -- 一个碎片等于多少精修值
		-- 碎片对应的tip描述
		["SplitDesc"] = "STR_INI_LUA_DEVILFRUIT_RUNETIPS_SPLITTIP_0",
		
	},

	--id为704的果实信息
	[704] = {
		-- 外套
		["IsNewFruit"] = true,
		["ClientStatus"] = 0,
		["name"]="STR_INI_LUA_DEVILFRUIT_FRUITINFO_NAME_704",
		["image"]="PirateJXSS_Pic1",--果实图片
		["imageBig"]="PirateJXSS_Pic2",--果实大图片
		["effect"]="ssgs_ui6",--果实默认光效
		["effect1"]="ssgs_ui6",--果实1级光效
		["effect2"]="ssgs_ui6",--果实2级光效
		["effect3"]="ssgs_ui6",--果实3级光效
		["effect4"]="ssgs_ui6",--果实4级光效
		["effect5"]="ssgs_ui6",--果实5级光效
		["effect6"]="ssgs_ui5",--果实6级光效
		["selectedEffect"]="ssgs_ui3",--左边按钮选中光效
		["splitImg"]="PirateJX_FWspty",--果实碎片图片
		--果实碎片tip
		["splitTip"]="STR_INI_LUA_DEVILFRUIT_FRUITINFO_SPLITTIP_701",
		["bg"]="PirateJXSS_BG1",--对应恶魔果实背景图
		["SRLevel"]="PirateJX_Pic20",--评级
		["desc"]="STR_INI_LUA_DEVILFRUIT_FRUITINFO_DESC_704",

		["initStar"]=0,--初始星级(最终星级=初始星级+等级,不能超过6)
		["maxLevel"]=6,--最高等级	
	},
}

-- 获取恶魔果实属性信息
local function GetFruitInfo( key1, key2, defValue, key3)
	if key1 == nil or key1=="" then
		return defValue
	end

	local keyValue1 = FruitInfo[key1]
	if keyValue1 == nil then
		return defValue
	end

	if key2 == nil or key2=="" then 
		return keyValue1
	end

	local keyValue2 = FruitInfo[key1][key2]
	if keyValue2 == nil then
		return defValue
	end

	if key3 == nil or key3=="" then 
		return keyValue2
	end

	local keyValue3 = FruitInfo[key1][key2][key3]
	if keyValue3 == nil then
		return defValue
	end

	return keyValue3
end



-- 果实图鉴信息及其通用配置信息
local FruitMap= {
	---- 通用UI配置信息----

	--图鉴行背景
	["lineBg"]="PirateJX_BG11",
	--果实背景框
	["fruitBg"]="PirateJX_BG32",
	--果实背景框选中态
	["fruitBgSelected"]="PirateJX_BG33",
	--果实名字背景
	["fruitNameBg"]="PirateJX_BG17",
	--符文背景框
	["itemBg"]="PirateJX_BG13",

	--图鉴符文灰态遮罩
	["runeGray"]="PirateJX_BG34",

	--符文锁住图标
	["RuneLock"]="PirateJX_Pic23",
	--符文可觉醒
	["RuneAwakeable"]="PirateJX_WZ12",
	
	--果实启用中(小图)
	["inUsingImg"]="PirateJX_WZ14",

	--符文格子增加等级--字体大小
	["runeGridFontSize"]=14,
	--符文格子增加等级--颜色
	["runeGridFontColor"]=0xFF41F22A,


	--tip边距
	["TipMarginMinX"]=20,
	["TipMarginMinY"]=20,

	--觉醒chkbox图片
	["AwakeCheckboxImg"]="PirateJX_Btn9",
	--觉醒成功光效
	["AwakeOkEffect"]="PirateJX_ui10",
	--觉醒成功新开符文光效(亮一下)
	["AwakeNewRuneEffect"]="PirateJX_ui12",
	--觉醒成功星星亮一下
	["AwakeStarEffect"]="PirateJX_ui11",

	-----果实碎片获取途径（目前最多支持3种途径）-----
	--获取途径个数
	["GetWayCount"]=2,
	--第1种途径
	["GetWay1"]={
		["title"]="STR_INI_LUA_DEVILFRUIT_FRUITMAP_GETWAYTITLE_1",
		["action"]="1",--1:打开对话框  2:寻路到目的地  3:寻路到NPC
		["dlgId"]="3644",--打开对话框ID
	},
	--第2种途径
	["GetWay2"]={
		["title"]="STR_INI_LUA_DEVILFRUIT_FRUITMAP_GETWAYTITLE_2",
		["action"]="1",--1:打开对话框  2:寻路到目的地  3:寻路到NPC
		["dlgId"]="2201",--打开对话框ID
	},
	--第3种途径
	["GetWay3"]={
		["title"]="STR_INI_LUA_DEVILFRUIT_FRUITMAP_GETWAYTITLE_3",
		["action"]="3",--1:打开对话框  2:寻路到目的地  3:寻路到NPC
		--地图ID
		["MapID"] = 2,
		--NPCID
		["NpcID"] = 6735,
		--地图位置
		["MapX"] = 444,
		["MapY"] = 674,
	},

	----果实图鉴信息列表----------
	--果实图鉴总数
	["count"]=4,
	
	--第1个图鉴信息
	[1] = {
		["id"]=701,--对应FruitInfo表格里面id的信息
		["runeId"]="1007,2007,3007",--包含符文ID		
		["descLine"]="STR_INI_LUA_DEVILFRUIT_FRUITMAP_DESCLINE_1",
		["desc"]="STR_INI_LUA_DEVILFRUIT_FRUITMAP_DESC_1",
		["upeff"]="PirateJX_ui48",
	},
	--第2个图鉴信息
	[2] = {
		["id"]=702,--对应FruitInfo表格里面id的信息
		-- ["runeId"]="5007,6007,7007,8007",--包含符文ID		
		["runeId"]="5007,6007,7007,8007",--包含符文ID		
		
		["descLine"]="STR_INI_LUA_DEVILFRUIT_FRUITMAP_DESCLINE_1",
		["desc"]="STR_INI_LUA_DEVILFRUIT_FRUITMAP_DESC_1",
		["upeff"]="PirateJX_ui46",
	},
	--第3个图鉴信息
	[3] = {
		["id"]=703,--对应FruitInfo表格里面id的信息
		["runeId"]="9007,10007,11007,12007",--包含符文ID		
		
		["descLine"]="STR_INI_LUA_DEVILFRUIT_FRUITMAP_DESCLINE_1",
		["desc"]="STR_INI_LUA_DEVILFRUIT_FRUITMAP_DESC_1",
		["upeff"]="PirateJX_ui47",
	},
	--第4个图鉴信息
	[4] = {
		["id"]=700,--对应FruitInfo表格里面id的信息
		["runeId"]="13007,14007,15007,16007,17007,18007,19007,20007,21007,22007,23007,24007,25007,26007",--包含符文ID		
		["descLine"]="STR_INI_LUA_DEVILFRUIT_FRUITMAP_DESCLINE_1",
		["desc"]="STR_INI_LUA_DEVILFRUIT_FRUITMAP_DESC_1",
	},
}

-- 获取果实图鉴信息
local function GetFruitMap( key1, defValue, key2)
	if key1 == nil or key1=="" then
		return defValue
	end

	local keyValue1 = FruitMap[key1]
	if keyValue1 == nil then
		return defValue
	end

	if key2 == nil or key2=="" then 
		return keyValue1
	end

	local keyValue2 = FruitMap[key1][key2]
	if keyValue2 == nil then
		return defValue
	end

	return keyValue2
end



-- lev：战装等级
-- use: 是否启用, nId:正在使用的ID
-- score:数据表配的分数
local function GetAblityScore(lev, use, nId, score)
	
	if (use == false) then
		score = 0	-- 策划说未启用不加分
	end
	
	return score
end


--判断是否显示果实图鉴按钮
-- fruitCount 拥有果实个数
-- runeCount 拥有符文个数
local function IsShowFruitMap(fruitCount, runeCount)
	--根据实际需求修改
	return (fruitCount>=0 and runeCount>=0)
end

local DlgInfo = {
	-- 投入精修值界面,没有物品时，物品的遮罩
	["NoItemImg"] = "PirateJX_BG13",
	-- 投入精修值界面，选中物品的图片
	["SelItemImg"] = "PirateJX_Pic4",
	-- 投入精修值tips底部和预留的蒙版高度
	["DescBottomOffset"] = 30,
	-- 投入精修值tips左边和预留的蒙版高度
	["DescLeftOffset"] = 10,
	-- 投入精修值tips顶部和预留的蒙版高度
	["DescTopOffset"] = 10,
	["MaskLeftOffset"] = 20,
	["MaskTopOffset"] = 20,
	["RedPointImg"] = "PirateJX_Pic2",
}

local function GetDlgInfo(nType, nDefault)
	if nil == DlgInfo[nType] then
		return nDefault
	else
		return DlgInfo[nType]
	end
end

local function GetFruitCount()
	local nCount = 0
	for _, _ in pairs(FruitInfo) do
		nCount = nCount + 1
	end
	return nCount
end

local function GetClientStatus(index)
	local nCount = 0
	for key, _ in pairs(FruitInfo) do
		if nCount == index then
			return FruitInfo[key]["ClientStatus"]
		end
		nCount = nCount + 1
	end
	return 0
end

local function GetMagicQuickSingle(id,key)
	local keyValue = MagicQuick[id]
	if (keyValue ~= nil and key == nil) then
		return keyValue
	end

	if key ~=nil then
		return keyValue[key]
	end
	
	return 0
end

local NewFruitInfo = {
	Id = 704,
	width = 75,
	uplevtime = 1.8,
	unlockvalue = 5000,

	--这里配置的是岁岁果实能够解锁的技能,start配置的是对应需要几星才能解锁的条件
	magicInfo = {
		[1] ={magictype = 24900, start = 1,},
		[2] ={magictype = 24910, start = 1,},
		[3] ={magictype = 24920, start = 1,},
		
	},
	levInfo = {
		[1] = {exp = 0, score = 0, lose_exp = 0, magic1_type = 0, magic1_lev = 0, magic2_type = 0, magic2_lev = 0, magic3_type = 0, magic3_lev = 0,},
		[2] = {exp = 500, score = 100, lose_exp = 500, magic1_type = 24900, magic1_lev = 1, magic2_type = 24910, magic2_lev = 1, magic3_type = 24920, magic3_lev = 1,},
		[3] = {exp = 1000, score = 300, lose_exp = 700, magic1_type = 24900, magic1_lev = 2, magic2_type = 24910, magic2_lev = 2, magic3_type = 24920, magic3_lev = 2,},
		[4] = {exp = 1500, score = 600, lose_exp = 900, magic1_type = 24900, magic1_lev = 3, magic2_type = 24910, magic2_lev = 3, magic3_type = 24920, magic3_lev = 3,},
		[5] = {exp = 2000, score = 1000, lose_exp = 1100, magic1_type = 24900, magic1_lev = 4, magic2_type = 24910, magic2_lev = 4, magic3_type = 24920, magic3_lev = 4,},
		[6] = {exp = 2500, score = 1500, lose_exp = 1300, magic1_type = 24900, magic1_lev = 5, magic2_type = 24910, magic2_lev = 5, magic3_type = 24920, magic3_lev = 5,},
	},
}

--根据等级每周减少的经验值
local function GetSucExp(nlev)
	return NewFruitInfo.levInfo[nlev].lose_exp
end

--这里的值是每个碎片的经验值
local function GetAddExp(nnum)
	return nnum
end

local function GetNeedExp(nLev)
	if nLev < 0 or nLev >= 6 then
		return 0
	end
	
	return NewFruitInfo.levInfo[nLev+1].exp - NewFruitInfo.levInfo[nLev].exp
end

--获得
local function GetCurExp(lev, allExp)
	-- if lev == 6 then
		-- return allExp
	-- end

	return allExp - NewFruitInfo.levInfo[lev].exp
end

local function GetNewFruitInfo(key)
	return NewFruitInfo[key]
end

local function GetNewFruitScoreBylev(lev)
	return NewFruitInfo.levInfo[lev].score
end

--这个函数是将总经验值转化成星星数
local function GetStartByExp(n64Exp)
	for index, value in ipairs(NewFruitInfo.levInfo) do
		if value.exp > n64Exp then
			return index - 2
		elseif  value.exp == n64Exp then
			return index - 1
		end
	end

	local maxlev = #NewFruitInfo.levInfo
	if n64Exp >= NewFruitInfo.levInfo[maxlev].exp then
		return maxlev - 1
	end

	return 0
end

--如果是去获取解锁条件：返回-1表示满足解锁，返回start表示尚未解锁
local function GetMagicInfoByIndex(index, key, n64exp, nlev)
	index = index + 1
	if NewFruitInfo.magicInfo[index] ==nil then
		return nil
	end

	if key == "amount" then
		return #NewFruitInfo.magicInfo
	elseif key == "magictype" then
		return NewFruitInfo.magicInfo[index][key]
	elseif key == "curlev" then
		local value = "magic".. math.floor(index).."_lev"
		return NewFruitInfo.levInfo[nlev][value]
	else
		if GetStartByExp(n64exp) >= NewFruitInfo.magicInfo[index].start then
			return -1
		else 
			return NewFruitInfo.magicInfo[index].start
		end
	end
end

-- cq_config新增
    -- type= 160112
    -- data1=效果id
    -- data2=属性枚举
    -- data3=属性值
    -- data4=超过属性值，额外增加点数
    
    -- 属性枚举值：
    -- 1：生命上限
    -- 2：物理攻击
    -- 3：物理防御
    -- 4：法术攻击
    -- 5：法术防御
    -- 6：物理伤害加成
    -- 7：物理伤害减免
    -- 8：法术伤害加成
    -- 9：法术伤害减免
-- 只要配置data2=1的数据


local WrapFutureInfo = {
[1] = {["defaultlife"] = 10000, ["addlife"] = 500 ,},
[2] ={["defaultlife"] = 12000, ["addlife"] = 600 ,},
[3] ={["defaultlife"] = 14000, ["addlife"] = 700 ,},
[4] ={["defaultlife"] = 16000, ["addlife"] = 800 ,},
[5] ={["defaultlife"] = 18000, ["addlife"] = 900 ,},
[6] ={["defaultlife"] = 20000, ["addlife"] = 1000,},
[7] ={["defaultlife"] = 22000, ["addlife"] = 1100,},
[8] ={["defaultlife"] = 24000, ["addlife"] = 1200,},
[9] ={["defaultlife"] = 26000, ["addlife"] = 1300,},
[10] ={["defaultlife"] = 28000, ["addlife"] = 1400,},
}

local function GetWrapFutureAddLife(lev,key)
	return WrapFutureInfo[lev + 1][key]
end

-- 清理变量释放内存
local function Unload()
	DevilFruit_GetWrapFutureAddLife = nil
	DevilFruit_GetNewFruitScoreBylev = nil
	DevilFruit_GetSucExp = nil
	DevilFruit_GetAddExp = nil
	DevilFruit_GetNeedExp = nil
	DevilFruit_GetCurExp = nil
	DevilFruit_GetStartByExp = nil
	DevilFruit_GetMagicInfoByIndex = nil
	DevilFruit_GetNewFruitInfo = nil
	DevilFruit_GetNewFruitId = nil
	DevilFruit_IsShowFruitMap = nil
	DevilFruit_GetRuneInfo = nil
	DevilFruit_GetFruitInfo = nil
	DevilFruit_GetFruitMap = nil
	DevilFruit_GetAblityScore = nil
	DevilFruit_Unload = nil
end

-- 通过require传给其他Lua脚本使用
local DevilFruit = {
	GetWrapFutureAddLife = GetWrapFutureAddLife,
	GetNewFruitScoreBylev = GetNewFruitScoreBylev,
	GetSucExp = GetSucExp,
	GetAddExp = GetAddExp,
	GetNeedExp = GetNeedExp,
	GetCurExp = GetCurExp,
	GetStartByExp = GetStartByExp,
	GetMagicInfoByIndex = GetMagicInfoByIndex,
	GetNewFruitInfo = GetNewFruitInfo,
	IsShowFruitMap = IsShowFruitMap,
	GetRuneInfo = GetRuneInfo,
	GetFruitInfo = GetFruitInfo,
	GetFruitMap = GetFruitMap,
	GetAblityScore = GetAblityScore,
	GetDlgInfo = GetDlgInfo,
	GetFruitCount = GetFruitCount,
	GetClientStatus = GetClientStatus,
	GetMagicQuickSingle = GetMagicQuickSingle,
	GetRuneMagicInfo = GetRuneMagicInfo,
	GetRuneEffectOffset = GetRuneEffectOffset,
	Unload = Unload,
}

-- C++程序使用的global函数名
DevilFruit_GetWrapFutureAddLife = DevilFruit.GetWrapFutureAddLife
DevilFruit_GetNewFruitScoreBylev = DevilFruit.GetNewFruitScoreBylev
DevilFruit_GetSucExp = DevilFruit.GetSucExp
DevilFruit_GetAddExp = DevilFruit.GetAddExp
DevilFruit_GetNeedExp = DevilFruit.GetNeedExp
DevilFruit_GetCurExp = DevilFruit.GetCurExp
DevilFruit_GetStartByExp = DevilFruit.GetStartByExp
DevilFruit_GetMagicInfoByIndex = DevilFruit.GetMagicInfoByIndex
DevilFruit_GetNewFruitInfo = DevilFruit.GetNewFruitInfo
DevilFruit_IsShowFruitMap = DevilFruit.IsShowFruitMap
DevilFruit_GetRuneInfo = DevilFruit.GetRuneInfo
DevilFruit_GetFruitInfo = DevilFruit.GetFruitInfo
DevilFruit_GetFruitMap = DevilFruit.GetFruitMap
DevilFruit_GetAblityScore = DevilFruit.GetAblityScore
DevilFruit_GetDlgInfo = DevilFruit.GetDlgInfo
DevilFruit_GetFruitCount = DevilFruit.GetFruitCount
DevilFruit_GetClientStatus = DevilFruit.GetClientStatus
DevilFruit_GetMagicQuickSingle = DevilFruit.GetMagicQuickSingle
DevilFruit_GetRuneMagicInfo = DevilFruit.GetRuneMagicInfo
DevilFruit_GetRuneEffectOffset = DevilFruit.GetRuneEffectOffset
DevilFruit_Unload = DevilFruit.Unload

-- require返回值
return DevilFruit

