feat: selling for Dirac (CrewShipFusionPoints) #2540
@ -9,7 +9,8 @@ import {
 | 
				
			|||||||
    freeUpSlot,
 | 
					    freeUpSlot,
 | 
				
			||||||
    combineInventoryChanges,
 | 
					    combineInventoryChanges,
 | 
				
			||||||
    addCrewShipRawSalvage,
 | 
					    addCrewShipRawSalvage,
 | 
				
			||||||
    addFusionPoints
 | 
					    addFusionPoints,
 | 
				
			||||||
 | 
					    addCrewShipFusionPoints
 | 
				
			||||||
} from "@/src/services/inventoryService";
 | 
					} from "@/src/services/inventoryService";
 | 
				
			||||||
import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
import { ExportDojoRecipes } from "warframe-public-export-plus";
 | 
					import { ExportDojoRecipes } from "warframe-public-export-plus";
 | 
				
			||||||
@ -26,6 +27,8 @@ export const sellController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        requiredFields.add("RegularCredits");
 | 
					        requiredFields.add("RegularCredits");
 | 
				
			||||||
    } else if (payload.SellCurrency == "SC_FusionPoints") {
 | 
					    } else if (payload.SellCurrency == "SC_FusionPoints") {
 | 
				
			||||||
        requiredFields.add("FusionPoints");
 | 
					        requiredFields.add("FusionPoints");
 | 
				
			||||||
 | 
					    } else if (payload.SellCurrency == "SC_CrewShipFusionPoints") {
 | 
				
			||||||
 | 
					        requiredFields.add("CrewShipFusionPoints");
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        requiredFields.add("MiscItems");
 | 
					        requiredFields.add("MiscItems");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -79,6 +82,8 @@ export const sellController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        inventory.RegularCredits += payload.SellPrice;
 | 
					        inventory.RegularCredits += payload.SellPrice;
 | 
				
			||||||
    } else if (payload.SellCurrency == "SC_FusionPoints") {
 | 
					    } else if (payload.SellCurrency == "SC_FusionPoints") {
 | 
				
			||||||
        addFusionPoints(inventory, payload.SellPrice);
 | 
					        addFusionPoints(inventory, payload.SellPrice);
 | 
				
			||||||
 | 
					    } else if (payload.SellCurrency == "SC_CrewShipFusionPoints") {
 | 
				
			||||||
 | 
					        addCrewShipFusionPoints(inventory, payload.SellPrice);
 | 
				
			||||||
    } else if (payload.SellCurrency == "SC_PrimeBucks") {
 | 
					    } else if (payload.SellCurrency == "SC_PrimeBucks") {
 | 
				
			||||||
        addMiscItems(inventory, [
 | 
					        addMiscItems(inventory, [
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@ -330,7 +335,8 @@ interface ISellRequest {
 | 
				
			|||||||
        | "SC_FusionPoints"
 | 
					        | "SC_FusionPoints"
 | 
				
			||||||
        | "SC_DistillPoints"
 | 
					        | "SC_DistillPoints"
 | 
				
			||||||
        | "SC_CrewShipFusionPoints"
 | 
					        | "SC_CrewShipFusionPoints"
 | 
				
			||||||
        | "SC_Resources";
 | 
					        | "SC_Resources"
 | 
				
			||||||
 | 
					        | "somethingelsewemightnotknowabout";
 | 
				
			||||||
    buildLabel: string;
 | 
					    buildLabel: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1437,6 +1437,8 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
				
			|||||||
        PremiumCreditsFree: { type: Number, default: 0 },
 | 
					        PremiumCreditsFree: { type: Number, default: 0 },
 | 
				
			||||||
        //Endo
 | 
					        //Endo
 | 
				
			||||||
        FusionPoints: { type: Number, default: 0 },
 | 
					        FusionPoints: { type: Number, default: 0 },
 | 
				
			||||||
 | 
					        //Dirac
 | 
				
			||||||
 | 
					        CrewShipFusionPoints: { type: Number, default: 0 },
 | 
				
			||||||
        //Regal Aya
 | 
					        //Regal Aya
 | 
				
			||||||
        PrimeTokens: { type: Number, default: 0 },
 | 
					        PrimeTokens: { type: Number, default: 0 },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1241,6 +1241,15 @@ export const addFusionPoints = (inventory: TInventoryDatabaseDocument, add: numb
 | 
				
			|||||||
    return add;
 | 
					    return add;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const addCrewShipFusionPoints = (inventory: TInventoryDatabaseDocument, add: number): number => {
 | 
				
			||||||
 | 
					    if (inventory.CrewShipFusionPoints + add > 2147483647) {
 | 
				
			||||||
 | 
					        logger.warn(`capping CrewShipFusionPoints balance at 2147483647`);
 | 
				
			||||||
 | 
					        add = 2147483647 - inventory.CrewShipFusionPoints;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    inventory.CrewShipFusionPoints += add;
 | 
				
			||||||
 | 
					    return add;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const standingLimitBinToInventoryKey: Record<
 | 
					const standingLimitBinToInventoryKey: Record<
 | 
				
			||||||
    Exclude<TStandingLimitBin, "STANDING_LIMIT_BIN_NONE">,
 | 
					    Exclude<TStandingLimitBin, "STANDING_LIMIT_BIN_NONE">,
 | 
				
			||||||
    keyof IDailyAffiliations
 | 
					    keyof IDailyAffiliations
 | 
				
			||||||
 | 
				
			|||||||
@ -215,6 +215,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
				
			|||||||
    PremiumCredits: number;
 | 
					    PremiumCredits: number;
 | 
				
			||||||
    PremiumCreditsFree: number;
 | 
					    PremiumCreditsFree: number;
 | 
				
			||||||
    FusionPoints: number;
 | 
					    FusionPoints: number;
 | 
				
			||||||
 | 
					    CrewShipFusionPoints: number; //Dirac (pre-rework Railjack)
 | 
				
			||||||
    PrimeTokens: number;
 | 
					    PrimeTokens: number;
 | 
				
			||||||
    SuitBin: ISlots;
 | 
					    SuitBin: ISlots;
 | 
				
			||||||
    WeaponBin: ISlots;
 | 
					    WeaponBin: ISlots;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user