Browse Source

Comment cleanup

combat-2
MagicBot 8 months ago
parent
commit
197df90a21
  1. 22
      src/engine/gameManager/ForgeManager.java

22
src/engine/gameManager/ForgeManager.java

@ -265,12 +265,22 @@ public enum ForgeManager implements Runnable {
public static Item forgeItem(WorkOrder workOrder) { public static Item forgeItem(WorkOrder workOrder) {
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID); // Create new item from specified template
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
Item forgedItem = new Item(workOrder.templateID); Item forgedItem = new Item(workOrder.templateID);
// Item gets a negative id; a virtual in-memory only item
// which is not persisted or added to the game cache.
forgedItem.objectUUID = MobLoot.lastNegativeID.getAndDecrement(); forgedItem.objectUUID = MobLoot.lastNegativeID.getAndDecrement();
forgedItem.containerType = mbEnums.ItemContainerType.FORGE; forgedItem.containerType = mbEnums.ItemContainerType.FORGE;
forgedItem.ownerID = workOrder.vendor.getObjectUUID(); forgedItem.ownerID = workOrder.vendor.getObjectUUID();
// The UpgradeDate for the item is serialized for the
// vendor forge window
forgedItem.setDateToUpgrade(workOrder.completionTime); forgedItem.setDateToUpgrade(workOrder.completionTime);
// Give prefix and suffix to this item if random rolled // Give prefix and suffix to this item if random rolled
@ -302,17 +312,19 @@ public enum ForgeManager implements Runnable {
toRemove.add(workOrderItem); toRemove.add(workOrderItem);
// Remove the virtual items from the forge window
ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_SETPRICE, true); ItemProductionMsg outMsg = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_SETPRICE, true);
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false); DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
ItemProductionMsg outMsg2 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true); ItemProductionMsg outMsg2 = new ItemProductionMsg(workOrder.vendor.building, workOrder.vendor, workOrderItem, mbEnums.ProductionActionType.CONFIRM_DEPOSIT, true);
DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg2, mbEnums.DispatchChannel.SECONDARY, 700, false, false); DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg2, mbEnums.DispatchChannel.SECONDARY, 700, false, false);
completed_item = DbManager.ItemQueries.PERSIST(workOrderItem); // Turn the virtual item into a real one and add to the vendor inventory
completed_item = DbManager.ItemQueries.PERSIST(workOrderItem);
workOrder.vendor.charItemManager.addItemToInventory(completed_item); workOrder.vendor.charItemManager.addItemToInventory(completed_item);
} }
// Remove the fake negativeID item from all collections. // Remove the fake negativeID virtual item from all collections.
// set the items as 'completed'
for (Item memoryItem : toRemove) { for (Item memoryItem : toRemove) {
workOrder.cooking.remove(memoryItem); workOrder.cooking.remove(memoryItem);
@ -328,7 +340,7 @@ public enum ForgeManager implements Runnable {
Item forged_item = forgeItem(workOrder); Item forged_item = forgeItem(workOrder);
// Add item to in-memory caches // Add virtual item to in-memory caches
workOrder.cooking.add(forged_item); workOrder.cooking.add(forged_item);

Loading…
Cancel
Save