Beispiel #1
0
        protected override void Execute(CallArgs args)
        {
            Player targetPlayer = args.Get <Player>(0);

            if (args.SenderName == targetPlayer.Name)
            {
                SendMessage(args.Sender, "You can't mute yourself");
                return;
            }

            if (!args.IsConsole && targetPlayer.Permissions >= args.Sender.Value.Permissions)
            {
                SendMessage(args.Sender, $"You're not allowed to mute {targetPlayer.Name}");
                return;
            }

            if (targetPlayer.IsMuted)
            {
                SendMessage(args.Sender, $"{targetPlayer.Name} is already muted");
                return;
            }

            targetPlayer.IsMuted = true;
            // TODO: Send a packet to all players to acknowledge the muted player
            SendMessage(targetPlayer, "You're now muted");
            SendMessage(args.Sender, $"Muted {targetPlayer.Name}");
        }
Beispiel #2
0
        protected override void Execute(CallArgs args)
        {
            string joinedArgs = args.GetTillEnd();

            playerManager.SendPacketToAllPlayers(new ChatMessage(ChatMessage.SERVER_ID, joinedArgs));
            Log.Info("BROADCAST: " + joinedArgs);
        }
Beispiel #3
0
        protected override void Execute(CallArgs args)
        {
            Player foundPlayer = args.Get <Player>(0);
            string message     = $"[{args.SenderName} -> YOU]: {args.GetTillEnd(1)}";

            SendMessageToPlayer(foundPlayer, message);
        }
        private CallArgs ParseCallArgs()
        {
            var t = NextToken();

            AssertDelimiter(Delimiter.ParenthesisOpen, t);

            var node = new CallArgs();

            t = NextToken(false);
            if (t.IsDelimiter(Delimiter.ParenthesisClose))
            {
                _stream.Next();

                return(node);
            }

            do
            {
                var expr = ParseExpression();

                node.AddChild(expr);
            } while (NextToken().IsDelimiter(Delimiter.Comma));
            _stream.Previous(); // Not comma encountered

            t = NextToken();
            AssertDelimiter(Delimiter.ParenthesisClose, t);

            return(node);
        }
        protected override void Execute(CallArgs args)
        {
            ServerGameMode sgm = args.Get <ServerGameMode>(0);

            serverConfig.GameModeEnum = sgm;
            SendMessage(args.Sender, $"Server gamemode changed to \"{sgm}\" by {args.SenderName}");
        }
Beispiel #6
0
        protected override void Execute(CallArgs args)
        {
            List <NitroxVector3> randomStartPositions = nitroxRandomStart.GenerateRandomStartPositions(world.Seed);

            playerManager.SendPacketToAllPlayers(new DebugStartMapPacket(randomStartPositions));
            SendMessage(args.Sender, $"Rendered {randomStartPositions.Count} spawn positions");
        }
Beispiel #7
0
        protected override void Execute(CallArgs args)
        {
            Player playerToKick = args.Get <Player>(0);

            if (args.SenderName == playerToKick.Name)
            {
                SendMessage(args.Sender, "You can't kick yourself");
                return;
            }

            if (!args.IsConsole && playerToKick.Permissions >= args.Sender.Value.Permissions)
            {
                SendMessage(args.Sender, $"You're not allowed to kick {playerToKick.Name}");
                return;
            }

            playerToKick.SendPacket(new PlayerKicked(args.GetTillEnd(1)));
            playerManager.PlayerDisconnected(playerToKick.Connection);

            List <SimulatedEntity> revokedEntities = entitySimulation.CalculateSimulationChangesFromPlayerDisconnect(playerToKick);

            if (revokedEntities.Count > 0)
            {
                SimulationOwnershipChange ownershipChange = new(revokedEntities);
                playerManager.SendPacketToAllPlayers(ownershipChange);
            }

            playerManager.SendPacketToOtherPlayers(new Disconnect(playerToKick.Id), playerToKick);
            SendMessage(args.Sender, $"The player {playerToKick.Name} has been disconnected");
        }
Beispiel #8
0
 private void CallNumber(object sender, CallArgs e)
 {
     if ((customerData.ContainsKey(e.TargetTelephoneNumber) && e.TargetTelephoneNumber != e.TelephoneNumber))
     {
         if (customerData[e.TelephoneNumber].Item1.PortState == true && customerData[e.TargetTelephoneNumber].Item1.PortState == true)
         {
             if (customerData[e.TelephoneNumber].Item2.Money > customerData[e.TelephoneNumber].Item2.Rate.CostPerMinute)
             {
                 callList.Add(new CallData(e.TelephoneNumber, e.TargetTelephoneNumber, DateTime.Now));
                 customerData[e.TargetTelephoneNumber].Item1.IncommingCall(this, new CallArgs(e.TelephoneNumber, e.TargetTelephoneNumber));
             }
             else
             {
                 Console.WriteLine("We don't have enough money to make the call");
             }
         }
         else
         {
             Console.WriteLine("The subscriber is not available now, please call back later");
         }
     }
     else
     {
         Console.WriteLine("Number is not exist, please check the number and call again.");
     }
 }
        protected override void Execute(CallArgs args)
        {
            server.DisablePeriodicSaving();
            string          saveDir         = serverConfig.SaveName;
            string          fileEnding      = worldPersistence.SaveDataSerializer.GetFileEnding();
            SaveFileVersion saveFileVersion = worldPersistence.SaveDataSerializer.Deserialize <SaveFileVersion>(Path.Combine(saveDir, "Version" + fileEnding));


            if (saveFileVersion.Version == NitroxEnvironment.Version)
            {
                SendMessage(args.Sender, "Save files are already at the newest version");
            }
            else if (serverConfig.SerializerMode == ServerSerializerMode.PROTOBUF)
            {
                SendMessage(args.Sender, "Can't upgrade while using ProtoBuf as serializer");
            }
            else
            {
                foreach (SaveDataUpgrade upgrade in upgrades)
                {
                    if (upgrade.TargetVersion > saveFileVersion.Version)
                    {
                        upgrade.UpgradeData(saveDir, fileEnding);
                    }
                }
                worldPersistence.SaveDataSerializer.Serialize(Path.Combine(saveDir, "Version" + fileEnding), new SaveFileVersion());
                SendMessage(args.Sender, $"Save file was upgraded to {NitroxEnvironment.Version}");
                server.StopAndWait(false);
            }
        }
Beispiel #10
0
        protected override void Execute(CallArgs args)
        {
            IList <string> players    = playerManager.GetConnectedPlayers().Select(player => player.Name).ToList();
            string         playerList = string.Join(", ", players);

            SendMessage(args.Sender, $"List of players : {(players.Count == 0 ? "No players online" : playerList)}");
        }
Beispiel #11
0
        protected override void Execute(CallArgs args)
        {
            Player targetPlayer = args.Get <Player>(0);
            Perms  permissions  = args.Get <Perms>(1);

            if (args.SenderName == targetPlayer.Name)
            {
                SendMessage(args.Sender, "You can't promote yourself");
                return;
            }

            //Allows a bounded permission hierarchy
            if (args.IsConsole || permissions < args.Sender.Value.Permissions)
            {
                targetPlayer.Permissions = permissions;

                // TODO: Send a packet to the player to acknowledge the permision level change
                SendMessage(args.Sender, $"Updated {targetPlayer.Name}\'s permissions to {permissions}");
                SendMessageToPlayer(targetPlayer, $"You've been promoted to {permissions}");
            }
            else
            {
                SendMessage(args.Sender, $"You're not allowed to update {targetPlayer.Name}\'s permissions");
            }
        }
Beispiel #12
0
        protected override void Execute(CallArgs args)
        {
            NitroxInt3    batchId  = new(args.Get <int>(0), args.Get <int>(1), args.Get <int>(2));
            List <Entity> entities = batchEntitySpawner.LoadUnspawnedEntities(batchId);

            SendMessage(args.Sender, $"Loaded {entities.Count} entities from batch {batchId}");
        }
Beispiel #13
0
 protected void CallFromTerminal(object obj, CallArgs e)
 {
     if (CallEvent != null)
     {
         CallEvent(this, e);
     }
     //CallEvent?.Invoke(this, e);
 }
Beispiel #14
0
        protected override void Execute(CallArgs args)
        {
            Player receivingPlayer = args.Get <Player>(0);
            string playerName      = receivingPlayer.Name;

            receivingPlayer.Permissions = Perms.ADMIN;
            SendMessage(args.Sender, $"Updated {playerName}\'s permissions to admin");
        }
Beispiel #15
0
        protected override void Execute(CallArgs args)
        {
            NitroxVector3 position = new(args.Get <int>(0), args.Get <int>(1), args.Get <int>(2));

            args.Sender.Value.Teleport(position, Optional.Empty);

            SendMessage(args.Sender, $"Teleported to {position}");
        }
Beispiel #16
0
        protected override void Execute(CallArgs args)
        {
            Player targetPlayer = args.Get <Player>(0);

            targetPlayer.Permissions = Perms.PLAYER;

            SendMessage(args.Sender, $"Updated {targetPlayer.Name}\'s permissions to PLAYER");
        }
        protected override void Execute(CallArgs args)
        {
            string password = args.Get(0) ?? string.Empty;

            serverConfig.ServerPassword = password;

            Log.Info($"Server password changed to \"{password}\" by {args.SenderName}");
            SendMessageToPlayer(args.Sender, "Server password changed");
        }
Beispiel #18
0
        protected override void Execute(CallArgs args)
        {
            ServerGameMode sgm = args.Get <ServerGameMode>(0);

            serverConfig.GameModeEnum = sgm;
            playerManager.SendPacketToAllPlayers(new GameModeChanged(sgm));

            SendMessageToAllPlayers($"Server gamemode changed to \"{sgm}\" by {args.SenderName}");
        }
        protected override void Execute(CallArgs args)
        {
            string password = args.Get(0) ?? string.Empty;

            serverConfig.ServerPassword = password;

            Log.InfoSensitive("Server password changed to {password} by {playername}", password, args.SenderName);
            SendMessageToPlayer(args.Sender, "Server password changed");
        }
Beispiel #20
0
        protected override void Execute(CallArgs args)
        {
            string newPassword = args.Get(0);

            serverConfig.AdminPassword = newPassword;

            Log.InfoSensitive("Admin password changed to {password} by {playername}", newPassword, args.SenderName);
            SendMessageToPlayer(args.Sender, "Admin password changed");
        }
Beispiel #21
0
        protected override void Execute(CallArgs args)
        {
            string newPassword = args.Get(0);

            serverConfig.AdminPassword = newPassword;

            Log.Info($"Admin password changed to \"{newPassword}\" by {args.SenderName}");
            SendMessageToPlayer(args.Sender, "Admin password changed");
        }
Beispiel #22
0
        public void OnCall(CallArgs e)
        {
            StateOfCurrentCall = e.CallState;
            CurrentCall        = e.LCall;
            Debug.WriteLine("Call state changed: " + StateOfCurrentCall);

            call_status.Text = "Call state changed: " + StateOfCurrentCall;

            if (StateOfCurrentCall == CallStatePCL.IncomingReceived)
            {
                var page = new OnCallPage();
                page.RefuseCall += (s, args) =>
                {
                    LinphoneManager.TerminateAllCalls();
                };

                page.AcceptCall += (s, args) =>
                {
                    LinphoneManager.AcceptCall();
                };

                page.SetVideoView(CurrentCall, LinphoneManager);

                Navigation.PushAsync(page);
            }
            else if (StateOfCurrentCall == CallStatePCL.IncomingEarlyMedia)
            {
            }
            else if (StateOfCurrentCall == CallStatePCL.StreamsRunning)
            {
                if (isOutgoingCall)
                {
                    call.Text = "Terminate";
                    if (!CurrentCall.IsVideoEnabled)
                    {
                        LinphoneManager.SetViewCallOutgoing(CurrentCall);
                    }
                }
            }
            else if (StateOfCurrentCall == CallStatePCL.Error || StateOfCurrentCall == CallStatePCL.End)
            {
                call.Text = "Start Call";

                var stack = Navigation.NavigationStack; // remove on call page
                if (stack != null && stack.Count == 2)
                {
                    Navigation.PopAsync();
                }
                if (isOutgoingCall)
                {
                    isOutgoingCall             = false;
                    contentViewVideo.IsVisible = false;
                    contentViewVideo.Content   = null;
                }
            }
        }
Beispiel #23
0
        protected override void Execute(CallArgs args)
        {
            Validate.IsTrue(args.Sender.HasValue, "This command can't be used by CONSOLE");

            Player otherPlayer = args.Get <Player>(0);

            args.Sender.Value.Teleport(otherPlayer.Position);

            SendMessage(args.Sender, $"Teleported to {otherPlayer.Name}");
        }
Beispiel #24
0
        protected override void Execute(CallArgs args)
        {
            IList <string> players = playerManager.GetConnectedPlayers().Select(player => player.Name).ToList();

            StringBuilder builder = new($"List of players ({players.Count}/{serverConfig.MaxConnections}):\n");

            builder.Append(string.Join(", ", players));

            SendMessage(args.Sender, builder.ToString());
        }
        protected override void Execute(CallArgs args)
        {
            ServerConfig serverConfig = NitroxConfig.Deserialize <ServerConfig>();

            serverConfig.SerializerMode = serverConfig.SerializerMode == ServerSerializerMode.PROTOBUF ? ServerSerializerMode.JSON : ServerSerializerMode.PROTOBUF;
            NitroxConfig.Serialize(serverConfig);

            worldPersistence.UpdateSerializer(serverConfig.SerializerMode == ServerSerializerMode.PROTOBUF ? (IServerSerializer)protoBufSerializer : jsonSerializer);
            SendMessage(args.Sender, $"Swapped to {serverConfig.SerializerMode}");
        }
Beispiel #26
0
        protected override void Execute(CallArgs args)
        {
            Validate.IsTrue(args.Sender.HasValue, "This command can't be used by CONSOLE");

            Vector3 position = new Vector3(args.Get <int>(0), args.Get <int>(1), args.Get <int>(2));

            args.Sender.Value.Teleport(position);

            SendMessage(args.Sender, $"Teleported to {position}");
        }
Beispiel #27
0
        private CallArgs GetCallArgs()
        {
            var args = new CallArgs();

            args.AutoLine   = this.checkAutoLine.Checked;
            args.AutoDate   = this.checkAutoDate.Checked;
            args.Count      = (int)this.cbxCount.SelectedItem;
            args.IntervalMs = (int)this.cbxInterval.SelectedItem;
            return(args);
        }
Beispiel #28
0
        protected override void Execute(CallArgs args)
        {
            Player targetPlayer = args.Get <Player>(0);

            targetPlayer.Permissions = Perms.PLAYER;

            // Need to notify him so that he no longer shows admin stuff on client (which would in any way stop working)
            // TODO: Send a packet to the player to acknowledge the permision level change
            SendMessage(targetPlayer, "You were demoted to PLAYER");
            SendMessage(args.Sender, $"Updated {targetPlayer.Name}\'s permissions to PLAYER");
        }
Beispiel #29
0
        protected override void Execute(CallArgs args)
        {
            Player targetPlayer = args.Get <Player>(0);

            targetPlayer.Permissions = Perms.ADMIN;

            // We need to notify this player that he can show all the admin-related stuff
            // TODO: Send a packet to the player to acknowledge the permision level change
            SendMessage(targetPlayer, "You were promoted to ADMIN");
            SendMessage(args.Sender, $"Updated {targetPlayer.Name}\'s permissions to ADMIN");
        }
Beispiel #30
0
        protected override void Execute(CallArgs args)
        {
            string dir = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);

            if (!Directory.Exists(dir))
            {
                Log.Error($"Unable to open Nitrox directory '{dir}' because it does not exist.");
                return;
            }

            Process.Start(dir);
        }