當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript garland-tools.service.GarlandToolsService類代碼示例

本文整理匯總了TypeScript中app/core/garland-tools.service.GarlandToolsService的典型用法代碼示例。如果您正苦於以下問題:TypeScript service.GarlandToolsService類的具體用法?TypeScript service.GarlandToolsService怎麽用?TypeScript service.GarlandToolsService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了service.GarlandToolsService類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getCraftedBy

 protected getCraftedBy(item: any): Observable<CraftedBy[]> {
     const result = [];
     for (const craft of item.craft) {
         const craftedBy: CraftedBy = {
             itemId: item.id,
             icon: `https://secure.xivdb.com/img/classes/set2/${this.gt.getJob(craft.job).name.toLowerCase()}.png`,
             level: craft.lvl,
             stars_tooltip: this.generateStars(craft.stars)
         };
         if (craft.job === 0) {
             craftedBy.icon = '';
         }
         if (craft.unlockId !== undefined) {
             result.push(this.db.getItem(craft.unlockId).map(masterbook => {
                 craftedBy.masterbook = {
                     name: this.getI18nName(masterbook.item),
                     id: masterbook.item.id
                 };
                 return craftedBy;
             }));
         } else {
             result.push(Observable.of(craftedBy));
         }
     }
     return Observable.combineLatest(result);
 }
開發者ID:aluink,項目名稱:ffxiv-teamcraft,代碼行數:26,代碼來源:list-manager.service.ts

示例2:

 .map(data => {
     tradeSource.npcName = data.npc.name;
     if (data.npc.zoneid === undefined) {
         return undefined;
     }
     tradeSource.zoneName = this.gt.getLocation(data.npc.zoneid).name;
     return tradeSource as TradeSource;
 });
開發者ID:aluink,項目名稱:ffxiv-teamcraft,代碼行數:8,代碼來源:list-manager.service.ts

示例3: getGatheredBy

 protected getGatheredBy(item: any): GatheredBy {
     const gatheredBy: GatheredBy = {
         icon: '',
         stars_tooltip: '',
         level: 0,
         nodes: []
     };
     // If it's a node gather (not a fish)
     if (item.nodes !== undefined) {
         for (const node of item.nodes) {
             const details = this.gt.getNode(node);
             if (details.type <= 1) {
                 gatheredBy.icon = 'https://garlandtools.org/db/images/MIN.png';
             } else if (details.type < 4) {
                 gatheredBy.icon = 'https://garlandtools.org/db/images/BTN.png';
             } else {
                 gatheredBy.icon = 'https://garlandtools.org/db/images/FSH.png';
             }
             gatheredBy.stars_tooltip = this.generateStars(details.stars);
             gatheredBy.level = details.lvl;
             if (details.areaid !== undefined) {
                 gatheredBy.nodes.push(details);
             }
         }
     } else {
         // If it's a fish, we have to handle it in another way
         for (const spot of item.fishingSpots) {
             const details = this.gt.getFishingSpot(spot);
             gatheredBy.icon = 'https://garlandtools.org/db/images/FSH.png';
             if (details.areaid !== undefined) {
                 gatheredBy.nodes.push(details);
             }
             gatheredBy.level = details.lvl;
         }
     }
     return gatheredBy;
 }
開發者ID:aluink,項目名稱:ffxiv-teamcraft,代碼行數:37,代碼來源:list-manager.service.ts

示例4: 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;
 }
開發者ID:aluink,項目名稱:ffxiv-teamcraft,代碼行數:65,代碼來源:list-manager.service.ts


注:本文中的app/core/garland-tools.service.GarlandToolsService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。