v2.5.0: fixed revently introduced error with custom notes by item type

This commit is contained in:
Evan Debenham
2024-09-06 12:34:30 -04:00
parent 2cb72f991a
commit a9b92035df
2 changed files with 9 additions and 6 deletions

View File

@@ -182,14 +182,17 @@ public class Ring extends KindofMisc {
String desc;
if (anonymous && (handler == null || !handler.isKnown( this ))){
desc = desc();
} else {
//otherwise, check for item type note too, rings can have either
//otherwise, check for item type note, rings can have either but not both
} else if (Notes.findCustomRecord(customNoteID) == null) {
Notes.CustomRecord note = Notes.findCustomRecord(getClass());
if (note != null){
desc = Messages.get(this, "custom_note", note.title()) + "\n\n" + super.info();
} else {
desc = super.info();
}
} else {
desc = super.info();
}
if (cursed && isEquipped( Dungeon.hero )) {

View File

@@ -623,18 +623,18 @@ public class Notes {
public static CustomRecord findCustomRecord( int ID ){
for (Record rec : records){
if (rec instanceof CustomRecord && ((CustomRecord) rec).ID == ID)
if (rec instanceof CustomRecord && ((CustomRecord) rec).ID == ID) {
return (CustomRecord) rec;
}
}
return null;
}
public static CustomRecord findCustomRecord( Class itemClass ){
for (Record rec : records){
if (rec instanceof CustomRecord
&& ((CustomRecord) rec).itemClass == itemClass
&& ((CustomRecord) rec).ID == -1)
if (rec instanceof CustomRecord && ((CustomRecord) rec).itemClass == itemClass) {
return (CustomRecord) rec;
}
}
return null;
}