tf2-item-format
Version:
Format's TF2 items like backpack.tf does
24 lines • 816 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isItemsTexture = isItemsTexture;
exports.getTexture = getTexture;
/**
* Checks if texture is the one on the item.
*/
function isItemsTexture(description, item) {
return (description.value.startsWith('\u2714 ') &&
(matchesName(description, item) || isCurrentItemSkin(item)));
}
function matchesName(description, { itemName }) {
return itemName.origin.includes(description.value.replace('\u2714 ', ''));
}
function isCurrentItemSkin({ tags }) {
return !!tags.wear;
}
function getTexture(description, schema) {
// Only set texture when app_data present.
return description.app_data
? schema.getTextureName(description.app_data.def_index)
: undefined;
}
//# sourceMappingURL=texture.js.map