Browse Source

new loot system completed

master
FatBoy-DOTC 2 years ago
parent
commit
93f6d0be0b
  1. 23
      src/engine/devcmd/cmds/simulateBootyCmd.java
  2. 6
      src/engine/loot/LootManager.java

23
src/engine/devcmd/cmds/simulateBootyCmd.java

@ -5,8 +5,6 @@ import engine.devcmd.AbstractDevCmd;
import engine.gameManager.*; import engine.gameManager.*;
import engine.objects.*; import engine.objects.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.ThreadLocalRandom;
import static engine.loot.LootManager.getGenTableItem;
public class simulateBootyCmd extends AbstractDevCmd { public class simulateBootyCmd extends AbstractDevCmd {
public simulateBootyCmd() { public simulateBootyCmd() {
@ -69,8 +67,17 @@ public class simulateBootyCmd extends AbstractDevCmd {
Mob mob = (Mob) target; Mob mob = (Mob) target;
output += "Name: " + mob.getName() + newline; output += "Name: " + mob.getName() + newline;
int minRollRange = mob.getLevel() + 0 + mob.getParentZone().minLvl; int minRollRange = mob.getLevel() + 0 + mob.getParentZone().minLvl;
int maxRollRange = (mob.getLevel() * 2) + 100 + (mob.getParentZone().maxLvl * 2); int maxRollRange = (mob.getLevel() * 2) + 120 + (mob.getParentZone().maxLvl * 2);
output += "Roll Range: " + minRollRange + " - " + maxRollRange + newline; output += "Roll Range: " + minRollRange + " - " + maxRollRange + newline;
output += "Special Loot:" + newline;
if(mob.bootySet != 0) {
for (BootySetEntry entry : NPCManager._bootySetMap.get(mob.bootySet)) {
ItemBase item = ItemBase.getItemBase(entry.itemBase);
if (item != null) {
output += "[" + entry.bootyType + "] " + item.getName() + " [Chance] " + entry.dropChance + newline;
}
}
}
ArrayList<Item> GlassItems = new ArrayList<Item>(); ArrayList<Item> GlassItems = new ArrayList<Item>();
ArrayList<Item> Resources = new ArrayList<Item>(); ArrayList<Item> Resources = new ArrayList<Item>();
ArrayList<Item> Runes = new ArrayList<Item>(); ArrayList<Item> Runes = new ArrayList<Item>();
@ -101,10 +108,16 @@ public class simulateBootyCmd extends AbstractDevCmd {
GlassItems.add(lootItem); GlassItems.add(lootItem);
} else { } else {
OtherDrops.add(lootItem); OtherDrops.add(lootItem);
if(lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") ||lootItem.getName().toLowerCase().contains("bell")){
output += lootItem.getName() + newline;
}
} }
break; break;
default: default:
OtherDrops.add(lootItem); OtherDrops.add(lootItem);
if(lootItem.getName().toLowerCase().contains("crimson") || lootItem.getName().toLowerCase().contains("vorgrim") ||lootItem.getName().toLowerCase().contains("bell")){
output += lootItem.getName() + newline;
}
break; break;
} }
} }
@ -116,7 +129,8 @@ public class simulateBootyCmd extends AbstractDevCmd {
if(mob.spawnTime > 0){ if(mob.spawnTime > 0){
respawnTime = mob.spawnTime; respawnTime = mob.spawnTime;
} }
output += "BootySet: " + mob.getMobBase().bootySet + newline; output += "MobBase BootySet: " + mob.getMobBase().bootySet + newline;
output += "Mob BootySet: " + mob.bootySet + newline;
output += "Tables Rolled On: " + newline; output += "Tables Rolled On: " + newline;
for(BootySetEntry entry : NPCManager._bootySetMap.get(mob.getMobBase().bootySet)){ for(BootySetEntry entry : NPCManager._bootySetMap.get(mob.getMobBase().bootySet)){
output += "[" + entry.bootyType + "] " + entry.lootTable + newline; output += "[" + entry.bootyType + "] " + entry.lootTable + newline;
@ -131,7 +145,6 @@ public class simulateBootyCmd extends AbstractDevCmd {
output += "FAILED ROLLS: " + failures + newline; output += "FAILED ROLLS: " + failures + newline;
break; break;
} }
throwbackInfo(pc, output); throwbackInfo(pc, output);
} }

6
src/engine/loot/LootManager.java

@ -20,6 +20,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
@ -125,7 +126,8 @@ public class LootManager {
} }
int itemTableId = selectedRow.itemTableID; int itemTableId = selectedRow.itemTableID;
int minRollRange = mob.getLevel() + roll + mob.getParentZone().minLvl; int minRollRange = mob.getLevel() + roll + mob.getParentZone().minLvl;
int maxRollRange = (mob.getLevel() * 2) + roll + (mob.getParentZone().maxLvl * 2); //add 20 to max roll range to make dwarven HA and Sage possible
int maxRollRange = (mob.getLevel() * 2) + roll + 20 + (mob.getParentZone().maxLvl * 2);
if(maxRollRange > 320){ if(maxRollRange > 320){
maxRollRange = 320; maxRollRange = 320;
} }
@ -153,6 +155,7 @@ public class LootManager {
ModTableRow prefixMod = prefixModTable.getRowForRange(new Random().nextInt(maxRollRange) + minRollRange); ModTableRow prefixMod = prefixModTable.getRowForRange(new Random().nextInt(maxRollRange) + minRollRange);
if (prefixMod != null && prefixMod.action.length() > 0) { if (prefixMod != null && prefixMod.action.length() > 0) {
outItem.setPrefix(prefixMod.action); outItem.setPrefix(prefixMod.action);
outItem.addPermanentEnchantment(prefixMod.action, 0, prefixMod.level, true);
} }
} }
if (modTables.get(suffixTable.getRowForRange(100).modTableID) != null) { if (modTables.get(suffixTable.getRowForRange(100).modTableID) != null) {
@ -160,6 +163,7 @@ public class LootManager {
ModTableRow suffixMod = suffixModTable.getRowForRange(new Random().nextInt(maxRollRange) + minRollRange); ModTableRow suffixMod = suffixModTable.getRowForRange(new Random().nextInt(maxRollRange) + minRollRange);
if (suffixMod != null && suffixMod.action.length() > 0) { if (suffixMod != null && suffixMod.action.length() > 0) {
outItem.setSuffix(suffixMod.action); outItem.setSuffix(suffixMod.action);
outItem.addPermanentEnchantment(suffixMod.action, 0, suffixMod.level, true);
} }
} }
} }

Loading…
Cancel
Save