Module:GameData/doc: Difference between revisions

Update script - Generate itemUpgrades entries for perfect cooked item downgrades & potion tier upgrades
(Update script - Firemaking: Initialize primaryProducts & secondaryProducts properties for logs with default values when absent)
(Update script - Generate itemUpgrades entries for perfect cooked item downgrades & potion tier upgrades)
 
Line 428: Line 428:
// Firemaking - Apply default primary & secondary products to logs
// Firemaking - Apply default primary & secondary products to logs
const skillDataFM = this.getObjectByID(this.gameData.skillData, 'melvorD:Firemaking', 'skillID');
const skillDataFM = this.getObjectByID(this.gameData.skillData, 'melvorD:Firemaking', 'skillID');
if (skillDataFM !== undefined) {
skillDataFM.data.logs.forEach((log) => {
skillDataFM.data.logs.forEach((log) => {
if (log.primaryProducts === undefined) {
if (log.primaryProducts === undefined) {
log.primaryProducts = [...skillDataFM.data.defaultPrimaryProducts];
log.primaryProducts = [...skillDataFM.data.defaultPrimaryProducts];
}
}
if (log.secondaryProducts === undefined) {
if (log.secondaryProducts === undefined) {
log.secondaryProducts = [...skillDataFM.data.defaultSecondaryProducts];
log.secondaryProducts = [...skillDataFM.data.defaultSecondaryProducts];
}
}
});
});
 
}
// Cooking - Generate perfect fish item downgrades
const skillDataCooking = this.getObjectByID(this.gameData.skillData, 'melvorD:Cooking', 'skillID');
// Logic sourced from postDataRegistration() within cooking.js
skillDataCooking.data.recipes.forEach((recipe) => {
const perfectID = recipe.perfectCookID;
if (perfectID !== undefined) {
this.gameData.itemUpgrades.push({
currencyCosts: [],
itemCosts: [
{
id: perfectID,
quantity: 1
}
],
rootItemIDs: [
perfectID
],
upgradedItemID: recipe.productID,
isDowngrade: true,
});
}
});
 
// Herblore - Generate potion tier item upgrades
const skillDataHerblore = this.getObjectByID(this.gameData.skillData, 'melvorD:Herblore', 'skillID');
// Logic sourced from postDataRegistration() within herblore.js
skillDataHerblore.data.recipes.forEach((recipe) => {
for (let i = 0; i < recipe.potionIDs.length - 1; i++) {
this.gameData.itemUpgrades.push({
currencyCosts: [],
itemCosts: [
{
id: recipe.potionIDs[i],
quantity: 3,
}
],
rootItemIDs: [
recipe.potionIDs[i]
],
upgradedItemID: recipe.potionIDs[i + 1],
isDowngrade: false,
});
}
});
 
}
}
registerPackData(packData) {
registerPackData(packData) {