rune skill loading broken into static method in NPCManager

This commit is contained in:
2023-09-03 19:52:16 -05:00
parent 0758bb5f38
commit ee6efc30a3
4 changed files with 21 additions and 17 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public Guild guild;
protected byte runningTrains;
protected ConcurrentHashMap<Integer, CharacterPower> powers;
protected ConcurrentHashMap<String, CharacterSkill> skills;
public ConcurrentHashMap<String, CharacterSkill> skills;
// Variables NOT to be stored in db
protected boolean sit = false;
protected boolean walkMode;
+1 -1
View File
@@ -258,7 +258,7 @@ public class CharacterSkill extends AbstractGameObject {
this.skillType = CharacterSkills.GetCharacterSkillByToken(this.skillsBase.getToken());
}
public CharacterSkill(SkillsBase sb, Mob mob, int trains) {
public CharacterSkill(SkillsBase sb, AbstractCharacter mob, int trains) {
super();
this.skillsBase = sb;
this.numTrains.set(trains);
+1 -15
View File
@@ -1680,6 +1680,7 @@ public class Mob extends AbstractIntelligenceAgent {
NPCManager.applyMobbaseEffects(this);
NPCManager.applyEquipmentResists(this);
NPCManager.applyMobbaseSkill(this);
NPCManager.applyRuneSkills(this,this.getMobBaseID());
this.recalculateStats();
this.setHealth(this.healthMax);
@@ -1705,21 +1706,6 @@ public class Mob extends AbstractIntelligenceAgent {
}
this.deathTime = 0;
//load mob skill adjustments form mobbase rune
if(PowersManager._allRuneSkillAdjusts.containsKey(this.getMobBaseID()))
for(RuneSkillAdjustEntry entry : PowersManager._allRuneSkillAdjusts.get(this.getMobBaseID())) {
if(SkillsBase.getFromCache(entry.skill_type) == null)
SkillsBase.putInCache(DbManager.SkillsBaseQueries.GET_BASE_BY_NAME(entry.skill_type));
SkillsBase skillBase = SkillsBase.getFromCache(entry.skill_type);
if(skillBase == null)
continue;
if (entry.level <= this.level)
if (this.skills.containsKey(entry.name) == false)
this.skills.put(entry.skill_type, new CharacterSkill(skillBase, this, entry.rank));
else
this.skills.put(entry.skill_type, new CharacterSkill(skillBase, this, entry.rank + this.skills.get(entry.skill_type).getNumTrains()));
}
}
@Override