mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-31 01:15:57 -04:00
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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user