예제 #1
0
        private bool ServerRemote_SetDescription(string text)
        {
            text = text?.Trim() ?? string.Empty;
            text = SharedTextHelper.TrimSpacesOnEachLine(text);

            if (text.Length > MaxDescriptionLength)
            {
                throw new Exception("Max description length exceeded");
            }

            text = ProfanityFilteringSystem.SharedApplyFilters(text);
            Api.Server.Core.DescriptionMessageText = serverDescriptionText = text;

            Logger.Important("Server description message changed to:"
                             + Environment.NewLine
                             + text.Replace("[br]", Environment.NewLine + "[br]"));
            return(true);
        }
예제 #2
0
        private void ServerRemote_OfficerSetDescription(string text, bool isPrivateDescription)
        {
            text = text?.Trim() ?? string.Empty;
            text = SharedTextHelper.TrimSpacesOnEachLine(text);

            var officer = ServerRemoteContext.Character;

            ServerValidateHasAccessRights(officer,
                                          FactionMemberAccessRights.EditDescription,
                                          out var faction);

            text = ProfanityFilteringSystem.SharedApplyFilters(text);
            SharedValidateDescriptionLength(text, isPrivateDescription);

            var privateState = Faction.GetPrivateState(faction);

            if (isPrivateDescription)
            {
                if (privateState.DescriptionPrivate == text)
                {
                    return;
                }

                privateState.DescriptionPrivate = text;
            }
            else
            {
                if (privateState.DescriptionPublic == text)
                {
                    return;
                }

                privateState.DescriptionPublic = text;
            }

            ServerAddLogEntry(faction, new FactionLogEntryDescriptionChanged(officer));
        }