[Add-on] NPC that delete your items.

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Account Inactive ♀Secret♂ is offline
    InactiveRank
    Sep 2009 Join Date
    499Posts

    [Add-on] NPC that delete your items.


    RaGEZONE Recommends

    RaGEZONE Recommends

    2nd Release o.o Oh well ;)

    Add these in NPCConversationManager.java
    Code:
    public String EquipList(MapleClient c) {
            StringBuilder str = new StringBuilder();
               MapleInventory equip = c.getPlayer().getInventory(MapleInventoryType.EQUIP);
                    List<String> stra = new LinkedList<String>();
                        for (IItem item : equip.list()) {
                            stra.add("#L"+item.getPosition()+"##v"+item.getItemId()+"##l");
                            }
                        for (String strb : stra) {
                    str.append(strb);
                }
            return str.toString();
        }
        
    public String CashList(MapleClient c) {
            StringBuilder str = new StringBuilder();
               MapleInventory cash = c.getPlayer().getInventory(MapleInventoryType.CASH);
                    List<String> stra = new LinkedList<String>();
                        for (IItem item : cash.list()) {
                            stra.add("#L"+item.getPosition()+"##v"+item.getItemId()+"##l");
                            }
                        for (String strb : stra) {
                    str.append(strb);
                }
            return str.toString();
        }
    NPC script :
    Code:
    /*
    Scripted by Yz, AAFS's DEVTeam. 2010-2011. All right reserved.
    --------------------------------------------------------------
    Feel free to re-distribute my work, but remember to give the proper credits. 
    
    Credit to Shawn in Rz
    */
    
    importPackage(Packages.client);
    
    var status = 0;
    var chosenItem;
    var selected = 1;
    var selectedType = -1;
    var selectedItem = -1;
    var choice;
    status = -1;
    
    function start() {
        cm.sendSimple("Hey #b#h ##k. I'm #rInventory Cleaner#k. Well, do you think you need some #bcleaning#k? If yes, I will give u a small #rwarning#k. Once click, your item will be deleted. We won't #rrefund#k your item! So, choose wisely! \r\n#L0#Equip Cleaner#l \r\n#L1#Cash Cleaner#l");
    }
    function action(mode, type, selection){
        if (mode != 1) {
            cm.dispose();
            return;
        }else{
            status++;
        }
        if (status == 0){
            choice = selection;
            if (choice == 0){
                cm.sendSimple("Well, choose wisely! We won't refund your #rEquip#k if you selected wrong! \r\n\r\n"+cm.EquipList(cm.getClient()));
            }else if (choice == 1){
                cm.sendSimple("PWell, choose wisely! We won't refund your #rCash#k if you selected wrong!  \r\n\r\n"+cm.CashList(cm.getClient()));
            }
        }else if (status == 1){
            /*     not fully sure, but this should work for both since 
                selection will start at 0 regardless of which you chose */
          	selectedType = selection;
    		var type = [MapleInventoryType.EQUIP,MapleInventoryType.CASH];
                chosenItem = cm.getPlayer().getInventory(type[choice]).getItem(selection).getItemId();
                cm.gainItem(chosenItem, -1);
                cm.sendOk("Thank you for your garbage!");
                cm.dispose();
        }
    }
    Should work probably.. ^_^"
    Release for those need it. If you dislike then excuse me please <3

    Credit : AAFSv2, Shawn, SuperLol, maxcloud on NPC idea, the one who release the MSI NPC


  2. #2
    Account Upgraded | Title Enabled! Expedia is offline
    True MemberRank
    Nov 2009 Join Date
    868Posts

    Re: NPC that delete your items.

    I don't get it, your Dev team claims it's scripted by them yet you give credits to Shawn? Also I find Moogra's version alot better.

  3. #3
    Account Inactive ♀Secret♂ is offline
    InactiveRank
    Sep 2009 Join Date
    499Posts

    Re: NPC that delete your items.

    @Expedia : Shawn one don't work for some reason o.o But he did help me a lots with the script, so credit Shawn ;) And Moongra's one I can't make it work o.o Idk why. the ArrayList function undefined @_@

  4. #4
    Account Upgraded | Title Enabled! SuperLol is offline
    True MemberRank
    Jun 2010 Join Date
    786Posts

    Re: NPC that delete your items.

    Quote Originally Posted by ♀Secret♂ View Post
    @Expedia : Shawn one don't work for some reason o.o But he did help me a lots with the script, so credit Shawn ;) And Moongra's one I can't make it work o.o Idk why. the ArrayList function undefined @_@
    You didn't add the method to MapleInventory.java. You just need to make it return a new ArrayList with the items in the inventory. It's a lame way of preventing concurrentmod, but since it's only GMs using it, it doesn't matter. Also that's for the full wipe, which barely any of the GMs use. For the single item removal, you can delete that part and only use the first selection which doesn't require that method.

  5. #5
    Account Inactive ♀Secret♂ is offline
    InactiveRank
    Sep 2009 Join Date
    499Posts

    Re: NPC that delete your items.

    @SuperLol : o.o Sorry I din't know it go into MapleInventory.java >< Well because I just want to delete only the selected item, and my NPC release for all players, so I use this instead of yours ;)

    But I believe yours is always better ^_^"

  6. #6
    Account Upgraded | Title Enabled! SuperLol is offline
    True MemberRank
    Jun 2010 Join Date
    786Posts

    Re: NPC that delete your items.

    I wasn't comparing yours to mine. I was just saying that mine wasn't broken lol. Oh there's a complication with all of the ones here too, and mine. The real way would be removeFromSlot, not gainItem(id, -1). You might end up deleting the wrong item but the same item id. I think I found a way to fix that a while ago but I never implemented it

  7. #7
    Account Inactive ♀Secret♂ is offline
    InactiveRank
    Sep 2009 Join Date
    499Posts

    Re: NPC that delete your items.

    Sorry I don't understand o.o
    How will gainItem(id, -1) end up deleting the wrong item? o.o I thought it should always delete the right item we choose? @_@

    //Edit : And I thought that every item should have an unique ID eh? o.o
    Last edited by ♀Secret♂; 26-12-10 at 09:29 PM.

  8. #8
    bleh.... Shawn is offline
    The OmegaRank
    Oct 2008 Join Date
    Mississauga, CaLocation
    6,125Posts

    Re: NPC that delete your items.

    Ok... normally I'm not one to bitch about people claiming credits for the scripts I hand them when they ask for help... but really?

    Look at my post:
    Quote Originally Posted by Shawn View Post
    o_0

    PHP Code:
    function start() {
        
    cm.sendSimple("Pick an Item:\r\n\r\n"+cm.EquipAndCashList(cm.getC()));
    }
    function 
    action(modetypeselection) {
        
    cm.dispose();
        if (
    mode 0) {
            
    cm.gainItem(selection, -1);
        }

    Use the method Snipe posted. Or... if you want to make it a bit longer, use these methods.

    NPCConversationManager.java
    PHP Code:
    public String EquipList(MapleClient c) {
            
    StringBuilder str = new StringBuilder();
               
    MapleInventory equip c.getPlayer().getInventory(MapleInventoryType.EQUIP);
                    List<
    Stringstra = new LinkedList<String>();
                        for (
    IItem item equip.list()) {
                            
    stra.add("#L"+item.getPosition()+"##v"+item.getItemId()+"##l");
                            }
                        for (
    String strb stra) {
                    
    str.append(strb);
                }
            return 
    str.toString();
        }
        
    public 
    String CashList(MapleClient c) {
            
    StringBuilder str = new StringBuilder();
               
    MapleInventory cash c.getPlayer().getInventory(MapleInventoryType.CASH);
                    List<
    Stringstra = new LinkedList<String>();
                        for (
    IItem item cash.list()) {
                            
    stra.add("#L"+item.getPosition()+"##v"+item.getItemId()+"##l");
                            }
                        for (
    String strb stra) {
                    
    str.append(strb);
                }
            return 
    str.toString();
        } 
    NPC
    PHP Code:
    var choice;
    var 
    chosenItem;
    var 
    type = [MapleInventoryType.EQUIP,MapleInventoryType.CASH];
    status = -1;
    function 
    start() {
        
    cm.sendSimple("Which would you like to remove? \r\n #L0#Equip Item#l \r\n #L1#Cash Item#l");
    }
    function 
    action(modetypeselection){
        if (
    mode != 1) {
            
    cm.dispose();
            return;
        }else{
            
    status++;
        }
        if (
    status == 0){
            
    choice selection;
            if (
    choice == 0){
                
    cm.sendSimple("Pick an Item:\r\n\r\n"+cm.EquipList(cm.getC()));
            }else if (
    choice == 1){
                
    cm.sendSimple("Pick an Item:\r\n\r\n"+cm.CashList(cm.getC()));
            }
        }else if (
    status == 1){
            
    /*     not fully sure, but this should work for both since 
                selection will start at 0 regardless of which you chose */
            
    chosenItem cm.getPlayer().getInventory(type[choice]).getItem(selection).getItemId(); // might be wrong due to type array
            
    cm.gainItem(chosenItem, -1);
            
    cm.dispose();
        }

    Make sure you compile the methods properly, then @dispose yourself before testing. Also, read the comments I put. They may help you fix any errors that might occur.
    Now look at the NPC script and the methods you posted and are claiming credit for.

    The only thing added to your "released" script is what I've added in the comments of your script here..

    PHP Code:
    /*
    Scripted by Yz, AAFS's DEVTeam. 2010-2011. All right reserved.
    --------------------------------------------------------------
    Feel free to re-distribute my work, but remember to give the proper credits. 

    Credit to Shawn in Rz
    */

    importPackage(Packages.client);

    var 
    status 0;
    var 
    chosenItem;
    var 
    selected 1// added
    var selectedType = -1// added
    var selectedItem = -1// added
    var choice;
    status = -1// repeat status variable? lol?

    function start() {
        
    cm.sendSimple("Hey #b#h ##k. I'm #rInventory Cleaner#k. Well, do you think you need some #bcleaning#k? If yes, I will give u a small #rwarning#k. Once click, your item will be deleted. We won't #rrefund#k your item! So, choose wisely! \r\n#L0#Equip Cleaner#l \r\n#L1#Cash Cleaner#l");
    }
    function 
    action(modetypeselection){
        if (
    mode != 1) {
            
    cm.dispose();
            return;
        }else{
            
    status++;
        }
        if (
    status == 0){
            
    choice selection;
            if (
    choice == 0){
                
    cm.sendSimple("Well, choose wisely! We won't refund your #rEquip#k if you selected wrong! \r\n\r\n"+cm.EquipList(cm.getClient()));
            }else if (
    choice == 1){
                
    cm.sendSimple("PWell, choose wisely! We won't refund your #rCash#k if you selected wrong!  \r\n\r\n"+cm.CashList(cm.getClient()));
            }
        }else if (
    status == 1){
            
    /*     not fully sure, but this should work for both since 
                selection will start at 0 regardless of which you chose */
              
    selectedType selection// literally has no use at all in the script. Where do you have selectedType being used?
            
    var type = [MapleInventoryType.EQUIP,MapleInventoryType.CASH]; // moved this down to localized
                
    chosenItem cm.getPlayer().getInventory(type[choice]).getItem(selection).getItemId();
                
    cm.gainItem(chosenItem, -1);
                
    cm.sendOk("Thank you for your garbage!");
                
    cm.dispose();
        }

    The things you added do not affect anything at all with the script, because they play no factor at all. The only thing you've done that might have made a difference is moved the type array to a localized variable, instead of global. Other than that, selectedType, selectedItem and selected don't do anything because they aren't used anywhere in the script except being defined... So... how does mine not work?

    Quote Originally Posted by Russell Peters
    I have a theory. I believe that the size of your penis is in indirect correlation with how much sex you will have in your life. The smaller your dick, the more you will fuck. You dont believe me, look at the two largest populations in the world

    RIP Akaruz, The Godfather

    Spoiler:

    mental is hot
    Spoiler:

    This is a true story
    Spoiler:

    This message is endorsed by Shawn and not added by MentaL.



  9. #9
    Smoke & Fly Kars is offline
    GammaRank
    Apr 2008 Join Date
    The NetherlandsLocation
    3,416Posts

    Re: NPC that delete your items.

    I'm sorry for the people who got credited on this.

  10. #10
    Account Inactive ♀Secret♂ is offline
    InactiveRank
    Sep 2009 Join Date
    499Posts

    Re: NPC that delete your items.

    @Shawn : Ahh sorry o.o Maybe I did forget about the import eh? @_@"

    @Kars : Lol ><" Sorry if this troublesome those person o.o

    //Edit : Close this topic if needed :) I din't expect much thanks, but finally I know at least 2 or 3 people took this away and use them o.o Ah well, mission done ^_^"

  11. #11
    Account Upgraded | Title Enabled! AuroX is offline
    True MemberRank
    Sep 2008 Join Date
    1,435Posts

    Re: NPC that delete your items.

    I guess you can improve it by enabling the user to type in the item id and the npc will just search for it in your inventory and remove it.

  12. #12
    Account Inactive ♀Secret♂ is offline
    InactiveRank
    Sep 2009 Join Date
    499Posts

    Re: NPC that delete your items.

    @yenpooh o.o I don't think this is a good idea, because the NPC were for player, so they don't have those item id @_@"

  13. #13
    Account Upgraded | Title Enabled! AuroX is offline
    True MemberRank
    Sep 2008 Join Date
    1,435Posts

    Re: NPC that delete your items.

    You can give them gm handbook or put @search command for them <3 this will be an easier method as you do not need to click one by one to delete them. Lols

  14. #14
    Account Inactive ♀Secret♂ is offline
    InactiveRank
    Sep 2009 Join Date
    499Posts

    Re: NPC that delete your items.

    o.o But they will need to type 1 by 1 to delete them now lol..

  15. #15
    Alpha Member XxОsirisxX is offline
    Alpha MaleRank
    Aug 2009 Join Date
    2,730Posts

    Re: NPC that delete your items.

    Yeah, yenpooh idea is terrible.

    Also, what SuperLol said doesn't apply in here at all. He is right, you must remove from slot, not by ID. But this only matters for merchants that sells in bundles, that doesn't apply in here at all, because you will ends up removing exactly the same item you wanted to. Well, the only way this could apply, is if the user have some cash items with the same ID, but he only wants to remove the one with the most quantity and left the one with the least (But really, barely going to happen).




Page 1 of 2 12 LastLast

Advertisement