mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-23 00:05:52 +01:00
Last cleanup
This commit is contained in:
parent
2c9a6773f5
commit
c104c8230d
@ -44,7 +44,6 @@ import net.Indyuce.mmocore.player.CombatHandler;
|
|||||||
import net.Indyuce.mmocore.player.Unlockable;
|
import net.Indyuce.mmocore.player.Unlockable;
|
||||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||||
import net.Indyuce.mmocore.skill.binding.SkillSlot;
|
|
||||||
import net.Indyuce.mmocore.skill.cast.SkillCastingHandler;
|
import net.Indyuce.mmocore.skill.cast.SkillCastingHandler;
|
||||||
import net.Indyuce.mmocore.skilltree.IntegerCoordinates;
|
import net.Indyuce.mmocore.skilltree.IntegerCoordinates;
|
||||||
import net.Indyuce.mmocore.skilltree.NodeStatus;
|
import net.Indyuce.mmocore.skilltree.NodeStatus;
|
||||||
@ -105,6 +104,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
private final Set<String> waypoints = new HashSet<>();
|
private final Set<String> waypoints = new HashSet<>();
|
||||||
private final Map<String, Integer> skills = new HashMap<>();
|
private final Map<String, Integer> skills = new HashMap<>();
|
||||||
|
// TODO change it to an array....... Map<Integer, BoundSkillInfo> is just BoundSkillInfo[]
|
||||||
private final Map<Integer, BoundSkillInfo> boundSkills = new HashMap<>();
|
private final Map<Integer, BoundSkillInfo> boundSkills = new HashMap<>();
|
||||||
private final PlayerProfessions collectSkills = new PlayerProfessions(this);
|
private final PlayerProfessions collectSkills = new PlayerProfessions(this);
|
||||||
private final PlayerAttributes attributes = new PlayerAttributes(this);
|
private final PlayerAttributes attributes = new PlayerAttributes(this);
|
||||||
@ -1064,15 +1064,15 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
|
|
||||||
public void setSkillLevel(String skill, int level) {
|
public void setSkillLevel(String skill, int level) {
|
||||||
skills.put(skill, level);
|
skills.put(skill, level);
|
||||||
refreshBoundedSkill(skill);
|
refreshBoundSkill(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetSkillLevel(String skill) {
|
public void resetSkillLevel(String skill) {
|
||||||
skills.remove(skill);
|
skills.remove(skill);
|
||||||
refreshBoundedSkill(skill);
|
refreshBoundSkill(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshBoundedSkill(String skill) {
|
public void refreshBoundSkill(String skill) {
|
||||||
boundSkills.values().stream().filter(skillInfo -> skillInfo.getClassSkill().getSkill().getHandler().getId().equals(skill)).forEach(BoundSkillInfo::refresh);
|
boundSkills.values().stream().filter(skillInfo -> skillInfo.getClassSkill().getSkill().getHandler().getId().equals(skill)).forEach(BoundSkillInfo::refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1142,6 +1142,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
return boundSkills.containsKey(slot);
|
return boundSkills.containsKey(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public ClassSkill getBoundSkill(int slot) {
|
public ClassSkill getBoundSkill(int slot) {
|
||||||
return boundSkills.containsKey(slot) ? boundSkills.get(slot).getClassSkill() : null;
|
return boundSkills.containsKey(slot) ? boundSkills.get(slot).getClassSkill() : null;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class CastableSkill extends Skill {
|
|||||||
PlayerData playerData = PlayerData.get(skillMeta.getCaster().getData().getUniqueId());
|
PlayerData playerData = PlayerData.get(skillMeta.getCaster().getData().getUniqueId());
|
||||||
boolean loud = !getTrigger().isSilent();
|
boolean loud = !getTrigger().isSilent();
|
||||||
|
|
||||||
// If the caster has unlocked that skill
|
// Skill is not usable yet
|
||||||
if (!playerData.hasSkillUnlocked(skill)) {
|
if (!playerData.hasSkillUnlocked(skill)) {
|
||||||
if (loud) MMOCore.plugin.configManager.getSimpleMessage("not-unlocked-skill").send(playerData.getPlayer());
|
if (loud) MMOCore.plugin.configManager.getSimpleMessage("not-unlocked-skill").send(playerData.getPlayer());
|
||||||
return false;
|
return false;
|
||||||
|
@ -22,9 +22,6 @@ public class ClassSkill implements CooldownObject, Unlockable {
|
|||||||
private final boolean unlockedByDefault;
|
private final boolean unlockedByDefault;
|
||||||
private final Map<String, LinearValue> modifiers = new HashMap<>();
|
private final Map<String, LinearValue> modifiers = new HashMap<>();
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
private final Set<Condition> unlockConditions = new HashSet<>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class used to save information about skills IN A CLASS CONTEXT
|
* Class used to save information about skills IN A CLASS CONTEXT
|
||||||
* i.e at which level the skill can be unlocked, etc.
|
* i.e at which level the skill can be unlocked, etc.
|
||||||
|
@ -3,6 +3,7 @@ package net.Indyuce.mmocore.skill.binding;
|
|||||||
import io.lumine.mythic.lib.player.skill.PassiveSkill;
|
import io.lumine.mythic.lib.player.skill.PassiveSkill;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -10,17 +11,18 @@ import java.util.UUID;
|
|||||||
public class BoundSkillInfo {
|
public class BoundSkillInfo {
|
||||||
private final PlayerData playerData;
|
private final PlayerData playerData;
|
||||||
private final ClassSkill classSkill;
|
private final ClassSkill classSkill;
|
||||||
private UUID passiveSkillUUID;
|
|
||||||
|
private UUID passiveSkillId;
|
||||||
|
|
||||||
public BoundSkillInfo(ClassSkill classSkill, PlayerData playerData) {
|
public BoundSkillInfo(ClassSkill classSkill, PlayerData playerData) {
|
||||||
this.classSkill = classSkill;
|
this.classSkill = classSkill;
|
||||||
this.playerData = playerData;
|
this.playerData = playerData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundSkillInfo(ClassSkill classSkill, PlayerData playerData, UUID passiveSkillUUID) {
|
public BoundSkillInfo(ClassSkill classSkill, PlayerData playerData, UUID passiveSkillId) {
|
||||||
this.classSkill = classSkill;
|
this.classSkill = classSkill;
|
||||||
this.playerData = playerData;
|
this.playerData = playerData;
|
||||||
this.passiveSkillUUID = passiveSkillUUID;
|
this.passiveSkillId = passiveSkillId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,19 +34,22 @@ public class BoundSkillInfo {
|
|||||||
info.unbind();
|
info.unbind();
|
||||||
PassiveSkill passiveSkill = classSkill.toPassive(playerData);
|
PassiveSkill passiveSkill = classSkill.toPassive(playerData);
|
||||||
passiveSkill.register(playerData.getMMOPlayerData());
|
passiveSkill.register(playerData.getMMOPlayerData());
|
||||||
this.passiveSkillUUID = passiveSkill.getUniqueId();
|
this.passiveSkillId = passiveSkill.getUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
public ClassSkill getClassSkill() {
|
public ClassSkill getClassSkill() {
|
||||||
return classSkill;
|
return classSkill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
public PlayerData getPlayerData() {
|
public PlayerData getPlayerData() {
|
||||||
return playerData;
|
return playerData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getPassiveSkillUUID() {
|
@NotNull
|
||||||
return passiveSkillUUID;
|
public UUID getPassiveSkillId() {
|
||||||
|
return passiveSkillId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,16 +57,15 @@ public class BoundSkillInfo {
|
|||||||
*/
|
*/
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
if (classSkill.getSkill().getTrigger().isPassive()) {
|
if (classSkill.getSkill().getTrigger().isPassive()) {
|
||||||
playerData.getMMOPlayerData().getPassiveSkillMap().removeModifier(passiveSkillUUID);
|
playerData.getMMOPlayerData().getPassiveSkillMap().removeModifier(passiveSkillId);
|
||||||
PassiveSkill passiveSkill = classSkill.toPassive(playerData);
|
PassiveSkill passiveSkill = classSkill.toPassive(playerData);
|
||||||
passiveSkill.register(playerData.getMMOPlayerData());
|
passiveSkill.register(playerData.getMMOPlayerData());
|
||||||
this.passiveSkillUUID = passiveSkill.getUniqueId();
|
this.passiveSkillId = passiveSkill.getUniqueId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unbind() {
|
public void unbind() {
|
||||||
if (classSkill.getSkill().getTrigger().isPassive()) {
|
if (classSkill.getSkill().getTrigger().isPassive())
|
||||||
playerData.getMMOPlayerData().getPassiveSkillMap().removeModifier(passiveSkillUUID);
|
playerData.getMMOPlayerData().getPassiveSkillMap().removeModifier(passiveSkillId);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user