Gender preferences added. Chat Select code touchups

This commit is contained in:
Nina-1474 2022-09-19 01:40:18 +01:00
parent 7f81963ba1
commit 850c43c912
11 changed files with 193 additions and 30 deletions
BondageClub
Icons
Screens
Character
Online
ChatRoom
ChatSelect
Room
MainHall
Shop
Scripts
index.html

Binary file not shown.

After

(image error) Size: 1.7 KiB

View file

@ -637,6 +637,7 @@ function LoginResponse(C) {
Player.OnlineSharedSettings = C.OnlineSharedSettings;
Player.GraphicsSettings = C.GraphicsSettings;
Player.NotificationSettings = C.NotificationSettings;
Player.GenderSettings = C.GenderSettings;
Player.SavedExpressions = C.SavedExpressions;
if (!Array.isArray(Player.SavedExpressions)) {
Player.SavedExpressions = [];

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"];
var PreferenceSubscreenList = ["General", "Difficulty", "Restriction", "Chat", "Audio", "Arousal", "Security", "Online", "Visibility", "Immersion", "Graphics", "Controller", "Notifications", "Gender"];
var PreferencePageCurrent = 1;
var PreferenceChatColorThemeList = ["Light", "Dark", "Light2", "Dark2"];
var PreferenceChatColorThemeIndex = 0;
@ -63,6 +63,14 @@ var PreferenceGraphicsWebGLOptions = null;
var PreferenceGraphicsAnimationQualityList = [10000, 2000, 200, 100, 50, 0];
var PreferenceCalibrationStage = 0;
/**
* An object defining which genders a setting is active for
* @typedef {object} GenderSetting
* @property {boolean} Female - Whether the setting is active for female cases
* @property {boolean} Male - Whether the setting is active for male cases
* @property {boolean} MutuallyExclusive - Whether the setting can only be enabled for one gender
*/
/**
* Compares the arousal preference level and returns TRUE if that level is met, or an higher level is met
* @param {Character} C - The player who performs the sexual activity
@ -334,6 +342,7 @@ function PreferenceInitPlayer() {
OnlineSharedSettings: JSON.stringify(C.OnlineSharedSettings) || "",
GraphicsSettings: JSON.stringify(C.GraphicsSettings) || "",
NotificationSettings: JSON.stringify(C.NotificationSettings) || "",
GenderSettings: JSON.stringify(C.GenderSettings) || "",
};
// Non-player specific settings
@ -449,7 +458,7 @@ function PreferenceInitPlayer() {
if (!C.LastChatRoomAdmin) C.LastChatRoomAdmin = [];
if (!C.LastChatRoomBan) C.LastChatRoomBan = [];
if (!C.LastChatRoomBlockCategory) C.LastChatRoomBlockCategory = [];
if (typeof C.LastChatRoomSpace !== "string") C.LastChatRoomSpace = "";
if (typeof C.LastChatRoomSpace !== "string") C.LastChatRoomSpace = ChatRoomSpaceType.MIXED;
// Restriction settings
// @ts-ignore: Individual properties validated separately
@ -542,6 +551,12 @@ function PreferenceInitPlayer() {
if (typeof NS.Test !== "object") NS.Test = PreferenceInitNotificationSetting(NS.Test, defaultAudio, NotificationAlertType.TITLEPREFIX);
C.NotificationSettings = NS;
// Graphical settings
// @ts-ignore: Individual properties validated separately
if (!C.GenderSettings) C.GenderSettings = {};
if (typeof C.GenderSettings.AutoJoinSearch !== "object") C.GenderSettings.AutoJoinSearch = PreferenceInitGenderSetting(false);
if (typeof C.GenderSettings.HideShopItems !== "object") C.GenderSettings.HideShopItems = PreferenceInitGenderSetting(false);
// Forces some preferences depending on difficulty
// Difficulty: non-Roleplay settings
@ -607,6 +622,19 @@ function PreferenceInitNotificationSetting(setting, audio, defaultAlertType) {
return setting;
}
/**
* Initialise a Gender setting
* @param {boolean} mutuallyExclusive - Whether the setting can only be enabled for one gender
* @returns {GenderSetting} - The setting to use
*/
function PreferenceInitGenderSetting(mutuallyExclusive) {
let setting = {};
setting.Female = false;
setting.Male = false;
setting.MutuallyExclusive = mutuallyExclusive;
return setting;
}
/**
* Migrates a named preference from one preference object to another if not already migrated
* @param {object} from - The preference object to migrate from
@ -1093,6 +1121,7 @@ function PreferenceExit() {
OnlineSharedSettings: Player.OnlineSharedSettings,
GraphicsSettings: Player.GraphicsSettings,
NotificationSettings: Player.NotificationSettings,
GenderSettings: Player.GenderSettings,
ItemPermission: Player.ItemPermission,
LabelColor: Player.LabelColor,
LimitedItems: CommonPackItemArray(Player.LimitedItems),
@ -1450,6 +1479,42 @@ function PreferenceSubscreenGraphicsRun() {
}
}
/**
* Sets the gender preferences for a player. Redirected to from the main Run function if the player is in the
* gender settings subscreen
* @returns {void} - Nothing
*/
function PreferenceSubscreenGenderRun() {
// Character and exit buttons
DrawCharacter(Player, 50, 50, 0.9);
DrawButton(1815, 75, 90, 90, "", "White", "Icons/Exit.png");
MainCanvas.textAlign = "left";
DrawText(TextGet("GenderPreferences"), 500, 125, "Black", "Gray");
DrawText(TextGet("GenderFemales"), 1410, 160, "Black", "Gray");
DrawText(TextGet("GenderMales"), 1590, 160, "Black", "Gray");
PreferenceGenderDrawSetting(500, 225, TextGet("GenderAutoJoinSearch"), Player.GenderSettings.AutoJoinSearch);
PreferenceGenderDrawSetting(500, 305, TextGet("GenderHideShopItems"), Player.GenderSettings.HideShopItems);
MainCanvas.textAlign = "center";
}
/**
* Draws the two checkbox row for a gender setting
* @param {number} Left - The X co-ordinate the row starts on
* @param {number} Top - The Y co-ordinate the row starts on
* @param {string} Text - The text for the setting's description
* @param {GenderSetting} Setting - The player setting the row corresponds to
* @returns {void} - Nothing
*/
function PreferenceGenderDrawSetting(Left, Top, Text, Setting) {
DrawText(Text, Left, Top, "Black", "Gray");
DrawCheckbox(Left + 950, Top - 32, 64, 64, "", Setting.Female);
DrawCheckbox(Left + 950 + 155, Top - 32, 64, 64, "", Setting.Male);
}
/**
* Handles click events for the audio preference settings. Redirected from the main Click function.
* @returns {void} - Nothing
@ -1816,6 +1881,40 @@ function PreferenceSubscreenSecurityClick() {
}
/**
* Handles the click events for the notifications settings of a player. Redirected from the main Click function.
* @returns {void} - Nothing
*/
function PreferenceSubscreenGenderClick() {
if (MouseIn(1815, 75, 90, 90)) PreferenceSubscreen = "";
PreferenceGenderClickSetting(1450, 225, Player.GenderSettings.AutoJoinSearch);
PreferenceGenderClickSetting(1450, 305, Player.GenderSettings.HideShopItems);
}
/**
* Handles the click for a gender setting row
* @param {number} Left - The X co-ordinate the row starts on
* @param {number} Top - The Y co-ordinate the row starts on
* @param {GenderSetting} Setting - The player setting the row corresponds to
* @returns {void} - Nothing
*/
function PreferenceGenderClickSetting(Left, Top, Setting) {
if (MouseIn(Left, Top - 32, 64, 64)) {
Setting.Female = !Setting.Female;
if (Setting.MutuallyExclusive && Setting.Female) {
Setting.Male = false;
}
}
if (MouseIn(Left + 155, Top - 32, 64, 64)) {
Setting.Male = !Setting.Male;
if (Setting.MutuallyExclusive && Setting.Male) {
Setting.Female = false;
}
}
}
/**
* Handles the click events for the visibility settings of a player. Redirected from the main Click function.
* @returns {void} - Nothing

View file

@ -12,6 +12,7 @@ OnlinePreferences,- Online Preferences -
ImmersionPreferences,- Immersion Preferences -
ControllerPreferences,- Controller Preferences -
NotificationsPreferences,- Notification Preferences -
GenderPreferences,- Gender Preferences -
HomepageGeneral,General
HomepageDifficulty,Difficulty
HomepageRestriction,Restriction
@ -25,6 +26,7 @@ HomepageImmersion,Immersion
HomepageGraphics,Graphics
HomepageController,Controller
HomepageNotifications,Notifications
HomepageGender,Gender
DifficultyTitle,The difficulty mode enforces BDSM restrictions in multi-player only. Click for details.
DifficultyLevel0,Roleplay
Difficulty0Text0,Roleplay - This mode is fully open to customise your experience.
@ -327,3 +329,7 @@ NotificationsTestMessage,Hello there!
Page,Page
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: "

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

View file

@ -1,4 +1,17 @@
"use strict";
/**
* An enum for the options for chat room spaces
* @readonly
* @enum {string}
*/
const ChatRoomSpaceType = {
MIXED: "",
FEMALE_ONLY: "F",
MALE_ONLY: "M",
ASYLUM: "Asylum",
};
var ChatRoomBackground = "";
/** @type {ChatRoom} */
let ChatRoomData = {};
@ -13,7 +26,7 @@ var ChatRoomLovershipOption = "";
var ChatRoomPlayerCanJoin = false;
var ChatRoomMoneyForOwner = 0;
var ChatRoomQuestGiven = [];
var ChatRoomSpace = "";
var ChatRoomSpace = ChatRoomSpaceType.MIXED;
var ChatRoomGame = "";
var ChatRoomMoveTarget = null;
var ChatRoomHelpSeen = false;
@ -115,6 +128,7 @@ const ChatRoomArousalMsg_ChanceGagMod = {
"StruggleAction" : 0,
"Gag" : 0.3,
};
var ChatRoomHideIconState = 0;
var ChatRoomMenuButtons = [];
let ChatRoomFontSize = 30;
@ -717,7 +731,7 @@ function ChatRoomClearAllElements() {
/**
* Starts the chatroom selection screen.
* @param {string} Space - Name of the chatroom space
* @param {ChatRoomSpaceType} Space - Name of the chatroom space
* @param {string} Game - Name of the chatroom game to play
* @param {string} LeaveRoom - Name of the room to go back to when exiting chatsearch.
* @param {string} LeaveSpace - Name of the space to go back to when exiting chatsearch.
@ -726,10 +740,21 @@ function ChatRoomClearAllElements() {
* @returns {void} - Nothing.
*/
function ChatRoomStart(Space, Game, LeaveRoom, LeaveSpace, Background, BackgroundTagList) {
if (!LeaveRoom || !LeaveSpace) {
if (Player.GenderSettings.AutoJoinSearch.Female || Player.GenderSettings.AutoJoinSearch.Male) {
ChatSearchLeaveRoom = "MainHall";
ChatSearchLeaveSpace = "Room";
} else {
ChatSearchLeaveRoom = "ChatSelect";
ChatSearchLeaveSpace = "Online";
}
} else {
ChatSearchLeaveRoom = LeaveRoom;
ChatSearchLeaveSpace = LeaveSpace;
}
ChatRoomSpace = Space;
ChatRoomGame = Game;
ChatSearchLeaveRoom = LeaveRoom;
ChatSearchLeaveSpace = LeaveSpace;
ChatSearchBackground = Background;
ChatCreateBackgroundList = BackgroundsGenerateList(BackgroundTagList);
BackgroundSelectionTagList = BackgroundTagList;

View file

@ -3,6 +3,10 @@ var ChatSelectBackground = "BrickWall";
var ChatSelectAllowedInFemaleOnly;
var ChatSelectAllowedInMaleOnly;
/**
* Runs the chatroom search select screen
* @returns {void} - Nothing
*/
function ChatSelectRun() {
//top-right menu buttons
DrawButton(1895, 215, 90, 90, "", "White", "Icons/Character.png");
@ -28,31 +32,51 @@ function ChatSelectRun() {
DrawImage("Screens/Online/ChatSelect/Male.png", 650, 810);
}
/**
* Handles clicks on the chat select screen
* @returns {void} - Nothing
*/
function ChatSelectClick() {
if (MouseIn(1895, 215, 90, 90)) InformationSheetLoadCharacter(Player);
if (MouseIn(1895, 15, 90, 90)) ChatSelectExit();
if (MouseIn(1895, 115, 90, 90) && Player.CanChangeOwnClothes()) CharacterAppearanceLoadCharacter(Player);
if (MouseIn(100, 45, 510, 125) && ChatSelectAllowedInFemaleOnly) ChatSelectStartFemaleChat();
if (MouseIn(100, 420, 510, 125)) ChatSelectStartMixedChat();
if (MouseIn(100, 800, 510, 125) && ChatSelectAllowedInMaleOnly) ChatSelectStartMaleChat();
if (MouseIn(100, 45, 510, 125) && ChatSelectAllowedInFemaleOnly) {
ChatSelectStartSearch(ChatRoomSpaceType.FEMALE_ONLY);
}
if (MouseIn(100, 420, 510, 125)) {
ChatSelectStartSearch(ChatRoomSpaceType.MIXED);
}
if (MouseIn(100, 800, 510, 125) && ChatSelectAllowedInMaleOnly) {
ChatSelectStartSearch(ChatRoomSpaceType.MALE_ONLY);
}
}
/**
* Loads the chat select screen, automatically joining a chat search space if configured
* @returns {void} - Nothing
*/
function ChatSelectLoad() {
const autoJoinSpace = Player.GenderSettings.AutoJoinSearch.Female
? Player.GenderSettings.AutoJoinSearch.Male ? ChatRoomSpaceType.MIXED : ChatRoomSpaceType.FEMALE_ONLY
: Player.GenderSettings.AutoJoinSearch.Male ? ChatRoomSpaceType.MALE_ONLY : null;
if (autoJoinSpace != null) {
ChatSelectStartSearch(autoJoinSpace);
return;
}
const playerGenders = Player.GetGenders();
ChatSelectAllowedInFemaleOnly = ChatSelectGendersAllowed("FemaleOnly", playerGenders);
ChatSelectAllowedInMaleOnly = ChatSelectGendersAllowed("MaleOnly", playerGenders);
ChatSelectAllowedInFemaleOnly = ChatSelectGendersAllowed(ChatRoomSpaceType.FEMALE_ONLY, playerGenders);
ChatSelectAllowedInMaleOnly = ChatSelectGendersAllowed(ChatRoomSpaceType.MALE_ONLY, playerGenders);
}
function ChatSelectStartFemaleChat () {
ChatRoomStart("FemaleOnly", "", "ChatSelect", "Online", "Introduction", BackgroundsTagList);
}
function ChatSelectStartMixedChat () {
ChatRoomStart("", "", "ChatSelect", "Online", "Introduction", BackgroundsTagList);
}
function ChatSelectStartMaleChat () {
ChatRoomStart("MaleOnly", "", "ChatSelect", "Online", "Introduction", BackgroundsTagList);
/**
* Start the chat search screen for the relevant chat room space
* @param {ChatRoomSpaceType} space - The space to join
*/
function ChatSelectStartSearch(space) {
ChatRoomStart(space, "", null, null, "Introduction", BackgroundsTagList);
}
function ChatSelectExit() {
@ -66,6 +90,6 @@ function ChatSelectExit() {
* @returns {boolean} - Whether the genders are allowed
*/
function ChatSelectGendersAllowed(space, genders) {
return !(space == "MaleOnly" && genders.includes("F"))
&& !(space == "FemaleOnly" && genders.includes("M"));
return !(space == ChatRoomSpaceType.MALE_ONLY && genders.includes("F"))
&& !(space == ChatRoomSpaceType.FEMALE_ONLY && genders.includes("M"));
}

View file

@ -163,7 +163,7 @@ function MainHallRun() {
if (Player.ImmersionSettings && Player.LastChatRoom && (Player.LastChatRoom != "") && (AsylumGGTSGetLevel(Player) <= 5) && ((MainHallMaid === null) || (MainHallMaid.Stage === "0"))) {
if (MainHallFirstFrame) {
if (Player.ImmersionSettings.ReturnToChatRoom) {
ChatRoomStart(Player.LastChatRoomSpace, "", "MainHall", "Room", "Introduction", BackgroundsTagList);
ChatRoomStart(Player.LastChatRoomSpace, "", null, null, "Introduction", BackgroundsTagList);
return;
} else ChatRoomSetLastChatRoom("");
} else MainHallFirstFrame = true;

View file

@ -145,7 +145,13 @@ function ShopRun() {
* @returns {boolean} - Returns TRUE if the item is purchasable and part of the focus group.
*/
function ShopAssetFocusGroup(Asset) {
return (Asset != null) && (Asset.Group != null) && (Asset.Value > 0) && (Asset.Group.Name == ShopVendor.FocusGroup.Name) && (ShopBuyMode || ShopCanSell(Asset));
return (Asset != null)
&& (Asset.Group != null)
&& (Asset.Value > 0)
&& (Asset.Group.Name == ShopVendor.FocusGroup.Name)
&& (ShopBuyMode || ShopCanSell(Asset))
&& !(ShopBuyMode && Player.GenderSettings.HideShopItems.Female && Asset.Gender == "F")
&& !(ShopBuyMode && Player.GenderSettings.HideShopItems.Male && Asset.Gender == "M");
}
/**
@ -465,4 +471,4 @@ function ShopJobFilterAvailableGroups() {
*/
function ShopJobCanGoAgain() {
return Player.CanInteract() && ShopJobFilterAvailableGroups().length > 0;
}
}

View file

@ -639,7 +639,7 @@ function ServerAccountBeep(data) {
ServerSend("ChatRoomLeave", "");
CommonSetScreen("Online", "ChatSearch");
}
else ChatRoomStart(data.ChatRoomSpace, "", "MainHall", "Room", "Introduction", BackgroundsTagList); //CommonSetScreen("Room", "ChatSearch")
else ChatRoomStart(data.ChatRoomSpace, "", null, null, "Introduction", BackgroundsTagList); //CommonSetScreen("Room", "ChatSearch")
} else {
ChatRoomLeashPlayer = null;
}

View file

@ -1086,7 +1086,7 @@ interface PlayerCharacter extends Character {
LastChatRoomBan?: any[];
LastChatRoomBlockCategory?: string[];
LastChatRoomTimer?: any;
LastChatRoomSpace?: string;
LastChatRoomSpace?: ChatRoomSpaceType;
RestrictionSettings?: {
BypassStruggle: boolean;
SlowImmunity: boolean;
@ -1150,6 +1150,10 @@ interface PlayerCharacter extends Character {
FriendNames?: Map<number, string>;
SubmissivesList?: Set<number>;
ChatSearchFilterTerms?: string;
GenderSettings: {
HideShopItems: GenderSetting;
AutoJoinSearch: GenderSetting;
};
}
/** Pandora Player extension */

View file

@ -244,8 +244,6 @@
<script src="Screens/Inventory/HairAccessory3/Halo/Halo.js"></script>
<script src="Screens/Inventory/HairAccessory1/Halo/Halo.js"></script>
<script src="Screens/Inventory/ItemArms/TransportJacket/TransportJacket.js"></script>
<script src="Screens/Inventory/Pronouns/HeHim/HeHim.js"></script>
<script src="Screens/Inventory/Pronouns/SheHer/SheHer.js"></script>
<script src="Screens/MiniGame/KinkyDungeon/KinkyDungeon.js"></script>
<script src="Screens/MiniGame/KinkyDungeon/KinkyDungeonGame.js"></script>
<script src="Screens/MiniGame/KinkyDungeon/KinkyDungeonVibe.js"></script>