mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-21 20:18:14 +07:00
Added item stat list to item details
This commit is contained in:
parent
0429e456d8
commit
0aa620d79b
@ -29,6 +29,7 @@ import com.riiablo.widget.Label;
|
|||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
|
||||||
import static com.riiablo.item.Quality.SET;
|
import static com.riiablo.item.Quality.SET;
|
||||||
@ -55,6 +56,8 @@ public class Item extends Actor implements Disposable {
|
|||||||
private static final int INSCRIBED = 0x01000000;
|
private static final int INSCRIBED = 0x01000000;
|
||||||
private static final int RUNEWORD = 0x04000000;
|
private static final int RUNEWORD = 0x04000000;
|
||||||
|
|
||||||
|
private static final EnumMap<Stat, Stat.Instance>[] EMPTY_STAT_ARRAY = (EnumMap<Stat, Stat.Instance>[]) new EnumMap[0];
|
||||||
|
|
||||||
public int flags;
|
public int flags;
|
||||||
public int version; // 0 = pre-1.08; 1 = 1.08/1.09 normal; 2 = 1.10 normal; 100 = 1.08/1.09 expansion; 101 = 1.10 expansion
|
public int version; // 0 = pre-1.08; 1 = 1.08/1.09 normal; 2 = 1.10 normal; 100 = 1.08/1.09 expansion; 101 = 1.10 expansion
|
||||||
public Location location;
|
public Location location;
|
||||||
@ -149,6 +152,7 @@ public class Item extends Actor implements Disposable {
|
|||||||
qualityData = null;
|
qualityData = null;
|
||||||
runewordData = 0;
|
runewordData = 0;
|
||||||
inscription = null;
|
inscription = null;
|
||||||
|
stats = EMPTY_STAT_ARRAY;
|
||||||
} else {
|
} else {
|
||||||
id = bitStream.read32BitsOrLess(Integer.SIZE);
|
id = bitStream.read32BitsOrLess(Integer.SIZE);
|
||||||
level = bitStream.readUnsigned7OrLess(7);
|
level = bitStream.readUnsigned7OrLess(7);
|
||||||
@ -770,6 +774,24 @@ public class Item extends Actor implements Disposable {
|
|||||||
add(usable).center().space(SPACING).row();
|
add(usable).center().space(SPACING).row();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < stats.length; i++) {
|
||||||
|
EnumMap<Stat, Stat.Instance> stats = Item.this.stats[i];
|
||||||
|
if (stats == null) continue;
|
||||||
|
Array<Stat.Instance> values = new Array<>();
|
||||||
|
for (Stat.Instance stat : stats.values()) values.add(stat);
|
||||||
|
values.sort(new Comparator<Stat.Instance>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Stat.Instance o1, Stat.Instance o2) {
|
||||||
|
return o1.stat.entry().descpriority - o2.stat.entry().descpriority;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (Stat.Instance stat : values) {
|
||||||
|
Label label = new Label(stat.stat + ": " + stat, font);
|
||||||
|
add(label).center().space(SPACING).row();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user