魔力宝贝

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz

[GP] yongbingsp_item.lua--佣兵契约碎片

[复制链接]
发表于 前天 03:25 | 显示全部楼层 |阅读模式
local yblb_NRSR_tab = {}
yblb_NRSR_tab[512291] = {83501,83502,83503} --伙伴礼包N碎片(非绑)奖池
yblb_NRSR_tab[512292] = {83401,83402,83403,83404,83405,83406,83407,83408,83409,83410,83411,83412,83413,83414,83415} --伙伴礼包R碎片(非绑)奖池
yblb_NRSR_tab[512293] = {83301,83302,83303,83304,83305,83306,83307,83308,83309,83310} --伙伴礼包SR碎片(非绑)奖池

local yblb_bdNRSR_tab = {}
yblb_bdNRSR_tab[512294] = {84501,84502,84503} --伙伴礼包N碎片(绑定)奖池
yblb_bdNRSR_tab[512295] = {84401,84402,84403,84404,84405,84406,84407,84408,84409,84410,84411,84412,84413,84414,84415} --伙伴礼包R碎片(绑定)奖池
yblb_bdNRSR_tab[512296] = {84301,84302,84303,84304,84305,84306,84307,84308,84309,84310} --伙伴礼包SR碎片(绑定)奖池
--奖池几率SSR 20%  SR 30% R45% N5%

local yblb_SSR_tab = {}--非绑SSR礼包表
yblb_SSR_tab[512301] = 83201--yblb_SSR_tab[礼包id] = 对应伙伴碎片(非绑)id
yblb_SSR_tab[512302] = 83202
yblb_SSR_tab[512303] = 83203
yblb_SSR_tab[512304] = 83204
yblb_SSR_tab[512305] = 83205
yblb_SSR_tab[512306] = 83206
yblb_SSR_tab[512307] = 83207
yblb_SSR_tab[512308] = 83208

local yblb_bdSSR_tab = {}--绑定SSR礼包表
yblb_bdSSR_tab[512401] = 84201--yblb_bdSSR_tab[礼包id] = 对应伙伴碎片(绑定)id
yblb_bdSSR_tab[512402] = 84202
yblb_bdSSR_tab[512403] = 84203
yblb_bdSSR_tab[512404] = 84204
yblb_bdSSR_tab[512405] = 84205
yblb_bdSSR_tab[512406] = 84206
yblb_bdSSR_tab[512407] = 84207
yblb_bdSSR_tab[512408] = 84208

----改版后单页
yblb_danyekaizhengye_tab = {}
yblb_danyekaizhengye_tab[512281] ={81401,81402,81403,81404,81405,81406,81407,81408,81409,81410,81411,81412,81413,81414,81415}--非绑R单页换整本
yblb_danyekaizhengye_tab[512282] ={81301,81302,81303,81304,81305,81306,81307,81308,81309,81310} --非绑SR单页换整本
yblb_danyekaizhengye_tab[512283] ={82401,82402,82403,82404,82405,82406,82407,82408,82409,82410,82411,82412,82413,82414,82415}--绑定R单页换整本
yblb_danyekaizhengye_tab[512284] ={82301,82302,82303,82304,82305,82306,82307,82308,82309,82310}--绑定SR单页换整本

----------
Global_Reg.RegItemUseEvent ("yongbingsp_item");--创建一个所有玩家双击道具栏物品就会触发的Lua函数。

function yongbingsp_item(player, Itemindex)
        local itemid = Item.GetData(Itemindex, %道具_ID%);--伙伴契约碎片道具id
--        NLG.SystemMessage(player,"itemid="..itemid..",类型="..type(itemid)..",")
        if itemid >= 83001 and itemid <= 84999 then
                local dhsl = Item.GetData(Itemindex,%道具_最大堆叠数%)
                local havesl = Char.ItemNum(player, itemid) -- 拥有道具数量
                local name = Item.GetData(Itemindex,%道具_已鉴定名%)
--                NLG.SystemMessage(player,"havesl="..havesl..",dhsl="..dhsl..",")
                if havesl >= dhsl then
                        NLG.DelItem(player,itemid,dhsl) --扣除道具
                        Char.GiveItem(player,itemid-2000,1)
                else
                        if itemid >= 83401 and itemid <= 83499 then --非绑R
                                NLG.DelItem(player,itemid,1) --扣除道具
                                Char.GiveItem(player,512281,1)
                        elseif  itemid >= 83301 and itemid <= 83399 then --非绑SR
                                NLG.DelItem(player,itemid,1) --扣除道具
                                Char.GiveItem(player,512282,1)
                        elseif itemid >= 84401 and itemid <= 84499 then --绑定R
                                NLG.DelItem(player,itemid,1) --扣除道具
                                Char.GiveItem(player,512283,1)
                        elseif  itemid >= 84301 and itemid <= 84399 then --绑定SR
                                NLG.DelItem(player,itemid,1) --扣除道具
                                Char.GiveItem(player,512284,1)
                        elseif itemid >= 83001 and itemid <= 83999 then --非绑
                                NLG.SystemMessage(player,""..name.."(非绑)还差"..(dhsl-havesl).."页才可装订成羁绊信。")
                        else
                                NLG.SystemMessage(player,""..name.."(绑定)还差"..(dhsl-havesl).."页才可装订成羁绊信。")
                        end
                end
                return 1
        end
------改版单页换整页
        if yblb_danyekaizhengye_tab[itemid] then
                local havesl = Char.ItemNum(player, itemid) -- 拥有道具数量
                local name = Item.GetData(Itemindex,%道具_已鉴定名%)
                local kongwei = Char.ItemSlot(player)
                if kongwei < 40 then --有空位
                        if itemid == 512281 then --非绑R单页
                                if havesl >= 100 then --非绑R 100单页
                                        local a = yblb_danyekaizhengye_tab[itemid][math.random(1,#yblb_danyekaizhengye_tab[itemid])]--随机抽奖池一个道具id
                                        NLG.DelItem(player,itemid,100) --扣除礼包
                                        Char.GiveItem(player,a,1)
                                else
                                        NLG.SystemMessage(player,""..name.."(非绑)还差"..(100-havesl).."页才可装订成羁绊信。")
                                end
                        elseif  itemid == 512282 then --非绑SR单页
                                if havesl >= 150 then --非绑R 150单页
                                        local a = yblb_danyekaizhengye_tab[itemid][math.random(1,#yblb_danyekaizhengye_tab[itemid])]--随机抽奖池一个道具id
                                        NLG.DelItem(player,itemid,150) --扣除礼包
                                        Char.GiveItem(player,a,1)
                                else
                                        NLG.SystemMessage(player,""..name.."(非绑)还差"..(150-havesl).."页才可装订成羁绊信。")
                                end
                        elseif  itemid == 512283 then --绑定SR单页
                                if havesl >= 50 then --绑定R 50单页
                                        local a = yblb_danyekaizhengye_tab[itemid][math.random(1,#yblb_danyekaizhengye_tab[itemid])]--随机抽奖池一个道具id
                                        NLG.DelItem(player,itemid,50) --扣除礼包
                                        Char.GiveItem(player,a,1)
                                else
                                        NLG.SystemMessage(player,""..name.."(绑定)还差"..(50-havesl).."页才可装订成羁绊信。")
                                end
                        elseif  itemid == 512284 then --绑定SR单页
                                if havesl >= 75 then --绑定SR 75单页
                                        local a = yblb_danyekaizhengye_tab[itemid][math.random(1,#yblb_danyekaizhengye_tab[itemid])]--随机抽奖池一个道具id
                                        NLG.DelItem(player,itemid,75) --扣除礼包
                                        Char.GiveItem(player,a,1)
                                else
                                        NLG.SystemMessage(player,""..name.."(非绑)还差"..(75-havesl).."页才可装订成羁绊信。")
                                end
                        end
                else
                        NLG.SystemMessage(player,"身上位置不足。")
                end
                return 1
        end
---------非绑SSR礼包------
        if yblb_SSR_tab[itemid] then
--                                NLG.SystemMessage(player,"itemid="..itemid.."")
                local haveitem = Char.ItemNum(player, itemid) -- 拥有道具数量
                local x = Char.ItemSlot(player)
                if haveitem >= 10 and x <= 30 then--十连抽
                        for i = 1,10 do
                                yongbinglb_fbchoujiang(player, itemid)
                        end
--                                NLG.SystemMessage(player,"判断成功")
                        Char.Sorting(player)--自动叠加
                else
                        yongbinglb_fbchoujiang(player, itemid)
                        Char.Sorting(player)--自动叠加
                end
                return 1
        end
---------绑定SSR礼包------
        if yblb_bdSSR_tab[itemid] then
--                                NLG.SystemMessage(player,"itemid="..itemid.."")
                local haveitem = Char.ItemNum(player, itemid) -- 拥有道具数量
                local x = Char.ItemSlot(player)
                if haveitem >= 10 and x <= 30 then--十连抽
                        for i = 1,10 do
                                yongbinglb_bdchoujiang(player, itemid)
                        end
--                                NLG.SystemMessage(player,"判断成功")
                        Char.Sorting(player)--自动叠加
                else
                        yongbinglb_bdchoujiang(player, itemid)
                        Char.Sorting(player)--自动叠加
                end
                return 1
        end
-----N~SR礼包开启----
        if yblb_NRSR_tab[itemid] then
                local a = Char.ItemNum(player, itemid) -- 拥有道具数量
                local b = Char.ItemSlot(player)
                if a >= 10 and b <= 30 then--十连抽
                        for i = 1,10 do
                                local c = yblb_NRSR_tab[itemid][math.random(1,#yblb_NRSR_tab[itemid])]--随机抽奖池一个道具id
                                NLG.DelItem(player,itemid,1) --扣除礼包
                                Char.GiveItem(player,c,5)
                        end
                        Char.Sorting(player)--自动叠加
                else
                        if b < 40 then --有空位
                                local c = yblb_NRSR_tab[itemid][math.random(1,#yblb_NRSR_tab[itemid])]--随机抽奖池一个道具id
                                NLG.DelItem(player,itemid,1) --扣除礼包
                                Char.GiveItem(player,c,5)
                                Char.Sorting(player)--自动叠加
                        else
                                NLG.SystemMessage(player,"你身上的位置不足了。")
                        end
                end
                return 1
        end
-----绑定N~SR礼包开启----
        if yblb_bdNRSR_tab[itemid] then
                local a = Char.ItemNum(player, itemid) -- 拥有道具数量
                local b = Char.ItemSlot(player)
                if a >= 10 and b <= 30 then--十连抽
                        for i = 1,10 do
                                local c = yblb_bdNRSR_tab[itemid][math.random(1,#yblb_bdNRSR_tab[itemid])]--随机抽奖池一个道具id
                                NLG.DelItem(player,itemid,1) --扣除礼包
                                Char.GiveItem(player,c,1)
                        end
                        Char.Sorting(player)--自动叠加
                else
                        if b < 40 then --有空位
                                local c = yblb_bdNRSR_tab[itemid][math.random(1,#yblb_bdNRSR_tab[itemid])]--随机抽奖池一个道具id
                                NLG.DelItem(player,itemid,1) --扣除礼包
                                Char.GiveItem(player,c,1)
                                Char.Sorting(player)--自动叠加
                        else
                                NLG.SystemMessage(player,"你身上的位置不足了。")
                        end
                end
                return 1
        end
        return 0--通过
end

function yongbinglb_bdchoujiang(player,itemid)--绑定抽奖函数
--                                NLG.SystemMessage(player,"itemid="..itemid.."")
        local Num = Char.ItemSlot(player)
        if Num < 40 then --有空位
                local s = math.random(1,10000) --抽奖池几率
                local sp = math.random(1,100) --给碎片几率
                local sl = 1 --给碎片数量
                local zb = yblb_bdSSR_tab[itemid]-2000--SSR整本id
                NLG.DelItem(player,itemid,1) --扣除礼包
                if sp >= 1 and sp <= 10 then--给2碎片
                        sl = 2
                elseif sp >= 11 and sp <= 15 then--给3碎片
                        sl = 3
                end
                if s >= 1 and s <= 2000 then--SSR20%
                        Char.GiveItem(player,yblb_bdSSR_tab[itemid],sl)
                elseif s >= 2001 and s <= 5000 then--SR30%
                        Char.GiveItem(player,512284,sl)
                elseif s >= 5001 and s <= 9500 then--R45%
                        Char.GiveItem(player,512283,sl)
                elseif s >= 9501 and s <= 9999 then--N5%
                        Char.GiveItem(player,512294,sl)
                elseif s == 10000  then--SSR整本0.01%
                        Char.GiveItem(player,yblb_bdSSR_tab[itemid]-2000,1)
                end
--                NLG.SystemMessage(player,"s="..s..",zb="..zb.."")
        else
                NLG.SystemMessage(player,"你身上的位置不足了。")
        end
end

function yongbinglb_fbchoujiang(player,itemid)--非绑抽奖函数
--                                NLG.SystemMessage(player,"itemid="..itemid.."")
        local Num = Char.ItemSlot(player)
        if Num < 40 then --有空位
                local s = math.random(1,10000) --抽奖池几率
                local sp = math.random(1,100) --给碎片几率
                local sl = 1 --给碎片数量
                local zb = yblb_SSR_tab[itemid]-2000--SSR整本id
                NLG.DelItem(player,itemid,1) --扣除礼包
                if sp >= 1 and sp <= 15 then--给2碎片
                        sl = 2
                end
                if s >= 1 and s <= 2000 then--SSR20%
                        Char.GiveItem(player,yblb_SSR_tab[itemid],sl*5)
                elseif s >= 2001 and s <= 5000 then--SR30%
                        Char.GiveItem(player,512282,sl*5)
                elseif s >= 5001 and s <= 9500 then--R45%
                        Char.GiveItem(player,512281,sl*5)
                elseif s >= 9501 and s <= 9999 then--N5%
                        Char.GiveItem(player,512291,sl)
                elseif s == 10000  then--SSR整本0.01%
                        Char.GiveItem(player,yblb_SSR_tab[itemid]-2000,1)
                end
--                NLG.SystemMessage(player,"s="..s..",zb="..zb.."")
        else
                NLG.SystemMessage(player,"你身上的位置不足了。")
        end
end


回复

使用道具 举报

Archiver|魔力研究社

GMT+8, 2025-5-12 13:10 , Processed in 0.214198 second(s), 31 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表