楓之谷私服v120 當前地圖怪物掉寶查詢

照樣是搬來的,製作是彩虹工作室,但不記得從哪扒來的。

改SRC

其實應該看著NPC腳本就會知道怎麼改了...
腳本的getAllMonstersThreadsafe是原端自帶
真正要加的是getAllUniqueMonsters、checkMapDrop以及checkDrop函數

  1. 打開Sever\Maps\MapleMap.java
    在一串變數宣告下方貼上
public List<Integer> getAllUniqueMonsters() {
        ArrayList<Integer> ret = new ArrayList<>();
        mapobjectlocks.get(MapleMapObjectType.MONSTER).readLock().lock();
        try {
            for (MapleMapObject mmo : mapobjects.get(MapleMapObjectType.MONSTER).values()) {
                int theId = ((MapleMonster) mmo).getId();
                if (!ret.contains(theId)) {
                    ret.add(theId);
                }
            }
        } finally {
            mapobjectlocks.get(MapleMapObjectType.MONSTER).readLock().unlock();
        }
        return ret;
    }

    /*怪物查詢*/
    private Map<Integer, MapleMapObject> mapobjects1 = new LinkedHashMap<Integer, MapleMapObject>();

    public Collection<MapleMapObject> getMapObjects() {
        return Collections.unmodifiableCollection(mapobjects1.values());
    }

    public List<Integer> getUniqueMonsters() {
        List<Integer> mobs = new ArrayList<Integer>();
        for (MapleMapObject obj : this.getMapObjects()) {
            MapleMonster mob = this.getMonsterByOid(obj.getObjectId());
            if (mob != null) {
                if (!mobs.contains(mob.getId())) {
                    mobs.add(mob.getId());
                }
            }
        }
        return mobs;
    }
  1. 打開scripting\NPCConversationManager.java

在最下方}前貼上

public String checkDrop(int mobId) {
        MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
        List<MonsterDropEntry> ranks = MapleMonsterInformationProvider.getInstance().retrieveDrop(mobId);
        if (!ranks.isEmpty() && ranks.size() > 0) {
            int num = 0, itemId, chance;
            MonsterDropEntry de;
            StringBuilder name = new StringBuilder();
            for (MonsterDropEntry rank : ranks) {
                de = rank;
                if (de.chance > 0 && (de.questid <= 0 || (de.questid > 0 && MapleQuest.getInstance(de.questid).getName().length() > 0))) {
                    itemId = de.itemId;
                    if (itemId == 0) {
                        continue;
                    } else if (!ii.itemExists(itemId)) {
                        continue;
                    }
                    if (num == 0) {
                        name.append("當前怪物 #o").append(mobId).append("# 的掉寶率為:\r\n");
                        name.append("--------------------------------------\r\n");
                    }
                    String namez = "";
                    if (itemId == 0) { //金幣 物品ID為0就是金幣道具
                        itemId = 4031041; //休咪的錢包 display sack of cash
                        namez = (de.Minimum * getClient().getChannelServer().getMesoRate()) + " - " + (de.Maximum * getClient().getChannelServer().getMesoRate()) + " 的金幣";
                    } else {
                        namez = "#z" + itemId + "#";
                    }
                    chance = de.chance * getClient().getChannelServer().getDropRate();
                    if (getPlayer().isAdmin()) {
                        name.append(num + 1).append(") #v").append(itemId).append("#").append(namez).append(" - ").append(Integer.valueOf(chance >= 999999 ? 1000000 : chance).doubleValue() / 10000.0).append("%的掉寶率. ").append(de.questid > 0 && MapleQuest.getInstance(de.questid).getName().length() > 0 ? ("需要接受任務: " + MapleQuest.getInstance(de.questid).getName()) : "").append("\r\n");
                    } else {
                        name.append(num + 1).append(") #v").append(itemId).append("#").append(namez).append(de.questid > 0 && MapleQuest.getInstance(de.questid).getName().length() > 0 ? ("需要接受任務: " + MapleQuest.getInstance(de.questid).getName()) : "").append("\r\n");
                    }
                    num++;
                }
            }
            if (name.length() > 0) {
                return name.toString();
            }
        }
        return "沒有找到這個怪物的掉寶率數據。";
    }

     public String checkMapDrop() {
        List<MonsterGlobalDropEntry> ranks = new ArrayList<>(MapleMonsterInformationProvider.getInstance().getGlobalDrop());
        int mapid = getPlayer().getMap().getId();
//        int cashServerRate = getClient().getChannelServer().getCashRate(); //點卷掉寶率
        //int globalServerRate = getClient().getChannelServer().getDropgRate(); //特殊數據庫道具掉寶率
        int globalServerRate = 1; //特殊數據庫道具掉寶率
        if (ranks != null && ranks.size() > 0) {
            int num = 0, itemId, chance;
            MonsterGlobalDropEntry de;
            StringBuilder name = new StringBuilder();
            for (MonsterGlobalDropEntry rank : ranks) {
                de = rank;
                if (de.continent < 0 || (de.continent < 10 && mapid / 100000000 == de.continent) || (de.continent < 100 && mapid / 10000000 == de.continent) || (de.continent < 1000 && mapid / 1000000 == de.continent)) {
                    itemId = de.itemId;
                    if (num == 0) {
                        name.append("當前地圖 #r").append(mapid).append("#k - #m").append(mapid).append("# 的全局掉寶率為:");
                        name.append("\r\n--------------------------------------\r\n");
                    }
                    String names = "#z" + itemId + "#";
//                    if (itemId == 0 && cashServerRate != 0) {
//                        itemId = 4031041;
//                        names = (de.minimum * cashServerRate) + " - " + (de.maximum * cashServerRate) + " 的抵用卷";
//                    }
                    chance = de.chance * globalServerRate;
                    if (getPlayer().isAdmin()) {
                        name.append(num + 1).append(") #v").append(itemId).append("#").append(names).append(" - ").append(Integer.valueOf(chance >= 999999 ? 1000000 : chance).doubleValue() / 10000.0).append("%的掉寶率. ").append(de.questid > 0 && MapleQuest.getInstance(de.questid).getName().length() > 0 ? ("需要接受任務: " + MapleQuest.getInstance(de.questid).getName()) : "").append("\r\n");
                    } else {
                        name.append(num + 1).append(") #v").append(itemId).append("#").append(names).append(de.questid > 0 && MapleQuest.getInstance(de.questid).getName().length() > 0 ? ("需要接受任務: " + MapleQuest.getInstance(de.questid).getName()) : "").append("\r\n");
                    }
                    num++;
                }
            }
            if (name.length() > 0) {
                return name.toString();
            }
        }
        return "當前地圖沒有設置全局掉寶率。";
    }

NPC腳本

隨便塞給一個NPC就行

/*
	製作:彩虹工作室
	功能:查看地圖怪物爆率
	時間:2016年12月23日
*/

var status = -1;

function action(mode, type, selection) {
    if (mode == 1) {
        status++;
    } else {
        if (status == 0) {
            cm.dispose();
        }
        status--;
    }
    if (status == 0) {
        if (cm.getMap().getAllMonstersThreadsafe().size() <= 0) {
            cm.sendOk("當前地圖沒有刷新怪物,無法查看怪物掉寶資訊。");
            cm.dispose();
            return;
        }
        var selStr = "請選擇你要查看怪物的掉寶資訊。\r\n\r\n#b";
        var iz = cm.getMap().getAllUniqueMonsters().iterator();
        while (iz.hasNext()) {
            var zz = iz.next();
            selStr += "#L" + zz + "##o" + zz + "##l\r\n";
        }
        if (cm.getPlayer().isAdmin()) {
            selStr += "\r\n#L0# #r查看全地圖掉寶資訊#k#l";
        }
        cm.sendSimple(selStr);
    } else if (status == 1) {
        if (selection == 0) {
            cm.sendNext(cm.checkMapDrop());
        } else {
             cm.sendOk(cm.checkDrop(selection));
        }
        cm.dispose();
    }
}