forked from MagicBane/Server
Refactor baked in stats
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user