v0.8.2: Player can now equip 3 misc items, but not all of the same type
This commit is contained in:
parent
a33fe02f53
commit
29f730f21f
|
@ -1661,7 +1661,7 @@ items.item.rankings_desc=Killed by: %s
|
||||||
items.item.curse=curse
|
items.item.curse=curse
|
||||||
|
|
||||||
items.kindofmisc.unequip_title=Unequip one item
|
items.kindofmisc.unequip_title=Unequip one item
|
||||||
items.kindofmisc.unequip_message=You can only wear two misc items at a time.
|
items.kindofmisc.unequip_message=You must unequip one of these items first. Select an item to swap with.
|
||||||
|
|
||||||
items.kindofweapon.equip_cursed=Your grip involuntarily tightens around the weapon.
|
items.kindofweapon.equip_cursed=Your grip involuntarily tightens around the weapon.
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class Bones {
|
||||||
private static Item pickItem(Hero hero){
|
private static Item pickItem(Hero hero){
|
||||||
Item item = null;
|
Item item = null;
|
||||||
if (Random.Int(3) != 0) {
|
if (Random.Int(3) != 0) {
|
||||||
switch (Random.Int(6)) {
|
switch (Random.Int(7)) {
|
||||||
case 0:
|
case 0:
|
||||||
item = hero.belongings.weapon;
|
item = hero.belongings.weapon;
|
||||||
break;
|
break;
|
||||||
|
@ -80,12 +80,15 @@ public class Bones {
|
||||||
item = hero.belongings.armor;
|
item = hero.belongings.armor;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
item = hero.belongings.misc1;
|
item = hero.belongings.artifact;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
item = hero.belongings.misc2;
|
item = hero.belongings.misc;
|
||||||
break;
|
break;
|
||||||
case 4: case 5:
|
case 4:
|
||||||
|
item = hero.belongings.ring;
|
||||||
|
break;
|
||||||
|
case 5: case 6:
|
||||||
item = Dungeon.quickslot.randomNonePlaceholder();
|
item = Dungeon.quickslot.randomNonePlaceholder();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,9 +154,9 @@ public enum Rankings {
|
||||||
Bundle handler = new Bundle();
|
Bundle handler = new Bundle();
|
||||||
Scroll.saveSelectively(handler, belongings.backpack.items);
|
Scroll.saveSelectively(handler, belongings.backpack.items);
|
||||||
Potion.saveSelectively(handler, belongings.backpack.items);
|
Potion.saveSelectively(handler, belongings.backpack.items);
|
||||||
//include worn rings
|
//include potentially worn rings
|
||||||
if (belongings.misc1 != null) belongings.backpack.items.add(belongings.misc1);
|
if (belongings.misc != null) belongings.backpack.items.add(belongings.misc);
|
||||||
if (belongings.misc2 != null) belongings.backpack.items.add(belongings.misc2);
|
if (belongings.ring != null) belongings.backpack.items.add(belongings.ring);
|
||||||
Ring.saveSelectively(handler, belongings.backpack.items);
|
Ring.saveSelectively(handler, belongings.backpack.items);
|
||||||
rec.gameData.put( HANDLERS, handler);
|
rec.gameData.put( HANDLERS, handler);
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,11 @@ public class ArtifactRecharge extends Buff {
|
||||||
if (target instanceof Hero){
|
if (target instanceof Hero){
|
||||||
Belongings b = ((Hero) target).belongings;
|
Belongings b = ((Hero) target).belongings;
|
||||||
|
|
||||||
if (b.misc1 instanceof Artifact){
|
if (b.artifact instanceof Artifact){
|
||||||
((Artifact)b.misc1).charge((Hero)target);
|
((Artifact)b.artifact).charge((Hero)target);
|
||||||
}
|
}
|
||||||
if (b.misc2 instanceof Artifact){
|
if (b.misc instanceof Artifact){
|
||||||
((Artifact)b.misc2).charge((Hero)target);
|
((Artifact)b.misc).charge((Hero)target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,10 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
|
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
|
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
|
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
@ -47,8 +49,9 @@ public class Belongings implements Iterable<Item> {
|
||||||
|
|
||||||
public KindOfWeapon weapon = null;
|
public KindOfWeapon weapon = null;
|
||||||
public Armor armor = null;
|
public Armor armor = null;
|
||||||
public KindofMisc misc1 = null;
|
public Artifact artifact = null;
|
||||||
public KindofMisc misc2 = null;
|
public KindofMisc misc = null;
|
||||||
|
public Ring ring = null;
|
||||||
|
|
||||||
public Belongings( Hero owner ) {
|
public Belongings( Hero owner ) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
@ -72,8 +75,9 @@ public class Belongings implements Iterable<Item> {
|
||||||
|
|
||||||
private static final String WEAPON = "weapon";
|
private static final String WEAPON = "weapon";
|
||||||
private static final String ARMOR = "armor";
|
private static final String ARMOR = "armor";
|
||||||
private static final String MISC1 = "misc1";
|
private static final String ARTIFACT = "artifact";
|
||||||
private static final String MISC2 = "misc2";
|
private static final String MISC = "misc";
|
||||||
|
private static final String RING = "ring";
|
||||||
|
|
||||||
public void storeInBundle( Bundle bundle ) {
|
public void storeInBundle( Bundle bundle ) {
|
||||||
|
|
||||||
|
@ -81,8 +85,9 @@ public class Belongings implements Iterable<Item> {
|
||||||
|
|
||||||
bundle.put( WEAPON, weapon );
|
bundle.put( WEAPON, weapon );
|
||||||
bundle.put( ARMOR, armor );
|
bundle.put( ARMOR, armor );
|
||||||
bundle.put( MISC1, misc1);
|
bundle.put( ARTIFACT, artifact );
|
||||||
bundle.put( MISC2, misc2);
|
bundle.put( MISC, misc );
|
||||||
|
bundle.put( RING, ring );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restoreFromBundle( Bundle bundle ) {
|
public void restoreFromBundle( Bundle bundle ) {
|
||||||
|
@ -99,16 +104,38 @@ public class Belongings implements Iterable<Item> {
|
||||||
if (armor != null){
|
if (armor != null){
|
||||||
armor.activate( owner );
|
armor.activate( owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
misc1 = (KindofMisc)bundle.get(MISC1);
|
//pre-0.8.2
|
||||||
if (misc1 != null) {
|
if (bundle.contains("misc1") || bundle.contains("misc2")){
|
||||||
misc1.activate( owner );
|
artifact = null;
|
||||||
}
|
misc = null;
|
||||||
|
ring = null;
|
||||||
misc2 = (KindofMisc)bundle.get(MISC2);
|
|
||||||
if (misc2 != null) {
|
KindofMisc m = (KindofMisc)bundle.get("misc1");
|
||||||
misc2.activate( owner );
|
if (m instanceof Artifact){
|
||||||
|
artifact = (Artifact) m;
|
||||||
|
} else if (m instanceof Ring) {
|
||||||
|
ring = (Ring) m;
|
||||||
|
}
|
||||||
|
|
||||||
|
m = (KindofMisc)bundle.get("misc2");
|
||||||
|
if (m instanceof Artifact){
|
||||||
|
if (artifact == null) artifact = (Artifact) m;
|
||||||
|
else misc = (Artifact) m;
|
||||||
|
} else if (m instanceof Ring) {
|
||||||
|
if (ring == null) ring = (Ring) m;
|
||||||
|
else misc = (Ring) m;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
artifact = (Artifact) bundle.get(ARTIFACT);
|
||||||
|
misc = (KindofMisc) bundle.get(MISC);
|
||||||
|
ring = (Ring) bundle.get(RING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (artifact != null) artifact.activate(owner);
|
||||||
|
if (misc != null) misc.activate( owner );
|
||||||
|
if (ring != null) ring.activate( owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void preview( GamesInProgress.Info info, Bundle bundle ) {
|
public static void preview( GamesInProgress.Info info, Bundle bundle ) {
|
||||||
|
@ -180,13 +207,17 @@ public class Belongings implements Iterable<Item> {
|
||||||
armor.identify();
|
armor.identify();
|
||||||
Badges.validateItemLevelAquired( armor );
|
Badges.validateItemLevelAquired( armor );
|
||||||
}
|
}
|
||||||
if (misc1 != null) {
|
if (artifact != null) {
|
||||||
misc1.identify();
|
artifact.identify();
|
||||||
Badges.validateItemLevelAquired(misc1);
|
Badges.validateItemLevelAquired(artifact);
|
||||||
}
|
}
|
||||||
if (misc2 != null) {
|
if (misc != null) {
|
||||||
misc2.identify();
|
misc.identify();
|
||||||
Badges.validateItemLevelAquired(misc2);
|
Badges.validateItemLevelAquired(misc);
|
||||||
|
}
|
||||||
|
if (ring != null) {
|
||||||
|
ring.identify();
|
||||||
|
Badges.validateItemLevelAquired(ring);
|
||||||
}
|
}
|
||||||
for (Item item : backpack) {
|
for (Item item : backpack) {
|
||||||
if (item instanceof EquipableItem || item instanceof Wand) {
|
if (item instanceof EquipableItem || item instanceof Wand) {
|
||||||
|
@ -196,7 +227,7 @@ public class Belongings implements Iterable<Item> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uncurseEquipped() {
|
public void uncurseEquipped() {
|
||||||
ScrollOfRemoveCurse.uncurse( owner, armor, weapon, misc1, misc2);
|
ScrollOfRemoveCurse.uncurse( owner, armor, weapon, artifact, misc, ring);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item randomUnequipped() {
|
public Item randomUnequipped() {
|
||||||
|
@ -231,14 +262,18 @@ public class Belongings implements Iterable<Item> {
|
||||||
armor.cursed = false;
|
armor.cursed = false;
|
||||||
armor.activate( owner );
|
armor.activate( owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (misc1 != null) {
|
if (artifact != null) {
|
||||||
misc1.cursed = false;
|
artifact.cursed = false;
|
||||||
misc1.activate( owner );
|
artifact.activate( owner );
|
||||||
}
|
}
|
||||||
if (misc2 != null) {
|
if (misc != null) {
|
||||||
misc2.cursed = false;
|
misc.cursed = false;
|
||||||
misc2.activate( owner );
|
misc.activate( owner );
|
||||||
|
}
|
||||||
|
if (ring != null) {
|
||||||
|
ring.cursed = false;
|
||||||
|
ring.activate( owner );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +300,7 @@ public class Belongings implements Iterable<Item> {
|
||||||
|
|
||||||
private Iterator<Item> backpackIterator = backpack.iterator();
|
private Iterator<Item> backpackIterator = backpack.iterator();
|
||||||
|
|
||||||
private Item[] equipped = {weapon, armor, misc1, misc2};
|
private Item[] equipped = {weapon, armor, artifact, misc, ring};
|
||||||
private int backpackIndex = equipped.length;
|
private int backpackIndex = equipped.length;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -303,10 +338,13 @@ public class Belongings implements Iterable<Item> {
|
||||||
equipped[1] = armor = null;
|
equipped[1] = armor = null;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
equipped[2] = misc1 = null;
|
equipped[2] = artifact = null;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
equipped[3] = misc2 = null;
|
equipped[3] = misc = null;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
equipped[4] = ring = null;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
backpackIterator.remove();
|
backpackIterator.remove();
|
||||||
|
|
|
@ -163,8 +163,8 @@ public enum HeroClass {
|
||||||
(hero.belongings.weapon = new Dagger()).identify();
|
(hero.belongings.weapon = new Dagger()).identify();
|
||||||
|
|
||||||
CloakOfShadows cloak = new CloakOfShadows();
|
CloakOfShadows cloak = new CloakOfShadows();
|
||||||
(hero.belongings.misc1 = cloak).identify();
|
(hero.belongings.artifact = cloak).identify();
|
||||||
hero.belongings.misc1.activate( hero );
|
hero.belongings.artifact.activate( hero );
|
||||||
|
|
||||||
ThrowingKnife knives = new ThrowingKnife();
|
ThrowingKnife knives = new ThrowingKnife();
|
||||||
knives.quantity(3).collect();
|
knives.quantity(3).collect();
|
||||||
|
|
|
@ -23,6 +23,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
@ -36,10 +38,28 @@ public abstract class KindofMisc extends EquipableItem {
|
||||||
@Override
|
@Override
|
||||||
public boolean doEquip(final Hero hero) {
|
public boolean doEquip(final Hero hero) {
|
||||||
|
|
||||||
if (hero.belongings.misc1 != null && hero.belongings.misc2 != null) {
|
boolean equipFull = false;
|
||||||
|
if ( this instanceof Artifact
|
||||||
|
&& hero.belongings.artifact != null
|
||||||
|
&& hero.belongings.misc != null){
|
||||||
|
equipFull = true;
|
||||||
|
} else if (this instanceof Ring
|
||||||
|
&& hero.belongings.misc != null
|
||||||
|
&& hero.belongings.ring != null){
|
||||||
|
equipFull = true;
|
||||||
|
}
|
||||||
|
|
||||||
final KindofMisc m1 = hero.belongings.misc1;
|
if (equipFull) {
|
||||||
final KindofMisc m2 = hero.belongings.misc2;
|
|
||||||
|
final KindofMisc m1;
|
||||||
|
final KindofMisc m2;
|
||||||
|
if (this instanceof Artifact){
|
||||||
|
m1 = hero.belongings.artifact;
|
||||||
|
m2 = hero.belongings.misc;
|
||||||
|
} else {
|
||||||
|
m1 = hero.belongings.misc;
|
||||||
|
m2 = hero.belongings.ring;
|
||||||
|
}
|
||||||
|
|
||||||
GameScene.show(
|
GameScene.show(
|
||||||
new WndOptions(Messages.get(KindofMisc.class, "unequip_title"),
|
new WndOptions(Messages.get(KindofMisc.class, "unequip_title"),
|
||||||
|
@ -66,10 +86,12 @@ public abstract class KindofMisc extends EquipableItem {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (hero.belongings.misc1 == null) {
|
if (this instanceof Artifact){
|
||||||
hero.belongings.misc1 = this;
|
if (hero.belongings.artifact == null) hero.belongings.artifact = (Artifact) this;
|
||||||
} else {
|
else hero.belongings.misc = (Artifact) this;
|
||||||
hero.belongings.misc2 = this;
|
} else if (this instanceof Ring){
|
||||||
|
if (hero.belongings.ring == null) hero.belongings.ring = (Ring) this;
|
||||||
|
else hero.belongings.misc = (Ring) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
detach( hero.belongings.backpack );
|
detach( hero.belongings.backpack );
|
||||||
|
@ -93,10 +115,12 @@ public abstract class KindofMisc extends EquipableItem {
|
||||||
public boolean doUnequip(Hero hero, boolean collect, boolean single) {
|
public boolean doUnequip(Hero hero, boolean collect, boolean single) {
|
||||||
if (super.doUnequip(hero, collect, single)){
|
if (super.doUnequip(hero, collect, single)){
|
||||||
|
|
||||||
if (hero.belongings.misc1 == this) {
|
if (hero.belongings.artifact == this) {
|
||||||
hero.belongings.misc1 = null;
|
hero.belongings.artifact = null;
|
||||||
} else {
|
} else if (hero.belongings.misc == this) {
|
||||||
hero.belongings.misc2 = null;
|
hero.belongings.misc = null;
|
||||||
|
} else if (hero.belongings.ring == this){
|
||||||
|
hero.belongings.ring = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -110,7 +134,9 @@ public abstract class KindofMisc extends EquipableItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEquipped( Hero hero ) {
|
public boolean isEquipped( Hero hero ) {
|
||||||
return hero.belongings.misc1 == this || hero.belongings.misc2 == this;
|
return hero.belongings.artifact == this
|
||||||
|
|| hero.belongings.misc == this
|
||||||
|
|| hero.belongings.ring == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,8 @@ public class Artifact extends KindofMisc {
|
||||||
@Override
|
@Override
|
||||||
public boolean doEquip( final Hero hero ) {
|
public boolean doEquip( final Hero hero ) {
|
||||||
|
|
||||||
if ((hero.belongings.misc1 != null && hero.belongings.misc1.getClass() == this.getClass())
|
if ((hero.belongings.artifact != null && hero.belongings.artifact.getClass() == this.getClass())
|
||||||
|| (hero.belongings.misc2 != null && hero.belongings.misc2.getClass() == this.getClass())){
|
|| (hero.belongings.misc != null && hero.belongings.misc.getClass() == this.getClass())){
|
||||||
|
|
||||||
GLog.w( Messages.get(Artifact.class, "cannot_wear_two") );
|
GLog.w( Messages.get(Artifact.class, "cannot_wear_two") );
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -59,8 +59,8 @@ public class WildEnergy extends TargetedSpell {
|
||||||
|
|
||||||
hero.belongings.charge(1f);
|
hero.belongings.charge(1f);
|
||||||
for (int i = 0; i < 4; i++){
|
for (int i = 0; i < 4; i++){
|
||||||
if (hero.belongings.misc1 instanceof Artifact) ((Artifact) hero.belongings.misc1).charge(hero);
|
if (hero.belongings.artifact instanceof Artifact) ((Artifact) hero.belongings.artifact).charge(hero);
|
||||||
if (hero.belongings.misc2 instanceof Artifact) ((Artifact) hero.belongings.misc2).charge(hero);
|
if (hero.belongings.misc instanceof Artifact) ((Artifact) hero.belongings.misc).charge(hero);
|
||||||
}
|
}
|
||||||
|
|
||||||
Buff.affect(hero, Recharging.class, 8f);
|
Buff.affect(hero, Recharging.class, 8f);
|
||||||
|
|
|
@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
|
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
|
||||||
|
@ -94,11 +95,15 @@ public class WndBag extends WndTabbed {
|
||||||
NOT_EQUIPPED
|
NOT_EQUIPPED
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static final int COLS_P = 4;
|
protected static final int COLS_P = 5;
|
||||||
protected static final int COLS_L = 6;
|
protected static final int COLS_L = 5;
|
||||||
|
|
||||||
protected static final int SLOT_WIDTH = 28;
|
protected static int SLOT_WIDTH_P = 24;
|
||||||
protected static final int SLOT_HEIGHT = 28;
|
protected static int SLOT_WIDTH_L = 28;
|
||||||
|
|
||||||
|
protected static int SLOT_HEIGHT_P = 28;
|
||||||
|
protected static int SLOT_HEIGHT_L = 24;
|
||||||
|
|
||||||
protected static final int SLOT_MARGIN = 1;
|
protected static final int SLOT_MARGIN = 1;
|
||||||
|
|
||||||
protected static final int TITLE_HEIGHT = 14;
|
protected static final int TITLE_HEIGHT = 14;
|
||||||
|
@ -109,6 +114,9 @@ public class WndBag extends WndTabbed {
|
||||||
|
|
||||||
private int nCols;
|
private int nCols;
|
||||||
|
|
||||||
|
private int slotWidth;
|
||||||
|
private int slotHeight;
|
||||||
|
|
||||||
protected int count;
|
protected int count;
|
||||||
protected int col;
|
protected int col;
|
||||||
protected int row;
|
protected int row;
|
||||||
|
@ -132,14 +140,17 @@ public class WndBag extends WndTabbed {
|
||||||
lastMode = mode;
|
lastMode = mode;
|
||||||
lastBag = bag;
|
lastBag = bag;
|
||||||
|
|
||||||
|
slotWidth = PixelScene.landscape() ? SLOT_WIDTH_L : SLOT_WIDTH_P;
|
||||||
|
slotHeight = PixelScene.landscape() ? SLOT_HEIGHT_L : SLOT_HEIGHT_P;
|
||||||
|
|
||||||
nCols = PixelScene.landscape() ? COLS_L : COLS_P;
|
nCols = PixelScene.landscape() ? COLS_L : COLS_P;
|
||||||
int slotsWidth = SLOT_WIDTH * nCols + SLOT_MARGIN * (nCols - 1);
|
int slotsWidth = slotWidth * nCols + SLOT_MARGIN * (nCols - 1);
|
||||||
|
|
||||||
placeTitle( bag, slotsWidth );
|
placeTitle( bag, slotsWidth );
|
||||||
|
|
||||||
placeItems( bag );
|
placeItems( bag );
|
||||||
|
|
||||||
int slotsHeight = SLOT_HEIGHT * row + SLOT_MARGIN * (row - 1);
|
int slotsHeight = slotHeight * row + SLOT_MARGIN * (row - 1);
|
||||||
|
|
||||||
resize( slotsWidth, slotsHeight + TITLE_HEIGHT );
|
resize( slotsWidth, slotsHeight + TITLE_HEIGHT );
|
||||||
|
|
||||||
|
@ -217,8 +228,9 @@ public class WndBag extends WndTabbed {
|
||||||
Belongings stuff = Dungeon.hero.belongings;
|
Belongings stuff = Dungeon.hero.belongings;
|
||||||
placeItem( stuff.weapon != null ? stuff.weapon : new Placeholder( ItemSpriteSheet.WEAPON_HOLDER ) );
|
placeItem( stuff.weapon != null ? stuff.weapon : new Placeholder( ItemSpriteSheet.WEAPON_HOLDER ) );
|
||||||
placeItem( stuff.armor != null ? stuff.armor : new Placeholder( ItemSpriteSheet.ARMOR_HOLDER ) );
|
placeItem( stuff.armor != null ? stuff.armor : new Placeholder( ItemSpriteSheet.ARMOR_HOLDER ) );
|
||||||
placeItem( stuff.misc1 != null ? stuff.misc1 : new Placeholder( ItemSpriteSheet.RING_HOLDER ) );
|
placeItem( stuff.artifact != null ? stuff.artifact : new Placeholder( ItemSpriteSheet.ARTIFACT_HOLDER ) );
|
||||||
placeItem( stuff.misc2 != null ? stuff.misc2 : new Placeholder( ItemSpriteSheet.RING_HOLDER ) );
|
placeItem( stuff.misc != null ? stuff.misc : new Placeholder( ItemSpriteSheet.SOMETHING ) );
|
||||||
|
placeItem( stuff.ring != null ? stuff.ring : new Placeholder( ItemSpriteSheet.RING_HOLDER ) );
|
||||||
|
|
||||||
//the container itself if it's not the root backpack
|
//the container itself if it's not the root backpack
|
||||||
if (container != Dungeon.hero.belongings.backpack){
|
if (container != Dungeon.hero.belongings.backpack){
|
||||||
|
@ -236,7 +248,7 @@ public class WndBag extends WndTabbed {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free Space
|
// Free Space
|
||||||
while ((count - 4) < container.capacity()) {
|
while ((count - 5) < container.capacity()) {
|
||||||
placeItem( null );
|
placeItem( null );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,8 +257,8 @@ public class WndBag extends WndTabbed {
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
int x = col * (SLOT_WIDTH + SLOT_MARGIN);
|
int x = col * (slotWidth + SLOT_MARGIN);
|
||||||
int y = TITLE_HEIGHT + row * (SLOT_HEIGHT + SLOT_MARGIN);
|
int y = TITLE_HEIGHT + row * (slotHeight + SLOT_MARGIN);
|
||||||
|
|
||||||
add( new ItemButton( item ).setPos( x, y ) );
|
add( new ItemButton( item ).setPos( x, y ) );
|
||||||
|
|
||||||
|
@ -357,13 +369,13 @@ public class WndBag extends WndTabbed {
|
||||||
bg.visible = false;
|
bg.visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = SLOT_WIDTH;
|
width = slotWidth;
|
||||||
height = SLOT_HEIGHT;
|
height = slotHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
bg = new ColorBlock( SLOT_WIDTH, SLOT_HEIGHT, NORMAL );
|
bg = new ColorBlock( 1, 1, NORMAL );
|
||||||
add( bg );
|
add( bg );
|
||||||
|
|
||||||
super.createChildren();
|
super.createChildren();
|
||||||
|
@ -371,6 +383,7 @@ public class WndBag extends WndTabbed {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
|
bg.size(width, height);
|
||||||
bg.x = x;
|
bg.x = x;
|
||||||
bg.y = y;
|
bg.y = y;
|
||||||
|
|
||||||
|
|
|
@ -238,11 +238,14 @@ public class WndRanking extends WndTabbed {
|
||||||
if (stuff.armor != null) {
|
if (stuff.armor != null) {
|
||||||
addItem( stuff.armor );
|
addItem( stuff.armor );
|
||||||
}
|
}
|
||||||
if (stuff.misc1 != null) {
|
if (stuff.artifact != null) {
|
||||||
addItem( stuff.misc1);
|
addItem( stuff.artifact );
|
||||||
}
|
}
|
||||||
if (stuff.misc2 != null) {
|
if (stuff.misc != null) {
|
||||||
addItem( stuff.misc2);
|
addItem( stuff.misc );
|
||||||
|
}
|
||||||
|
if (stuff.ring != null) {
|
||||||
|
addItem( stuff.ring );
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
@ -250,14 +253,14 @@ public class WndRanking extends WndTabbed {
|
||||||
if (Dungeon.quickslot.getItem(i) != null){
|
if (Dungeon.quickslot.getItem(i) != null){
|
||||||
QuickSlotButton slot = new QuickSlotButton(Dungeon.quickslot.getItem(i));
|
QuickSlotButton slot = new QuickSlotButton(Dungeon.quickslot.getItem(i));
|
||||||
|
|
||||||
slot.setRect( pos, 116, 28, 28 );
|
slot.setRect( pos, 120, 28, 23 );
|
||||||
|
|
||||||
add(slot);
|
add(slot);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ColorBlock bg = new ColorBlock( 28, 28, 0x9953564D );
|
ColorBlock bg = new ColorBlock( 28, 23, 0x9953564D );
|
||||||
bg.x = pos;
|
bg.x = pos;
|
||||||
bg.y = 116;
|
bg.y = 120;
|
||||||
add(bg);
|
add(bg);
|
||||||
}
|
}
|
||||||
pos += 29;
|
pos += 29;
|
||||||
|
@ -286,10 +289,10 @@ public class WndRanking extends WndTabbed {
|
||||||
list.setSize( WIDTH, HEIGHT );
|
list.setSize( WIDTH, HEIGHT );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ItemButton extends Button {
|
private class ItemButton extends Button {
|
||||||
|
|
||||||
public static final int HEIGHT = 28;
|
public static final int HEIGHT = 23;
|
||||||
|
|
||||||
private Item item;
|
private Item item;
|
||||||
|
|
||||||
|
@ -316,7 +319,7 @@ public class WndRanking extends WndTabbed {
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
|
|
||||||
bg = new ColorBlock( HEIGHT, HEIGHT, 0x9953564D );
|
bg = new ColorBlock( 28, HEIGHT, 0x9953564D );
|
||||||
add( bg );
|
add( bg );
|
||||||
|
|
||||||
slot = new ItemSlot();
|
slot = new ItemSlot();
|
||||||
|
@ -333,7 +336,7 @@ public class WndRanking extends WndTabbed {
|
||||||
bg.x = x;
|
bg.x = x;
|
||||||
bg.y = y;
|
bg.y = y;
|
||||||
|
|
||||||
slot.setRect( x, y, HEIGHT, HEIGHT );
|
slot.setRect( x, y, 28, HEIGHT );
|
||||||
PixelScene.align(slot);
|
PixelScene.align(slot);
|
||||||
|
|
||||||
name.maxWidth((int)(width - slot.width() - 2));
|
name.maxWidth((int)(width - slot.width() - 2));
|
||||||
|
@ -365,7 +368,7 @@ public class WndRanking extends WndTabbed {
|
||||||
|
|
||||||
private class QuickSlotButton extends ItemSlot{
|
private class QuickSlotButton extends ItemSlot{
|
||||||
|
|
||||||
public static final int HEIGHT = 28;
|
public static final int HEIGHT = 23;
|
||||||
|
|
||||||
private Item item;
|
private Item item;
|
||||||
private ColorBlock bg;
|
private ColorBlock bg;
|
||||||
|
@ -377,7 +380,7 @@ public class WndRanking extends WndTabbed {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
bg = new ColorBlock( HEIGHT, HEIGHT, 0x9953564D );
|
bg = new ColorBlock( 28, HEIGHT, 0x9953564D );
|
||||||
add( bg );
|
add( bg );
|
||||||
|
|
||||||
super.createChildren();
|
super.createChildren();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user