本文整理匯總了TypeScript中app/core/garland-tools.service.GarlandToolsService.getCrystalDetails方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript service.GarlandToolsService.getCrystalDetails方法的具體用法?TypeScript service.GarlandToolsService.getCrystalDetails怎麽用?TypeScript service.GarlandToolsService.getCrystalDetails使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app/core/garland-tools.service.GarlandToolsService
的用法示例。
在下文中一共展示了service.GarlandToolsService.getCrystalDetails方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: addCraft
protected addCraft(additions: CraftAddition[], list: List): List {
const nextIteration: CraftAddition[] = [];
for (const addition of additions) {
for (const element of addition.item.craft[0].ingredients) {
// If this is a crystal
if (element.id < 20 && element.id > 1) {
const crystal = this.gt.getCrystalDetails(element.id);
this.add(list.crystals, {
id: element.id,
name: this.getI18nName(crystal),
icon: this.getIcon(crystal),
amount: element.amount * addition.amount,
done: 0,
yield: 1,
addedAt: Date.now()
});
} else {
const elementDetails = this.getRelated(addition.data, element.id);
if (elementDetails.craft !== undefined) {
const yields = elementDetails.craft[0].yield || 1;
const amount = Math.ceil(element.amount * addition.amount / yields);
this.add(list.preCrafts, {
id: elementDetails.id,
icon: this.getIcon(elementDetails),
amount: amount,
requires: elementDetails.craft[0].ingredients,
done: 0,
name: this.getI18nName(elementDetails),
yield: yields,
addedAt: Date.now()
});
nextIteration.push({
item: elementDetails,
data: addition.data,
amount: amount
});
} else if (elementDetails.nodes !== undefined || elementDetails.fishingSpots !== undefined) {
this.add(list.gathers, {
id: elementDetails.id,
icon: this.getIcon(elementDetails),
amount: element.amount * addition.amount,
done: 0,
name: this.getI18nName(elementDetails),
yield: 1,
addedAt: Date.now()
});
} else {
this.add(list.others, {
id: elementDetails.id,
icon: this.getIcon(elementDetails),
amount: element.amount * addition.amount,
done: 0,
name: this.getI18nName(elementDetails),
yield: 1,
addedAt: Date.now()
});
}
}
}
}
if (nextIteration.length > 0) {
return this.addCraft(nextIteration, list);
}
return list;
}