@rpg-engine/long-bow 0.8.50 → 0.8.51

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.50",
3
+ "version": "0.8.51",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -57,13 +57,7 @@ export const DailyRewardsTooltip: React.FC<IDailyRewardsTooltipProps> = ({
57
57
  <SpriteFromAtlas
58
58
  atlasJSON={itemsAtlasJSON}
59
59
  atlasIMG={itemsAtlasIMG}
60
- spriteKey={
61
- reward.type === RewardType.Gold
62
- ? 'others/gold-coin-qty-6.png'
63
- : reward.type === RewardType.Experience
64
- ? 'others/royal-chalice.png'
65
- : reward.texturePath || 'others/no-image.png'
66
- }
60
+ spriteKey={reward.texturePath ?? 'check.png'}
67
61
  width={24}
68
62
  height={24}
69
63
  imgScale={1.75}
@@ -142,6 +136,7 @@ const RewardLabel = styled.span`
142
136
  color: ${uiColors.yellow};
143
137
  font-size: 0.9rem;
144
138
  line-height: 1.2;
139
+ padding-top: 15px;
145
140
  display: inline-flex;
146
141
  align-items: center;
147
142
  `;
@@ -2,7 +2,6 @@ import {
2
2
  ICharacterDailyTask,
3
3
  ICollectGlobalRewardRequest,
4
4
  ITaskIdentifier,
5
- TaskStatus,
6
5
  TaskType,
7
6
  } from '@rpg-engine/shared';
8
7
  import React from 'react';
@@ -38,27 +37,18 @@ export const DailyTasks: React.FC<IDailyTasksProps> = ({
38
37
  iconAtlasJSON,
39
38
  iconAtlasIMG,
40
39
  }): JSX.Element | null => {
41
- const [localTasks, setLocalTasks] = React.useState(tasks);
40
+ const [localTasks] = React.useState(tasks);
42
41
  const size = useResponsiveSize(scale);
43
42
 
44
43
  const handleClaimReward = (taskKey: string, type: TaskType) => {
45
- setLocalTasks(prevTasks =>
46
- prevTasks.map(task =>
47
- task.key === taskKey ? { ...task, claimed: true } : task
48
- )
49
- );
50
- onClaimReward({ type, taskKey });
44
+ onClaimReward({
45
+ type,
46
+ taskKey,
47
+ });
51
48
  };
52
49
 
53
- const handleClaimAllRewards = () => {
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 });
50
+ const handleClaimGlobalRewards = (tasks: ICollectGlobalRewardRequest) => {
51
+ onClaimGlobalReward(tasks);
62
52
  };
63
53
 
64
54
  if (!size) return null;
@@ -77,7 +67,7 @@ export const DailyTasks: React.FC<IDailyTasksProps> = ({
77
67
  <TasksList className="tasks-container">
78
68
  <GlobalDailyProgress
79
69
  tasks={localTasks}
80
- onClaimAllRewards={handleClaimAllRewards}
70
+ onClaimAllRewards={handleClaimGlobalRewards}
81
71
  />
82
72
  {localTasks.map(task => (
83
73
  <DailyTaskItem
@@ -44,9 +44,9 @@ export const GlobalDailyProgress: React.FC<IGlobalTaskProgressProps> = ({
44
44
  <ProgressBar>
45
45
  <ProgressFill percentage={(completedTasks / totalTasks) * 100} />
46
46
  </ProgressBar>
47
- {totalTasks > 0 && allCompleted && allClaimed && (
47
+ {totalTasks > 0 && allCompleted && (
48
48
  <>
49
- {isClaimed ? (
49
+ {allClaimed || isClaimed ? (
50
50
  <ClaimedText>Global Rewards Claimed</ClaimedText>
51
51
  ) : (
52
52
  <CollectWrapper>
@@ -36,6 +36,7 @@ export const mockTasks: ICharacterDailyTask[] = [
36
36
  },
37
37
  {
38
38
  type: RewardType.Experience,
39
+ texturePath: 'others/royal-chalice.png',
39
40
  quantity: 100
40
41
  }
41
42
  ]
@@ -62,6 +63,7 @@ export const mockTasks: ICharacterDailyTask[] = [
62
63
  {
63
64
  type: RewardType.Gold,
64
65
  key: 'gold-coin',
66
+ texturePath: 'others/gold-coin-qty-6.png',
65
67
  quantity: 100
66
68
  },
67
69
  {
@@ -72,6 +74,7 @@ export const mockTasks: ICharacterDailyTask[] = [
72
74
  },
73
75
  {
74
76
  type: RewardType.Experience,
77
+ texturePath: 'others/royal-chalice.png',
75
78
  quantity: 250
76
79
  }
77
80
  ],
@@ -100,6 +103,7 @@ export const mockTasks: ICharacterDailyTask[] = [
100
103
  {
101
104
  type: RewardType.Gold,
102
105
  key: 'gold-coin',
106
+ texturePath: 'others/gold-coin-qty-6.png',
103
107
  quantity: 1000
104
108
  },
105
109
  {
@@ -110,6 +114,7 @@ export const mockTasks: ICharacterDailyTask[] = [
110
114
  },
111
115
  {
112
116
  type: RewardType.Experience,
117
+ texturePath: 'others/royal-chalice.png',
113
118
  quantity: 1000
114
119
  }
115
120
  ],
@@ -129,11 +134,13 @@ export const mockTasks: ICharacterDailyTask[] = [
129
134
  rewards: [
130
135
  {
131
136
  type: RewardType.Experience,
137
+ texturePath: 'others/royal-chalice.png',
132
138
  quantity: 10000
133
139
  },
134
140
  {
135
141
  type: RewardType.Gold,
136
142
  key: 'gold-coin',
143
+ texturePath: 'others/gold-coin-qty-6.png',
137
144
  quantity: 1000
138
145
  },
139
146
  {
@@ -181,7 +188,7 @@ export const mockTasks: ICharacterDailyTask[] = [
181
188
  ]
182
189
  },
183
190
  progress: {
184
- crafted: { 'life-potion': 2 },
191
+ crafted: { 'life-potion': 5 },
185
192
  },
186
193
  rewards: [
187
194
  {
@@ -193,14 +200,16 @@ export const mockTasks: ICharacterDailyTask[] = [
193
200
  {
194
201
  type: RewardType.Gold,
195
202
  key: 'gold-coin',
203
+ texturePath: 'others/gold-coin-qty-6.png',
196
204
  quantity: 150
197
205
  },
198
206
  {
199
207
  type: RewardType.Experience,
208
+ texturePath: 'others/royal-chalice.png',
200
209
  quantity: 200
201
210
  }
202
211
  ],
203
- status: TaskStatus.InProgress,
204
- claimed: false
212
+ status: TaskStatus.Completed,
213
+ claimed: true
205
214
  },
206
215
  ];