Skip to content

Commit c7b863e

Browse files
committed
update silver texture and add some more robust code for chest colors
1 parent 46b7aab commit c7b863e

3 files changed

Lines changed: 30 additions & 11 deletions

File tree

23 Bytes
Loading

src/item-data.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface RawMapItems {
1414
export type RawChests = { [mapId: string]: RawChest };
1515

1616
export interface RawChest {
17+
name: string;
1718
mwids: number[];
1819
}
1920

src/plugin.ts

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ export default class MwRandomizer {
196196
return;
197197
}
198198

199-
this.check = map.chests?.[this.mapId];
200-
if (!this.check) {
199+
this.mwCheck = map.chests?.[this.mapId];
200+
if (!this.mwCheck) {
201201
return;
202202
}
203203

@@ -209,17 +209,23 @@ export default class MwRandomizer {
209209
const masterKeyLayer = this.animSheet.anims.idleMasterKey.animations[1];
210210
let layerToAdd = null;
211211

212+
this.analyzeColor = sc.ANALYSIS_COLORS.GREY;
213+
this.analyzeLabel = "Filler";
214+
212215
let newOffY = 0;
213-
let flags = sc.multiworld.locationInfo[this.check.mwids[0]].flags;
216+
let flags = sc.multiworld.locationInfo[this.mwCheck.mwids[0]].flags;
214217
if (flags & (ap.ITEM_FLAGS.NEVER_EXCLUDE | ap.ITEM_FLAGS.TRAP)) {
215218
// USEFUL and TRAP items get a blue chest
216219
newOffY = 80;
217220
layerToAdd = keyLayer;
218-
221+
this.analyzeColor = sc.ANALYSIS_COLORS.BLUE;
222+
this.analyzeLabel = "Useful";
219223
} else if (flags & ap.ITEM_FLAGS.PROGRESSION) {
220224
// PROGRESSION items get a green chest
221225
newOffY = 136;
222226
layerToAdd = masterKeyLayer;
227+
this.analyzeColor = sc.ANALYSIS_COLORS.GREEN;
228+
this.analyzeLabel = "Progression";
223229
}
224230

225231
if (newOffY == 0) {
@@ -239,29 +245,41 @@ export default class MwRandomizer {
239245
}
240246
},
241247

248+
getQuickMenuSettings() {
249+
return {
250+
disabled: this.isOpen || (this.hideManager && this.hideManager.hidden),
251+
type: "Analyzable",
252+
color: this.analyzeColor ?? 0,
253+
text: this.mwCheck
254+
? `\\c[4]${this.mwCheck.name}\\c[0]\nType: \\c[3]${this.analyzeLabel}\\c[3]`
255+
: "\\c[1]Not in logic",
256+
257+
};
258+
},
259+
242260
_reallyOpenUp() {
243261
if (
244-
this.check === undefined ||
245-
this.check.mwids === undefined ||
246-
this.check.mwids.length == 0 ||
247-
sc.multiworld.locationInfo[this.check.mwids[0]] === undefined
262+
this.mwCheck === undefined ||
263+
this.mwCheck.mwids === undefined ||
264+
this.mwCheck.mwids.length == 0 ||
265+
sc.multiworld.locationInfo[this.mwCheck.mwids[0]] === undefined
248266
) {
249267
console.warn('Chest not in logic');
250268
return this.parent();
251269
}
252270

253271
const old = sc.ItemDropEntity.spawnDrops;
254272
try {
255-
if (this.check) {
256-
sc.multiworld.reallyCheckLocations(this.check.mwids);
273+
if (this.mwCheck) {
274+
sc.multiworld.reallyCheckLocations(this.mwCheck.mwids);
257275
}
258276

259277
this.amount = 0;
260278
return this.parent();
261279
} finally {
262280
sc.ItemDropEntity.spawnDrops = old;
263281
}
264-
}
282+
},
265283
});
266284

267285
ig.EVENT_STEP.SET_PLAYER_CORE.inject({

0 commit comments

Comments
 (0)