Anonymous

Module:GameData/doc: Difference between revisions

From Melvor Idle
Update JS - Avoid modified descriptions for shop purchases
(Add data version)
(Update JS - Avoid modified descriptions for shop purchases)
Line 1,114: Line 1,114:
const purchase = game.shop.purchases.getObjectByID(data.id);
const purchase = game.shop.purchases.getObjectByID(data.id);
if (purchase !== undefined) {
if (purchase !== undefined) {
return purchase.description;
// Logic taken from description method of ShopPurchase class & slightly modified
// to avoid retrieving an item's modified description, which can include HTML
let desc = '';
if (purchase._customDescription !== undefined) {
if (purchase.isModded) {
return purchase._customDescription;
}
else {
return getLangString(`SHOP_DESCRIPTION_${ purchase.localID }`);
}
}
if (purchase.contains.itemCharges !== undefined) {
  return purchase.contains.itemCharges.item.description;
}
if (purchase.contains.items.length === 1) {
  return purchase.contains.items[0].item.description; // Was modifiedDescription
}
if (purchase.contains.pet !== undefined) {
  return purchase.contains.pet.description;
}
if (purchase.contains.stats !== undefined) {
  desc = purchase.contains.stats.describePlain();
}
if (purchase.hasDisabledModifier) {
desc += getLangString('MENU_TEXT_CONTAINS_DISABLED_MODIFIER');
}
return desc;
} else return '';
} else return '';
};
};