Compare commits
	
		
			2 Commits
		
	
	
		
			8ac0c08592
			...
			ab623059da
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ab623059da | |||
| 6771a129f5 | 
							
								
								
									
										1
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							@ -19,7 +19,6 @@ jobs:
 | 
			
		||||
            - run: npm run lint:ci
 | 
			
		||||
            - run: npm run prettier
 | 
			
		||||
            - run: npm run update-translations
 | 
			
		||||
            - run: npm run fix-imports
 | 
			
		||||
            - name: Fail if there are uncommitted changes
 | 
			
		||||
              run: |
 | 
			
		||||
                  if [[ -n "$(git status --porcelain)" ]]; then
 | 
			
		||||
 | 
			
		||||
@ -22,8 +22,7 @@
 | 
			
		||||
    "lint:fix": "eslint --fix --ext .ts .",
 | 
			
		||||
    "prettier": "prettier --write .",
 | 
			
		||||
    "update-translations": "cd scripts && node update-translations.cjs",
 | 
			
		||||
    "fix-imports": "cd scripts && node fix-imports.cjs",
 | 
			
		||||
    "fix": "npm run update-translations && npm run fix-imports && npm run lint:fix"
 | 
			
		||||
    "fix": "npm run update-translations && npm run lint:fix"
 | 
			
		||||
  },
 | 
			
		||||
  "license": "GNU",
 | 
			
		||||
  "type": "module",
 | 
			
		||||
 | 
			
		||||
@ -1,75 +0,0 @@
 | 
			
		||||
/* eslint-disable */
 | 
			
		||||
const fs = require("fs");
 | 
			
		||||
const path = require("path");
 | 
			
		||||
 | 
			
		||||
const root = path.join(process.cwd(), "..");
 | 
			
		||||
 | 
			
		||||
function listFiles(dir) {
 | 
			
		||||
    const entries = fs.readdirSync(dir, { withFileTypes: true });
 | 
			
		||||
    let results = [];
 | 
			
		||||
    for (const entry of entries) {
 | 
			
		||||
        const fullPath = path.join(dir, entry.name);
 | 
			
		||||
        if (entry.isDirectory()) {
 | 
			
		||||
            results = results.concat(listFiles(fullPath));
 | 
			
		||||
        } else {
 | 
			
		||||
            results.push(fullPath);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return results;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const files = listFiles(path.join(root, "src"));
 | 
			
		||||
 | 
			
		||||
for (const file of files) {
 | 
			
		||||
    let content;
 | 
			
		||||
    try {
 | 
			
		||||
        content = fs.readFileSync(file, "utf8");
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
        continue;
 | 
			
		||||
    }
 | 
			
		||||
    const dir = path.dirname(file);
 | 
			
		||||
    const fixedContent = content.replaceAll(/from "([^"]+)";/g, (sub, importPath) => {
 | 
			
		||||
        if (importPath.startsWith("@/") || importPath.startsWith(".")) {
 | 
			
		||||
            const base = importPath.startsWith("@/")
 | 
			
		||||
                ? path.join(root, importPath.slice(2))
 | 
			
		||||
                : path.resolve(dir, importPath);
 | 
			
		||||
            let target = base;
 | 
			
		||||
 | 
			
		||||
            if (fs.existsSync(target)) {
 | 
			
		||||
                const stat = fs.statSync(target);
 | 
			
		||||
                if (stat.isDirectory()) {
 | 
			
		||||
                    if (fs.existsSync(path.join(target, "index.ts"))) {
 | 
			
		||||
                        target = path.join(target, "index.ts");
 | 
			
		||||
                    } else {
 | 
			
		||||
                        return sub;
 | 
			
		||||
                    }
 | 
			
		||||
                } else {
 | 
			
		||||
                    const ext = path.extname(target);
 | 
			
		||||
                    if (!ext) {
 | 
			
		||||
                        target += ".ts";
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            } else if (fs.existsSync(target + ".ts")) {
 | 
			
		||||
                target += ".ts";
 | 
			
		||||
            } else if (fs.existsSync(path.join(target, "index.ts"))) {
 | 
			
		||||
                target = path.join(target, "index.ts");
 | 
			
		||||
            } else {
 | 
			
		||||
                return sub;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            let relative = path.relative(dir, target).replace(/\\/g, "/");
 | 
			
		||||
            if (!path.extname(relative)) {
 | 
			
		||||
                relative += ".ts";
 | 
			
		||||
            }
 | 
			
		||||
            if (!relative.startsWith(".")) {
 | 
			
		||||
                relative = "./" + relative;
 | 
			
		||||
            }
 | 
			
		||||
            console.log(`${importPath} -> ${relative}`);
 | 
			
		||||
            return sub.split(importPath).join(relative);
 | 
			
		||||
        }
 | 
			
		||||
        return sub;
 | 
			
		||||
    });
 | 
			
		||||
    if (content != fixedContent) {
 | 
			
		||||
        fs.writeFileSync(file, fixedContent, "utf8");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								src/controllers/api/upgradeOperatorController.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/controllers/api/upgradeOperatorController.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,16 @@
 | 
			
		||||
import { getInventory, updateCurrency } from "../../services/inventoryService.ts";
 | 
			
		||||
import { getAccountIdForRequest } from "../../services/loginService.ts";
 | 
			
		||||
import type { RequestHandler } from "express";
 | 
			
		||||
 | 
			
		||||
export const upgradeOperatorController: RequestHandler = async (req, res) => {
 | 
			
		||||
    const accountId = await getAccountIdForRequest(req);
 | 
			
		||||
    const inventory = await getInventory(
 | 
			
		||||
        accountId,
 | 
			
		||||
        "OperatorCustomizationSlotPurchases PremiumCredits PremiumCreditsFree"
 | 
			
		||||
    );
 | 
			
		||||
    inventory.OperatorCustomizationSlotPurchases ??= 0;
 | 
			
		||||
    inventory.OperatorCustomizationSlotPurchases += 1;
 | 
			
		||||
    const inventoryChanges = updateCurrency(inventory, 10, true);
 | 
			
		||||
    await inventory.save();
 | 
			
		||||
    res.json({ InventoryChanges: inventoryChanges });
 | 
			
		||||
};
 | 
			
		||||
@ -1564,6 +1564,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
			
		||||
        OperatorLoadOuts: [operatorConfigSchema],
 | 
			
		||||
        //Drifter
 | 
			
		||||
        AdultOperatorLoadOuts: [operatorConfigSchema],
 | 
			
		||||
        OperatorCustomizationSlotPurchases: Number,
 | 
			
		||||
        // Kahl
 | 
			
		||||
        KahlLoadOuts: [operatorConfigSchema],
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -162,6 +162,7 @@ import { updateQuestController } from "../controllers/api/updateQuestController.
 | 
			
		||||
import { updateSessionGetController, updateSessionPostController } from "../controllers/api/updateSessionController.ts";
 | 
			
		||||
import { updateSongChallengeController } from "../controllers/api/updateSongChallengeController.ts";
 | 
			
		||||
import { updateThemeController } from "../controllers/api/updateThemeController.ts";
 | 
			
		||||
import { upgradeOperatorController } from "../controllers/api/upgradeOperatorController.ts";
 | 
			
		||||
import { upgradesController } from "../controllers/api/upgradesController.ts";
 | 
			
		||||
import { valenceSwapController } from "../controllers/api/valenceSwapController.ts";
 | 
			
		||||
import { wishlistController } from "../controllers/api/wishlistController.ts";
 | 
			
		||||
@ -229,6 +230,7 @@ apiRouter.get("/startLibraryPersonalTarget.php", startLibraryPersonalTargetContr
 | 
			
		||||
apiRouter.get("/surveys.php", surveysController);
 | 
			
		||||
apiRouter.get("/trading.php", tradingController);
 | 
			
		||||
apiRouter.get("/updateSession.php", updateSessionGetController);
 | 
			
		||||
apiRouter.get("/upgradeOperator.php", upgradeOperatorController);
 | 
			
		||||
 | 
			
		||||
// post
 | 
			
		||||
apiRouter.post("/abortDojoComponent.php", abortDojoComponentController);
 | 
			
		||||
 | 
			
		||||
@ -374,6 +374,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
			
		||||
    CrewMembers: ICrewMemberClient[];
 | 
			
		||||
    LotusCustomization?: ILotusCustomization;
 | 
			
		||||
    UseAdultOperatorLoadout?: boolean;
 | 
			
		||||
    OperatorCustomizationSlotPurchases?: number;
 | 
			
		||||
    NemesisAbandonedRewards: string[];
 | 
			
		||||
    LastInventorySync?: IOid;
 | 
			
		||||
    NextRefill?: IMongoDate;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user