public void CanGetTcpChannelOnUnpecifiedPortPUT1([PexAssumeUnderTest] String name)
 {
     channel1 = ServerUtilities.GetTcpChannel(name, 0);
     channel2 = ServerUtilities.GetTcpChannel(name, 0);
     PexAssert.AreEqual(channel1, channel2);
     PexAssert.AreSame(channel1, channel2);
 }
Beispiel #2
0
        // (Konrad) We are not going to process warnings here.
#else
        /// <summary>
        /// Adds Warnings to a collection in database. If warnings exist it updates their status.
        /// </summary>
        public static void ProcessWarnings(ActionType action, Document doc, string centralPath)
        {
            var current = doc.GetWarnings().Select(x => new WarningItem(x, doc)).ToList();

            switch (action)
            {
            case ActionType.CheckIn:
                if (!ServerUtilities.Post(current, "warnings/add", out ResponseCreated unused1))
                {
                    Log.AppendLog(LogMessageType.ERROR, "Failed to publish Views Data.");
                }
                break;

            case ActionType.Synch:
                var newW = AppCommand.Warnings.Values
                           .Where(x => !string.IsNullOrEmpty(x.CreatedBy) && current.Any(y => y.UniqueId == x.UniqueId)).ToList();
                var existingW = current.Except(newW).Select(x => x.UniqueId);

                var payload = new WarningData(Environment.UserName, centralPath, newW, existingW);
                if (!ServerUtilities.Post(payload, "warnings/update", out ResponseCreated unused))
                {
                    Log.AppendLog(LogMessageType.ERROR, "Failed to publish Views Data.");
                }
                else
                {
                    CollectWarnings(doc);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Checks if Trigger Records collection exists and creates one if it doesn't. Since trigger
        /// records are published on demand by another tool (DTM) there is no need to publish them here.
        /// </summary>
        /// <param name="centralPath"></param>
        public static void ProcessTriggerRecords(string centralPath)
        {
            var project = MissionControlSetup.Projects[centralPath];

            if (!ServerUtilities.GetByCentralPath(centralPath, "triggerrecords/centralpath", out TriggerRecordData trData))
            {
                if (ServerUtilities.Post(new TriggerRecordData {
                    CentralPath = centralPath.ToLower()
                }, "triggerrecords", out trData))
                {
                    ServerUtilities.Put(new { id = trData.Id }, "projects/" + project.Id + "/addtriggerrecord");

                    if (MissionControlSetup.TriggerRecords.ContainsKey(centralPath))
                    {
                        MissionControlSetup.TriggerRecords.Remove(centralPath);
                    }
                    MissionControlSetup.TriggerRecords.Add(centralPath, trData.Id); // store TriggerRecords record
                }
            }
            if (trData != null)
            {
                if (MissionControlSetup.TriggerRecords.ContainsKey(centralPath))
                {
                    MissionControlSetup.TriggerRecords.Remove(centralPath);
                }
                MissionControlSetup.TriggerRecords.Add(centralPath, trData.Id); // store TriggerRecords record
            }
        }
 //Chatbot Question -> NLP Nonsense model
 public OffensivenessModelRequest(ChatbotNewQuestionModel chatbotNewQuestionModel)
 {
     this.question    = chatbotNewQuestionModel.question;
     this.question_id = chatbotNewQuestionModel.chatbot_temp_id;
     this.msg_id      = ServerUtilities.getAndGenerateMsgIDForGivenQuestion(chatbotNewQuestionModel.user_id, chatbotNewQuestionModel.question, chatbotNewQuestionModel.chatbot_temp_id);
     this.action      = "IS_NONSENSE".ToLower();
 }
        public async void SelectCharacter(Client client, object[] args)
        {
            uint          characterId   = (uint)(int)args[0];
            CharacterData characterData = await CharacterDatabase.GetCharacterData(characterId);

            Vector3 position = characterData.GetPosition();
            float   heading  = characterData.Heading.HasValue ? characterData.Heading.Value : 0;

            if (position == null)
            {
                GamePosition spawnPoint = ServerUtilities.GetRandomSpawnPoint();
                position = spawnPoint.GetPosition();
                heading  = spawnPoint.GetHeading();
            }


            client.SetData(CharacterData.CHARACTER_DATA_KEY, characterData);

            PlayerData playerData         = client.GetData(PlayerData.PLAYER_DATA_KEY);
            GroupData  highestRankedGroup = await GroupDatabase.GetPlayerHighestRankingGroup(playerData.Id);

            if (highestRankedGroup == null)
            {
                return;
            }
            if (characterData == null)
            {
                return;
            }

            ServerUtilities.SetPlayerNametag(client);
            ServerUtilities.SwitchPlayerPosition(client, position, heading);
        }
        public static string getQuestionFromID(int question_id)
        {
            DBManager manager = new DBManager(true);

            String result = null;

            StringBuilder sb = new StringBuilder();

            sb.Append("SELECT question ");
            sb.Append("FROM Questions q ");
            sb.Append($"WHERE q.question_id = {question_id}; ");
            String sql = sb.ToString();

            using (SqlDataReader reader = manager.Read(sql))
            {
                // This query should only return 0 or 1 result
                if (reader.Read())
                {
                    result = reader.GetString(0);
                    /****/
                    result = ServerUtilities.SQLSafeToUserInput(result);
                    /****/
                }
            }

            manager.Close();

            return(result);
        }
Beispiel #7
0
        /// <summary>
        /// If Family is marked as Completed it will post the data to MC.
        /// </summary>
        /// <param name="app"></param>
        public void SubmitFamily(UIApplication app)
        {
            var doc = app.ActiveUIDocument.Document;

            if (doc == null || doc.IsFamilyDocument)
            {
                return;
            }

            var centralPath   = FileInfoUtil.GetCentralFilePath(doc);
            var familyStatsId = MissionControlSetup.FamilyData[centralPath].Id;

            if (string.IsNullOrEmpty(familyStatsId))
            {
                return;
            }

            FamilyTask.CompletedOn = DateTime.UtcNow;
            FamilyTask.CompletedBy = Environment.UserName.ToLower();

            if (!ServerUtilities.Post(FamilyTask,
                                      "families/" + familyStatsId + "/family/" + FamilyItem.Name + "/updatetask/" + FamilyTask.Id, out FamilyData unused))
            {
                Log.AppendLog(LogMessageType.ERROR, "Failed to submit Family Task Completed update.");
            }
        }
 //Chatbot answer -> Nonsense to NLP model
 public OffensivenessModelRequest(ChatbotGivesAnswerModelToServer item, ChatbotGivesAnswersToQuestionsToServer chatbotGivesAnswersToQuestionsToServer)
 {
     this.question    = item.answer;
     this.question_id = item.question_id;
     this.msg_id      = ServerUtilities.getAndGenerateMsgIDForGivenAnswer(chatbotGivesAnswersToQuestionsToServer.user_id, item.answer, item.question_id); //TODO: what should this be?
     this.action      = "IS_NONSENSE".ToLower();
 }
 //NLP Nonsense -> NLP Offense model
 public OffensivenessModelRequest(NewQuestionNonsenseCheck newQuestionNonsenseCheck)
 {
     this.question    = newQuestionNonsenseCheck.question;
     this.question_id = newQuestionNonsenseCheck.question_id;
     this.msg_id      = ServerUtilities.getAndGenerateMsgIDForGivenQuestion(newQuestionNonsenseCheck.user_id, newQuestionNonsenseCheck.question, newQuestionNonsenseCheck.question_id);
     this.action      = "ESTIMATE_OFFENSIVENESS".ToLower();
 }
Beispiel #10
0
        /// <summary>
        /// Publishes data about Model Opening duration.
        /// </summary>
        /// <param name="filePath">Revit Document central file path.</param>
        public void PublishOpenTime(string filePath)
        {
            try
            {
                var from = AppCommand.OpenTime["from"];
                var to   = DateTime.UtcNow;
                var span = to - from;
                var ms   = (int)span.TotalMilliseconds;

                var eventItem = new ModelEventData
                {
                    CentralPath = filePath.ToLower(),
                    Value       = ms,
                    User        = Environment.UserName.ToLower()
                };

                if (!ServerUtilities.Post(eventItem, "model/opentimes", out ModelEventData unused))
                {
                    Log.AppendLog(LogMessageType.ERROR, "Failed to publish Model Open Times Data.");
                }
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
Beispiel #11
0
        public async void OnResourceStart()
        {
            NAPI.Server.SetAutoRespawnAfterDeath(false);
            NAPI.Server.SetAutoSpawnOnConnect(false);
            //NAPI.Server.SetGlobalServerChat(false);
            //NAPI.Server.SetCommandErrorMessage("");

            ServerUtilities.Initialise();

            Database db = new Database();

            Connection = db.Connection;

            GroupDatabase.InitializeTable();
            GroupDatabase.InitializeGroups();
            VehicleDatabase.InitializeTable();
            PlayerDatabase.InitializeTable();
            CharacterDatabase.InitializeTable();


            await GroupDatabase.AddCommandsToGroup(Config.GROUP_NAME_ADMIN, Commands.AdminCommands.ToArray());

            await GroupDatabase.AddCommandsToGroup(Config.GROUP_NAME_LEAD_ADMIN, Commands.OwnerCommands.ToArray());

            await GroupDatabase.AddCommandsToGroup(Config.GROUP_NAME_OWNER, Commands.OwnerCommands.ToArray());
        }
        public void CanConnectToAgency()
        {
            object obj = Activator.GetObject(typeof(TestAgency), ServerUtilities.MakeUrl("TempTestAgency", 9300));

            Assert.IsNotNull(obj);
            Assert.That(obj is TestAgency);
        }
        public void Init(IServerObjectHelper pSOH)
        {
            try
            {
                _soHelper      = pSOH;
                _serverLog     = new ServerLogger();
                _restSOIHelper = new RestSOIHelper(pSOH);

                try
                {
                    IPropertySet configProps = ServerUtilities.QueryConfigurationProperties(pSOH.ServerObject.ConfigurationName, pSOH.ServerObject.TypeName);
                    _outputDirectory = configProps.GetProperty("outputDir") as string;
                }
                catch (Exception ignore)
                {
                    _outputDirectory = string.Empty;
                }

                _outputDirectory = _outputDirectory.Trim();
                if (string.IsNullOrEmpty(_outputDirectory))
                {
                    _serverLog.LogMessage(ServerLogger.msgType.error, _soiName + ".init()", 500, "OutputDirectory is empty or missing. Reset to default.");
                    _outputDirectory = "C:\\arcgisserver\\directories\\arcgisoutput";
                }

                _serverLog.LogMessage(ServerLogger.msgType.infoDetailed, _soiName + ".init()", 500, "OutputDirectory is " + _outputDirectory);
                _serverLog.LogMessage(ServerLogger.msgType.infoStandard, _soiName + ".init()", 200, "Initialized " + _soiName + " SOI.");
            }
            catch (Exception e)
            {
                _serverLog.LogMessage(ServerLogger.msgType.error, _soiName + ".HandleRESTRequest()", 500, "Exception " + e.GetType().Name + " " + e.Message + " " + e.StackTrace);
                throw;
            }
        }
Beispiel #14
0
        /// <summary>
        /// Adds Groups data to collection if such exists, otherwise creates a new one.
        /// </summary>
        private static void ProcessGroups(Document doc, string centralPath)
        {
            var project = MissionControlSetup.Projects[centralPath];
            var data    = new DataRangeRequest(centralPath.ToLower());

            if (!ServerUtilities.Post(data, "groups/groupstats", out GroupsData gData))
            {
                if (ServerUtilities.Post(new GroupsData {
                    CentralPath = centralPath.ToLower()
                }, "groups", out gData))
                {
                    ServerUtilities.Put(new { id = gData.Id }, "projects/" + project.Id + "/addgroup");
                }
            }

            if (gData != null)
            {
                if (MissionControlSetup.GroupsData.ContainsKey(centralPath))
                {
                    MissionControlSetup.GroupsData.Remove(centralPath);
                }
                MissionControlSetup.GroupsData.Add(centralPath, gData); // store groups record

                Messenger.Default.Send(new HealthReportSummaryAdded {
                    Data = gData, Type = SummaryType.Groups
                });

                new Thread(() => new GroupMonitor().PublishData(doc, gData.Id))
                {
                    Priority     = ThreadPriority.BelowNormal,
                    IsBackground = true
                }.Start();
            }
        }
Beispiel #15
0
        /// <summary>
        /// Adds Models data to collection if such exists, otherwise creates a new one.
        /// </summary>
        public static void ProcessModels(ActionType action, Document doc, string centralPath)
        {
            var data = new DataRangeRequest(centralPath.ToLower())
            {
                From = null, To = null
            };

            switch (action)
            {
            case ActionType.CheckIn:
                if (!ServerUtilities.Post(data, "model/getmodelsdata", out List <ModelStats> mData) || mData == null)
                {
                    Log.AppendLog(LogMessageType.ERROR, "Failed to get Model Stats.");
                    return;
                }
                if (mData.Any())
                {
                    if (MissionControlSetup.ModelsData.ContainsKey(centralPath))
                    {
                        MissionControlSetup.ModelsData.Remove(centralPath);
                    }
                    MissionControlSetup.ModelsData.Add(centralPath, mData.First());     // store model record

                    Messenger.Default.Send(new HealthReportSummaryAdded {
                        Data = mData.First(), Type = SummaryType.Models
                    });

                    new Thread(() => new ModelMonitor().PublishModelSize(doc, centralPath, doc.Application.VersionNumber))
                    {
                        Priority     = ThreadPriority.BelowNormal,
                        IsBackground = true
                    }.Start();

                    if (AppCommand.OpenTime.ContainsKey("from"))
                    {
                        new Thread(() => new ModelMonitor().PublishOpenTime(centralPath))
                        {
                            Priority     = ThreadPriority.BelowNormal,
                            IsBackground = true
                        }.Start();
                    }
                }
                break;

            case ActionType.Synch:
                if (AppCommand.SynchTime.ContainsKey("from"))
                {
                    new Thread(() => new ModelMonitor().PublishSynchTime(centralPath))
                    {
                        Priority     = ThreadPriority.BelowNormal,
                        IsBackground = true
                    }.Start();
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }
        }
Beispiel #16
0
        /// <summary>
        /// Adds Sheets data to collection if such exists, otherwise creates a new one.
        /// </summary>
        public static void ProcessSheets(ActionType action, Document doc, string centralPath)
        {
            var project = MissionControlSetup.Projects[centralPath];

            switch (action)
            {
            case ActionType.CheckIn:
                if (!ServerUtilities.GetByCentralPath(centralPath, "sheets/centralpath", out SheetData sData))
                {
                    if (ServerUtilities.Post(new SheetData {
                        CentralPath = centralPath.ToLower()
                    }, "sheets", out sData))
                    {
                        ServerUtilities.Put(new { id = sData.Id }, "projects/" + project.Id + "/addsheet");

                        if (MissionControlSetup.SheetsData.ContainsKey(centralPath))
                        {
                            MissionControlSetup.SheetsData.Remove(centralPath);
                        }
                        MissionControlSetup.SheetsData.Add(centralPath, sData);     // store sheets record
                    }
                }
                if (sData != null)
                {
                    if (MissionControlSetup.SheetsData.ContainsKey(centralPath))
                    {
                        MissionControlSetup.SheetsData.Remove(centralPath);
                    }
                    MissionControlSetup.SheetsData.Add(centralPath, sData);     // store sheets record

                    Messenger.Default.Send(new CommunicatorDataDownloaded
                    {
                        CentralPath = centralPath,
                        Type        = DataType.Sheets
                    });

                    new Thread(() => new SheetTracker.SheetTracker().SynchSheets(doc))
                    {
                        Priority     = ThreadPriority.BelowNormal,
                        IsBackground = true
                    }.Start();
                }
                break;

            case ActionType.Synch:
                if (MissionControlSetup.SheetsData.ContainsKey(centralPath))
                {
                    new Thread(() => new SheetTracker.SheetTracker().SynchSheets(doc))
                    {
                        Priority     = ThreadPriority.BelowNormal,
                        IsBackground = true
                    }.Start();
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }
        }
Beispiel #17
0
 public void CanGetTcpChannelOnUnspecifiedPort()
 {
     channel1 = ServerUtilities.GetTcpChannel("test", 0);
     Assert.AreEqual("test", channel1.ChannelName);
     channel2 = ServerUtilities.GetTcpChannel("test", 0);
     Assert.AreEqual("test", channel2.ChannelName);
     Assert.AreEqual(channel1, channel2);
     Assert.AreSame(channel1, channel2);
 }
Beispiel #18
0
 public void CanConnect()
 {
     using (TestServer server = new TestServer("TestServer", 9000))
     {
         server.Start();
         object obj = Activator.GetObject(typeof(TestRunner), ServerUtilities.MakeUrl("TestServer", 9000));
         Assert.IsNotNull(obj, "Unable to connect");
     }
 }
        public void CanGetTcpChannelOnSpecifiedPortPUT3([PexAssumeUnderTest] String name, int port)
        {
            PexAssume.IsFalse(name.Equals(""));
            //PexAssume.IsTrue(port > 1000 && port < 5000);
            TcpChannel       chan1   = ServerUtilities.GetTcpChannel(name, port);
            ChannelDataStore cds     = (ChannelDataStore)chan1.ChannelData;
            String           uriInfo = "tcp://127.0.0.1:" + port;

            PexAssert.AreEqual(uriInfo, cds.ChannelUris[0]);
        }
Beispiel #20
0
        public ActionResult CheckOneServer(string IP)
        {
            var loggedUser = UsersUtilities.GetLoggedUser();

            if (loggedUser == null)
            {
                return(Redirect("~/User/Login"));
            }
            return(Json(ServerUtilities.CheckServer(loggedUser, IP), JsonRequestBehavior.AllowGet));
        }
        public void setUp()
        {
            Task <bool> IsAvailable = ServerUtilities.IsElasticServerAvailable();

            IsAvailable.Wait();
            if (!IsAvailable.Result)
            {
                throw new Exception("No elastic server to test on");
            }
        }
Beispiel #22
0
        public void GetTcpChannel()
        {
            Hashtable props = new Hashtable();

            props.Add("port", 0);
            props.Add("name", channelName);
            IChannel channel = ServerUtilities.GetTcpChannel(props);

            Assert.AreEqual(channelName, channel.ChannelName);
        }
        protected void TeleportPlayersIn()
        {
            SavePlayersPosition();
            for (int i = 0; i < GameModeData.CurrentPlayers.Count; i++)
            {
                Client player = GameModeData.CurrentPlayers[i];


                GamePosition randomSpawn = GetRandomSpawnPosition();
                ServerUtilities.SpawnPlayer(player, randomSpawn);
            }
        }
 //An exception is thrown when the channel is null or re-registered.
 //It is very difficult to get the exception thrown here....
 public void CanGetTcpChannelOnSpecifiedPortPUT2(String name, int port)
 {
     try
     {
         TcpChannel channel1 = ServerUtilities.GetTcpChannel(name, port);
         TcpChannel channel2 = ServerUtilities.GetTcpChannel(name, port);
     }
     catch (Exception e)
     {
         throw new PexGoalException(e.Message);
     }
 }
Beispiel #25
0
        /// <summary>
        /// Adds Worksets data to collection if such exists, otherwise creates a new one.
        /// </summary>
        public static void ProcessWorksets(ActionType action, Document doc, string centralPath)
        {
            var data = new DataRangeRequest(centralPath.ToLower())
            {
                From = null, To = null
            };

            switch (action)
            {
            case ActionType.CheckIn:
                if (!ServerUtilities.Post(data, "worksets/getworksetsdata", out List <WorksetStats> wData))
                {
                    Log.AppendLog(LogMessageType.ERROR, "Failed to get Workset Stats.");
                    return;
                }
                if (wData != null && wData.Any())
                {
                    if (MissionControlSetup.WorksetsData.ContainsKey(centralPath))
                    {
                        MissionControlSetup.WorksetsData.Remove(centralPath);
                    }
                    MissionControlSetup.WorksetsData.Add(centralPath, wData.First());     // store workset record

                    Messenger.Default.Send(new HealthReportSummaryAdded {
                        Data = wData.First(), Type = SummaryType.Worksets
                    });

                    new Thread(() => new WorksetItemCount().PublishData(doc, centralPath))
                    {
                        Priority     = ThreadPriority.BelowNormal,
                        IsBackground = true
                    }.Start();

                    new Thread(() => new WorksetOpenSynch().PublishData(doc, centralPath, WorksetMonitorState.onopened))
                    {
                        Priority     = ThreadPriority.BelowNormal,
                        IsBackground = true
                    }.Start();
                }
                break;

            case ActionType.Synch:
                new Thread(() => new WorksetOpenSynch().PublishData(doc, centralPath, WorksetMonitorState.onsynched))
                {
                    Priority     = ThreadPriority.BelowNormal,
                    IsBackground = true
                }.Start();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }
        }
Beispiel #26
0
        public void CanGetTcpChannelOnSpecifiedPort()
        {
            channel1 = ServerUtilities.GetTcpChannel("test", 1234);
            Assert.AreEqual("test", channel1.ChannelName);
            channel2 = ServerUtilities.GetTcpChannel("test", 4321);
            Assert.AreEqual("test", channel2.ChannelName);
            Assert.AreEqual(channel1, channel2);
            Assert.AreSame(channel1, channel2);
            ChannelDataStore cds = (ChannelDataStore)channel1.ChannelData;

            Assert.AreEqual("tcp://127.0.0.1:1234", cds.ChannelUris[0]);
        }
        public void OnPlayerDeath(Client client, Client killer, uint reason)
        {
            PlayerTempData playerTempData = client.GetData(PlayerTempData.PLAYER_TEMP_DATA_KEY);

            if (playerTempData.GamemodeId.HasValue)
            {
                GameModeHandler.Instance.OnDeath(client, killer, reason);
                return;
            }

            ServerUtilities.SpawnPlayerAfter(client);
        }
Beispiel #28
0
        /// <summary>
        /// Get all the unanswered questions and wrap them into a MatchQuestionModelRequest.
        /// </summary>
        /// <param name="list">A list of ChatbotNewQuestionModels to process.</param>
        /// <returns>A MatchQuestionModelRequest containing all the answered questions from the forum.</returns>
        public static MatchQuestionModelRequest GenerateModelCompareToOpenQuestions(NewQuestion newQuestion)
        {
            MatchQuestionModelRequest mqmr = new MatchQuestionModelRequest();

            List <DBQuestion> result  = new List <DBQuestion>();
            DBManager         manager = new DBManager(true);

            StringBuilder sb = new StringBuilder();

            sb.Append("SELECT * ");
            sb.Append("FROM Questions q ");
            sb.Append("WHERE q.answer_id IS NOT NULL; ");
            String sqlCommand = sb.ToString();

            var reader = manager.Read(sqlCommand);

            while (reader.Read())
            {
                DBQuestion answer = new DBQuestion();
                answer.Question_id = (int)reader["question_id"];
                answer.Question    = (String)reader["question"];
                answer.Answer_id   = (int)reader["answer_id"];

                /****/
                answer.Question = ServerUtilities.SQLSafeToUserInput(answer.Question);
                /****/

                result.Add(answer);
            }
            manager.Close();                                //IMPORTANT! Should happen automatically, but better safe than sorry.

            mqmr.action      = "MATCH_QUESTIONS".ToLower(); //Standard
            mqmr.question    = newQuestion.question;
            mqmr.question_id = -1;                          // This id does not exist at this point

            List <NLPQuestionModelInfo> comparisonQuestions = new List <NLPQuestionModelInfo>();

            for (int i = 0; i < result.Count; i++)
            {
                comparisonQuestions.Add(new NLPQuestionModelInfo()
                {
                    question = result[i].Question, question_id = result[i].Question_id
                });
            }
            mqmr.compare_questions = comparisonQuestions.ToArray();


            mqmr.msg_id = ClusterConnector.ServerUtilities.getAndGenerateMsgIDOpenQuestions(newQuestion.chatbot_temp_id, newQuestion.question, newQuestion.user_id);

            return(mqmr);
        }
        private void TeleportPlayerOut(Client client)
        {
            int clientIndex = GameModeData.CurrentPlayers.IndexOf(client);

            if (clientIndex > -1)
            {
                GamePosition position = GameModeData.PlayerPositions[clientIndex];
                ServerUtilities.SpawnPlayer(client, position);

                PlayerTempData playerTempData = client.GetData(PlayerTempData.PLAYER_TEMP_DATA_KEY);
                playerTempData.GamemodeId = null;
                client.SetData(PlayerTempData.PLAYER_TEMP_DATA_KEY, playerTempData);
                OnResetPlayerState(client, clientIndex);
            }
        }
Beispiel #30
0
        protected override void OnPlayerDeath(Client client, Client killer, uint reason)
        {
            GamePosition randomSpawn = GetRandomSpawnPosition();

            var killerIndex = Data.CurrentPlayers.IndexOf(killer);

            if (killerIndex != -1)
            {
                Data.TotalKills[killerIndex]++;
            }

            ServerUtilities.SpawnPlayerAfter(client, randomSpawn, callback: () =>
            {
                GiveWeaponToPlayer(client);
            });
        }