public string Execute(bool isEnabled, [CurrentCharacterIfNull] ICharacter character)
        {
            if (isEnabled)
            {
                NewbieProtectionSystem.ServerRegisterNewbie(character);
            }
            else
            {
                NewbieProtectionSystem.ServerDisableNewbieProtection(character);
            }

            return(character
                   + " is now "
                   + (NewbieProtectionSystem.SharedIsNewbie(character)
                          ? "under newbie protection."
                          : "without newbie protection."));
        }
Esempio n. 2
0
        protected override void ServerInitializeCharacterFirstTime(ServerInitializeData data)
        {
            base.ServerInitializeCharacterFirstTime(data);

            var character   = data.GameObject;
            var publicState = data.PublicState;

            if (!Api.IsEditor)
            {
                NewbieProtectionSystem.ServerRegisterNewbie(character);

                publicState.IsMale    = 1 == RandomHelper.Next(0, maxValueExclusive: 2); // male/female ratio: 50/50
                publicState.FaceStyle = SharedCharacterFaceStylesProvider
                                        .GetForGender(publicState.IsMale)
                                        .GenerateRandomFace();
            }
            else // if Editor
            {
                publicState.IsMale    = true;
                publicState.FaceStyle = SharedCharacterFaceStylesProvider
                                        .GetForGender(publicState.IsMale)
                                        .GetDefaultFaceInEditor();
            }

            ServerPlayerSpawnManager.ServerAddTorchItemIfNoItems(character);

            if (!Api.IsEditor)
            {
                return;
            }

            // the game is run as Editor
            // auto pwn in editor mode
            ConsoleCommandsSystem.SharedGetCommand <ConsoleAdminPwn>().Execute(player: character);
            // add all the skills
            ConsoleCommandsSystem.SharedGetCommand <ConsoleSkillsSetAll>().Execute(player: character);
            // add all the technologies
            ConsoleCommandsSystem.SharedGetCommand <ConsoleTechAddAll>().Execute(player: character);

            this.ServerRebuildFinalCacheIfNeeded(data.PrivateState, publicState);

            // add all the quests (and complete them)
            ConsoleCommandsSystem.SharedGetCommand <ConsoleQuestCompleteAll>().Execute(player: character);
        }
Esempio n. 3
0
        protected override void ServerInitializeCharacterFirstTime(ServerInitializeData data)
        {
            base.ServerInitializeCharacterFirstTime(data);

            var character   = data.GameObject;
            var publicState = data.PublicState;

            if (!Api.IsEditor)
            {
                NewbieProtectionSystem.ServerRegisterNewbie(character);
            }

            publicState.IsMale    = true;
            publicState.FaceStyle = SharedCharacterFaceStylesProvider
                                    .GetForGender(publicState.IsMale)
                                    .GenerateRandomFace();

            ServerPlayerSpawnManager.ServerAddTorchItemIfNoItems(character);

            if (!Api.IsEditor)
            {
                return;
            }

            // the game is run as Editor
            // auto pwn in editor mode
            GetProtoEntity <ConsoleAdminPwn>().Execute(player: character);
            // add all the skills
            GetProtoEntity <ConsoleSkillsSetAll>().Execute(player: character);
            // add all the technologies
            GetProtoEntity <ConsoleTechAddAll>().Execute(player: character);

            this.ServerRebuildFinalCacheIfNeeded(data.PrivateState, publicState);

            // add all the quests (and complete them)
            GetProtoEntity <ConsoleQuestCompleteAll>().Execute(player: character);
        }