Skip to content

Commit 0fc9814

Browse files
committed
Fix character quest init and empty hunt regions
1 parent dbcbd21 commit 0fc9814

4 files changed

Lines changed: 38 additions & 12 deletions

File tree

app/js/engine/state-engine.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,9 @@ var StateEngine = (function() {
368368

369369
worldState.characters[sender] = character;
370370
worldState.inventories[sender] = [];
371-
worldState.quests[sender] = worldState.quests[sender] || _createDefaultQuestState();
371+
worldState.quests[sender] = worldState.quests[sender] || (typeof QuestSystem !== 'undefined'
372+
? QuestSystem.createPlayerQuestState()
373+
: { active: [], completed: [], dailyProphecyDay: 0 });
372374

373375
// Give starter equipment based on class
374376
var starterItems = _getStarterItems(data.class, sender, blockNum);

app/js/i18n/en.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ var LangEN = {
143143
// Hunt
144144
hunt_title: 'Hunt',
145145
hunt_choose_creature: 'Choose your prey',
146+
hunt_no_creatures_here: 'There are currently no huntable creatures in this location.',
147+
hunt_no_creatures_hint: 'Open the map and return to The Commons of First Light, or wait until creatures appear in this region.',
148+
hunt_return_to_commons: 'Return to First Light',
146149
hunt_choose_spell: 'Choose a spell',
147150
hunt_attack: 'Attack',
148151
hunt_victory: 'Victory!',

app/js/i18n/ru.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ var LangRU = {
143143
// Hunt
144144
hunt_title: 'Охота',
145145
hunt_choose_creature: 'Выбери добычу',
146+
hunt_no_creatures_here: 'В этой локации сейчас нет доступной добычи для охоты.',
147+
hunt_no_creatures_hint: 'Откройте карту и вернитесь в The Commons of First Light или дождитесь появления существ в этом регионе.',
148+
hunt_return_to_commons: 'Вернуться в First Light',
146149
hunt_choose_spell: 'Выбери заклинание',
147150
hunt_attack: 'Атаковать',
148151
hunt_victory: 'Победа!',

app/js/ui/screens/hunt.js

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,30 @@ var HuntScreen = (function() {
3333

3434
var html = '<div class="hunt-screen">' +
3535
'<h1>' + t('hunt_title') + '</h1>' +
36-
'<h2>' + t('hunt_choose_creature') + '</h2>' +
37-
'<div class="creature-list" role="radiogroup" aria-label="' + t('hunt_choose_creature') + '">';
38-
39-
for (var i = 0; i < creatures.length; i++) {
40-
var c = creatures[i];
41-
html += '<button class="creature-card" data-id="' + c.id + '" role="radio" aria-checked="false" ' +
42-
'aria-label="' + c.name + '. Level ' + c.minLevel + ' to ' + c.maxLevel + '">' +
43-
'<span class="creature-name">' + c.name + '</span>' +
44-
'<span class="creature-level">Lv ' + c.minLevel + '-' + c.maxLevel + '</span>' +
45-
'</button>';
36+
'<h2>' + t('hunt_choose_creature') + '</h2>';
37+
38+
if (!creatures.length) {
39+
html += '<div class="creature-list" role="status" aria-live="polite">' +
40+
'<p class="empty-state">' + t('hunt_no_creatures_here') + '</p>' +
41+
'<p class="quest-desc">' + t('hunt_no_creatures_hint') + '</p>' +
42+
'<button class="btn btn-secondary" id="btn-return-commons">' + t('hunt_return_to_commons') + '</button>' +
43+
'</div>';
44+
} else {
45+
html += '<div class="creature-list" role="radiogroup" aria-label="' + t('hunt_choose_creature') + '">';
46+
47+
for (var i = 0; i < creatures.length; i++) {
48+
var c = creatures[i];
49+
html += '<button class="creature-card" data-id="' + c.id + '" role="radio" aria-checked="false" ' +
50+
'aria-label="' + c.name + '. Level ' + c.minLevel + ' to ' + c.maxLevel + '">' +
51+
'<span class="creature-name">' + c.name + '</span>' +
52+
'<span class="creature-level">Lv ' + c.minLevel + '-' + c.maxLevel + '</span>' +
53+
'</button>';
54+
}
55+
56+
html += '</div>';
4657
}
4758

48-
html += '</div><h2>' + t('hunt_choose_spell') + '</h2>' +
59+
html += '<h2>' + t('hunt_choose_spell') + '</h2>' +
4960
'<div class="spell-grid" role="radiogroup" aria-label="' + t('hunt_choose_spell') + '">';
5061

5162
for (var j = 0; j < spells.length; j++) {
@@ -134,6 +145,13 @@ var HuntScreen = (function() {
134145

135146
Helpers.$('btn-attack').addEventListener('click', _doHunt);
136147

148+
var returnBtn = Helpers.$('btn-return-commons');
149+
if (returnBtn) {
150+
returnBtn.addEventListener('click', function() {
151+
Helpers.EventBus.emit('navigate', 'map');
152+
});
153+
}
154+
137155
// Armageddon confirm checkbox and launch button
138156
var armaCb = el.querySelector('#armageddon-confirm-cb');
139157
var armaBtn = el.querySelector('#btn-armageddon');

0 commit comments

Comments
 (0)