feat(webui): give all quests #980
128
src/controllers/api/giveStartingGearController.ts
Normal file
128
src/controllers/api/giveStartingGearController.ts
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
|
import { InventoryDocumentProps } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
|
import {
|
||||||
|
addEquipment,
|
||||||
|
addItem,
|
||||||
|
addPowerSuit,
|
||||||
|
combineInventoryChanges,
|
||||||
|
getInventory,
|
||||||
|
updateSlots
|
||||||
|
} from "@/src/services/inventoryService";
|
||||||
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
|
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
|
import {
|
||||||
|
IInventoryClient,
|
||||||
|
IInventoryDatabase,
|
||||||
|
InventorySlot,
|
||||||
|
TEquipmentKey
|
||||||
|
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
|
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||||
|
import { RequestHandler } from "express";
|
||||||
|
import { HydratedDocument } from "mongoose";
|
||||||
|
|
||||||
|
export const giveStartingGearController: RequestHandler = async (req, res) => {
|
||||||
|
const accountId = await getAccountIdForRequest(req);
|
||||||
|
const startingGear = getJSONfromString<Partial<IInventoryClient>>(String(req.body));
|
||||||
|
const inventory = await getInventory(accountId);
|
||||||
|
|
||||||
|
const inventoryChanges = await addStartingGear(inventory, startingGear);
|
||||||
|
|
||||||
|
res.send(inventoryChanges);
|
||||||
|
};
|
||||||
|
|
||||||
|
//TODO: RawUpgrades might need to return a LastAdded
|
||||||
|
const awakeningRewards = [
|
||||||
|
"/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem1",
|
||||||
|
"/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem2",
|
||||||
|
"/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem3",
|
||||||
|
"/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem4",
|
||||||
|
"/Lotus/Types/Restoratives/LisetAutoHack",
|
||||||
|
"/Lotus/Upgrades/Mods/Warframe/AvatarShieldMaxMod"
|
||||||
|
];
|
||||||
|
|
||||||
|
type test = IInventoryClient & [key in TEquipmentKey]?: Partial<IEquipmentClient>[] ;
|
||||||
|
export const addStartingGear = async (
|
||||||
|
inventory: HydratedDocument<IInventoryDatabase, InventoryDocumentProps>,
|
||||||
|
startingGear: test,
|
||||||
|
_skipTutorial: boolean = false
|
||||||
|
) => {
|
||||||
|
const { LongGuns, Pistols, Suits, Melee } = startingGear;
|
||||||
|
|
||||||
|
//TODO: properly merge weapon bin changes
|
||||||
|
const inventoryChanges: IInventoryChanges = {};
|
||||||
|
addEquipment(inventory, "LongGuns", LongGuns[0].ItemType, undefined, inventoryChanges);
|
||||||
|
addEquipment(inventory, "Pistols", Pistols[0].ItemType, undefined, inventoryChanges);
|
||||||
|
addEquipment(inventory, "Melee", Melee[0].ItemType, undefined, inventoryChanges);
|
||||||
|
addEquipment(inventory, "Suits", Suits[0].ItemType, undefined, inventoryChanges, { Configs: Suits[0].Configs });
|
||||||
|
addEquipment(
|
||||||
|
inventory,
|
||||||
|
"DataKnives",
|
||||||
|
"/Lotus/Weapons/Tenno/HackingDevices/TnHackingDevice/TnHackingDeviceWeapon",
|
||||||
|
undefined,
|
||||||
|
inventoryChanges,
|
||||||
|
{ XP: 450_000 }
|
||||||
|
);
|
||||||
|
addEquipment(
|
||||||
|
inventory,
|
||||||
|
"Scoops",
|
||||||
|
"/Lotus/Weapons/Tenno/Speedball/SpeedballWeaponTest",
|
||||||
|
undefined,
|
||||||
|
inventoryChanges
|
||||||
|
);
|
||||||
|
|
||||||
|
updateSlots(inventory, InventorySlot.SUITS, 0, 1);
|
||||||
|
updateSlots(inventory, InventorySlot.WEAPONS, 0, 3);
|
||||||
|
inventoryChanges.SuitBin = { count: 1, platinum: 0, Slots: -1 };
|
||||||
|
inventoryChanges.WeaponBin = { count: 3, platinum: 0, Slots: -3 };
|
||||||
|
|
||||||
|
await addItem(inventory, "/Lotus/Types/Keys/VorsPrize/VorsPrizeQuestKeyChain");
|
||||||
|
inventory.ActiveQuest = "/Lotus/Types/Keys/VorsPrize/VorsPrizeQuestKeyChain";
|
||||||
|
|
||||||
|
inventory.PremiumCredits = 50;
|
||||||
|
inventory.PremiumCreditsFree = 50;
|
||||||
|
inventoryChanges.PremiumCredits = 50;
|
||||||
|
inventoryChanges.PremiumCreditsFree = 50;
|
||||||
|
inventory.RegularCredits = 3000;
|
||||||
|
inventoryChanges.RegularCredits = 3000;
|
||||||
|
|
||||||
|
for (const item of awakeningRewards) {
|
||||||
|
const inventoryDelta = await addItem(inventory, item);
|
||||||
|
combineInventoryChanges(inventoryChanges, inventoryDelta.InventoryChanges);
|
||||||
|
}
|
||||||
|
// currentloadoutids
|
||||||
|
|
||||||
|
// "LoadOutPresets": {
|
||||||
|
// "NORMAL": [
|
||||||
|
// {
|
||||||
|
// "s": {
|
||||||
|
// "ItemId": { "$oid": "67b73fbfb56b4b84d70433c2" },
|
||||||
|
// "mod": 0,
|
||||||
|
// "cus": 0
|
||||||
|
// },
|
||||||
|
// "p": {
|
||||||
|
// "ItemId": { "$oid": "67b73fbfb56b4b84d70433c5" },
|
||||||
|
// "mod": 0,
|
||||||
|
// "cus": 0
|
||||||
|
// },
|
||||||
|
// "l": {
|
||||||
|
// "ItemId": { "$oid": "67b73fbfb56b4b84d70433c4" },
|
||||||
|
// "mod": 0,
|
||||||
|
// "cus": 0
|
||||||
|
// },
|
||||||
|
// "m": {
|
||||||
|
// "ItemId": { "$oid": "67b73fbfb56b4b84d70433c6" },
|
||||||
|
// "mod": 0,
|
||||||
|
// "cus": 0
|
||||||
|
// },
|
||||||
|
// "ItemId": { "$oid": "67b73fbfb56b4b84d70433c7" }
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// },
|
||||||
|
|
||||||
|
inventory.PlayedParkourTutorial = true;
|
||||||
|
inventory.ReceivedStartingGear = true;
|
||||||
|
|
||||||
|
//originally ship is returned
|
||||||
|
//also weaponskins
|
||||||
|
return inventoryChanges;
|
||||||
|
};
|
@ -13,7 +13,8 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
|
|||||||
| "completeAll"
|
| "completeAll"
|
||||||
| "ResetAll"
|
| "ResetAll"
|
||||||
| "completeAllUnlocked"
|
| "completeAllUnlocked"
|
||||||
| "updateKey";
|
| "updateKey"
|
||||||
|
| "giveAll";
|
||||||
const questKeyUpdate = req.body as IUpdateQuestRequest["QuestKeys"];
|
const questKeyUpdate = req.body as IUpdateQuestRequest["QuestKeys"];
|
||||||
|
|
||||||
const allQuestKeys: string[] = [];
|
const allQuestKeys: string[] = [];
|
||||||
@ -71,6 +72,7 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
|
|||||||
for (const questKey of inventory.QuestKeys) {
|
for (const questKey of inventory.QuestKeys) {
|
||||||
questKey.Completed = false;
|
questKey.Completed = false;
|
||||||
questKey.Progress = [];
|
questKey.Progress = [];
|
||||||
|
questKey.CompletionDate = undefined;
|
||||||
}
|
}
|
||||||
inventory.ActiveQuest = "";
|
inventory.ActiveQuest = "";
|
||||||
break;
|
break;
|
||||||
@ -78,7 +80,6 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
|
|||||||
case "completeAllUnlocked": {
|
case "completeAllUnlocked": {
|
||||||
logger.info("completing all unlocked quests..");
|
logger.info("completing all unlocked quests..");
|
||||||
for (const questKey of inventory.QuestKeys) {
|
for (const questKey of inventory.QuestKeys) {
|
||||||
console.log("size of questkeys", inventory.QuestKeys.length);
|
|
||||||
try {
|
try {
|
||||||
await completeQuest(inventory, questKey.ItemType);
|
await completeQuest(inventory, questKey.ItemType);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -105,6 +106,12 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
|
|||||||
inventory.ActiveQuest = "";
|
inventory.ActiveQuest = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "giveAll": {
|
||||||
|
for (const questKey of allQuestKeys) {
|
||||||
|
addQuestKey(inventory, { ItemType: questKey });
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
|
66
static/fixed_responses/junctionRewards.json
Normal file
66
static/fixed_responses/junctionRewards.json
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{ "VenusToMercuryJunction":
|
||||||
|
["/Lotus/StoreItems/Types/Keys/InfestedIntroQuest/InfestedIntroQuestKeyChain",
|
||||||
|
"/Lotus/StoreItems/Types/Keys/KubrowQuest/KubrowQuestKeyChain",
|
||||||
|
"/Lotus/StoreItems/Weapons/Tenno/Rifle/BoltoRifle",
|
||||||
|
"/Lotus/StoreItems/Upgrades/Mods/Warframe/AvatarShieldRechargeRateMod",
|
||||||
|
"/Lotus/StoreItems/Upgrades/Mods/Warframe/AvatarAbilityEfficiencyMod",
|
||||||
|
"/Lotus/StoreItems/Types/Game/KubrowPet/EggHatcher",]
|
||||||
|
"EarthToVenusJunction":
|
||||||
|
/Lotus/StoreItems/Types/Recipes/Weapons/FurisBlueprint
|
||||||
|
/Lotus/StoreItems/Upgrades/Mods/Melee/WeaponFreezeDamageMod
|
||||||
|
/Lotus/StoreItems/Upgrades/Mods/Rifle/WeaponElectricityDamageMod
|
||||||
|
/Lotus/StoreItems/Types/Recipes/SentinelRecipes/TnSentinelCrossBlueprint
|
||||||
|
/Lotus/StoreItems/Weapons/Tenno/Melee/MeleeTrees/StaffCmbOneMeleeTree
|
||||||
|
/Lotus/StoreItems/Types/Items/MiscItems/OrokinReactor
|
||||||
|
/Lotus/StoreItems/Upgrades/Mods/Aura/PlayerEnergyHealthRegenAuraMod
|
||||||
|
EarthToMarsJunction
|
||||||
|
/Lotus/StoreItems/Types/Keys/ArchwingQuest/ArchwingQuestKeyChain
|
||||||
|
/Lotus/StoreItems/Types/Game/KubrowPet/EggHatcher
|
||||||
|
/Lotus/StoreItems/Types/Items/ShipFeatureItems/VoidProjectionFeatureItem
|
||||||
|
/Lotus/StoreItems/Types/Game/Projections/T1VoidProjectionRevenantPrimeABronze
|
||||||
|
/Lotus/StoreItems/Weapons/Tenno/Melee/Hammer/HammerWeapon
|
||||||
|
/Lotus/StoreItems/Weapons/Tenno/Melee/MeleeTrees/IronPhoenixMeleeTree
|
||||||
|
/Lotus/StoreItems/Types/Keys/InfestedMicroplanetQuest/InfestedMicroplanetQuestKeyChain
|
||||||
|
MarsToCeresJunction
|
||||||
|
/Lotus/StoreItems/Types/Recipes/Weapons/GrnSniperRifleBlueprint
|
||||||
|
/Lotus/StoreItems/Upgrades/Mods/Melee/WeaponToxinDamageMod
|
||||||
|
/Lotus/StoreItems/Weapons/Tenno/Melee/MeleeTrees/DualSwordCmbOneMeleeTree
|
||||||
|
MarsToPhobosJunction
|
||||||
|
/Lotus/StoreItems/Types/Keys/SpyQuestKeyChain/SpyQuestKeyChain
|
||||||
|
/Lotus/StoreItems/Types/Recipes/Weapons/GrnHeavyPistolBlueprint
|
||||||
|
/Lotus/StoreItems/Types/StoreItems/Consumables/CipherBlueprint
|
||||||
|
/Lotus/StoreItems/Upgrades/Mods/Rifle/WeaponReloadSpeedMod
|
||||||
|
/Lotus/StoreItems/Upgrades/Mods/Warframe/AvatarLootRadarMod
|
||||||
|
/Lotus/StoreItems/Types/Items/MiscItems/OrokinCatalyst
|
||||||
|
JupiterToEuropaJunction
|
||||||
|
/Lotus/StoreItems/Types/Keys/LimboQuest/LimboQuestKeyChain
|
||||||
|
/Lotus/StoreItems/Types/Keys/DragonQuest/DragonQuestKeyChain
|
||||||
|
/Lotus/StoreItems/Types/Recipes/Weapons/CorpusMinigunBlueprint
|
||||||
|
/Lotus/StoreItems/Upgrades/Mods/Aura/PlayerHealthAuraMod
|
||||||
|
JupiterToSaturnJunction
|
||||||
|
/Lotus/StoreItems/Types/Recipes/Weapons/GrenadeLauncherBlueprint
|
||||||
|
/Lotus/StoreItems/Types/Keys/ProteaQuest/ProteaQuestKeyChain
|
||||||
|
SaturnToUranusJunction
|
||||||
|
/Lotus/StoreItems/Types/Recipes/Weapons/CorpusWhipBlueprint
|
||||||
|
/Lotus/StoreItems/Types/Recipes/WarframeRecipes/ChromaHelmetBlueprint
|
||||||
|
/Lotus/StoreItems/Types/Keys/DuviriQuest/DuviriQuestKeyChain
|
||||||
|
/Lotus/StoreItems/Types/NeutralCreatures/ErsatzHorse/ErsatzHorsePowerSuit
|
||||||
|
UranusToNeptuneJunction
|
||||||
|
/Lotus/StoreItems/Types/Keys/OrokinMoonQuest/OrokinMoonQuestKeyChain
|
||||||
|
/Lotus/StoreItems/Types/Recipes/Weapons/ReconnasorBlueprint
|
||||||
|
/Lotus/StoreItems/Types/Recipes/WarframeRecipes/ChromaChassisBlueprint
|
||||||
|
NeptuneToPlutoJunction
|
||||||
|
/Lotus/StoreItems/Types/Recipes/Weapons/GrineerFlakCannonBlueprint
|
||||||
|
/Lotus/StoreItems/Types/Recipes/WarframeRecipes/ChromaSystemsBlueprint
|
||||||
|
PlutoToSednaJunction
|
||||||
|
/Lotus/StoreItems/Types/Keys/WarWithinQuest/WarWithinQuestKeyChain
|
||||||
|
/Lotus/StoreItems/Types/Keys/MirageQuest/MirageQuestKeyChain
|
||||||
|
/Lotus/StoreItems/Types/Recipes/Weapons/DualDaggerBlueprint
|
||||||
|
PlutoToErisJunction
|
||||||
|
/Lotus/StoreItems/Types/Keys/InfestedAladVQuest/InfestedAladVQuestKeyChain
|
||||||
|
/Lotus/StoreItems/Types/Recipes/Weapons/MireSwordBlueprint
|
||||||
|
CeresToJupiterJunction
|
||||||
|
/Lotus/StoreItems/Types/Recipes/Weapons/GrnStaffBlueprint
|
||||||
|
/Lotus/StoreItems/Upgrades/Mods/Archwing/Suit/ArchwingSuitHealthMaxMod
|
||||||
|
/Lotus/StoreItems/Upgrades/Mods/Archwing/Rifle/ArchwingRifleDamageAmountMod
|
||||||
|
/Lotus/StoreItems/Upgrades/Mods/Archwing/Melee/ArchwingMeleeDamageMod
|
@ -539,10 +539,12 @@
|
|||||||
</form>
|
</form>
|
||||||
<h5 class="mt-3" data-loc="cheats_quests"></h6>
|
<h5 class="mt-3" data-loc="cheats_quests"></h6>
|
||||||
<div class="mb-2 d-flex flex-wrap gap-2">
|
<div class="mb-2 d-flex flex-wrap gap-2">
|
||||||
<button class="btn btn-primary" onclick="doQuestUpdate('unlockAll');" data-loc="cheats_quests_UnlockAll"></button>
|
<button class="btn btn-primary" onclick="doQuestUpdate('unlockAll');" data-loc="cheats_quests_unlockAll"></button>
|
||||||
<button class="btn btn-primary" onclick="doQuestUpdate('completeAll');" data-loc="cheats_quests_CompleteAll"></button>
|
<button class="btn btn-primary" onclick="doQuestUpdate('completeAll');" data-loc="cheats_quests_completeAll"></button>
|
||||||
<button class="btn btn-primary" onclick="doQuestUpdate('completeAllUnlocked');" data-loc="cheats_quests_CompleteAllUnlocked"></button>
|
<button class="btn btn-primary" onclick="doQuestUpdate('completeAllUnlocked');" data-loc="cheats_quests_completeAllUnlocked"></button>
|
||||||
<button class="btn btn-primary" onclick="doQuestUpdate('ResetAll');" data-loc="cheats_quests_ResetAll"></button>
|
<button class="btn btn-primary" onclick="doQuestUpdate('ResetAll');" data-loc="cheats_quests_resetAll"></button>
|
||||||
|
<button class="btn btn-primary" onclick="doQuestUpdate('giveAll');" data-loc="cheats_quests_giveAll"></button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -118,10 +118,11 @@ dict = {
|
|||||||
cheats_changeButton: `Change`,
|
cheats_changeButton: `Change`,
|
||||||
cheats_none: `None`,
|
cheats_none: `None`,
|
||||||
cheats_quests: `Quests`,
|
cheats_quests: `Quests`,
|
||||||
cheats_quests_UnlockAll: `Unlock All Quests`,
|
cheats_quests_unlockAll: `Unlock All Quests`,
|
||||||
cheats_quests_CompleteAll: `Complete All Quests`,
|
cheats_quests_completeAll: `Complete All Quests`,
|
||||||
cheats_quests_CompleteAllUnlocked: `Complete All Unlocked Quests`,
|
cheats_quests_completeAllUnlocked: `Complete All Unlocked Quests`,
|
||||||
cheats_quests_ResetAll: `Reset All Quests`,
|
cheats_quests_resetAll: `Reset All Quests`,
|
||||||
|
cheats_quests_giveAll: `Give All Quests`,
|
||||||
import_importNote: `You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer <b>will be overwritten</b> in your account.`,
|
import_importNote: `You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer <b>will be overwritten</b> in your account.`,
|
||||||
import_submit: `Submit`
|
import_submit: `Submit`
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user