feat: dojo visitors (#2374)
Closes #2373 Reviewed-on: #2374 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
fd1d72a1cf
commit
a9b3b16d31
8
package-lock.json
generated
8
package-lock.json
generated
@ -23,7 +23,7 @@
|
|||||||
"ncp": "^2.0.0",
|
"ncp": "^2.0.0",
|
||||||
"typescript": "^5.5",
|
"typescript": "^5.5",
|
||||||
"undici": "^7.10.0",
|
"undici": "^7.10.0",
|
||||||
"warframe-public-export-plus": "^0.5.74",
|
"warframe-public-export-plus": "^0.5.76",
|
||||||
"warframe-riven-info": "^0.1.2",
|
"warframe-riven-info": "^0.1.2",
|
||||||
"winston": "^3.17.0",
|
"winston": "^3.17.0",
|
||||||
"winston-daily-rotate-file": "^5.0.0",
|
"winston-daily-rotate-file": "^5.0.0",
|
||||||
@ -3386,9 +3386,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/warframe-public-export-plus": {
|
"node_modules/warframe-public-export-plus": {
|
||||||
"version": "0.5.74",
|
"version": "0.5.76",
|
||||||
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.74.tgz",
|
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.76.tgz",
|
||||||
"integrity": "sha512-pA7dxA0lKn9w/2Sc97oxnn+CEzL1SrT9XriNLTDF4Xp+2SBEpGcfbqbdR9ljPQJopIbrc9Zy02R+uBQVomcwyA=="
|
"integrity": "sha512-0gX3NTWaxFyzUmqBSUHhPY8pMRX92iXQFqoBuMQlMG1+6uC6JMKtwP5t8cuXR3pvV2vkaCi/cDWjP1JUChkZ9g=="
|
||||||
},
|
},
|
||||||
"node_modules/warframe-riven-info": {
|
"node_modules/warframe-riven-info": {
|
||||||
"version": "0.1.2",
|
"version": "0.1.2",
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
"ncp": "^2.0.0",
|
"ncp": "^2.0.0",
|
||||||
"typescript": "^5.5",
|
"typescript": "^5.5",
|
||||||
"undici": "^7.10.0",
|
"undici": "^7.10.0",
|
||||||
"warframe-public-export-plus": "^0.5.74",
|
"warframe-public-export-plus": "^0.5.76",
|
||||||
"warframe-riven-info": "^0.1.2",
|
"warframe-riven-info": "^0.1.2",
|
||||||
"winston": "^3.17.0",
|
"winston": "^3.17.0",
|
||||||
"winston-daily-rotate-file": "^5.0.0",
|
"winston-daily-rotate-file": "^5.0.0",
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
getGuildVault,
|
getGuildVault,
|
||||||
hasAccessToDojo,
|
hasAccessToDojo,
|
||||||
hasGuildPermission,
|
hasGuildPermission,
|
||||||
|
processCompletedGuildTechProject,
|
||||||
processFundedGuildTechProject,
|
processFundedGuildTechProject,
|
||||||
processGuildTechProjectContributionsUpdate,
|
processGuildTechProjectContributionsUpdate,
|
||||||
removePigmentsFromGuildMembers,
|
removePigmentsFromGuildMembers,
|
||||||
@ -51,8 +52,12 @@ export const guildTechController: RequestHandler = async (req, res) => {
|
|||||||
};
|
};
|
||||||
if (project.CompletionDate) {
|
if (project.CompletionDate) {
|
||||||
techProject.CompletionDate = toMongoDate(project.CompletionDate);
|
techProject.CompletionDate = toMongoDate(project.CompletionDate);
|
||||||
if (Date.now() >= project.CompletionDate.getTime()) {
|
if (
|
||||||
needSave ||= setGuildTechLogState(guild, project.ItemType, 4, project.CompletionDate);
|
Date.now() >= project.CompletionDate.getTime() &&
|
||||||
|
setGuildTechLogState(guild, project.ItemType, 4, project.CompletionDate)
|
||||||
|
) {
|
||||||
|
processCompletedGuildTechProject(guild, project.ItemType);
|
||||||
|
needSave = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
techProjects.push(techProject);
|
techProjects.push(techProject);
|
||||||
|
@ -57,8 +57,12 @@ export const placeDecoInComponentController: RequestHandler = async (req, res) =
|
|||||||
component.DecoCapacity -= meta.capacityCost;
|
component.DecoCapacity -= meta.capacityCost;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const [itemType, meta] = Object.entries(ExportResources).find(arr => arr[1].deco == deco.Type)!;
|
const entry = Object.entries(ExportResources).find(arr => arr[1].deco == deco.Type);
|
||||||
if (!itemType || meta.dojoCapacityCost === undefined) {
|
if (!entry) {
|
||||||
|
throw new Error(`unknown deco type: ${deco.Type}`);
|
||||||
|
}
|
||||||
|
const [itemType, meta] = entry;
|
||||||
|
if (meta.dojoCapacityCost === undefined) {
|
||||||
throw new Error(`unknown deco type: ${deco.Type}`);
|
throw new Error(`unknown deco type: ${deco.Type}`);
|
||||||
}
|
}
|
||||||
component.DecoCapacity -= meta.dojoCapacityCost;
|
component.DecoCapacity -= meta.dojoCapacityCost;
|
||||||
@ -75,7 +79,13 @@ export const placeDecoInComponentController: RequestHandler = async (req, res) =
|
|||||||
if (meta) {
|
if (meta) {
|
||||||
processDojoBuildMaterialsGathered(guild, meta);
|
processDojoBuildMaterialsGathered(guild, meta);
|
||||||
}
|
}
|
||||||
} else if (guild.AutoContributeFromVault && guild.VaultRegularCredits && guild.VaultMiscItems) {
|
} else if (
|
||||||
|
deco.Type.startsWith("/Lotus/Objects/Tenno/Dojo/NpcPlaceables/") ||
|
||||||
|
(guild.AutoContributeFromVault && guild.VaultRegularCredits && guild.VaultMiscItems)
|
||||||
|
) {
|
||||||
|
if (!guild.VaultRegularCredits || !guild.VaultMiscItems) {
|
||||||
|
throw new Error(`dojo visitor placed without anything in vault?!`);
|
||||||
|
}
|
||||||
if (guild.VaultRegularCredits >= scaleRequiredCount(guild.Tier, meta.price)) {
|
if (guild.VaultRegularCredits >= scaleRequiredCount(guild.Tier, meta.price)) {
|
||||||
let enoughMiscItems = true;
|
let enoughMiscItems = true;
|
||||||
for (const ingredient of meta.ingredients) {
|
for (const ingredient of meta.ingredients) {
|
||||||
|
@ -550,6 +550,19 @@ export const processFundedGuildTechProject = (
|
|||||||
guild.XP += recipe.guildXpValue;
|
guild.XP += recipe.guildXpValue;
|
||||||
}
|
}
|
||||||
setGuildTechLogState(guild, techProject.ItemType, config.noDojoResearchTime ? 4 : 3, techProject.CompletionDate);
|
setGuildTechLogState(guild, techProject.ItemType, config.noDojoResearchTime ? 4 : 3, techProject.CompletionDate);
|
||||||
|
if (config.noDojoResearchTime) {
|
||||||
|
processCompletedGuildTechProject(guild, techProject.ItemType);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const processCompletedGuildTechProject = (guild: TGuildDatabaseDocument, type: string): void => {
|
||||||
|
if (type.startsWith("/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/")) {
|
||||||
|
guild.VaultDecoRecipes ??= [];
|
||||||
|
guild.VaultDecoRecipes.push({
|
||||||
|
ItemType: type,
|
||||||
|
ItemCount: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setGuildTechLogState = (
|
export const setGuildTechLogState = (
|
||||||
|
@ -64,8 +64,12 @@ export const handleSetShipDecorations = async (
|
|||||||
throw new Error(`unknown room: ${placedDecoration.Room}`);
|
throw new Error(`unknown room: ${placedDecoration.Room}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const [itemType, meta] = Object.entries(ExportResources).find(arr => arr[1].deco == placedDecoration.Type)!;
|
const entry = Object.entries(ExportResources).find(arr => arr[1].deco == placedDecoration.Type);
|
||||||
if (!itemType || meta.capacityCost === undefined) {
|
if (!entry) {
|
||||||
|
throw new Error(`unknown deco type: ${placedDecoration.Type}`);
|
||||||
|
}
|
||||||
|
const [itemType, meta] = entry;
|
||||||
|
if (meta.capacityCost === undefined) {
|
||||||
throw new Error(`unknown deco type: ${placedDecoration.Type}`);
|
throw new Error(`unknown deco type: ${placedDecoration.Type}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,5 +92,13 @@
|
|||||||
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/ThumperTrophySilverRecipe",
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/ThumperTrophySilverRecipe",
|
||||||
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/CorpusPlaceables/GasTurbineConeRecipe",
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/CorpusPlaceables/GasTurbineConeRecipe",
|
||||||
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/NaturalPlaceables/CoralChunkARecipe",
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/NaturalPlaceables/CoralChunkARecipe",
|
||||||
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/TennoPlaceables/TnoBeaconEmitterRecipe"
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/TennoPlaceables/TnoBeaconEmitterRecipe",
|
||||||
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/OstronFemaleSitting",
|
||||||
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/OstronFemaleStanding",
|
||||||
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/OstronMaleStanding",
|
||||||
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/OstronMaleStandingTwo",
|
||||||
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/SolarisForeman",
|
||||||
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/SolarisHazard",
|
||||||
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/SolarisStrikerOne",
|
||||||
|
"/Lotus/Levels/ClanDojo/ComponentPropRecipes/NpcPlaceables/SolarisStrikerThree"
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user