Replacing elemental skill shortcuts.

This commit is contained in:
MobiusDev
2016-01-05 13:36:39 +00:00
parent 1e116574b8
commit c4c6ffcb41
3 changed files with 40 additions and 1 deletions

View File

@@ -292,4 +292,23 @@ public class ShortCuts implements IRestorable
}
}
}
/**
* Replace the shortcut icon with the new skill.
* @param skillId the skill Id to search.
* @param newSkillId the skill Id to replace.
*/
public void replaceShortCuts(int skillId, int newSkillId)
{
// Replace all the shortcuts with the new skill
for (Shortcut sc : _shortCuts.values())
{
if ((sc.getId() == skillId) && (sc.getType() == ShortcutType.SKILL))
{
final Shortcut newsc = new Shortcut(sc.getSlot(), sc.getPage(), sc.getType(), newSkillId, sc.getLevel(), 1);
_owner.sendPacket(new ShortCutRegister(newsc));
_owner.registerShortCut(newsc);
}
}
}
}

View File

@@ -1651,6 +1651,16 @@ public final class L2PcInstance extends L2Playable
_shortCuts.updateShortCuts(skillId, skillLevel);
}
/**
* Replace the shortcut icon with the new skill.
* @param skillId the skill Id to search.
* @param newSkillId the skill Id to replace.
*/
public void replaceShortCuts(int skillId, int newSkillId)
{
_shortCuts.replaceShortCuts(skillId, newSkillId);
}
/**
* Delete the L2ShortCut corresponding to the position (page-slot) from the L2PcInstance _shortCuts.
* @param slot