Browse Source

forge manager cleanup and special drop rates

lakebane
FatBoy-DOTC 3 weeks ago
parent
commit
eaeb2eb943
  1. 23
      src/engine/gameManager/SpecialLootHandler.java
  2. 38
      src/engine/objects/ItemFactory.java

23
src/engine/gameManager/SpecialLootHandler.java

@ -105,13 +105,24 @@ public class SpecialLootHandler { @@ -105,13 +105,24 @@ public class SpecialLootHandler {
}
public static Zone getMacroZone(Mob mob){
for(Zone zone : ZoneManager.macroZones){
HashSet<AbstractWorldObject> inZone = WorldGrid.getObjectsInRangePartial(zone.getLoc(),zone.getBounds().getHalfExtents().x * 2f, MBServerStatics.MASK_MOB);
if(inZone.contains(mob)){
return zone;
}
Zone parentZone = mob.parentZone;
if(parentZone == null)
return null;
while(!parentZone.isMacroZone() && !parentZone.equals(ZoneManager.getSeaFloor())){
parentZone = parentZone.getParent();
}
return null;
return parentZone;
//for(Zone zone : ZoneManager.macroZones){
// HashSet<AbstractWorldObject> inZone = WorldGrid.getObjectsInRangePartial(zone.getLoc(),zone.getBounds().getHalfExtents().x * 2f, MBServerStatics.MASK_MOB);
// if(inZone.contains(mob)){
// return zone;
// }
//}
//return null;
}
public static int getContractForZone(Zone zone){

38
src/engine/objects/ItemFactory.java

@ -26,6 +26,7 @@ import org.joda.time.DateTime; @@ -26,6 +26,7 @@ import org.joda.time.DateTime;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
@ -679,58 +680,40 @@ public class ItemFactory { @@ -679,58 +680,40 @@ public class ItemFactory {
return null;
}
for (byte temp : vendor.getItemModTable()) {
if (itemModTable != temp)
continue;
prefixMod = vendor.getModTypeTable().get(vendor.getItemModTable().indexOf(temp));
suffixMod = vendor.getModSuffixTable().get(vendor.getItemModTable().indexOf(temp));
}
Random random = new Random();
prefixMod = vendor.getModTypeTable().get(random.nextInt(vendor.getModTypeTable().size()));
suffixMod = vendor.getModSuffixTable().get(random.nextInt(vendor.getModTypeTable().size()));
if (prefixMod == 0 && suffixMod == 0) {
Logger.info("Failed to find modTables for item " + ib.getName());
return null;
}
// Roll on the tables for this vendor
ArrayList<ModTypeTableEntry> prefixTable = LootManager._modTypeTables.get(prefixMod);
ArrayList<ModTypeTableEntry> suffixTable = LootManager._modTypeTables.get(suffixMod);
ModTypeTableEntry prefixTypeTable = ModTypeTableEntry.rollTable(prefixMod, ThreadLocalRandom.current().nextInt(1, 100 + 1));
ModTypeTableEntry suffixTypeTable = ModTypeTableEntry.rollTable(suffixMod, ThreadLocalRandom.current().nextInt(1, 100 + 1));
ModTypeTableEntry prefixTypeTable = prefixTable.get(random.nextInt(prefixTable.size()));
ModTypeTableEntry suffixTypeTable = suffixTable.get(random.nextInt(suffixTable.size()));
// Sanity check.
if (prefixTypeTable == null || suffixTypeTable == null)
return null;
int rollPrefix = ThreadLocalRandom.current().nextInt(1, 100 + 1);
int rollPrefix = ThreadLocalRandom.current().nextInt(100);
if (rollPrefix < vendor.getLevel() + 30) {
int randomPrefix = TableRoll(vendor.getLevel());
if(vendor.contract.getName().contains("Heavy") || vendor.contract.getName().contains("Medium") || vendor.contract.getName().contains("Leather"))
randomPrefix += vendor.level * 0.5f;
if(randomPrefix > 320)
randomPrefix = 320;
prefixEntry = ModTableEntry.rollTable(prefixTypeTable.modTableID, randomPrefix);
if (prefixEntry != null)
prefix = prefixEntry.action;
}
int rollSuffix = ThreadLocalRandom.current().nextInt(1, 100 + 1);
// Always have at least one mod on a magic rolled item.
// Suffix will be our backup plan.
int rollSuffix = ThreadLocalRandom.current().nextInt( 100);
if (rollSuffix < vendor.getLevel() + 30) {
int randomSuffix = TableRoll(vendor.getLevel());
if(vendor.contract.getName().contains("Heavy") || vendor.contract.getName().contains("Medium") || vendor.contract.getName().contains("Leather"))
randomSuffix += vendor.level * 0.25f;
if(randomSuffix > 320)
randomSuffix = 320;
suffixEntry = ModTableEntry.rollTable(suffixTypeTable.modTableID, randomSuffix);
if (suffixEntry != null)
@ -1092,4 +1075,5 @@ public class ItemFactory { @@ -1092,4 +1075,5 @@ public class ItemFactory {
return ml;
}
}

Loading…
Cancel
Save