From 2ccda1d1e7e174d661680aeffd0f889bc3bd2e4e Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 9 Jul 2017 22:27:31 -0400 Subject: [PATCH] v0.6.1: moved notes class to journal package, renamed features to landmarks --- .../shatteredpixeldungeon/Dungeon.java | 1 + .../shatteredpixeldungeon/Journal.java | 125 ------------------ .../actors/blobs/Alchemy.java | 4 +- .../actors/blobs/Foliage.java | 4 +- .../actors/blobs/WaterOfAwareness.java | 8 +- .../actors/blobs/WaterOfHealth.java | 8 +- .../actors/blobs/WaterOfTransmutation.java | 6 +- .../actors/blobs/WellWater.java | 10 +- .../actors/mobs/Statue.java | 6 +- .../actors/mobs/npcs/Blacksmith.java | 6 +- .../actors/mobs/npcs/Ghost.java | 6 +- .../actors/mobs/npcs/Imp.java | 6 +- .../actors/mobs/npcs/Wandmaker.java | 6 +- .../{ => journal}/Notes.java | 38 ++++-- .../windows/WndJournal.java | 4 +- .../messages/journal/journal.properties | 10 ++ .../messages/misc/misc.properties | 11 -- 17 files changed, 72 insertions(+), 187 deletions(-) delete mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Journal.java rename core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/{ => journal}/Notes.java (72%) create mode 100644 core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/journal/journal.properties diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 538b82476..f5711f5ab 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -40,6 +40,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.levels.CavesBossLevel; import com.shatteredpixel.shatteredpixeldungeon.levels.CavesLevel; import com.shatteredpixel.shatteredpixeldungeon.levels.CityBossLevel; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Journal.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Journal.java deleted file mode 100644 index 296817fe6..000000000 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Journal.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Pixel Dungeon - * Copyright (C) 2012-2015 Oleg Dolya - * - * Shattered Pixel Dungeon - * Copyright (C) 2014-2017 Evan Debenham - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - */ - -package com.shatteredpixel.shatteredpixeldungeon; - -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.watabou.utils.Bundlable; -import com.watabou.utils.Bundle; - -import java.util.ArrayList; - -public class Journal { - - public enum Feature { - WELL_OF_HEALTH, - WELL_OF_AWARENESS, - WELL_OF_TRANSMUTATION, - ALCHEMY, - GARDEN, - STATUE, - - GHOST, - WANDMAKER, - TROLL, - IMP; - - public String desc() { - return Messages.get(this, name()); - } - }; - - public static class Record implements Comparable, Bundlable { - - private static final String FEATURE = "feature"; - private static final String DEPTH = "depth"; - - public Feature feature; - public int depth; - - public Record() { - } - - public Record( Feature feature, int depth ) { - this.feature = feature; - this.depth = depth; - } - - @Override - public int compareTo( Record another ) { - return another.depth - depth; - } - - @Override - public void restoreFromBundle( Bundle bundle ) { - feature = Feature.valueOf( bundle.getString( FEATURE ) ); - depth = bundle.getInt( DEPTH ); - } - - @Override - public void storeInBundle( Bundle bundle ) { - bundle.put( FEATURE, feature.toString() ); - bundle.put( DEPTH, depth ); - } - } - - public static ArrayList records; - - public static void reset() { - records = new ArrayList(); - } - - private static final String JOURNAL = "journal"; - - public static void storeInBundle( Bundle bundle ) { - bundle.put( JOURNAL, records ); - } - - public static void restoreFromBundle( Bundle bundle ) { - records = new ArrayList(); - for (Bundlable rec : bundle.getCollection( JOURNAL ) ) { - records.add( (Record) rec ); - } - } - - public static void add( Feature feature ) { - int size = records.size(); - for (int i=0; i < size; i++) { - Record rec = records.get( i ); - if (rec.feature == feature && rec.depth == Dungeon.depth) { - return; - } - } - - records.add( new Record( feature, Dungeon.depth ) ); - } - - public static void remove( Feature feature ) { - int size = records.size(); - for (int i=0; i < size; i++) { - Record rec = records.get( i ); - if (rec.feature == feature && rec.depth == Dungeon.depth) { - records.remove( i ); - return; - } - } - } -} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java index aa4bae7ab..988ee51d1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java @@ -22,11 +22,11 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Notes; import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.watabou.utils.Bundle; @@ -53,7 +53,7 @@ public class Alchemy extends Blob { area.union(pos%Dungeon.level.width(), pos/Dungeon.level.width()); if (Dungeon.visible[pos]) { - Notes.add( Notes.Feature.ALCHEMY ); + Notes.add( Notes.Landmark.ALCHEMY ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java index b7d5cc22c..3bbcffe10 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Foliage.java @@ -22,12 +22,12 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Notes; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Shadows; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -69,7 +69,7 @@ public class Foliage extends Blob { } if (visible) { - Notes.add( Notes.Feature.GARDEN ); + Notes.add( Notes.Landmark.GARDEN ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java index 1e17c233c..7e3bbadd7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfAwareness.java @@ -24,8 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Notes; -import com.shatteredpixel.shatteredpixeldungeon.Notes.Feature; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -33,6 +31,8 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Identification; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes.Landmark; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -70,7 +70,7 @@ public class WaterOfAwareness extends WellWater { GLog.p( Messages.get(this, "procced") ); - Notes.remove( Feature.WELL_OF_AWARENESS ); + Notes.remove( Landmark.WELL_OF_AWARENESS ); return true; } @@ -85,7 +85,7 @@ public class WaterOfAwareness extends WellWater { emitter.parent.add( new Identification( DungeonTilemap.tileCenterToWorld( pos ) ) ); - Notes.remove( Feature.WELL_OF_AWARENESS ); + Notes.remove( Landmark.WELL_OF_AWARENESS ); return item; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfHealth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfHealth.java index 10525ecaa..716b85288 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfHealth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfHealth.java @@ -23,8 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Notes; -import com.shatteredpixel.shatteredpixeldungeon.Notes.Feature; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; @@ -34,6 +32,8 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle; import com.shatteredpixel.shatteredpixeldungeon.items.DewVial; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes.Landmark; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; @@ -55,7 +55,7 @@ public class WaterOfHealth extends WellWater { GLog.p( Messages.get(this, "procced") ); - Notes.remove( Feature.WELL_OF_HEALTH ); + Notes.remove( Landmark.WELL_OF_HEALTH ); return true; } @@ -64,7 +64,7 @@ public class WaterOfHealth extends WellWater { protected Item affectItem( Item item ) { if (item instanceof DewVial && !((DewVial)item).isFull()) { ((DewVial)item).fill(); - Notes.remove( Feature.WELL_OF_HEALTH ); + Notes.remove( Landmark.WELL_OF_HEALTH ); return item; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java index 77af5df43..c9a82de92 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java @@ -21,8 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; -import com.shatteredpixel.shatteredpixeldungeon.Notes; -import com.shatteredpixel.shatteredpixeldungeon.Notes.Feature; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; @@ -41,6 +39,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes.Landmark; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.watabou.utils.Random; @@ -71,7 +71,7 @@ public class WaterOfTransmutation extends WellWater { } if (item != null) { - Notes.remove( Feature.WELL_OF_TRANSMUTATION ); + Notes.remove( Landmark.WELL_OF_TRANSMUTATION ); } return item; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WellWater.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WellWater.java index 38f0bc9ce..193836b5b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WellWater.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WellWater.java @@ -22,11 +22,11 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Notes; -import com.shatteredpixel.shatteredpixeldungeon.Notes.Feature; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes.Landmark; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -58,11 +58,11 @@ public class WellWater extends Blob { if (Dungeon.visible[pos]) { if (this instanceof WaterOfAwareness) { - Notes.add( Feature.WELL_OF_AWARENESS ); + Notes.add( Landmark.WELL_OF_AWARENESS ); } else if (this instanceof WaterOfHealth) { - Notes.add( Feature.WELL_OF_HEALTH ); + Notes.add( Notes.Landmark.WELL_OF_HEALTH ); } else if (this instanceof WaterOfTransmutation) { - Notes.add( Feature.WELL_OF_TRANSMUTATION ); + Notes.add( Landmark.WELL_OF_TRANSMUTATION ); } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java index 4cf11ecb1..775bbeabf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java @@ -22,7 +22,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Notes; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison; @@ -32,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon.Enchantment; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vampiric; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite; import com.watabou.utils.Bundle; @@ -80,7 +80,7 @@ public class Statue extends Mob { @Override protected boolean act() { if (Dungeon.visible[pos]) { - Notes.add( Notes.Feature.STATUE ); + Notes.add( Notes.Landmark.STATUE ); } return super.act(); } @@ -139,7 +139,7 @@ public class Statue extends Mob { @Override public void destroy() { - Notes.remove( Notes.Feature.STATUE ); + Notes.remove( Notes.Landmark.STATUE ); super.destroy(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java index 75a4709eb..b0e666860 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java @@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Notes; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem; @@ -32,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.quest.DarkGold; import com.shatteredpixel.shatteredpixeldungeon.items.quest.Pickaxe; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.BlacksmithRoom; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -86,7 +86,7 @@ public class Blacksmith extends NPC { } } ); - Notes.add( Notes.Feature.TROLL ); + Notes.add( Notes.Landmark.TROLL ); } else if (!Quest.completed) { if (Quest.alternative) { @@ -203,7 +203,7 @@ public class Blacksmith extends NPC { Quest.reforged = true; - Notes.remove( Notes.Feature.TROLL ); + Notes.remove( Notes.Landmark.TROLL ); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java index 73c191429..b32c306a6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java @@ -23,7 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Notes; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; @@ -44,6 +43,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.ScaleArmor; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Shortsword; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.levels.SewerLevel; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -170,7 +170,7 @@ public class Ghost extends NPC { GameScene.add(questBoss); GameScene.show( new WndQuest( this, txt_quest ) ); Quest.given = true; - Notes.add( Notes.Feature.GHOST ); + Notes.add( Notes.Landmark.GHOST ); } } @@ -342,7 +342,7 @@ public class Ghost extends NPC { weapon = null; armor = null; - Notes.remove( Notes.Feature.GHOST ); + Notes.remove( Notes.Landmark.GHOST ); } public static boolean completed(){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java index 0297085ea..fe5ddf396 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java @@ -22,7 +22,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Notes; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Golem; @@ -31,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Monk; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.quest.DwarfToken; import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.levels.CityLevel; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -105,7 +105,7 @@ public class Imp extends NPC { Quest.given = true; Quest.completed = false; - Notes.add( Notes.Feature.IMP ); + Notes.add( Notes.Landmark.IMP ); } return false; @@ -214,7 +214,7 @@ public class Imp extends NPC { reward = null; completed = true; - Notes.remove( Notes.Feature.IMP ); + Notes.remove( Notes.Landmark.IMP ); } public static boolean isCompleted() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java index 63a30015a..086d1bfd9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java @@ -23,7 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs; import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Notes; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; @@ -32,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.quest.CeremonialCandle; import com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust; import com.shatteredpixel.shatteredpixeldungeon.items.quest.Embers; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.MassGraveRoom; @@ -163,7 +163,7 @@ public class Wandmaker extends NPC { } }); - Notes.add( Notes.Feature.WANDMAKER ); + Notes.add( Notes.Landmark.WANDMAKER ); Quest.given = true; } @@ -307,7 +307,7 @@ public class Wandmaker extends NPC { wand1 = null; wand2 = null; - Notes.remove( Notes.Feature.WANDMAKER ); + Notes.remove( Notes.Landmark.WANDMAKER ); } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Notes.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java similarity index 72% rename from core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Notes.java rename to core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java index dda1dfabf..7975c8511 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Notes.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java @@ -19,8 +19,9 @@ * along with this program. If not, see */ -package com.shatteredpixel.shatteredpixeldungeon; +package com.shatteredpixel.shatteredpixeldungeon.journal; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.watabou.utils.Bundlable; import com.watabou.utils.Bundle; @@ -29,7 +30,7 @@ import java.util.ArrayList; public class Notes { - public enum Feature { + public enum Landmark { WELL_OF_HEALTH, WELL_OF_AWARENESS, WELL_OF_TRANSMUTATION, @@ -49,17 +50,22 @@ public class Notes { public static class Record implements Comparable, Bundlable { + //compatibility with pre-0.6.1 saves private static final String FEATURE = "feature"; + + private static final String LANDMARK = "landmark"; + private static final String DEPTH = "depth"; - public Feature feature; + public Landmark landmark; + public int depth; public Record() { } - public Record( Feature feature, int depth ) { - this.feature = feature; + public Record(Landmark landmark, int depth ) { + this.landmark = landmark; this.depth = depth; } @@ -70,13 +76,17 @@ public class Notes { @Override public void restoreFromBundle( Bundle bundle ) { - feature = Feature.valueOf( bundle.getString( FEATURE ) ); + if (bundle.contains(FEATURE)) { + landmark = Landmark.valueOf(bundle.getString(FEATURE)); + } else { + landmark = Landmark.valueOf(bundle.getString(LANDMARK)); + } depth = bundle.getInt( DEPTH ); } @Override public void storeInBundle( Bundle bundle ) { - bundle.put( FEATURE, feature.toString() ); + bundle.put( LANDMARK, landmark.toString() ); bundle.put( DEPTH, depth ); } } @@ -84,7 +94,7 @@ public class Notes { public static ArrayList records; public static void reset() { - records = new ArrayList(); + records = new ArrayList<>(); } private static final String JOURNAL = "journal"; @@ -94,29 +104,29 @@ public class Notes { } public static void restoreFromBundle( Bundle bundle ) { - records = new ArrayList(); + records = new ArrayList<>(); for (Bundlable rec : bundle.getCollection( JOURNAL ) ) { records.add( (Record) rec ); } } - public static void add( Feature feature ) { + public static void add( Landmark landmark ) { int size = records.size(); for (int i=0; i < size; i++) { Record rec = records.get( i ); - if (rec.feature == feature && rec.depth == Dungeon.depth) { + if (rec.landmark == landmark && rec.depth == Dungeon.depth) { return; } } - records.add( new Record( feature, Dungeon.depth ) ); + records.add( new Record(landmark, Dungeon.depth ) ); } - public static void remove( Feature feature ) { + public static void remove( Landmark landmark ) { int size = records.size(); for (int i=0; i < size; i++) { Record rec = records.get( i ); - if (rec.feature == feature && rec.depth == Dungeon.depth) { + if (rec.landmark == landmark && rec.depth == Dungeon.depth) { records.remove( i ); return; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java index 64f4da4a6..3d341a1fd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java @@ -22,7 +22,6 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.Notes; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey; @@ -32,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.journal.Catalogs; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; @@ -239,7 +239,7 @@ public class WndJournal extends WndTabbed { //Notes entries for (Notes.Record rec : Notes.records) { - ListItem item = new ListItem( Icons.get(Icons.DEPTH), rec.feature.desc(), rec.depth ); + ListItem item = new ListItem( Icons.get(Icons.DEPTH), rec.landmark.desc(), rec.depth ); item.setRect( 0, pos, width(), ITEM_HEIGHT ); content.add( item ); diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/journal/journal.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/journal/journal.properties new file mode 100644 index 000000000..1801d564e --- /dev/null +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/journal/journal.properties @@ -0,0 +1,10 @@ +notes$landmark.well_of_health=Well of Health +notes$landmark.well_of_awareness=Well of Awareness +notes$landmark.well_of_transmutation=Well of Transmutation +notes$landmark.alchemy=Alchemy pot +notes$landmark.garden=Garden +notes$landmark.statue=Animated statue +notes$landmark.ghost=Sad ghost +notes$landmark.wandmaker=Old wandmaker +notes$landmark.troll=Troll blacksmith +notes$landmark.imp=Ambitious imp \ No newline at end of file diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties index c9c628af0..25bdaf4ae 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/misc/misc.properties @@ -73,15 +73,4 @@ challenges.swarm_intelligence=Swarm intelligence challenges.darkness=Into darkness challenges.no_scrolls=Forbidden runes -journal$feature.well_of_health=Well of Health -journal$feature.well_of_awareness=Well of Awareness -journal$feature.well_of_transmutation=Well of Transmutation -journal$feature.alchemy=Alchemy pot -journal$feature.garden=Garden -journal$feature.statue=Animated statue -journal$feature.ghost=Sad ghost -journal$feature.wandmaker=Old wandmaker -journal$feature.troll=Troll blacksmith -journal$feature.imp=Ambitious imp - rankings$record.something=Killed by Something