From dd09113cbfc98f7bfa680f54f39f2fb5c460f2b6 Mon Sep 17 00:00:00 2001 From: Starknet Dev Date: Mon, 7 Oct 2024 13:12:29 +0100 Subject: [PATCH] force item xp and special details on purchase --- indexer/src/items.ts | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/indexer/src/items.ts b/indexer/src/items.ts index 520c2e85d..ae76af9c5 100644 --- a/indexer/src/items.ts +++ b/indexer/src/items.ts @@ -1,43 +1,43 @@ import type { Config } from "https://esm.sh/@apibara/indexer"; -import type { Block, Starknet } from "https://esm.sh/@apibara/indexer/starknet"; -import type { Mongo } from "https://esm.sh/@apibara/indexer/sink/mongo"; import type { Console } from "https://esm.sh/@apibara/indexer/sink/console"; +import type { Mongo } from "https://esm.sh/@apibara/indexer/sink/mongo"; +import type { Block, Starknet } from "https://esm.sh/@apibara/indexer/starknet"; +import { MONGO_CONNECTION_STRING } from "./utils/constants.ts"; +import { GameData } from "./utils/data.ts"; +import { checkExistsInt } from "./utils/encode.ts"; import { ADVENTURER_UPGRADED, + DISCOVERED_LOOT, DODGED_OBSTACLE, DROPPED_ITEMS, + EQUIPMENT_CHANGED, EQUIPPED_ITEMS, HIT_BY_OBSTACLE, ITEMS_LEVELED_UP, - UPGRADES_AVAILABLE, parseAdventurerUpgraded, + parseDiscoveredLoot, parseDodgedObstacle, parseDroppedItems, + parseEquipmentChanged, parseEquippedItems, parseHitByObstacle, - parseUpgradesAvailable, parseItemsLeveledUp, parsePurchasedItems, parseSlayedBeast, parseStartGame, + parseTransfer, + parseUpgradesAvailable, PURCHASED_ITEMS, SLAYED_BEAST, START_GAME, - DISCOVERED_LOOT, - parseDiscoveredLoot, - EQUIPMENT_CHANGED, - parseEquipmentChanged, TRANSFER, - parseTransfer, + UPGRADES_AVAILABLE, } from "./utils/events.ts"; import { insertItem, updateItemsOwner, updateItemsXP, } from "./utils/helpers.ts"; -import { checkExistsInt } from "./utils/encode.ts"; -import { GameData } from "./utils/data.ts"; -import { MONGO_CONNECTION_STRING } from "./utils/constants.ts"; const gameData = new GameData(); @@ -134,6 +134,12 @@ export default function transform({ header, events }: Block) { slot: gameData.ITEM_SLOTS[item.item.id], type: gameData.ITEM_TYPES[item.item.id], ownerAddress: checkExistsInt(BigInt(as.owner).toString(16)), + xp: 0, + greatness: 1, + special1: 0, + special2: 0, + special3: 0, + isAvailable: false, purchasedTime: new Date().toISOString(), timestamp: new Date().toISOString(), },