@rpg-engine/long-bow 0.7.13 → 0.7.15
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/components/Quests/QuestList.d.ts +11 -1
- package/dist/long-bow.cjs.development.js +30 -78
- 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 +28 -79
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Quests/QuestList.tsx +27 -88
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import { IQuest } from '@rpg-engine/shared';
|
|
1
|
+
import { IQuest, QuestStatus } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { CSSProperties } from 'styled-components';
|
|
3
4
|
export interface IQuestListProps {
|
|
4
5
|
quests?: IQuest[];
|
|
6
|
+
styles?: {
|
|
7
|
+
container?: CSSProperties;
|
|
8
|
+
card?: CSSProperties;
|
|
9
|
+
label?: CSSProperties;
|
|
10
|
+
value?: CSSProperties;
|
|
11
|
+
};
|
|
5
12
|
}
|
|
6
13
|
export declare const QuestList: React.FC<IQuestListProps>;
|
|
14
|
+
export declare const formatQuestText: (text: string) => string;
|
|
15
|
+
export declare const getQuestStatusColor: (status?: QuestStatus | undefined) => string;
|
|
16
|
+
export declare const formatQuestStatus: (status?: QuestStatus | undefined) => string;
|
|
@@ -31955,22 +31955,36 @@ var Thumbnail = /*#__PURE__*/styled__default.img.withConfig({
|
|
|
31955
31955
|
})(["color:white;z-index:22;width:32px * 1.5;margin-right:0.5rem;position:relative;top:-4px;"]);
|
|
31956
31956
|
|
|
31957
31957
|
var QuestList = function QuestList(_ref) {
|
|
31958
|
-
var quests = _ref.quests
|
|
31959
|
-
|
|
31960
|
-
|
|
31958
|
+
var quests = _ref.quests,
|
|
31959
|
+
styles = _ref.styles;
|
|
31960
|
+
return React__default.createElement(QuestListContainer, {
|
|
31961
|
+
style: styles == null ? void 0 : styles.container
|
|
31962
|
+
}, quests && quests.length > 0 ? quests.map(function (quest, i) {
|
|
31963
|
+
var _formatQuestStatus;
|
|
31961
31964
|
return React__default.createElement(QuestCard, {
|
|
31962
|
-
key: i
|
|
31963
|
-
|
|
31964
|
-
|
|
31965
|
-
|
|
31966
|
-
|
|
31967
|
-
|
|
31965
|
+
key: i,
|
|
31966
|
+
style: styles == null ? void 0 : styles.card
|
|
31967
|
+
}, React__default.createElement(QuestItem, null, React__default.createElement(Label, {
|
|
31968
|
+
style: styles == null ? void 0 : styles.label
|
|
31969
|
+
}, "Title:"), React__default.createElement(Value, {
|
|
31970
|
+
style: styles == null ? void 0 : styles.value
|
|
31971
|
+
}, formatQuestText(quest.title))), React__default.createElement(QuestItem, null, React__default.createElement(Label, {
|
|
31972
|
+
style: styles == null ? void 0 : styles.label
|
|
31973
|
+
}, "Status:"), React__default.createElement(Value, {
|
|
31974
|
+
style: _extends({}, styles == null ? void 0 : styles.value, {
|
|
31975
|
+
color: getQuestStatusColor(quest.status)
|
|
31976
|
+
})
|
|
31977
|
+
}, (_formatQuestStatus = formatQuestStatus(quest.status)) != null ? _formatQuestStatus : 'Unknown')), React__default.createElement(QuestItem, null, React__default.createElement(Label, {
|
|
31978
|
+
style: styles == null ? void 0 : styles.label
|
|
31979
|
+
}, "Description:"), React__default.createElement(Value, {
|
|
31980
|
+
style: styles == null ? void 0 : styles.value
|
|
31981
|
+
}, quest.description)));
|
|
31968
31982
|
}) : React__default.createElement(NoQuestContainer, null, React__default.createElement("p", null, "There are no ongoing quests")));
|
|
31969
31983
|
};
|
|
31970
31984
|
var QuestListContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
31971
31985
|
displayName: "QuestList__QuestListContainer",
|
|
31972
31986
|
componentId: "sc-1c1y8sp-0"
|
|
31973
|
-
})(["
|
|
31987
|
+
})(["max-height:400px;padding:10px;border-radius:10px;font-size:0.7rem;"]);
|
|
31974
31988
|
var QuestCard = /*#__PURE__*/styled__default.div.withConfig({
|
|
31975
31989
|
displayName: "QuestList__QuestCard",
|
|
31976
31990
|
componentId: "sc-1c1y8sp-1"
|
|
@@ -31991,78 +32005,13 @@ var NoQuestContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
31991
32005
|
displayName: "QuestList__NoQuestContainer",
|
|
31992
32006
|
componentId: "sc-1c1y8sp-5"
|
|
31993
32007
|
})(["text-align:center;p{margin-top:5px;color:", ";}"], uiColors.lightGray);
|
|
31994
|
-
|
|
31995
|
-
// objectives: (IQuestObjectiveKill | IQuestObjectiveInteraction)[]
|
|
31996
|
-
// ) => {
|
|
31997
|
-
// try {
|
|
31998
|
-
// if (!objectives || !Array.isArray(objectives)) return '';
|
|
31999
|
-
// return objectives
|
|
32000
|
-
// .map(objective => {
|
|
32001
|
-
// if ('killCountTarget' in objective) {
|
|
32002
|
-
// const killObjective = objective as IQuestObjectiveKill;
|
|
32003
|
-
// return `Kill ${formatText(
|
|
32004
|
-
// killObjective.creatureKeys?.join(', ') ?? ''
|
|
32005
|
-
// )}: ${killObjective.killCount ?? 0}/${killObjective.killCountTarget ??
|
|
32006
|
-
// 0}`;
|
|
32007
|
-
// } else if ('targetNPCkey' in objective) {
|
|
32008
|
-
// const interactionObjective = objective as IQuestObjectiveInteraction;
|
|
32009
|
-
// return `Interact with NPC: ${formatText(
|
|
32010
|
-
// interactionObjective.targetNPCkey ?? ''
|
|
32011
|
-
// )}`;
|
|
32012
|
-
// } else {
|
|
32013
|
-
// return '';
|
|
32014
|
-
// }
|
|
32015
|
-
// })
|
|
32016
|
-
// .filter(Boolean)
|
|
32017
|
-
// .join('; ');
|
|
32018
|
-
// } catch (error) {
|
|
32019
|
-
// console.error('Error formatting objectives:', error);
|
|
32020
|
-
// return '';
|
|
32021
|
-
// }
|
|
32022
|
-
// };
|
|
32023
|
-
// const formatRewards = (rewards: IQuest['rewards']) => {
|
|
32024
|
-
// try {
|
|
32025
|
-
// if (!rewards || !Array.isArray(rewards)) return '';
|
|
32026
|
-
// return rewards
|
|
32027
|
-
// .map(reward => {
|
|
32028
|
-
// const itemKeysFormatted = reward?.itemKeys
|
|
32029
|
-
// ?.map(itemKey =>
|
|
32030
|
-
// itemKey && reward?.qty !== undefined
|
|
32031
|
-
// ? `${itemKey} x${reward.qty}`
|
|
32032
|
-
// : ''
|
|
32033
|
-
// )
|
|
32034
|
-
// .filter(Boolean)
|
|
32035
|
-
// .join(', ');
|
|
32036
|
-
// const spellKeysFormatted = reward?.spellKeys
|
|
32037
|
-
// ?.filter(Boolean)
|
|
32038
|
-
// .join(', ');
|
|
32039
|
-
// const formattedReward = itemKeysFormatted
|
|
32040
|
-
// ? `${formatText(itemKeysFormatted)}`
|
|
32041
|
-
// : '';
|
|
32042
|
-
// if (spellKeysFormatted) {
|
|
32043
|
-
// return formattedReward
|
|
32044
|
-
// ? `${formattedReward}, Spells: ${formatText(spellKeysFormatted)}`
|
|
32045
|
-
// : `Spells: ${formatText(spellKeysFormatted)}`;
|
|
32046
|
-
// }
|
|
32047
|
-
// return formattedReward || '';
|
|
32048
|
-
// })
|
|
32049
|
-
// .filter(Boolean)
|
|
32050
|
-
// .join('; ');
|
|
32051
|
-
// } catch (error) {
|
|
32052
|
-
// console.error(
|
|
32053
|
-
// `Error formatting rewards: ${JSON.stringify(rewards)}:`,
|
|
32054
|
-
// error
|
|
32055
|
-
// );
|
|
32056
|
-
// return '';
|
|
32057
|
-
// }
|
|
32058
|
-
// };
|
|
32059
|
-
var formatText = function formatText(text) {
|
|
32008
|
+
var formatQuestText = function formatQuestText(text) {
|
|
32060
32009
|
if (!text) return '';
|
|
32061
32010
|
return text.split('-').map(function (word) {
|
|
32062
32011
|
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
32063
32012
|
}).join(' ');
|
|
32064
32013
|
};
|
|
32065
|
-
var
|
|
32014
|
+
var getQuestStatusColor = function getQuestStatusColor(status) {
|
|
32066
32015
|
switch (status) {
|
|
32067
32016
|
case shared.QuestStatus.Pending:
|
|
32068
32017
|
return uiColors.orange;
|
|
@@ -32074,7 +32023,7 @@ var getStatusColor = function getStatusColor(status) {
|
|
|
32074
32023
|
return uiColors.white;
|
|
32075
32024
|
}
|
|
32076
32025
|
};
|
|
32077
|
-
var
|
|
32026
|
+
var formatQuestStatus = function formatQuestStatus(status) {
|
|
32078
32027
|
if (!status) return '';
|
|
32079
32028
|
return status.split(/(?=[A-Z])/).join(' ').replace(/^\w/, function (c) {
|
|
32080
32029
|
return c.toUpperCase();
|
|
@@ -33693,8 +33642,11 @@ exports.Truncate = Truncate;
|
|
|
33693
33642
|
exports.TutorialStepper = TutorialStepper;
|
|
33694
33643
|
exports.UserActionLink = UserActionLink;
|
|
33695
33644
|
exports._RPGUI = _RPGUI;
|
|
33645
|
+
exports.formatQuestStatus = formatQuestStatus;
|
|
33646
|
+
exports.formatQuestText = formatQuestText;
|
|
33696
33647
|
exports.getMockedPlayersRowsLeader = getMockedPlayersRowsLeader;
|
|
33697
33648
|
exports.getMockedPlayersRowsNotLeader = getMockedPlayersRowsNotLeader;
|
|
33649
|
+
exports.getQuestStatusColor = getQuestStatusColor;
|
|
33698
33650
|
exports.mockedPartyManager = mockedPartyManager;
|
|
33699
33651
|
exports.mockedPartyRows = mockedPartyRows;
|
|
33700
33652
|
exports.mockedPlayersRows = mockedPlayersRows;
|