@rpg-engine/long-bow 0.6.74 → 0.6.76
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 +30 -19
- 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 +30 -19
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/QuestList.tsx +51 -28
package/package.json
CHANGED
|
@@ -92,43 +92,65 @@ export const QuestList: React.FC<IQuestListProps> = ({ quests }) => {
|
|
|
92
92
|
const formatObjectives = (
|
|
93
93
|
objectives: (IQuestObjectiveKill | IQuestObjectiveInteraction)[]
|
|
94
94
|
) => {
|
|
95
|
-
|
|
96
|
-
.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
95
|
+
try {
|
|
96
|
+
if (!objectives || !Array.isArray(objectives)) return 'No objectives';
|
|
97
|
+
return objectives
|
|
98
|
+
.map(objective => {
|
|
99
|
+
if ('killCountTarget' in objective) {
|
|
100
|
+
const killObjective = objective as IQuestObjectiveKill;
|
|
101
|
+
return `Kill ${formatText(
|
|
102
|
+
killObjective.creatureKeys?.join(', ') ?? 'Unknown'
|
|
103
|
+
)}: ${killObjective.killCount ?? 0}/${killObjective.killCountTarget ??
|
|
104
|
+
0}`;
|
|
105
|
+
} else if ('targetNPCkey' in objective) {
|
|
106
|
+
const interactionObjective = objective as IQuestObjectiveInteraction;
|
|
107
|
+
return `Interact with NPC: ${formatText(
|
|
108
|
+
interactionObjective.targetNPCkey ?? 'Unknown'
|
|
109
|
+
)}`;
|
|
110
|
+
} else {
|
|
111
|
+
return 'Unknown objective';
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
.join('; ');
|
|
115
|
+
} catch (error) {
|
|
116
|
+
console.error('Error formatting objectives:', error);
|
|
117
|
+
return 'Error formatting objectives';
|
|
118
|
+
}
|
|
114
119
|
};
|
|
115
120
|
|
|
116
121
|
// Updated helper function to format rewards
|
|
117
122
|
const formatRewards = (rewards: IQuest['rewards']) => {
|
|
118
123
|
try {
|
|
119
124
|
if (!rewards || !Array.isArray(rewards)) return 'No rewards';
|
|
125
|
+
|
|
120
126
|
return rewards
|
|
121
127
|
.map(reward => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
const itemKeysFormatted = reward?.itemKeys
|
|
129
|
+
?.map(itemKey =>
|
|
130
|
+
itemKey && reward?.qty !== undefined
|
|
131
|
+
? `${itemKey} x${reward.qty}`
|
|
132
|
+
: ''
|
|
133
|
+
)
|
|
134
|
+
.filter(Boolean)
|
|
135
|
+
.join(', ');
|
|
136
|
+
|
|
137
|
+
const spellKeysFormatted = reward?.spellKeys
|
|
138
|
+
?.filter(Boolean)
|
|
139
|
+
.join(', ');
|
|
140
|
+
|
|
141
|
+
const formattedReward = itemKeysFormatted
|
|
142
|
+
? `${formatText(itemKeysFormatted)}`
|
|
143
|
+
: '';
|
|
144
|
+
|
|
145
|
+
if (spellKeysFormatted) {
|
|
146
|
+
return formattedReward
|
|
147
|
+
? `${formattedReward}, Spells: ${formatText(spellKeysFormatted)}`
|
|
148
|
+
: `Spells: ${formatText(spellKeysFormatted)}`;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return formattedReward || 'No rewards';
|
|
131
152
|
})
|
|
153
|
+
.filter(Boolean)
|
|
132
154
|
.join('; ');
|
|
133
155
|
} catch (error) {
|
|
134
156
|
console.error(
|
|
@@ -138,6 +160,7 @@ const formatRewards = (rewards: IQuest['rewards']) => {
|
|
|
138
160
|
return 'Error on rewards';
|
|
139
161
|
}
|
|
140
162
|
};
|
|
163
|
+
|
|
141
164
|
const formatText = (text: string) => {
|
|
142
165
|
return text
|
|
143
166
|
.split('-')
|