Rename and clean up MapleMonsterInformationProvider
This commit is contained in:
@@ -27,8 +27,8 @@ import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.life.MapleMonsterInformationProvider;
|
||||
import server.life.MonsterDropEntry;
|
||||
import server.life.MonsterInformationProvider;
|
||||
import tools.Pair;
|
||||
|
||||
import java.util.Iterator;
|
||||
@@ -48,20 +48,20 @@ public class WhatDropsFromCommand extends Command {
|
||||
String monsterName = player.getLastCommandMessage();
|
||||
String output = "";
|
||||
int limit = 3;
|
||||
Iterator<Pair<Integer, String>> listIterator = MapleMonsterInformationProvider.getMobsIDsFromName(monsterName).iterator();
|
||||
Iterator<Pair<Integer, String>> listIterator = MonsterInformationProvider.getMobsIDsFromName(monsterName).iterator();
|
||||
for (int i = 0; i < limit; i++) {
|
||||
if(listIterator.hasNext()) {
|
||||
Pair<Integer, String> data = listIterator.next();
|
||||
int mobId = data.getLeft();
|
||||
String mobName = data.getRight();
|
||||
output += mobName + " drops the following items:\r\n\r\n";
|
||||
for (MonsterDropEntry drop : MapleMonsterInformationProvider.getInstance().retrieveDrop(mobId)){
|
||||
for (MonsterDropEntry drop : MonsterInformationProvider.getInstance().retrieveDrop(mobId)){
|
||||
try {
|
||||
String name = MapleItemInformationProvider.getInstance().getName(drop.itemId);
|
||||
if (name == null || name.equals("null") || drop.chance == 0){
|
||||
continue;
|
||||
}
|
||||
float chance = Math.max(1000000 / drop.chance / (!MapleMonsterInformationProvider.getInstance().isBoss(mobId) ? player.getDropRate() : player.getBossDropRate()), 1);
|
||||
float chance = Math.max(1000000 / drop.chance / (!MonsterInformationProvider.getInstance().isBoss(mobId) ? player.getDropRate() : player.getBossDropRate()), 1);
|
||||
output += "- " + name + " (1/" + (int) chance + ")\r\n";
|
||||
} catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
|
||||
@@ -27,7 +27,7 @@ import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.life.MapleMonsterInformationProvider;
|
||||
import server.life.MonsterInformationProvider;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.Pair;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class WhoDropsCommand extends Command {
|
||||
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
String resultName = MapleMonsterInformationProvider.getInstance().getMobNameFromId(rs.getInt("dropperid"));
|
||||
String resultName = MonsterInformationProvider.getInstance().getMobNameFromId(rs.getInt("dropperid"));
|
||||
if (resultName != null) {
|
||||
output += resultName + ", ";
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ package client.command.commands.gm3;
|
||||
import client.Character;
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import server.life.MapleMonsterInformationProvider;
|
||||
import server.life.MonsterInformationProvider;
|
||||
|
||||
public class ReloadDropsCommand extends Command {
|
||||
{
|
||||
@@ -36,7 +36,7 @@ public class ReloadDropsCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
MapleMonsterInformationProvider.getInstance().clearDrops();
|
||||
MonsterInformationProvider.getInstance().clearDrops();
|
||||
player.dropMessage(5, "Reloaded Drops");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user