コード例 #1
0
ファイル: Synapse.cs プロジェクト: dcsobral/BadCompanySM
        public static void DeadIsDead(ClientInfo cInfo)
        {
            var synapse = Brain.GetSynapse("deadisdead");

            if (synapse == null || !synapse.IsEnabled)
            {
                return;
            }

            var neuron = synapse.GetNeurons().OfType <DeadIsDead>().FirstOrDefault();

            if (neuron == null)
            {
                Log.Out($"{Config.ModPrefix} Unable to load neuron for dead is dead mode");

                return;
            }
            if (neuron.GlobalMode || neuron.DiDModePlayers.Contains(cInfo.playerId))
            {
                Log.Out($"{Config.ModPrefix} Player kicked and archived for DiD mode: {cInfo.playerId}/{neuron.BackupAndDelete(cInfo.playerId)} - {cInfo.playerName}");
            }
        }
コード例 #2
0
ファイル: Synapse.cs プロジェクト: dcsobral/BadCompanySM
        public static void PlayerTracker(ClientInfo cInfo, RespawnType respawnReason, bool create = true)
        {
            var synapse = Brain.GetSynapse("tracker");

            if (synapse == null || !synapse.IsEnabled)
            {
                return;
            }

            var world = GameManager.Instance.World;

            if (world == null)
            {
                return;
            }

            var playerlog = PersistentContainer.Instance.PlayerLogs[cInfo.playerId, create];

            if (playerlog == null)
            {
                return;
            }

            var ts = $"{DateTime.UtcNow:yyyy-MM-dd_HH_mm_ss.fffZ}";

            if (world.Players.dict.ContainsKey(cInfo.entityId))
            {
                var ep = world.Players.dict[cInfo.entityId];
                if (!playerlog.LogDataCache.ContainsKey(ts) && ep != null)
                {
                    playerlog.LogDataCache.Add(ts,
                                               new LogData(new BCMVector4(ep.position, (int)Math.Floor(ep.rotation.y)),
                                                           $"{(respawnReason == RespawnType.Unknown ? "DISCONNECT" : $"SPAWN: {respawnReason}")}"));
                }
            }
            PersistentContainer.Instance.Save("logs");
        }