Refactored abilities, skillSvc sends less traffic

This commit is contained in:
Treeku
2014-06-04 14:56:19 +01:00
parent 850e23cd5e
commit 9ac995796a
3 changed files with 28 additions and 95 deletions
+8 -1
View File
@@ -25,6 +25,7 @@ import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
@@ -163,10 +164,16 @@ public class SkillService implements INetworkDispatch {
}
}
} else {
Map<String, Integer> abilitiesMap = new TreeMap<String, Integer>();
for (String ability : abilities) {
creature.addAbility(ability);
if (!creature.hasAbility(ability)) {
abilitiesMap.put(ability, 1);
}
}
creature.getAbilities().putAll(abilitiesMap);
for (String expertiseName : creature.getSkills()) {
if (expertiseName.startsWith("expertise")) {
if (FileUtilities.doesFileExist("scripts/expertise/" + expertiseName + ".py")) {