Player Preference - Censored Words

This commit is contained in:
BondageProjects 2022-11-22 17:15:04 -05:00
parent 65741c7d64
commit 6cbebf584d
4 changed files with 118 additions and 10 deletions
BondageClub

Binary file not shown.

After

(image error) Size: 12 KiB

View file

@ -4,7 +4,7 @@ var PreferenceMessage = "";
var PreferenceSafewordConfirm = false;
var PreferenceColorPick = "";
var PreferenceSubscreen = "";
var PreferenceSubscreenList = ["General", "Difficulty", "Restriction", "Chat", "Audio", "Arousal", "Security", "Online", "Visibility", "Immersion", "Graphics", "Controller", "Notifications", "Gender"];
var PreferenceSubscreenList = ["General", "Difficulty", "Restriction", "Chat", "CensoredWords", "Audio", "Arousal", "Security", "Online", "Visibility", "Immersion", "Graphics", "Controller", "Notifications", "Gender"];
var PreferencePageCurrent = 1;
var PreferenceChatColorThemeList = ["Light", "Dark", "Light2", "Dark2"];
var PreferenceChatColorThemeIndex = 0;
@ -62,6 +62,8 @@ var PreferenceGraphicsPowerModeIndex = null;
var PreferenceGraphicsWebGLOptions = null;
var PreferenceGraphicsAnimationQualityList = [10000, 2000, 200, 100, 50, 0];
var PreferenceCalibrationStage = 0;
var PreferenceCensoredWordsList = [];
var PreferenceCensoredWordsOffset = 0;
/**
* An object defining which genders a setting is active for
@ -371,6 +373,8 @@ function PreferenceInitPlayer() {
if (typeof C.ChatSettings.ShowChatHelp !== "boolean") C.ChatSettings.ShowChatHelp = true;
if (typeof C.ChatSettings.ShrinkNonDialogue !== "boolean") C.ChatSettings.ShrinkNonDialogue = false;
if (typeof C.ChatSettings.WhiteSpace !== "string") C.ChatSettings.WhiteSpace = "Preserve";
if (typeof C.ChatSettings.CensoredWordsList !== "string") C.ChatSettings.CensoredWordsList = "";
if (typeof C.ChatSettings.CensoredWordsLevel !== "number") C.ChatSettings.CensoredWordsLevel = 0;
// Visual settings
// @ts-ignore: Individual properties validated separately
@ -700,6 +704,12 @@ function PreferenceLoad() {
PreferenceGraphicsAnimationQualityIndex = (PreferenceGraphicsAnimationQualityList.indexOf(Player.GraphicsSettings.AnimationQuality) < 0) ? 0 : PreferenceGraphicsAnimationQualityList.indexOf(Player.GraphicsSettings.AnimationQuality);
PreferenceGraphicsWebGLOptions = GLDrawGetOptions();
PreferenceGraphicsPowerModeIndex = (PreferenceGraphicsPowerModes.indexOf(PreferenceGraphicsWebGLOptions.powerPreference) < 0) ? 0 : PreferenceGraphicsPowerModes.indexOf(PreferenceGraphicsWebGLOptions.powerPreference);
// Prepares the censored words list
PreferenceCensoredWordsOffset = 0;
PreferenceCensoredWordsList = [];
if ((Player.ChatSettings.CensoredWordsList != null) && (Player.ChatSettings.CensoredWordsList != "")) PreferenceCensoredWordsList = Player.ChatSettings.CensoredWordsList.split("|");
}
/**
@ -1151,8 +1161,7 @@ function PreferenceSubscreenAudioRun() {
}
/**
* Sets the audio preferences for the player. Redirected to from the main Run function if the player is in the audio
* settings subscreen
* Sets the controller preferences for the player. Redirected to from the main Run function.
* @returns {void} - Nothing
*/
function PreferenceSubscreenControllerRun() {
@ -1223,6 +1232,34 @@ function PreferenceSubscreenControllerRun() {
MainCanvas.textAlign = "center";
}
/**
* Sets the censored words for the player. Redirected to from the main Run function.
* @returns {void} - Nothing
*/
function PreferenceSubscreenCensoredWordsRun() {
// Draw the header
DrawText(TextGet("CensorTitle"), 930, 105, "Black", "Silver");
DrawButton(1830, 60, 90, 90, "", "White", "Icons/Exit.png", TextGet("CensorExit"));
DrawText(TextGet("CensorLevel"), 200, 205, "Black", "Silver");
DrawButton(350, 175, 550, 60, TextGet("CensorLevel" + Player.ChatSettings.CensoredWordsLevel), "White");
DrawText(TextGet("CensorWord"), 1080, 205, "Black", "Silver");
ElementPosition("InputWord", 1385, 200, 300);
DrawButton(1550, 175, 180, 60, TextGet("CensorAdd"), "White");
if (PreferenceCensoredWordsList.length > 32) DrawButton(1830, 175, 90, 90, "", "White", "Icons/Next.png");
// List all words with a delete button
MainCanvas.textAlign = "left";
for (let O = PreferenceCensoredWordsOffset; O < PreferenceCensoredWordsList.length && O < PreferenceCensoredWordsOffset + 32; O++) {
let X = 100 + Math.floor((O - PreferenceCensoredWordsOffset)/ 8) * 450;
let Y = 270 + ((O % 8) * 84);
DrawButton(X, Y, 60, 60, "", "White", "Icons/Small/Remove.png");
DrawText(PreferenceCensoredWordsList[O], X + 100, Y + 30, "Black", "Gray");
}
MainCanvas.textAlign = "center";
}
/**
* Sets the chat preferences for the player. Redirected to from the main Run function if the player is in the chat
* settings subscreen.
@ -1634,7 +1671,7 @@ function PreferenceSubscreenAudioExit() {
}
/**
* Handles click events for the audio preference settings. Redirected from the main Click function.
* Handles click events for the controller preference settings. Redirected from the main Click function.
* @returns {void} - Nothing
*/
function PreferenceSubscreenControllerClick() {
@ -1673,6 +1710,47 @@ function PreferenceSubscreenControllerClick() {
}
}
/**
* Handles click events for the censored words preference settings. Redirected from the main Click function.
* @returns {void} - Nothing
*/
function PreferenceSubscreenCensoredWordsClick() {
// When the user clicks on the header buttons
if (MouseIn(1830, 60, 250, 65)) PreferenceSubscreenCensoredWordsExit();
if (MouseIn(1550, 175, 180, 60)) {
let Word = ElementValue("InputWord").trim().toUpperCase().replace("|", "");
if ((Word != "") && (PreferenceCensoredWordsList.indexOf(Word) < 0)) {
PreferenceCensoredWordsList.push(Word);
PreferenceCensoredWordsList.sort();
ElementValue("InputWord", "");
}
return;
}
if (MouseIn(350, 175, 550, 60)) {
Player.ChatSettings.CensoredWordsLevel++;
if (Player.ChatSettings.CensoredWordsLevel > 2) Player.ChatSettings.CensoredWordsLevel = 0;
return;
}
if (MouseIn(1830, 175, 250, 65)) {
PreferenceCensoredWordsOffset = PreferenceCensoredWordsOffset + 32;
if (PreferenceCensoredWordsOffset >= PreferenceCensoredWordsList.length) PreferenceCensoredWordsOffset = 0;
return;
}
// When the user clicks to delete one of the words
for (let O = PreferenceCensoredWordsOffset; O < PreferenceCensoredWordsList.length && O < PreferenceCensoredWordsOffset + 32; O++) {
let X = 100 + Math.floor((O - PreferenceCensoredWordsOffset)/ 8) * 450;
let Y = 270 + ((O % 8) * 84);
if (MouseIn(X, Y, 60, 60)) {
PreferenceCensoredWordsList.splice(O, 1);
if (PreferenceCensoredWordsOffset >= PreferenceCensoredWordsList.length) PreferenceCensoredWordsOffset = 0;
return;
}
}
}
/**
* Handles the click events for the chat settings of a player. Redirected from the main Click function.
* @returns {void} - Nothing
@ -2118,7 +2196,7 @@ function PreferenceSubscreenDifficultyExit() {
}
/**
* Loads the Preferences screen.
* Loads the preference security screen.
* @returns {void} - Nothing
*/
function PreferenceSubscreenSecurityLoad() {
@ -2127,6 +2205,15 @@ function PreferenceSubscreenSecurityLoad() {
ServerSend("AccountQuery", { Query: "EmailStatus" });
}
/**
* Loads the preference censored words screen.
* @returns {void} - Nothing
*/
function PreferenceSubscreenCensoredWordsLoad() {
PreferenceCensoredWordsOffset = 0;
ElementCreateInput("InputWord", "text", "", "50");
}
/**
* Get the sensory deprivation setting for the player
* @returns {boolean} - Return true if sensory deprivation is active, false otherwise
@ -2351,6 +2438,16 @@ function PreferenceSubscreenControllerExit() {
Calibrating = false;
}
/**
* Exits the preference screen
* @returns {void} - Nothing
*/
function PreferenceSubscreenCensoredWordsExit() {
ElementRemove("InputWord");
Player.ChatSettings.CensoredWordsList = PreferenceCensoredWordsList.join("|");
PreferenceSubscreen = "";
}
/**
* Exits the preference screen
* @returns {void} - Nothing

View file

@ -17,6 +17,7 @@ HomepageGeneral,General
HomepageDifficulty,Difficulty
HomepageRestriction,Restriction
HomepageChat,Chat
HomepageCensoredWords,Censored Words
HomepageAudio,Audio
HomepageArousal,Arousal
HomepageSecurity,Security
@ -81,8 +82,8 @@ ErrorInvalidColor,Put a valid hex #red-green-blue color
ColorTheme,Color theme:
Light,Light
Dark,Dark
Light2, Light 2,
Dark2,Dark 2,
Light2, Light 2
Dark2,Dark 2
EnterLeaveStyle,Enter/Leave message style:
Normal,Normal
Smaller,Smaller
@ -134,7 +135,7 @@ SensDepExtreme,Total
DoBlindFlash,Flash after blindness
SmoothZoom,Zoom chatrooms smoothly
CenterChatrooms,Center players in chatrooms
AllowPlayerLeashing,"Players can drag you to rooms when leashed"
AllowPlayerLeashing,Players can drag you to rooms when leashed
DisableAutoMaid,Maids come automatically when restrained
DisablePickingLocksOnSelf,Locks on you can't be picked
BlindDisableExamine,Disable examining when blind
@ -331,5 +332,13 @@ AllowTints,Allow item tint effects
AllowBlur,Allow item blur effects (turn off if experiencing frame rate drops)
GenderFemales,Females
GenderMales,Males
GenderAutoJoinSearch,"Automatically enter the chatroom area for: "
GenderHideShopItems,"Hide shop items exclusively for: "
GenderAutoJoinSearch,Automatically enter the chatroom area for:
GenderHideShopItems,Hide shop items exclusively for:
CensorExit,Apply the censoring
CensorTitle,Select the censorship to apply and the words to censor in both the chat and room labels.
CensorLevel,Censorship:
CensorLevel0,Replace the word by ***
CensorLevel1,Replace the phrase by ***
CensorLevel2,Hide the phrase or room
CensorWord,Censored words:
CensorAdd,Add

Can't render this file because it has a wrong number of fields in line 84.

View file

@ -1283,6 +1283,8 @@ interface PlayerCharacter extends Character {
DisableAnimations?: any;
/** @deprecated */
SearchShowsFullRooms?: any;
CensoredWordsList: string;
CensoredWordsLevel: number;
};
VisualSettings?: {
ForceFullHeight?: boolean;