mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-20 19:49:47 +07:00
Implemented half of #21
Added Sets excel Moved set items list from SetItems to Set Added reference to Set.Entry in SetItems.Entry Added reference to list of SetItems.Entry in Set.Entry
This commit is contained in:
parent
22a1498d64
commit
150494b45e
@ -40,6 +40,7 @@ import com.riiablo.codec.excel.RarePrefix;
|
||||
import com.riiablo.codec.excel.RareSuffix;
|
||||
import com.riiablo.codec.excel.Runes;
|
||||
import com.riiablo.codec.excel.SetItems;
|
||||
import com.riiablo.codec.excel.Sets;
|
||||
import com.riiablo.codec.excel.SkillDesc;
|
||||
import com.riiablo.codec.excel.Skills;
|
||||
import com.riiablo.codec.excel.Sounds;
|
||||
@ -84,6 +85,7 @@ public class Files {
|
||||
public final RarePrefix RarePrefix;
|
||||
public final RareSuffix RareSuffix;
|
||||
public final Runes Runes;
|
||||
public final Sets Sets;
|
||||
public final SetItems SetItems;
|
||||
public final Skills skills;
|
||||
public final SkillDesc skilldesc;
|
||||
@ -130,6 +132,7 @@ public class Files {
|
||||
PlrType = load(assets, PlrType.class);
|
||||
Properties = load(assets, Properties.class, Excel.EXPANSION);
|
||||
QualityItems = load(assets, QualityItems.class);
|
||||
Sets = load(assets, Sets.class, Excel.EXPANSION);
|
||||
SetItems = load(assets, SetItems.class, Excel.EXPANSION);
|
||||
skills = load(assets, Skills.class);
|
||||
skilldesc = load(assets, SkillDesc.class);
|
||||
@ -139,6 +142,8 @@ public class Files {
|
||||
//UniqueSuffix = load(assets, UniqueSuffix.class);
|
||||
WeaponClass = load(assets, WeaponClass.class);
|
||||
weapons = load(assets, Weapons.class);
|
||||
|
||||
Sets.index(SetItems);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -1,30 +1,18 @@
|
||||
package com.riiablo.codec.excel;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
|
||||
public class SetItems extends Excel<SetItems.Entry> {
|
||||
private final ObjectMap<String, Array<SetItems.Entry>> sets = new ObjectMap<>();
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
for (SetItems.Entry item : this) {
|
||||
Array<SetItems.Entry> items = sets.get(item.set);
|
||||
if (items == null) sets.put(item.set, items = new Array<>(6));
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public Array<SetItems.Entry> getItems(SetItems.Entry item) {
|
||||
return sets.get(item.set);
|
||||
}
|
||||
|
||||
public static class Entry extends Excel.Entry {
|
||||
@Override
|
||||
public String toString() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public Sets.Entry getSet() {
|
||||
return parentSet;
|
||||
}
|
||||
|
||||
Sets.Entry parentSet;
|
||||
|
||||
@Key
|
||||
@Column
|
||||
public String index;
|
||||
|
79
core/src/com/riiablo/codec/excel/Sets.java
Normal file
79
core/src/com/riiablo/codec/excel/Sets.java
Normal file
@ -0,0 +1,79 @@
|
||||
package com.riiablo.codec.excel;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.IntMap;
|
||||
|
||||
public class Sets extends Excel<Sets.Entry> {
|
||||
private final IntMap<Array<SetItems.Entry>> ITEMS = new IntMap<>();
|
||||
|
||||
public void index(SetItems items) {
|
||||
assert ITEMS.size == 0 : "Illegal state -- ITEM has already been indexed";
|
||||
for (SetItems.Entry item : items) {
|
||||
int id = index(item.set);
|
||||
Sets.Entry entry = item.parentSet = get(id);
|
||||
Array<SetItems.Entry> setItems = ITEMS.get(id);
|
||||
if (setItems == null) ITEMS.put(id, setItems = entry.items = new Array<>(6));
|
||||
setItems.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Entry extends Excel.Entry {
|
||||
@Override
|
||||
public String toString() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public Array<SetItems.Entry> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
Array<SetItems.Entry> items;
|
||||
|
||||
@Key
|
||||
@Column
|
||||
public String index;
|
||||
@Column public String name;
|
||||
@Column public int version;
|
||||
@Column public int level;
|
||||
@Column(format = "PCode2%s", endIndex = 2, values = {"a", "b"})
|
||||
public String PCode2[];
|
||||
@Column(format = "PParam2%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PParam2[];
|
||||
@Column(format = "PMin2%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PMin2[];
|
||||
@Column(format = "PMax2%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PMax2[];
|
||||
@Column(format = "PCode3%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PCode3[];
|
||||
@Column(format = "PParam3%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PParam3[];
|
||||
@Column(format = "PMin3%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PMin3[];
|
||||
@Column(format = "PMax3%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PMax3[];
|
||||
@Column(format = "PCode4%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PCode4[];
|
||||
@Column(format = "PParam4%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PParam4[];
|
||||
@Column(format = "PMin4%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PMin4[];
|
||||
@Column(format = "PMax4%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PMax4[];
|
||||
@Column(format = "PCode5%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PCode5[];
|
||||
@Column(format = "PParam5%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PParam5[];
|
||||
@Column(format = "PMin5%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PMin5[];
|
||||
@Column(format = "PMax5%s", endIndex = 2, values = {"a", "b"})
|
||||
public int PMax5[];
|
||||
@Column(startIndex = 1, endIndex = 9)
|
||||
public String FCode[];
|
||||
@Column(startIndex = 1, endIndex = 9)
|
||||
public int FParam[];
|
||||
@Column(startIndex = 1, endIndex = 9)
|
||||
public int FMin[];
|
||||
@Column(startIndex = 1, endIndex = 9)
|
||||
public int FMax[];
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ import com.riiablo.codec.excel.ItemTypes;
|
||||
import com.riiablo.codec.excel.MagicAffix;
|
||||
import com.riiablo.codec.excel.Misc;
|
||||
import com.riiablo.codec.excel.SetItems;
|
||||
import com.riiablo.codec.excel.Sets;
|
||||
import com.riiablo.codec.excel.UniqueItems;
|
||||
import com.riiablo.codec.excel.Weapons;
|
||||
import com.riiablo.codec.util.BBox;
|
||||
@ -985,9 +986,9 @@ public class Item extends Actor implements Disposable {
|
||||
// TODO: This can be cleaned up later -- add support for set detection
|
||||
if (quality == SET) {
|
||||
add().height(font.getLineHeight()).space(SPACING).row();
|
||||
final SetItems.Entry set = Riiablo.files.SetItems.get(qualityId);
|
||||
add(new Label(Riiablo.string.lookup(set.set), font, Riiablo.colors.gold)).space(SPACING).row();
|
||||
for (SetItems.Entry item : Riiablo.files.SetItems.getItems(set)) {
|
||||
Sets.Entry set = Riiablo.files.SetItems.get(qualityId).getSet();
|
||||
add(new Label(Riiablo.string.lookup(set.name), font, Riiablo.colors.gold)).space(SPACING).row();
|
||||
for (SetItems.Entry item : set.getItems()) {
|
||||
add(new Label(Riiablo.string.lookup(item.index), font, Riiablo.colors.red)).space(SPACING).row();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user