Originally Posted by
bobismyname
TODO:
- Configs for pressing the buttons, cba to find them in the meantime.
If you can find any of those, please contribute to this thread and I will update it.
Code:
private Map<Skill, Boolean> skills = new HashMap<Skill, Boolean>();
Buttons:
Code:
if(Skill.getSkillByComponent(componentId) == null)
return;
skills.put(Skill.getSkillByComponent(componentId), !skills.get(Skill.getSkillByComponent(componentId)));
player.getPackets().sendConfigByFile(Skill.getSkillByComponent(componentId).getBitConfig(), skills.get(Skill.getSkillByComponent(componentId)) ? 1 : 0);
Skills
Code:
/**
* @author Joris
*
*/
public enum Skill {
RUNECRAFTING(4090, 74),
CRAFTING(4091, 75),
FLETCHING(4093, 76),
CONSTRUCTION(4095, 77),
FARMING(4096, 78),
MAGIC(4098, 79),
SMITHING(4100, 80),
COOKING(4101, 81),
HERBLORE(4102, 82);
private int bitConfig;
private int component;
Skill(int bitConfig, int component) {
this.setBitConfig(bitConfig);
this.setComponent(component);
}
/**
* @return the bitConfig
*/
public int getBitConfig() {
return bitConfig;
}
/**
* @param bitConfig the bitConfig to set
*/
public void setBitConfig(int bitConfig) {
this.bitConfig = bitConfig;
}
/**
* @return the component
*/
public int getComponent() {
return component;
}
/**
* @param component the component to set
*/
public void setComponent(int component) {
this.component = component;
}
/**
* Gets skill by component id
* @param componentId
* @return
*/
public static Skill getSkillByComponent(int componentId) {
return Arrays.stream(Skill.values()).filter(skill -> skill.getComponent() == componentId).findAny().orElseGet(null);
}
}
Sending XP:
Code:
player.getPackets().sendConfigByFile(4103, ((int) experience * 10));