@rpg-engine/long-bow 0.6.82 → 0.6.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/long-bow.cjs.development.js +12 -12
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +12 -12
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Quests/QuestList.tsx +23 -18
package/package.json
CHANGED
|
@@ -32,14 +32,18 @@ export const QuestList: React.FC<IQuestListProps> = ({ quests }) => {
|
|
|
32
32
|
<Label>Description:</Label>
|
|
33
33
|
<Value>{quest.description}</Value>
|
|
34
34
|
</QuestItem>
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
{quest.objectives && quest.objectives.length > 0 && (
|
|
36
|
+
<QuestItem>
|
|
37
|
+
<Label>Objectives:</Label>
|
|
38
|
+
<Value>{formatObjectives(quest.objectives)}</Value>
|
|
39
|
+
</QuestItem>
|
|
40
|
+
)}
|
|
41
|
+
{quest.rewards && quest.rewards.length > 0 && (
|
|
42
|
+
<QuestItem>
|
|
43
|
+
<Label>Rewards:</Label>
|
|
44
|
+
<Value>{formatRewards(quest.rewards)}</Value>
|
|
45
|
+
</QuestItem>
|
|
46
|
+
)}
|
|
43
47
|
</QuestCard>
|
|
44
48
|
))
|
|
45
49
|
) : (
|
|
@@ -104,34 +108,35 @@ const formatObjectives = (
|
|
|
104
108
|
objectives: (IQuestObjectiveKill | IQuestObjectiveInteraction)[]
|
|
105
109
|
) => {
|
|
106
110
|
try {
|
|
107
|
-
if (!objectives || !Array.isArray(objectives)) return '
|
|
111
|
+
if (!objectives || !Array.isArray(objectives)) return '';
|
|
108
112
|
return objectives
|
|
109
113
|
.map(objective => {
|
|
110
114
|
if ('killCountTarget' in objective) {
|
|
111
115
|
const killObjective = objective as IQuestObjectiveKill;
|
|
112
116
|
return `Kill ${formatText(
|
|
113
|
-
killObjective.creatureKeys?.join(', ') ?? '
|
|
117
|
+
killObjective.creatureKeys?.join(', ') ?? ''
|
|
114
118
|
)}: ${killObjective.killCount ?? 0}/${killObjective.killCountTarget ??
|
|
115
119
|
0}`;
|
|
116
120
|
} else if ('targetNPCkey' in objective) {
|
|
117
121
|
const interactionObjective = objective as IQuestObjectiveInteraction;
|
|
118
122
|
return `Interact with NPC: ${formatText(
|
|
119
|
-
interactionObjective.targetNPCkey ?? '
|
|
123
|
+
interactionObjective.targetNPCkey ?? ''
|
|
120
124
|
)}`;
|
|
121
125
|
} else {
|
|
122
|
-
return '
|
|
126
|
+
return '';
|
|
123
127
|
}
|
|
124
128
|
})
|
|
129
|
+
.filter(Boolean)
|
|
125
130
|
.join('; ');
|
|
126
131
|
} catch (error) {
|
|
127
132
|
console.error('Error formatting objectives:', error);
|
|
128
|
-
return '
|
|
133
|
+
return '';
|
|
129
134
|
}
|
|
130
135
|
};
|
|
131
136
|
|
|
132
137
|
const formatRewards = (rewards: IQuest['rewards']) => {
|
|
133
138
|
try {
|
|
134
|
-
if (!rewards || !Array.isArray(rewards)) return '
|
|
139
|
+
if (!rewards || !Array.isArray(rewards)) return '';
|
|
135
140
|
|
|
136
141
|
return rewards
|
|
137
142
|
.map(reward => {
|
|
@@ -158,7 +163,7 @@ const formatRewards = (rewards: IQuest['rewards']) => {
|
|
|
158
163
|
: `Spells: ${formatText(spellKeysFormatted)}`;
|
|
159
164
|
}
|
|
160
165
|
|
|
161
|
-
return formattedReward || '
|
|
166
|
+
return formattedReward || '';
|
|
162
167
|
})
|
|
163
168
|
.filter(Boolean)
|
|
164
169
|
.join('; ');
|
|
@@ -167,12 +172,12 @@ const formatRewards = (rewards: IQuest['rewards']) => {
|
|
|
167
172
|
`Error formatting rewards: ${JSON.stringify(rewards)}:`,
|
|
168
173
|
error
|
|
169
174
|
);
|
|
170
|
-
return '
|
|
175
|
+
return '';
|
|
171
176
|
}
|
|
172
177
|
};
|
|
173
178
|
|
|
174
179
|
const formatText = (text: string) => {
|
|
175
|
-
if (!text) return '
|
|
180
|
+
if (!text) return '';
|
|
176
181
|
return text
|
|
177
182
|
.split('-')
|
|
178
183
|
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
@@ -193,7 +198,7 @@ const getStatusColor = (status?: QuestStatus) => {
|
|
|
193
198
|
};
|
|
194
199
|
|
|
195
200
|
const formatStatus = (status?: QuestStatus) => {
|
|
196
|
-
if (!status) return '
|
|
201
|
+
if (!status) return '';
|
|
197
202
|
return status
|
|
198
203
|
.split(/(?=[A-Z])/)
|
|
199
204
|
.join(' ')
|