diff --git a/core/src/com/riiablo/CharData.java b/core/src/com/riiablo/CharData.java index 6da932f2..9e5d9f70 100644 --- a/core/src/com/riiablo/CharData.java +++ b/core/src/com/riiablo/CharData.java @@ -38,6 +38,17 @@ public class CharData { private final IntIntMap skills = new IntIntMap(); private final Attributes stats = new Attributes(); + private static final IntIntMap defaultSkills = new IntIntMap(); + static { + // TODO: throw skills added dynamically depending on weapon + defaultSkills.put(0, 1); // attack + defaultSkills.put(1, 1); // kick + //defaultSkills.put(2, 1); // throw + defaultSkills.put(3, 1); // unsummon + //defaultSkills.put(4, 1); // left hand throw + defaultSkills.put(5, 1); // left hand swing + } + public CharData() { for (StoreLoc storeLoc : StoreLoc.values()) store.put(storeLoc, new Array()); } @@ -157,6 +168,7 @@ public class CharData { stats.update(this); // TODO: this need to be done whenever an item is changed skills.clear(); + skills.putAll(defaultSkills); for (int spellId = charClass.firstSpell, i = 0; spellId < charClass.lastSpell; spellId++, i++) { skills.put(spellId, d2s.skills.data[i]); } @@ -185,6 +197,7 @@ public class CharData { stats.reset(); final int alternate = getAlternate(); for (Item item : equipped.values()) { + if (item == null) continue; item.update(); if (item.bodyLoc == BodyLoc.getAlternate(item.bodyLoc, alternate)) { stats.add(item.props.remaining()); @@ -206,6 +219,7 @@ public class CharData { stats.aggregate().get(Stat.armorclass).add(dex / 4); skills.clear(); + skills.putAll(defaultSkills); for (int spellId = charClass.firstSpell, i = 0; spellId < charClass.lastSpell; spellId++, i++) { skills.put(spellId, d2s.skills.data[i]); } diff --git a/core/src/com/riiablo/panel/SpellsQuickPanel.java b/core/src/com/riiablo/panel/SpellsQuickPanel.java index 20e675af..69138e7e 100644 --- a/core/src/com/riiablo/panel/SpellsQuickPanel.java +++ b/core/src/com/riiablo/panel/SpellsQuickPanel.java @@ -39,6 +39,7 @@ public class SpellsQuickPanel extends Table implements Disposable, CharData.Skil DC6 CharSkillicon[]; private static int getClassId(String charClass) { + if (charClass.isEmpty()) return -1; switch (charClass.charAt(0)) { case 'a': return charClass.charAt(1) == 'm' ? CharacterClass.AMAZON.id : CharacterClass.ASSASSIN.id; case 'b': return CharacterClass.BARBARIAN.id; @@ -87,24 +88,11 @@ public class SpellsQuickPanel extends Table implements Disposable, CharData.Skil ALIGN = leftSkills ? Align.left : Align.right; keyMappings = new ObjectMap<>(31); - Table top = new Table() {{ - add(new HotkeyButton(Skillicon, 14, -1)).size(SIZE); - add(new HotkeyButton(Skillicon, 18, -1)).size(SIZE); - pack(); - }}; tables = new Table[5]; - for (int i = 0; i < tables.length; i++) tables[i] = new Table(); - Table bottom = new Table() {{ - add(new HotkeyButton(Skillicon, 4, -1)).size(SIZE); - add(new HotkeyButton(Skillicon, 6, -1)).size(SIZE); - add(new HotkeyButton(Skillicon, 2, -1)).size(SIZE); - pack(); - }}; - add(top).align(ALIGN).row(); for (int i = tables.length - 1; i >= 0; i--) { - add(tables[i]).align(ALIGN).row(); + Table table = tables[i] = new Table(); + add(table).align(ALIGN).row(); } - add(bottom).align(ALIGN).row(); pack(); //setDebug(true, true); @@ -140,6 +128,8 @@ public class SpellsQuickPanel extends Table implements Disposable, CharData.Skil if (skill.passive) continue; final SkillDesc.Entry desc = Riiablo.files.skilldesc.get(skill.skilldesc); + if (desc.ListRow < 0) continue; + Table table = tables[desc.ListRow]; int iconCel = desc.IconCel; DC icons = getSkillicon(skill.charclass, iconCel);