Skip to content

Commit

Permalink
feat: added send to chat, readded missing effect-control
Browse files Browse the repository at this point in the history
  • Loading branch information
spyrella committed Oct 13, 2024
1 parent f3b6fc9 commit 208e12c
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lang/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@
"Miss": "未命中",
"SettingsSave": "保存更改",
"SettingsReset": "重置更改",
"ChatMessageSend": "Send",
"ChatMessageSendHint": "Send to chat",
"ChatMessageShow": "永远显示",
"ChatMessageClicked": "隐藏直到被点击",
"ChatMessageHide": "隐藏",
Expand Down
2 changes: 2 additions & 0 deletions lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@
"Miss": "Verfehlt",
"SettingsSave": "Speichern",
"SettingsReset": "Zurücksetzen",
"ChatMessageSend": "Send",
"ChatMessageSendHint": "Send to chat",
"ChatMessageShow": "Anzeigen",
"ChatMessageClicked": "Versteckt bis Angeklickt",
"ChatMessageHide": "Verstecken",
Expand Down
2 changes: 2 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@
"Miss": "Miss",
"SettingsSave": "Save Changes",
"SettingsReset": "Reset Changes",
"ChatMessageSend": "Send",
"ChatMessageSendHint": "Send to chat",
"ChatMessageShow": "Show",
"ChatMessageClicked": "Hide until clicked",
"ChatMessageHide": "Hide",
Expand Down
2 changes: 2 additions & 0 deletions lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@
"Miss": "Fallo",
"SettingsSave": "Guardar cambios",
"SettingsReset": "Resetear cambios",
"ChatMessageSend": "Send",
"ChatMessageSendHint": "Send to chat",
"ChatMessageShow": "Mostrar",
"ChatMessageClicked": "Ocultar hasta hacer clic",
"ChatMessageHide": "Ocultar",
Expand Down
2 changes: 2 additions & 0 deletions lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@
"Miss": "Raté",
"SettingsSave": "Sauvegarder les modifications",
"SettingsReset": "Remise à zéro des modifications",
"ChatMessageSend": "Send",
"ChatMessageSendHint": "Send to chat",
"ChatMessageShow": "Afficher",
"ChatMessageClicked": "Masquer jusqu'à ce que l'on clique",
"ChatMessageHide": "Masquer",
Expand Down
2 changes: 2 additions & 0 deletions lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@
"Miss": "Mancato",
"SettingsSave": "Salva modifiche",
"SettingsReset": "Reset modifiche",
"ChatMessageSend": "Send",
"ChatMessageSendHint": "Send to chat",
"ChatMessageShow": "Mostra",
"ChatMessageClicked": "Nascondi finché non cliccato",
"ChatMessageHide": "Nascondi",
Expand Down
2 changes: 2 additions & 0 deletions lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@
"Miss": "Pudło",
"SettingsSave": "Zapisz Zmiany",
"SettingsReset": "Resetuj Zmiany",
"ChatMessageSend": "Send",
"ChatMessageSendHint": "Send to chat",
"ChatMessageShow": "Zawsze pokazuj",
"ChatMessageClicked": "Ukryj do kliknięcia",
"ChatMessageHide": "Ukryj",
Expand Down
2 changes: 2 additions & 0 deletions lang/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@
"Miss": "Erro",
"SettingsSave": "Salvar Alterações",
"SettingsReset": "Resetar Alterações",
"ChatMessageSend": "Send",
"ChatMessageSendHint": "Send to chat",
"ChatMessageShow": "Mostrar",
"ChatMessageClicked": "Ocultaraté ser clicado",
"ChatMessageHide": "Ocultar",
Expand Down
2 changes: 2 additions & 0 deletions lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@
"Miss": "Промах",
"SettingsSave": "Сохранить изменения",
"SettingsReset": "Сбросить изменения",
"ChatMessageSend": "Send",
"ChatMessageSendHint": "Send to chat",
"ChatMessageShow": "Всегда показывать",
"ChatMessageClicked": "Скрыть до клика",
"ChatMessageHide": "Скрыть",
Expand Down
1 change: 1 addition & 0 deletions module/sheets/actor-standard-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ export class FUStandardActorSheet extends ActorSheet {
html.on('mouseup', '.effect', this._onMiddleClickEditEffect.bind(this)); // Middle-click to edit effect
html.on('click', '.effect-roll', (ev) => onManageActiveEffect(ev, this.actor)); // Send active effect to chat
html.on('click', '.study-button', async () => await new StudyRollHandler().handleStudyRoll(this.actor)); // Handle study roll
html.find('.effect-control').click((ev) => onManageActiveEffect(ev, this.actor)); // Active Effect management

// -------------------------------------------------------------
// Everything below here is only needed if the sheet is editable
Expand Down
35 changes: 35 additions & 0 deletions module/sheets/item-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,39 @@ export class FUItemSheet extends ItemSheet {
}
return data;
}

_getHeaderButtons() {
return [
{
label: 'Send',
class: 'send-to-chat',
icon: 'fas fa-comment',
onclick: this._onSendToChat.bind(this),
},
...super._getHeaderButtons(),
];
}

_onSendToChat(event) {
event.preventDefault();
const item = this.item;
ChatMessage.create({
user: game.user.id,
speaker: ChatMessage.getSpeaker(),
content: `
<div class="chat-item-message">
<header class="title-desc chat-header flexrow">
<img src="${item.img}" alt="Image" data-item-id="${item.id}" class="item-img">
<h2>${item.name}</h2>
</header>
<div class="chat-desc">
<div>${item.system.description || game.i18n.localize('FU.NoItem')}</div><hr>
<a class="content-link" draggable="true" data-uuid="Item.${item.id}" data-id="${item.id}" data-type="Item" data-tooltip="${item.name}">
<i class="fas fa-suitcase"></i> ${item.name}
</a>
</div>
</div>
`,
});
}
}

0 comments on commit 208e12c

Please sign in to comment.