本帖最后由 lwc64508978 于 2022-5-3 23:47 编辑
- local ngModule = ModuleBase:createModule('ng')
-
-
- function ngModule:ng_TalkEvent(player,msg,color,range,size)
- -- 全队伍打卡
- if self:startswith(msg,"/7 ") then
- local command = string.sub(msg,4)
- print(command)
- for slot = 0,4 do
- local p =Char.GetPartyMember(player,slot)
- if(p>0) then
- local money = Char.GetData(p,%对象_金币%);
- Char.SetData(p,%对象_金币%,money-200);
- if(command =='on') then
- Char.FeverStart(p);
- NLG.UpChar(p);
- NLG.SystemMessage(p, "扣除魔币200G。");
- NLG.SystemMessage(p, "恭喜您打卡成功。");
- elseif(command =='off') then
- Char.FeverStop(p);
- NLG.UpChar(p);
- NLG.SystemMessage(p, "扣除魔币200G。");
- NLG.SystemMessage(p, "恭喜您关闭打卡成功。");
- end
-
- end
- end
-
- end
- -- 快速组队
- if self:startswith(msg,"/8 ") then
- local names = string.sub(msg,4)
- local nameTable = self:split(names," ")
- for _,cdkey in pairs(nameTable) do
- -- 判断本身队伍是否满人
- local partyNum = Char.PartyNum(player)
- if(partyNum>=5) then
- NLG.SystemMessage(player, "队伍已满5人");
- return
- end
-
- local charIndex = NLG.FindUser(cdkey)
- if(charIndex>0) then
- local invitedPartyNum = Char.PartyNum(charIndex)
- print(invitedPartyNum)
- if(invitedPartyNum>0) then
- NLG.SystemMessage(player, "被邀请者已有队伍");
- else
- -- 第一个参数 队员,第二个参数队长
- Char.JoinParty(charIndex, player)
- end
-
- end
- end
- end
- end
-
- function ngModule:split( str,reps )
- local resultStrList = {}
- string.gsub(str,'[^'..reps..']+',function ( w )
- table.insert(resultStrList,w)
- end)
- return resultStrList
- end
-
- function ngModule:startswith ( str, substr)
- if str == nil or substr == nil then
- return nil, "the string or the sub-stirng parameter is nil"
- end
- if string.find(str, substr) ~= 1 then
- return false
- else
- return true
- end
- end
-
- --- 加载模块钩子
- function ngModule:onLoad()
- self:logInfo('load')
- self:regCallback('TalkEvent', Func.bind(self.ng_TalkEvent, self))
- end
-
- --- 卸载模块钩子
- function ngModule:onUnload()
- self:logInfo('unload')
- end
-
- return ngModule
复制代码
全队打卡命令 【/7 on 】 开启;【/7 off】 关闭
快速组队命令【/8 用户名1 用户名2 用户名3】 队员无论在何处(但不能在队伍中)都可以组队
|