--yuanshen_bg36 绿
--yuanshen_bg39 紫
--yuanshen_bg34 蓝
--yuanshen_bg32 红
--yuanshen_bg30 黄

--yuanshen_bg7 红
--yuanshen_bg8 黄
--yuanshen_bg9 蓝
-- 界面信息

local E_GUIDE_UPGRADE_UI_CLICK = 0			-- 点击修炼界面
local E_GUIDE_ITEM_CLICK = 1				-- 点击一键选择
local E_GUIDE_UPGRADE_CLICK = 2				-- 点击升级按钮
local E_GUIDE_UPGRADE_DLG_TOP_CLICK = 3		-- 点击升级界面突破按钮
local E_GUIDE_SELECT_CARD = 4				-- 选择主元神
local E_GUIDE_TOP_DLG_TOP_CLICK = 5			-- 点击突破界面突破按钮
local E_GUIDE_TOP_DLG_RETURN = 6			-- 点击突破界面返回
local E_GUIDE_BAG_CLICK = 7					-- 点击背包按钮
local E_GUIDE_BAG_OK = 8					-- 点击知道了按钮
local E_GUIDE_GOTO_CHALLENGE = 9			-- 前往挑战
local E_GUIDE_GOTO_PROGRESS = 10			-- 点击进度条
local E_GUIDE_WORLD_UI_CLICK = 11			-- 点击元神界界面
local E_GUIDE_WORLD_CALL_CLICK = 12			-- 点击元神召唤
local E_GUIDE_CALL_TEN_CLICK = 13			-- 点击召唤10次
local E_GUIDE_REWARD_SUC_UI_OK = 14			-- 点击元神抽奖成功确定按钮
local E_GUIDE_END = 15


-- 聊天类别
local TALK_CALLSS = {}
TALK_CALLSS.E_TALK_MAIN_DLG_ACTIVING = 1		-- 正在激活的元神
TALK_CALLSS.E_TALK_MAIN_DLG_CLICK_SPIRIT = 2	-- 点击元神
TALK_CALLSS.E_TALK_ACTIVE_NEW_SPIRIT = 3		-- 激活新的元神
TALK_CALLSS.E_TALK_UPGRADE_NO_ADD_LEV = 4		-- 修炼未升级
TALK_CALLSS.E_TALK_UPGRADE_ADD_LEV = 5		    -- 修炼升级
TALK_CALLSS.E_TALK_TOP_SUCESS = 6				-- 突破成功
TALK_CALLSS.E_TALK_TOP_FAILD = 7				-- 突破失败
TALK_CALLSS.E_TALK_CALL_SHOW_SPIRIT = 8		    -- 元神召唤展示元神
-- 神谕材料能升级的元神
local ShenYu = {
    --AABB ,AA品质下限，BB品质上限
    [3347151] = 0110,
    [3347152] = 0110,
    [3347153] = 0110,
    [3347154] = 0110,
    [3347155] = 0110,
    [3347156] = 0110,
    [3348377] = 0110,
}

-- 物品名称颜色
local ItemNameColor = {
    [3347152] = 0xff6fcd79,
    [3347153] = 0xff5dadf5,
    [3347154] = 0xffca6cf8,
    [3347155] = 0xffffd85c,
    [3347156] = 0xfff14b4b,
}

local tYuanshenType_yuanshen_advance = {}
tYuanshenType_yuanshen_advance[1] = {}
tYuanshenType_yuanshen_advance[2] = {}
tYuanshenType_yuanshen_advance[3] = {}
tYuanshenType_yuanshen_advance[4] = {}
tYuanshenType_yuanshen_advance[5] = {}
tYuanshenType_yuanshen_advance[6] = {}
tYuanshenType_yuanshen_advance[7] = {}
tYuanshenType_yuanshen_advance[8] = {}
tYuanshenType_yuanshen_advance[9] = {}
-- tYuanshenType_yuanshen_advance[1][0] = 500
tYuanshenType_yuanshen_advance[1][1] = 10000
-- tYuanshenType_yuanshen_advance[1][2] = 5000
-- tYuanshenType_yuanshen_advance[1][3] = 8000
-- tYuanshenType_yuanshen_advance[1][4] = 4700
-- tYuanshenType_yuanshen_advance[2][0] = 500
tYuanshenType_yuanshen_advance[2][1] = 10000
-- tYuanshenType_yuanshen_advance[2][2] = 5000
-- tYuanshenType_yuanshen_advance[2][3] = 8000
-- tYuanshenType_yuanshen_advance[2][4] = 4250
-- tYuanshenType_yuanshen_advance[3][0] = 450
tYuanshenType_yuanshen_advance[3][1] = 10000
-- tYuanshenType_yuanshen_advance[3][2] = 4500
-- tYuanshenType_yuanshen_advance[3][3] = 7200
-- tYuanshenType_yuanshen_advance[3][4] = 2550
-- tYuanshenType_yuanshen_advance[4][0] = 400
tYuanshenType_yuanshen_advance[4][1] = 10000
-- tYuanshenType_yuanshen_advance[4][2] = 4000
-- tYuanshenType_yuanshen_advance[4][3] = 6400
-- tYuanshenType_yuanshen_advance[4][4] = 1750
-- tYuanshenType_yuanshen_advance[5][0] = 350
tYuanshenType_yuanshen_advance[5][1] = 10000
-- tYuanshenType_yuanshen_advance[5][2] = 3500
-- tYuanshenType_yuanshen_advance[5][3] = 5600
-- tYuanshenType_yuanshen_advance[5][4] = 1250
-- tYuanshenType_yuanshen_advance[6][0] = 250
tYuanshenType_yuanshen_advance[6][1] = 10000
-- tYuanshenType_yuanshen_advance[6][2] = 2500
-- tYuanshenType_yuanshen_advance[6][3] = 4000
-- tYuanshenType_yuanshen_advance[6][4] = 1050
-- tYuanshenType_yuanshen_advance[7][0] = 200
tYuanshenType_yuanshen_advance[7][1] = 10000
-- tYuanshenType_yuanshen_advance[7][2] = 2000
-- tYuanshenType_yuanshen_advance[7][3] = 3200
-- tYuanshenType_yuanshen_advance[7][4] = 800
-- tYuanshenType_yuanshen_advance[8][0] = 150
tYuanshenType_yuanshen_advance[8][1] = 10000
-- tYuanshenType_yuanshen_advance[8][2] = 1500
-- tYuanshenType_yuanshen_advance[8][3] = 2400
-- tYuanshenType_yuanshen_advance[8][4] = 10000
-- tYuanshenType_yuanshen_advance[9][0] = 100
tYuanshenType_yuanshen_advance[9][1] = 1000
-- tYuanshenType_yuanshen_advance[9][2] = 1000
-- tYuanshenType_yuanshen_advance[9][3] = 1600
-- tYuanshenType_yuanshen_advance[9][4] = 10000


local YuanshenType = {"0201","0401","1001"}
local MaxQuality = 10
local UiInfo = {}
local UiFileInfo = {
    ["General"] = {
        -- 突破界面两个槽位的底框
        ["TupoQualityBg"] = {
            [1] = "yuanshen_bg63",
            [2] = "yuanshen_bg62",
            [3] = "yuanshen_bg64",
            [4] = "yuanshen_bg61",
            [5] = "yuanshen_bg60",
            [6] = "yuanshen_bg60",
            [7] = "yuanshen_bg60",
            [8] = "yuanshen_bg60",
            [9] = "yuanshen_bg60",
            [10] = "yuanshen_bg60",
        },
        -- 元神背包中元神的底框
        ["BagQualityBg"] = {
            [1] = "yuanshen_bg10",
            [2] = "yuanshen_bg9",
            [3] = "yuanshen_bg11",
            [4] = "yuanshen_bg8",
            [5] = "yuanshen_bg7",
            [6] = "yuanshen_bg7",
            [7] = "yuanshen_bg7",
            [8] = "yuanshen_bg7",
            [9] = "yuanshen_bg7",
            [10] = "yuanshen_bg7",
        },
        -- 召唤界面结果展示时元神的底框
        ["GachaQualityBg"] ={
            [1] = "yuanshen_bg44",
            [2] = "yuanshen_bg43",
            [3] = "yuanshen_bg46",
            [4] = "yuanshen_bg42",
            [5] = "yuanshen_bg41",
            [6] = "yuanshen_bg41",
            [7] = "yuanshen_bg41",
            [8] = "yuanshen_bg41",
            [9] = "yuanshen_bg41",
            [10] = "yuanshen_bg41",
        },
        -- 召唤界面结果展示时元神的底框特效
        ["LotteryQualityEff"] = {
            [1] = "yuanshen76",
            [2] = "yuanshen77",
            [3] = "yuanshen75",
            [4] = "yuanshen45",
            [5] = "yuanshen44",
            [6] = "yuanshen44",
            [7] = "yuanshen44",
            [8] = "yuanshen44",
            [9] = "yuanshen44",
            [10] = "yuanshen44",
        },
        -- 突破界面三个槽位底框特效
        ["TupoQualityEffect"] = {
            [1] = "",
            [2] = "",
            [3] = "",
            [4] = "yuanshen51",
            [5] = "yuanshen50",
            [6] = "yuanshen50",
            [7] = "yuanshen50",
            [8] = "yuanshen50",
            [9] = "yuanshen50",
            [10] = "yuanshen50",
        },
        -- 元神品质名称的底框
        ["QualityNameBg"] = {
            [1] = "yuanshen_bg30",
            [2] = "yuanshen_bg35",
            [3] = "yuanshen_bg40",
            [4] = "yuanshen_bg31",
            [5] = "yuanshen_bg33",
            [6] = "yuanshen_bg33",
            [7] = "yuanshen_bg33",
            [8] = "yuanshen_bg33",
            [9] = "yuanshen_bg33",
            [10] = "yuanshen_bg33",
        },
        -- 元神品质名称
        ["SpiritName"] = {
            [1] = "STR_PRIMORDIALSPIRIT_NAME_COLOR_01",
            [2] = "STR_PRIMORDIALSPIRIT_NAME_COLOR_02",
            [3] = "STR_PRIMORDIALSPIRIT_NAME_COLOR_03",
            [4] = "STR_PRIMORDIALSPIRIT_NAME_COLOR_04",
            [5] = "STR_PRIMORDIALSPIRIT_NAME_COLOR_05",
            [6] = "STR_PRIMORDIALSPIRIT_NAME_COLOR_06",
            [7] = "STR_PRIMORDIALSPIRIT_NAME_COLOR_07",
            [8] = "STR_PRIMORDIALSPIRIT_NAME_COLOR_08",
            [9] = "STR_PRIMORDIALSPIRIT_NAME_COLOR_09",
            [10] = "STR_PRIMORDIALSPIRIT_NAME_COLOR_10",
        },
        -- 抽奖物品非元神底框光效
        ["LotteryQualitySyEff"] = {
            [3347154] = "yuanshen75",
            [3347155] = "yuanshen45",
            [3347156] = "yuanshen44",
        },
    },
    ["0201"] = {
        -- 突破界面放入槽位后的元神图标
        ["AscendPro"] = "yuanshen_bg98",
        -- 元神名称
        ["Name"] = "STR_PRIMORDIALSPIRIT_NAME_201",
        -- 元神背包中的元神图标
        ["BagIcon"] = "yuanshen_bg85",
        -- 召唤界面结果展示时元神的图标
        ["GachaIcon"] = "yuanshen_bg49",
		["ProBg"] = "yuanshen_bg82",
        -- 元神品质名称
        ["QualityName1"] = "yuanshen_wz28",
        ["QualityName2"] = "yuanshen_wz27",
        ["QualityName3"] = "yuanshen_wz26",
        ["QualityName4"] = "yuanshen_wz25",
        ["QualityName5"] = "yuanshen_wz24",
        ["QualityName6"] = "yuanshen_wz39",
        ["QualityName7"] = "yuanshen_wz40",
        ["QualityName8"] = "yuanshen_wz41",
        ["QualityName9"] = "yuanshen_wz42",
        ["QualityName10"] = "yuanshen_wz43",
    },
    ["0401"] = {
        ["AscendPro"] = "yuanshen_bg97",
        ["Name"] = "STR_PRIMORDIALSPIRIT_NAME_401",
        ["BagIcon"] = "yuanshen_bg84",
        ["GachaIcon"] = "yuanshen_bg48",
		["ProBg"] = "yuanshen_bg81",
        ["QualityName1"] = "yuanshen_wz23",
        ["QualityName2"] = "yuanshen_wz22",
        ["QualityName3"] = "yuanshen_wz21",
        ["QualityName4"] = "yuanshen_wz20",
        ["QualityName5"] = "yuanshen_wz19",
        ["QualityName6"] = "yuanshen_wz44",
        ["QualityName7"] = "yuanshen_wz45",
        ["QualityName8"] = "yuanshen_wz46",
        ["QualityName9"] = "yuanshen_wz47",
        ["QualityName10"] = "yuanshen_wz48",
    },
    ["1001"] = {
        ["AscendPro"] = "yuanshen_bg96",
        ["Name"] = "STR_PRIMORDIALSPIRIT_NAME_1001",
        ["BagIcon"] = "yuanshen_bg83",
        ["GachaIcon"] = "yuanshen_bg47",
		["ProBg"] = "yuanshen_bg80",
        ["QualityName1"] = "yuanshen_wz18",
        ["QualityName2"] = "yuanshen_wz17",
        ["QualityName3"] = "yuanshen_wz16",
        ["QualityName4"] = "yuanshen_wz15",
        ["QualityName5"] = "yuanshen_wz14",
        ["QualityName6"] = "yuanshen_wz49",
        ["QualityName7"] = "yuanshen_wz50",
        ["QualityName8"] = "yuanshen_wz51",
        ["QualityName9"] = "yuanshen_wz52",
        ["QualityName10"] = "yuanshen_wz53",
    },
    
}

for i = 1, #YuanshenType do
    for j = 1, MaxQuality do
        if j < 10 then
            j = 0 .. j
        end
        k = tonumber(10 .. YuanshenType[i] .. j)
        UiInfo[k] = {}
        UiInfo[k]["TopBG"] = UiFileInfo["General"]["TupoQualityBg"][tonumber(j)]
        UiInfo[k]["ProUI"] = UiFileInfo[YuanshenType[i]]["AscendPro"]
        UiInfo[k]["QualityEff"] = UiFileInfo["General"]["TupoQualityEffect"][tonumber(j)]
        UiInfo[k]["ProName"] = UiFileInfo[string.sub(k,3,6)]["Name"]
        UiInfo[k]["QualityBg"] = UiFileInfo["General"]["QualityNameBg"][tonumber(j)]
        UiInfo[k]["QualityName"] = UiFileInfo[string.sub(k,3,6)]["QualityName" .. tonumber(j)]
        UiInfo[k]["CardQualityBg"] = UiFileInfo["General"]["BagQualityBg"][tonumber(j)]
        UiInfo[k]["CardIcon"] = UiFileInfo[string.sub(k,3,6)]["BagIcon"]
        UiInfo[k]["LotteryQualityBg"] = UiFileInfo["General"]["GachaQualityBg"][tonumber(j)]
        UiInfo[k]["LotteryCard"] = UiFileInfo[string.sub(k,3,6)]["GachaIcon"]
        UiInfo[k]["SpiritName"] = UiFileInfo["General"]["SpiritName"][tonumber(j)]
		UiInfo[k]["LotteryQualityEff"] = UiFileInfo["General"]["LotteryQualityEff"][tonumber(j)]
		UiInfo[k]["ProBg"] = UiFileInfo[string.sub(k,3,6)]["ProBg"]
    end
end

-- 获取元神界面信息
local ModelInfo = {
    -- 战士
    [2] = {
        -- 立绘光效
        ["ModelEff"] = "yuanshen56",
        -- 立绘描述
        ["ModelDesc"] = "STR_PRIMORDIALSPIRIT_MODEL_DESC_2",
        -- 图标
        ["Icon"] = "yuanshen_bg93",
        -- 图标光效
        ["IconEff"] = "yuanshen_tbcx_8900",
        -- 背景光效
        ["BgEff"] = "yuanshenyh4",
        -- 背景图
        ["Bg"] = "yuanshen_bg166",
        -- 背景转场
        ["BgTurnEff"] = "yuanshen_bg_8900",
    },
    -- 弓手
    [4] = {
        -- 立绘光效
        ["ModelEff"] = "yuanshen55",
        -- 立绘描述
        ["ModelDesc"] = "STR_PRIMORDIALSPIRIT_MODEL_DESC_4",
        -- 图标
        ["Icon"] = "yuanshen_bg92",
        -- 图标光效
        ["IconEff"] = "yuanshen_tbcx_8902",
        -- 背景光效
        ["BgEff"] = "yuanshen71",
        -- 背景图
        ["Bg"] = "yuanshen_bg2",
        -- 背景转场
        ["BgTurnEff"] = "yuanshen_bg_8902",
    },
    -- 道士
    [10] = {
        -- 立绘光效
        ["ModelEff"] = "yuanshen57",
        -- 立绘描述
        ["ModelDesc"] = "STR_PRIMORDIALSPIRIT_MODEL_DESC_10",
        -- 图标
        ["Icon"] = "yuanshen_bg91",
        -- 图标光效
        ["IconEff"] = "yuanshen_tbcx_8901",
        -- 背景光效
        ["BgEff"] = "yuanshenyh3",
        -- 背景图
        ["Bg"] = "yuanshen_bg165",
        -- 背景转场
        ["BgTurnEff"] = "yuanshen_bg_8901",
    },
}

-- 获取界面信息
local function GetUiInfo(itemtype, key)
    local pro = math.floor(itemtype / 10000 % 100)
    -- 立绘光效
    if key == "ModelEff" then
        return ModelInfo[pro]["ModelEff"]
    elseif key == "ModelDesc" then
        return ModelInfo[pro]["ModelDesc"]
    elseif key == "IconEff" then
        return ModelInfo[pro]["IconEff"]
    elseif key == "BgEff" then
        return ModelInfo[pro]["BgEff"]
    elseif key == "Bg" then
        return ModelInfo[pro]["Bg"]
    elseif key == "BgTurnEff" then
        return ModelInfo[pro]["BgTurnEff"]
    end

    if key == "LotteryQualitySyEff" then
        if UiFileInfo["General"]["LotteryQualitySyEff"][itemtype] ~= nil then
            return UiFileInfo["General"]["LotteryQualitySyEff"][itemtype]
        end
        return
    end
    if UiInfo[itemtype] ~= nil then
        return UiInfo[itemtype][key]
    end
end

-- 奖励预览
local RewardPreview = {
    [1] = {
        -- 元神
        [1] = {
            [1] = 10020101,
            [2] = 10040101,
            [3] = 10100101,
        },
        -- 物品
        [2] = {
            -- [1] = 3347151,
            [1] = 3348377,
        }
    },
    [2] = {
        -- 元神
        [1] = {
            [1] = 10020105,
            [2] = 10040105,
            [3] = 10100105,
        },
        -- 物品
        [2] = {
            [1] = 3347152,
            [2] = 3347153,
            [3] = 3347154,
            [4] = 3347155,
            [5] = 3347156,
        }
    }
}

 -- 任务信息
 local TaskInfo = {
    -- 战士 10AABBCC中间四位 AA职业，BB 种类，CC 品质
    [201] = {
        -- 任务1
        [1] = {
            -- 名称
            ["TaskName"] = "STR_PRIMORDIALSPIRIT_TASK1_201_NAME",
            -- 总页数
            ["PageNum"] = 3,
            [1] = "STR_PRIMORDIALSPIRIT_TASK1_201_1",
            [2] = "STR_PRIMORDIALSPIRIT_TASK1_201_2",
            [3] = "STR_PRIMORDIALSPIRIT_TASK1_201_3",
            -- 奖励物品
            ["RewardItem"] = 3347151,
            -- 奖励物品数量
            ["RewardNum"] = 10,
            -- 达成条件文本1
            ["ConditionText1"] = "STR_PRIMORDIALSPIRIT_QUALITY_2_3",
            -- 达成条件1(品质)
            ["Condition1"] = 1,
            -- 达成条件文本2
            ["ConditionText2"] = "STR_PRIMORDIALSPIRIT_CONDITION_2_1",
            -- 达成条件2 （地图id,x,y,npcid,半径）
            ["Condition2"] = "1002,435,661,7927,2",
            -- 任务id
            ["TaskId"] = 13965,
        },
        -- 任务2
        [2] = {
            -- 名称
            ["TaskName"] = "STR_PRIMORDIALSPIRIT_TASK2_201_NAME",
            -- 总页数
            ["PageNum"] = 3,
            [1] = "STR_PRIMORDIALSPIRIT_TASK2_201_1",
            [2] = "STR_PRIMORDIALSPIRIT_TASK2_201_2",
            [3] = "STR_PRIMORDIALSPIRIT_TASK2_201_3",
            -- 奖励物品
            ["RewardItem"] = 3347152,
            -- 奖励物品数量
            ["RewardNum"] = 9,
            -- 达成条件文本1
            ["ConditionText1"] = "STR_PRIMORDIALSPIRIT_QUALITY_2_4",
            -- 达成条件1(品质)
            ["Condition1"] = 1,
            -- 达成条件文本2
            ["ConditionText2"] = "STR_PRIMORDIALSPIRIT_CONDITION_2_2",
            -- 达成条件2 （地图id,x,y,npcid,半径）
            ["Condition2"] = "1002,435,661,7927,2",
            -- 任务id
            ["TaskId"] = 13965,
        },
        -- 任务3
        [3] = {
            -- 名称
            ["TaskName"] = "STR_PRIMORDIALSPIRIT_TASK3_201_NAME",
            -- 总页数
            ["PageNum"] = 3,
            [1] = "STR_PRIMORDIALSPIRIT_TASK3_201_1",
            [2] = "STR_PRIMORDIALSPIRIT_TASK3_201_2",
            [3] = "STR_PRIMORDIALSPIRIT_TASK3_201_3",
            -- 奖励物品
            ["RewardItem"] = 3347153,
            -- 奖励物品数量
            ["RewardNum"] = 7,
            -- 达成条件文本1
            ["ConditionText1"] = "STR_PRIMORDIALSPIRIT_QUALITY_2_5",
            -- 达成条件1(品质)
            ["Condition1"] = 1,
            -- 达成条件文本2
            ["ConditionText2"] = "STR_PRIMORDIALSPIRIT_CONDITION_2_3",
            -- 达成条件2 （地图id,x,y,npcid,半径）
            ["Condition2"] = "1002,435,661,7927,2",
            -- 任务id
            ["TaskId"] = 13965,
        }
    },
    -- 弓手
    [401] = {
        -- 任务1
        [1] = {
            -- 名称
            ["TaskName"] = "STR_PRIMORDIALSPIRIT_TASK1_401_NAME",
            -- 总页数
            ["PageNum"] = 3,
            [1] = "STR_PRIMORDIALSPIRIT_TASK1_401_1",
            [2] = "STR_PRIMORDIALSPIRIT_TASK1_401_2",
            [3] = "STR_PRIMORDIALSPIRIT_TASK1_401_3",
            -- 奖励物品
            ["RewardItem"] = 3347154,
            -- 奖励物品数量
            ["RewardNum"] = 7,
            -- 达成条件文本1
            ["ConditionText1"] = "STR_PRIMORDIALSPIRIT_QUALITY_4_1",
            -- 达成条件1(品质)
            ["Condition1"] = 1,
            -- 达成条件文本2
            ["ConditionText2"] = "STR_PRIMORDIALSPIRIT_CONDITION_4_1",
            -- 达成条件2 （地图id,x,y,npcid,半径）
            ["Condition2"] = "1002,435,661,7927,2",
            -- 任务id
            ["TaskId"] = 13965,
        },
        -- 任务2
        [2] = {
            -- 名称
            ["TaskName"] = "STR_PRIMORDIALSPIRIT_TASK2_401_NAME",
            -- 总页数
            ["PageNum"] = 3,
            [1] = "STR_PRIMORDIALSPIRIT_TASK2_401_1",
            [2] = "STR_PRIMORDIALSPIRIT_TASK2_401_2",
            [3] = "STR_PRIMORDIALSPIRIT_TASK2_401_3",
            -- 奖励物品
            ["RewardItem"] = 3347155,
            -- 奖励物品数量
            ["RewardNum"] = 7,
            -- 达成条件文本1
            ["ConditionText1"] = "STR_PRIMORDIALSPIRIT_QUALITY_4_3",
            -- 达成条件1(品质)
            ["Condition1"] = 1,
            -- 达成条件文本2
            ["ConditionText2"] = "STR_PRIMORDIALSPIRIT_CONDITION_4_2",
            -- 达成条件2 （地图id,x,y,npcid,半径）
            ["Condition2"] = "1002,435,661,7927,2",
            -- 任务id
            ["TaskId"] = 13965,
        },
        -- 任务3
        [3] = {
            -- 名称
            ["TaskName"] = "STR_PRIMORDIALSPIRIT_TASK3_401_NAME",
            -- 总页数
            ["PageNum"] = 3,
            [1] = "STR_PRIMORDIALSPIRIT_TASK3_401_1",
            [2] = "STR_PRIMORDIALSPIRIT_TASK3_401_2",
            [3] = "STR_PRIMORDIALSPIRIT_TASK3_401_3",
            -- 奖励物品
            ["RewardItem"] = 3347156,
            -- 奖励物品数量
            ["RewardNum"] = 7,
            -- 达成条件文本1
            ["ConditionText1"] = "STR_PRIMORDIALSPIRIT_QUALITY_4_6",
            -- 达成条件1(品质)
            ["Condition1"] = 1,
            -- 达成条件文本2
            ["ConditionText2"] = "STR_PRIMORDIALSPIRIT_CONDITION_4_3",
            -- 达成条件2 （地图id,x,y,npcid,半径）
            ["Condition2"] = "1002,435,661,7927,2",
            -- 任务id
            ["TaskId"] = 13965,
        }
    },
    -- 道士
    [1001] = {
        -- 任务1
        [1] = {
            -- 名称
            ["TaskName"] = "STR_PRIMORDIALSPIRIT_TASK1_1001_NAME",
            -- 总页数
            ["PageNum"] = 3,
            [1] = "STR_PRIMORDIALSPIRIT_TASK1_1001_1",
            [2] = "STR_PRIMORDIALSPIRIT_TASK1_1001_2",
            [3] = "STR_PRIMORDIALSPIRIT_TASK1_1001_3",
            -- 奖励物品
            ["RewardItem"] = 3347153,
            -- 奖励物品数量
            ["RewardNum"] = 7,
            -- 达成条件文本1
            ["ConditionText1"] = "STR_PRIMORDIALSPIRIT_QUALITY_10_1",
            -- 达成条件1(品质)
            ["Condition1"] = 1,
            -- 达成条件文本2
            ["ConditionText2"] = "STR_PRIMORDIALSPIRIT_CONDITION_10_1",
            -- 达成条件2 （地图id,x,y,npcid,半径）
            ["Condition2"] = "1002,435,661,7927,2",
            -- 任务id
            ["TaskId"] = 13965,
        },
        -- 任务2
        [2] = {
            -- 名称
            ["TaskName"] = "STR_PRIMORDIALSPIRIT_TASK2_1001_NAME",
            -- 总页数
            ["PageNum"] = 3,
            [1] = "STR_PRIMORDIALSPIRIT_TASK2_1001_1",
            [2] = "STR_PRIMORDIALSPIRIT_TASK2_1001_2",
            [3] = "STR_PRIMORDIALSPIRIT_TASK2_1001_3",
            -- 奖励物品
            ["RewardItem"] = 3347152,
            -- 奖励物品数量
            ["RewardNum"] = 6,
            -- 达成条件文本1
            ["ConditionText1"] = "STR_PRIMORDIALSPIRIT_QUALITY_10_4",
            -- 达成条件1(品质)
            ["Condition1"] = 1,
            -- 达成条件文本2
            ["ConditionText2"] = "STR_PRIMORDIALSPIRIT_CONDITION_10_2",
            -- 达成条件2 （地图id,x,y,npcid,半径）
            ["Condition2"] = "1002,435,661,7927,2",
            -- 任务id
            ["TaskId"] = 13965,
        },
        -- 任务3
        [3] = {
            -- 名称
            ["TaskName"] = "STR_PRIMORDIALSPIRIT_TASK3_1001_NAME",
            -- 总页数
            ["PageNum"] = 3,
            [1] = "STR_PRIMORDIALSPIRIT_TASK3_1001_1",
            [2] = "STR_PRIMORDIALSPIRIT_TASK3_1001_2",
            [3] = "STR_PRIMORDIALSPIRIT_TASK3_1001_3",
            -- 奖励物品
            ["RewardItem"] = 3347151,
            -- 奖励物品数量
            ["RewardNum"] = 7,
            -- 达成条件文本1
            ["ConditionText1"] = "STR_PRIMORDIALSPIRIT_QUALITY_10_7",
            -- 达成条件1(品质)
            ["Condition1"] = 1,
            -- 达成条件文本2
            ["ConditionText2"] = "STR_PRIMORDIALSPIRIT_CONDITION_10_3",
            -- 达成条件2 （地图id,x,y,npcid,半径）
            ["Condition2"] = "1002,435,661,7927,2",
            -- 任务id
            ["TaskId"] = 13965,
        }
    }
 }

-- 获取召唤奖励预览
local function GetRewardPreview(lotteryType, para1, para2)
    if para2 == "Count" then
        return #RewardPreview[lotteryType][para1]
    end

    return RewardPreview[lotteryType][para1][para2]
end

-- 获取元神录任务信息
local function GetTaskInfo(idItemType, para1, para2)
    local id = math.floor(idItemType / 100 % 10000)

    if TaskInfo[id] == nil or TaskInfo[id][para1] == nil then
        return
    end

    if para2 == "Condition1" then
        local quality = math.floor(idItemType % 100)
        local conditionQuality = TaskInfo[id][para1][para2]
        print("quality"..quality.."conditionQuality"..conditionQuality)
        if quality >= conditionQuality then
            return true
        end
        return false
    end

    return TaskInfo[id][para1][para2]
end

-- 元神按钮是否开启
local function IsOpen(nlev, nMete)
	if UserData_IsOldSoldierServer() == true then
		return false
	end
	-- 屏蔽掉钱服
	if UserData_IsCoinsServer() == true then
		return false
	end
	
	if nlev >= 30 and nMete >= 2 then
		return true
	end
	
	return false
end

-- 任务详情
local TaskDetail = {
    [13965] = {
        --参数1地图id,参数2，参数3，xy坐标，参数4Npcid配0就是寻路，参数5是半径
        ["TaskPos"] = {
            ["Passion"] = "10364,291,334,0,2",
            ["Old"] = "1002,487,297,0,2",
			["OldBing"] = "10364,291,334,0,2",
        }
    },
  
    [7886] = {},

	
    [3891] = {
        --参数1地图id,参数2，参数3，xy坐标，参数4Npcid配0就是寻路，参数5是半径
        ["TaskPos"] = {
            ["Passion"] = "1036,100,100,0,2",
            ["Old"] = "1002,487,297,0,2",
			["OldBing"] = "1036,100,150,0,2",
        }
    },
	
  -- 新增任务
    [7938] = {
        --参数1地图id,参数2，参数3，xy坐标，参数4Npcid配0就是寻路，参数5是半径
        ["TaskPos"] = {
            ["Passion"] = "1036,333,230,36861,2",
            ["Old"] = "1002,468,353,36861,2",
			["OldBing"] = "1036,333,230,36861,2",
        }
    },
}

-- 是否是元神任务id
local function IsMyTask(taskid)
    local TaskId = TaskDetail[taskid]
    if TaskId == nil then
        return false
    end

    return true
end

-- 获取任务Id
local function GetTaskId(key)
    if key == "Challenge" then
        return 7938
    end
end


-- 获取元神解锁任务
local function GetTaskPos(id, key)
    if UserData_IsPassionServer() then 
        return TaskDetail[id][key]["Passion"]
    elseif UserData_IsOldSoldierServer() then 
		return TaskDetail[id][key]["OldBing"]
	elseif UserData_IsCoinsServer() then 
		return TaskDetail[id][key]["OldBing"]
	else
        return TaskDetail[id][key]["Old"]
    end
    
end

-- 经验信息
local ExpInfo = {
    -- 元神碎片
    [3347151] = {
        -- 消耗币种0金币1天石
        ["Cost"] = 1,
        -- 消耗数量
        ["CostNum"] = 3,
        -- 提供经验
        ["Exp"] = 200,
    },
    -- 元神碎片
    [3347152] = {
        -- 消耗币种0金币1天石
        ["Cost"] = 0,
        -- 消耗数量
        ["CostNum"] = 0,
        -- 提供经验
        ["Exp"] = 500,
    },
    -- 元神碎片
    [3347153] = {
        -- 消耗币种0金币1天石
        ["Cost"] = 0,
        -- 消耗数量
        ["CostNum"] = 0,
        -- 提供经验
        ["Exp"] = 1500,
    },
    -- 元神碎片
    [3347154] = {
        -- 消耗币种0金币1天石
        ["Cost"] = 0,
        -- 消耗数量
        ["CostNum"] = 0,
        -- 提供经验
        ["Exp"] = 4500,
    },
    -- 元神碎片
    [3347155] = {
        -- 消耗币种0金币1天石
        ["Cost"] = 0,
        -- 消耗数量
        ["CostNum"] = 0,
        -- 提供经验
        ["Exp"] = 13500,
    },
    -- 元神碎片
    [3347156] = {
        -- 消耗币种0金币1天石
        ["Cost"] = 1,
        -- 消耗数量
        ["CostNum"] = 999999999,
        -- 提供经验
        ["Exp"] = 40500,
    },
    -- 神谕残页
    [3348377] = {
        -- 消耗币种0金币1天石
        ["Cost"] = 1,
        -- 消耗数量
        ["CostNum"] = 999999999,
        -- 提供经验
        ["Exp"] = 100,
    },
    -- 元神sort
    [28] = {
        -- 基础经验
        ["BaseExp"] = 200,
        -- 同类元神经验系数(百分比)
        ["SameRatio"] = 60,
        -- 其他元神经验系数(百分比)
        ["OtherRatio"] = 40,
    }
}

-- 获取经验
local function GetExpInfo(type, key)
    return ExpInfo[type][key]
end

-- 计算元神经验
local function GetCardExp(itemtype1, itemtype2, totalexp)
    local baseExp = ExpInfo[28]["BaseExp"]
    if math.floor(itemtype1 / 100 % 10000) == math.floor(itemtype2 / 100 % 10000) then
        local sameRatio = ExpInfo[28]["SameRatio"]
        return (totalexp + baseExp) * sameRatio / 100
    else
        local otherRatio = ExpInfo[28]["OtherRatio"]
        return (totalexp + baseExp) * otherRatio / 100  
    end
end


--这边需要配置技能对应的解锁条件，Cn_Res拼串的值
local MagicUnlockCon = {
    --该技能的解锁条件是什么AABBCC:AA:职业 BB：种类 CC：品质
    [24420] = 020105, 
}

local BaseInfo = {
    ["QualityMax"] = 10,
    ["LevMax"] = 1,
    ["NormalColor"] = 0xffff0000,
    ["PSColor"] = 0xffff0000,
    ["AddColor"] = 0xffff0000,
    --职业元神相关
    --元神技能栏相关光效
    ["ProEff2"] = "yuanshen59",
    ["ProEff10"] = "yuanshen60",
    ["ProEff4"] = "yuanshen58",
    --职业元神种类
    ["ProNum"] = 3,
    --全部
    ["ProIndex0"] = "0",
    ["ProIcon0"] = "yuanshen_btn35",
    --道士元神
    ["ProIndex1"] = "10",
    ["ProIcon1"] = "yuanshen_btn36",
    --战士元神
    ["ProIndex2"] = "2",
    ["ProIcon2"] = "yuanshen_btn38",
    --弓手元神
    ["ProIndex3"] = "4",
    ["ProIcon3"] = "yuanshen_btn37",

    --突破过程光效时长
    ["TopSuc"] = 5.5,
    --突破失败光效时长
    ["TopFail"] = 1.5,
	-- 无双乱舞
	["wslwProTime"] = 80,
}

local function GetBaseInfo(key)
    return BaseInfo[key]
end

-- 人模信息
local RolePartData = {
    -- 战士
    [89000000] = {
        ["OffsetX"] = 10,
        ["OffsetY"] = 120,
        ["RotateX"] = 10,
        ["RotateY"] = 0,
        ["RotateZ"] = 0,
    },
    -- 弓手
    [89020000] = {
        ["OffsetX"] = 10,
        ["OffsetY"] = 120,
        ["RotateX"] = 10,
        ["RotateY"] = 0,
        ["RotateZ"] = 0,
    },
    -- 道士
    [89010000] = {
        ["OffsetX"] = 10,
        ["OffsetY"] = 180,
        ["RotateX"] = 10,
        ["RotateY"] = 0,
        ["RotateZ"] = 0,
    },
}

-- 获取人模id
local function GetRolePartId(idItemType)
    local pro = math.floor(idItemType / 10000 % 100)
    -- 战士
    if pro == 2 then
        return 89000000
    -- 弓手
    elseif pro == 4 then
        return 89020000
    -- 道士
    elseif pro == 10 then  
        return 89010000
   end 
end

-- 获取人模信息
local function GetRolePartData(partId, key)
    return RolePartData[partId][key]
end

local SpiritView = {
	-- 元神ID，约定为物品type
    [10020101] = {
		-- 元神的模型ID
		["View"] = 89000000,
		-- 右手武器模型ID
		["RWeapon"] = 510030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_zscx",
		-- 消失光效
		["HideEff"] = "yuanshen_zsxs",
	},
    [10020102] = {
		-- 元神的模型ID
		["View"] = 89000000,
		-- 右手武器模型ID
		["RWeapon"] = 510030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_zscx",
		-- 消失光效
		["HideEff"] = "yuanshen_zsxs",
	},
    [10020103] = {
		-- 元神的模型ID
		["View"] = 89000000,
		-- 右手武器模型ID
		["RWeapon"] = 510030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_zscx",
		-- 消失光效
		["HideEff"] = "yuanshen_zsxs",
	},
    [10020104] = {
		-- 元神的模型ID
		["View"] = 89000000,
		-- 右手武器模型ID
		["RWeapon"] = 510030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_zscx",
		-- 消失光效
		["HideEff"] = "yuanshen_zsxs",
	},
    [10020105] = {
		-- 元神的模型ID
		["View"] = 89000000,
		-- 右手武器模型ID
		["RWeapon"] = 510030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_zscx",
		-- 消失光效
		["HideEff"] = "yuanshen_zsxs",
	},
    [10020106] = {
		-- 元神的模型ID
		["View"] = 89000000,
		-- 右手武器模型ID
		["RWeapon"] = 510030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_zscx",
		-- 消失光效
		["HideEff"] = "yuanshen_zsxs",
	},
    [10020107] = {
		-- 元神的模型ID
		["View"] = 89000000,
		-- 右手武器模型ID
		["RWeapon"] = 510030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_zscx",
		-- 消失光效
		["HideEff"] = "yuanshen_zsxs",
	},
    [10020108] = {
		-- 元神的模型ID
		["View"] = 89000000,
		-- 右手武器模型ID
		["RWeapon"] = 510030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_zscx",
		-- 消失光效
		["HideEff"] = "yuanshen_zsxs",
	},
    [10020109] = {
		-- 元神的模型ID
		["View"] = 89000000,
		-- 右手武器模型ID
		["RWeapon"] = 510030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_zscx",
		-- 消失光效
		["HideEff"] = "yuanshen_zsxs",
	},
    [10020110] = {
		-- 元神的模型ID
		["View"] = 89000000,
		-- 右手武器模型ID
		["RWeapon"] = 510030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_zscx",
		-- 消失光效
		["HideEff"] = "yuanshen_zsxs",
	},
	[10100101] = {
		-- 元神的模型ID
		["View"] = 89010000,
		-- 右手武器模型ID
		["RWeapon"] = 421030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_dscx",
		-- 消失光效
		["HideEff"] = "yuanshen_dsxs",
	},
	[10100102] = {
		-- 元神的模型ID
		["View"] = 89010000,
		-- 右手武器模型ID
		["RWeapon"] = 421030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_dscx",
		-- 消失光效
		["HideEff"] = "yuanshen_dsxs",
	},
	[10100103] = {
		-- 元神的模型ID
		["View"] = 89010000,
		-- 右手武器模型ID
		["RWeapon"] = 421030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_dscx",
		-- 消失光效
		["HideEff"] = "yuanshen_dsxs",
	},
	[10100104] = {
		-- 元神的模型ID
		["View"] = 89010000,
		-- 右手武器模型ID
		["RWeapon"] = 421030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_dscx",
		-- 消失光效
		["HideEff"] = "yuanshen_dsxs",
	},
	[10100105] = {
		-- 元神的模型ID
		["View"] = 89010000,
		-- 右手武器模型ID
		["RWeapon"] = 421030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_dscx",
		-- 消失光效
		["HideEff"] = "yuanshen_dsxs",
	},
	[10100106] = {
		-- 元神的模型ID
		["View"] = 89010000,
		-- 右手武器模型ID
		["RWeapon"] = 421030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_dscx",
		-- 消失光效
		["HideEff"] = "yuanshen_dsxs",
	},
	[10100107] = {
		-- 元神的模型ID
		["View"] = 89010000,
		-- 右手武器模型ID
		["RWeapon"] = 421030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_dscx",
		-- 消失光效
		["HideEff"] = "yuanshen_dsxs",
	},
	[10100108] = {
		-- 元神的模型ID
		["View"] = 89010000,
		-- 右手武器模型ID
		["RWeapon"] = 421030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_dscx",
		-- 消失光效
		["HideEff"] = "yuanshen_dsxs",
	},
	[10100109] = {
		-- 元神的模型ID
		["View"] = 89010000,
		-- 右手武器模型ID
		["RWeapon"] = 421030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_dscx",
		-- 消失光效
		["HideEff"] = "yuanshen_dsxs",
	},
	[10100110] = {
		-- 元神的模型ID
		["View"] = 89010000,
		-- 右手武器模型ID
		["RWeapon"] = 421030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_dscx",
		-- 消失光效
		["HideEff"] = "yuanshen_dsxs",
	},
	[10040101] = {
		-- 元神的模型ID
		["View"] = 89020000,
		-- 右手武器模型ID
		["RWeapon"] = 500030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_gscx",
		-- 消失光效
		["HideEff"] = "yuanshen_gsxs",
	},
	[10040102] = {
		-- 元神的模型ID
		["View"] = 89020000,
		-- 右手武器模型ID
		["RWeapon"] = 500030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_gscx",
		-- 消失光效
		["HideEff"] = "yuanshen_gsxs",
	},
	[10040103] = {
		-- 元神的模型ID
		["View"] = 89020000,
		-- 右手武器模型ID
		["RWeapon"] = 500030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_gscx",
		-- 消失光效
		["HideEff"] = "yuanshen_gsxs",
	},
	[10040104] = {
		-- 元神的模型ID
		["View"] = 89020000,
		-- 右手武器模型ID
		["RWeapon"] = 500030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_gscx",
		-- 消失光效
		["HideEff"] = "yuanshen_gsxs",
	},
	[10040105] = {
		-- 元神的模型ID
		["View"] = 89020000,
		-- 右手武器模型ID
		["RWeapon"] = 500030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_gscx",
		-- 消失光效
		["HideEff"] = "yuanshen_gsxs",
	},
	[10040106] = {
		-- 元神的模型ID
		["View"] = 89020000,
		-- 右手武器模型ID
		["RWeapon"] = 500030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_gscx",
		-- 消失光效
		["HideEff"] = "yuanshen_gsxs",
	},
	[10040107] = {
		-- 元神的模型ID
		["View"] = 89020000,
		-- 右手武器模型ID
		["RWeapon"] = 500030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_gscx",
		-- 消失光效
		["HideEff"] = "yuanshen_gsxs",
	},
	[10040108] = {
		-- 元神的模型ID
		["View"] = 89020000,
		-- 右手武器模型ID
		["RWeapon"] = 500030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_gscx",
		-- 消失光效
		["HideEff"] = "yuanshen_gsxs",
	},
	[10040109] = {
		-- 元神的模型ID
		["View"] = 89020000,
		-- 右手武器模型ID
		["RWeapon"] = 500030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_gscx",
		-- 消失光效
		["HideEff"] = "yuanshen_gsxs",
	},
	[10040110] = {
		-- 元神的模型ID
		["View"] = 89020000,
		-- 右手武器模型ID
		["RWeapon"] = 500030,
		-- 左手武器模型ID
		["LWeapon"] = 0,
		-- 出现光效
		["ShowEff"] = "yuanshen_gscx",
		-- 消失光效
		["HideEff"] = "yuanshen_gsxs",
	},
}

local function GetSpiritView(idtype,index,mount)
	local id = SpiritView[idtype]
	
	if (id == nil) then
		return 0
	end

	id = id[index]	
	
	if ((mount ~= 0) and (index == "ShowEff" or index == "HideEff")) then
		id = id.."mount"
	end
	
	if (id == nil) then
		return 0
	end
	
    return id
end

-- 获得突破的下一级的itemtype
local function GetNextQualityItem(itemtype)
    return itemtype + 1
end

--获取突破上一级的itemtype
local function GetBeforeQualityItem(itemtype)
    return itemtype - 1
end

local function GetMaxQualityItem(itemtype)
    return math.floor(itemtype / 100) * 100 + BaseInfo["QualityMax"]
end

--填写成功率计算公式,直接返回百分比成功率的值如：66.66
local function GetTopSucPercent(mainTypeid, seconTypeid, secondLev)

	local nResult = string.sub(mainTypeid,8,8)
	local nFirstNum = tonumber(nResult)
	local nOutput = tYuanshenType_yuanshen_advance[nFirstNum][secondLev]

	return nOutput/100
	-- return mainTypeid
	-- return 66.66
end

local function GetAttrValue(id, value)
    --万分比属性
    if (id >=10 and id <= 15) or (id >= 27 and id <= 29) then
        return string.format("%.2f", value / 100) 
    end

    return string.format("%d", math.ceil(value)) 
end

local function GetAttrStr(id,type)
    if type == "Name" then
        return "STR_PRIMORDIALSPIRIT_ATTR_NAME1_"..math.ceil(id)
    elseif type == "Attr" then
        --这里是原神属性
        if id <= 35 and id >= 33 then
            return "STR_PRIMORDIALSPIRIT_ATTR_TIP1" 
        --这里是万分比属性
        elseif (id >=10 and id <= 15) or (id >= 27 and id <= 29) then
            return "STR_PRIMORDIALSPIRIT_ATTR_TIP2"
        else
            return "STR_PRIMORDIALSPIRIT_ATTR_TIP3"
        end
    elseif type == "AttrAdd" then
        --这里是原神属性
        if id <= 35 and id >= 33 then
            return "STR_PRIMORDIALSPIRIT_ATTR_TIP4" 
        --这里是万分比属性
       elseif (id >=10 and id <= 15) or (id >= 27 and id <= 29) then
           return "STR_PRIMORDIALSPIRIT_ATTR_TIP5"
        else
            return "STR_PRIMORDIALSPIRIT_ATTR_TIP6"
        end
    end
end
-- 对应界面从上到下5种神谕消耗
local SpiritDebrisCraftCost = {

    [0] = {
        -- 0:金币 1:天石
        ["Type"] = 0,
        ["Price"] = 0,  
    },
    [1] = {
        -- 0:金币 1:天石
        ["Type"] = 0,
        ["Price"] = 0,  
    },
    [2] = {
        -- 0:金币 1:天石
        ["Type"] = 0,
        ["Price"] = 0,  
    },
    [3] = {
        -- 0:金币 1:天石
        ["Type"] = 0,
        ["Price"] = 0,  
    },
    [4] = {
        -- 0:金币 1:天石
        ["Type"] = 1,
        ["Price"] = 3,  
    },
}

--满级满品质的元神加上的经过换算的经验值评分
--具体算法具体系数在这个函数修改，参数为额外加的经验值
--当前0.5为测试值并非正式值
local function GetSpiritScoreExByExp(Exp)
    return math.floor(Exp/50000)*10
end

-- 获取5种神谕消耗
local function GetSpiritDebrisCraftCostInfo(index, key)
    if SpiritDebrisCraftCost[index] ~= nil then
        if SpiritDebrisCraftCost[index][key] ~= nil then
            return SpiritDebrisCraftCost[index][key]
        end
    end

    return nil
end


local function GetMagicUnlockConStr(idMagic, itemtype)
    if MagicUnlockCon[idMagic] == nil then
        return "STR_PRIMORDIALSPIRIT_MAGIC_0_TIP"
    end

    return "STR_PRIMORDIALSPIRIT_MAGIC_"..MagicUnlockCon[idMagic].."_TIP"
end

-- 元神对话
local RolePartTalkInfo =  {

    [100201] = {
        [TALK_CALLSS.E_TALK_MAIN_DLG_ACTIVING] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100201_1_",
            -- 概率
            ["percentage"] = 50,
        },
        [TALK_CALLSS.E_TALK_MAIN_DLG_CLICK_SPIRIT] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100201_2_",
            -- 概率
            ["percentage"] = 100,
        }, 
        [TALK_CALLSS.E_TALK_ACTIVE_NEW_SPIRIT] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100201_3_",
            -- 概率
            ["percentage"] = 100,
        }, 
        [TALK_CALLSS.E_TALK_UPGRADE_NO_ADD_LEV] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100201_4_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_UPGRADE_ADD_LEV] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100201_5_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_TOP_SUCESS] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100201_6_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_TOP_FAILD] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100201_7_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_CALL_SHOW_SPIRIT] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100201_8_",
            -- 概率
            ["percentage"] = 100,
        },
    },
    [100401] = {
        -- 场景
        [TALK_CALLSS.E_TALK_MAIN_DLG_ACTIVING] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100401_1_，100401元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100401_1_",
            -- 概率
            ["percentage"] = 50,
        },
        [TALK_CALLSS.E_TALK_MAIN_DLG_CLICK_SPIRIT] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100401_1_，100401元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100401_2_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_ACTIVE_NEW_SPIRIT] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100401_3_",
            -- 概率
            ["percentage"] = 100,
        }, 
        [TALK_CALLSS.E_TALK_UPGRADE_NO_ADD_LEV] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100401_4_",
            -- 概率
            ["percentage"] = 100,
        }, 
        [TALK_CALLSS.E_TALK_UPGRADE_ADD_LEV] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100401_5_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_TOP_SUCESS] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100401_6_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_TOP_FAILD] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100401_7_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_CALL_SHOW_SPIRIT] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_100401_8_",
            -- 概率
            ["percentage"] = 100,
        },
    },
    [101001] = {
        -- 场景
        [TALK_CALLSS.E_TALK_MAIN_DLG_ACTIVING] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_101001_1_，101001元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_101001_1_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_MAIN_DLG_CLICK_SPIRIT] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_101001_1_，101001元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_101001_2_",
            -- 概率
            ["percentage"] = 100,
        }, 
        [TALK_CALLSS.E_TALK_ACTIVE_NEW_SPIRIT] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_101001_3_",
            -- 概率
            ["percentage"] = 100,
        }, 
        [TALK_CALLSS.E_TALK_UPGRADE_NO_ADD_LEV] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_101001_4_",
            -- 概率
            ["percentage"] = 100,
        }, 
        [TALK_CALLSS.E_TALK_UPGRADE_ADD_LEV] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_101001_5_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_TOP_SUCESS] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_101001_6_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_TOP_FAILD] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_101001_7_",
            -- 概率
            ["percentage"] = 100,
        },
        [TALK_CALLSS.E_TALK_CALL_SHOW_SPIRIT] = {
            -- 文本数量
            ["count"] = 2,
            -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_100201_1_，100201元神前6位，_1是类型，最后加一个小于“count”的索引)
            ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_101001_8_",
            -- 概率
            ["percentage"] = 100,
        },
    },
    -- 主界面
    [3877] = {
        -- 场景1
        [1] = {
            -- 职业
            [2] = {
                -- 文本数量
                ["count"] = 30,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_2_",
                -- 概率
                ["percentage"] = 50,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 720,
                ["action2"] = 721,
            }, 
            -- 职业
            [4] = {
                -- 数量
                ["count"] = 30,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_4_",
                -- 概率
                ["percentage"] = 50,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 730,
                ["action2"] = 731,
            }, 
            -- 职业
            [10] = {
                -- 数量
                ["count"] = 27,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_10_",
                -- 概率
                ["percentage"] = 50,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 733,
                ["action2"] = 734,
            }, 
        },
        -- 场景2(引导第一步)
        [2] = {
            -- 职业
            [2] = {
                -- 文本数量
                ["count"] = 1,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_2_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 720,
                ["action2"] = 721,
            }, 
            -- 职业
            [4] = {
                -- 数量
                ["count"] = 3,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_2_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 730,
                ["action2"] = 731,
            }, 
            -- 职业
            [10] = {
                -- 数量
                ["count"] = 3,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_2_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 733,
                ["action2"] = 734,
            }, 
        },
        -- 场景2(引导第二步)
        [3] = {
            -- 职业
            [2] = {
                -- 文本数量
                ["count"] = 1,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_3_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 720,
                ["action2"] = 721,
            }, 
            -- 职业
            [4] = {
                -- 数量
                ["count"] = 3,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_3_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 730,
                ["action2"] = 731,
            }, 
            -- 职业
            [10] = {
                -- 数量
                ["count"] = 3,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_3_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 733,
                ["action2"] = 734,
            }, 
        },
        -- 场景2(引导第三步)
        [4] = {
            -- 职业
            [2] = {
                -- 文本数量
                ["count"] = 1,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_4_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 720,
                ["action2"] = 721,
            }, 
            -- 职业
            [4] = {
                -- 数量
                ["count"] = 3,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_4_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 730,
                ["action2"] = 731,
            }, 
            -- 职业
            [10] = {
                -- 数量
                ["count"] = 3,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_4_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 733,
                ["action2"] = 734,
            }, 
        },
        -- 场景2(引导第四步)
        [5] = {
            -- 职业
            [2] = {
                -- 文本数量
                ["count"] = 1,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_5_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 720,
                ["action2"] = 721,
            }, 
            -- 职业
            [4] = {
                -- 数量
                ["count"] = 3,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_5_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 730,
                ["action2"] = 731,
            }, 
            -- 职业
            [10] = {
                -- 数量
                ["count"] = 3,
                -- 文本前缀(根据上面的count数量在cn_res.ini中配置STR_PRIMORDIALSPIRIT_TALK_3877_1_1~STR_PRIMORDIALSPIRIT_TALK_3877_1_“count”，3877是窗口id，_1是类型)
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3877_5_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 733,
                ["action2"] = 734,
            }, 
        },
    },
    -- 升级界面
    [3882] = {
        [1] = {
            -- 战士
            [2] = {
                -- 数量
                ["count"] = 22,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3882_2_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 720,
                ["action2"] = 721,
            },
            -- 弓手
            [4] = {
                -- 数量
                ["count"] = 22,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3882_4_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 730,
                ["action2"] = 731,
            },
            -- 道士
            [10] = {
                -- 数量
                ["count"] = 21,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3882_10_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 733,
                ["action2"] = 734,
            },
        },
    },
    -- 突破界面
    [1479] = {
        -- 成功
        [1] = {
            -- 战士
            [2] = {
                -- 数量
                ["count"] = 21,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_1479_1_2_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 720,
                ["action2"] = 721,
            },
            -- 弓手
            [4] = {
                -- 数量
                ["count"] = 19,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_1479_1_4_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 730,
                ["action2"] = 731,
            },
            -- 道士
            [10] = {
                -- 数量
                ["count"] = 17,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_1479_1_10_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 733,
                ["action2"] = 734,
            },
        },
        -- 失败
        [2] = {
            -- 战士
            [2] = {
                -- 数量
                ["count"] = 26,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_1479_2_2_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 720,
                ["action2"] = 721,
            },
            -- 弓手
            [4] = {
                -- 数量
                ["count"] = 29,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_1479_2_4_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 730,
                ["action2"] = 731,
            },
            -- 道士
            [10] = {
                -- 数量
                ["count"] = 27,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_1479_2_10_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 733,
                ["action2"] = 734,
            },
        },
    },
    -- 元神获得界面
    [3880] = {
        [1] = {
            -- 战士
            [2] = {
                -- 数量
                ["count"] = 5,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3880_2_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 720,
                ["action2"] = 721,
            },
            -- 弓手
            [4] = {
                -- 数量
                ["count"] = 5,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3880_4_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 730,
                ["action2"] = 731,
            },
            -- 道士
            [10] = {
                -- 数量
                ["count"] = 5,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3880_10_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 733,
                ["action2"] = 734,
            },
        },
    },
    -- 元神激活成功
    [3890] = {
        [1] = {
            -- 战士
            [2] = {
                -- 数量
                ["count"] = 5,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3890_2_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 720,
                ["action2"] = 721,
            },
            -- 弓手
            [4] = {
                -- 数量
                ["count"] = 5,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3890_4_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 730,
                ["action2"] = 731,
            },
            -- 道士
            [10] = {
                -- 数量
                ["count"] = 5,
                -- 文本前缀
                ["tip"] = "STR_PRIMORDIALSPIRIT_TALK_3890_10_",
                -- 概率
                ["percentage"] = 100,
                -- 动作数量
                ["actionCount"] = 2,
                -- 动作
                ["action1"] = 733,
                ["action2"] = 734,
            },
        },
    },
}

-- 获取聊天气泡内容
local function GetRolePartTalkInfo(ntype, class, key)
    return RolePartTalkInfo[ntype][class][key]
end

-- 获取聊天气泡控制器索引
local function GetTalkInfo(ntype)
    -- 战士
    if ntype == 100201 then
        return 0
    elseif ntype == 100401 then
        return 1
    elseif ntype == 101001 then
        return 2
    end
    return 0
end

-- 获取抽奖次数
local LotteryInfo = {
    -- 普通
    [1] = {
        -- 消耗物品
        ["CostItem"] = 3347158,
        -- 小保底
        ["Small"] = 10,
        -- 大保底
        ["Big"] = 100,
        -- 小保底背景
        ["SmallBg"] = "",
        -- 小保底品质
        ["SmallQuality"] = "yuanshen_wz66",
         -- 大保底背景
         ["BigBg"] = "",
         -- 大保底品质
         ["BigQuality"] = "yuanshen_wz68",       
    },
    -- 珍惜
    [2] = {
        -- 消耗物品
        ["CostItem"] = 3347157,
        -- 小保底
        ["Small"] = 10,
        -- 大保底
        ["Big"] = 100,
        -- 小保底背景
        ["SmallBg"] = "",
        -- 小保底品质
        ["SmallQuality"] = "yuanshen_wz34",
         -- 大保底背景
         ["BigBg"] = "",
         -- 大保底品质
         ["BigQuality"] = "yuanshen_wz36",     
    }
}

-- 召唤奖励物品
local CallRewardItem = {
    [1] = {
        ["ItemTypeId"] = 0,
        ["Monopoly"] = 0,
    },
    [2] = {
        -- 物品id
        ["ItemTypeId"] = 10020102,
        -- 赠与非赠
        ["Monopoly"] = 0,
    },
    [3] = {
        ["ItemTypeId"] = 10040102,
        ["Monopoly"] = 0,
    },
    [4] = {
        ["ItemTypeId"] = 10100102,
        ["Monopoly"] = 0,
    },

    [5] = {
        ["ItemTypeId"] = 3348377,
        ["Monopoly"] = 0,
    },
    [6] = {
        ["ItemTypeId"] = 0,
        ["Monopoly"] = 0,
    }
}


-- 人物背包元神物品信息
local BagItemInfo = {
    -- 品质
    [1] = {
        ["BgEff"] = "yuanshen81",
    },
    [2] = {
        ["BgEff"] = "yuanshen82",
    },
    [3] = {
        ["BgEff"] = "yuanshen79",
    },
    [4] = {
        ["BgEff"] = "yuanshen83",
    },
    [5] = {
        ["BgEff"] = "yuanshen80",
    },
    [6] = {
        ["BgEff"] = "yuanshen80",
    },
    [7] = {
        ["BgEff"] = "yuanshen80",
    },
    [8] = {
        ["BgEff"] = "yuanshen80",
    },
    [9] = {
        ["BgEff"] = "yuanshen80",
    },
    [10] = {
        ["BgEff"] = "yuanshen80",
    },
}

-- 人物背包元神物品信息
local function GetBagItemInfo(quality, key)
   return BagItemInfo[quality][key]
end

-- 获取召唤奖励物品
local function GetCallRewardItem(index, key)
    return CallRewardItem[index][key]
end

local function GetOpenUnLockLua(dwHeroId)
	local strFormat = "/callluafunc </F>PrimordialSpiritMain_OpenView</N>%u"
	return string.format(strFormat, dwHeroId)
end

local function GetLotteryInfo(ntype, key)
    return LotteryInfo[ntype][key]
end
--请策划配置对应的职业普攻的范围
local function GetAtkRange(nPro,bAdd)
  --战士 2 hwd修改
  if nPro == 2 then
    return 2
  end
-- 道士
  if nPro == 10 then
    return 8
  end
-- 弓手
   if nPro == 4 then
    if bAdd == nil then
      return 6
    else
      return 8
    end
  end
end

-- 获取引导信息
local function GetGuideInfo(step,key)
    -- 开启引导按钮根据当前步骤继续执行的窗口id
    if key == "OpenWindow" then
        if step == E_GUIDE_UPGRADE_UI_CLICK or step == E_GUIDE_BAG_CLICK or step == E_GUIDE_BAG_OK or step == E_GUIDE_GOTO_CHALLENGE or step == E_GUIDE_WORLD_UI_CLICK or (step >= E_GUIDE_REWARD_SUC_UI_OK and step <= E_GUIDE_GOTO_CHALLENGE) then
            -- 主界面
            return 3877
        elseif step == E_GUIDE_ITEM_CLICK  then
            -- 升级
            return 3882
        elseif step ==  E_GUIDE_WORLD_CALL_CLICK then
            -- 万神殿
            return 3878
        elseif step == E_GUIDE_CALL_TEN_CLICK then
            return 3879
        elseif step == E_GUIDE_REWARD_SUC_UI_OK then
            return 3881
        end
    -- 引导步骤匹配的窗口id（该步骤在哪个窗口进行）
    elseif key == "MatchWindow" then
        if step == E_GUIDE_UPGRADE_UI_CLICK or step == E_GUIDE_BAG_CLICK or step == E_GUIDE_BAG_OK or step == E_GUIDE_GOTO_CHALLENGE or step == E_GUIDE_WORLD_UI_CLICK or step == E_GUIDE_REWARD_SUC_UI_OK or step == E_GUIDE_GOTO_CHALLENGE then
            -- 主界面
            return 3877
        elseif step >= E_GUIDE_ITEM_CLICK and step <= E_GUIDE_UPGRADE_DLG_TOP_CLICK then
            -- 升级
            return 3882
        elseif step >= E_GUIDE_SELECT_CARD and step <= E_GUIDE_TOP_DLG_RETURN then
            -- 突破
            return 1479
        elseif step ==  E_GUIDE_WORLD_CALL_CLICK then
            -- 万神殿
            return 3878
        elseif step == E_GUIDE_CALL_TEN_CLICK then
            return 3879
        elseif step == E_GUIDE_REWARD_SUC_UI_OK then
            return 3881
        elseif step == E_GUIDE_GOTO_PROGRESS then
            return 1484
        end
    -- 重置引导步骤
    elseif key == "ResetStep" then
        if step > E_GUIDE_UPGRADE_UI_CLICK and step < E_GUIDE_BAG_OK then
            return E_GUIDE_BAG_CLICK
        elseif step == E_GUIDE_GOTO_PROGRESS then
            return E_GUIDE_GOTO_CHALLENGE
        else
            return step
        end
    end
end

-- 获取赠品取出的品质
local function GetMonoPolyQuality()
    -- return 9
	return 1
end

-- 获取引导中断结束步骤
local function GetGuideEndStep()
    return E_GUIDE_WORLD_CALL_CLICK
end

-- 元神最大背包格子数
local function GetMaxBagItemCount()
    return 300
end

-- 是否是匹配的元神材料(itemtype1升级元神，itemtype2元神材料)
local function IsMatchYuanShen(itemtype1, itemtype2)
    -- local quality1 = itemtype1 % 100
    -- local quality2 = itemtype2 % 100
 
    -- -- 匹配的阶数根据情况修改
    -- if (quality1 <= 6 and quality2 <= 7) or (quality1 > 6 and quality2 > 7) then
        -- return true
    -- end

    -- return false
	return true
end


-- 获取神速层数的光效
local function GetGodSpeedEff(level)
	if (level == 1) then
		return "yuanshen_gs_skill3lv1"
	elseif (level == 2) then
		return "yuanshen_gs_skill3lv2"
	elseif (level == 3) then
		return "yuanshen_gs_skill3lv3"
	end
	
    return ""
end
-- 是否是匹配的神谕材料
local function IsMatchShenYu(itemtype1, itemtype2)
    local qualityRange = ShenYu[itemtype2]
    local quality = itemtype1 % 100
    if quality >= math.floor(qualityRange / 100) and quality <= math.floor(qualityRange % 100) then
        return true
    end

    return false
end

local function GetItemNameColor(itemtype, default)
    if ItemNameColor[itemtype] ~= nil then
        return ItemNameColor[itemtype]
    end

    return default
end

--快速突破模块的零散参数，通过本函数获取
local function getFastBreakData(key)
	if key == "StageRange" then
		--能通过快速突破获得的目标元神阶段区间，若配置"1-9"，则表示1阶~9阶，用法类推
		return "1-9"
	end
end

--idTargetType-快速突破的目标元神itemtypeid
--本函数用于找出符合目前元神阶数的神谕itemtype集合
local function filterFastBreakOracle(idTargetType)
	local copyShenYu = {}
	--拷贝ShenYu字典涉及的神谕
	for p, s in pairs(ShenYu) do
		table.insert(copyShenYu, p)
	end
	
	table.sort(copyShenYu, 
	function(a, b)
		--按能提供的升级经验升序
		return ExpInfo[a]["Exp"] < ExpInfo[b]["Exp"]
	end
	)
	
	local strRet = ""
	for primaryKey, secondaryTable in pairs(copyShenYu) do
		if IsMatchShenYu(idTargetType, secondaryTable) then
			if strRet == "" then
				strRet = string.format("%d", secondaryTable)
			else
				strRet = string.format("%s,%d", strRet, secondaryTable)
			end
		end
	end
	
	return strRet
end

-- 通过require传给其他Lua脚本使用
local PrimordialSpirit = {
	getFastBreakData = getFastBreakData,
	filterFastBreakOracle = filterFastBreakOracle,
    IsOpen = IsOpen,
    GetUiInfo = GetUiInfo,
    GetRewardPreview = GetRewardPreview,
    GetTaskInfo = GetTaskInfo,
    IsMyTask = IsMyTask,
    GetBaseInfo = GetBaseInfo,
    GetExpInfo = GetExpInfo,
    GetCardExp = GetCardExp,
    GetRolePartData = GetRolePartData,
    GetRolePartId = GetRolePartId,
    GetMaxQualityItem = GetMaxQualityItem,
    GetMagicUnlockConStr = GetMagicUnlockConStr,
    GetRolePartTalkInfo = GetRolePartTalkInfo,
    GetTaskPos = GetTaskPos,
    GetLotteryInfo = GetLotteryInfo,
    GetTopSucPercent = GetTopSucPercent,
    GetNextQualityItem = GetNextQualityItem,
    GetBeforeQualityItem = GetBeforeQualityItem,
    GetAttrValue = GetAttrValue,
    GetAttrStr = GetAttrStr,
    GetSpiritView = GetSpiritView,
    GetSpiritDebrisCraftCostInfo = GetSpiritDebrisCraftCostInfo,
    GetSpiritScoreExByExp = GetSpiritScoreExByExp,
    GetOpenUnLockLua = GetOpenUnLockLua,
    GetBagItemInfo = GetBagItemInfo,
    GetCallRewardItem = GetCallRewardItem,
	GetAtkRange = GetAtkRange,
	GetGuideInfo = GetGuideInfo,
    GetMonoPolyQuality = GetMonoPolyQuality,
    IsMatchShenYu = IsMatchShenYu,
    IsMatchYuanShen = IsMatchYuanShen,
    GetGuideEndStep = GetGuideEndStep,
	GetItemNameColor = GetItemNameColor,
	GetGodSpeedEff = GetGodSpeedEff,
    GetMaxBagItemCount = GetMaxBagItemCount,
    GetTaskId = GetTaskId,
	GetTalkInfo = GetTalkInfo,
}

-- C++程序使用的global函数名
PrimordialSpirit_GetFastBreakData = PrimordialSpirit.getFastBreakData
PrimordialSpirit_FilterFastBreakOracle = PrimordialSpirit.filterFastBreakOracle
PrimordialSpirit_GetUiInfo = PrimordialSpirit.GetUiInfo
PrimordialSpirit_GetRewardPreview = PrimordialSpirit.GetRewardPreview
PrimordialSpirit_GetTaskInfo = PrimordialSpirit.GetTaskInfo
PrimordialSpirit_IsOpen = PrimordialSpirit.IsOpen
PrimordialSpirit_IsMyTask = PrimordialSpirit.IsMyTask
PrimordialSpirit_GetBaseInfo = PrimordialSpirit.GetBaseInfo
PrimordialSpirit_GetExpInfo = PrimordialSpirit.GetExpInfo
PrimordialSpirit_GetCardExp = PrimordialSpirit.GetCardExp
PrimordialSpirit_GetRolePartData = PrimordialSpirit.GetRolePartData
PrimordialSpirit_GetRolePartId = PrimordialSpirit.GetRolePartId
PrimordialSpirit_GetMaxQualityItem = PrimordialSpirit.GetMaxQualityItem
PrimordialSpirit_GetMagicUnlockConStr = PrimordialSpirit.GetMagicUnlockConStr
PrimordialSpirit_GetRolePartTalkInfo = PrimordialSpirit.GetRolePartTalkInfo
PrimordialSpirit_GetTaskPos = PrimordialSpirit.GetTaskPos
PrimordialSpirit_GetLotteryInfo = PrimordialSpirit.GetLotteryInfo
PrimordialSpirit_GetTopSucPercent = PrimordialSpirit.GetTopSucPercent
PrimordialSpirit_GetNextQualityItem = PrimordialSpirit.GetNextQualityItem
PrimordialSpirit_GetBeforeQualityItem = PrimordialSpirit.GetBeforeQualityItem
PrimordialSpirit_GetAttrValue = PrimordialSpirit.GetAttrValue
PrimordialSpirit_GetAttrStr = PrimordialSpirit.GetAttrStr
PrimordialSpirit_GetSpiritView = PrimordialSpirit.GetSpiritView
PrimordialSpirit_GetSpiritDebrisCraftCostInfo = PrimordialSpirit.GetSpiritDebrisCraftCostInfo
PrimordialSpirit_GetSpiritScoreExByExp = PrimordialSpirit.GetSpiritScoreExByExp
PrimordialSpirit_GetCallRewardItem = PrimordialSpirit.GetCallRewardItem
PrimordialSpirit_GetOpenUnLockLua = PrimordialSpirit.GetOpenUnLockLua
PrimordialSpirit_GetBagItemInfo = PrimordialSpirit.GetBagItemInfo
PrimordialSpirit_GetAtkRange = PrimordialSpirit.GetAtkRange
PrimordialSpirit_GetGuideInfo = PrimordialSpirit.GetGuideInfo
PrimordialSpirit_GetMonoPolyQuality = PrimordialSpirit.GetMonoPolyQuality
PrimordialSpirit_IsMatchShenYu= PrimordialSpirit.IsMatchShenYu
PrimordialSpirit_IsMatchYuanShen = PrimordialSpirit.IsMatchYuanShen
PrimordialSpirit_GetGuideEndStep = PrimordialSpirit.GetGuideEndStep
PrimordialSpirit_GetItemNameColor = PrimordialSpirit.GetItemNameColor
PrimordialSpirit_GetGodSpeedEff = PrimordialSpirit.GetGodSpeedEff
PrimordialSpirit_GetMaxBagItemCount = PrimordialSpirit.GetMaxBagItemCount
PrimordialSpirit_GetTaskId = PrimordialSpirit.GetTaskId
PrimordialSpirit_GetTalkInfo = PrimordialSpirit.GetTalkInfo

return PrimordialSpirit
