diff --git a/scripts/commands/setcurrentskilltitle.py b/scripts/commands/setcurrentskilltitle.py index 43e9e5f4..160c9091 100644 --- a/scripts/commands/setcurrentskilltitle.py +++ b/scripts/commands/setcurrentskilltitle.py @@ -11,5 +11,6 @@ def run(core, actor, target, commandString): if playerObject is None: return - playerObject.setTitle(str(commandString)) + if str(commandString) in playerObject.getTitleList() or str(commandString) == "citizenship" or str(commandString) == "": playerObject.setTitle(str(commandString)) + return \ No newline at end of file diff --git a/src/services/SkillService.java b/src/services/SkillService.java index de024d6d..c3926f7b 100644 --- a/src/services/SkillService.java +++ b/src/services/SkillService.java @@ -271,16 +271,33 @@ public class SkillService implements INetworkDispatch { return; for(String expertiseName : expertise.getExpertiseSkills()) { - addSkill(creature, expertiseName); - if(!FileUtilities.doesFileExist("scripts/expertise/" + expertiseName + ".py")) - continue; - core.scriptService.callScript("scripts/expertise/", expertiseName, "addAbilities", core, creature, player); - } - + if(expertiseName.startsWith("expertise_") && ((caluclateExpertisePoints(creature) - 1) > 0)) // Prevent possible glitches/exploits + { + addSkill(creature, expertiseName); + if(!FileUtilities.doesFileExist("scripts/expertise/" + expertiseName + ".py")) + continue; + core.scriptService.callScript("scripts/expertise/", expertiseName, "addAbilities", core, creature, player); + } + } } }); } + + public int caluclateExpertisePoints(CreatureObject creature) + { + int expertisePoints = 0; + + try + { + DatatableVisitor table = ClientFileManager.loadFile("datatables/player/player_level.iff", DatatableVisitor.class); + for (int i = 0; i <= creature.getLevel(); i++) expertisePoints += (int) table.getObject(i, 5); + } + catch (Exception e) { e.printStackTrace(); } + + System.out.println("Player should have " + expertisePoints + " expertise points."); + return expertisePoints; + } @Override public void shutdown() {