v2.5.0: adjusted logic for rings to properly handle type vs. item notes

This commit is contained in:
Evan Debenham
2024-08-30 13:57:47 -04:00
parent 210d1b4e8a
commit 54917b94f4
2 changed files with 17 additions and 2 deletions
@@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler; import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc; import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@@ -177,7 +178,18 @@ public class Ring extends KindofMisc {
public String info(){ public String info(){
//skip custom notes if anonymized and un-Ided //skip custom notes if anonymized and un-Ided
String desc = (anonymous && (handler == null || !handler.isKnown( this ))) ? super.desc() : super.info(); String desc;
if (anonymous && (handler == null || !handler.isKnown( this ))){
desc = super.desc();
} else {
//otherwise, check for item type note too, rings can have either
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();
}
}
if (cursed && isEquipped( Dungeon.hero )) { if (cursed && isEquipped( Dungeon.hero )) {
desc += "\n\n" + Messages.get(Ring.class, "cursed_worn"); desc += "\n\n" + Messages.get(Ring.class, "cursed_worn");
@@ -156,6 +156,9 @@ public class CustomNoteButton extends IconButton {
@Override @Override
public boolean itemSelectable(Item item) { public boolean itemSelectable(Item item) {
if (item instanceof EquipableItem){ if (item instanceof EquipableItem){
if (item instanceof Ring && Notes.findCustomRecord(item.getClass()) != null){
return false;
}
return ((EquipableItem) item).customNoteID == -1 return ((EquipableItem) item).customNoteID == -1
|| Notes.findCustomRecord(((EquipableItem) item).customNoteID) == null; || Notes.findCustomRecord(((EquipableItem) item).customNoteID) == null;
} else { } else {