[Add-On] Clear drops after a kill / certain amount of items is reached.

Results 1 to 17 of 17
  1. #1
    Grand Master Sparrow is offline
    Grand MasterRank
    Mar 2009 Join Date
    SydneyLocation
    2,951Posts

    [Add-On] Clear drops after a kill / certain amount of items is reached.

    So I've recieved a couple PMs on how to clear the drops of a map when a certain amount of mobs die, or how do I make the FM mobs die if you're the last to leave. Since people are retarded here you go;

    (Assuming you use Moople)

    Clear drops after certain amount of deaths;
    Spoiler:


    Add:
    MapleMap.java
    Spoiler:

    PHP Code:
    private int MonstersKilled 0


    Look for;
    MapleMap.java
    Spoiler:

    PHP Code:
    killMonster(monsterchrtrue);
    monster.empty();
    nullifyObject(monster); 


    Replace with:
    MapleMap.java
    Spoiler:

    PHP Code:
    killMonster(monsterchrtrue);
                    
    MonstersKilled++;
                    
    //System.out.println(MonstersKilled);
                    
    if (MonstersKilled == 500) {
                        
    MonstersKilled 0;
                        
    clearDrops(chr);
                        
    chr.dropMessage("[Map] - Drops have been cleared.");
                    } 



    Kill FM Mobs if you're last to leave;
    Spoiler:

    Find;
    ChangeMapHandler.Java
    Spoiler:

    PHP Code:
     if (portal != null) {
                        
    portal.enterPortal(c);
                    } else {
                        
    c.announce(MaplePacketCreator.enableActions());
                    }
                    
    chr.setRates(); 


    Replace with;
    ChangeMapHandler.Java
    Spoiler:

    PHP Code:
    if (portal.getTargetMapId() == 910000000 && c.getPlayer().getMap().getAllPlayer().size() <= 1) {
                        
    c.getPlayer().getMap().killAllMonsters();
                        
    c.getPlayer().getMap().clearDrops();   
                    }
                    
                    if (
    portal != null) {
                        
    portal.enterPortal(c);
                    } else {
                        
    c.announce(MaplePacketCreator.enableActions());
                    } 



    Clear drops after certain amount of items is reached;
    Spoiler:

    Look for;
    MapleMap.java
    Spoiler:

    PHP Code:
    killMonster(monsterchrtrue);
    monster.empty();
    nullifyObject(monster); 


    Replace with:
    MapleMap.java
    Spoiler:

    PHP Code:
    killMonster(monsterchrtrue);
     List<
    MapleMapObjectitems chr.getMap().getMapObjectsInRange(chr.getPosition(), Double.POSITIVE_INFINITYArrays.asList(MapleMapObjectType.ITEM));
                if (
    items.size() >= 500) {
                     for (
    MapleMapObject i items) {
                
    chr.getMap().removeMapObject(i);
                
    chr.getMap().broadcastMessage(MaplePacketCreator.removeItemFromMap(i.getObjectId(), 0chr.getId()));
                     }    
                     
    chr.dropMessage("[Map] - 500 drops on map reached. Drops cleared.");
                }

     
    monster.empty();
                
    nullifyObject(monster); 


    Peace.
    Last edited by Sparrow; 14-02-12 at 06:08 AM.


  2. #2
    Grand Master Soulfist is offline
    Grand MasterRank
    Dec 2010 Join Date
    a hovelLocation
    1,835Posts

    Re: Monster killing (Can't explain)

    Lol daniel, people seriously don't know how to do this? Help section much? Hopefully what people gain out of this release is knowledge and not free code...
    Posted via Mobile Device

  3. #3
    Grand Master Sparrow is offline
    Grand MasterRank
    Mar 2009 Join Date
    SydneyLocation
    2,951Posts

    Re: Monster killing (Can't explain)

    Yeah I'll show you my PMs :P

  4. #4
    Can't kilean the zilean Darksta is offline
    Grand MasterRank
    Oct 2010 Join Date
    Down undah mateLocation
    1,582Posts

    Re: Monster killing (Can't explain)

    oh Jandey you sxc beast

    I like the title of the post. xD

    nicework ;)

  5. #5
    Grand Master Sparrow is offline
    Grand MasterRank
    Mar 2009 Join Date
    SydneyLocation
    2,951Posts

    Re: Monster killing (Can't explain)

    Quote Originally Posted by GossipGoat View Post
    oh Jandey you sxc beast

    I like the title of the post. xD

    nicework ;)
    That isn't work :L

  6. #6
    Grand Master StripedCow is offline
    Grand MasterRank
    Jun 2011 Join Date
    813Posts

    Re: Monster killing (Can't explain)

    Surprised people haven't found out about this yet, nice. I have a better fix for drops though, drops clear after a certain amount on floor.

  7. #7
    Grand Master Sparrow is offline
    Grand MasterRank
    Mar 2009 Join Date
    SydneyLocation
    2,951Posts

    Re: Monster killing (Can't explain)

    Quote Originally Posted by StripedCow View Post
    Surprised people haven't found out about this yet, nice. I have a better fix for drops though, drops clear after a certain amount on floor.
    Want to contribute to the thread? :L Nice idea though.

  8. #8
    Newbie Jiuolo is offline
    MemberRank
    Feb 2012 Join Date
    23Posts

    Re: Monster killing (Can't explain)

    Quote Originally Posted by Soulfist View Post
    Lol daniel, people seriously don't know how to do this? Help section much? Hopefully what people gain out of this release is knowledge and not free code...
    Posted via Mobile Device
    I hope that is what I get from this code.
    but what I dont really get is how those who write those things know how to call each things they want.

    for example how did you (op) know how to get the number of items in the map and how to express it in code.

    Is there a way to know such things when I need to find somthing like that?

  9. #9
    Grand Master Sparrow is offline
    Grand MasterRank
    Mar 2009 Join Date
    SydneyLocation
    2,951Posts

    Re: Monster killing (Can't explain)

    Easy, I based it off the clear drops function which finds and adds every item on the map to a list..

  10. #10
    Sorcerer Supreme Yaseen is offline
    Member +Rank
    Nov 2011 Join Date
    /index.phpLocation
    430Posts

    Re: Monster killing (Can't explain)

    Congrats on Mod, Sparrow.

  11. #11
    Grand Master Veda is offline
    Grand MasterRank
    Mar 2011 Join Date
    808Posts

    Re: Monster killing (Can't explain)

    Easy code, but I did get like 2 pms after you posted this asking me how to make this. People these days.

    Oh, check your "Clear drops after certain amount of items is reached" stuff. There's something wrong.

  12. #12
    Grand Master Sparrow is offline
    Grand MasterRank
    Mar 2009 Join Date
    SydneyLocation
    2,951Posts

    Re: Monster killing (Can't explain)

    Quote Originally Posted by Veda View Post
    Easy code, but I did get like 2 pms after you posted this asking me how to make this. People these days.

    Oh, check your "Clear drops after certain amount of items is reached" stuff. There's something wrong.
    Is it that the dropMessage says 20 instead of 500? :P If so I was too lazy to change it.

  13. #13
    Grand Master Veda is offline
    Grand MasterRank
    Mar 2011 Join Date
    808Posts

    Re: Monster killing (Can't explain)

    Quote Originally Posted by Sparrow View Post
    Is it that the dropMessage says 20 instead of 500? :P If so I was too lazy to change it.
    You removed killMonster O.o

  14. #14
    Grand Master Sparrow is offline
    Grand MasterRank
    Mar 2009 Join Date
    SydneyLocation
    2,951Posts

    Re: Monster killing (Can't explain)

    Quote Originally Posted by Veda View Post
    You removed killMonster O.o
    Ah, thanks. I re added it just then. I'm sure people would of been able to know I made a mistake themselves though.

  15. #15
    Sorcerer Supreme lolwutwat is offline
    Member +Rank
    Aug 2011 Join Date
    307Posts

    Re: Monster killing (Can't explain)

    Title: Clear drops after a kill / after certain amount of items is reached
    would be more clear (;


    gj

  16. #16
    Newbie koolblue877 is offline
    MemberRank
    Dec 2011 Join Date
    19Posts

    Re: Clear drops after a kill / certain amount of items is reached.

    Thanks so much.

  17. #17
    Grand Master StripedCow is offline
    Grand MasterRank
    Jun 2011 Join Date
    813Posts

    Re: Clear drops after a kill / certain amount of items is reached.

    that's a bad way to remove them, just saying. especially when items aren't syncronized/locked-unlocked.



Advertisement