Dropitems Command to make items not drop from mobs, only mesos?

Results 1 to 12 of 12
  1. #1
    TranquilityStory JarrYD is offline
    Grand MasterRank
    Jan 2010 Join Date
    764Posts

    Dropitems Command to make items not drop from mobs, only mesos?

    So how would I make a command that a character can toggle on an off and when it is toggled on, items from bosses etc. wont drop for you. But mesos will still drop.
    Was thinking of somehow adding an exception to the bossdrops table maybe?
    This is for v55 btw, and heres my dropfrommonster from maplemap:

    Code:
    private void dropFromMonster(MapleCharacter dropOwner, MapleMonster monster) {
            if (dropsDisabled || (ChannelServer.getInstance(channel).getBossDropRate() <= 0)) {
                int card = dropOwner.getDropMod();
                return;
            }
            int maxDrops;
            MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
            final boolean isBoss = monster.isBoss();
            if (isBoss) {
                maxDrops = 8 * ChannelServer.getInstance(channel).getBossDropRate();
            } else {
                maxDrops = 8 * ChannelServer.getInstance(channel).getBossDropRate();
            }
    
            List<Integer> toDrop = new ArrayList<Integer>();
            if (monster.getId() == 9500167) {
        Random randomInt = new Random();
        int chance = randomInt.nextInt(10000);
        if (chance <= 10) { // 0.1%
            toDrop.add(4001013); // ItemID
        }
    }  
            for (int i = 0; i < maxDrops; i++) {
                toDrop.add(monster.getDrop());
            }
    
            Set<Integer> alreadyDropped = new HashSet<Integer>();
            for (int i = 0; i < toDrop.size(); i++) {
                if (toDrop.get(i) == -1) {
                    if (alreadyDropped.contains(-1) && !isBoss) {
                        toDrop.remove(i);
                        i--;
                    } else {
                        alreadyDropped.add(-1);
                    }
                } else {
                    MapleInventoryType type = ii.getInventoryType(toDrop.get(i));
                    if (alreadyDropped.contains((int) type.getType()) && !isBoss) {
                        toDrop.remove(i);
                        i--;
                    } else {
                        alreadyDropped.add((int) type.getType());
                    }
                }
            }
    
            if (toDrop.size() > maxDrops) {
                toDrop = toDrop.subList(0, maxDrops);
            }
            Point[] toPoint = new Point[toDrop.size()];
            int shiftDirection = 0;
            int shiftCount = 0;
    
            int curX = Math.min(Math.max(monster.getPosition().x - 25 * (toDrop.size() / 2), footholds.getMinDropX() + 25), footholds.getMaxDropX() - toDrop.size() * 25);
            int curY = Math.max(monster.getPosition().y, footholds.getY1());
            //int monsterShift = curX -
            while (shiftDirection < 3 && shiftCount < 1000) {
                // TODO for real center drop the monster width is needed o.o"
                if (shiftDirection == 1) {
                    curX += 25;
                } else if (shiftDirection == 2) {
                    curX -= 25;
                }
                // now do it
                for (int i = 0; i < toDrop.size(); i++) {
                    MapleFoothold wall = footholds.findWall(new Point(curX, curY), new Point(curX + toDrop.size() * 25, curY));
                    if (wall != null) {
                        //System.out.println("found a wall. wallX " + wall.getX1() + " curX " + curX);
                        if (wall.getX1() < curX) {
                            shiftDirection = 1;
                            shiftCount++;
                            break;
                        } else if (wall.getX1() == curX) {
                            if (shiftDirection == 0) {
                                shiftDirection = 1;
                            }
                            shiftCount++;
                            break;
                        } else {
                            shiftDirection = 2;
                            shiftCount++;
                            break;
                        }
                    } else if (i == toDrop.size() - 1) {
                        //System.out.println("ok " + curX);
                        shiftDirection = 3;
                    }
                    final Point dropPos = calcDropPos(new Point(curX + i * 25, curY), new Point(monster.getPosition()));
                    toPoint[i] = new Point(curX + i * 25, curY);
                    final int drop = toDrop.get(i);
    
                    if (drop == -1) { // meso
                        final int mesoRate = ChannelServer.getInstance(dropOwner.getClient().getChannel()).getMesoRate();
                        Random r = new Random();
                        double mesoDecrease = Math.pow(0.93, monster.getExp() / 300.0);
                        if (mesoDecrease > 1.0) {
                            mesoDecrease = 1.0;
                        } else if (mesoDecrease < 0.001) {
                            mesoDecrease = 0.005;
                        }
                        int tempmeso = Math.min(30000, (int) (mesoDecrease * (monster.getExp()) *
                                (1.0 + r.nextInt(20)) / 10.0));
                        if (dropOwner.getBuffedValue(MapleBuffStat.MESOUP) != null) {
                            tempmeso = (int) (tempmeso * dropOwner.getBuffedValue(MapleBuffStat.MESOUP).doubleValue() / 100.0);
                        }
    
                        final int meso = tempmeso;
    
                        if (meso > 0) {
                            final MapleMonster dropMonster = monster;
                            final MapleCharacter dropChar = dropOwner;
                            TimerManager.getInstance().schedule(new Runnable() {
    
                                public void run() {
                                    spawnMesoDrop(meso * mesoRate, meso, dropPos, dropMonster, dropChar, isBoss);
                                }
                            }, monster.getAnimationTime("die1"));
                        }
                    } else {
                        IItem idrop;
                        MapleInventoryType type = ii.getInventoryType(drop);
                        if (type.equals(MapleInventoryType.EQUIP)) {
                            Equip nEquip = ii.randomizeStats((Equip) ii.getEquipById(drop));
                            idrop = nEquip;
                        } else {
                            idrop = new Item(drop, (byte) 0, (short) 1);
                            // Randomize quantity for certain items
                            if (ii.isArrowForBow(drop) || ii.isArrowForCrossBow(drop) || ii.isThrowingStar(drop)) {
                                idrop.setQuantity((short) (1 + ii.getSlotMax(drop) * Math.random()));
                            }
                        }
    
                        StringBuilder logMsg = new StringBuilder("Created as a drop from monster ");
                        logMsg.append(monster.getObjectId());
                        logMsg.append(" (");
                        logMsg.append(monster.getId());
                        logMsg.append(") at ");
                        logMsg.append(dropPos.toString());
                        logMsg.append(" on map ");
                        logMsg.append(mapid);
                        idrop.log(logMsg.toString(), false);
    
                        final MapleMapItem mdrop = new MapleMapItem(idrop, dropPos, monster, dropOwner);
                        final MapleMapObject dropMonster = monster;
                        final MapleCharacter dropChar = dropOwner;
                        final TimerManager tMan = TimerManager.getInstance();
    
                        activateItemReactors(mdrop);
                        tMan.schedule(new Runnable() {
    
                            public void run() {
                                spawnAndAddRangedMapObject(mdrop, new DelayedPacketCreation() {
    
                                    public void sendPackets(MapleClient c) {
                                        c.getSession().write(MaplePacketCreator.dropItemFromMapObject(drop, mdrop.getObjectId(), dropMonster.getObjectId(), isBoss ? 0 : dropChar.getId(), dropMonster.getPosition(), dropPos, (byte) 1));
                                    }
                                });
    
                                tMan.schedule(new ExpireMapItemJob(mdrop), 60000);
                            }
                        }, monster.getAnimationTime("die1"));
    
                    }
                }
            }
        }
    So would I make a dropitems is on check and then if it is just return; or?
    Last edited by JarrYD; 19-04-13 at 08:05 AM.


  2. #2
    Grand Master AristoCat is offline
    Grand MasterRank
    Apr 2012 Join Date
    947Posts

    Re: Dropitems Command to make items not drop from mobs, only mesos?

    Create a boolean for each character and add a check on item drop packet.

  3. #3
    TranquilityStory JarrYD is offline
    Grand MasterRank
    Jan 2010 Join Date
    764Posts

    Re: Dropitems Command to make items not drop from mobs, only mesos?

    Hmmm still need help

  4. #4
    TranquilityStory JarrYD is offline
    Grand MasterRank
    Jan 2010 Join Date
    764Posts

    Re: Dropitems Command to make items not drop from mobs, only mesos?

    Still need help, was thinking a player command like this that only sets the players drop rate to 0
    Code:
    } else if (splitted[0].equals("@droprate")) {
    
                    
                        cserv.setDropRate(0);
    }

  5. #5
    Elite Member funnylord is offline
    Member +Rank
    Apr 2010 Join Date
    190Posts

    Re: Dropitems Command to make items not drop from mobs, only mesos?

    better off doing something that togglesdrops on all maps.

  6. #6
    Grand Master sunnyboy is offline
    Grand MasterRank
    Mar 2010 Join Date
    6,108Posts

    Re: Dropitems Command to make items not drop from mobs, only mesos?

    If you set drop rate to 0, nothing would technically drop including mesos.

  7. #7
    Member Splend is offline
    MemberRank
    Jan 2013 Join Date
    Great BritishLocation
    48Posts

    Re: Dropitems Command to make items not drop from mobs, only mesos?

    Go to the MapleMap and find the spawnDrop function that drops the item in the map.
    and add an if check.
    Something like this:
    Code:
    if (cserv.DropItem()) {
             spawnDrop(iItem, calcDropPos(pos, mob.getPosition()), mob, player, (byte) 1);
    }

  8. #8
    TranquilityStory JarrYD is offline
    Grand MasterRank
    Jan 2010 Join Date
    764Posts

    Re: Dropitems Command to make items not drop from mobs, only mesos?

    Quote Originally Posted by Splend View Post
    Go to the MapleMap and find the spawnDrop function that drops the item in the map.
    and add an if check.
    Something like this:
    Code:
    if (cserv.DropItem()) {
             spawnDrop(iItem, calcDropPos(pos, mob.getPosition()), mob, player, (byte) 1);
    }
    Yeah I need to do something like that and then add a toggle for it. That didn't work for me though.
    Last edited by JarrYD; 18-04-13 at 04:53 PM.

  9. #9
    TranquilityStory JarrYD is offline
    Grand MasterRank
    Jan 2010 Join Date
    764Posts

    Re: Dropitems Command to make items not drop from mobs, only mesos?

    Bump~

  10. #10
    TranquilityStory JarrYD is offline
    Grand MasterRank
    Jan 2010 Join Date
    764Posts

    Re: Dropitems Command to make items not drop from mobs, only mesos?

    updated thread

  11. #11
    Grand Master royalmonky is offline
    Grand MasterRank
    Jun 2011 Join Date
    648Posts

    Re: Dropitems Command to make items not drop from mobs, only mesos?

    Quote Originally Posted by JarrYD View Post
    updated thread
    I already coded that on my v83 source just leech it from there.

  12. #12
    TranquilityStory JarrYD is offline
    Grand MasterRank
    Jan 2010 Join Date
    764Posts

    Re: Dropitems Command to make items not drop from mobs, only mesos?

    Quote Originally Posted by royalmonky View Post
    I already coded that on my v83 source just leech it from there.
    Oh yeah thats right, we had nodrops coded. Derp.
    Last edited by JarrYD; 20-04-13 at 06:46 AM.



Advertisement