|
|
|
@ -8,15 +8,19 @@
@@ -8,15 +8,19 @@
|
|
|
|
|
|
|
|
|
|
package engine.gameManager; |
|
|
|
|
|
|
|
|
|
import engine.loot.ModTableEntry; |
|
|
|
|
import engine.loot.ModTypeTableEntry; |
|
|
|
|
import engine.loot.WorkOrder; |
|
|
|
|
import engine.mbEnums; |
|
|
|
|
import engine.objects.*; |
|
|
|
|
import engine.powers.EffectsBase; |
|
|
|
|
import engine.powers.poweractions.AbstractPowerAction; |
|
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.concurrent.BlockingQueue; |
|
|
|
|
import java.util.concurrent.DelayQueue; |
|
|
|
|
import java.util.concurrent.ThreadLocalRandom; |
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
|
|
|
|
@ -254,12 +258,22 @@ public enum ForgeManager implements Runnable {
@@ -254,12 +258,22 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
|
|
|
|
|
public static Item forgeItem(WorkOrder workOrder) { |
|
|
|
|
|
|
|
|
|
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID); |
|
|
|
|
|
|
|
|
|
Item forgedItem = new Item(workOrder.templateID); |
|
|
|
|
forgedItem.objectUUID = MobLoot.lastNegativeID.getAndDecrement(); |
|
|
|
|
forgedItem.containerType = mbEnums.ItemContainerType.FORGE; |
|
|
|
|
forgedItem.ownerID = workOrder.vendor.getObjectUUID(); |
|
|
|
|
forgedItem.setDateToUpgrade(workOrder.completionTime); |
|
|
|
|
|
|
|
|
|
// Give prefix and suffix to this item if random rolled
|
|
|
|
|
|
|
|
|
|
if (workOrder.prefixToken == 0) |
|
|
|
|
forgedItem.prefixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.PREFIX, template.modTable); |
|
|
|
|
|
|
|
|
|
if (workOrder.suffixToken == 0) |
|
|
|
|
forgedItem.suffixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.SUFFIX, template.modTable); |
|
|
|
|
|
|
|
|
|
// Forged random rolled items are unidentified until completed
|
|
|
|
|
|
|
|
|
|
if (workOrder.prefixToken == 0 && workOrder.suffixToken == 0) |
|
|
|
@ -282,14 +296,39 @@ public enum ForgeManager implements Runnable {
@@ -282,14 +296,39 @@ public enum ForgeManager implements Runnable {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void calsRandomModType(NPC vendor, mbEnums.ItemModType itemModType, Item item) { |
|
|
|
|
public static int calcRandomMod(NPC vendor, mbEnums.ItemModType itemModType, int modTable) { |
|
|
|
|
|
|
|
|
|
int modifier = 0; |
|
|
|
|
ModTypeTableEntry modTypeTableEntry = null; |
|
|
|
|
ModTableEntry modRollEntry = null; |
|
|
|
|
int modifierRoll; |
|
|
|
|
|
|
|
|
|
switch (itemModType) { |
|
|
|
|
case PREFIX: |
|
|
|
|
modifier = vendor.getModTypeTable().get(vendor.getItemModTable().indexOf(modTable)); |
|
|
|
|
modTypeTableEntry = ModTypeTableEntry.rollTable(modifier, ThreadLocalRandom.current().nextInt(1, 100 + 1)); |
|
|
|
|
break; |
|
|
|
|
case SUFFIX: |
|
|
|
|
modifier = vendor.getModSuffixTable().get(vendor.getItemModTable().indexOf(modTable)); |
|
|
|
|
modTypeTableEntry = ModTypeTableEntry.rollTable(modifier, ThreadLocalRandom.current().nextInt(1, 100 + 1)); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (modTypeTableEntry == null) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
int modifier; |
|
|
|
|
modifierRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1); |
|
|
|
|
|
|
|
|
|
if (itemModType.equals(mbEnums.ItemModType.PREFIX)) |
|
|
|
|
modifier = vendor.getModTypeTable().get(vendor.getItemModTable().indexOf(item.template.modTable)); |
|
|
|
|
else |
|
|
|
|
modifier = vendor.getModTypeTable().get(vendor.getItemModTable().indexOf(item.template.modTable)); |
|
|
|
|
if (modifierRoll < 80) { |
|
|
|
|
modifierRoll = LootManager.TableRoll(vendor.getLevel(), false); |
|
|
|
|
modRollEntry = ModTableEntry.rollTable(modTypeTableEntry.modTableID, modifierRoll); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (modRollEntry != null) { |
|
|
|
|
AbstractPowerAction abstractPowerAction = PowersManager.getPowerActionByIDString(modRollEntry.action); |
|
|
|
|
modifier = abstractPowerAction.getEffectsBase().getToken(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return modifier; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|