
local Reward = {
	--按照服务器类型值配置
	["Old"] = {							--正常服
		[1]={
			RewardNum=2,
			[1]={
				IdItem=3307012,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},
		},
		[2]={
			RewardNum=2,
			[1]={
				IdItem=3307013,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},			
		},
		[3]={
			RewardNum=2,
			[1]={
				IdItem=3307014,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},
		},
		[4]={
			RewardNum=2,
			[1]={
				IdItem=3307015,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},			
		},
		["AutoRunTarget"] = {
			mapid = 1002,
			x = 452,
			y = 291,
			npcid = 662,
		},
	},
	["Fight"] = {						--激情服
		[1]={
			RewardNum=2,
			[1]={
				IdItem=3307012,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},
		},
		[2]={
			RewardNum=2,
			[1]={
				IdItem=3307013,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},			
		},
		[3]={
			RewardNum=2,
			[1]={
				IdItem=3307014,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},			
		},
		[4]={
			RewardNum=2,
			[1]={
				IdItem=3307015,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},			
		},
		["AutoRunTarget"] = {
			mapid = 10364,
			x = 308,
			y = 141,
			npcid = 662,
		},
	},
	["New"] = {							--新服
		[1]={
			RewardNum=2,
			[1]={
				IdItem=3307012,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},			
		},
		[2]={
			RewardNum=2,
			[1]={
				IdItem=3307013,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},			
		},
		[3]={
			RewardNum=2,
			[1]={
				IdItem=3307014,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},			
		},
		[4]={
			RewardNum=2,
			[1]={
				IdItem=3307015,
				Num=1,
				Monopoly=0,
			},
			[2]={
				IdItem=3327105,
				Num=1,
				Monopoly=0,
			},			
		},
		["AutoRunTarget"] = {
			mapid = 1002,
			x = 452,
			y = 291,
			npcid = 662,
		},
	},
	["OldSoldier"] = {							--老兵服
		[1]={
			RewardNum=2,
			[1]={
				IdItem=730006,
				Num=1,
				Monopoly=1,
			},
			[2]={
				IdItem=3008058,
				Num=1,
				Monopoly=0,
			},	
		},
		[2]={
			RewardNum=2,
			[1]={
				IdItem=730006,
				Num=1,
				Monopoly=1,
			},
			[2]={
				IdItem=3008058,
				Num=1,
				Monopoly=0,
			},	
		},
		[3]={
			RewardNum=2,
			[1]={
				IdItem=730006,
				Num=1,
				Monopoly=1,
			},
			[2]={
				IdItem=3008058,
				Num=1,
				Monopoly=0,
			},	
		},
		[4]={
			RewardNum=2,
			[1]={
				IdItem=730006,
				Num=1,
				Monopoly=1,
			},
			[2]={
				IdItem=3008058,
				Num=1,
				Monopoly=0,
			},	
		},
		["AutoRunTarget"] = {
			mapid = 10364,
			x = 309,
			y = 147,
			npcid = 662,
		},
	},
}


local RewardPositonInfo = {
    --表示有几个奖励物品
    [1] = {
        --从左到右对应ini配置中的 x，y，w，h
        [0] = "429,388,54,54",
    },
    [2] = {
        [0] = "280,388,54,54",
        [1] = "370,388,54,54",
    },
    [3] = {
        [0] = "250,388,54,54",
        [1] = "320,388,54,54",
        [2] = "390,388,54,54",
    },
    [4] = {
        [0] = "330,388,54,54",
        [1] = "394,388,54,54",
        [2] = "454,388,54,54",
        [3] = "515,388,54,54",
    },
    [5] = {
        [0] = "304,388,54,54",
        [1] = "369,388,54,54",
        [2] = "429,388,54,54",
        [3] = "489,388,54,54",
        [4] = "569,388,54,54",
    },
}

local ProfessionalTxt = {
	-- 普通服
	[0] = {
		["Time"] = "STR_PROFESSIONALPK_TIPS2",
		["Rule"] = "STR_PROFESSIONALPK_TIPS3",
		["Style"] = "STR_PROFESSIONALPK_TIPS4",
	},

	-- 老兵服
	[1] = {
		["Time"] = "STR_PROFESSIONALPK_TIPS2_OS",
		["Rule"] = "STR_PROFESSIONALPK_TIPS3_OS",
		["Style"] = "STR_PROFESSIONALPK_TIPS4_OS",
	},
}

local function GetProfessionalTxt(key)
    if (UserData_IsOldSoldierServer() == true) or (UserData_IsCoinsServer() == true) then
        return ProfessionalTxt[1][key]
    end
        
    return ProfessionalTxt[0][key]
end

local function GetPositionInfo(Num,index)
    return RewardPositonInfo[Num][index]
end

local function GetReward(level,index,key)
    if (UserData_IsPassionServer() == true)then
        return Reward["Fight"][level][index][key]
	elseif (UserData_IsOldSoldierServer() == true) then
        return Reward["OldSoldier"][level][index][key]
	elseif (UserData_IsCoinsServer() == true) then
        return Reward["OldSoldier"][level][index][key]
    elseif (UserData_IsNewServer() == true) then
        return Reward["New"][level][index][key]
    else
        return Reward["Old"][level][index][key]
    end
    return default
end

local function GetLevel(level)
    if (level < 100 ) then
        level = 1
    elseif (level <120 ) then
        level = 2
    elseif(level < 130) then
        level = 3
    else
        level = 4
    end
    return level
end

local function GetRewardNum(level)
    if (UserData_IsPassionServer() == true ) then
        return Reward["Fight"][level].RewardNum
	elseif (UserData_IsOldSoldierServer() == true) then
		return Reward["OldSoldier"][level].RewardNum
	elseif (UserData_IsCoinsServer() == true) then
		return Reward["OldSoldier"][level].RewardNum
    elseif (UserData_IsNewServer() == true) then
        return Reward["New"][level].RewardNum
    else
        return Reward["Old"][level].RewardNum
    end 
    return default
end

local function GetAutoRunTargetInfo(index, default)
    if (UserData_IsPassionServer() == true )then
        return Reward["Fight"]["AutoRunTarget"][index]
	elseif (UserData_IsOldSoldierServer() == true) then
		return Reward["OldSoldier"]["AutoRunTarget"][index]
	elseif (UserData_IsCoinsServer() == true) then
		return Reward["OldSoldier"]["AutoRunTarget"][index]
    elseif (UserData_IsNewServer() == true) then
        return Reward["New"]["AutoRunTarget"][index]
    else
        return Reward["Old"]["AutoRunTarget"][index]
    end
    return default
end

-- 清理变量释放内存
local function Unload()
    Reward = nil
    AutoRunTarget = nil
    RewardPositonInfo = nil
end

-- 通过require传给其他Lua脚本使用
local ProfessionalPK = {
    GetReward = GetReward,
    GetRewardNum = GetRewardNum,
    GetAutoRunTargetInfo = GetAutoRunTargetInfo,
    GetLevel = GetLevel,
    GetPositionInfo = GetPositionInfo,
	GetProfessionalTxt = GetProfessionalTxt,
    Unload = Unload,
}

-- C++程序使用的global函数名

ProfessionalPK_GetAutoRunTargetInfo= ProfessionalPK.GetAutoRunTargetInfo
ProfessionalPK_GetReward = ProfessionalPK.GetReward
ProfessionalPK_GetRewardNum = ProfessionalPK.GetRewardNum
ProfessionalPK_Unload = ProfessionalPK.Unload
ProfessionalPK_GetLevel = ProfessionalPK.GetLevel
ProfessionalPK_GetPositionInfo = ProfessionalPK.GetPositionInfo
ProfessionalPK_GetProfessionalTxt = ProfessionalPK.GetProfessionalTxt

-- require返回值
return ProfessionalPK
