mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-31 01:15:57 -04:00
Fixed expertise abilities
This commit is contained in:
@@ -26,6 +26,8 @@ import java.util.Map;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.session.IoSession;
|
||||
import org.python.core.Py;
|
||||
import org.python.core.PyObject;
|
||||
|
||||
import protocol.swg.ExpertiseRequestMessage;
|
||||
|
||||
@@ -147,10 +149,32 @@ public class SkillService implements INetworkDispatch {
|
||||
}
|
||||
}
|
||||
|
||||
if(!skill.contains("expertise")) { // only mark 1 abilities in datatable need to remove abilities per script
|
||||
if (skill.contains("expertise")) {
|
||||
if (FileUtilities.doesFileExist("scripts/expertise/" + skill + ".py")) {
|
||||
PyObject method = core.scriptService.getMethod("scripts/expertise/", skill, "addAbilities");
|
||||
|
||||
if (method != null && method.isCallable()) {
|
||||
method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(player));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (String ability : abilities) {
|
||||
creature.addAbility(ability);
|
||||
}
|
||||
|
||||
// When leveling, add all new unadded expertise abilities
|
||||
// It's up to the script to not add abilities that are already added
|
||||
for (String expertiseName : creature.getSkills()) {
|
||||
if (expertiseName.startsWith("expertise")) {
|
||||
if (FileUtilities.doesFileExist("scripts/expertise/" + expertiseName + ".py")) {
|
||||
PyObject method = core.scriptService.getMethod("scripts/expertise/", expertiseName, "addAbilities");
|
||||
|
||||
if (method != null && method.isCallable()) {
|
||||
method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(player));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (String skillMod : skillMods) {
|
||||
@@ -214,7 +238,15 @@ public class SkillService implements INetworkDispatch {
|
||||
//creature.addExpertisePoints(pointsRequired);
|
||||
}
|
||||
|
||||
if(!skill.contains("expertise")) { // only mark 1 abilities in datatable need to remove abilities per script
|
||||
if (skill.contains("expertise")) {
|
||||
if (FileUtilities.doesFileExist("scripts/expertise/" + skill + ".py")) {
|
||||
PyObject method = core.scriptService.getMethod("scripts/expertise/", skill, "removeAbilities");
|
||||
|
||||
if (method != null && method.isCallable()) {
|
||||
method.__call__(Py.java2py(core), Py.java2py(creature), Py.java2py(player));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (String ability : abilities) {
|
||||
creature.removeAbility(ability);
|
||||
}
|
||||
@@ -271,12 +303,8 @@ public class SkillService implements INetworkDispatch {
|
||||
return;
|
||||
|
||||
for(String expertiseName : expertise.getExpertiseSkills()) {
|
||||
if(expertiseName.startsWith("expertise_") && ((caluclateExpertisePoints(creature) - 1) >= 0)) // Prevent possible glitches/exploits
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user