ps99-api 2.3.2 → 2.4.0

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.
Files changed (53) hide show
  1. package/.idea/node-ps99-api.iml +1 -0
  2. package/README.md +1 -1
  3. package/dist/responses/collection/achievement.d.ts +2 -0
  4. package/dist/responses/collection/guild-battle.d.ts +2 -4
  5. package/dist/responses/collection/rank.d.ts +1 -0
  6. package/dist/responses/collection/seed.d.ts +1 -0
  7. package/dist/responses/exists.d.ts +2 -0
  8. package/example-web/react2/public/service-worker.js +6 -6
  9. package/example-web/react2/src/App.tsx +8 -2
  10. package/example-web/react2/src/components/AchievementsComponent.tsx +23 -30
  11. package/example-web/react2/src/components/BoostsComponent.tsx +6 -13
  12. package/example-web/react2/src/components/BoothsComponent.tsx +52 -20
  13. package/example-web/react2/src/components/BoxesComponent.tsx +17 -24
  14. package/example-web/react2/src/components/BuffsComponent.tsx +35 -13
  15. package/example-web/react2/src/components/CharmsComponent.tsx +25 -30
  16. package/example-web/react2/src/components/CurrencyComponent.tsx +37 -44
  17. package/example-web/react2/src/components/DynamicCollectionConfigData.tsx +23 -4
  18. package/example-web/react2/src/components/EggsComponent.tsx +39 -44
  19. package/example-web/react2/src/components/EnchantsComponent.tsx +43 -34
  20. package/example-web/react2/src/components/FishingRodsComponent.tsx +23 -30
  21. package/example-web/react2/src/components/Footer.tsx +80 -16
  22. package/example-web/react2/src/components/FruitsComponent.tsx +18 -25
  23. package/example-web/react2/src/components/GenericFetchComponent.tsx +31 -21
  24. package/example-web/react2/src/components/GuildBattlesComponent.tsx +86 -65
  25. package/example-web/react2/src/components/HomePage.tsx +3 -1
  26. package/example-web/react2/src/components/HoverboardsComponent.tsx +100 -36
  27. package/example-web/react2/src/components/LootboxesComponent.tsx +8 -15
  28. package/example-web/react2/src/components/MasteryComponent.tsx +17 -24
  29. package/example-web/react2/src/components/MerchantsComponent.tsx +16 -23
  30. package/example-web/react2/src/components/MiscItemsComponent.tsx +32 -25
  31. package/example-web/react2/src/components/PetsComponent.tsx +74 -44
  32. package/example-web/react2/src/components/PotionsComponent.tsx +37 -36
  33. package/example-web/react2/src/components/RandomEventsComponent.tsx +30 -35
  34. package/example-web/react2/src/components/RanksComponent.tsx +58 -67
  35. package/example-web/react2/src/components/RarityComponent.tsx +7 -14
  36. package/example-web/react2/src/components/RebirthsComponent.tsx +20 -26
  37. package/example-web/react2/src/components/SecretRoomsComponent.tsx +6 -13
  38. package/example-web/react2/src/components/SeedsComponent.tsx +15 -22
  39. package/example-web/react2/src/components/ShovelsComponent.tsx +9 -16
  40. package/example-web/react2/src/components/SprinklersComponent.tsx +11 -18
  41. package/example-web/react2/src/components/UltimatesComponent.tsx +17 -24
  42. package/example-web/react2/src/components/UpgradesComponent.tsx +49 -54
  43. package/example-web/react2/src/components/WateringCansComponent.tsx +15 -19
  44. package/example-web/react2/src/components/WorldsComponent.tsx +16 -23
  45. package/example-web/react2/src/components/XPPotionsComponent.tsx +12 -19
  46. package/example-web/react2/src/components/ZoneFlagsComponent.tsx +15 -22
  47. package/example-web/react2/src/components/ZonesComponent.tsx +69 -69
  48. package/package.json +1 -1
  49. package/src/responses/collection/achievement.ts +2 -0
  50. package/src/responses/collection/guild-battle.ts +2 -4
  51. package/src/responses/collection/rank.ts +1 -0
  52. package/src/responses/collection/seed.ts +1 -0
  53. package/src/responses/exists.ts +2 -0
@@ -5,6 +5,7 @@
5
5
  <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
6
  <excludeFolder url="file://$MODULE_DIR$/temp" />
7
7
  <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ <excludeFolder url="file://$MODULE_DIR$/dist" />
8
9
  </content>
9
10
  <orderEntry type="inheritedJdk" />
10
11
  <orderEntry type="sourceFolder" forTests="false" />
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # ps99-api
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/ps99-api.svg)](https://badge.fury.io/js/ps99-api)
4
- ![Website](https://img.shields.io/website?url=https%3A%2F%2Fjoekiller.github.io%2Fnode-ps99-api)
4
+ [![Website](https://img.shields.io/website?url=https%3A%2F%2Fjoekiller.github.io%2Fnode-ps99-api)](https://joekiller.github.io/node-ps99-api/)
5
5
 
6
6
  Pet Simulator Public API wrapper written in Typescript.
7
7
 
@@ -26,7 +26,9 @@ export type AchievementRewardItem = {
26
26
  };
27
27
  export type AchievementRewardData = {
28
28
  id: string;
29
+ /** potions: enchants, etc: tn is tier number */
29
30
  tn?: number;
30
31
  _am?: number;
32
+ /** For pets: pt=1 is golden, p2=2 is rainbow */
31
33
  pt?: number;
32
34
  };
@@ -18,13 +18,11 @@ export type GuildBattleItem = {
18
18
  };
19
19
  export type GuildBattleItemData = {
20
20
  id: string;
21
+ /** For pets: pt=1 is golden, p2=2 is rainbow */
21
22
  pt?: number;
22
23
  };
23
24
  export type GuildBattleRewards = {
24
- Bronze: GuildBattleRewardItem[];
25
- Gold: GuildBattleRewardItem[];
26
- Good?: GuildBattleRewardItem[];
27
- Silver: GuildBattleRewardItem[];
25
+ [key: string]: GuildBattleRewardItem[];
28
26
  };
29
27
  export type GuildBattleRewardItem = {
30
28
  _data: GuildBattleRewardItemData;
@@ -32,5 +32,6 @@ export type RankRewardItem = {
32
32
  export type RankRewardItemData = {
33
33
  _am?: number;
34
34
  id: string;
35
+ /** For potions: enchants, etc: tn is tier number */
35
36
  tn?: number;
36
37
  };
@@ -42,6 +42,7 @@ export interface LootTableValue {
42
42
  export type RawStackKey = string;
43
43
  export interface LootTableData {
44
44
  id: string;
45
+ /** For potions: enchants, etc: tn is tier number */
45
46
  tn?: number;
46
47
  _am?: number;
47
48
  }
@@ -5,7 +5,9 @@ export type ExistsData = {
5
5
  };
6
6
  export type ExistsConfigData = {
7
7
  id: string;
8
+ /** for pets pt=1 is golden, p2=2 is rainbow */
8
9
  pt?: number;
10
+ /** for pets sh is shiny */
9
11
  sh?: boolean;
10
12
  };
11
13
  export type ExistsResponseBody = {
@@ -1,11 +1,11 @@
1
1
  const CACHE_NAME = "ps99-cache-v2";
2
2
  const urlsToCache = [
3
- "/",
4
- "/bundle.js",
5
- "/manifest.json",
6
- "/icons/icon-192x192.png",
7
- "/icons/icon-512x512.png",
8
- "/collections",
3
+ "/node-ps99-api/",
4
+ "/node-ps99-api/bundle.js",
5
+ "/node-ps99-api/manifest.json",
6
+ "/node-ps99-api/icons/icon-192x192.png",
7
+ "/node-ps99-api/icons/icon-512x512.png",
8
+ "/node-ps99-api/collections",
9
9
  ];
10
10
 
11
11
  self.addEventListener("install", (event) => {
@@ -14,8 +14,14 @@ const App: React.FC = () => {
14
14
  <Routes>
15
15
  <Route path="/" element={<HomePage />} />
16
16
  <Route path="/collections" element={<CollectionsIndex />} />
17
- <Route path="/collections/:collectionName" element={<CollectionConfigIndex />} />
18
- <Route path="/collections/:collectionName/:configName" element={<DynamicCollectionConfigData />} />
17
+ <Route
18
+ path="/collections/:collectionName"
19
+ element={<CollectionConfigIndex />}
20
+ />
21
+ <Route
22
+ path="/collections/:collectionName/:configName"
23
+ element={<DynamicCollectionConfigData />}
24
+ />
19
25
  </Routes>
20
26
  <Footer />
21
27
  </Router>
@@ -1,40 +1,33 @@
1
1
  import React from "react";
2
2
  import { CollectionConfigData } from "ps99-api";
3
- import { GenericFetchComponent } from "./GenericFetchComponent";
4
3
  import ImageComponent from "./ImageComponent";
5
4
 
6
5
  const AchievementsComponent: React.FC<{
7
- configData?: CollectionConfigData<"Achievements">;
6
+ configData: CollectionConfigData<"Achievements">;
8
7
  }> = ({ configData }) => {
9
8
  return (
10
- <GenericFetchComponent<CollectionConfigData<"Achievements">>
11
- collectionName="Achievements"
12
- configData={configData}
13
- render={(data) => (
14
- <div>
15
- <h2>{data.Name}</h2>
16
- <ImageComponent src={data.Icon} alt={data.Name} />
17
- <ul>
18
- {data.Tiers.map((tier, index) => (
19
- <li key={index}>
20
- <h3>{tier.Title}</h3>
21
- <p>{tier.Desc.replace("{amount}", tier.Amount.toString())}</p>
22
- <p>Difficulty: {tier.Difficulty.Name}</p>
23
- <p>Amount: {tier.Amount}</p>
24
- <ul>
25
- {tier.Rewards.map((reward, rewardIndex) => (
26
- <li key={rewardIndex}>
27
- Reward ID: {reward.Reward._data.id} Amount:{" "}
28
- {reward.Reward._data._am}
29
- </li>
30
- ))}
31
- </ul>
32
- </li>
33
- ))}
34
- </ul>
35
- </div>
36
- )}
37
- />
9
+ <div>
10
+ <h2>{configData.Name}</h2>
11
+ <ImageComponent src={configData.Icon} alt={configData.Name} />
12
+ <ul>
13
+ {configData.Tiers.map((tier, index) => (
14
+ <li key={index}>
15
+ <h3>{tier.Title}</h3>
16
+ <p>{tier.Desc.replace("{amount}", tier.Amount.toString())}</p>
17
+ <p>Difficulty: {tier.Difficulty.Name}</p>
18
+ <p>Amount: {tier.Amount}</p>
19
+ <ul>
20
+ {tier.Rewards.map((reward, rewardIndex) => (
21
+ <li key={rewardIndex}>
22
+ Reward ID: {reward.Reward._data.id} Amount:{" "}
23
+ {reward.Reward._data._am}
24
+ </li>
25
+ ))}
26
+ </ul>
27
+ </li>
28
+ ))}
29
+ </ul>
30
+ </div>
38
31
  );
39
32
  };
40
33
 
@@ -1,23 +1,16 @@
1
1
  import React from "react";
2
2
  import { CollectionConfigData } from "ps99-api";
3
- import { GenericFetchComponent } from "./GenericFetchComponent";
4
3
  import ImageComponent from "./ImageComponent";
5
4
 
6
5
  const BoostsComponent: React.FC<{
7
- configData?: CollectionConfigData<"Boosts">;
6
+ configData: CollectionConfigData<"Boosts">;
8
7
  }> = ({ configData }) => {
9
8
  return (
10
- <GenericFetchComponent<CollectionConfigData<"Boosts">>
11
- collectionName="Boosts"
12
- configData={configData}
13
- render={(data) => (
14
- <div>
15
- <h2>{data.DisplayName}</h2>
16
- <ImageComponent src={data.Icon} alt={data.DisplayName} />
17
- <p>Maximum Percent: {data.MaximumPercent}%</p>
18
- </div>
19
- )}
20
- />
9
+ <div>
10
+ <h2>{configData.DisplayName}</h2>
11
+ <ImageComponent src={configData.Icon} alt={configData.DisplayName} />
12
+ <p>Maximum Percent: {configData.MaximumPercent}%</p>
13
+ </div>
21
14
  );
22
15
  };
23
16
 
@@ -1,31 +1,63 @@
1
1
  import React from "react";
2
2
  import { CollectionConfigData } from "ps99-api";
3
- import { GenericFetchComponent } from "./GenericFetchComponent";
4
3
  import ImageComponent from "./ImageComponent";
5
4
 
6
5
  const BoothsComponent: React.FC<{
7
- configData?: CollectionConfigData<"Booths">;
6
+ configData: CollectionConfigData<"Booths">;
8
7
  }> = ({ configData }) => {
9
8
  return (
10
- <GenericFetchComponent<CollectionConfigData<"Booths">>
11
- collectionName="Booths"
12
- configData={configData}
13
- render={(data) => (
14
- <div>
15
- <h2>{data.DisplayName}</h2>
16
- <ImageComponent src={data.Icon} alt={data.DisplayName} />
17
- <p>Description: {data.Desc}</p>
18
- <p>Rarity: {data.Rarity.DisplayName}</p>
19
- <p>Rarity Number: {data.Rarity.RarityNumber}</p>
20
- {data.Hidden && <p>Hidden: Yes</p>}
21
- {data.Tradable && <p>Tradable: Yes</p>}
22
- {data.OffSale && <p>Off Sale: Yes</p>}
23
- {data.ProductId && <p>Product ID: {data.ProductId}</p>}
24
- {data.DiamondPrice && <p>Diamond Price: {data.DiamondPrice}</p>}
25
- {data.Sittable && <p>Sittable: Yes</p>}
26
- </div>
9
+ <div
10
+ style={{
11
+ padding: "1em",
12
+ border: "1px solid #ccc",
13
+ borderRadius: "8px",
14
+ backgroundColor: "#f9f9f9",
15
+ }}
16
+ >
17
+ <h2 style={{ borderBottom: "2px solid #ccc", paddingBottom: "0.5em" }}>
18
+ {configData.DisplayName}
19
+ </h2>
20
+ <ImageComponent src={configData.Icon} alt={configData.DisplayName} />
21
+ <p>
22
+ <strong>Description:</strong> {configData.Desc}
23
+ </p>
24
+ <p>
25
+ <strong>Rarity:</strong> {configData.Rarity.DisplayName}
26
+ </p>
27
+ <p>
28
+ <strong>Rarity Number:</strong> {configData.Rarity.RarityNumber}
29
+ </p>
30
+ {configData.Hidden && (
31
+ <p>
32
+ <strong>Hidden:</strong> Yes
33
+ </p>
27
34
  )}
28
- />
35
+ {configData.Tradable && (
36
+ <p>
37
+ <strong>Tradable:</strong> Yes
38
+ </p>
39
+ )}
40
+ {configData.OffSale && (
41
+ <p>
42
+ <strong>Off Sale:</strong> Yes
43
+ </p>
44
+ )}
45
+ {configData.ProductId && (
46
+ <p>
47
+ <strong>Product ID:</strong> {configData.ProductId}
48
+ </p>
49
+ )}
50
+ {configData.DiamondPrice && (
51
+ <p>
52
+ <strong>Diamond Price:</strong> {configData.DiamondPrice}
53
+ </p>
54
+ )}
55
+ {configData.Sittable && (
56
+ <p>
57
+ <strong>Sittable:</strong> Yes
58
+ </p>
59
+ )}
60
+ </div>
29
61
  );
30
62
  };
31
63
 
@@ -1,34 +1,27 @@
1
1
  import React from "react";
2
2
  import { CollectionConfigData } from "ps99-api";
3
- import { GenericFetchComponent } from "./GenericFetchComponent";
4
3
  import ImageComponent from "./ImageComponent";
5
4
 
6
5
  const BoxesComponent: React.FC<{
7
- configData?: CollectionConfigData<"Boxes">;
6
+ configData: CollectionConfigData<"Boxes">;
8
7
  }> = ({ configData }) => {
9
8
  return (
10
- <GenericFetchComponent<CollectionConfigData<"Boxes">>
11
- collectionName="Boxes"
12
- configData={configData}
13
- render={(data) => (
14
- <div>
15
- <h2>{data.DisplayName}</h2>
16
- <p>Description: {data.Desc}</p>
17
- <p>Capacity: {data.Capacity}</p>
18
- <p>Rarity: {data.Rarity.DisplayName}</p>
19
- <p>Rarity Number: {data.Rarity.RarityNumber}</p>
20
- <h3>Icons:</h3>
21
- <ul>
22
- {data.Icons.map((icon, index) => (
23
- <li key={index}>
24
- <ImageComponent src={icon.Icon} alt={icon.Name} />
25
- <span>{icon.Name}</span>
26
- </li>
27
- ))}
28
- </ul>
29
- </div>
30
- )}
31
- />
9
+ <div>
10
+ <h2>{configData.DisplayName}</h2>
11
+ <p>Description: {configData.Desc}</p>
12
+ <p>Capacity: {configData.Capacity}</p>
13
+ <p>Rarity: {configData.Rarity.DisplayName}</p>
14
+ <p>Rarity Number: {configData.Rarity.RarityNumber}</p>
15
+ <h3>Icons:</h3>
16
+ <ul>
17
+ {configData.Icons.map((icon, index) => (
18
+ <li key={index}>
19
+ <ImageComponent src={icon.Icon} alt={icon.Name} />
20
+ <span>{icon.Name}</span>
21
+ </li>
22
+ ))}
23
+ </ul>
24
+ </div>
32
25
  );
33
26
  };
34
27
 
@@ -1,24 +1,46 @@
1
1
  import React from "react";
2
2
  import { CollectionConfigData } from "ps99-api";
3
- import { GenericFetchComponent } from "./GenericFetchComponent";
3
+ import DynamicCollectionConfigData from "./DynamicCollectionConfigData";
4
4
 
5
5
  const BuffsComponent: React.FC<{
6
- configData?: CollectionConfigData<"Buffs">;
6
+ configData: CollectionConfigData<"Buffs">;
7
7
  }> = ({ configData }) => {
8
8
  return (
9
- <GenericFetchComponent<CollectionConfigData<"Buffs">>
10
- collectionName="Buffs"
11
- configData={configData}
12
- render={(data) => (
13
- <div>
14
- <h2>{data.DisplayName}</h2>
15
- <p>Associated Item ID: {data.AssociatedItemID}</p>
16
- <p>Associated Item Class: {data.AssociatedItemClass}</p>
17
- <p>Length: {data.Length} seconds</p>
18
- {data.IgnoreInstancePause && <p>Ignore Instance Pause: Yes</p>}
9
+ <div
10
+ style={{
11
+ padding: "1em",
12
+ border: "1px solid #ccc",
13
+ borderRadius: "8px",
14
+ marginBottom: "2em",
15
+ }}
16
+ >
17
+ <h2 style={{ borderBottom: "2px solid #ccc", paddingBottom: "0.5em" }}>
18
+ {configData.DisplayName}
19
+ </h2>
20
+ <p>
21
+ <strong>Associated Item ID:</strong> {configData.AssociatedItemID}
22
+ </p>
23
+ <p>
24
+ <strong>Associated Item Class:</strong> {configData.AssociatedItemClass}
25
+ </p>
26
+ <p>
27
+ <strong>Length:</strong> {configData.Length} seconds
28
+ </p>
29
+ {configData.IgnoreInstancePause && (
30
+ <p>
31
+ <strong>Ignore Instance Pause:</strong> Yes
32
+ </p>
33
+ )}
34
+ {configData.AssociatedItemClass === "Misc" && (
35
+ <div style={{ marginTop: "2em" }}>
36
+ <h3>Associated Misc Item</h3>
37
+ <DynamicCollectionConfigData
38
+ collectionName="MiscItems"
39
+ configName={configData.AssociatedItemID}
40
+ />
19
41
  </div>
20
42
  )}
21
- />
43
+ </div>
22
44
  );
23
45
  };
24
46
 
@@ -1,41 +1,36 @@
1
1
  import React from "react";
2
2
  import { CollectionConfigData } from "ps99-api";
3
- import { GenericFetchComponent } from "./GenericFetchComponent";
4
3
  import ImageComponent from "./ImageComponent";
5
4
 
6
5
  const CharmsComponent: React.FC<{
7
- configData?: CollectionConfigData<"Charms">;
6
+ configData: CollectionConfigData<"Charms">;
8
7
  }> = ({ configData }) => {
9
8
  return (
10
- <GenericFetchComponent<CollectionConfigData<"Charms">>
11
- collectionName="Charms"
12
- configData={configData}
13
- render={(data) => (
14
- <div>
15
- <h2>{data.Tiers[0].DisplayName}</h2>
16
- <ImageComponent src={data.Icon} alt={data.Tiers[0].DisplayName} />
17
- <p>Base Tier: {data.BaseTier}</p>
18
- <p>Max Tier: {data.MaxTier}</p>
19
- {data.DiminishPowerThreshold && (
20
- <p>Diminish Power Threshold: {data.DiminishPowerThreshold}</p>
21
- )}
22
- {data.Unique && <p>Unique: Yes</p>}
23
- <h3>Tiers:</h3>
24
- <ul>
25
- {data.Tiers.map((tier, index) => (
26
- <li key={index}>
27
- <p>{tier.DisplayName}</p>
28
- <p>Description: {tier.Desc}</p>
29
- <p>Power: {tier.Power}</p>
30
- <p>Rarity: {tier.Rarity.DisplayName}</p>
31
- <p>Rarity Number: {tier.Rarity.RarityNumber}</p>
32
- </li>
33
- ))}
34
- </ul>
35
- </div>
9
+ <div>
10
+ <h2>{configData.Tiers[0].DisplayName}</h2>
11
+ <ImageComponent
12
+ src={configData.Icon}
13
+ alt={configData.Tiers[0].DisplayName}
14
+ />
15
+ <p>Base Tier: {configData.BaseTier}</p>
16
+ <p>Max Tier: {configData.MaxTier}</p>
17
+ {configData.DiminishPowerThreshold && (
18
+ <p>Diminish Power Threshold: {configData.DiminishPowerThreshold}</p>
36
19
  )}
37
- />
20
+ {configData.Unique && <p>Unique: Yes</p>}
21
+ <h3>Tiers:</h3>
22
+ <ul>
23
+ {configData.Tiers.map((tier, index) => (
24
+ <li key={index}>
25
+ <p>{tier.DisplayName}</p>
26
+ <p>Description: {tier.Desc}</p>
27
+ <p>Power: {tier.Power}</p>
28
+ <p>Rarity: {tier.Rarity.DisplayName}</p>
29
+ <p>Rarity Number: {tier.Rarity.RarityNumber}</p>
30
+ </li>
31
+ ))}
32
+ </ul>
33
+ </div>
38
34
  );
39
35
  };
40
-
41
36
  export default CharmsComponent;
@@ -1,64 +1,57 @@
1
1
  import React from "react";
2
2
  import { CollectionConfigData } from "ps99-api";
3
- import { GenericFetchComponent } from "./GenericFetchComponent";
4
3
  import ImageComponent from "./ImageComponent";
5
4
 
6
5
  const CurrencyComponent: React.FC<{
7
- configData?: CollectionConfigData<"Currency">;
6
+ configData: CollectionConfigData<"Currency">;
8
7
  }> = ({ configData }) => {
9
8
  return (
10
- <GenericFetchComponent<CollectionConfigData<"Currency">>
11
- collectionName="Currency"
12
- configData={configData}
13
- render={(data) => (
9
+ <div>
10
+ <h2>{configData.DisplayName}</h2>
11
+ <p>Description: {configData.Desc}</p>
12
+ <p>Max Amount: {configData.MaxAmount}</p>
13
+ <p>Rarity: {configData.Rarity.DisplayName}</p>
14
+ <p>Rarity Number: {configData.Rarity.RarityNumber}</p>
15
+ {configData.Tradable && <p>Tradable: Yes</p>}
16
+ {configData.IsWorldCurrency && <p>World Currency: Yes</p>}
17
+ {configData.PermitAutoLootScaling && <p>Permit Auto Loot Scaling: Yes</p>}
18
+ <h3>Tiers:</h3>
19
+ <ul>
20
+ {configData.Tiers.map((tier, index) => (
21
+ <li key={index}>
22
+ <ImageComponent src={tier.orbImage} alt={tier.tierName} />
23
+ <p>Tier Name: {tier.tierName}</p>
24
+ <p>Order: {tier.Order}</p>
25
+ <p>Value: {tier.value}</p>
26
+ <ImageComponent
27
+ src={tier.imageOutline}
28
+ alt={`${tier.tierName} outline`}
29
+ />
30
+ {tier.isBottom && <p>Is Bottom: Yes</p>}
31
+ <ImageComponent
32
+ src={tier.tinyImage}
33
+ alt={`${tier.tierName} tiny`}
34
+ />
35
+ </li>
36
+ ))}
37
+ </ul>
38
+ {configData.BagTiers && (
14
39
  <div>
15
- <h2>{data.DisplayName}</h2>
16
- <p>Description: {data.Desc}</p>
17
- <p>Max Amount: {data.MaxAmount}</p>
18
- <p>Rarity: {data.Rarity.DisplayName}</p>
19
- <p>Rarity Number: {data.Rarity.RarityNumber}</p>
20
- {data.Tradable && <p>Tradable: Yes</p>}
21
- {data.IsWorldCurrency && <p>World Currency: Yes</p>}
22
- {data.PermitAutoLootScaling && <p>Permit Auto Loot Scaling: Yes</p>}
23
- <h3>Tiers:</h3>
40
+ <h3>Bag Tiers:</h3>
24
41
  <ul>
25
- {data.Tiers.map((tier, index) => (
42
+ {configData.BagTiers.map((bagTier, index) => (
26
43
  <li key={index}>
27
- <ImageComponent src={tier.orbImage} alt={tier.tierName} />
28
- <p>Tier Name: {tier.tierName}</p>
29
- <p>Order: {tier.Order}</p>
30
- <p>Value: {tier.value}</p>
31
44
  <ImageComponent
32
- src={tier.imageOutline}
33
- alt={`${tier.tierName} outline`}
34
- />
35
- {tier.isBottom && <p>Is Bottom: Yes</p>}
36
- <ImageComponent
37
- src={tier.tinyImage}
38
- alt={`${tier.tierName} tiny`}
45
+ src={bagTier.image}
46
+ alt={`Bag tier ${index + 1}`}
39
47
  />
48
+ <p>Value: {bagTier.value}</p>
40
49
  </li>
41
50
  ))}
42
51
  </ul>
43
- {data.BagTiers && (
44
- <div>
45
- <h3>Bag Tiers:</h3>
46
- <ul>
47
- {data.BagTiers.map((bagTier, index) => (
48
- <li key={index}>
49
- <ImageComponent
50
- src={bagTier.image}
51
- alt={`Bag tier ${index + 1}`}
52
- />
53
- <p>Value: {bagTier.value}</p>
54
- </li>
55
- ))}
56
- </ul>
57
- </div>
58
- )}
59
52
  </div>
60
53
  )}
61
- />
54
+ </div>
62
55
  );
63
56
  };
64
57
 
@@ -1,13 +1,25 @@
1
1
  import React, { lazy, Suspense } from "react";
2
2
  import { useParams } from "react-router-dom";
3
- import { CollectionName } from "ps99-api";
3
+ import { CollectionName, CollectionConfigData } from "ps99-api";
4
+ import { GenericFetchComponent } from "./GenericFetchComponent";
4
5
 
5
- const DynamicCollectionConfigData: React.FC = () => {
6
- const { collectionName, configName } = useParams<{
6
+ interface DynamicCollectionConfigDataProps {
7
+ collectionName?: CollectionName;
8
+ configName?: string;
9
+ render?: (configData: CollectionConfigData<any>) => React.ReactNode; // Add render prop
10
+ }
11
+
12
+ const DynamicCollectionConfigData: React.FC<
13
+ DynamicCollectionConfigDataProps
14
+ > = (props) => {
15
+ const params = useParams<{
7
16
  collectionName: CollectionName;
8
17
  configName: string;
9
18
  }>();
10
19
 
20
+ const collectionName = props.collectionName || params.collectionName;
21
+ const configName = props.configName || params.configName;
22
+
11
23
  if (!collectionName || !configName) {
12
24
  return <div>Invalid collection or config name</div>;
13
25
  }
@@ -16,7 +28,14 @@ const DynamicCollectionConfigData: React.FC = () => {
16
28
 
17
29
  return (
18
30
  <Suspense fallback={<div>Loading...</div>}>
19
- <Component configName={configName} />
31
+ <GenericFetchComponent
32
+ collectionName={collectionName}
33
+ configName={configName}
34
+ render={
35
+ props.render ||
36
+ ((configData) => <Component configData={configData} />)
37
+ } // Use render prop if provided
38
+ />
20
39
  </Suspense>
21
40
  );
22
41
  };