@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/dist/long-bow.cjs.development.js +68 -44
- 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 +68 -44
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Quests/QuestList.tsx +74 -86
package/package.json
CHANGED
|
@@ -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
|
-
|
|
105
|
-
) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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 '
|
|
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 '
|
|
184
|
+
if (!status) return '';
|
|
197
185
|
return status
|
|
198
186
|
.split(/(?=[A-Z])/)
|
|
199
187
|
.join(' ')
|