Browse Source

Methods moved to itemmanger

combat-2
MagicBot 7 months ago
parent
commit
80aa413ea8
  1. 22
      src/engine/gameManager/ForgeManager.java
  2. 15
      src/engine/gameManager/ItemManager.java
  3. 3
      src/engine/net/client/handlers/ItemProductionMsgHandler.java

22
src/engine/gameManager/ForgeManager.java

@ -78,7 +78,7 @@ public enum ForgeManager implements Runnable { @@ -78,7 +78,7 @@ public enum ForgeManager implements Runnable {
// Create new set of in-memory only virtual items
forgeWorkerOrderBatch(workOrder);
forgeWorkOrderBatch(workOrder);
// enQueue this workOrder again; back into the oven
// until all items for this workOrder are completed.
@ -146,7 +146,7 @@ public enum ForgeManager implements Runnable { @@ -146,7 +146,7 @@ public enum ForgeManager implements Runnable {
// Create in-memory items and add to collections
forgeWorkerOrderBatch(workOrder);
forgeWorkOrderBatch(workOrder);
Logger.info(workOrder.toString());
forge.add(workOrder);
@ -260,20 +260,6 @@ public enum ForgeManager implements Runnable { @@ -260,20 +260,6 @@ public enum ForgeManager implements Runnable {
return forgedItem;
}
public static void applyItemEffects(Item forgedItem) {
if (forgedItem.prefixToken != 0) {
EffectsBase prefix = PowersManager.getEffectByToken(forgedItem.prefixToken);
forgedItem.addPermanentEnchantment(prefix.getIDString(), 0);
}
if (forgedItem.suffixToken != 0) {
EffectsBase suffix = PowersManager.getEffectByToken(forgedItem.suffixToken);
forgedItem.addPermanentEnchantment(suffix.getIDString(), 0);
}
}
public static void completeWorkOrderBatch(WorkOrder workOrder) {
ArrayList<Item> toRemove = new ArrayList<>();
@ -293,7 +279,7 @@ public enum ForgeManager implements Runnable { @@ -293,7 +279,7 @@ public enum ForgeManager implements Runnable {
completedItem.prefixToken = workOrderItem.prefixToken;
completedItem.suffixToken = workOrderItem.suffixToken;
applyItemEffects(completedItem);
ItemManager.applyItemEffects(completedItem);
// add to the vendor inventory
@ -323,7 +309,7 @@ public enum ForgeManager implements Runnable { @@ -323,7 +309,7 @@ public enum ForgeManager implements Runnable {
}
}
public static void forgeWorkerOrderBatch(WorkOrder workOrder) {
public static void forgeWorkOrderBatch(WorkOrder workOrder) {
// New completion time for this batch

15
src/engine/gameManager/ItemManager.java

@ -3,6 +3,7 @@ package engine.gameManager; @@ -3,6 +3,7 @@ package engine.gameManager;
import engine.loot.WorkOrder;
import engine.mbEnums;
import engine.objects.*;
import engine.powers.EffectsBase;
import engine.powers.poweractions.AbstractPowerAction;
import org.pmw.tinylog.Logger;
@ -260,4 +261,18 @@ public enum ItemManager { @@ -260,4 +261,18 @@ public enum ItemManager {
return validation_result;
}
public static void applyItemEffects(Item forgedItem) {
if (forgedItem.prefixToken != 0) {
EffectsBase prefix = PowersManager.getEffectByToken(forgedItem.prefixToken);
forgedItem.addPermanentEnchantment(prefix.getIDString(), 0);
}
if (forgedItem.suffixToken != 0) {
EffectsBase suffix = PowersManager.getEffectByToken(forgedItem.suffixToken);
forgedItem.addPermanentEnchantment(suffix.getIDString(), 0);
}
}
}

3
src/engine/net/client/handlers/ItemProductionMsgHandler.java

@ -13,6 +13,7 @@ import engine.exception.MsgSendException; @@ -13,6 +13,7 @@ import engine.exception.MsgSendException;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.ForgeManager;
import engine.gameManager.ItemManager;
import engine.loot.WorkOrder;
import engine.mbEnums;
import engine.mbEnums.ItemType;
@ -159,7 +160,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler { @@ -159,7 +160,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
completedItem.prefixToken = virtualItem.prefixToken;
completedItem.suffixToken = virtualItem.suffixToken;
ForgeManager.applyItemEffects(completedItem);
ItemManager.applyItemEffects(completedItem);
vendor.charItemManager.addItemToInventory(completedItem);

Loading…
Cancel
Save