forked from Upstream/mmocore
Debug Skill Trees.
This commit is contained in:
parent
1cd405b1ff
commit
82678a6c90
17
MMOCore-API/MMOCore-API.iml
Normal file
17
MMOCore-API/MMOCore-API.iml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="minecraft" name="Minecraft">
|
||||||
|
<configuration>
|
||||||
|
<autoDetectTypes>
|
||||||
|
<platformType>SPIGOT</platformType>
|
||||||
|
<platformType>MCP</platformType>
|
||||||
|
<platformType>BUKKIT</platformType>
|
||||||
|
</autoDetectTypes>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="McpModuleSettings">
|
||||||
|
<option name="srgType" value="SRG" />
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -4,6 +4,8 @@ import io.lumine.mythic.lib.MythicLib;
|
|||||||
import io.lumine.mythic.lib.api.player.MMOPlayerData;
|
import io.lumine.mythic.lib.api.player.MMOPlayerData;
|
||||||
import io.lumine.mythic.lib.player.cooldown.CooldownMap;
|
import io.lumine.mythic.lib.player.cooldown.CooldownMap;
|
||||||
import io.lumine.mythic.lib.player.skill.PassiveSkill;
|
import io.lumine.mythic.lib.player.skill.PassiveSkill;
|
||||||
|
import net.Indyuce.mmocore.party.provided.MMOCorePartyModule;
|
||||||
|
import net.Indyuce.mmocore.party.provided.Party;
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.ConfigMessage;
|
import net.Indyuce.mmocore.api.ConfigMessage;
|
||||||
import net.Indyuce.mmocore.api.SoundEvent;
|
import net.Indyuce.mmocore.api.SoundEvent;
|
||||||
@ -30,8 +32,6 @@ import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
|||||||
import net.Indyuce.mmocore.guild.provided.Guild;
|
import net.Indyuce.mmocore.guild.provided.Guild;
|
||||||
import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect;
|
import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect;
|
||||||
import net.Indyuce.mmocore.party.AbstractParty;
|
import net.Indyuce.mmocore.party.AbstractParty;
|
||||||
import net.Indyuce.mmocore.party.provided.MMOCorePartyModule;
|
|
||||||
import net.Indyuce.mmocore.party.provided.Party;
|
|
||||||
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;
|
||||||
@ -58,7 +58,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
|
|
||||||
public class PlayerData extends OfflinePlayerData implements Closable, ExperienceTableClaimer {
|
public class PlayerData extends OfflinePlayerData implements Closable, ExperienceTableClaimer {
|
||||||
@ -132,6 +131,8 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
this.mmoData = mmoData;
|
this.mmoData = mmoData;
|
||||||
questData = new PlayerQuests(this);
|
questData = new PlayerQuests(this);
|
||||||
playerStats = new PlayerStats(this);
|
playerStats = new PlayerStats(this);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,6 +182,14 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
return pointSpent.getOrDefault(skillTree, 0);
|
return pointSpent.getOrDefault(skillTree, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<SkillTree, Integer> getPointsSpent() {
|
||||||
|
return new HashMap<>(pointSpent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearPointsSpent() {
|
||||||
|
pointSpent.clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void setSkillTreePoints(String treeId, int points) {
|
public void setSkillTreePoints(String treeId, int points) {
|
||||||
skillTreePoints.put(treeId, points);
|
skillTreePoints.put(treeId, points);
|
||||||
@ -194,10 +203,18 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
return nodeLevels.keySet().stream().filter(node -> node.getTree().equals(skillTree)).mapToInt(nodeLevels::get).sum();
|
return nodeLevels.keySet().stream().filter(node -> node.getTree().equals(skillTree)).mapToInt(nodeLevels::get).sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We make a copy to assure that the object created is independent of the state of playerData.
|
||||||
|
*/
|
||||||
public Map<String, Integer> getSkillTreePoints() {
|
public Map<String, Integer> getSkillTreePoints() {
|
||||||
return skillTreePoints;
|
return new HashMap(skillTreePoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearSkillTreePoints() {
|
||||||
|
skillTreePoints.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean containsSkillPointTreeId(String treeId) {
|
public boolean containsSkillPointTreeId(String treeId) {
|
||||||
return skillTreePoints.containsKey(treeId);
|
return skillTreePoints.containsKey(treeId);
|
||||||
}
|
}
|
||||||
@ -211,7 +228,11 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<SkillTreeNode, Integer> getNodeLevels() {
|
public Map<SkillTreeNode, Integer> getNodeLevels() {
|
||||||
return nodeLevels;
|
return new HashMap<>(nodeLevels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearNodeLevels() {
|
||||||
|
nodeLevels.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canIncrementNodeLevel(SkillTreeNode node) {
|
public boolean canIncrementNodeLevel(SkillTreeNode node) {
|
||||||
@ -219,7 +240,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
//Check the State of the node
|
//Check the State of the node
|
||||||
if (nodeState != NodeState.UNLOCKED && nodeState != NodeState.UNLOCKABLE)
|
if (nodeState != NodeState.UNLOCKED && nodeState != NodeState.UNLOCKABLE)
|
||||||
return false;
|
return false;
|
||||||
return getNodeLevel(node) < node.getMaxLevel() && (skillTreePoints.get(node.getTree().getId()) > 0 || skillTreePoints.get("global") > 0);
|
return getNodeLevel(node) < node.getMaxLevel() && (skillTreePoints.getOrDefault(node.getTree().getId(), 0) > 0 || skillTreePoints.getOrDefault("global", 0) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -268,7 +289,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSkillTreePoint(String treeId) {
|
public int getSkillTreePoint(String treeId) {
|
||||||
return skillTreePoints.get(treeId);
|
return skillTreePoints.getOrDefault(treeId, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void withdrawSkillTreePoints(String treeId, int withdraw) {
|
public void withdrawSkillTreePoints(String treeId, int withdraw) {
|
||||||
@ -301,12 +322,17 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
for (SkillTreeNode node : skillTree.getNodes()) {
|
for (SkillTreeNode node : skillTree.getNodes()) {
|
||||||
node.getExperienceTable().reset(this, node);
|
node.getExperienceTable().reset(this, node);
|
||||||
setNodeLevel(node, 0);
|
setNodeLevel(node, 0);
|
||||||
|
nodeStates.remove(node);
|
||||||
}
|
}
|
||||||
skillTree.setupNodeState(this);
|
skillTree.setupNodeState(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<SkillTreeNode, NodeState> getNodeStates() {
|
public Map<SkillTreeNode, NodeState> getNodeStates() {
|
||||||
return nodeStates;
|
return new HashMap<>(nodeStates);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearNodeStates() {
|
||||||
|
nodeStates.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getNodeTimesClaimed() {
|
public Map<String, Integer> getNodeTimesClaimed() {
|
||||||
@ -393,6 +419,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
return Math.max(1, level);
|
return Math.max(1, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public AbstractParty getParty() {
|
public AbstractParty getParty() {
|
||||||
return MMOCore.plugin.partyModule.getParty(this);
|
return MMOCore.plugin.partyModule.getParty(this);
|
||||||
@ -446,6 +473,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
|
|
||||||
public int getClaims(String key) {
|
public int getClaims(String key) {
|
||||||
return tableItemClaims.getOrDefault(key, 0);
|
return tableItemClaims.getOrDefault(key, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -455,8 +483,10 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
|
|
||||||
public void setClaims(String key, int times) {
|
public void setClaims(String key, int times) {
|
||||||
tableItemClaims.put(key, times);
|
tableItemClaims.put(key, times);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Map<String, Integer> getItemClaims() {
|
public Map<String, Integer> getItemClaims() {
|
||||||
return tableItemClaims;
|
return tableItemClaims;
|
||||||
}
|
}
|
||||||
@ -716,9 +746,9 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
final double r = Math.sin((double) t / warpTime * Math.PI);
|
final double r = Math.sin((double) t / warpTime * Math.PI);
|
||||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / 4)
|
for (double j = 0; j < Math.PI * 2; j += Math.PI / 4)
|
||||||
getPlayer().getLocation().getWorld().spawnParticle(Particle.REDSTONE, getPlayer().getLocation().add(
|
getPlayer().getLocation().getWorld().spawnParticle(Particle.REDSTONE, getPlayer().getLocation().add(
|
||||||
Math.cos((double) 5 * t / warpTime + j) * r,
|
Math.cos((double) 5 * t / warpTime + j) * r,
|
||||||
(double) 2 * t / warpTime,
|
(double) 2 * t / warpTime,
|
||||||
Math.sin((double) 5 * t / warpTime + j) * r),
|
Math.sin((double) 5 * t / warpTime + j) * r),
|
||||||
1, new Particle.DustOptions(Color.PURPLE, 1.25f));
|
1, new Particle.DustOptions(Color.PURPLE, 1.25f));
|
||||||
}
|
}
|
||||||
}.runTaskTimer(MMOCore.plugin, 0, 1);
|
}.runTaskTimer(MMOCore.plugin, 0, 1);
|
||||||
@ -751,27 +781,21 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
if (value <= 0)
|
if (value <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Splitting exp through party members
|
|
||||||
AbstractParty party;
|
|
||||||
if (splitExp && (party = getParty()) != null) {
|
|
||||||
final List<PlayerData> nearbyMembers = party.getOnlineMembers().stream()
|
|
||||||
.filter(pd -> {
|
|
||||||
if (equals(pd))
|
|
||||||
return false;
|
|
||||||
final double maxDis = MMOCore.plugin.configManager.partyMaxExpSplitRange;
|
|
||||||
return maxDis <= 0 || pd.getPlayer().getLocation().distanceSquared(getPlayer().getLocation()) < maxDis * maxDis;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
value /= (nearbyMembers.size() + 1);
|
|
||||||
for (PlayerData member : nearbyMembers)
|
|
||||||
member.giveExperience(value, source, null, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Must be placed after exp spliting
|
|
||||||
if (hasReachedMaxLevel()) {
|
if (hasReachedMaxLevel()) {
|
||||||
setExperience(0);
|
setExperience(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Splitting exp through party members
|
||||||
|
AbstractParty party;
|
||||||
|
if (splitExp && (party = getParty()) != null) {
|
||||||
|
List<PlayerData> onlineMembers = party.getOnlineMembers();
|
||||||
|
value /= onlineMembers.size();
|
||||||
|
for (PlayerData member : onlineMembers)
|
||||||
|
if (!equals(member))
|
||||||
|
member.giveExperience(value, source, null, false);
|
||||||
|
}
|
||||||
|
|
||||||
// Apply buffs AFTER splitting exp
|
// Apply buffs AFTER splitting exp
|
||||||
value *= (1 + getStats().getStat("ADDITIONAL_EXPERIENCE") / 100) * MMOCore.plugin.boosterManager.getMultiplier(null);
|
value *= (1 + getStats().getStat("ADDITIONAL_EXPERIENCE") / 100) * MMOCore.plugin.boosterManager.getMultiplier(null);
|
||||||
|
|
||||||
@ -1131,7 +1155,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
* checks if they could potentially upgrade to one of these
|
* checks if they could potentially upgrade to one of these
|
||||||
*
|
*
|
||||||
* @return If the player can change its current class to
|
* @return If the player can change its current class to
|
||||||
* a subclass
|
* a subclass
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean canChooseSubclass() {
|
public boolean canChooseSubclass() {
|
||||||
|
@ -9,6 +9,7 @@ import net.Indyuce.mmocore.manager.data.PlayerDataManager;
|
|||||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||||
import net.Indyuce.mmocore.tree.SkillTreeNode;
|
import net.Indyuce.mmocore.tree.SkillTreeNode;
|
||||||
import net.Indyuce.mmocore.tree.skilltree.SkillTree;
|
import net.Indyuce.mmocore.tree.skilltree.SkillTree;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -26,7 +27,7 @@ public class SavedClassInformation {
|
|||||||
/**
|
/**
|
||||||
* Stores the tableItemsClaims values but only for skill tree node as it is class based.
|
* Stores the tableItemsClaims values but only for skill tree node as it is class based.
|
||||||
*/
|
*/
|
||||||
private final Map<String,Integer> nodeTimesClaimed;
|
private final Map<String, Integer> nodeTimesClaimed;
|
||||||
|
|
||||||
public SavedClassInformation(ConfigurationSection config) {
|
public SavedClassInformation(ConfigurationSection config) {
|
||||||
level = config.getInt("level");
|
level = config.getInt("level");
|
||||||
@ -78,7 +79,7 @@ public class SavedClassInformation {
|
|||||||
if (json.has("node-levels"))
|
if (json.has("node-levels"))
|
||||||
for (Entry<String, JsonElement> entry : json.getAsJsonObject("node-levels").entrySet())
|
for (Entry<String, JsonElement> entry : json.getAsJsonObject("node-levels").entrySet())
|
||||||
nodeLevels.put(MMOCore.plugin.skillTreeManager.getNode(entry.getKey()), entry.getValue().getAsInt());
|
nodeLevels.put(MMOCore.plugin.skillTreeManager.getNode(entry.getKey()), entry.getValue().getAsInt());
|
||||||
nodeTimesClaimed=new HashMap<>();
|
nodeTimesClaimed = new HashMap<>();
|
||||||
if (json.has("node-times-claimed"))
|
if (json.has("node-times-claimed"))
|
||||||
for (Entry<String, JsonElement> entry : json.getAsJsonObject("node-times-claimed").entrySet())
|
for (Entry<String, JsonElement> entry : json.getAsJsonObject("node-times-claimed").entrySet())
|
||||||
nodeTimesClaimed.put(entry.getKey(), entry.getValue().getAsInt());
|
nodeTimesClaimed.put(entry.getKey(), entry.getValue().getAsInt());
|
||||||
@ -89,7 +90,7 @@ public class SavedClassInformation {
|
|||||||
public SavedClassInformation(PlayerData player) {
|
public SavedClassInformation(PlayerData player) {
|
||||||
this(player.getLevel(), player.getExperience(), player.getSkillPoints(), player.getAttributePoints(), player.getAttributeReallocationPoints()
|
this(player.getLevel(), player.getExperience(), player.getSkillPoints(), player.getAttributePoints(), player.getAttributeReallocationPoints()
|
||||||
, player.getSkillTreeReallocationPoints(), player.getSkillReallocationPoints(),
|
, player.getSkillTreeReallocationPoints(), player.getSkillReallocationPoints(),
|
||||||
player.getAttributes().mapPoints(), player.mapSkillLevels(), player.getSkillTreePoints(), player.getNodeLevels(),player.getNodeTimesClaimed());
|
player.getAttributes().mapPoints(), player.mapSkillLevels(), player.getSkillTreePoints(), player.getNodeLevels(), player.getNodeTimesClaimed());
|
||||||
}
|
}
|
||||||
|
|
||||||
public SavedClassInformation(PlayerDataManager.DefaultPlayerData data) {
|
public SavedClassInformation(PlayerDataManager.DefaultPlayerData data) {
|
||||||
@ -97,11 +98,12 @@ public class SavedClassInformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SavedClassInformation(int level, double experience, int skillPoints, int attributePoints, int attributeReallocationPoints, int skillTreeReallocationPoints, int skillReallocationPoints) {
|
public SavedClassInformation(int level, double experience, int skillPoints, int attributePoints, int attributeReallocationPoints, int skillTreeReallocationPoints, int skillReallocationPoints) {
|
||||||
this(level, experience, skillPoints, attributePoints, attributeReallocationPoints, skillTreeReallocationPoints, skillReallocationPoints, new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),new HashMap<>());
|
this(level, experience, skillPoints, attributePoints, attributeReallocationPoints, skillTreeReallocationPoints, skillReallocationPoints, new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public SavedClassInformation(int level, double experience, int skillPoints, int attributePoints, int attributeReallocationPoints, int skillTreeReallocationPoints, int skillReallocationPoints,
|
public SavedClassInformation(int level, double experience, int skillPoints, int attributePoints, int attributeReallocationPoints, int skillTreeReallocationPoints, int skillReallocationPoints,
|
||||||
Map<String, Integer> attributes, Map<String, Integer> skills, Map<String, Integer> skillTreePoints, Map<SkillTreeNode, Integer> nodeLevels,Map<String, Integer> nodeTimesClaimed) {
|
Map<String, Integer> attributes, Map<String, Integer> skills, Map<String, Integer> skillTreePoints, Map<SkillTreeNode, Integer> nodeLevels, Map<String, Integer> nodeTimesClaimed) {
|
||||||
|
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.skillPoints = skillPoints;
|
this.skillPoints = skillPoints;
|
||||||
this.attributePoints = attributePoints;
|
this.attributePoints = attributePoints;
|
||||||
@ -113,7 +115,7 @@ public class SavedClassInformation {
|
|||||||
this.skills = skills;
|
this.skills = skills;
|
||||||
this.skillTreePoints = skillTreePoints;
|
this.skillTreePoints = skillTreePoints;
|
||||||
this.nodeLevels = nodeLevels;
|
this.nodeLevels = nodeLevels;
|
||||||
this.nodeTimesClaimed=nodeTimesClaimed;
|
this.nodeTimesClaimed = nodeTimesClaimed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLevel() {
|
public int getLevel() {
|
||||||
@ -173,6 +175,7 @@ public class SavedClassInformation {
|
|||||||
return nodeLevels.get(node);
|
return nodeLevels.get(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Set<String> getSkillTreePointsKeys() {
|
public Set<String> getSkillTreePointsKeys() {
|
||||||
return skillTreePoints.keySet();
|
return skillTreePoints.keySet();
|
||||||
}
|
}
|
||||||
@ -186,7 +189,7 @@ public class SavedClassInformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getAttributeLevel(String id) {
|
public int getAttributeLevel(String id) {
|
||||||
return attributes.getOrDefault(id,0);
|
return attributes.getOrDefault(id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerAttributeLevel(PlayerAttribute attribute, int level) {
|
public void registerAttributeLevel(PlayerAttribute attribute, int level) {
|
||||||
@ -212,13 +215,15 @@ public class SavedClassInformation {
|
|||||||
|
|
||||||
player.mapSkillLevels().forEach((skill, level) -> player.resetSkillLevel(skill));
|
player.mapSkillLevels().forEach((skill, level) -> player.resetSkillLevel(skill));
|
||||||
player.getAttributes().getInstances().forEach(ins -> ins.setBase(0));
|
player.getAttributes().getInstances().forEach(ins -> ins.setBase(0));
|
||||||
|
player.clearSkillTreePoints();
|
||||||
|
player.clearNodeLevels();
|
||||||
|
player.clearNodeStates();
|
||||||
|
player.clearPointsSpent();
|
||||||
// We reset the experience table for each skill tree node to remove the perm stat.
|
// We reset the experience table for each skill tree node to remove the perm stat.
|
||||||
for (SkillTree skillTree : player.getProfess().getSkillTrees())
|
for (SkillTree skillTree : player.getProfess().getSkillTrees()) {
|
||||||
for (SkillTreeNode node : skillTree.getNodes())
|
for (SkillTreeNode node : skillTree.getNodes())
|
||||||
node.getExperienceTable().reset(player, node);
|
node.getExperienceTable().reset(player, node);
|
||||||
player.getNodeLevels().clear();
|
}
|
||||||
player.getNodeStates().clear();
|
|
||||||
|
|
||||||
while (player.hasSkillBound(0))
|
while (player.hasSkillBound(0))
|
||||||
player.unbindSkill(0);
|
player.unbindSkill(0);
|
||||||
@ -238,18 +243,24 @@ public class SavedClassInformation {
|
|||||||
|
|
||||||
(skills).forEach(player::setSkillLevel);
|
(skills).forEach(player::setSkillLevel);
|
||||||
attributes.forEach((id, pts) -> player.getAttributes().setBaseAttribute(id, pts));
|
attributes.forEach((id, pts) -> player.getAttributes().setBaseAttribute(id, pts));
|
||||||
skillTreePoints.forEach((skillTree, point) -> player.setSkillTreePoints(skillTree, point));
|
|
||||||
//Setup node levels and node state.
|
//Careful, the global points must not be forgotten.
|
||||||
nodeLevels.forEach((node, level) -> player.setNodeLevel(node, level));
|
player.setSkillTreePoints("global", skillTreePoints.getOrDefault("global", 0));
|
||||||
for(SkillTree skillTree: profess.getSkillTrees())
|
for (SkillTree skillTree : profess.getSkillTrees()) {
|
||||||
|
player.setSkillTreePoints(skillTree.getId(), skillTreePoints.getOrDefault(skillTree.getId(), 0));
|
||||||
|
for (SkillTreeNode node : skillTree.getNodes()) {
|
||||||
|
player.setNodeLevel(node, nodeLevels.getOrDefault(node, 0));
|
||||||
|
}
|
||||||
|
|
||||||
skillTree.setupNodeState(player);
|
skillTree.setupNodeState(player);
|
||||||
|
}
|
||||||
|
|
||||||
//Add the values to the times claimed table and claims the corresponding stat triggers.
|
//Add the values to the times claimed table and claims the corresponding stat triggers.
|
||||||
nodeTimesClaimed.forEach((str,val)->player.setClaims(str,val));
|
nodeTimesClaimed.forEach((str, val) -> player.setClaims(str, val));
|
||||||
//We claim back the stats triggers for all the skill tree nodes of the new class.
|
//We claim back the stats triggers for all the skill tree nodes of the new class.
|
||||||
for(SkillTree skillTree:profess.getSkillTrees())
|
for (SkillTree skillTree : profess.getSkillTrees())
|
||||||
for(SkillTreeNode node:skillTree.getNodes())
|
for (SkillTreeNode node : skillTree.getNodes())
|
||||||
node.getExperienceTable().claimStatTriggers(player,node);
|
node.getExperienceTable().claimStatTriggers(player, node);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* unload current class information and set the new profess once
|
* unload current class information and set the new profess once
|
||||||
|
16
MMOCore-Dist/MMOCore-Dist.iml
Normal file
16
MMOCore-Dist/MMOCore-Dist.iml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="minecraft" name="Minecraft">
|
||||||
|
<configuration>
|
||||||
|
<autoDetectTypes>
|
||||||
|
<platformType>SPIGOT</platformType>
|
||||||
|
<platformType>MCP</platformType>
|
||||||
|
</autoDetectTypes>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="McpModuleSettings">
|
||||||
|
<option name="srgType" value="SRG" />
|
||||||
|
</component>
|
||||||
|
</module>
|
Loading…
Reference in New Issue
Block a user