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:
parent
ab9f86d7a6
commit
e71dfb4ec3
1 changed files with 29 additions and 0 deletions
|
|
@ -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(chatBtn);
|
||||||
buttonsContainer.appendChild(statsBtn);
|
buttonsContainer.appendChild(statsBtn);
|
||||||
buttonsContainer.appendChild(inventoryBtn);
|
buttonsContainer.appendChild(inventoryBtn);
|
||||||
|
buttonsContainer.appendChild(charBtn);
|
||||||
li.appendChild(buttonsContainer);
|
li.appendChild(buttonsContainer);
|
||||||
|
|
||||||
// Store references for easy access
|
// Store references for easy access
|
||||||
|
|
@ -169,6 +181,7 @@ function createNewListItem() {
|
||||||
li.chatBtn = chatBtn;
|
li.chatBtn = chatBtn;
|
||||||
li.statsBtn = statsBtn;
|
li.statsBtn = statsBtn;
|
||||||
li.inventoryBtn = inventoryBtn;
|
li.inventoryBtn = inventoryBtn;
|
||||||
|
li.charBtn = charBtn;
|
||||||
|
|
||||||
return li;
|
return li;
|
||||||
}
|
}
|
||||||
|
|
@ -1075,6 +1088,22 @@ function showInventoryWindow(name) {
|
||||||
debugLog('Inventory window created for:', 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
|
// Inventory tooltip functions
|
||||||
let inventoryTooltip = null;
|
let inventoryTooltip = null;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue