mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-21 20:18:14 +07:00
Fixes #10
This commit is contained in:
parent
395e0274b8
commit
94883beba5
@ -22,7 +22,7 @@ public class ItemHolder extends Entity {
|
||||
this.item = item;
|
||||
name(item.getName());
|
||||
|
||||
flippyDescriptor = new AssetDescriptor<>(Type.ITM.PATH + "\\" + item.base.flippyfile + ".dc6", DC6.class);
|
||||
flippyDescriptor = new AssetDescriptor<>(Type.ITM.PATH + "\\" + item.getFlippyFile() + ".dc6", DC6.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -40,16 +40,15 @@ public class ItemHolder extends Entity {
|
||||
Riiablo.assets.load(flippyDescriptor);
|
||||
Riiablo.assets.finishLoadingAsset(flippyDescriptor);
|
||||
flippy = Riiablo.assets.get(flippyDescriptor);
|
||||
byte packedTransform = (byte) ((item.base.Transform << 5) | (item.charColorIndex & 0x1F));
|
||||
animation = Animation.builder()
|
||||
.layer(flippy, BlendMode.ID, packedTransform)
|
||||
.layer(flippy, BlendMode.ID, (byte) ((item.base.Transform << 5) | (item.charColorIndex & 0x1F)))
|
||||
.build();
|
||||
animation.setLooping(false);
|
||||
animation.updateBox();
|
||||
animation.addAnimationListener(item.base.dropsfxframe, new Animation.AnimationListener() {
|
||||
animation.addAnimationListener(item.getDropFxFrame(), new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onTrigger(Animation animation, int frame) {
|
||||
Riiablo.audio.play(item.base.dropsound, true);
|
||||
Riiablo.audio.play(item.getDropSound(), true);
|
||||
animation.removeAnimationListener(frame, this);
|
||||
}
|
||||
});
|
||||
|
@ -421,7 +421,16 @@ public class Item extends Actor implements Disposable {
|
||||
}
|
||||
|
||||
private String getInvFileName() {
|
||||
if (pictureId >= 0) return type.InvGfx[pictureId];
|
||||
if (pictureId >= 0) {
|
||||
if (isIdentified() && quality == Quality.UNIQUE) {
|
||||
if (qualityId == 381) { // Annihilus
|
||||
return "invmss";
|
||||
} else if (qualityId == 400) { // Hellfire Torch
|
||||
return "invtrch";
|
||||
}
|
||||
}
|
||||
return type.InvGfx[pictureId];
|
||||
}
|
||||
switch (quality) {
|
||||
case SET:
|
||||
return !base.setinvfile.isEmpty()
|
||||
@ -516,6 +525,61 @@ public class Item extends Actor implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
public String getFlippyFile() {
|
||||
if (isIdentified() && quality == Quality.UNIQUE) {
|
||||
if (qualityId == 381) { // Annihilus
|
||||
return findBase("mss").flippyfile;
|
||||
} else if (qualityId == 400) { // Hellfire Torch
|
||||
return findBase("tch").flippyfile;
|
||||
}
|
||||
}
|
||||
|
||||
return base.flippyfile;
|
||||
}
|
||||
|
||||
public int getDropFxFrame() {
|
||||
if (isIdentified() && quality == Quality.UNIQUE) {
|
||||
if (qualityId == 381) { // Annihilus
|
||||
return findBase("mss").dropsfxframe;
|
||||
} else if (qualityId == 400) { // Hellfire Torch
|
||||
return findBase("tch").dropsfxframe;
|
||||
}
|
||||
}
|
||||
|
||||
return base.dropsfxframe;
|
||||
}
|
||||
|
||||
public String getDropSound() {
|
||||
if (isIdentified() && quality == Quality.UNIQUE) {
|
||||
if (qualityId == 381) { // Annihilus
|
||||
return "item_gem";
|
||||
} else if (qualityId == 400) { // Hellfire Torch
|
||||
return "item_gem";
|
||||
}
|
||||
}
|
||||
|
||||
return base.dropsound;
|
||||
}
|
||||
|
||||
public String getUseSound() {
|
||||
/*
|
||||
// Neither are usable
|
||||
if (isIdentified() && quality == Quality.UNIQUE) {
|
||||
if (qualityId == 381) { // Annihilus
|
||||
return "item_gem";
|
||||
} else if (qualityId == 400) { // Hellfire Torch
|
||||
return "item_gem";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return base.usesound;
|
||||
}
|
||||
|
||||
public boolean isIdentified() {
|
||||
return (flags & IDENTIFIED) == IDENTIFIED;
|
||||
}
|
||||
|
||||
public boolean isEthereal() {
|
||||
return (flags & ETHEREAL) == ETHEREAL;
|
||||
}
|
||||
@ -585,8 +649,14 @@ public class Item extends Actor implements Disposable {
|
||||
Label usable;
|
||||
|
||||
Details() {
|
||||
setBackground(new PaletteIndexedColorDrawable(Riiablo.colors.modal75));
|
||||
pad(PADDING);
|
||||
// TODO: Change this to a static object ref
|
||||
setBackground(new PaletteIndexedColorDrawable(Riiablo.colors.modal75) {{
|
||||
setLeftWidth(PADDING);
|
||||
setTopHeight(PADDING - 2); // font16 has extra top padding, changing this would require propagating elsewhere
|
||||
setRightWidth(PADDING);
|
||||
setBottomHeight(PADDING);
|
||||
}});
|
||||
//pad(PADDING);
|
||||
|
||||
BitmapFont font = Riiablo.fonts.font16;
|
||||
name = new Label(Item.this.getName(), font);
|
||||
|
@ -319,7 +319,7 @@ public class InventoryPanel extends WidgetGroup implements Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
Riiablo.audio.play(cursor.base.dropsound, true);
|
||||
Riiablo.audio.play(cursor.getDropSound(), true);
|
||||
Riiablo.cursor.setItem(item);
|
||||
item = cursor;
|
||||
gameScreen.player.setSlot(InventoryPanel.BodyPart.this.bodyLoc, item);
|
||||
|
@ -89,7 +89,7 @@ public class ItemGrid extends Group {
|
||||
|
||||
Item cursor = Riiablo.cursor.getItem();
|
||||
if (cursor != null) {
|
||||
Riiablo.audio.play(cursor.base.dropsound, true);
|
||||
Riiablo.audio.play(cursor.getDropSound(), true);
|
||||
if (swap != null) {
|
||||
Riiablo.cursor.setItem(swap.item);
|
||||
removeActor(swap);
|
||||
@ -260,7 +260,7 @@ public class ItemGrid extends Group {
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
ItemEntry entry = StoredItem.this.item.base;
|
||||
if (entry.useable) {
|
||||
Riiablo.audio.play(entry.usesound, true);
|
||||
Riiablo.audio.play(StoredItem.this.item.getUseSound(), true);
|
||||
}/* else if (Riiablo.cursor.getItem() == null) {
|
||||
String[] BodyLocs = item.type.BodyLoc;
|
||||
for (String BodyLoc : BodyLocs) {
|
||||
|
Loading…
Reference in New Issue
Block a user