@rpg-engine/long-bow 0.8.48 → 0.8.49

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.8.48",
3
+ "version": "0.8.49",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  ICharacterDailyTask,
3
+ ICollectGlobalRewardRequest,
3
4
  ITaskIdentifier,
4
5
  TaskStatus,
5
6
  TaskType,
@@ -17,6 +18,7 @@ import { getTaskIcon } from './utils/dailyTasks.utils';
17
18
  export interface IDailyTasksProps {
18
19
  tasks: ICharacterDailyTask[];
19
20
  onClaimReward: (task: ITaskIdentifier) => void;
21
+ onClaimGlobalReward: (tasks: ICollectGlobalRewardRequest) => void;
20
22
  onClose: () => void;
21
23
  scale?: number;
22
24
  itemsAtlasJSON: Record<string, any>;
@@ -28,6 +30,7 @@ export interface IDailyTasksProps {
28
30
  export const DailyTasks: React.FC<IDailyTasksProps> = ({
29
31
  tasks,
30
32
  onClaimReward,
33
+ onClaimGlobalReward,
31
34
  onClose,
32
35
  scale = 1,
33
36
  itemsAtlasJSON,
@@ -48,12 +51,14 @@ export const DailyTasks: React.FC<IDailyTasksProps> = ({
48
51
  };
49
52
 
50
53
  const handleClaimAllRewards = () => {
51
- localTasks.forEach(task => {
52
- if (task.status === TaskStatus.Completed && !task.claimed) {
53
- const { type, key } = task;
54
- onClaimReward({ type, taskKey: key });
55
- }
56
- });
54
+ const tasksToReward = localTasks
55
+ .filter(task => task.status === TaskStatus.Completed && !task.claimed)
56
+ .map(task => ({
57
+ type: task.type,
58
+ taskKey: task.key,
59
+ }));
60
+
61
+ onClaimGlobalReward({ tasks: tasksToReward });
57
62
  };
58
63
 
59
64
  if (!size) return null;