--[ItemType] 奖励物品type
--[Count] 奖励物品数量
--[Effect] 物品光效
local RankAward = {
	["Season"] = 1,
	-- 第1赛季 
	[1] = {
		-- ["TimeStart"] = 191010,
		-- ["TimeEnd"] = 191231,
		-- ["FinishTime"] = 19013101,
		-- 第1名
		[0] = {
			-- 第1名奖励数量
			["Count"] = 2,
			[1] = {
				["ItemType"] = 730006,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
				["Monopoly"] = 1, -- 1赠 0非赠
			},
			[2] = {
				["ItemType"] = 3324264,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
			},
			-- [3] = {
				-- ["ItemType"] = 3327379,
				-- ["Count"] = 3,
				-- ["Effect"] = "fp_kuang",
			-- },
			-- [4] = {
				-- ["ItemType"] = 3327380,
				-- ["Count"] = 2,
				-- ["Effect"] = "",
			-- },
		},
		-- 第2名
		[1] = {
			-- 第2名奖励数量
			["Count"] = 2,
			[1] = {
				["ItemType"] = 730005,
				["Count"] = 2,
				["Effect"] = "fp_kuang",
				["Monopoly"] = 1,
			},
			[2] = {
				["ItemType"] = 3324265,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
			},
			-- [3] = {
				-- ["ItemType"] = 3327379,
				-- ["Count"] = 3,
				-- ["Effect"] = "fp_kuang",
			-- },
			-- [4] = {
				-- ["ItemType"] = 3327380,
				-- ["Count"] = 2,
				-- ["Effect"] = "",
			-- },
		},
		-- 第3名
		[2] = {
			-- 第3名奖励数量
			["Count"] = 2,
			[1] = {
				["ItemType"] = 730005,
				["Count"] = 2,
				["Effect"] = "fp_kuang",
				["Monopoly"] = 1,
			},
			[2] = {
				["ItemType"] = 3324265,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
			},
			-- [3] = {
				-- ["ItemType"] = 3327378,
				-- ["Count"] = 2,
				-- ["Effect"] = "",
			-- },
			-- [4] = {
				-- ["ItemType"] = 730004,
				-- ["Count"] = 3,
				-- ["Effect"] = "fp_kuang",
			-- },
		},
		-- 第4名
		[3] = {
			-- 第4名奖励数量
			["Count"] = 2,
			[1] = {
				["ItemType"] = 730005,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
				["Monopoly"] = 1,
			},
			[2] = {
				["ItemType"] = 3324265,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
			},
			-- [3] = {
				-- ["ItemType"] = 3327378,
				-- ["Count"] = 2,
				-- ["Effect"] = "",
			-- },
			-- [4] = {
				-- ["ItemType"] = 730004,
				-- ["Count"] = 3,
				-- ["Effect"] = "fp_kuang",
			-- },
		},
	}
}

--老兵服
local RankAward_OSServer = {
	["Season"] = 1,
	-- 第1赛季 
	[1] = {
		-- ["TimeStart"] = 191010,
		-- ["TimeEnd"] = 191231,
		-- ["FinishTime"] = 19013101,
		-- 第1名
		[0] = {
			-- 第1名奖励数量
			["Count"] = 2,
			[1] = {
				["ItemType"] = 730006,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
				["Monopoly"] = 1, -- 1赠 0非赠
			},
			[2] = {
				["ItemType"] = 3324264,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
			},
			-- [3] = {
				-- ["ItemType"] = 3327379,
				-- ["Count"] = 3,
				-- ["Effect"] = "fp_kuang",
			-- },
			-- [4] = {
				-- ["ItemType"] = 3327380,
				-- ["Count"] = 2,
				-- ["Effect"] = "",
			-- },
		},
		-- 第2名
		[1] = {
			-- 第2名奖励数量
			["Count"] = 2,
			[1] = {
				["ItemType"] = 730005,
				["Count"] = 2,
				["Effect"] = "fp_kuang",
				["Monopoly"] = 1,
			},
			[2] = {
				["ItemType"] = 3324265,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
			},
			-- [3] = {
				-- ["ItemType"] = 3327379,
				-- ["Count"] = 3,
				-- ["Effect"] = "fp_kuang",
			-- },
			-- [4] = {
				-- ["ItemType"] = 3327380,
				-- ["Count"] = 2,
				-- ["Effect"] = "",
			-- },
		},
		-- 第3名
		[2] = {
			-- 第3名奖励数量
			["Count"] = 2,
			[1] = {
				["ItemType"] = 730005,
				["Count"] = 2,
				["Effect"] = "fp_kuang",
				["Monopoly"] = 1,
			},
			[2] = {
				["ItemType"] = 3324265,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
			},
			-- [3] = {
				-- ["ItemType"] = 3327378,
				-- ["Count"] = 2,
				-- ["Effect"] = "",
			-- },
			-- [4] = {
				-- ["ItemType"] = 730004,
				-- ["Count"] = 3,
				-- ["Effect"] = "fp_kuang",
			-- },
		},
		-- 第4名
		[3] = {
			-- 第4名奖励数量
			["Count"] = 2,
			[1] = {
				["ItemType"] = 730005,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
				["Monopoly"] = 1,
			},
			[2] = {
				["ItemType"] = 3324265,
				["Count"] = 1,
				["Effect"] = "fp_kuang",
			},
			-- [3] = {
				-- ["ItemType"] = 3327378,
				-- ["Count"] = 2,
				-- ["Effect"] = "",
			-- },
			-- [4] = {
				-- ["ItemType"] = 730004,
				-- ["Count"] = 3,
				-- ["Effect"] = "fp_kuang",
			-- },
		},
	}
}

local function GetAwardItem(season,id,index,key)
    local keyValue = nil
	
	if UserData_IsOldSoldierServer() then
		keyValue = RankAward_OSServer[season][id]
	elseif UserData_IsCoinsServer() then
		keyValue = RankAward_OSServer[season][id]
	else
		keyValue = RankAward[season][id]
	end
	
    if (keyValue) then
        return keyValue[index][key]
    end
    
    return 0
end

local function GetAwardCount(season,id)
    local keyValue = nil
	
	if UserData_IsOldSoldierServer() then
		keyValue = RankAward_OSServer[season][id]["Count"]
	elseif UserData_IsCoinsServer() then
		keyValue = RankAward_OSServer[season][id]["Count"]
	else
		keyValue = RankAward[season][id]["Count"]
	end

    if (keyValue) then
        return keyValue
    end
    
    return 0
end

local function GetCurSeason()
	if UserData_IsOldSoldierServer() or UserData_IsCoinsServer() then
		return RankAward_OSServer["Season"]
	end
    return RankAward["Season"]
end

-- local function GetSeasonTime(season,key)
    -- local keyValue = RankAward[season][key]

    -- if (keyValue) then
        -- return keyValue
    -- end
    
    -- return 0
-- end	

-- 清理变量释放内存
local function Unload()
	ForeignInvasionAward_GetAwardItem = nil
	ForeignInvasionAward_GetAwardCount = nil
	ForeignInvasionAward_GetCurSeason = nil
	ForeignInvasionAward_GetSeasonTime = nil
end

local ForeignInvasionAward = { 
	 GetAwardCount = GetAwardCount,
	 GetAwardItem = GetAwardItem,
	 GetCurSeason = GetCurSeason,
 }

-- C++程序使用的global函数名
ForeignInvasionAward_GetAwardItem = ForeignInvasionAward.GetAwardItem
ForeignInvasionAward_GetAwardCount = ForeignInvasionAward.GetAwardCount
ForeignInvasionAward_GetCurSeason = ForeignInvasionAward.GetCurSeason

-- require返回值
return ForeignInvasionAward