feat: focus 2.0 #2898
@ -114,6 +114,23 @@ export const focusController: RequestHandler = async (req, res) => {
 | 
			
		||||
            });
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        case "IncreasePool": {
 | 
			
		||||
            const request = JSON.parse(String(req.body)) as IIncreasePoolRequest;
 | 
			
		||||
            const focusPolarity = focusTypeToPolarity(request.FocusType);
 | 
			
		||||
            const inventory = await getInventory(account._id.toString(), "FocusXP FocusCapacity");
 | 
			
		||||
            let cost = 0;
 | 
			
		||||
            for (let capacity = request.CurrentTotalCapacity; capacity != request.NewTotalCapacity; ++capacity) {
 | 
			
		||||
                cost += increasePoolCost[capacity - 5];
 | 
			
		||||
            }
 | 
			
		||||
            inventory.FocusXP![focusPolarity]! -= cost;
 | 
			
		||||
            inventory.FocusCapacity = request.NewTotalCapacity;
 | 
			
		||||
            await inventory.save();
 | 
			
		||||
            res.json({
 | 
			
		||||
                TotalCapacity: request.NewTotalCapacity,
 | 
			
		||||
                FocusPointCosts: { [focusPolarity]: cost }
 | 
			
		||||
            });
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        case "ActivateWay": {
 | 
			
		||||
            const focusType = (JSON.parse(String(req.body)) as IWayRequest).FocusType;
 | 
			
		||||
 | 
			
		||||
@ -261,7 +278,7 @@ enum Focus3Operation {
 | 
			
		||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
 | 
			
		||||
enum Focus2Operation {
 | 
			
		||||
    UnlockWay = "2",
 | 
			
		||||
    IncreasePool = "4", // {"FocusType":"/Lotus/Upgrades/Focus/Defense/DefenseFocusAbility","CurrentTotalCapacity":5,"NewTotalCapacity":7}
 | 
			
		||||
    IncreasePool = "4",
 | 
			
		||||
    UnlockUpgrade = "3",
 | 
			
		||||
    LevelUpUpgrade = "5",
 | 
			
		||||
    ActivateWay = "6",
 | 
			
		||||
@ -279,6 +296,13 @@ interface IUnlockUpgradeRequest {
 | 
			
		||||
    FocusTypes: string[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Focus 2.0
 | 
			
		||||
interface IIncreasePoolRequest {
 | 
			
		||||
    FocusType: string;
 | 
			
		||||
    CurrentTotalCapacity: number;
 | 
			
		||||
    NewTotalCapacity: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface ILevelUpUpgradeRequest {
 | 
			
		||||
    FocusInfos: {
 | 
			
		||||
        ItemType: string;
 | 
			
		||||
@ -321,3 +345,19 @@ const shardValues = {
 | 
			
		||||
    "/Lotus/Types/Gameplay/Eidolon/Resources/SentientShards/SentientShardBrilliantItem": 25_000,
 | 
			
		||||
    "/Lotus/Types/Gameplay/Eidolon/Resources/SentientShards/SentientShardBrilliantTierTwoItem": 40_000
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Starting at a capacity of 5 (Source: https://wiki.warframe.com/w/Focus_2.0)
 | 
			
		||||
const increasePoolCost = [
 | 
			
		||||
    2576, 3099, 3638, 4190, 4755, 5331, 5918, 6514, 7120, 7734, 8357, 8988, 9626, 10271, 10923, 11582, 12247, 12918,
 | 
			
		||||
    13595, 14277, 14965, 15659, 16357, 17061, 17769, 18482, 19200, 19922, 20649, 21380, 22115, 22854, 23597, 24344,
 | 
			
		||||
    25095, 25850, 26609, 27371, 28136, 28905, 29678, 30454, 31233, 32015, 32801, 33590, 34382, 35176, 35974, 36775,
 | 
			
		||||
    37579, 38386, 39195, 40008, 40823, 41641, 42461, 43284, 44110, 44938, 45769, 46603, 47439, 48277, 49118, 49961,
 | 
			
		||||
    50807, 51655, 52505, 53357, 54212, 55069, 55929, 56790, 57654, 58520, 59388, 60258, 61130, 62005, 62881, 63759,
 | 
			
		||||
    64640, 65522, 66407, 67293, 68182, 69072, 69964, 70858, 71754, 72652, 73552, 74453, 75357, 76262, 77169, 78078,
 | 
			
		||||
    78988, 79900, 80814, 81730, 82648, 83567, 84488, 85410, 86334, 87260, 88188, 89117, 90047, 90980, 91914, 92849,
 | 
			
		||||
    93786, 94725, 95665, 96607, 97550, 98495, 99441, 100389, 101338, 102289, 103241, 104195, 105150, 106107, 107065,
 | 
			
		||||
    108024, 108985, 109948, 110911, 111877, 112843, 113811, 114780, 115751, 116723, 117696, 118671, 119647, 120624,
 | 
			
		||||
    121603, 122583, 123564, 124547, 125531, 126516, 127503, 128490, 129479, 130470, 131461, 132454, 133448, 134443,
 | 
			
		||||
    135440, 136438, 137437, 138437, 139438, 140441, 141444, 142449, 143455, 144463, 145471, 146481, 147492, 148503,
 | 
			
		||||
    149517
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
@ -1543,6 +1543,8 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
 | 
			
		||||
        FocusAbility: String,
 | 
			
		||||
        //The treeways of the Focus school.(Active and passive Ability)
 | 
			
		||||
        FocusUpgrades: [focusUpgradeSchema],
 | 
			
		||||
        //Focus 2.0 Pool
 | 
			
		||||
        FocusCapacity: Number,
 | 
			
		||||
 | 
			
		||||
        //Achievement
 | 
			
		||||
        ChallengeProgress: [challengeProgressSchema],
 | 
			
		||||
 | 
			
		||||
@ -340,6 +340,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
			
		||||
    EmailItems: ITypeCount[];
 | 
			
		||||
    CompletedSyndicates: string[];
 | 
			
		||||
    FocusXP?: IFocusXP;
 | 
			
		||||
    FocusCapacity?: number;
 | 
			
		||||
    Wishlist: string[];
 | 
			
		||||
    Alignment?: IAlignment;
 | 
			
		||||
    CompletedSorties: string[];
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user