@rpg-engine/long-bow 0.8.13 → 0.8.14

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.13",
3
+ "version": "0.8.14",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import { GRID_HEIGHT, GRID_WIDTH } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
- import styled from 'styled-components';
3
+ import styled, { css } from 'styled-components';
4
4
  import { toUppercaseHexColor } from '../../utils/colorUtils';
5
5
 
6
6
  interface IProps {
@@ -53,6 +53,9 @@ export const SpriteFromAtlas: React.FC<IProps> = ({
53
53
  }
54
54
 
55
55
  const normalizedTintColor = toUppercaseHexColor(tintColor);
56
+ // For white tint, we'll use a very light gray instead
57
+ const effectiveTintColor =
58
+ normalizedTintColor === '#FFFFFF' ? '#EEEEEE' : normalizedTintColor;
56
59
 
57
60
  return (
58
61
  <Container
@@ -72,7 +75,7 @@ export const SpriteFromAtlas: React.FC<IProps> = ({
72
75
  style={imgStyle}
73
76
  centered={centered}
74
77
  borderRadius={borderRadius}
75
- tintColor={normalizedTintColor}
78
+ tintColor={effectiveTintColor}
76
79
  />
77
80
  </Container>
78
81
  );
@@ -115,23 +118,59 @@ const ImgSprite = styled.div<IImgSpriteProps>`
115
118
  width: ${props => props.frame.w}px;
116
119
  height: ${props => props.frame.h}px;
117
120
  background-image: url(${props => props.atlasIMG});
118
- background-position: -${props => props.frame.x}px -${props => props.frame.y}px;
121
+ background-position: -${props => props.frame.x}px -${props =>
122
+ props.frame.y}px;
119
123
  transform: scale(${props => props.scale});
120
124
  position: relative;
121
125
  top: ${props => (props.centered ? '0' : '8px')};
122
126
  left: ${props => (props.centered ? '0' : '8px')};
123
- filter: ${props => {
124
- const filters = [];
125
- if (props.grayScale) filters.push('grayscale(100%)');
126
- if (props.tintColor)
127
- filters.push(
128
- `brightness(0.8) contrast(1.2) sepia(100%) hue-rotate(${
129
- props.tintColor === '#FFD700' ? '40deg' : '210deg'
130
- }) saturate(400%)`
131
- );
132
- return filters.length ? filters.join(' ') : 'none';
133
- }};
134
127
  opacity: ${props => props.opacity};
135
128
  border-radius: ${props => props.borderRadius || '0'};
136
129
  overflow: hidden;
130
+
131
+ /* Apply grayscale if needed */
132
+ ${props =>
133
+ props.grayScale &&
134
+ css`
135
+ filter: grayscale(100%);
136
+ `}
137
+
138
+ /* Add tint overlay if tintColor is provided */
139
+ ${props =>
140
+ props.tintColor &&
141
+ css`
142
+ &::before {
143
+ content: '';
144
+ position: absolute;
145
+ top: 0;
146
+ left: 0;
147
+ width: ${props.frame.w}px;
148
+ height: ${props.frame.h}px;
149
+ background-color: ${props.tintColor};
150
+ mix-blend-mode: multiply;
151
+ opacity: 0.6;
152
+ pointer-events: none;
153
+ -webkit-mask-image: url(${props.atlasIMG});
154
+ -webkit-mask-position: -${props.frame.x}px -${props.frame.y}px;
155
+ mask-image: url(${props.atlasIMG});
156
+ mask-position: -${props.frame.x}px -${props.frame.y}px;
157
+ }
158
+
159
+ &::after {
160
+ content: '';
161
+ position: absolute;
162
+ top: 0;
163
+ left: 0;
164
+ width: ${props.frame.w}px;
165
+ height: ${props.frame.h}px;
166
+ background-color: ${props.tintColor};
167
+ mix-blend-mode: soft-light;
168
+ opacity: 0.6;
169
+ pointer-events: none;
170
+ -webkit-mask-image: url(${props.atlasIMG});
171
+ -webkit-mask-position: -${props.frame.x}px -${props.frame.y}px;
172
+ mask-image: url(${props.atlasIMG});
173
+ mask-position: -${props.frame.x}px -${props.frame.y}px;
174
+ }
175
+ `}
137
176
  `;
@@ -8,6 +8,44 @@ import {
8
8
  UserAccountTypes,
9
9
  } from '@rpg-engine/shared';
10
10
 
11
+ const createBagItem = (id: string, tintColor: string): IItem => ({
12
+ _id: id,
13
+ hasUseWith: false,
14
+ type: ItemType.Container,
15
+ subType: ItemSubType.Other,
16
+ textureAtlas: 'items',
17
+ allowedEquipSlotType: [ItemSlotType.Inventory],
18
+ isEquipable: false,
19
+ isStackable: true,
20
+ maxStackSize: 100,
21
+ isUsable: false,
22
+ isStorable: true,
23
+ isTwoHanded: false,
24
+ layer: 1,
25
+ isItemContainer: true,
26
+ isSolid: false,
27
+ key: 'bag',
28
+ texturePath: 'containers/bag.png',
29
+ textureKey: 'bag',
30
+ name: 'Bag',
31
+ generateContainerSlots: 10,
32
+ description:
33
+ 'You see a bag. It has made using leather and it has 10 total slots.',
34
+ attack: 7,
35
+ defense: 3,
36
+ weight: 13,
37
+ tiledId: 67,
38
+ x: 320,
39
+ y: 144,
40
+ scene: 'MainScene',
41
+ fullDescription:
42
+ 'You see a bag. It has made using leather and it has 10 total slots.',
43
+ createdAt: '2022-06-04T03:18:09.335Z',
44
+ updatedAt: '2022-06-04T18:16:49.056Z',
45
+ rarity: ItemRarities.Common,
46
+ tintColor,
47
+ });
48
+
11
49
  export const items: IItem[] = [
12
50
  {
13
51
  _id: '629acef1c7c8e8002ff60736',
@@ -286,44 +324,14 @@ export const items: IItem[] = [
286
324
  updatedAt: '2022-06-04T18:16:49.056Z',
287
325
  rarity: ItemRarities.Common,
288
326
  },
289
- {
290
- _id: '392acek4j7c8e8002ff60404',
291
- hasUseWith: false,
292
- type: ItemType.Container,
293
- subType: ItemSubType.Other,
294
- textureAtlas: 'items',
295
- allowedEquipSlotType: [ItemSlotType.Inventory],
296
- isEquipable: false,
297
- isStackable: true,
298
- maxStackSize: 100,
299
-
300
- isUsable: false,
301
- isStorable: true,
302
- isTwoHanded: false,
303
- layer: 1,
304
- isItemContainer: true,
305
- isSolid: false,
306
- key: 'bag',
307
- texturePath: 'containers/bag.png',
308
- textureKey: 'bag',
309
- name: 'Bag',
310
- generateContainerSlots: 10,
311
- description:
312
- 'You see a bag. It has made using leather and it has 10 total slots.',
313
- attack: 7,
314
- defense: 3,
315
- weight: 13,
316
- tiledId: 67,
317
- x: 320,
318
- y: 144,
319
- scene: 'MainScene',
320
- fullDescription:
321
- 'You see a bag. It has made using leather and it has 10 total slots.',
322
- createdAt: '2022-06-04T03:18:09.335Z',
323
- updatedAt: '2022-06-04T18:16:49.056Z',
324
- rarity: ItemRarities.Common,
325
- tintColor: '#FFD700',
326
- },
327
+ createBagItem('392acek4j7c8e8002ff60404', '#FF0000'), // red
328
+ createBagItem('392acek4j7c8e8002ff60405', '#0000FF'), // blue
329
+ createBagItem('392acek4j7c8e8002ff60406', '#00FF00'), // green
330
+ createBagItem('392acek4j7c8e8002ff60407', '#FFFF00'), // yellow
331
+ createBagItem('392acek4j7c8e8002ff60408', '#800080'), // purple
332
+ createBagItem('392acek4j7c8e8002ff60409', '#FFA500'), // orange
333
+ createBagItem('392acek4j7c8e8002ff60410', '#00FFFF'), // cyan
334
+ createBagItem('392acek4j7c8e8002ff60411', '#FFFFFF'), // white
327
335
  {
328
336
  _id: '392acek4j7c8e80d2fs60404',
329
337
  hasUseWith: false,