function n6030014_OnTalk(MapID, InstanceID, TargetID, TargetTypeID, RoleID, TalkIndex) local curmon = tonumber(os.date("%m")) local curday = tonumber(os.date("%d")) local curhour = tonumber(os.date("%H")) local curmin = tonumber(os.date("%M")) local nowtime = curhour*100 + curmin if TalkIndex == -1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 200010) -- 教师节使者:\n 只要你等级高于35级,每天的20:30至21:00,都可以在我这里领取教师节的嘉奖状态,可以提高获得经验的速度哦! msg.AddMsgEvent(MsgID, 24, TargetID) msg.AddMsgEvent(MsgID, 21, 4) msg.AddMsgEvent(MsgID, 1, 200014) -- 领取状态 msg.AddMsgEvent(MsgID, 21, 99) msg.AddMsgEvent(MsgID, 1, 100002) -- 取消 msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 4 then local ishavebuff = role.IsRoleHaveBuff(MapID,InstanceID,RoleID,20586) local level = role.GetRoleLevel(MapID,InstanceID,RoleID) if nowtime > 2029 and nowtime < 2101 then if ishavebuff then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 200011) -- 教师节使者:\n 你已经领取过了。 msg.AddMsgEvent(MsgID, 24, TargetID) msg.AddMsgEvent(MsgID, 21, 99) msg.AddMsgEvent(MsgID, 1, 100001) -- 确定 msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif level < 35 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 200013) -- 教师节使者:\n 等级不足。 msg.AddMsgEvent(MsgID, 24, TargetID) msg.AddMsgEvent(MsgID, 21, 99) msg.AddMsgEvent(MsgID, 1, 100001) -- 确定 msg.DispatchRoleMsgEvent(RoleID, MsgID) else unit.AddBuff(MapID,InstanceID,RoleID,2058601,RoleID) end else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 200012) -- 教师节使者:\n 只有在20:30至21:00之间才能领取。 msg.AddMsgEvent(MsgID, 24, TargetID) msg.AddMsgEvent(MsgID, 21, 99) msg.AddMsgEvent(MsgID, 1, 100001) -- 确定 msg.DispatchRoleMsgEvent(RoleID, MsgID) end end end aux.RegisterCreatureEvent(6030014, 7, "n6030014_OnTalk")