@rpg-engine/long-bow 0.6.82 → 0.6.85

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.82",
3
+ "version": "0.6.85",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,9 +1,4 @@
1
- import {
2
- IQuest,
3
- IQuestObjectiveInteraction,
4
- IQuestObjectiveKill,
5
- QuestStatus,
6
- } from '@rpg-engine/shared';
1
+ import { IQuest, QuestStatus } from '@rpg-engine/shared';
7
2
  import React from 'react';
8
3
  import styled from 'styled-components';
9
4
  import { uiColors } from '../../constants/uiColors';
@@ -32,14 +27,6 @@ export const QuestList: React.FC<IQuestListProps> = ({ quests }) => {
32
27
  <Label>Description:</Label>
33
28
  <Value>{quest.description}</Value>
34
29
  </QuestItem>
35
- <QuestItem>
36
- <Label>Objectives:</Label>
37
- <Value>{formatObjectives(quest.objectives)}</Value>
38
- </QuestItem>
39
- <QuestItem>
40
- <Label>Rewards:</Label>
41
- <Value>{formatRewards(quest.rewards)}</Value>
42
- </QuestItem>
43
30
  </QuestCard>
44
31
  ))
45
32
  ) : (
@@ -100,79 +87,80 @@ const NoQuestContainer = styled.div`
100
87
  }
101
88
  `;
102
89
 
103
- const formatObjectives = (
104
- objectives: (IQuestObjectiveKill | IQuestObjectiveInteraction)[]
105
- ) => {
106
- try {
107
- if (!objectives || !Array.isArray(objectives)) return 'No objectives';
108
- return objectives
109
- .map(objective => {
110
- if ('killCountTarget' in objective) {
111
- const killObjective = objective as IQuestObjectiveKill;
112
- return `Kill ${formatText(
113
- killObjective.creatureKeys?.join(', ') ?? 'Unknown'
114
- )}: ${killObjective.killCount ?? 0}/${killObjective.killCountTarget ??
115
- 0}`;
116
- } else if ('targetNPCkey' in objective) {
117
- const interactionObjective = objective as IQuestObjectiveInteraction;
118
- return `Interact with NPC: ${formatText(
119
- interactionObjective.targetNPCkey ?? 'Unknown'
120
- )}`;
121
- } else {
122
- return 'Unknown objective';
123
- }
124
- })
125
- .join('; ');
126
- } catch (error) {
127
- console.error('Error formatting objectives:', error);
128
- return 'Error formatting objectives';
129
- }
130
- };
131
-
132
- const formatRewards = (rewards: IQuest['rewards']) => {
133
- try {
134
- if (!rewards || !Array.isArray(rewards)) return 'No rewards';
135
-
136
- return rewards
137
- .map(reward => {
138
- const itemKeysFormatted = reward?.itemKeys
139
- ?.map(itemKey =>
140
- itemKey && reward?.qty !== undefined
141
- ? `${itemKey} x${reward.qty}`
142
- : ''
143
- )
144
- .filter(Boolean)
145
- .join(', ');
146
-
147
- const spellKeysFormatted = reward?.spellKeys
148
- ?.filter(Boolean)
149
- .join(', ');
150
-
151
- const formattedReward = itemKeysFormatted
152
- ? `${formatText(itemKeysFormatted)}`
153
- : '';
154
-
155
- if (spellKeysFormatted) {
156
- return formattedReward
157
- ? `${formattedReward}, Spells: ${formatText(spellKeysFormatted)}`
158
- : `Spells: ${formatText(spellKeysFormatted)}`;
159
- }
160
-
161
- return formattedReward || 'No rewards';
162
- })
163
- .filter(Boolean)
164
- .join('; ');
165
- } catch (error) {
166
- console.error(
167
- `Error formatting rewards: ${JSON.stringify(rewards)}:`,
168
- error
169
- );
170
- return 'Error on rewards';
171
- }
172
- };
90
+ // const formatObjectives = (
91
+ // objectives: (IQuestObjectiveKill | IQuestObjectiveInteraction)[]
92
+ // ) => {
93
+ // try {
94
+ // if (!objectives || !Array.isArray(objectives)) return '';
95
+ // return objectives
96
+ // .map(objective => {
97
+ // if ('killCountTarget' in objective) {
98
+ // const killObjective = objective as IQuestObjectiveKill;
99
+ // return `Kill ${formatText(
100
+ // killObjective.creatureKeys?.join(', ') ?? ''
101
+ // )}: ${killObjective.killCount ?? 0}/${killObjective.killCountTarget ??
102
+ // 0}`;
103
+ // } else if ('targetNPCkey' in objective) {
104
+ // const interactionObjective = objective as IQuestObjectiveInteraction;
105
+ // return `Interact with NPC: ${formatText(
106
+ // interactionObjective.targetNPCkey ?? ''
107
+ // )}`;
108
+ // } else {
109
+ // return '';
110
+ // }
111
+ // })
112
+ // .filter(Boolean)
113
+ // .join('; ');
114
+ // } catch (error) {
115
+ // console.error('Error formatting objectives:', error);
116
+ // return '';
117
+ // }
118
+ // };
119
+
120
+ // const formatRewards = (rewards: IQuest['rewards']) => {
121
+ // try {
122
+ // if (!rewards || !Array.isArray(rewards)) return '';
123
+
124
+ // return rewards
125
+ // .map(reward => {
126
+ // const itemKeysFormatted = reward?.itemKeys
127
+ // ?.map(itemKey =>
128
+ // itemKey && reward?.qty !== undefined
129
+ // ? `${itemKey} x${reward.qty}`
130
+ // : ''
131
+ // )
132
+ // .filter(Boolean)
133
+ // .join(', ');
134
+
135
+ // const spellKeysFormatted = reward?.spellKeys
136
+ // ?.filter(Boolean)
137
+ // .join(', ');
138
+
139
+ // const formattedReward = itemKeysFormatted
140
+ // ? `${formatText(itemKeysFormatted)}`
141
+ // : '';
142
+
143
+ // if (spellKeysFormatted) {
144
+ // return formattedReward
145
+ // ? `${formattedReward}, Spells: ${formatText(spellKeysFormatted)}`
146
+ // : `Spells: ${formatText(spellKeysFormatted)}`;
147
+ // }
148
+
149
+ // return formattedReward || '';
150
+ // })
151
+ // .filter(Boolean)
152
+ // .join('; ');
153
+ // } catch (error) {
154
+ // console.error(
155
+ // `Error formatting rewards: ${JSON.stringify(rewards)}:`,
156
+ // error
157
+ // );
158
+ // return '';
159
+ // }
160
+ // };
173
161
 
174
162
  const formatText = (text: string) => {
175
- if (!text) return 'Unknown';
163
+ if (!text) return '';
176
164
  return text
177
165
  .split('-')
178
166
  .map(word => word.charAt(0).toUpperCase() + word.slice(1))
@@ -193,7 +181,7 @@ const getStatusColor = (status?: QuestStatus) => {
193
181
  };
194
182
 
195
183
  const formatStatus = (status?: QuestStatus) => {
196
- if (!status) return 'Unknown';
184
+ if (!status) return '';
197
185
  return status
198
186
  .split(/(?=[A-Z])/)
199
187
  .join(' ')