Browse Source

drop rate work

lakebane-master
FatBoy-DOTC 10 months ago
parent
commit
6023022077
  1. 20
      src/engine/devcmd/cmds/SimulateBootyCmd.java
  2. 32
      src/engine/gameManager/LootManager.java

20
src/engine/devcmd/cmds/SimulateBootyCmd.java

@ -1,10 +1,12 @@
package engine.devcmd.cmds; package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.LootManager; import engine.gameManager.LootManager;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.loot.BootySetEntry; import engine.loot.BootySetEntry;
import engine.objects.*; import engine.objects.*;
import org.pmw.tinylog.Logger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
@ -26,7 +28,9 @@ public class SimulateBootyCmd extends AbstractDevCmd {
String output; String output;
output = "Booty Simulation:" + newline; output = "Booty Simulation:" + newline;
if(target.getObjectType().equals(Enum.GameObjectType.Mob) == false){
return;//ugh what?
}
Mob mob = (Mob) target; Mob mob = (Mob) target;
output += "Name: " + mob.getName() + newline; output += "Name: " + mob.getName() + newline;
output += "Special Loot:" + newline; output += "Special Loot:" + newline;
@ -51,7 +55,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
int failures = 0; int failures = 0;
int goldAmount = 0; int goldAmount = 0;
for (int i = 0; i < 10000; ++i) { for (int i = 0; i < 1000; ++i) {
try { try {
mob.loadInventory(); mob.loadInventory();
@ -85,6 +89,9 @@ public class SimulateBootyCmd extends AbstractDevCmd {
} }
} catch (Exception ex) { } catch (Exception ex) {
failures++; failures++;
//throwbackError(playerCharacter,ex.getLocalizedMessage());
//Logger.error(ex.fillInStackTrace());
//return;
} }
if (mob.getEquip() != null) { if (mob.getEquip() != null) {
for (MobEquipment me : mob.getEquip().values()) { for (MobEquipment me : mob.getEquip().values()) {
@ -131,8 +138,17 @@ public class SimulateBootyCmd extends AbstractDevCmd {
} }
output += "GLASS DROPS: " + GlassItems.size() + newline; output += "GLASS DROPS: " + GlassItems.size() + newline;
for(Item glass : GlassItems){
output += " " + glass.getName() + newline;
}
output += "RUNE DROPS: " + Runes.size() + newline; output += "RUNE DROPS: " + Runes.size() + newline;
for(Item rune : Runes){
output += " " + rune.getName() + newline;
}
output += "CONTRACTS DROPS: " + Contracts.size() + newline; output += "CONTRACTS DROPS: " + Contracts.size() + newline;
for(Item contract : Contracts){
output += " " + contract.getName() + newline;
}
output += "RESOURCE DROPS: " + Resources.size() + newline; output += "RESOURCE DROPS: " + Resources.size() + newline;
output += "OFFERINGS DROPPED: " + Offerings.size() + newline; output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline; output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;

32
src/engine/gameManager/LootManager.java

@ -116,10 +116,18 @@ public enum LootManager {
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob) { private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob) {
float dropRate = NORMAL_DROP_RATE; float dropRate = NORMAL_DROP_RATE;
//roll the geenric world drop table
GenerateLootDrop(mob, 1300);
if(ThreadLocalRandom.current().nextInt(1, 10000) == 5000) {
MobLoot extraLoot = rollForGlass(mob);
if (extraLoot != null) {
mob.getCharItemManager().addItemToInventory(extraLoot);
}
}
// Iterate all entries in this bootySet and process accordingly // Iterate all entries in this bootySet and process accordingly
boolean hasExtraRolled = false;
for (BootySetEntry bse : entries) { for (BootySetEntry bse : entries) {
switch (bse.bootyType) { switch (bse.bootyType) {
case "GOLD": case "GOLD":
GenerateGoldDrop(mob, bse); GenerateGoldDrop(mob, bse);
@ -128,7 +136,7 @@ public enum LootManager {
if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate)) if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate))
GenerateLootDrop(mob, bse.genTable); //generate normal loot drop GenerateLootDrop(mob, bse.genTable); //generate normal loot drop
if(mob.parentZone.getSafeZone() == 0) { if(mob.parentZone.getSafeZone() == 0) {
if (ThreadLocalRandom.current().nextInt(1, 10000) < 10) { if (hasExtraRolled == false && ThreadLocalRandom.current().nextInt(1, 10000) < 5 * dropRate) {
int roll = ThreadLocalRandom.current().nextInt(1, 101); int roll = ThreadLocalRandom.current().nextInt(1, 101);
MobLoot extraLoot = null; MobLoot extraLoot = null;
if (roll >= 1 && roll <= 50) { if (roll >= 1 && roll <= 50) {
@ -137,12 +145,13 @@ public enum LootManager {
if (roll >= 51 && roll <= 94) { if (roll >= 51 && roll <= 94) {
extraLoot = rollForRune(bse.genTable, mob); extraLoot = rollForRune(bse.genTable, mob);
} }
if (roll >= 95) { //if (roll >= 95) {
extraLoot = rollForGlass(mob); // extraLoot = rollForGlass(mob);
} //}
if (extraLoot != null) { if (extraLoot != null) {
mob.getCharItemManager().addItemToInventory(extraLoot); mob.getCharItemManager().addItemToInventory(extraLoot);
} }
hasExtraRolled = true;
} }
} }
break; break;
@ -492,7 +501,10 @@ public enum LootManager {
} }
public static MobLoot rollForContract(int table, Mob mob){ public static MobLoot rollForContract(int table, Mob mob){
GenTableEntry selectedRow = GenTableEntry.rollTable(table, 99, 1.0f); int roll = 99;
if (table == 1900 || table == 1500)
roll = 73;
GenTableEntry selectedRow = GenTableEntry.rollTable(table, roll, 1.0f);
if (selectedRow == null) if (selectedRow == null)
return null; return null;
@ -515,7 +527,11 @@ public enum LootManager {
return null; return null;
} }
public static MobLoot rollForRune(int table, Mob mob){ public static MobLoot rollForRune(int table, Mob mob){
GenTableEntry selectedRow = GenTableEntry.rollTable(table, 97, 1.0f); int roll = 97;
if(table == 1900 || table == 1500){
roll = 77;
}
GenTableEntry selectedRow = GenTableEntry.rollTable(table, roll, 1.0f);
if (selectedRow == null) if (selectedRow == null)
return null; return null;

Loading…
Cancel
Save