Rename and clean up MapleMonsterInformationProvider

This commit is contained in:
P0nk
2021-09-09 22:06:55 +02:00
parent 02786eab63
commit 2acf2ed83d
14 changed files with 34 additions and 34 deletions

View File

@@ -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();

View File

@@ -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 + ", ";
}

View File

@@ -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");
}
}