local LEV        = 0    -- 装备等级
local QUALITY    = 1    -- 品质
local GEM        = 2    -- 宝石
local APPEND    = 3    -- 追加
local REDUCE    = 4    -- 神佑
local ENCHANT    = 5    -- 加持
local SOUL        = 6    -- 神魂
local QUENCH    = 7    -- 淬炼
local REFINE    = 8    -- 精炼
local VIALITY    = 9    -- 练气
local KONGFU    = 10-- 自创武功
local OFFICIAL    = 11-- 爵位
local ATTRI        = 12-- 属性点
local SUB_PRO    = 13-- 副职业
local METE        = 14-- 转世
local NEIGONG    = 15-- 内功
local QL        = 16-- 龙魂
local SOLDIER       = 17-- 战士战装
local TAOIST       = 18-- 道士战装

local SSS = 1
local SS = 2
local S = 3
local A = 4
local B = 5
local C = 6
local D = 7
local E = 8


-- 图标资源
local IconAni = {
    [LEV] = "WoYaoQiang_TB14",
    [QUALITY] = "WoYaoQiang_TB3",
    [GEM] = "WoYaoQiang_TB0",
    [APPEND] = "WoYaoQiang_TB8",
    [REDUCE] = "WoYaoQiang_TB7",
    [ENCHANT] = "WoYaoQiang_TB10",
    [SOUL] = "WoYaoQiang_TB11",
    [QUENCH] = "WoYaoQiang_TB16",
    [REFINE] = "WoYaoQiang_TB2",
    [VIALITY] = "WoYaoQiang_TB4",
    [KONGFU] = "WoYaoQiang_TB9",
    [OFFICIAL] = "WoYaoQiang_TB12",
    [ATTRI] = "WoYaoQiang_TB17",
    [SUB_PRO] = "WoYaoQiang_TB6",
    [METE] = "WoYaoQiang_TB5",
    [NEIGONG] = "WoYaoQiang_TB18",
    [QL] = "WoYaoQiang_TB1",
	[SOLDIER] = "WoYaoQiang_TB20",
    [TAOIST] = "WoYaoQiang_TB21",
}

local function GetIconAni(ftype, default)
    if (IconAni[ftype] == nil) then
        return default
    end

    return IconAni[ftype]
end

-- 评级资源
local RateAni = {
    [SSS] = "WoYaoQiang_SSS",
    [SS] = "WoYaoQiang_SS",
    [S] = "WoYaoQiang_S",
    [A] = "WoYaoQiang_A",
    [B] = "WoYaoQiang_B",
    [C] = "WoYaoQiang_C",
    [D] = "WoYaoQiang_D",
    [E] = "WoYaoQiang_E",
}

local function GetRateAni(rate, default)
    if (RateAni[rate] == nil) then
        return default
    end

    return RateAni[rate]
end

-- 个人江湖分数转评级
local function GetSelfRate(score)
    if (type(score) ~= "number") then
        return 0
    end
    
    if (score <= 40000) then
        return E
    elseif (score <= 80000) then
        return D
    elseif (score <= 150000) then
        return C
    elseif (score <= 200000) then
        return B
    elseif (score <= 300000) then
        return A
    elseif (score <= 400000) then
        return S
    elseif (score <= 500000) then
        return SS
    else
        return SSS
    end
end

-- 各细分评级建议
local RateAdvise = {
-- <个人评级>  {种类 -- 评级} 
    [SSS] = { [LEV] = SSS, [QUALITY] = SSS, [GEM]= SSS, [APPEND] = SSS, [REDUCE] = SSS, [ENCHANT] = SSS, [SOUL] = SSS, [QUENCH] = SSS, [REFINE] = SSS,
                [VIALITY] = SSS, [KONGFU] = SSS, [OFFICIAL] = SSS, [ATTRI] = SSS, [SUB_PRO] = SSS, [METE] = SSS, [NEIGONG] = SSS, [QL] = SSS, [SOLDIER] = SSS , [TAOIST] = SSS },
    [SS] = { [LEV] = SS, [QUALITY] = SS , [GEM]= SS, [APPEND] = SS, [REDUCE] = SS, [ENCHANT] = SS, [SOUL] = SS, [QUENCH] = SS, [REFINE] = SS,
                [VIALITY] = SS, [KONGFU] = SS, [OFFICIAL] = SS, [ATTRI] = SS, [SUB_PRO] = SS, [METE] = SS, [NEIGONG] = SS, [QL] = SS, [SOLDIER] = SS , [TAOIST] = SS},
    [S] = { [LEV] = S, [QUALITY] = S , [GEM]= S, [APPEND] = S, [REDUCE] = S, [ENCHANT] = S, [SOUL] = S, [QUENCH] = S, [REFINE] = S,
                [VIALITY] = S, [KONGFU] = S, [OFFICIAL] = S, [ATTRI] = S, [SUB_PRO] = S, [METE] = S, [NEIGONG] = S, [QL] = S, [SOLDIER] = S , [TAOIST] = S},
    [A] = { [LEV] = A, [QUALITY] = A , [GEM]= A, [APPEND] = A, [REDUCE] = A, [ENCHANT] = A, [SOUL] = A, [QUENCH] = A, [REFINE] = A,
                [VIALITY] = A, [KONGFU] = A, [OFFICIAL] = A, [ATTRI] = A, [SUB_PRO] = A, [METE] = A, [NEIGONG] = A, [QL] = A, [SOLDIER] = A  , [TAOIST] = A},
    [B] = { [LEV] = B, [QUALITY] = B , [GEM]= B, [APPEND] = B, [REDUCE] = B, [ENCHANT] = B, [SOUL] = B, [QUENCH] = B, [REFINE] = B,
                [VIALITY] = B, [KONGFU] = B, [OFFICIAL] = B, [ATTRI] = B, [SUB_PRO] = B, [METE] = B, [NEIGONG] = B, [QL] = B, [SOLDIER] = B  , [TAOIST] = B},
    [C] = { [LEV] = C, [QUALITY] = C , [GEM]= C, [APPEND] = C, [REDUCE] = C, [ENCHANT] = C, [SOUL] = C, [QUENCH] = C, [REFINE] = C,
                [VIALITY] = C, [KONGFU] = C, [OFFICIAL] = C, [ATTRI] = C, [SUB_PRO] = C, [METE] = C, [NEIGONG] = C, [QL] = C, [SOLDIER] = C  , [TAOIST] = C},
    [D] = { [LEV] = D, [QUALITY] = D , [GEM]= D, [APPEND] = D, [REDUCE] = D, [ENCHANT] = D, [SOUL] = D, [QUENCH] = D, [REFINE] = D,
                [VIALITY] = D, [KONGFU] = D, [OFFICIAL] = D, [ATTRI] = D, [SUB_PRO] = D, [METE] = D, [NEIGONG] = D, [QL] = D, [SOLDIER] = D , [TAOIST] = D},
    [E] = { [LEV] = E, [QUALITY] = E , [GEM]= E, [APPEND] = E, [REDUCE] = E, [ENCHANT] = E, [SOUL] = E, [QUENCH] = E, [REFINE] = E,
                [VIALITY] = E, [KONGFU] = E, [OFFICIAL] = E, [ATTRI] = E, [SUB_PRO] = E, [METE] = E, [NEIGONG] = E, [QL] = E, [SOLDIER] = E  , [TAOIST] = E},
}

local function GetRateAdvise(rate, ntype, default)
    if ( RateAdvise[rate][ntype] == nil ) then
        return default
    end

    return RateAdvise[rate][ntype]
end

-- 默认推荐等级和转世没有限制
local AdviseLimit = {
-- <种类 -- < 等级限制, 转世限制>>>
    [LEV] = { levlimit = 0, mete = 0 },
    [METE] = { levlimit = 120, mete = 0 },
    [ATTRI] = { levlimit = 15, mete = 1 },
    [KONGFU] = { levlimit = 30, mete = 2 },
    [VIALITY] = { levlimit = 120, mete = 2 },
    [OFFICIAL] = { levlimit = 100, mete = 0 },
}

local function GetAdviseLimit(ntype, index, default)
    if (UserData_IsOldSoldierServer() == true) or (UserData_IsCoinsServer() == true) then
        -- 练气,内功,自创武功,精炼
        if ntype == VIALITY or ntype ==  NEIGONG or ntype == KONGFU or ntype == REFINE or ntype == SUB_PRO then
            return 10000
        end
    end

    if ntype == nil or index == nil or AdviseLimit[ntype] == nil then
        return default
    end
    if (AdviseLimit[ntype][index] == nil ) then
        return default
    end
    
    return AdviseLimit[ntype][index]
end


-- 个人评级按实力评分分数分类< 种类 <评级--分数>> 只要值超过就达到该评级
local RateGrade = {
    [LEV] = { [SSS] = 961, [SS] = 900, [S] = 800, [A] = 700, [B] = 600, [C] = 400, [D] = 200, [E] = 0, },
    [QUALITY] = { [SSS] = 99, [SS] = 92, [S] = 82, [A] = 72, [B] = 62, [C] = 52, [D] = 32, [E] = 0, },
    [GEM] = { [SSS] = 20, [SS] = 16, [S] = 13, [A] = 11, [B] = 10, [C] = 6, [D] = 2, [E] = 0, },
    [APPEND] = { [SSS] = 144, [SS] = 108, [S] = 96, [A] = 84, [B] = 72, [C] = 36, [D] = 12, [E] = 0, },
    [REDUCE] = { [SSS] = 55, [SS] = 50, [S] = 43, [A] = 29, [B] = 15, [C] = 8, [D] = 3, [E] = 0, },
    [ENCHANT] = { [SSS] = 1785, [SS] = 1778, [S] = 1750, [A] = 1680, [B] = 1540, [C] = 1400, [D] = 1260, [E] = 0, },
    [SOUL] = { [SSS] = 49, [SS] = 30, [S] = 20, [A] = 18, [B] = 15, [C] = 12, [D] = 7, [E] = 0, },
    [QUENCH] = { [SSS] = 42, [SS] = 35, [S] = 20, [A] = 15, [B] = 10, [C] = 8, [D] = 6, [E] = 0, },
    [REFINE] = { [SSS] = 648, [SS] = 328, [S] = 100, [A] = 50, [B] = 30, [C] = 20, [D] = 10, [E] = 0, },
    [QL] = { [SSS] = 126, [SS] = 105, [S] = 84, [A] = 63, [B] = 35, [C] = 28, [D] = 14, [E] = 0, },
	[SOLDIER] = { [SSS] = 12000, [SS] = 10800, [S] = 9600, [A] = 7440, [B] = 4800, [C] = 2700, [D] = 1200, [E] = 0, },
	
    [VIALITY] = { [SSS] = 1600, [SS] = 1560, [S] = 1520, [A] = 1440, [B] = 1320, [C] = 1264, [D] = 1104, [E] = 0, },
    [KONGFU] = { [SSS] = 81000, [SS] = 60000, [S] = 50000, [A] = 40000, [B] = 30000, [C] = 20000, [D] = 10000, [E] = 0, },
    [OFFICIAL] = { [SSS] = 12, [SS] = 9, [S] = 7, [A] = 5, [B] = 3, [C] = 1, [D] = 0, },
    [ATTRI] = { [SSS] = 900, [SS] = 800, [S] = 700, [A] = 650, [B] = 600, [C] = 550, [D] = 500, [E] = 450, },
    [SUB_PRO] = { [SSS] = 63, [SS] = 49, [S] = 35, [A] = 28, [B] = 21, [C] = 14, [D] = 7, [E] = 0, },
    [METE] = { [SSS] = 2, [SS] = 2, [S] = 2, [A] = 1, [B] = 1, [C] = 1, [D] = 1, [E] = 0, },
    [NEIGONG] = { [SSS] = 1700, [SS] = 1000, [S] = 500, [A] = 400, [B] = 300, [C] = 200, [D] = 100, [E] = 0, },
	
	[TAOIST] = { [SSS] = 12000, [SS] = 9000, [S] = 7500, [A] = 6000, [B] = 4500, [C] = 3000, [D] = 1500, [E] = 0, },
}

-- 功能分数转换评级
local function ValueToRate(ntype, value)
    local grade = RateGrade[ntype]
    
    if (grade == nil) then
        return E
    end

    for i = SSS, E do
        if ( value >= grade[i] ) then
            return i
        end
    end
    
    return E
end

-- 分级[E] = 100表示在E级时进度条上限为100,超过100进入下一级; 最高级SSS的值仅用来显示,为最大值
-- 这里的数值表示类型的实力评分
local ProgressGrade = {
    [LEV] = { [SSS] = 961, [SS] = 961, [S] = 900, [A] = 800, [B] = 700, [C] = 600, [D] = 400, [E] = 200, },
    [QUALITY] = { [SSS] = 99, [SS] = 99, [S] = 92, [A] = 82, [B] = 72, [C] = 62, [D] = 52, [E] = 32, },
    [GEM] = { [SSS] = 20, [SS] = 20, [S] = 16, [A] = 13, [B] = 11, [C] = 10, [D] = 6, [E] = 2, },
    [APPEND] = { [SSS] = 144, [SS] = 144, [S] = 108, [A] = 96, [B] = 84, [C] = 72, [D] = 36, [E] = 12, },
    [REDUCE] = { [SSS] = 55, [SS] = 55, [S] = 50, [A] = 43, [B] = 29, [C] = 15, [D] = 8, [E] = 3, },
    [ENCHANT] = { [SSS] = 1785, [SS] = 1785, [S] = 1775, [A] = 1750, [B] = 1680, [C] = 1540, [D] = 1400, [E] = 1260, },
    [SOUL] = { [SSS] = 49, [SS] = 49, [S] = 30, [A] = 20, [B] = 18, [C] = 15, [D] = 12, [E] = 7, },
    [QUENCH] = { [SSS] = 42, [SS] = 42, [S] = 35, [A] = 20, [B] = 15, [C] = 10, [D] = 8, [E] = 6, },
    [REFINE] = { [SSS] = 648, [SS] = 648, [S] = 328, [A] = 100, [B] = 50, [C] = 30, [D] = 20, [E] = 10, },
    [QL] = { [SSS] = 126, [SS] = 126, [S] = 105, [A] = 84, [B] = 63, [C] = 35, [D] = 28, [E] = 14, },
    [SOLDIER] = { [SSS] = 12000, [SS] = 12000, [S] = 10800, [A] = 9600, [B] = 7440, [C] = 4800, [D] = 2700, [E] = 1200, },
	
    [VIALITY] = { [E] = 1104, [D] = 1264, [C] = 1320, [B] = 1440, [A] = 1520, [S] = 1560, [SS] = 1600, [SSS] = 1600, },
    [KONGFU] = { [E] = 10000, [D] = 20000, [C] = 30000, [B] = 40000, [A] = 50000, [S] = 60000, [SS] = 81000, [SSS] = 81000, },
    [OFFICIAL] = { [D] = 1, [C] = 3, [B] = 5, [A] = 7, [S] = 9, [SS] = 12, [SSS] = 12, },
    [ATTRI] = { [E] = 500, [D] = 550, [C] = 600, [B] = 650, [A] = 700, [S] = 800, [SS] = 900, [SSS] = 900, },
    [SUB_PRO] = { [E] = 7, [D] = 14, [C] = 21, [B] = 28, [A] = 35, [S] = 49, [SS] = 63, [SSS] = 63, },
    [METE] = { [E] = 1, [D] = 0, [C] = 0, [B] = 0, [A] = 2, [S] = 0, [SS] = 0, [SSS] = 2, },
    [NEIGONG] = { [E] = 100, [D] = 200, [C] = 300, [B] = 400, [A] = 500, [S] = 1000, [SS] = 1700, [SSS] = 1700, },
	[TAOIST] = {  [SSS] = 12000, [SS] = 12000, [S] = 9000, [A] = 7500, [B] = 6000, [C] = 4500, [D] = 3000, [E] = 1500 },
}

-- 我要变强最高显示实力评分(>=时隐藏按钮)
local function GetTopScore()
	return 695460
end

local function GetProgressGrade(ntype, rate)
    if (ProgressGrade[ntype][rate] == nil) then
        return 0
    end
    
    return ProgressGrade[ntype][rate]
end

--默认的获取方式
local METHOD_TYPE_OPEN_SHOP = 1  --打开天石商店
local METHOD_TYPE_GOTO_NPC = 2   -- 寻路去npc
local METHOD_TYPE_OPEN_DIALOG = 3 -- 打开窗口，可能出现一些层次等问题，目前拆秀坊和寻衣阁可支持使用
local METHOD_TYPE_OPEN_ACTIVITY = 4 -- 打开活动的id窗口
local METHOD_TYPE_TIP = 5 -- 提示,tip去cn_res.ini配置

local ItemGetWaysInfo = {
    -- 加持
    [ENCHANT] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 7000030,
            [2] = 7000130,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP11",type = METHOD_TYPE_OPEN_DIALOG, dialog = 3009, 
            },
        }
    },
	-- 神魂
    [SOUL]  = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 33108220,
            [2] = 33108210,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP16",type = METHOD_TYPE_GOTO_NPC, gotonpc = "1002,209,398,16849,2",
            },
        }
    },
	-- 淬炼
    [QUENCH] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 33104630,
            [2] = 33104100,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP17",type = METHOD_TYPE_OPEN_DIALOG, dialog = 410,
            },
            [2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP18",type = METHOD_TYPE_OPEN_DIALOG, dialog = 465, 
            },
        }
    },
	-- 龙魂
    [QL] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 42000110,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP12",type = METHOD_TYPE_OPEN_SHOP, 
            },
        }
    },
	-- 宝石
    [GEM] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 7000030,
            [2] = 7000130,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP11",type = METHOD_TYPE_OPEN_DIALOG, dialog = 3009, 
            },
        }
    },
	-- 神佑
    [REDUCE] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 7000730,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP19",type = METHOD_TYPE_OPEN_DIALOG, dialog = 438, 
            },
        }
    },
	-- 追加
    [APPEND] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 7300050,
        },
        -- 获取途径
        ["accessway"] = {
			[1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP8",type = METHOD_TYPE_OPEN_DIALOG, dialog = 1035,
            },
            [2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP20",type = METHOD_TYPE_GOTO_NPC, gotonpc = "1002,345,445,22050,2",
            },
        }
    },
	-- 装备等级
    [LEV] = {
        -- 获得物品（最多配两个）,itemtype *10 + 是否是赠品
        ["itemtype"] = {
            [1] = 10880010,
			[2] = 10880000,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP21",type = METHOD_TYPE_TIP, tip = "STR_STRENGTH_DEVELOP_FIND_TIP29",
            },
            [2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP11",type = METHOD_TYPE_OPEN_DIALOG, dialog = 3009, 
            },
        }
    },
	-- 神品精炼
    [REFINE] = {
        -- 获得物品（最多配两个）,itemtype *10 + 是否是赠品
        ["itemtype"] = {
            [1] = 30090010,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP20",type = METHOD_TYPE_GOTO_NPC, gotonpc = "1002,345,445,22050,2",
            },
            [2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP22",type = METHOD_TYPE_OPEN_DIALOG, dialog = 2201, 
            },
        }
    },
	-- 品质
    [QUALITY] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 10880000,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP11",type = METHOD_TYPE_OPEN_DIALOG, dialog = 3009, 
            },
        }
    },
	-- 属性点
    [ATTRI] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 30010440,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP1",type = METHOD_TYPE_GOTO_NPC, gotonpc = "1002,282,486,31880,2",
            },
        }
    },
	-- 练气
    [VIALITY] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 30080600,
			[2] = 30080590,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP6",type = METHOD_TYPE_GOTO_NPC, gotonpc = "1002,208,376,1152,2",
            },
			[2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP23",type = METHOD_TYPE_GOTO_NPC, gotonpc = "1002,275,484,3215,2",
            },
        }
    },
	-- 自创武功
    [KONGFU] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 33033730,
			[2] = 30020290,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP24",type = METHOD_TYPE_OPEN_DIALOG, dialog = 612,
            },
			[2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP25",type = METHOD_TYPE_TIP, tip = "STR_STRENGTH_DEVELOP_FIND_TIP31",
            },
        }
    },
	-- 副职业
    [SUB_PRO] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 7239030,
			[2] = 7212610,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP26",type = METHOD_TYPE_TIP, tip = "STR_STRENGTH_DEVELOP_FIND_TIP30",
            },
			[2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP27",type = METHOD_TYPE_GOTO_NPC, gotonpc = "1011,810,460,421,2",
            },
        }
    },
	-- 爵位
    [OFFICIAL] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 33241910,
			[2] = 33227620,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP7",type = METHOD_TYPE_GOTO_NPC, gotonpc = "1002,346,327,17980,2",
            },
			[2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP11",type = METHOD_TYPE_OPEN_DIALOG, dialog = 3009, 
            },
        }
    },
	-- 内功
    [NEIGONG] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 33142120,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP28",type = METHOD_TYPE_GOTO_NPC, gotonpc = "1002,378,385,23021,2",
            },
        }
    },
	-- 转世
    [METE] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 7110830,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP17",type = METHOD_TYPE_OPEN_DIALOG, dialog = 410,
            },
        }
    },
}

-- 老兵服配置
local ItemGetWaysInfo_OldSoldierSvr = {
    -- 装备等级
    [LEV] = {
        -- 获得物品（最多配两个）,itemtype *10 + 是否是赠品
        ["itemtype"] = {
            [1] = 10880010,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP4",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10364,309,365,31881,2",
            },
            [2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP5",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10364,308,379,31985,2",
            },
            [3] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP6",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10364,261,136,1152,2",
            },
            [4] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP7",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10364,320,282,17980,2",
            },
        }
    },
    -- 品质
    [QUALITY] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 10880000,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP8",type = METHOD_TYPE_OPEN_DIALOG, dialog = 1035, 
            },
            [2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP6",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10364,261,136,1152,2",
            },
            [3] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP9",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10364,320,282,17980,2",
            },
            [4] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP10",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10366,530,481,20823,2",
            },
        }
    },
    -- 宝石
    [GEM] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 7000030,
            [2] = 7000130,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP11",type = METHOD_TYPE_OPEN_DIALOG, dialog = 3009, 
            },
        }
    },
    -- 追加
    [APPEND] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 7300030,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP4",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10364,309,365,31881,2",
            },
            [2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP5",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10364,308,379,31985,2",
            },
            [3] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP8",type = METHOD_TYPE_OPEN_DIALOG, dialog = 1035,
            },
            [4] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP10",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10366,530,481,20823,2",
            },
        }
    },
    -- 神佑
    [REDUCE] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 7000730,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP11",type = METHOD_TYPE_OPEN_DIALOG, dialog = 3009, 
            },
        }
    },
    -- 加持
    [ENCHANT] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 7000030,
            [2] = 7000130,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP11",type = METHOD_TYPE_OPEN_DIALOG, dialog = 3009, 
            },
        }
    },
    -- 神魂
    [SOUL]  = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 33108220,
            [2] = 33108210,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP13",type = METHOD_TYPE_OPEN_ACTIVITY, activityid = 405,
            },
            [2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP8",type = METHOD_TYPE_OPEN_DIALOG, dialog = 1035, 
            },
        }
    },
    -- 淬炼
    [QUENCH] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 30042490,
            [2] = 33104630,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP14",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10364,302,275,31863,2",
            },
            [2] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP15",type = METHOD_TYPE_OPEN_DIALOG, dialog = 1035, 
            },
        }
    },
    -- 爵位
    [OFFICIAL] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 33241910,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP2",type = METHOD_TYPE_GOTO_NPC, gotonpc = "10364,320,282,17980,2",
            },
        }
    },
    -- 属性点
    [ATTRI] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 30010440,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP1",type = METHOD_TYPE_GOTO_NPC, gotonpc = "1036,295,227,31880,2",
            },
        }
    },
    -- 转世
    [METE] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 7212590,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP3",type = METHOD_TYPE_GOTO_NPC, gotonpc = "1036,312,243,31924,2",
            },
        }
    },
    -- 龙魂
    [QL] = {
        -- 获得物品（最多配两个）
        ["itemtype"] = {
            [1] = 42000110,
        },
        -- 获取途径
        ["accessway"] = {
            [1] = {
                text="STR_STRENGTH_DEVELOP_FIND_TIP12",type = METHOD_TYPE_OPEN_SHOP, 
            },
        }
    },
}
-- 获取物品途径信息
local function GetItemWaysInfo(typeid, para1, para2, para3)
    local ItemGetInfo = nil
    if UserData_IsOldSoldierServer() then
        ItemGetInfo = ItemGetWaysInfo_OldSoldierSvr
	elseif UserData_IsCoinsServer() then
        ItemGetInfo = ItemGetWaysInfo_OldSoldierSvr
    else
        ItemGetInfo = ItemGetWaysInfo
    end
    if ItemGetInfo[typeid] == nil then
        return 0
    end

    local ItemInfo = ItemGetInfo[typeid][para1]
    if ItemInfo == nil then
        return 0
    end

    if para2 == "Num" then
        return #ItemInfo
    end

    local ItemInfosub = ItemInfo[para2]
    if ItemInfosub == nil then
        return 0
    end

    if para3 == nil then
        return ItemInfosub
    end

    local AssessWayInfo = ItemInfosub[para3]
    if AssessWayInfo == nil then
        return 0
    end

    return AssessWayInfo
end


-- 清理变量释放内存
local function Unload()
    RateAni = nil
    ProgressGrade = nil
    RateGrade = nil
    AdviseLimit = nil
    RateAdvise = nil
    Recommend = nil
    RecommendAni = nil
end

-- 通过require传给其他Lua脚本使用
local StrengthDevelop = {
    GetItemWaysInfo = GetItemWaysInfo,
    GetCurAdviseRate = GetCurAdviseRate,
    GetSelfRate = GetSelfRate,
    GetRateAni = GetRateAni,
    GetProgressGrade = GetProgressGrade,
    ValueToRate = ValueToRate,
    GetAdviseLimit = GetAdviseLimit,
    GetRateAdvise = GetRateAdvise,
    GetRecommend = GetRecommend,
    GetIconAni = GetIconAni,
    GetTopScore = GetTopScore,
    Unload = Unload,
}

-- C++程序使用的global函数名
StrengthDevelop_GetItemWaysInfo = StrengthDevelop.GetItemWaysInfo
StrengthDevelop_GetCurAdviseRate = StrengthDevelop.GetCurAdviseRate
StrengthDevelop_GetRateAni = StrengthDevelop.GetRateAni
StrengthDevelop_GetSelfRate = StrengthDevelop.GetSelfRate
StrengthDevelop_GetProgressGrade = StrengthDevelop.GetProgressGrade
StrengthDevelop_ValueToRate = StrengthDevelop.ValueToRate
StrengthDevelop_GetAdviseLimit = StrengthDevelop.GetAdviseLimit
StrengthDevelop_GetRateAdvise = StrengthDevelop.GetRateAdvise
StrengthDevelop_GetRecommend = StrengthDevelop.GetRecommend
StrengthDevelop_GetIconAni = StrengthDevelop.GetIconAni
StrengthDevelop_GetTopScore = StrengthDevelop.GetTopScore
StrengthDevelop_Unload = StrengthDevelop.Unload

-- require返回值
return StrengthDevelop