From c9972962d12b5452bf37bc09eb8ae77d0df2da19 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 11 Jan 2023 19:52:38 -0600 Subject: [PATCH] check for powers needing skill --- src/engine/net/client/msg/RefineMsg.java | 16 ++++++++++++++++ src/engine/objects/CharacterPower.java | 1 + 2 files changed, 17 insertions(+) diff --git a/src/engine/net/client/msg/RefineMsg.java b/src/engine/net/client/msg/RefineMsg.java index f7757783..4789c687 100644 --- a/src/engine/net/client/msg/RefineMsg.java +++ b/src/engine/net/client/msg/RefineMsg.java @@ -10,13 +10,17 @@ package engine.net.client.msg; +import engine.gameManager.PowersManager; import engine.gameManager.SessionManager; import engine.net.*; import engine.net.client.ClientConnection; import engine.net.client.Protocol; import engine.objects.*; +import engine.powers.PowersBase; import engine.server.MBServerStatics; +import java.util.ArrayList; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class RefineMsg extends ClientNetMsg { @@ -189,6 +193,18 @@ public class RefineMsg extends ClientNetMsg { //TODO verify if any skills have this as prereq //TODO verify if any powers have this as a prereq + //get all players powers + for(CharacterPower power : pc.getPowers().values()){ + ArrayList reqs = PowerReq.getPowerReqsForRune(power.getPowerID()); + for (PowerReq req : reqs) { + ConcurrentHashMap playerSkills = pc.getSkills(); + CharacterSkill playerSkill = playerSkills.get(token); + int currentSkillLevel = playerSkill.getTotalSkillPercet(); + if (token == req.getToken() && req.getLevel() == currentSkillLevel) { + return false; + } + } + } //refine skill return skill.refine(pc); diff --git a/src/engine/objects/CharacterPower.java b/src/engine/objects/CharacterPower.java index 7ef1a3d7..ecc2c808 100644 --- a/src/engine/objects/CharacterPower.java +++ b/src/engine/objects/CharacterPower.java @@ -566,6 +566,7 @@ public class CharacterPower extends AbstractGameObject { } } } + return true; }