forked from OpenWF/SpaceNinjaServer
		
	feat: selling for Dirac (CrewShipFusionPoints) (#2540)
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Reviewed-on: OpenWF/SpaceNinjaServer#2540 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: azdful <mischzaripov@yandex.ru> Co-committed-by: azdful <mischzaripov@yandex.ru>
This commit is contained in:
		
							parent
							
								
									aada031a80
								
							
						
					
					
						commit
						509f7f0d9b
					
				@ -9,7 +9,8 @@ import {
 | 
			
		||||
    freeUpSlot,
 | 
			
		||||
    combineInventoryChanges,
 | 
			
		||||
    addCrewShipRawSalvage,
 | 
			
		||||
    addFusionPoints
 | 
			
		||||
    addFusionPoints,
 | 
			
		||||
    addCrewShipFusionPoints
 | 
			
		||||
} from "@/src/services/inventoryService";
 | 
			
		||||
import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
			
		||||
import { ExportDojoRecipes } from "warframe-public-export-plus";
 | 
			
		||||
@ -26,6 +27,8 @@ export const sellController: RequestHandler = async (req, res) => {
 | 
			
		||||
        requiredFields.add("RegularCredits");
 | 
			
		||||
    } else if (payload.SellCurrency == "SC_FusionPoints") {
 | 
			
		||||
        requiredFields.add("FusionPoints");
 | 
			
		||||
    } else if (payload.SellCurrency == "SC_CrewShipFusionPoints") {
 | 
			
		||||
        requiredFields.add("CrewShipFusionPoints");
 | 
			
		||||
    } else {
 | 
			
		||||
        requiredFields.add("MiscItems");
 | 
			
		||||
    }
 | 
			
		||||
@ -79,6 +82,8 @@ export const sellController: RequestHandler = async (req, res) => {
 | 
			
		||||
        inventory.RegularCredits += payload.SellPrice;
 | 
			
		||||
    } else if (payload.SellCurrency == "SC_FusionPoints") {
 | 
			
		||||
        addFusionPoints(inventory, payload.SellPrice);
 | 
			
		||||
    } else if (payload.SellCurrency == "SC_CrewShipFusionPoints") {
 | 
			
		||||
        addCrewShipFusionPoints(inventory, payload.SellPrice);
 | 
			
		||||
    } else if (payload.SellCurrency == "SC_PrimeBucks") {
 | 
			
		||||
        addMiscItems(inventory, [
 | 
			
		||||
            {
 | 
			
		||||
@ -330,7 +335,8 @@ interface ISellRequest {
 | 
			
		||||
        | "SC_FusionPoints"
 | 
			
		||||
        | "SC_DistillPoints"
 | 
			
		||||
        | "SC_CrewShipFusionPoints"
 | 
			
		||||
        | "SC_Resources";
 | 
			
		||||
        | "SC_Resources"
 | 
			
		||||
        | "somethingelsewemightnotknowabout";
 | 
			
		||||
    buildLabel: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1437,6 +1437,8 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
			
		||||
        PremiumCreditsFree: { type: Number, default: 0 },
 | 
			
		||||
        //Endo
 | 
			
		||||
        FusionPoints: { type: Number, default: 0 },
 | 
			
		||||
        //Dirac
 | 
			
		||||
        CrewShipFusionPoints: { type: Number, default: 0 },
 | 
			
		||||
        //Regal Aya
 | 
			
		||||
        PrimeTokens: { type: Number, default: 0 },
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1241,6 +1241,15 @@ export const addFusionPoints = (inventory: TInventoryDatabaseDocument, add: numb
 | 
			
		||||
    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<
 | 
			
		||||
    Exclude<TStandingLimitBin, "STANDING_LIMIT_BIN_NONE">,
 | 
			
		||||
    keyof IDailyAffiliations
 | 
			
		||||
 | 
			
		||||
@ -215,6 +215,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
			
		||||
    PremiumCredits: number;
 | 
			
		||||
    PremiumCreditsFree: number;
 | 
			
		||||
    FusionPoints: number;
 | 
			
		||||
    CrewShipFusionPoints: number; //Dirac (pre-rework Railjack)
 | 
			
		||||
    PrimeTokens: number;
 | 
			
		||||
    SuitBin: ISlots;
 | 
			
		||||
    WeaponBin: ISlots;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user