Пример #1
0
        private void OnMake(EntityUid uid, string name, string description, string rules, bool makeSentient)
        {
            var player = _playerManager.LocalPlayer;

            if (player == null)
            {
                return;
            }

            var makeGhostRoleCommand =
                $"makeghostrole " +
                $"\"{CommandParsing.Escape(uid.ToString())}\" " +
                $"\"{CommandParsing.Escape(name)}\" " +
                $"\"{CommandParsing.Escape(description)}\" " +
                $"\"{CommandParsing.Escape(rules)}\"";

            _consoleHost.ExecuteCommand(player.Session, makeGhostRoleCommand);

            if (makeSentient)
            {
                var makeSentientCommand = $"makesentient \"{CommandParsing.Escape(uid.ToString())}\"";
                _consoleHost.ExecuteCommand(player.Session, makeSentientCommand);
            }

            _window.Close();
        }
        /// <summary>
        ///     Execute a command to modify the reagents in the solution.
        /// </summary>
        private void SetReagent(FloatSpinBox.FloatSpinBoxEventArgs args, string reagentId)
        {
            if (_solutions == null || _selectedSolution == null)
            {
                return;
            }

            var current = _solutions[_selectedSolution].GetReagentQuantity(reagentId);
            var delta   = args.Value - current.Float();

            if (MathF.Abs(delta) < 0.01)
            {
                return;
            }

            var command = $"addreagent {_target} {_selectedSolution} {reagentId} {delta}";

            _consoleHost.ExecuteCommand(command);
        }
        private void ConfirmButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
        {
            if (TargetEntityId == null || _selectedOutfit == null)
            {
                return;
            }
            var command = $"setoutfit {TargetEntityId} {_selectedOutfit.ID}";

            _consoleHost.ExecuteCommand(command);
            Close();
        }
Пример #4
0
        private void AddAdminVerbs(GetVerbsEvent <Verb> args)
        {
            // Currently this is only the ViewVariables verb, but more admin-UI related verbs can be added here.

            // View variables verbs
            if (_clientConGroupController.CanViewVar())
            {
                Verb verb = new();
                verb.Category        = VerbCategory.Debug;
                verb.Text            = "View Variables";
                verb.IconTexture     = "/Textures/Interface/VerbIcons/vv.svg.192dpi.png";
                verb.Act             = () => _clientConsoleHost.ExecuteCommand($"vv {args.Target}");
                verb.ClientExclusive = true; // opening VV window is client-side. Don't ask server to run this verb.
                args.Verbs.Add(verb);
            }
        }
Пример #5
0
        public override void Startup()
        {
            _gameTicker     = EntitySystem.Get <ClientGameTicker>();
            _characterSetup = new CharacterSetupGui(_entityManager, _resourceCache, _preferencesManager,
                                                    _prototypeManager);
            LayoutContainer.SetAnchorPreset(_characterSetup, LayoutContainer.LayoutPreset.Wide);

            _lobby = new LobbyGui(_entityManager, _preferencesManager);
            _userInterfaceManager.StateRoot.AddChild(_lobby);

            _characterSetup.CloseButton.OnPressed += _ =>
            {
                _userInterfaceManager.StateRoot.AddChild(_lobby);
                _userInterfaceManager.StateRoot.RemoveChild(_characterSetup);
            };

            _characterSetup.SaveButton.OnPressed += _ =>
            {
                _characterSetup.Save();
                _lobby?.CharacterPreview.UpdateUI();
            };

            LayoutContainer.SetAnchorPreset(_lobby, LayoutContainer.LayoutPreset.Wide);

            _chatManager.SetChatBox(_lobby.Chat);
            _voteManager.SetPopupContainer(_lobby.VoteContainer);

            _lobby.ServerName.Text = _baseClient.GameInfo?.ServerName;

            ChatInput.SetupChatInputHandlers(_inputManager, _lobby.Chat);

            UpdateLobbyUi();

            _lobby.CharacterPreview.CharacterSetupButton.OnPressed += _ =>
            {
                SetReady(false);
                _userInterfaceManager.StateRoot.RemoveChild(_lobby);
                _userInterfaceManager.StateRoot.AddChild(_characterSetup);
            };

            _lobby.ReadyButton.OnPressed += _ =>
            {
                if (!_gameTicker.IsGameStarted)
                {
                    return;
                }

                new LateJoinGui().OpenCentered();
            };

            _lobby.ReadyButton.OnToggled += args =>
            {
                SetReady(args.Pressed);
            };

            _lobby.LeaveButton.OnPressed   += _ => _consoleHost.ExecuteCommand("disconnect");
            _lobby.OptionsButton.OnPressed += _ => new OptionsMenu().Open();

            UpdatePlayerList();

            _playerManager.PlayerListUpdated       += PlayerManagerOnPlayerListUpdated;
            _gameTicker.InfoBlobUpdated            += UpdateLobbyUi;
            _gameTicker.LobbyStatusUpdated         += LobbyStatusUpdated;
            _gameTicker.LobbyReadyUpdated          += LobbyReadyUpdated;
            _gameTicker.LobbyLateJoinStatusUpdated += LobbyLateJoinStatusUpdated;
        }
Пример #6
0
 private void OnQuitButtonClicked(BaseButton.ButtonEventArgs args)
 {
     _consoleHost.ExecuteCommand("quit");
     Dispose();
 }
Пример #7
0
        public override void Startup()
        {
            _characterSetup = new CharacterSetupGui(_entityManager, _resourceCache, _preferencesManager,
                                                    _prototypeManager);
            LayoutContainer.SetAnchorPreset(_characterSetup, LayoutContainer.LayoutPreset.Wide);

            _characterSetup.CloseButton.OnPressed += args =>
            {
                _userInterfaceManager.StateRoot.AddChild(_lobby);
                _userInterfaceManager.StateRoot.RemoveChild(_characterSetup);
            };

            _characterSetup.SaveButton.OnPressed += args =>
            {
                _characterSetup.Save();
                _lobby.CharacterPreview.UpdateUI();
            };

            _lobby = new LobbyGui(_entityManager, _resourceCache, _preferencesManager);
            _userInterfaceManager.StateRoot.AddChild(_lobby);

            LayoutContainer.SetAnchorPreset(_lobby, LayoutContainer.LayoutPreset.Wide);

            _chatManager.SetChatBox(_lobby.Chat);
            _lobby.Chat.DefaultChatFormat = "ooc \"{0}\"";

            _lobby.ServerName.Text = _baseClient.GameInfo.ServerName;

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(s => GameScreen.FocusChat(_lobby.Chat)));

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusOOC,
                                          InputCmdHandler.FromDelegate(s => GameScreen.FocusOOC(_lobby.Chat)));

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusAdminChat,
                                          InputCmdHandler.FromDelegate(s => GameScreen.FocusAdminChat(_lobby.Chat)));

            UpdateLobbyUi();

            _lobby.CharacterPreview.CharacterSetupButton.OnPressed += args =>
            {
                SetReady(false);
                _userInterfaceManager.StateRoot.RemoveChild(_lobby);
                _userInterfaceManager.StateRoot.AddChild(_characterSetup);
            };

            _lobby.ObserveButton.OnPressed += args => _consoleHost.ExecuteCommand("observe");
            _lobby.ReadyButton.OnPressed   += args =>
            {
                if (!_clientGameTicker.IsGameStarted)
                {
                    return;
                }

                new LateJoinGui().OpenCentered();
                return;
            };

            _lobby.ReadyButton.OnToggled += args =>
            {
                SetReady(args.Pressed);
            };

            _lobby.LeaveButton.OnPressed   += args => _consoleHost.ExecuteCommand("disconnect");
            _lobby.OptionsButton.OnPressed += args => new OptionsMenu().Open();

            UpdatePlayerList();

            _playerManager.PlayerListUpdated             += PlayerManagerOnPlayerListUpdated;
            _clientGameTicker.InfoBlobUpdated            += UpdateLobbyUi;
            _clientGameTicker.LobbyStatusUpdated         += LobbyStatusUpdated;
            _clientGameTicker.LobbyReadyUpdated          += LobbyReadyUpdated;
            _clientGameTicker.LobbyLateJoinStatusUpdated += LobbyLateJoinStatusUpdated;
        }
Пример #8
0
 private void ToggleLight()
 {
     _consoleHost.ExecuteCommand("togglelight");
 }
        public BwoinkWindow(BwoinkSystem bs)
        {
            RobustXamlLoader.Load(this);
            IoCManager.InjectDependencies(this);
            _bwoinkSystem = bs;

            _adminManager.AdminStatusUpdated += FixButtons;
            FixButtons();

            ChannelSelector.OnSelectionChanged += sel =>
            {
                _currentPlayer = sel;
                if (sel is not null)
                {
                    SwitchToChannel(sel.SessionId);
                    Title = $"{sel.CharacterName} / {sel.Username}";
                }

                foreach (var li in ChannelSelector.PlayerItemList)
                {
                    li.Text = FormatTabTitle(li);
                }
            };

            ChannelSelector.DecoratePlayer += (PlayerInfo pl, ItemList.Item li) =>
            {
                li.Text = FormatTabTitle(li, pl);
            };

            ChannelSelector.Comparison = (a, b) =>
            {
                var aChannelExists = _bwoinkSystem.TryGetChannel(a.SessionId, out var ach);
                var bChannelExists = _bwoinkSystem.TryGetChannel(b.SessionId, out var bch);
                if (!aChannelExists && !bChannelExists)
                {
                    return(0);
                }

                if (!aChannelExists)
                {
                    return(1);
                }

                if (!bChannelExists)
                {
                    return(-1);
                }

                return(bch !.LastMessage.CompareTo(ach !.LastMessage));
            };

            // ew
            Ban.OnPressed += _ =>
            {
                var bw = new BanWindow();
                bw.OnPlayerSelectionChanged(_currentPlayer);
                bw.Open();
            };

            Kick.OnPressed += _ =>
            {
                if (!TryConfirm(Kick))
                {
                    return;
                }

                // TODO: Reason field
                if (_currentPlayer is not null)
                {
                    _console.ExecuteCommand($"kick \"{_currentPlayer.Username}\"");
                }
            };

            Teleport.OnPressed += _ =>
            {
                if (_currentPlayer is not null)
                {
                    _console.ExecuteCommand($"tpto \"{_currentPlayer.Username}\"");
                }
            };

            Respawn.OnPressed += _ =>
            {
                if (!TryConfirm(Respawn))
                {
                    return;
                }

                if (_currentPlayer is not null)
                {
                    _console.ExecuteCommand($"respawn \"{_currentPlayer.Username}\"");
                }
            };
        }
Пример #10
0
 private void OnQuitPressed()
 {
     _consoleHost.ExecuteCommand("quit");
 }