forked from MagicBane/Server
MagicBot
1 year ago
6 changed files with 19 additions and 445 deletions
@ -1,132 +0,0 @@ |
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds; |
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd; |
|
||||||
import engine.objects.AbstractGameObject; |
|
||||||
import engine.objects.ItemBase; |
|
||||||
import engine.objects.LootTable; |
|
||||||
import engine.objects.PlayerCharacter; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Eighty |
|
||||||
*/ |
|
||||||
public class MBDropCmd extends AbstractDevCmd { |
|
||||||
|
|
||||||
public MBDropCmd() { |
|
||||||
super("mbdrop"); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void _doCmd(PlayerCharacter pcSender, String[] args, |
|
||||||
AbstractGameObject target) { |
|
||||||
String newline = "\r\n "; |
|
||||||
if (args.length != 1) { |
|
||||||
this.sendUsage(pcSender); |
|
||||||
this.sendHelp(pcSender); |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
String output = ""; |
|
||||||
switch (args[0].toLowerCase()) { |
|
||||||
case "clear": |
|
||||||
|
|
||||||
LootTable.contractCount = 0; |
|
||||||
LootTable.dropCount = 0; |
|
||||||
LootTable.glassCount = 0; |
|
||||||
LootTable.runeCount = 0; |
|
||||||
LootTable.rollCount = 0; |
|
||||||
LootTable.resourceCount = 0; |
|
||||||
|
|
||||||
LootTable.contractDroppedMap.clear(); |
|
||||||
LootTable.glassDroppedMap.clear(); |
|
||||||
LootTable.itemsDroppedMap.clear(); |
|
||||||
LootTable.resourceDroppedMap.clear(); |
|
||||||
LootTable.runeDroppedMap.clear(); |
|
||||||
break; |
|
||||||
case "all": |
|
||||||
output = LootTable.dropCount + " items - ITEM NAME : DROP COUNT" + newline; |
|
||||||
for (ItemBase ib : LootTable.itemsDroppedMap.keySet()) { |
|
||||||
|
|
||||||
int dropCount = LootTable.itemsDroppedMap.get(ib); |
|
||||||
output += ib.getName() + " : " + dropCount + newline; |
|
||||||
|
|
||||||
} |
|
||||||
break; |
|
||||||
case "resource": |
|
||||||
output = LootTable.resourceCount + " Resources - ITEM NAME : DROP COUNT" + newline; |
|
||||||
for (ItemBase ib : LootTable.resourceDroppedMap.keySet()) { |
|
||||||
|
|
||||||
int dropCount = LootTable.resourceDroppedMap.get(ib); |
|
||||||
output += ib.getName() + " : " + dropCount + newline; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
break; |
|
||||||
case "rune": |
|
||||||
|
|
||||||
output = LootTable.runeCount + " Runes - ITEM NAME : DROP COUNT" + newline; |
|
||||||
for (ItemBase ib : LootTable.runeDroppedMap.keySet()) { |
|
||||||
|
|
||||||
int dropCount = LootTable.runeDroppedMap.get(ib); |
|
||||||
output += ib.getName() + " : " + dropCount + newline; |
|
||||||
|
|
||||||
} |
|
||||||
break; |
|
||||||
case "contract": |
|
||||||
|
|
||||||
output = LootTable.contractCount + " Contracts - ITEM NAME : DROP COUNT" + newline; |
|
||||||
for (ItemBase ib : LootTable.contractDroppedMap.keySet()) { |
|
||||||
|
|
||||||
int dropCount = LootTable.contractDroppedMap.get(ib); |
|
||||||
output += ib.getName() + " : " + dropCount + newline; |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
break; |
|
||||||
|
|
||||||
case "glass": |
|
||||||
|
|
||||||
output = LootTable.glassCount + " Glass - ITEM NAME : DROP COUNT" + newline; |
|
||||||
for (ItemBase ib : LootTable.glassDroppedMap.keySet()) { |
|
||||||
|
|
||||||
int dropCount = LootTable.glassDroppedMap.get(ib); |
|
||||||
output += ib.getName() + " : " + dropCount + newline; |
|
||||||
} |
|
||||||
break; |
|
||||||
|
|
||||||
case "chance": |
|
||||||
float chance = (float) LootTable.dropCount / (float) LootTable.rollCount * 100; |
|
||||||
output = LootTable.dropCount + " out of " + LootTable.rollCount + " items Dropped. chance = " + chance + '%'; |
|
||||||
|
|
||||||
break; |
|
||||||
|
|
||||||
default: |
|
||||||
this.sendUsage(pcSender); |
|
||||||
this.sendHelp(pcSender); |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
this.throwbackInfo(pcSender, output); |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String _getUsageString() { |
|
||||||
return "' /mbdrop all/resource/rune/contract/glass/chance/clear"; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected String _getHelpString() { |
|
||||||
return "Lists drops for server since a reboot. All lists all items and drops. chance is the overall chance items drop from mobs on server. (not including Equipment)"; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,63 +0,0 @@ |
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.objects; |
|
||||||
|
|
||||||
public class LootRow { |
|
||||||
|
|
||||||
private int valueOne; |
|
||||||
private int valueTwo; |
|
||||||
private int valueThree; |
|
||||||
private String action; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* Generic Constructor |
|
||||||
*/ |
|
||||||
public LootRow(int valueOne, int valueTwo, int valueThree, String action) { |
|
||||||
this.valueOne = valueOne; |
|
||||||
this.valueTwo = valueTwo; |
|
||||||
this.valueThree = valueThree; |
|
||||||
this.action = action; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public int getValueOne() { |
|
||||||
return this.valueOne; |
|
||||||
} |
|
||||||
|
|
||||||
public void setValueOne(int value) { |
|
||||||
this.valueOne = value; |
|
||||||
} |
|
||||||
|
|
||||||
public int getValueTwo() { |
|
||||||
return this.valueTwo; |
|
||||||
} |
|
||||||
|
|
||||||
public void setValueTwo(int value) { |
|
||||||
this.valueTwo = value; |
|
||||||
} |
|
||||||
|
|
||||||
public int getValueThree() { |
|
||||||
return this.valueThree; |
|
||||||
} |
|
||||||
|
|
||||||
public void setValueThree(int value) { |
|
||||||
this.valueThree = value; |
|
||||||
} |
|
||||||
|
|
||||||
public String getAction() { |
|
||||||
return this.action; |
|
||||||
} |
|
||||||
|
|
||||||
public void setAction(String value) { |
|
||||||
this.action = value; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,77 +0,0 @@ |
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.objects; |
|
||||||
|
|
||||||
import engine.server.MBServerStatics; |
|
||||||
|
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.concurrent.ConcurrentHashMap; |
|
||||||
|
|
||||||
public class LootTable { |
|
||||||
private static final ConcurrentHashMap<Integer, LootTable> modTables = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
||||||
private static final ConcurrentHashMap<Integer, LootTable> modTypeTables = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
||||||
private static final ConcurrentHashMap<Integer, Integer> statRuneChances = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
||||||
public static boolean initialized = false; |
|
||||||
public static HashMap<ItemBase, Integer> itemsDroppedMap = new HashMap<>(); |
|
||||||
public static HashMap<ItemBase, Integer> resourceDroppedMap = new HashMap<>(); |
|
||||||
public static HashMap<ItemBase, Integer> runeDroppedMap = new HashMap<>(); |
|
||||||
public static HashMap<ItemBase, Integer> contractDroppedMap = new HashMap<>(); |
|
||||||
public static HashMap<ItemBase, Integer> glassDroppedMap = new HashMap<>(); |
|
||||||
public static int rollCount = 0; |
|
||||||
public static int dropCount = 0; |
|
||||||
public static int runeCount = 0; |
|
||||||
public static int contractCount = 0; |
|
||||||
public static int resourceCount = 0; |
|
||||||
public static int glassCount = 0; |
|
||||||
private final ConcurrentHashMap<Integer, LootRow> lootTable = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); |
|
||||||
public float minRoll = 320; |
|
||||||
public float maxRoll = 1; |
|
||||||
public int lootTableID = 0; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* Generic Constructor |
|
||||||
*/ |
|
||||||
public LootTable(int lootTableID) { |
|
||||||
this.lootTableID = lootTableID; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public static LootTable getModTypeTable(int UUID) { |
|
||||||
|
|
||||||
if (modTypeTables.containsKey(UUID)) |
|
||||||
return modTypeTables.get(UUID); |
|
||||||
|
|
||||||
LootTable modTable = new LootTable(UUID); |
|
||||||
modTypeTables.put(UUID, modTable); |
|
||||||
|
|
||||||
return modTable; |
|
||||||
} |
|
||||||
|
|
||||||
public static LootTable getModTable(int UUID) { |
|
||||||
|
|
||||||
if (modTables.containsKey(UUID)) |
|
||||||
return modTables.get(UUID); |
|
||||||
|
|
||||||
LootTable modTypeTable = new LootTable(UUID); |
|
||||||
modTables.put(UUID, modTypeTable); |
|
||||||
|
|
||||||
return modTypeTable; |
|
||||||
} |
|
||||||
|
|
||||||
public LootRow getLootRow(int probability) { |
|
||||||
|
|
||||||
if (lootTable.containsKey(probability)) |
|
||||||
return lootTable.get(probability); |
|
||||||
|
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
Loading…
Reference in new issue