魔力宝贝

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

[GP] Luac.lua;--Luac

[复制链接]
发表于 前天 02:54 | 显示全部楼层 |阅读模式

--[[
解散队伍强化函数
功能:解散队伍时候不解散佣兵

LuaModule leavegroup
--]]

--[[
日常范例:

LuaModule everydaypass,2

everyday_pass--启动关键词,判断当前是否有首通记录
2--日常任务编号代码,不能为1

魔力脚本返回值:
localcount 33 == 0 --今日未首通
localcount 33 == 1 --今日已经首通


LuaModule everydaysave,2

everyday_save--启动关键词,对对应编号任务记录上首通标记
2--日常任务编号代码,不能为1

--]]



------宠物技能替换
local PetTechCanCallWord = "pettechcan" --宠物技能替换脚本判断字符串
--[[ 魔力脚本范例
block
        LuaModule pettechcan
]]
------宠物技能替换


--佣兵签约
local AddybWord ="xinshouqianyue"
--[[ 魔力脚本范例
block
        LuaModule yb
]]
--佣兵签约

--[[首通范例
       
        block
        window"\n\n我是凑巧路过的『法兰城日报』记者,您允许我在『法兰城日报』上刊登您英勇战斗的实记吗?",ok
        window_ok
    LuaModule firstpass,1,500
                if localcount 33 == -1
                        endwindow"勇者大人,您的英勇身姿我已经刊登过了。"
                endif
                if localcount 33 == 1
                        endwindow "好的,已经为您刊登在『法兰城日报』上了。"
                endif
                if localcount 33 == 0
                        endwindow "您身上的位置不足了。"
                endif
               
        firstpass,1,500介绍:
                firstpass触发关键词
                1任务编号←←←(同内置攻略任务编号)
                500道具编号←←←(例如给一个增加500声望的女神苹果)
       
        localcount 33介绍:
                localcount 33 的返回值是-1的时候,证明首通记录已经记录在field里面←←←(已经首通)
                localcount 33 的返回值是1的时候,就是没有记录在里面←←←(还未首通)
                localcount 33 的返回值是0的时候,为道具栏不足
--首通范例]]


--[[
女神苹果范例:

LuaModule apple,500

apple--启动关键词
500--要增加的声望

--]]

--[[
自动香范例

LuaModule autox,道具编号

如果道具编号填的是jmx_item_num表的道具编号,就自动识别为聚魔香(10怪)
如果填的是ymx_item_num表的道具编号,就识别为诱魔香


--]]

--[[
神秘礼物范例

LuaModule ybgift,几率


--]]

--[[
传送之间提示范例

LuaModule tishi


--]]

--[[
自选礼包范例

LuaModule bdzixuanlibao,道具编号

--]]

--[[
智能发奖范例

LuaModule ybdzjlup,道具编号,数量,道具编号,数量(数量处只可填可叠加道具的数量,如果要复数给不可叠加道具,请多写一次道具编号)

localcount 33返回值:
返回本次发放奖励需要的道具栏数量
--]]

--[[
LuaModule givesendmsgxs
--]]

function ScriptEvent(player,String,npc)
        --NLG.SystemMessage(player,"触发关键词是"..String)
        if string.sub(String,1,string.len(PetTechCanCallWord)) == PetTechCanCallWord then
                UsePetTechCan(player)
        end
       
        if(string.find(String,"bdzixuanlibao"))then--[自选礼包]
                local a = splitplus(String,",")
                local itemid = tonumber(a[2])
--                NLG.SystemMessage(player,"itemid ="..itemid.."")
                bdzxlb_qidong(player,itemid)
        end
--盗窃染墨布
        if(string.find(String,"ranmobukaiguan1"))then
                if(Theft_tab[player][1]==false) then
                        Theft_tab[player][1] = true
                        return 1;
                else
                        return 2;
                end
        end
       
        if(string.find(String,"ranmobukaiguan2"))then
                if(Theft_tab[player][1]==true) then
                        Theft_tab[player][1] = false
                        return 3;
                else
                        return 4;
                end
        end
--盗窃染墨布
        if(string.find(String,"ybdzjlup"))then--[自选礼包]
                local a = splitplus(String,",")
                local Num = Char.FindEmptyItemBox(player)
                local dz = Char.GetData(player,11556)
                local count = 1--佣兵倍率
                if dz == 1 then--是队长
                        for i = 1,4 do
                                local GroupIndex = Char.GetTeamIndex(player, i);
                                if GroupIndex>=0 then
                                        local jobnum = Char.GetData(GroupIndex,51)
                                        if jobnum==540 then
                                                local catordog = string.sub(Char.GetData(GroupIndex,2002),-1,-1)
                                                if catordog=="?" then
                                                        count=count+1
                                                end
                                        end
                                end
                        end
                end
                local long = (#a -1)/2 * count
                if Num>=long then
                        for i=1,count do
                                for i=1,#a,2 do
                                        local itemid = tonumber(a[i+1])
                                        if a[i+2] then
                                                local sl = tonumber(a[i+2])
                                                Char.Additem(player,itemid,sl);
                                        end
                                end
                        end
                        return long
                else
                        return long
                end
        end
       
        if(string.find(String,"autox"))then--[自动香]
                local mapID = Char.GetData(player,%对象_地图%)
                if Auto_battle_limit_mapID[mapID]==nil then
                        local dz = Char.GetData(player,%对象_组队模式%)
                        if dz == 1 or dz == 0 then--是队长或者没有队伍
                                if Auto_battle_x_save[player] then
                                        Auto_battle_x_save[player]=nil
                                        if Auto_battle_x_save2[player] then
                                                Auto_battle_x_save2[player]=nil
                                        end
                                        Char.SetLoopEvent(nil, "YMXAutoBattle_Loop",player, 0)
                                        NLG.SystemMessage(player,"[系统]您合上了[自动香]的盖子")
                                else
                                        local jmx = splitplus(String,",")
                                        local itemnum = tonumber(jmx[2])
                                        if (itemnum==79447 and mapID==60061) or itemnum~=79447 then
                                                Auto_battle_x_save[player]=itemnum
                                                local djpos = Char.FindItemId(player, itemnum) or -1
                                                local Itemindex = Char.GetItemIndex(player,djpos) or -1
                                                local naijiu = Item.GetData(Itemindex, %道具_耐久%)
                                                if naijiu>1 then
                                                        local a=NLG.CreateBattle(player)
                                                        if a==1 then
                                                                if Auto_battle_x_save[player] then
                                                                        Auto_battle_x_save[player]=nil
                                                                end
                                                                return 0;
                                                        else
                                                                Item.SetData(Itemindex, %道具_耐久%,naijiu-1)
                                                                Item.UpItem(player,djpos);
                                                                NLG.SystemMessage(player,"[自动香]的气味吸引了魔物")
                                                        end
                                                elseif naijiu==1 then
                                                        local a=NLG.CreateBattle(player)
                                                        if a==1 then
                                                                if Auto_battle_x_save[player] then
                                                                        Auto_battle_x_save[player]=nil
                                                                end
                                                                return 0;
                                                        else
                                                                local tNum = NLG.DelItemByPos(player,djpos);
                                                                Auto_battle_x_save[player]=nil
                                                                if Auto_battle_x_save2[player] then
                                                                        Auto_battle_x_save2[player]=nil
                                                                end
                                                                NLG.SystemMessage(player,"[自动香]耗尽了")
                                                                NLG.SystemMessage(player,"[自动香]的气味吸引了魔物")
                                                                NLG.SystemMessage(player,"[自动香]耗尽了")
                                                        end
                                                else
                                                        local tNum = NLG.DelItemByPos(player,djpos);
                                                        Auto_battle_x_save[player]=nil
                                                        if Auto_battle_x_save2[player] then
                                                                Auto_battle_x_save2[player]=nil
                                                        end
                                                        NLG.SystemMessage(player,"[自动香]耗尽了")
                                                end
                                        else
                                                NLG.SystemMessage(player,"[爱岛自动香]只能在爱之南岛使用")
                                        end
                                        return 1;--反馈MSG
                                end
                        else
                                NLG.SystemMessage(player,"[系统]:[自动香]只有组队队长可以使用")
                        end
                else
                        NLG.SystemMessage(player,"[系统]该地图无法使用[自动香]")
                end
        end
       
        --[[if(string.find(String,"zidongyoumoxiangkaiguan1"))then--[自动诱魔香]
                local mapID = Char.GetData(player,%对象_地图%)
                if Auto_battle_limit_mapID[mapID]==nil then
                        local saveplayer=player+1--防止第一位玩家0号index产生错误
                        ZDYMXtab[1][saveplayer] = 1--初次开启自动[自动]诱魔香
                        ZDYMXtab[2][saveplayer]=os.time()*2--初次开启自动[自动]诱魔香
                        local DJSL1 = Char.ItemNum(player,AutoBattleItemID[1]) or -1 --获取自动诱魔香数量
                        local ZDZT = Char.GetData(player,%对象_组队模式%)
                        if DJSL1>1 and ZDZT<2 then
                                NLG.DelItem(player,AutoBattleItemID[1])
                                NLG.SystemMessage(player,"[系统]诱魔香的香味散发出去了")
                                NLG.CreateBattle(player)
                        elseif DJSL1==1 and ZDZT<2 then
                                ZDYMXtab[1][saveplayer] = -1
                                ZDYMXtab[2][saveplayer] = -1
                                NLG.DelItem(player,AutoBattleItemID[1])
                                NLG.SystemMessage(player,"[系统][自动]诱魔香已耗尽")
                                NLG.CreateBattle(player)
                        elseif DJSL1<1 and ZDZT<2 then
                                ZDYMXtab[1][saveplayer] = -1
                                ZDYMXtab[2][saveplayer] = -1
                                NLG.DelItem(player,AutoBattleItemID[1])
                                NLG.SystemMessage(player,"[系统]您未持有[自动]诱魔香")
                        else
                                return 1;--组队队员无法开启,反馈MSG
                        end
                else
                        NLG.SystemMessage(player,"[系统]只能在练级点和特定活动地图使用[自动]诱魔香")
                end
        end
       
        if(string.find(String,"zidongyoumoxiangkaiguan2"))then--[自动诱魔香]
                local saveplayer = player+1
                local savetab = ZDYMXtab[2][saveplayer] or -1
                if(savetab>-1) then--关闭诱魔香
                        ZDYMXtab[1][saveplayer] = -1
                        ZDYMXtab[2][saveplayer] = -1
                        Char.SetLoopEvent(nil, nil,player, 0)
                        return 2;
                else
                        return 3;--正常
                end
        end
       
        if(string.find(String,"zidongjumoxiangkaiguan1"))then--[自动聚魔香]
                local mapID = Char.GetData(player,%对象_地图%)
                if (mapID==100 or mapID==11004) then
                        local saveplayer=player+1--防止第一位玩家0号index产生错误
                        ZDYMXtab[1][saveplayer] = 2--初次开启自动[自动]聚魔香
                        ZDYMXtab[2][saveplayer]=os.time()*2--初次开启自动[自动]聚魔香
                        local DJSL2 = Char.ItemNum(player,AutoBattleItemID[2]) or -1 --获取自动聚魔香数量
                        local ZDZT = Char.GetData(player,%对象_组队模式%)
                        if DJSL2>1 and ZDZT<2 then
                                NLG.DelItem(player,AutoBattleItemID[2])
                                NLG.SystemMessage(player,"[系统]聚魔香的香味散发出去了")
                                NLG.CreateBattle(player)
                        elseif DJSL2==1 and ZDZT<2 then
                                ZDYMXtab[1][saveplayer] = 3
                                ZDYMXtab[2][saveplayer] = -1
                                NLG.DelItem(player,AutoBattleItemID[2])
                                NLG.SystemMessage(player,"[系统][自动]聚魔香已耗尽")
                                NLG.CreateBattle(player)
                        elseif DJSL2<1 and ZDZT<2 then
                                ZDYMXtab[1][saveplayer] = -1
                                ZDYMXtab[2][saveplayer] = -1
                                NLG.DelItem(player,AutoBattleItemID[2])
                                NLG.SystemMessage(player,"[系统]您未持有[自动]聚魔香")
                        else
                                return 1;--组队队员无法开启,反馈MSG
                        end
                else
                NLG.SystemMessage(player,"[系统]只能在练级点和特定活动地图使用[自动]聚魔香")
                end
        end
       
        if(string.find(String,"zidongjumoxiangkaiguan2"))then--[自动聚魔香]
                local saveplayer = player+1
                local savetab = ZDYMXtab[2][saveplayer] or -1
                if(savetab>-1) then--关闭聚魔香
                        ZDYMXtab[1][saveplayer] = -1
                        ZDYMXtab[2][saveplayer] = -1
                        Char.SetLoopEvent(nil, nil,player, 0)
                        return 2;
                else
                        return 3;--正常
                end
        end--]]
       
        --给佣兵
        if string.sub(String,1,2) == AddybWord then
                local zdms = Char.GetData(player,11556)
                if zdms==0 then
                        local playerCDK = Char.GetData(player,%对象_帐号%)--字符串型
                        local RegistNumber = Char.GetData(player,%对象_RegistNumber%)
                        yongbingchuangjian(player,playerCDK,RegistNumber,501)
                        yongbingchuangjian(player,playerCDK,RegistNumber,502)
                        yongbingchuangjian(player,playerCDK,RegistNumber,503)
                        CallDummy2(player,501,playerCDK,RegistNumber,1)
                        CallDummy2(player,502,playerCDK,RegistNumber,1)
                        CallDummy2(player,503,playerCDK,RegistNumber,1)
                        for i=1,4 do
                                local GroupIndex = Char.GetTeamIndex(player, i);
                                if GroupIndex>=0 then
                                        local job = Char.GetData(player,51)
                                        if job==540 then
                                                giveorigin(GroupIndex,90)
                                        end
                                end
                        end
                        local name = Char.GetData(player,2000)
                        NLG.SystemMessage(player,"[巴乌·哇呜]:李贝留斯要过来了!"..name.."拔出灭神剑!")
                        NLG.SystemMessage(player,"[沙慈]:我要为阿绫报仇")
                        NLG.SystemMessage(player,"[伊佐塔]:阿绫还没死呢……沙慈")
                        NLG.SystemMessage(player,"[提示]:新手教程结束后,您也可以从右上角『同伴招募』中寻找『冒险者酒吧老板』和伙伴组队")
                else
                        NLG.SystemMessage(player,"[提示]:请去打倒李贝留斯吧!")
                end
        end
        --给佣兵
        if(string.find(String,"firstpass"))then
                return First_pass_event(player,String,npc)
        end
        --↑首通
        if(string.find(String,"apple"))then
                local apple=Split(String, ",")
                local sw = tonumber(apple[2])
                local a = Char.GetData(player,59)
                local b = Char.SetData(player,59,a+sw)
                local c = Char.GetData(player,59)
                NLG.SystemMessage(player,"[女神苹果]增长了"..sw.."声望,您当前的声望是:"..c)
        end
        --↑女神苹果
        if(string.find(String,"everydaypass"))then
                local info=Split(String, ",")
                local number = tonumber(info[2])
                local Base_day = tonumber(os.date("%d"))
                local tCdKey = Char.GetData(player, 2002)
                local tRegistNum = Char.GetData(player, 48)
                local tTabKey = tCdKey .. tRegistNum
                if Base_day~=Base_everyday[tTabKey][1] then
                        Luac_everyday_Reset(tTabKey,Base_day)
                end
                if Base_everyday[tTabKey][number]==0 then
                        --NLG.SystemMessage(player,"[luac]没通关判断成功")
                        return 0--未首通
                elseif Base_everyday[tTabKey][number]==1 then
                        --NLG.SystemMessage(player,"[luac]已经通关了")
                        return 1--已经通关
                end
        end
        if(string.find(String,"everydaysave"))then
                local info=Split(String, ",")
                local number = tonumber(info[2])
                local tCdKey = Char.GetData(player, 2002)
                local tRegistNum = Char.GetData(player, 48)
                local tTabKey = tCdKey .. tRegistNum
                Base_everyday[tTabKey][number]=1
        end
        --↑日常判断
        if(string.find(String,"leavegroup"))then
                for i = 1,4 do
                        local GroupIndex = Char.GetTeamIndex(player, i);
                        if(GroupIndex>=0)then
                                local jobnum = Char.GetData(GroupIndex,51)
                                if jobnum~=540 then
                                        NLG.DischargeParty(GroupIndex);
                                end
                        end
                end
        end
        --↑离队加强
        if(string.find(String,"havefriend"))then
                local count = 1
                for i = 1,4 do
                        local GroupIndex = Char.GetTeamIndex(player, i);
                        if(GroupIndex>=0)then
                                local jobnum = Char.GetData(GroupIndex,51)
                                if jobnum~=540 then
                                        count = count +1
                                end
                        end
                end
                return count
        end
        --↑队伍对象判断加强
        if(string.find(String,"ybgift"))then
                local info=Split(String, ",")
                local jilv = tonumber(info[2])
                everyday_gift_give(player,jilv)
        end
        --↑神秘礼物
        if(string.find(String,"tishi"))then
                NLG.SystemMessage(player,"[提示]:聊天框输入/m可以查看传送石对应的村落,传送之间一共有三层")
        end
        --↑传送之间提示
        if(string.find(String,"givepicnic"))then
                local Num = Char.ItemNum(player,79600)
                if Num>0 then
                        return
                else
                        local itemNum = Char.FindEmptyItemBox(player)
                        if itemNum>0 then
                                NLG.GiveItem(player,79600)
                                for i=8,47 do
                                        local ItemIndex = Char.GetItemIndex(player,i)
                                        local Item_ID = Item.GetData(ItemIndex,0);--获取道具ID
                                        if Item_ID==79600 then
                                                Item.SetData(ItemIndex,%道具_耐久%,0)
                                                Item.UpItem(player,i)
                                        end
                                end
                        end
                        return
                end
        end
        --↑给人物料理食盒
        if(string.find(String,"bankpos"))then
                local bank_num = Char.GetData(player,%对象_银行页数%)
                if bank_num<8 then
                        Char.SetData(player,%对象_银行页数%,bank_num+1)
                        NLG.UpChar(player,%对象_银行页数%)
                        local CDK=Char.GetData(player,2002)
                        local rignum=Char.GetData(player,48)
                        local tcdk = CDK..rignum
                        bank_num_tab[tcdk]=bank_num+1
                        NLG.DelItem(player,91011)
                        NLG.SystemMessage(player,"您的银行栏位增加到了"..(bank_num+2).."个")
                else
                        NLG.SystemMessage(player,"您的银行栏位已经是9个了")
                end
        end
        --↑传送之间提示
        if(string.find(String,"ceshi"))then--[ceshi]
                local itemslot = 0
                local itemid = 79406
                for i = 8,27 do
                        local itemindex = Char.GetItemIndex(player,i)
                        if itemindex > 0 then
--if itemid == Item.GetData(itemindex,%道具_ID%) then
                                if itemid == Item.GetData(itemindex,%道具_ID%) then
                                        itemslot = i
                                        break
                                end
                        end
                end
                        chongzhi_gongneng(-1,player,0,0,1)
        end
        --↑传送之间提示
        if(string.find(String,"givesendmsgxs"))then
                Char.SendMsg(player,4,4,"$4请在该处遇敌练级到LV5,然后尝试使用右上角的『匹配组队』便捷传送至下一个练级点吧$0")
        end
        --↑给人物料理食盒
       
       
end
       

回复

使用道具 举报

Archiver|魔力研究社

GMT+8, 2025-5-12 18:05 , Processed in 0.114677 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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