rveitch
11/14/2016 - 4:52 PM

Set Destiny Item Year based on sourceHashes (from DIM)

Set Destiny Item Year based on sourceHashes (from DIM)

function setItemYear(item) {
	// determine what year this item came from based on sourceHash value
	// items will hopefully be tagged as follows
	// No value: Vanilla, Crota's End, House of Wolves
	// The Taken King (year 2): 460228854
	// Rise of Iron (year3): 24296771

	// This could be further refined for CE/HoW based on activity. See
	// DestinyRewardSourceDefinition and filter on %SOURCE%
	// if sourceHash doesn't contain these values, we assume they came from
	// year 1

	item.year = 1;
	if (item.sourceHashes.includes(460228854) ||  // ttk
			item.sourceHashes.includes(3523074641) || // variks
			(item.talentGrid && item.talentGrid.infusable) || // no year1 item is infusable...
			item.sourceHashes.includes(3739898362) || // elders challenge
			item.sourceHashes.includes(3551688287)) { // kings fall
		item.year = 2;
	}
	if ((item.sourceHashes.includes(24296771) ||        // roi
			!item.sourceHashes.length)) {                   // new items
		item.year = 3;
	}
}