Skip to content

Commit 9fab424

Browse files
authored
v0.2.1 (#1)
* Fully prepared module for translation - all strings should be translatable * Added scroll for overflowing quest's description * Added toggle between Actor's/Token's image for Quest Giver's image * Added failed state for tasks * Translated to Polish
1 parent e20cb3e commit 9fab424

18 files changed

+260
-53
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# FoundryVTT - Forien's Quest Log
2-
**[Current version]**: v0.2.0
2+
**[Current version]**: v0.2.1
33
**[Compatibility]**: *FoundryVTT* 0.6.0+
44

55
This module provides Quest Log system for players and Game Masters to use with Foundry Virtual Table Top

changelog.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# Changelog
22

33
## v0.X.X
4-
### v0.1.X
4+
### v0.2.X
5+
6+
#### v0.2.1
7+
* Fully prepared module for translation - all strings should be translatable
8+
* Added scroll for overflowing quest's description
9+
* Added toggle between Actor's/Token's image for Quest Giver's image
10+
* Added failed state for tasks
11+
* Translated to Polish
512

613
#### v0.2.0
714
* Initial release

lang/en.json

+33-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
"ForienQuestLog.Details": "Details",
88
"ForienQuestLog.GMNotes": "GM Notes",
9+
"ForienQuestLog.NewQuest": "New Quest",
910

1011
"ForienQuestLog.Notifications.QuestMoved": "Moved quest to new folder and gave it new status: {target}",
1112

1213
"ForienQuestLog.Buttons.AddNewQuest": "Add new Quest",
14+
"ForienQuestLog.Buttons.AddNewTask": "add new",
1315

1416
"ForienQuestLog.QuestTypes.InProgress": "Active",
1517
"ForienQuestLog.QuestTypes.Completed": "Completed",
@@ -20,11 +22,41 @@
2022
"ForienQuestLog.QuestName": "Title",
2123
"ForienQuestLog.QuestTasks": "Tasks",
2224
"ForienQuestLog.Actions": "Actions",
25+
"ForienQuestLog.Objectives": "Objectives",
26+
"ForienQuestLog.Rewards": "Rewards",
2327

2428
"ForienQuestLog.showTasks.Enable": "Show tasks in Quest Log",
2529
"ForienQuestLog.showTasks.EnableHint": "Decide if or how to show amount of Tasks (objectives) next to Quest's title in Quest Log. This has no effect on Quest individual preview.",
2630

2731
"ForienQuestLog.showTasks.default": "Show tasks: done/total",
2832
"ForienQuestLog.showTasks.onlyCurrent": "Show tasks: done",
29-
"ForienQuestLog.showTasks.no": "Hide \"tasks\" column"
33+
"ForienQuestLog.showTasks.no": "Hide \"tasks\" column",
34+
35+
"ForienQuestLog.QuestLogButton": "Quest Log",
36+
"ForienQuestLog.QuestForm.Title": "Add new Quest",
37+
"ForienQuestLog.QuestLog.Title": "Quest Log",
38+
"ForienQuestLog.QuestPreview.Title": "Quest Details",
39+
40+
"ForienQuestLog.QuestForm.QuestGiver": "Quest giver",
41+
"ForienQuestLog.QuestForm.QuestGiverPlaceholder": "Actor's name or ID",
42+
"ForienQuestLog.QuestForm.QuestTitle": "Quest's title",
43+
"ForienQuestLog.QuestForm.QuestDescription": "Quest description",
44+
"ForienQuestLog.QuestForm.QuestGMNotes": "GM notes",
45+
"ForienQuestLog.QuestForm.Submit": "Submit",
46+
47+
"ForienQuestLog.SampleTask": "f.e. Kill all rats in „The Twisted Ankle” inn",
48+
"ForienQuestLog.DragDropRewards": "Drag & drop items here to add them as rewards",
49+
50+
"ForienQuestLog.DeleteDialog.Title": "Delete {name}",
51+
"ForienQuestLog.DeleteDialog.Header": "Are you sure?",
52+
"ForienQuestLog.DeleteDialog.Body": "This quest and its data will be permanently deleted.",
53+
"ForienQuestLog.DeleteDialog.Delete": "Delete",
54+
"ForienQuestLog.DeleteDialog.Cancel": "Cancel",
55+
56+
"ForienQuestLog.Tooltips.ToggleImage": "Toggle token/actor image",
57+
"ForienQuestLog.Tooltips.SetActive": "Set as In Progress",
58+
"ForienQuestLog.Tooltips.SetCompleted": "Set as Completed",
59+
"ForienQuestLog.Tooltips.SetFailed": "Set as Failed",
60+
"ForienQuestLog.Tooltips.Hide": "Hide",
61+
"ForienQuestLog.Tooltips.Delete": "Delete"
3062
}

lang/pl.json

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"ForienQuestLog.InProgress": "W trakcie",
3+
"ForienQuestLog.Completed": "Zakończone",
4+
"ForienQuestLog.Failed": "Nieudane",
5+
"ForienQuestLog.Hidden": "Ukryte",
6+
7+
"ForienQuestLog.Details": "Szczegóły",
8+
"ForienQuestLog.GMNotes": "Notatki MG",
9+
"ForienQuestLog.NewQuest": "Nowa misja",
10+
11+
"ForienQuestLog.Notifications.QuestMoved": "Przeniesiono misję do nowego folderu, a jej nowy status to: {target}",
12+
13+
"ForienQuestLog.Buttons.AddNewQuest": "Dodaj nową misję",
14+
"ForienQuestLog.Buttons.AddNewTask": "dodaj",
15+
16+
"ForienQuestLog.QuestTypes.InProgress": "Aktywne",
17+
"ForienQuestLog.QuestTypes.Completed": "Zakończone",
18+
"ForienQuestLog.QuestTypes.Failed": "Nieudane",
19+
"ForienQuestLog.QuestTypes.Hidden": "Ukryte",
20+
"ForienQuestLog.Quests": "Misje",
21+
"ForienQuestLog.QuestGiver": "Zleceniodawca",
22+
"ForienQuestLog.QuestName": "Tytuł",
23+
"ForienQuestLog.QuestTasks": "Zadania",
24+
"ForienQuestLog.Actions": "Akcje",
25+
"ForienQuestLog.Objectives": "Zadania",
26+
"ForienQuestLog.Rewards": "Nagrody",
27+
28+
"ForienQuestLog.showTasks.Enable": "Pokaż zadania w Dzienniku",
29+
"ForienQuestLog.showTasks.EnableHint": "Zdecyduj czy, i w jaki sposób wyświetlać ilość Zadań obok tytułu Misji w Dzienniku Misji. Nie wpływa na widoczność Zadań na ekranie podglądu Misji.",
30+
31+
"ForienQuestLog.showTasks.default": "Pokaż zadania: wykonane/wszystkie",
32+
"ForienQuestLog.showTasks.onlyCurrent": "Pokaż zadania: wykonane",
33+
"ForienQuestLog.showTasks.no": "Ukryj kolumnę zadań",
34+
35+
"ForienQuestLog.QuestLogButton": "Dziennik",
36+
"ForienQuestLog.QuestForm.Title": "Stwórz nową Misję",
37+
"ForienQuestLog.QuestLog.Title": "Dziennik Misji",
38+
"ForienQuestLog.QuestPreview.Title": "Podgląd Misji",
39+
40+
"ForienQuestLog.QuestForm.QuestGiver": "Zleceniodawca",
41+
"ForienQuestLog.QuestForm.QuestGiverPlaceholder": "Imię lub ID Aktora",
42+
"ForienQuestLog.QuestForm.QuestTitle": "Tytuł misji",
43+
"ForienQuestLog.QuestForm.QuestDescription": "Opis misji",
44+
"ForienQuestLog.QuestForm.QuestGMNotes": "Notatki MG",
45+
"ForienQuestLog.QuestForm.Submit": "Zapisz",
46+
47+
"ForienQuestLog.SampleTask": "np. Zabij wszystkie szczury w karczmie „Pod Skręconą Kostką”",
48+
"ForienQuestLog.DragDropRewards": "Kliknij i Przeciągnij przedmioty w to miejsce, aby dodać je jako nagrody",
49+
50+
"ForienQuestLog.DeleteDialog.Title": "Usuń {name}",
51+
"ForienQuestLog.DeleteDialog.Header": "Na pewno?",
52+
"ForienQuestLog.DeleteDialog.Body": "Ta misja i związane z nią dane zostaną utracone na stałe.",
53+
"ForienQuestLog.DeleteDialog.Delete": "Usuń",
54+
"ForienQuestLog.DeleteDialog.Cancel": "Anuluj",
55+
56+
"ForienQuestLog.Tooltips.ToggleImage": "Przełącz obraz Aktora/Tokenu",
57+
"ForienQuestLog.Tooltips.SetActive": "Ustaw na Aktywną",
58+
"ForienQuestLog.Tooltips.SetCompleted": "Ustaw jako Zakończoną",
59+
"ForienQuestLog.Tooltips.SetFailed": "Ustaw jako Nieudaną",
60+
"ForienQuestLog.Tooltips.Hide": "Ukryj",
61+
"ForienQuestLog.Tooltips.Delete": "Usuń"
62+
}

module.json

+9-4
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,25 @@
99
"url": "https://www.patreon.com/forien"
1010
}
1111
],
12-
"version": "0.2.0",
12+
"version": "0.2.1",
1313
"minimumCoreVersion": "0.6.0",
1414
"compatibleCoreVersion": "0.6.2",
1515
"url": "https://github.com/Forien/forien-quest-log",
1616
"manifest": "https://raw.githubusercontent.com/Forien/foundryvtt-forien-quest-log/master/module.json",
17-
"download": "https://github.com/Forien/foundryvtt-forien-quest-log/archive/v0.2.0.zip",
18-
"readme": "https://github.com/Forien/foundryvtt-forien-quest-log/blob/v0.2.0/README.md",
19-
"changelog": "https://github.com/Forien/foundryvtt-forien-quest-log/blob/v0.2.0/changelog.md",
17+
"download": "https://github.com/Forien/foundryvtt-forien-quest-log/archive/v0.2.1.zip",
18+
"readme": "https://github.com/Forien/foundryvtt-forien-quest-log/blob/v0.2.1/README.md",
19+
"changelog": "https://github.com/Forien/foundryvtt-forien-quest-log/blob/v0.2.1/changelog.md",
2020
"bugs": "https://github.com/Forien/foundryvtt-forien-quest-log/issues",
2121
"languages": [
2222
{
2323
"lang": "en",
2424
"name": "English",
2525
"path": "lang/en.json"
26+
},
27+
{
28+
"lang": "pl",
29+
"name": "Polski",
30+
"path": "lang/pl.json"
2631
}
2732
],
2833
"esmodules": [

modules/quest-form.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class QuestForm extends FormApplication {
99
return mergeObject(super.defaultOptions, {
1010
id: "forien-quest-log-form",
1111
template: "modules/forien-quest-log/templates/quest-log-form.html",
12-
title: "Add new Quest",
12+
title: game.i18n.localize("ForienQuestLog.QuestForm.Title"),
1313
width: 940,
1414
height: 640,
1515
closeOnSubmit: true

modules/quest-log.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class QuestLog extends Application {
1212
height: 480,
1313
minimizable: true,
1414
resizable: true,
15-
title: "Quest Log",
15+
title: game.i18n.localize("ForienQuestLog.QuestLog.Title"),
1616
tabs: [{navSelector: ".log-tabs", contentSelector: ".log-body", initial: "progress"}]
1717
});
1818
}

modules/quest-preview.mjs

+9-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default class QuestPreview extends FormApplication {
1616
height: 540,
1717
minimizable: true,
1818
resizable: true,
19-
title: "Quest Details",
19+
title: game.i18n.localize("ForienQuestLog.QuestPreview.Title"),
2020
tabs: [{navSelector: ".quest-tabs", contentSelector: ".quest-body", initial: "details"}]
2121
});
2222
}
@@ -25,7 +25,6 @@ export default class QuestPreview extends FormApplication {
2525
let content = duplicate(this.quest);
2626
content = Quest.populate(content);
2727

28-
console.log(content);
2928
return mergeObject(content, {
3029
isGM: game.user.isGM
3130
});
@@ -63,6 +62,7 @@ export default class QuestPreview extends FormApplication {
6362

6463
render(force = false, options = {}) {
6564
game.questPreview = this;
65+
if (force) this.quest.refresh();
6666
return super.render(force, options);
6767
}
6868

@@ -159,7 +159,7 @@ export default class QuestPreview extends FormApplication {
159159
this.saveQuest();
160160
});
161161

162-
html.on("click", '.task input[type="checkbox"]', (event) => {
162+
html.on("click", '.task .toggleState', (event) => {
163163
let index = $(event.target).data('task-index');
164164
this.quest.tasks[index].toggle();
165165
this.saveQuest();
@@ -172,10 +172,15 @@ export default class QuestPreview extends FormApplication {
172172
actor.sheet.render(true);
173173
});
174174

175+
html.on("click", ".toggleImage", (event) => {
176+
this.quest.toggleImage();
177+
this.saveQuest();
178+
});
179+
175180
html.on("click", ".add-new-task", (event) => {
176181
let div = $('<div class="task"></div>');
177182
let placeholder = $('<span><i class="fas fa-check hidden"></i></span>');
178-
let input = $(`<input type="text" class="editable-input" value="" placeholder="f.e. Kill all rats in „The Twisted Ankle” inn" />`);
183+
let input = $(`<input type="text" class="editable-input" value="" placeholder="${game.i18n.localize("ForienQuestLog.SampleTask")}" />`);
179184
let box = $(event.target).parent().parent('.tasks-gc').find('.tasks-box');
180185

181186
div.append(placeholder);

modules/quest.mjs

+42-8
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ import Socket from "./socket.mjs";
77
export default class Quest {
88
constructor(data = {}) {
99
this._id = data.id || null;
10+
this.initData(data);
11+
}
12+
13+
initData(data) {
1014
this._actor = data.actor || null;
11-
this._title = data.title || 'New Quest';
15+
this._title = data.title || game.i18n.localize("ForienQuestLog.NewQuest");
1216
this._description = data.description || '';
1317
this._gmnotes = data.gmnotes || '';
1418
this._tasks = [];
1519
this._rewards = [];
20+
this._image = data.image || 'actor';
1621
this._populated = false;
1722

1823
if (data.tasks !== undefined && Array.isArray(data.tasks))
@@ -47,6 +52,21 @@ export default class Quest {
4752
this._rewards.splice(index, 1);
4853
}
4954

55+
toggleImage() {
56+
if (this._image === 'actor') {
57+
this._image = 'token';
58+
} else {
59+
this._image = 'actor';
60+
}
61+
}
62+
63+
refresh() {
64+
let entry = game.journal.get(this._id);
65+
let content = Quest.getContent(entry);
66+
67+
this.initData(content);
68+
}
69+
5070
async save() {
5171
if (this._populated) {
5272
throw new Error(`Can't save populated Quest (${this._id})`);
@@ -66,6 +86,8 @@ export default class Quest {
6686
let actor = Utils.findActor(content.actor);
6787
if (actor !== false)
6888
content.actor = duplicate(actor);
89+
if (content.image === 'token')
90+
content.actor.img = actor.data.token.img;
6991

7092
content.checkedTasks = content.tasks.filter(t => t.completed).length;
7193
content.totalTasks = content.tasks.length;
@@ -74,6 +96,8 @@ export default class Quest {
7496
content.rewards = [];
7597
}
7698

99+
content.tasks = content.tasks.map((t) => {return new Task(t)});
100+
77101
content.noRewards = (content.rewards.length === 0);
78102
content.rewards.forEach((item) => {
79103
item.transfer = JSON.stringify(item.data);
@@ -132,26 +156,26 @@ export default class Quest {
132156
game.questlog.render(true);
133157
Socket.refreshQuestLog();
134158
let dirname = game.i18n.localize(this.getQuestTypes()[target]);
135-
ui.notifications.info(game.i18n.format('ForienQuestLog.Notifications.QuestMoved', {target: dirname}), {});
159+
ui.notifications.info(game.i18n.format("ForienQuestLog.Notifications.QuestMoved", {target: dirname}), {});
136160
});
137161
}
138162

139163
static async delete(questId) {
140164
let entry = this.get(questId);
141165

142166
new Dialog({
143-
title: `Delete ${entry.name}`,
144-
content: "<h3>Are you sure?</h3>" +
145-
"<p>This quest and its data will be permanently deleted.</p>",
167+
title: game.i18n.format("ForienQuestLog.DeleteDialog.Title", entry.name),
168+
content: `<h3>${game.i18n.localize("ForienQuestLog.DeleteDialog.Header")}</h3>` +
169+
`<p>${game.i18n.localize("ForienQuestLog.DeleteDialog.Body")}</p>`,
146170
buttons: {
147171
yes: {
148172
icon: '<i class="fas fa-trash"></i>',
149-
label: "Delete",
173+
label: game.i18n.localize("ForienQuestLog.DeleteDialog.Delete"),
150174
callback: () => this.deleteConfirm(questId)
151175
},
152176
no: {
153177
icon: '<i class="fas fa-times"></i>',
154-
label: "Cancel"
178+
label: game.i18n.localize("ForienQuestLog.DeleteDialog.Cancel")
155179
}
156180
},
157181
default: 'yes'
@@ -212,6 +236,15 @@ export default class Quest {
212236
return this._tasks;
213237
}
214238

239+
set image(image) {
240+
if (image === 'actor' || image === 'token')
241+
this._image = image;
242+
}
243+
244+
get image() {
245+
return this._image;
246+
}
247+
215248
get rewards() {
216249
return this._rewards;
217250
}
@@ -223,7 +256,8 @@ export default class Quest {
223256
description: this._description,
224257
gmnotes: this._gmnotes,
225258
tasks: this._tasks,
226-
rewards: this._rewards
259+
rewards: this._rewards,
260+
image: this._image
227261
}
228262
}
229263
}

0 commit comments

Comments
 (0)