Fixed a few exploits. See extended.

Skills obtained through the expertise system are now validated to make
sure they are legitimate expertise skills.
Player expertise points are also now factored in instead of letting the
client do all the calculations.
Command "setcurrentskilltitle" now checks if the player has obtained the
skill title to prevent abuse of the command.
This commit is contained in:
Seefo
2014-03-23 12:27:42 -04:00
parent 51899bef77
commit d00aa83050
2 changed files with 25 additions and 7 deletions
+23 -6
View File
@@ -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() {