chore: use PE+ for boosters #1009
							
								
								
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -12,7 +12,7 @@
 | 
			
		||||
        "copyfiles": "^2.4.1",
 | 
			
		||||
        "express": "^5",
 | 
			
		||||
        "mongoose": "^8.9.4",
 | 
			
		||||
        "warframe-public-export-plus": "^0.5.35",
 | 
			
		||||
        "warframe-public-export-plus": "^0.5.36",
 | 
			
		||||
        "warframe-riven-info": "^0.1.2",
 | 
			
		||||
        "winston": "^3.17.0",
 | 
			
		||||
        "winston-daily-rotate-file": "^5.0.0"
 | 
			
		||||
@ -4093,9 +4093,9 @@
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/warframe-public-export-plus": {
 | 
			
		||||
      "version": "0.5.35",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.35.tgz",
 | 
			
		||||
      "integrity": "sha512-YLQP1n5sOV+PS5hfC4Kuoapa9gsqOy5Qy/E4EYfRV/xJBruFl3tPhbdbgFn3HhL2OBrgRJ8yzT5bjIvaHKhOCw=="
 | 
			
		||||
      "version": "0.5.36",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.36.tgz",
 | 
			
		||||
      "integrity": "sha512-FYZECqBSnynl6lQvcQyEqpnGW9l84wzusekhtwKjvg3280CYdn7g5x0Q9tOMhj1jpc/1tuY+akHtHa94sPtqKw=="
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/warframe-riven-info": {
 | 
			
		||||
      "version": "0.1.2",
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,7 @@
 | 
			
		||||
    "copyfiles": "^2.4.1",
 | 
			
		||||
    "express": "^5",
 | 
			
		||||
    "mongoose": "^8.9.4",
 | 
			
		||||
    "warframe-public-export-plus": "^0.5.35",
 | 
			
		||||
    "warframe-public-export-plus": "^0.5.36",
 | 
			
		||||
    "warframe-riven-info": "^0.1.2",
 | 
			
		||||
    "winston": "^3.17.0",
 | 
			
		||||
    "winston-daily-rotate-file": "^5.0.0"
 | 
			
		||||
 | 
			
		||||
@ -16,8 +16,10 @@ import { logger } from "@/src/utils/logger";
 | 
			
		||||
import worldState from "@/static/fixed_responses/worldState/worldState.json";
 | 
			
		||||
import {
 | 
			
		||||
    ExportBoosterPacks,
 | 
			
		||||
    ExportBoosters,
 | 
			
		||||
    ExportBundles,
 | 
			
		||||
    ExportGear,
 | 
			
		||||
    ExportMisc,
 | 
			
		||||
    ExportResources,
 | 
			
		||||
    ExportSyndicates,
 | 
			
		||||
    ExportVendors,
 | 
			
		||||
@ -247,7 +249,7 @@ export const handleStoreItemAcquisition = async (
 | 
			
		||||
                purchaseResponse = await handleTypesPurchase(internalName, inventory, quantity);
 | 
			
		||||
                break;
 | 
			
		||||
            case "Boosters":
 | 
			
		||||
                purchaseResponse = handleBoostersPurchase(internalName, inventory, durability);
 | 
			
		||||
                purchaseResponse = handleBoostersPurchase(storeItemName, inventory, durability);
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@ -367,32 +369,18 @@ const handleTypesPurchase = async (
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const boosterCollection = [
 | 
			
		||||
    "/Lotus/Types/Boosters/ResourceAmountBooster",
 | 
			
		||||
    "/Lotus/Types/Boosters/AffinityBooster",
 | 
			
		||||
    "/Lotus/Types/Boosters/ResourceDropChanceBooster",
 | 
			
		||||
    "/Lotus/Types/Boosters/CreditBooster"
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
const boosterDuration: Record<TRarity, number> = {
 | 
			
		||||
    COMMON: 3 * 86400,
 | 
			
		||||
    UNCOMMON: 7 * 86400,
 | 
			
		||||
    RARE: 30 * 86400,
 | 
			
		||||
    LEGENDARY: 90 * 86400
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const handleBoostersPurchase = (
 | 
			
		||||
    boosterStoreName: string,
 | 
			
		||||
    inventory: TInventoryDatabaseDocument,
 | 
			
		||||
    durability: TRarity
 | 
			
		||||
): { InventoryChanges: IInventoryChanges } => {
 | 
			
		||||
    const ItemType = boosterStoreName.replace("StoreItem", "");
 | 
			
		||||
    if (!boosterCollection.find(x => x == ItemType)) {
 | 
			
		||||
        logger.error(`unknown booster type: ${ItemType}`);
 | 
			
		||||
    if (!(boosterStoreName in ExportBoosters)) {
 | 
			
		||||
        logger.error(`unknown booster type: ${boosterStoreName}`);
 | 
			
		||||
        return { InventoryChanges: {} };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const ExpiryDate = boosterDuration[durability];
 | 
			
		||||
    const ItemType = ExportBoosters[boosterStoreName].typeName;
 | 
			
		||||
    const ExpiryDate = ExportMisc.boosterDurations[durability];
 | 
			
		||||
 | 
			
		||||
    addBooster(ItemType, ExpiryDate, inventory);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user