Esempio n. 1
0
        private void OnDoorMoveEvent(NotifyClientMovedEvent evt)
        {
            if (!Settings.HasAdmin)
            {
                return;
            }
            if (!Settings.DoorChannelEnabled)
            {
                return;
            }
            if (string.IsNullOrEmpty(Settings.DoorChannelName))
            {
                return;
            }

            string doorName    = Settings.DoorChannelName;
            string doorMessage = string.IsNullOrEmpty(Settings.DoorMessage) ? "Left the house." : Settings.DoorMessage;

            doorMessage = ModelParser.ToStringAttribute(doorMessage);

            Channel channel = Client.GetChannelById(evt.ToChannelId);

            if (channel != null && channel.Name == doorName)
            {
                LogMessage($"{Client.GetClientById(evt.ClientId).Nickname} used the door channel");
                Client.SendCommand($"clientkick reasonid=5 reasonmsg={doorMessage} clid={evt.ClientId}");
                StatSettings.DoorUsed++;
            }
        }
Esempio n. 2
0
        public void OnClientMoved(Event e)
        {
            NotifyClientMovedEvent evt = (NotifyClientMovedEvent)e;

            OnNoMoveEvent(evt);
            OnDoorMoveEvent(evt);

            if (evt.ClientId == MyClientId)
            {
                MyChannelId = evt.ToChannelId;
            }

            RefreshClientList();
        }
Esempio n. 3
0
        public void OnNoMoveEvent(NotifyClientMovedEvent evt)
        {
            if (!Settings.NoMoveEnabled)
            {
                return;
            }
            if (evt.Reason == ClientMoveReason.SelfMove || evt.ClientId == evt.InvokerId)
            {
                return;                                                                           //Ignore channel switching
            }
            int myId = GetMyClientId();

            if (myId == evt.ClientId)
            {
                Client me = Client.GetClientById(myId);
                Client.SendCommand($"clientmove cid={me.ChannelId} clid={myId}");
                LogMessage($"No-Move triggered for yourself");
                StatSettings.MovesDenied++;
                return;
            }


            if (!Settings.HasAdmin)
            {
                return;                     //Others can only be protected with admin privileges
            }
            if (string.IsNullOrEmpty(Settings.NoMoveUsername))
            {
                return;
            }

            string        otherExcludeNames = Settings.NoMoveUsername;
            List <string> namesList         = otherExcludeNames.Split(new char[] { ',' }).ToList();

            Client otherClient = Client.GetClientById(evt.ClientId);

            if (otherClient != null && namesList.Contains(otherClient.Nickname))
            {
                Client.SendCommand($"clientmove cid={otherClient.ChannelId} clid={otherClient.Id}");
                LogMessage($"No-Move triggered for '{otherClient.Nickname}'");
                StatSettings.MovesDenied++;
                return;
            }
        }