@rpg-engine/long-bow 0.6.73 → 0.6.74

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.6.73",
3
+ "version": "0.6.74",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -115,20 +115,29 @@ const formatObjectives = (
115
115
 
116
116
  // Updated helper function to format rewards
117
117
  const formatRewards = (rewards: IQuest['rewards']) => {
118
- if (!rewards) return 'No rewards';
119
- return rewards
120
- .map(reward => {
121
- return `${formatText(
122
- reward.itemKeys.map(itemKey => itemKey + ' x' + reward.qty).join(', ')
123
- )}${
124
- reward.spellKeys
125
- ? `, Spells: ${formatText(reward.spellKeys.join(', '))}`
126
- : ''
127
- }`;
128
- })
129
- .join('; ');
118
+ try {
119
+ if (!rewards || !Array.isArray(rewards)) return 'No rewards';
120
+ return rewards
121
+ .map(reward => {
122
+ return `${formatText(
123
+ reward?.itemKeys
124
+ ?.map(itemKey => itemKey + ' x' + reward?.qty)
125
+ .join(', ')
126
+ )}${
127
+ reward?.spellKeys
128
+ ? `, Spells: ${formatText(reward.spellKeys.join(', '))}`
129
+ : ''
130
+ }`;
131
+ })
132
+ .join('; ');
133
+ } catch (error) {
134
+ console.error(
135
+ `Error formatting rewards: ${JSON.stringify(rewards)}:`,
136
+ error
137
+ );
138
+ return 'Error on rewards';
139
+ }
130
140
  };
131
-
132
141
  const formatText = (text: string) => {
133
142
  return text
134
143
  .split('-')