Add Char button to player list with stub character window

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
erik 2026-02-26 15:07:37 +00:00
parent ab9f86d7a6
commit e71dfb4ec3

View file

@ -159,9 +159,21 @@ function createNewListItem() {
}
});
const charBtn = document.createElement('button');
charBtn.className = 'char-btn';
charBtn.textContent = 'Char';
charBtn.addEventListener('click', (e) => {
e.stopPropagation();
const playerData = e.currentTarget.playerData || e.target.closest('li.player-item')?.playerData;
if (playerData) {
showCharacterWindow(playerData.character_name);
}
});
buttonsContainer.appendChild(chatBtn);
buttonsContainer.appendChild(statsBtn);
buttonsContainer.appendChild(inventoryBtn);
buttonsContainer.appendChild(charBtn);
li.appendChild(buttonsContainer);
// Store references for easy access
@ -169,6 +181,7 @@ function createNewListItem() {
li.chatBtn = chatBtn;
li.statsBtn = statsBtn;
li.inventoryBtn = inventoryBtn;
li.charBtn = charBtn;
return li;
}
@ -1075,6 +1088,22 @@ function showInventoryWindow(name) {
debugLog('Inventory window created for:', name);
}
function showCharacterWindow(name) {
debugLog('showCharacterWindow called for:', name);
const windowId = `characterWindow-${name}`;
const { win, content, isNew } = createWindow(
windowId, `Character: ${name}`, 'character-window'
);
if (!isNew) {
debugLog('Existing character window found, showing it');
return;
}
content.innerHTML = '<div style="padding: 20px; color: #c8b89a;">Awaiting character data...</div>';
}
// Inventory tooltip functions
let inventoryTooltip = null;