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