From 554ef6ef2014e2d81c2539c5edc8627656835f5c Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 17 Jul 2020 19:01:12 -0400 Subject: [PATCH] v0.8.2: Added shops to landmarks & sale price back to item info windows --- core/src/main/assets/messages/items/items.properties | 1 + .../main/assets/messages/journal/journal.properties | 1 + .../actors/mobs/npcs/Shopkeeper.java | 7 +++++++ .../shatteredpixeldungeon/items/Heap.java | 3 +++ .../shatteredpixeldungeon/items/Item.java | 4 ++++ .../shatteredpixeldungeon/journal/Notes.java | 1 + .../shatteredpixeldungeon/windows/WndInfoItem.java | 10 ++-------- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index c8d71661b..08f0362a4 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1631,6 +1631,7 @@ items.equipableitem.ac_unequip=UNEQUIP items.gold.name=gold items.gold.desc=A pile of gold coins. Collect gold coins to spend them later in a shop. +items.heap.for_sale=%1$dg: %2$s items.heap.chest=Chest items.heap.chest_desc=You won't know what's inside until you open it! items.heap.locked_chest=Locked chest diff --git a/core/src/main/assets/messages/journal/journal.properties b/core/src/main/assets/messages/journal/journal.properties index 13666929d..fa0c9a855 100644 --- a/core/src/main/assets/messages/journal/journal.properties +++ b/core/src/main/assets/messages/journal/journal.properties @@ -46,6 +46,7 @@ journal.notes$landmark.well_of_transmutation=well of transmutation journal.notes$landmark.alchemy=alchemy pot journal.notes$landmark.garden=garden journal.notes$landmark.statue=animated statue +journal.notes$landmark.shop=shop journal.notes$landmark.ghost=sad ghost journal.notes$landmark.wandmaker=old wandmaker journal.notes$landmark.troll=troll blacksmith diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java index 83de5d9ff..47d9dac2c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Shopkeeper.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ShopkeeperSprite; @@ -48,6 +49,10 @@ public class Shopkeeper extends NPC { protected boolean act() { throwItem(); + + if (Dungeon.level.heroFOV[pos]){ + Notes.add(Notes.Landmark.SHOP); + } sprite.turnTo( pos, Dungeon.hero.pos ); spend( TICK ); @@ -66,6 +71,8 @@ public class Shopkeeper extends NPC { public void flee() { destroy(); + + Notes.remove(Notes.Landmark.SHOP); sprite.killAndErase(); CellEmitter.get( pos ).burst( ElmoParticle.FACTORY, 6 ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index 01f8fc246..3577c8464 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -351,6 +351,9 @@ public class Heap implements Bundlable { @Override public String toString(){ switch(type){ + case FOR_SALE: + Item i = peek(); + return Messages.get(this, "for_sale", i.sellPrice(), i.toString()); case CHEST: case MIMIC: return Messages.get(this, "chest"); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index 500ca7532..5875e60da 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -441,6 +441,10 @@ public class Item implements Bundlable { public int price() { return 0; } + + public final int sellPrice(){ + return price() * 5 * (Dungeon.depth / 5 + 1); + } public Item virtual(){ Item item = Reflection.newInstance(getClass()); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java index f5cd05dc3..f640a56be 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java @@ -70,6 +70,7 @@ public class Notes { ALCHEMY, GARDEN, STATUE, + SHOP, GHOST, WANDMAKER, diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java index 37a96bf8a..2ac41b7ba 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java @@ -38,14 +38,8 @@ public class WndInfoItem extends Window { public WndInfoItem( Heap heap ) { super(); - - if (heap.type == Heap.Type.HEAP || heap.type == Heap.Type.FOR_SALE) { - fillFields( heap.peek() ); - - } else { - fillFields( heap ); - - } + + fillFields( heap ); } public WndInfoItem( Item item ) {