Merge branch 'beta' into 'master'

BETA: Fix the likes of the `/eyes` chat command failing to properly open the expression self menu

See merge request 
This commit is contained in:
BondageProjects 2025-04-14 15:35:09 +00:00
commit 7d6d86f897
5 changed files with 27 additions and 17 deletions
BondageClub

View file

@ -1566,9 +1566,10 @@ function ChatRoomDrawCharacterStatusIcons(C, CharX, CharY, Zoom)
/**
* Select the character (open dialog) and clear other chatroom displays.
* @param {Character} C - The character to focus on. Does nothing if null.
* @param {null | { mode?: DialogMenuMode, selfMode?: DialogSelfMenuName }} options - The type of dialog- and dialog-self subscreen te open
* @returns {void} - Nothing
*/
function ChatRoomFocusCharacter(C) {
function ChatRoomFocusCharacter(C, options=null) {
if (ChatRoomOwnerPresenceRule("BlockAccessSelf", C)) return;
if (ChatRoomOwnerPresenceRule("BlockAccessOther", C)) return;
if (C == null) return;
@ -1579,7 +1580,7 @@ function ChatRoomFocusCharacter(C) {
ChatRoomLovershipOption = "";
if (!C.IsPlayer()) ServerSend("ChatRoomAllowItem", { MemberNumber: C.MemberNumber });
if (C.IsOwnedByPlayer() || C.IsLoverOfPlayer()) ServerSend("ChatRoomChat", { Content: "RuleInfoGet", Type: "Hidden", Target: C.MemberNumber });
CharacterSetCurrent(C);
CharacterSetCurrent(C, options);
}
/**

View file

@ -855,8 +855,7 @@ const CommonCommands = [
Tag: 'expr',
Action: args => {
if (args.trim() == "") {
ChatRoomFocusCharacter(Player);
DialogFindSubMenu("SavedExpressions");
ChatRoomFocusCharacter(Player, { selfMode: "SavedExpressions" });
} else if (/^[0-5]$/.test(args)) {
let ExprNum = parseInt(args);
if (ExprNum == 0) {
@ -871,8 +870,7 @@ const CommonCommands = [
Tag: 'blush',
Action: args => {
if (args.trim() == "") {
ChatRoomFocusCharacter(Player);
DialogFindSubMenu("Expression");
ChatRoomFocusCharacter(Player, { selfMode: "Expression" });
DialogFindFacialExpressionMenuGroup("Blush");
return;
}
@ -921,8 +919,7 @@ const CommonCommands = [
Tag: 'eyes',
Action: args => {
if (args.trim() == "") {
ChatRoomFocusCharacter(Player);
DialogFindSubMenu("Expression");
ChatRoomFocusCharacter(Player, { selfMode: "Expression" });
DialogFindFacialExpressionMenuGroup("Eyes");
return;
}

View file

@ -1431,10 +1431,18 @@ function CharacterLoadCanvasAll() {
* Sets the current character to have a dialog with.
*
* @param {Character} C - Character to have a conversation with
* @param {null | { mode?: DialogMenuMode, selfMode?: DialogSelfMenuName }} options - The type of dialog- and dialog-self subscreen te open
* @returns {void} - Nothing
*/
function CharacterSetCurrent(C) {
function CharacterSetCurrent(C, options=null) {
options ??= {};
CurrentCharacter = C;
if (options.mode) {
DialogMenuMode = options.mode;
}
if (options.selfMode) {
DialogSelfMenuSelected = options.selfMode;
}
DialogLoad();
}

View file

@ -2082,9 +2082,11 @@ function DialogChangeMode(mode, reset=false) {
DialogExpressionPreviousMode = { mode: DialogMenuMode, group: C.FocusGroup };
}
DialogMenuMapping[DialogMenuMode]?.Unload();
const modeChange = DialogMenuMode !== mode || reset;
DialogMenuMode = mode;
if (DialogMenuMode !== mode) {
DialogMenuMapping[DialogMenuMode]?.Unload();
DialogMenuMode = mode;
}
switch (DialogMenuMode) {
case "activities":
@ -2374,12 +2376,12 @@ function DialogFindSubMenu(MenuName, force=false) {
* @returns {boolean} True, when the expression group was found and opened. False otherwise and nothing happens.
*/
function DialogFindFacialExpressionMenuGroup(ExpressionGroup) {
if (DialogSelfMenuSelected !== "Expression" && !DialogSelfMenuMapping.Expression.Init({ C: Player })) {
if (DialogSelfMenuSelected !== "Expression") {
return false;
}
const ids = DialogSelfMenuMapping.Expression.ids;
const button = /** @type {null | HTMLButtonElement} */(document.querySelector(`${ids.menuLeft} > [name="${ExpressionGroup}"]`));
const button = /** @type {null | HTMLButtonElement} */(document.querySelector(`#${ids.menuLeft} > [name="${ExpressionGroup}"]`));
if (!button) {
return false;
} else if (button.getAttribute("aria-checked") === "false") {
@ -4273,8 +4275,10 @@ class _DialogSelfMenu extends DialogMenu {
/** @type {DialogMenu<ModeType, T, { C: PlayerCharacter }>["Init"]} */
Init(parameters, style) {
DialogSelfMenuMapping[DialogSelfMenuSelected]?.Unload();
DialogSelfMenuSelected = this.mode;
if (DialogSelfMenuSelected !== this.mode) {
DialogSelfMenuMapping[DialogSelfMenuSelected]?.Unload();
DialogSelfMenuSelected = this.mode;
}
const ret = super.Init(parameters, style);
this.Resize(true);
return ret;
@ -5473,7 +5477,7 @@ function DialogLoad() {
}
if (C.IsPlayer()) {
DialogSelfMenuMapping.Expression.Init({ C });
DialogSelfMenuMapping[DialogSelfMenuSelected ?? "Expression"]?.Init({ C });
}
DialogChangeMode(DialogMenuMode ?? "dialog", true);
}

View file

@ -1,4 +1,4 @@
namespace Platform {
export namespace Platform {
type Perk = string;