Thread: Charming Imp

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1 Charming Imp 
    Donator

    Defiled RSPS's Avatar
    Join Date
    Oct 2013
    Posts
    465
    Thanks given
    32
    Thanks received
    30
    Rep Power
    94
    so if you don't know what this is read more about it
    Charming imp - The RuneScape Wiki

    so basically this collects charms before they hit the ground giving you experience
    please pm me any errors.

    first go to npchandler.java

    search for

    Code:
    public void dropItems(int i) {
    above ^ Add
    Code:
    public boolean isCharm (int item) {
             switch (item) {
                 case 12160://crimson
                 case 12163://blue
                 case 12158://gold
                 case 12159://green
                     return true;
                 default:         
                     return false;
                 }
             }
    This makes sure that the item been dropped is a charm

    Code:
    default:
     return false;
    this means that any other item id's are determined as non charm id's

    scroll down a few lines of text
    find
    Code:
    if (NPCDrops.constantDrops.get(npcs[i].npcType) != null) {
                     for (int item : NPCDrops.constantDrops.get(npcs[i].npcType)) {
    underneath
    Code:
    for (int item : NPCDrops.constantDrops.get(npcs[i].npcType)) {

    replace
    Code:
    Server.itemHandler.createGroundItem(c, item, npcs[i].absX, npcs[i].absY, 1, c.playerId);
    with
    Code:
    if (c.getItems().playerHasItem(****,1) && IsCharm(item))    
                             c.getPA().addSkillXP(c.getSummoning().getExp(item)*Config.SUMMONING_EXPERIE​NCE,22);
                         else
                             Server.itemHandler.createGroundItem(c, item, npcs[i].absX, npcs[i].absY, 1, c.playerId);
    the **** = the item id of the item you want to collect the charms
    eg if you wanted dragon claws for instance to collect the charms add

    Code:
    if (c.getItems().playerHasItem(14484,1) && IsCharm(item))    
                             c.getPA().addSkillXP(c.getSummoning().getExp(item)*Config.SUMMONING_EXPERIE​NCE,22);
                         else
                             Server.itemHandler.createGroundItem(c, item, npcs[i].absX, npcs[i].absY, 1, c.playerId);
    credits to http://www.rune-server.org/runescape...600-items.html
    I converted this to a charming imp and deleted some useless code.


    Do not trash talk this as you don't have to use it if you don't want to.
    Attached image
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Registered Member Pseudo's Avatar
    Join Date
    Jan 2014
    Posts
    227
    Thanks given
    31
    Thanks received
    43
    Rep Power
    37
    Code:
    isCharm(item)
    Reply With Quote  
     

  4. #3  
    Donator

    Join Date
    Jul 2013
    Posts
    488
    Thanks given
    21
    Thanks received
    42
    Rep Power
    0
    Correct me if i'm wrong but would creating an array not be better?
    Code:
    public boolean isCharm (int item) {
             switch (item) {
                 case 12160://crimson
                 case 12163://blue
                 case 12158://gold
                 case 12159://green
                     return true;
                 default:         
                     return false;
                 }
             }
    Reply With Quote  
     

  5. #4  
    SERGEANT OF THE MASTER SERGEANTS MOST IMPORTANT PERSON OF EXTREME SERGEANTS TO THE MAX!

    cube's Avatar
    Join Date
    Jun 2007
    Posts
    8,871
    Thanks given
    1,854
    Thanks received
    4,745
    Rep Power
    5000
    Quote Originally Posted by pabb View Post
    Correct me if i'm wrong but would creating an array not be better?
    Code:
    public boolean isCharm (int item) {
             switch (item) {
                 case 12160://crimson
                 case 12163://blue
                 case 12158://gold
                 case 12159://green
                     return true;
                 default:         
                     return false;
                 }
             }
    There's only few charms so an array won't be necessary

    Attached image

    Reply With Quote  
     

  6. #5  
    Donator

    Defiled RSPS's Avatar
    Join Date
    Oct 2013
    Posts
    465
    Thanks given
    32
    Thanks received
    30
    Rep Power
    94
    Quote Originally Posted by S Quare Quxx View Post
    There's only few charms so an array won't be necessary
    exactly.
    Attached image
    Reply With Quote  
     

  7. #6  
    Donator

    Defiled RSPS's Avatar
    Join Date
    Oct 2013
    Posts
    465
    Thanks given
    32
    Thanks received
    30
    Rep Power
    94
    bump no problem guys.
    Attached image
    Reply With Quote  
     

  8. #7  
    Registered Member Pseudo's Avatar
    Join Date
    Jan 2014
    Posts
    227
    Thanks given
    31
    Thanks received
    43
    Rep Power
    37
    Quote Originally Posted by tekkit View Post
    bump no problem guys.
    You may want to fix what I posted.
    Reply With Quote  
     

  9. #8  
    Registered Member
    Join Date
    Dec 2010
    Posts
    354
    Thanks given
    17
    Thanks received
    61
    Rep Power
    47
    Code:
    private static final Integer[] CHARMS = { all charms };
    
    
    Set<Integer> charms = new HashSet<Integer>(Arrays.asList(CHARMS));
    
    if(charms.contains(itemId)) {
    //dostuff
    }
    if you want to use an array you could do it like this.
    Reply With Quote  
     

  10. #9  


    Major's Avatar
    Join Date
    Jan 2011
    Posts
    2,997
    Thanks given
    1,293
    Thanks received
    3,556
    Rep Power
    5000
    Quote Originally Posted by dan0194 View Post
    Code:
    private static final Integer[] CHARMS = { all charms };
    
    
    Set<Integer> charms = new HashSet<Integer>(Arrays.asList(CHARMS));
    
    if(charms.contains(itemId)) {
    //dostuff
    }
    if you want to use an array you could do it like this.
    This isn't exactly using an array... also this is far too short to bother with arrays or hashsets or directed acyclic functional hash bimap tables

    Code:
    public boolean isCharm(int id) {
        return id == 12160 || id == 12163 || id == 12158 || id == 12159;
    Also you should really use the diamond operator
    Reply With Quote  
     

  11. Thankful user:


  12. #10  
    Registered Member risgaard's Avatar
    Join Date
    Jul 2013
    Posts
    648
    Thanks given
    12
    Thanks received
    16
    Rep Power
    13
    correct me if i am wrong, but this 1 turns the charms into exP? and it's supposted to add the charms to inventory ? maybe i am wrong...
    my grammar. aint pefect. but atleast you understand me

    did i help you ?
    i am not asking for rep but you can atleast say thanks
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. charming imp
    By risgaard in forum Models
    Replies: 11
    Last Post: 06-21-2014, 09:25 PM
  2. Charming Imp help.
    By WithinTheLight in forum Help
    Replies: 2
    Last Post: 05-25-2014, 06:30 AM
  3. Santa Imp (Npc)
    By Mikey` in forum Configuration
    Replies: 2
    Last Post: 03-02-2008, 09:49 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •