Skip to content

Commit

Permalink
Fixed Typescript errors
Browse files Browse the repository at this point in the history
 Changes to be committed:
	modified:   ui/core/proto_utils/gear.ts
	modified:   ui/core/sim.ts
	modified:   ui/feral_druid/sim.ts
  • Loading branch information
NerdEgghead committed Jul 27, 2023
1 parent 47bdcff commit b1bf06d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 7 additions & 1 deletion ui/core/proto_utils/gear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ export class Gear extends BaseGear {
}

hasRelic(itemId: number): boolean {
return this.getEquippedItem(ItemSlot.ItemSlotRanged).item.id == itemId;
const relicItem = this.getEquippedItem(ItemSlot.ItemSlotRanged);

if (!relicItem) {
return false;
}

return relicItem!.item.id == itemId;
}

asMap(): InternalGear {
Expand Down
2 changes: 1 addition & 1 deletion ui/core/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export class Sim {
}

// This should be invoked internally whenever stats might have changed.
private async updateCharacterStats(eventID: EventID) {
async updateCharacterStats(eventID: EventID) {
if (eventID == 0) {
// Skip the first event ID because it interferes with the loaded stats.
return;
Expand Down
8 changes: 4 additions & 4 deletions ui/feral_druid/sim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,17 @@ export class FeralDruidSimUI extends IndividualSimUI<Spec.SpecFeralDruid> {
if (tearSlot) {
const tearSlotItem = gear.getEquippedItem(tearSlot);

for (const [socketIdx, socketColor] of tearSlotItem.allSocketColors().entries()) {
for (const [socketIdx, socketColor] of tearSlotItem!.allSocketColors().entries()) {
if (socketColor == GemColor.GemColorBlue) {
return gear.withEquippedItem(tearSlot, tearSlotItem.withGem(this.sim.db.lookupGem(49110), socketIdx), true);
return gear.withEquippedItem(tearSlot, tearSlotItem!.withGem(this.sim.db.lookupGem(49110), socketIdx), true);
}
}
}

return gear;
}

findSocketsByColor(gear: Gear, epWeights: Stats, color: GemColor, tearSlot: ItemSlot): Array<[ItemSlot, number]> {
findSocketsByColor(gear: Gear, epWeights: Stats, color: GemColor, tearSlot: ItemSlot | null): Array<[ItemSlot, number]> {
const socketList = new Array<[ItemSlot, number]>();

for (var slot of gear.getItemSlots()) {
Expand Down Expand Up @@ -341,7 +341,7 @@ export class FeralDruidSimUI extends IndividualSimUI<Spec.SpecFeralDruid> {
return socketList;
}

async fillGemsToCaps(gear: Gear, socketList: Array<[ItemSlot, number]>, gemCaps: Array<[number, Stats]>, numPasses: number, firstIdx: number): Gear {
async fillGemsToCaps(gear: Gear, socketList: Array<[ItemSlot, number]>, gemCaps: Array<[number, Stats]>, numPasses: number, firstIdx: number): Promise<Gear> {
let updatedGear: Gear = gear;
let nextGem = this.sim.db.lookupGem(gemCaps[numPasses][0]);

Expand Down

0 comments on commit b1bf06d

Please sign in to comment.