Browse Source

MobileBooty system integrated.

master
MagicBot 2 years ago
parent
commit
2b307daeb2
  1. 3
      src/engine/Enum.java
  2. 75
      src/engine/db/handlers/dbSpecialLootHandler.java
  3. 64
      src/engine/devcmd/cmds/GetDisciplineLocCmd.java
  4. 1
      src/engine/gameManager/DbManager.java
  5. 1
      src/engine/gameManager/DevCmdManager.java
  6. 342
      src/engine/objects/LootTable.java
  7. 12
      src/engine/objects/Mob.java
  8. 77
      src/engine/objects/SpecialLoot.java
  9. 3
      src/engine/server/world/WorldServer.java

3
src/engine/Enum.java

@ -9,7 +9,6 @@ @@ -9,7 +9,6 @@
package engine;
import ch.claude_martin.enumbitset.EnumBitSetHelper;
import engine.gameManager.ConfigManager;
import engine.gameManager.PowersManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector2f;
@ -1773,7 +1772,7 @@ public class Enum { @@ -1773,7 +1772,7 @@ public class Enum {
SkillReq,
SkillsBase,
SkillsBaseAttribute,
SpecialLoot,
MobileBooty,
StrongBox,
Trigger,
ValidRaceBeardStyle,

75
src/engine/db/handlers/dbSpecialLootHandler.java

@ -1,75 +0,0 @@ @@ -1,75 +0,0 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.db.handlers;
import engine.objects.SpecialLoot;
import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
public class dbSpecialLootHandler extends dbHandlerBase {
public dbSpecialLootHandler() {
this.localClass = SpecialLoot.class;
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public ArrayList<SpecialLoot> GET_SPECIALLOOT(int mobbaseID) {
prepareCallable("SELECT * FROM `static_npc_mob_specialloot` WHERE `mobbaseID`=?");
setInt(1, mobbaseID);
return getObjectList();
}
public void GenerateSpecialLoot(){
HashMap<Integer, ArrayList<SpecialLoot>> lootSets;
SpecialLoot lootSetEntry;
int lootSetID;
lootSets = new HashMap<>();
int recordsRead = 0;
prepareCallable("SELECT * FROM static_zone_npc_specialloot");
try {
ResultSet rs = executeQuery();
while (rs.next()) {
recordsRead++;
lootSetID = rs.getInt("lootSet");
lootSetEntry = new SpecialLoot(rs,true);
if (lootSets.get(lootSetID) == null){
ArrayList<SpecialLoot> lootList = new ArrayList<>();
lootList.add(lootSetEntry);
lootSets.put(lootSetID, lootList);
}
else{
ArrayList<SpecialLoot>lootList = lootSets.get(lootSetID);
lootList.add(lootSetEntry);
lootSets.put(lootSetID, lootList);
}
}
Logger.info( "read: " + recordsRead + " cached: " + lootSets.size());
} catch (SQLException e) {
Logger.error(e.getErrorCode() + ' ' + e.getMessage(), e);
} finally {
closeCallable();
}
SpecialLoot.LootMap = lootSets;
}
}

64
src/engine/devcmd/cmds/GetDisciplineLocCmd.java

@ -1,64 +0,0 @@ @@ -1,64 +0,0 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.devcmd.cmds;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager;
import engine.objects.*;
import java.util.ArrayList;
/**
* @author
*
*/
public class GetDisciplineLocCmd extends AbstractDevCmd {
public GetDisciplineLocCmd() {
super("getdiscloc");
}
@Override
protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) {
System.out.println("MOB UUID , MOB NAME , MACRO ZONE NAME , MOB LOCATION, DROPPED ITEM, DROP CHANCE");
for (Zone zone: ZoneManager.getAllZones()){
for (Mob mob: zone.zoneMobSet){
if (mob.getLevel() >= 80)
continue;
ArrayList<SpecialLoot> specialLootList = SpecialLoot.LootMap.get(mob.getLootSet());
if (specialLootList != null)
for (SpecialLoot specialLoot: specialLootList){
ItemBase itemBase = ItemBase.getItemBase(specialLoot.getItemID());
System.out.println(mob.getObjectUUID() + " : " + mob.getName() + " : " + (mob.getParentZone().isMacroZone() ? mob.getParentZone().getName() : mob.getParentZone().getParent().getName()) + " , " + mob.getLoc().toString2D() + " , " + itemBase.getName() + " , " + specialLoot.getDropChance() + '%');
}
}
}
}
@Override
protected String _getHelpString() {
return "Enchants an item with a prefix and suffix";
}
@Override
protected String _getUsageString() {
return "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
}
}

1
src/engine/gameManager/DbManager.java

@ -303,7 +303,6 @@ public enum DbManager { @@ -303,7 +303,6 @@ public enum DbManager {
public static final dbRuneBaseHandler RuneBaseQueries = new dbRuneBaseHandler();
public static final dbSkillBaseHandler SkillsBaseQueries = new dbSkillBaseHandler();
public static final dbSkillReqHandler SkillReqQueries = new dbSkillReqHandler();
public static final dbSpecialLootHandler SpecialLootQueries = new dbSpecialLootHandler();
public static final dbVendorDialogHandler VendorDialogQueries = new dbVendorDialogHandler();
public static final dbZoneHandler ZoneQueries = new dbZoneHandler();
public static final dbRealmHandler RealmQueries = new dbRealmHandler();

1
src/engine/gameManager/DevCmdManager.java

@ -134,7 +134,6 @@ public enum DevCmdManager { @@ -134,7 +134,6 @@ public enum DevCmdManager {
DevCmdManager.registerDevCmd(new convertLoc());
DevCmdManager.registerDevCmd(new GetMobBaseLoot());
DevCmdManager.registerDevCmd(new MBDropCmd());
DevCmdManager.registerDevCmd(new GetDisciplineLocCmd());
DevCmdManager.registerDevCmd(new AuditHeightMapCmd());
DevCmdManager.registerDevCmd(new UnloadFurnitureCmd());
DevCmdManager.registerDevCmd(new SetNPCSlotCmd());

342
src/engine/objects/LootTable.java

@ -9,15 +9,14 @@ @@ -9,15 +9,14 @@
package engine.objects;
import engine.Enum;
import engine.Enum.ItemContainerType;
import engine.Enum.ItemType;
import engine.Enum.OwnerType;
import engine.gameManager.ConfigManager;
import engine.gameManager.DbManager;
import engine.gameManager.NPCManager;
import engine.gameManager.ZoneManager;
import engine.server.MBServerStatics;
import engine.server.world.WorldServer;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
@ -182,32 +181,31 @@ public class LootTable { @@ -182,32 +181,31 @@ public class LootTable {
}
//Returns a list of random loot for a mob based on level, lootTable and hotzone
public static ArrayList<MobLoot> getMobLoot(Mob mob, int mobLevel, int lootTable, boolean hotzone) {
public static ArrayList<MobLoot> getMobLoot(Mob mobile, int mobLevel, int lootTable, boolean hotzone) {
// Member variable declaration
ArrayList<MobLoot> loot;
ArrayList<MobLoot> mobLoot;
int calculatedLootTable;
int roll;
int randomRoll;
// Member variable assignment
loot = new ArrayList<>();
mobLoot = new ArrayList<>();
// Setup default loot table if none exists
calculatedLootTable = lootTable;
LootTable.rollCount++;
if (MobLootBase.MobLootSet.get(mob.getMobBase().getLoadID()).isEmpty()){
if (MobLootBase.MobLootSet.get(mobile.getMobBase().getLoadID()).isEmpty()){
roll = ThreadLocalRandom.current().nextInt(100);
if (roll > 90)
if (roll > LootTable.oneDropHotZone)
addMobLoot(mob, loot, mobLevel, calculatedLootTable, 1, true);
randomRoll = ThreadLocalRandom.current().nextInt(100);
if (randomRoll > 90)
if (randomRoll > LootTable.oneDropHotZone)
addMobLoot(mobile, mobLoot, mobLevel, calculatedLootTable, 1, true);
else
addMobLoot(mob, loot, mobLevel, calculatedLootTable, 1, true);
addMobLoot(mobile, mobLoot, mobLevel, calculatedLootTable, 1, true);
}else{
for (MobLootBase mlb:MobLootBase.MobLootSet.get(mob.getMobBase().getLoadID())){
for (MobLootBase mlb:MobLootBase.MobLootSet.get(mobile.getMobBase().getLoadID())){
float chance = mlb.getChance() *.01f;
@ -215,12 +213,10 @@ public class LootTable { @@ -215,12 +213,10 @@ public class LootTable {
calculatedLootTable = mlb.getLootTableID();
if (ThreadLocalRandom.current().nextFloat() > chance)
continue;
addMobLoot(mob, loot, mobLevel, calculatedLootTable, 1, false);
addMobLoot(mobile, mobLoot, mobLevel, calculatedLootTable, 1, false);
}
}
@ -230,62 +226,48 @@ public class LootTable { @@ -230,62 +226,48 @@ public class LootTable {
if (calculatedLootTable <= 1)
calculatedLootTable = 1300; // GENERIC WORLD
//handle hotzone random loot
if (hotzone) {
LootTable.rollCount++;
if (MobLootBase.MobLootSet.get(mob.getMobBase().getLoadID()).isEmpty()){
roll = ThreadLocalRandom.current().nextInt(100);
if (roll > 90)
if (roll > LootTable.oneDropHotZone)
addMobLoot(mob, loot, mobLevel, calculatedLootTable + 1, 1, true);
else
addMobLoot(mob, loot, mobLevel, calculatedLootTable + 1, 1, true);
}else{
for (MobLootBase mlb:MobLootBase.MobLootSet.get(mob.getMobBase().getLoadID())){
if (!MobLootBase.MobLootSet.get(mobile.getMobBase().getLoadID()).isEmpty())
for (MobLootBase mlb : MobLootBase.MobLootSet.get(mobile.getMobBase().getLoadID())) {
if (!LootTable.lootGroups.containsKey(mlb.getLootTableID() + 1))
continue;
calculatedLootTable = mlb.getLootTableID();
break;
}
roll = ThreadLocalRandom.current().nextInt(100);
if (roll > 90)
if (roll > LootTable.oneDropHotZone)
addMobLoot(mob, loot, mobLevel, (calculatedLootTable + 1), 1, true);
else
addMobLoot(mob, loot, mobLevel, (calculatedLootTable + 1), 1, true);
}
randomRoll = ThreadLocalRandom.current().nextInt(100);
if (randomRoll > 90)
if (randomRoll > LootTable.oneDropHotZone)
addMobLoot(mobile, mobLoot, mobLevel, calculatedLootTable + 1, 1, true);
else
addMobLoot(mobile, mobLoot, mobLevel, calculatedLootTable + 1, 1, true);
}
//handle mob specific special loot
handleSpecialLoot(loot, mob, false);
return loot;
ArrayList bootyLoot = getBootyLoot(mobile);
mobLoot.addAll(bootyLoot);
return mobLoot;
}
public static ArrayList<MobLoot> getMobLootDeath(Mob mob, int mobLevel, int lootTable) {
ArrayList<MobLoot> loot = new ArrayList<>();
public static ArrayList<MobLoot> getMobLootDeath(Mob mobile, int mobLevel, int lootTable) {
ArrayList<MobLoot> mobLoot = new ArrayList<>();
if (mob == null)
return loot;
if (mobile == null)
return mobLoot;
//handle hotzone random loot
boolean hotzone = ZoneManager.inHotZone(mob.getLoc());
boolean hotzone = ZoneManager.inHotZone(mobile.getLoc());
if (hotzone) {
if (MobLootBase.MobLootSet.get(mob.getMobBase().getLoadID()).isEmpty()){
if (MobLootBase.MobLootSet.get(mobile.getMobBase().getLoadID()).isEmpty()){
lootTable += 1;
if (lootTable <= 1)
@ -293,11 +275,11 @@ public class LootTable { @@ -293,11 +275,11 @@ public class LootTable {
int roll = ThreadLocalRandom.current().nextInt(100);
if (roll > 90)
if (roll > LootTable.oneDropHotZone)
addMobLoot(mob, loot, mobLevel, lootTable, 1, true);
addMobLoot(mobile, mobLoot, mobLevel, lootTable, 1, true);
else
addMobLoot(mob, loot, mobLevel, lootTable, 1, true);
addMobLoot(mobile, mobLoot, mobLevel, lootTable, 1, true);
}else{
for (MobLootBase mlb:MobLootBase.MobLootSet.get(mob.getMobBase().getLoadID())){
for (MobLootBase mlb:MobLootBase.MobLootSet.get(mobile.getMobBase().getLoadID())){
lootTable = mlb.getLootTableID() + 1;
if (!LootTable.lootGroups.containsKey(lootTable))
continue;
@ -305,67 +287,54 @@ public class LootTable { @@ -305,67 +287,54 @@ public class LootTable {
int roll = ThreadLocalRandom.current().nextInt(100);
if (roll > 90)
if (roll > LootTable.oneDropHotZone)
addMobLoot(mob, loot, mobLevel, (lootTable), 1, true);
addMobLoot(mobile, mobLoot, mobLevel, (lootTable), 1, true);
else
addMobLoot(mob, loot, mobLevel, (lootTable), 1, true);
addMobLoot(mobile, mobLoot, mobLevel, (lootTable), 1, true);
break;
}
}
if (loot.isEmpty()){
if (mobLoot.isEmpty()){
LootTable.rollCount++; //add another rollCount here.
int resourceRoll = ThreadLocalRandom.current().nextInt(100);
if (resourceRoll <=5)
addMobLootResources(mob, loot, mobLevel, (lootTable), 1, true);
addMobLootResources(mobile, mobLoot, mobLevel, (lootTable), 1, true);
}
}
//handle mob specific special loot on death
handleSpecialLoot(loot, mob, true);
//handle mob specific booty on death
ArrayList bootyLoot = getBootyLoot(mobile);
mobLoot.addAll(bootyLoot);
return loot;
return mobLoot;
}
private static void handleSpecialLoot(ArrayList<MobLoot> loot, Mob mob, boolean onDeath) {
private static ArrayList<MobLoot> getBootyLoot(Mob mob) {
if (SpecialLoot.LootMap.containsKey(mob.getLootSet())) {
ArrayList<SpecialLoot> specialLoot = SpecialLoot.LootMap.get(mob.getLootSet());
for (SpecialLoot sl : specialLoot) {
if ((onDeath && sl.dropOnDeath()) || (!onDeath && !sl.dropOnDeath()))
if (ThreadLocalRandom.current().nextInt(100) < sl.getDropChance()) {
ItemBase ib = ItemBase.getItemBase(sl.getItemID());
if (ib != null) {
ArrayList<BootySetEntry> bootySetList;
ArrayList<MobLoot> mobLootList = new ArrayList<>();
switch (ib.getUUID()){
case 19290:
continue;
case 19291:
continue;
case 19292:
continue;
case 27530:
continue;
case 973000:
continue;
case 973200:
continue;
case 26360:
continue;
}
MobLoot ml = new MobLoot(mob, ib, sl.noSteal());
loot.add(ml);
if (mob.bootySetID == 0)
return mobLootList;
bootySetList = NPCManager._bootySetMap.get(mob.bootySetID);
for (BootySetEntry bootyEntry : bootySetList)
if (ThreadLocalRandom.current().nextInt(100) < bootyEntry.dropChance) {
ItemBase itemBase = ItemBase.getItemBase(bootyEntry.itemBase);
if (itemBase != null) {
MobLoot mobLoot = new MobLoot(mob, itemBase, true);
mobLootList.add(mobLoot);
}
}
}
}
return mobLootList;
}
@ -394,40 +363,29 @@ public class LootTable { @@ -394,40 +363,29 @@ public class LootTable {
LootRow modRow = null;
// Used for actual generation of items
int itemBaseUUID;
ItemBase itemBase = null;
MobLoot mobLoot;
Zone zone = mob.getParentZone();
// Member variable assignment
if (!LootTable.lootGroups.containsKey(lootTableID))
return;
lootGroup = LootTable.lootGroups.get(lootTableID);
calculatedMobLevel = mobLevel;
if (calculatedMobLevel > 49)
calculatedMobLevel = 49;
int roll = 0;
int randomRoll = 0;
for (int i = 0; i < cnt; i++) {
Random random = new Random();
roll = random.nextInt(100) + 1; //random roll between 1 and 100
groupRow = lootGroup.getLootRow(roll);
randomRoll = random.nextInt(100) + 1; //random roll between 1 and 100
groupRow = lootGroup.getLootRow(randomRoll);
if (groupRow == null)
return;
@ -436,21 +394,13 @@ public class LootTable { @@ -436,21 +394,13 @@ public class LootTable {
if (!LootTable.lootTables.containsKey(groupRow.getValueOne()))
return;
lootTable = LootTable.lootTables.get(groupRow.getValueOne());
//get item ID //FUCK THIS RETARDED SHIT
// roll = gaussianLevel(calculatedMobLevel);
int minRoll = (int) ((calculatedMobLevel - 5) * 5);
int maxRoll = (int) ((calculatedMobLevel + 15) * 5);
if (minRoll < (int)lootTable.minRoll){
if (minRoll < (int)lootTable.minRoll)
minRoll = (int)lootTable.minRoll;
}
if (maxRoll < minRoll)
maxRoll = minRoll;
@ -458,36 +408,30 @@ public class LootTable { @@ -458,36 +408,30 @@ public class LootTable {
if (maxRoll > lootTable.maxRoll)
maxRoll = (int) lootTable.maxRoll;
if (maxRoll > 320)
maxRoll = 320;
roll = (int) ThreadLocalRandom.current().nextDouble(minRoll, maxRoll + 1); //Does not return Max, but does return min?
randomRoll = (int) ThreadLocalRandom.current().nextDouble(minRoll, maxRoll + 1); //Does not return Max, but does return min?
lootRow = lootTable.getLootRow(roll); //get the item row from the bell's curve of level +-15
lootRow = lootTable.getLootRow(randomRoll); //get the item row from the bell's curve of level +-15
if (lootRow == null)
continue; //no item found for roll
itemBaseUUID = lootRow.getValueOne();
if (lootRow.getValueOne() == 0)
continue;
//handle quantities > 1 for resource drops
minSpawn = lootRow.getValueTwo();
maxSpawn = lootRow.getValueThree();
// spawnQuanity between minspawn (inclusive) and maxspawn (inclusive)
// spawnQuantity between min spawn (inclusive) and max spawn (inclusive)
if (maxSpawn > 1)
spawnQuanity = ThreadLocalRandom.current().nextInt((maxSpawn + 1 - minSpawn)) + minSpawn;
//get modifierPrefix
calculatedMobLevel = mobLevel;
@ -500,20 +444,18 @@ public class LootTable { @@ -500,20 +444,18 @@ public class LootTable {
int chanceMod = ThreadLocalRandom.current().nextInt(100) + 1;
if (chanceMod < 25){
if (chanceMod < 25) {
modGroup = LootTable.modGroups.get(groupRow.getValueTwo());
if (modGroup != null) {
for (int a = 0;a<10;a++){
roll = ThreadLocalRandom.current().nextInt(100) + 1;
modRow = modGroup.getLootRow(roll);
randomRoll = ThreadLocalRandom.current().nextInt(100) + 1;
modRow = modGroup.getLootRow(randomRoll);
if (modRow != null)
break;
}
if (modRow != null) {
subTableID = modRow.getValueOne();
@ -521,17 +463,15 @@ public class LootTable { @@ -521,17 +463,15 @@ public class LootTable {
modTable = LootTable.modTables.get(subTableID);
roll = gaussianLevel((int)calculatedMobLevel);
if (roll < modTable.minRoll)
roll = (int) modTable.minRoll;
randomRoll = gaussianLevel((int)calculatedMobLevel);
if (roll > modTable.maxRoll)
roll = (int) modTable.maxRoll;
if (randomRoll < modTable.minRoll)
randomRoll = (int) modTable.minRoll;
if (randomRoll > modTable.maxRoll)
randomRoll = (int) modTable.maxRoll;
modRow = modTable.getLootRow(roll);
modRow = modTable.getLootRow(randomRoll);
if (modRow != null) {
prefixValue = modRow.getValueOne();
@ -540,14 +480,14 @@ public class LootTable { @@ -540,14 +480,14 @@ public class LootTable {
}
}
}
}else if(chanceMod < 50){
}else if(chanceMod < 50) {
modGroup = LootTable.modGroups.get(groupRow.getValueThree());
if (modGroup != null) {
for (int a = 0;a<10;a++){
roll = ThreadLocalRandom.current().nextInt(100) + 1;
modRow = modGroup.getLootRow(roll);
randomRoll = ThreadLocalRandom.current().nextInt(100) + 1;
modRow = modGroup.getLootRow(randomRoll);
if (modRow != null)
break;
}
@ -559,19 +499,19 @@ public class LootTable { @@ -559,19 +499,19 @@ public class LootTable {
if (LootTable.modTables.containsKey(subTableID)) {
modTable = LootTable.modTables.get(subTableID);
roll = gaussianLevel((int)calculatedMobLevel);
randomRoll = gaussianLevel((int)calculatedMobLevel);
if (roll < modTable.minRoll)
roll = (int) modTable.minRoll;
if (randomRoll < modTable.minRoll)
randomRoll = (int) modTable.minRoll;
if (roll > modTable.maxRoll)
roll = (int) modTable.maxRoll;
if (randomRoll > modTable.maxRoll)
randomRoll = (int) modTable.maxRoll;
modRow = modTable.getLootRow(roll);
modRow = modTable.getLootRow(randomRoll);
if (modRow == null){
if (modRow == null)
modRow = modTable.getLootRow((int) ((modTable.minRoll + modTable.maxRoll) *.05f));
}
if (modRow != null) {
suffixValue = modRow.getValueOne();
@ -586,9 +526,9 @@ public class LootTable { @@ -586,9 +526,9 @@ public class LootTable {
if (modGroup != null) {
for (int a = 0;a<10;a++){
roll = ThreadLocalRandom.current().nextInt(100) + 1;
modRow = modGroup.getLootRow(roll);
for (int a = 0;a<10;a++) {
randomRoll = ThreadLocalRandom.current().nextInt(100) + 1;
modRow = modGroup.getLootRow(randomRoll);
if (modRow != null)
break;
}
@ -601,21 +541,18 @@ public class LootTable { @@ -601,21 +541,18 @@ public class LootTable {
modTable = LootTable.modTables.get(subTableID);
roll = gaussianLevel((int)calculatedMobLevel);
if (roll < modTable.minRoll)
roll = (int) modTable.minRoll;
if (roll > modTable.maxRoll)
roll = (int) modTable.maxRoll;
randomRoll = gaussianLevel((int)calculatedMobLevel);
if (randomRoll < modTable.minRoll)
randomRoll = (int) modTable.minRoll;
if (randomRoll > modTable.maxRoll)
randomRoll = (int) modTable.maxRoll;
modRow = modTable.getLootRow(roll);
modRow = modTable.getLootRow(randomRoll);
if (modRow == null){
if (modRow == null)
modRow = modTable.getLootRow((int) ((modTable.minRoll + modTable.maxRoll) *.05f));
}
if (modRow != null) {
prefixValue = modRow.getValueOne();
@ -631,8 +568,8 @@ public class LootTable { @@ -631,8 +568,8 @@ public class LootTable {
if (modGroup != null) {
for (int a = 0;a<10;a++){
roll = ThreadLocalRandom.current().nextInt(100) + 1;
modRow = modGroup.getLootRow(roll);
randomRoll = ThreadLocalRandom.current().nextInt(100) + 1;
modRow = modGroup.getLootRow(randomRoll);
if (modRow != null)
break;
}
@ -644,19 +581,18 @@ public class LootTable { @@ -644,19 +581,18 @@ public class LootTable {
if (LootTable.modTables.containsKey(subTableID)) {
modTable = LootTable.modTables.get(subTableID);
roll = gaussianLevel((int)calculatedMobLevel);
randomRoll = gaussianLevel((int)calculatedMobLevel);
if (roll < modTable.minRoll)
roll = (int) modTable.minRoll;
if (randomRoll < modTable.minRoll)
randomRoll = (int) modTable.minRoll;
if (roll > modTable.maxRoll)
roll = (int) modTable.maxRoll;
if (randomRoll > modTable.maxRoll)
randomRoll = (int) modTable.maxRoll;
modRow = modTable.getLootRow(roll);
modRow = modTable.getLootRow(randomRoll);
if (modRow == null){
if (modRow == null)
modRow = modTable.getLootRow((int) ((modTable.minRoll + modTable.maxRoll) *.05f));
}
if (modRow != null) {
suffixValue = modRow.getValueOne();
@ -667,7 +603,6 @@ public class LootTable { @@ -667,7 +603,6 @@ public class LootTable {
}
}
itemBase = ItemBase.getItemBase(itemBaseUUID);
if (itemBase == null)
@ -676,19 +611,6 @@ public class LootTable { @@ -676,19 +611,6 @@ public class LootTable {
//Handle logging of drops
LootTable.HandleDropLogs(itemBase);
// Handle drop rates of resources/runes/contracts.
// We intentionally drop them in half
// if ((itemBase.getMessageType() == ItemType.CONTRACT) ||
// (itemBase.getMessageType() == ItemType.RUNE) ){
// if (ThreadLocalRandom.current().nextBoolean() == false)
// continue;
// }
if (itemBase.getType() == ItemType.OFFERING)
spawnQuanity = 1;
@ -702,12 +624,11 @@ public class LootTable { @@ -702,12 +624,11 @@ public class LootTable {
if (!modifierSuffix.isEmpty())
mobLoot.addPermanentEnchantment(modifierSuffix, 0, suffixValue, false);
mobLoot.loadEnchantments();
loot.add(mobLoot);
}
}
@ -718,28 +639,18 @@ public class LootTable { @@ -718,28 +639,18 @@ public class LootTable {
int minSpawn;
int maxSpawn;
int spawnQuanity = 0;
int prefixValue = 0;
int suffixValue = 0;
int subTableID;
String modifierPrefix = "";
String modifierSuffix = "";
// Lookup Table Variables
LootTable lootTable;
LootRow lootRow;
LootTable lootGroup;
LootRow groupRow = null;
LootTable modTable;
LootTable modGroup;
LootRow modRow = null;
// Used for actual generation of items
int itemBaseUUID;
ItemBase itemBase;
MobLoot mobLoot;
Zone zone = mob.getParentZone();
// Member variable assignment
if (!LootTable.lootGroups.containsKey(lootTableID))
return;
@ -753,8 +664,6 @@ public class LootTable { @@ -753,8 +664,6 @@ public class LootTable {
int roll = 0;
for (int i = 0; i < cnt; i++) {
if (lootTableID == 1901)
groupRow = lootGroup.getLootRow(66);
else if (lootTableID == 1501)
@ -762,38 +671,25 @@ public class LootTable { @@ -762,38 +671,25 @@ public class LootTable {
else
groupRow = lootGroup.getLootRow(80);
if (groupRow == null)
return;
//get loot table for this group
if (!LootTable.lootTables.containsKey(groupRow.getValueOne()))
return;
lootTable = LootTable.lootTables.get(groupRow.getValueOne());
//get item ID //FUCK THIS RETARDED SHIT
// roll = gaussianLevel(calculatedMobLevel);
int minRoll = (int) ((calculatedMobLevel-5) * 5);
int maxRoll = (int) ((calculatedMobLevel + 15) *5);
if (minRoll < (int)lootTable.minRoll){
if (minRoll < (int)lootTable.minRoll)
minRoll = (int)lootTable.minRoll;
}
if (maxRoll < minRoll)
maxRoll = minRoll;
if (maxRoll > 320)
maxRoll = 320;
@ -809,19 +705,21 @@ public class LootTable { @@ -809,19 +705,21 @@ public class LootTable {
continue;
//handle quantities > 1 for resource drops
minSpawn = lootRow.getValueTwo();
maxSpawn = lootRow.getValueThree();
// spawnQuanity between minspawn (inclusive) and maxspawn (inclusive)
if (maxSpawn > 1)
spawnQuanity = ThreadLocalRandom.current().nextInt((maxSpawn + 1 - minSpawn)) + minSpawn;
itemBase = ItemBase.getItemBase(itemBaseUUID);
if (itemBase == null)
return;
LootTable.HandleDropLogs(itemBase);
LootTable.HandleDropLogs(itemBase);
switch (itemBase.getUUID()){
case 19290:
@ -844,8 +742,6 @@ public class LootTable { @@ -844,8 +742,6 @@ public class LootTable {
// Handle drop rates of resources/runes/contracts.
// We intentionally drop them in half
if (itemBase.getType() == ItemType.OFFERING)
spawnQuanity = 1;
@ -867,18 +763,8 @@ public class LootTable { @@ -867,18 +763,8 @@ public class LootTable {
}
return (level * 5) + ret;
// float useLevel = (float)(level + (ThreadLocalRandom.current().nextGaussian() * 5));
//
// if (useLevel < (level - 15))
// useLevel = level - 15;
// else if (useLevel > (level + 15))
// useLevel = level + 15;
// return (int)(useLevel * 5);
}
}
//This set's the drop chances for stat runes.
public static void populateStatRuneChances() {

12
src/engine/objects/Mob.java

@ -108,8 +108,6 @@ public class Mob extends AbstractIntelligenceAgent { @@ -108,8 +108,6 @@ public class Mob extends AbstractIntelligenceAgent {
private int equipmentSetID = 0;
public int runeSetID = 0;
public int bootySetID = 0;
private int lootSet = 0;
private boolean isGuard;
/**
* No Id Constructor
@ -295,8 +293,6 @@ public class Mob extends AbstractIntelligenceAgent { @@ -295,8 +293,6 @@ public class Mob extends AbstractIntelligenceAgent {
if (this.contract != null)
this.equipmentSetID = this.contract.getEquipmentSet();
this.lootSet = (rs.getInt("lootSet"));
this.nameOverride = rs.getString("mob_name");
} catch (Exception e) {
@ -2466,14 +2462,6 @@ public class Mob extends AbstractIntelligenceAgent { @@ -2466,14 +2462,6 @@ public class Mob extends AbstractIntelligenceAgent {
return equipmentSetID;
}
public int getLootSet() {
return lootSet;
}
public boolean isGuard() {
return this.isGuard;
}
public String getNameOverride() {
return nameOverride;
}

77
src/engine/objects/SpecialLoot.java

@ -1,77 +0,0 @@ @@ -1,77 +0,0 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.objects;
import engine.gameManager.DbManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
public class SpecialLoot extends AbstractGameObject {
private int itemID;
private int dropChance;
private boolean dropOnDeath;
private boolean noSteal;
private int lootSetID;
public static HashMap<Integer,ArrayList<SpecialLoot>> LootMap = new HashMap<>();
/**
* ResultSet Constructor
*/
public SpecialLoot(ResultSet rs) throws SQLException {
super(rs);
this.itemID = rs.getInt("itemID");
this.dropChance = rs.getInt("dropChance");
this.dropOnDeath = rs.getBoolean("dropOnDeath");
this.noSteal = rs.getBoolean("noSteal");
}
public SpecialLoot(ResultSet rs,boolean specialLoot) throws SQLException {
super(rs);
this.lootSetID = rs.getInt("lootSet");
this.itemID = rs.getInt("itemID");
this.dropChance = rs.getInt("dropChance");
this.dropOnDeath = false;
this.noSteal = true;
}
/*
* Getters
*/
public int getItemID() {
return this.itemID;
}
public int getDropChance() {
return this.dropChance;
}
public boolean dropOnDeath() {
return this.dropOnDeath;
}
public boolean noSteal() {
return this.noSteal;
}
public static ArrayList<SpecialLoot> getSpecialLoot(int mobbaseID) {
return DbManager.SpecialLootQueries.GET_SPECIALLOOT(mobbaseID);
}
@Override
public void updateDatabase() {
}
}

3
src/engine/server/world/WorldServer.java

@ -344,9 +344,6 @@ public class WorldServer { @@ -344,9 +344,6 @@ public class WorldServer {
Blueprint.loadAllDoorNumbers();
Blueprint.loadAllBlueprints();
Logger.info("Loading Special Loot For Mobs");
DbManager.SpecialLootQueries.GenerateSpecialLoot();
Logger.info("Initializing Heightmap data");
HeightMap.loadAlHeightMaps();

Loading…
Cancel
Save