Refactor baked in stats

This commit is contained in:
2024-03-11 11:24:19 -04:00
parent 784767dc4e
commit 6ee194924c
3 changed files with 12 additions and 36 deletions
+12 -12
View File
@@ -76,7 +76,7 @@ public class Item extends AbstractWorldObject {
this.containerType = ItemContainerType.NONE;
this.numberOfItems = 1;
loadEnchantments();
bakeInStats();
applyBakedInStats();
}
/**
@@ -1022,25 +1022,25 @@ public class Item extends AbstractWorldObject {
this.customName = name;
}
private void bakeInStats() {
private void applyBakedInStats() {
EffectsBase effect;
if (ConfigManager.serverType.equals(Enum.ServerType.LOGINSERVER))
return;
if (this.getItemBase() != null)
for (Integer token : this.getItemBase().getBakedInStats().keySet()) {
for (String effectID : this.template.item_user_power_action.keySet()) {
effect = PowersManager.getEffectByToken(token);
effect = PowersManager.getEffectByIDString(effectID);
if (effect == null) {
Logger.error("missing effect of token " + token);
continue;
}
AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effect.getIDString());
apa.applyBakedInStatsForItem(this, this.getItemBase().getBakedInStats().get(token));
if (effect == null) {
Logger.error("missing effect of type: " + effectID);
continue;
}
AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effect.getIDString());
apa.applyBakedInStatsForItem(this, this.template.item_user_power_action.get(effectID)[0]);
}
}
@@ -1123,7 +1123,7 @@ public class Item extends AbstractWorldObject {
@Override
public void runAfterLoad() {
loadEnchantments();
bakeInStats();
applyBakedInStats();
}