Пример #1
0
        void BpReset(BasePlayer player, string[] args, ConsoleSystem.Arg arg = null)
        {
            if (!CheckAccess(player, _authLevel, arg))
            {
                return;
            }
            Puts("{0} used /bpreset {1}", player?.displayName, string.Join(" ", args));
            var targetPlayer = player;

            if (args != null && args.Length > 0)
            {
                if (!CheckAccess(player, _authLevelOther, arg))
                {
                    return;
                }
                targetPlayer = FindPlayer(args[0]);
            }
            if (targetPlayer == null)
            {
                Reply(player, arg, "Player not found: {0}", args != null && args.Length > 0 ? args[0] : "unknown");
                return;
            }
            var data = ServerMgr.Instance.persistance.GetPlayerInfo(targetPlayer.userID);

            data.blueprints = null;
            PlayerBlueprints.InitializePersistance(data);
            ServerMgr.Instance.persistance.SetPlayerInfo(targetPlayer.userID, data);
            targetPlayer.SendFullSnapshot();
            SendReply(targetPlayer, "You forgot all blueprints");
            if (targetPlayer != player)
            {
                Reply(player, arg, "{0} forgot all blueprints", targetPlayer.displayName);
            }
        }
Пример #2
0
        void cmdChatBpReset(BasePlayer player, string command, string[] args)
        {
            if (!CheckAccess(player, _authLevel))
            {
                return;
            }
            LocalPuts(string.Format("{0} used /bpreset {1}", player.displayName, string.Join(" ", args)));
            var targetPlayer = player;

            if (args != null && args.Length > 0)
            {
                if (!CheckAccess(player, _authLevelOther))
                {
                    return;
                }
                targetPlayer = BasePlayer.Find(args[0]);
                if (targetPlayer == null)
                {
                    SendReply(player, string.Format("Player not found: {0}", args[0]));
                    return;
                }
            }
            var data = Persistence.GetPlayerInfo(targetPlayer.userID);

            data.blueprints = null;
            PlayerBlueprints.InitializePersistance(data);
            targetPlayer.SendFullSnapshot();
            SendReply(targetPlayer, "You forgot all blueprints");
            if (targetPlayer != player)
            {
                SendReply(player, string.Format("{0} forgot all blueprints", targetPlayer.displayName));
            }
        }
Пример #3
0
        private void CheckBlueprints(BasePlayer player)
        {
            if (player.net == null)
            {
                return;
            }

            if (player.net.connection == null)
            {
                return;
            }

            if (SingletonComponent <ServerMgr> .Instance == null)
            {
                return;
            }

            if (SingletonComponent <ServerMgr> .Instance.persistance == null)
            {
                return;
            }

            bool removed = false;

            ProtoBuf.PersistantPlayer persistentPlayer = SingletonComponent <ServerMgr> .Instance.persistance.GetPlayerInfo(player.userID);

            if (persistentPlayer is ProtoBuf.PersistantPlayer)
            {
                foreach (string blocked in this.blockList)
                {
                    ItemDefinition item = ItemManager.FindItemDefinition(blocked);
                    if (item is ItemDefinition && persistentPlayer.blueprints is ProtoBuf.BlueprintList && persistentPlayer.blueprints.complete is List <int> && persistentPlayer.blueprints.complete.Contains(item.itemid))
                    {
                        persistentPlayer.blueprints.complete.Remove(item.itemid);
                        removed = true;
                    }
                }

                if (removed)
                {
                    PlayerBlueprints.InitializePersistance(persistentPlayer);
                    SingletonComponent <ServerMgr> .Instance.persistance.SetPlayerInfo(player.userID, persistentPlayer);

                    player.SendFullSnapshot();
                }
            }
        }