Skip to content

Commit

Permalink
Minor Typescript surgery.
Browse files Browse the repository at this point in the history
 Changes to be committed:
	modified:   ui/core/components/suggest_gems_action.ts
  • Loading branch information
NerdEgghead committed Dec 7, 2023
1 parent f4ae6b3 commit b893b29
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions ui/core/components/suggest_gems_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Gear } from '../proto_utils/gear.js';
import { EquippedItem } from '../proto_utils/equipped_item.js';
import { TypedEvent } from '../typed_event.js';
import { Stats } from '../proto_utils/stats.js';
import { GemColor, Stat, Profession, ItemSlot } from '../proto/common.js';
import { GemColor, Stat, Profession, ItemSlot, Spec } from '../proto/common.js';

interface GemCapsData {
gemId: number
Expand All @@ -18,7 +18,7 @@ interface SocketData {
}

abstract class GemOptimizer {
protected readonly player: Player<any>;
protected readonly player: Player<Spec>;
protected readonly sim: Sim;
protected readonly gemPriorityByColor: Record<GemColor, Array<GemCapsData>>;
abstract metaGemID: number;
Expand Down Expand Up @@ -122,11 +122,11 @@ abstract class GemOptimizer {
continue;
}

if (item!.numSocketsOfColor(blacklistedColor) != 0) {
if (item.numSocketsOfColor(blacklistedColor) != 0) {
continue;
}

const numSockets = item!.numSocketsOfColor(color);
const numSockets = item.numSocketsOfColor(color);

if ((numSockets == 0) || (singleOnly && (numSockets != 1))) {
continue;
Expand All @@ -148,6 +148,10 @@ abstract class GemOptimizer {
if (itemSlot != null) {
const item = gear.getEquippedItem(itemSlot);

if (!item) {
return gear;
}

for (const [socketIdx, socketColor] of item!.allSocketColors().entries()) {
if (socketColor == colorToMatch) {
return gear.withEquippedItem(itemSlot, item!.withGem(this.sim.db.lookupGem(gemId), socketIdx), true);
Expand Down Expand Up @@ -184,7 +188,7 @@ abstract class GemOptimizer {
continue;
}

for (const [socketIdx, socketColor] of item!.curSocketColors(this.isBlacksmithing).entries()) {
for (const [socketIdx, socketColor] of item.curSocketColors(this.isBlacksmithing).entries()) {
if (item!.hasSocketedGem(socketIdx)) {
continue;
}
Expand Down

0 comments on commit b893b29

Please sign in to comment.