Removed passive skill from the skill list GUI

This commit is contained in:
Ka0rX 2023-03-09 23:10:49 +01:00
parent b7d3aa07eb
commit 81f245a4ce
2 changed files with 8 additions and 84 deletions

View File

@ -5,7 +5,6 @@ import io.lumine.mythic.lib.api.player.MMOPlayerData;
import io.lumine.mythic.lib.api.stat.StatInstance;
import io.lumine.mythic.lib.api.stat.modifier.StatModifier;
import io.lumine.mythic.lib.player.cooldown.CooldownMap;
import io.lumine.mythic.lib.player.skill.PassiveSkill;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.ConfigMessage;
import net.Indyuce.mmocore.api.SoundEvent;
@ -82,7 +81,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
@Nullable
private PlayerClass profess;
private int level, classPoints, skillPoints, attributePoints, attributeReallocationPoints;
private int numberSlots, skillTreeReallocationPoints, skillReallocationPoints;
private int skillSlotLimit, skillTreeReallocationPoints, skillReallocationPoints;
private double experience;
private double mana, stamina, stellium;
private Guild guild;
@ -459,12 +458,12 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
return skillPoints;
}
public int getNumberSlots() {
return numberSlots;
public int getSkillSlotLimit() {
return skillSlotLimit;
}
public void setNumberSlots(int numberSlots) {
this.numberSlots = numberSlots;
public void setSkillSlotLimit(int skillSlotLimit) {
this.skillSlotLimit = skillSlotLimit;
}
public void giveSkillReallocationPoints(int value) {

View File

@ -61,11 +61,11 @@ public class SkillList extends EditableInventory {
};
}
if (function.equals("active-slot"))
if (function.equals("slot"))
return new SlotItem(config) {
@Override
public ItemStack display(SkillViewerInventory inv, int n) {
if (n >= inv.getPlayerData().getProfess().getMaxBoundActiveSkills()) {
if (n >= inv.getPlayerData().getSkillSlotLimit()) {
return new ItemStack(Material.AIR);
}
ItemStack item = super.display(inv, n);
@ -91,38 +91,6 @@ public class SkillList extends EditableInventory {
}
};
if (function.equals("passive-slot"))
return new SlotItem(config) {
@Override
public ItemStack display(SkillViewerInventory inv, int n) {
if (n >= inv.getPlayerData().getProfess().getMaxBoundPassiveSkills()) {
return new ItemStack(Material.AIR);
}
ItemStack item = super.display(inv, n);
if (!inv.getPlayerData().hasPassiveSkillBound(n)) {
item.setType(super.emptyMaterial);
if (MythicLib.plugin.getVersion().isStrictlyHigher(1, 13)) {
ItemMeta meta = item.getItemMeta();
meta.setCustomModelData(super.emptyCMD);
item.setItemMeta(meta);
}
}
return item;
}
@Override
public Placeholders getPlaceholders(SkillViewerInventory inv, int n) {
Placeholders holders= super.getPlaceholders(inv, n);
String none = MythicLib.plugin.parseColors(config.getString("no-skill"));
RegisteredSkill skill = inv.getPlayerData().hasPassiveSkillBound(n) ?
MMOCore.plugin.skillManager.getSkill(inv.getPlayerData().getBoundPassiveSkill(n).getTriggeredSkill().getHandler().getId())
: null;
holders.register("skill", skill == null ? none : skill.getName());
return holders;
}
};
if (function.equals("previous"))
return new SimplePlaceholderItem<SkillViewerInventory>(config) {
@ -408,49 +376,6 @@ public class SkillList extends EditableInventory {
return;
}
/*
* binding or unbinding passive skills.
*/
if (item.getFunction().equals("passive-slot")) {
int index = passiveSlotSlots.indexOf(context.getSlot());
// unbind if there is a current spell.
if (context.getClickType() == ClickType.RIGHT) {
if (!playerData.hasPassiveSkillBound(index)) {
MMOCore.plugin.configManager.getSimpleMessage("no-skill-bound").send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
return;
}
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
playerData.unbindPassiveSkill(index);
open();
return;
}
if (selected == null)
return;
if (!selected.getSkill().getTrigger().isPassive()) {
MMOCore.plugin.configManager.getSimpleMessage("not-passive-skill").send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
return;
}
if (!playerData.hasSkillUnlocked(selected)) {
MMOCore.plugin.configManager.getSimpleMessage("not-unlocked-skill").send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2);
return;
}
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
playerData.bindPassiveSkill(index, selected.toPassive(playerData));
open();
return;
}
/*
* binding or unbinding skills.
*/
@ -487,7 +412,7 @@ public class SkillList extends EditableInventory {
}
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2);
playerData.bindActiveSkill(index, selected);
playerData.bindSkill(index, selected);
open();
return;
}