Added support for charged skill -- further testing required

This commit is contained in:
Collin Smith 2019-04-18 22:01:48 -07:00
parent d45bad230e
commit 961acb0df1
3 changed files with 13 additions and 6 deletions

View File

@ -264,7 +264,7 @@ public class CharData {
skills.getAndIncrement(stat.param(), 0, stat.value());
break;
case Stat.item_charged_skill: // FIXME: This is incorrect on purpose
skills.getAndIncrement(stat.param2(), 0, stat.param1());
skills.getAndIncrement(0xF0000000 | stat.param2(), 0, stat.param1());
break;
default:
// do nothing

View File

@ -123,26 +123,29 @@ public class SpellsQuickPanel extends Table implements Disposable, CharData.Skil
for (IntIntMap.Entry skillId : skills) {
if (skillId.value <= 0) continue; // level <= 0
final Skills.Entry skill = Riiablo.files.skills.get(skillId.key);
boolean charged = (skillId.key & 0xF0000000) != 0;
int key = skillId.key & 0x0FFFFFFF;
final Skills.Entry skill = Riiablo.files.skills.get(key);
if (leftSkills && !skill.leftskill) continue;
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 ListRow = charged ? 4 : desc.ListRow;
Table table = tables[ListRow];
int iconCel = desc.IconCel;
DC icons = getSkillicon(skill.charclass, iconCel);
if (icons == null) {
icons = Skillicon;
iconCel = 20;
}
final HotkeyButton button = new HotkeyButton(icons, iconCel, skill.Id);
final HotkeyButton button = new HotkeyButton(icons, iconCel, skill.Id, charged);
if (skill.aura) {
button.setBlendMode(BlendMode.DARKEN, Riiablo.colors.darkenGold);
}
int index = Riiablo.charData.getHotkey(leftSkills ? Input.Buttons.LEFT : Input.Buttons.RIGHT, skillId.key);
int index = Riiablo.charData.getHotkey(leftSkills ? Input.Buttons.LEFT : Input.Buttons.RIGHT, key);
if (index != ArrayUtils.INDEX_NOT_FOUND) {
MappedKey mapping = Keys.Skill[index];
button.map(mapping);

View File

@ -15,6 +15,10 @@ public class HotkeyButton extends Button {
int skillId;
public HotkeyButton(final DC dc, final int index, int skillId) {
this(dc, index, skillId, false);
}
public HotkeyButton(final DC dc, final int index, int skillId, boolean charged) {
super(new ButtonStyle() {{
up = new TextureRegionDrawable(dc.getTexture(index));
down = new TextureRegionDrawable(dc.getTexture(index + 1));
@ -27,7 +31,7 @@ public class HotkeyButton extends Button {
row();
add().grow();
row();
add(charges = new Label("", Riiablo.fonts.font16, Riiablo.colors.blue)).align(Align.bottomLeft);
add(charges = new Label(charged ? "0" : "", Riiablo.fonts.font16, Riiablo.colors.blue)).align(Align.bottomLeft);
pad(2);
pack();