Item doesn't get deducted after using command !

Results 1 to 10 of 10
  1. #1
    Proficient Member TheJava is offline
    MemberRank
    Jan 2014 Join Date
    166Posts

    Item doesn't get deducted after using command !

    Greetings !

    I've ripped off Vindicated's @BUYIOC command and somehow used it on a v144. But for some reasons it doesn't minus off anything when command is used.

    public static class buyioc extends CommandExecute {

    @Override
    public int execute(MapleClient c, String[] splitted) {
    if (splitted.length == 1) {
    c.getPlayer().dropMessage(6, "[IOC] @voteitem <item id>");
    } else if (!c.getPlayer().canHold()) {
    c.getPlayer().dropMessage(6, "[IOC] Please check if you have room in your Inventory.");
    return 0;
    } else if (!c.getPlayer().haveItem(4310031, 1)) {
    c.getPlayer().dropMessage(6, "[IOC] Please check if you have a Legends Award Coin");
    return 0;
    }
    final int itemId = Integer.parseInt(splitted[1]);
    final short quantity = (short) CommandProcessorUtil.getOptionalIntArg(splitted, 2, 1);


    MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
    for (int i : itemBlockez) {
    if (itemId == i) {
    c.getPlayer().dropMessage(6, "[IOC] " + itemId + " is blocked.");
    return 0;
    }
    }
    if (!ii.itemExists(itemId)) {
    c.getPlayer().dropMessage(6, "[IOC] " + itemId + " does not exist, type @search item <Item Name> to search for your item.");
    } else {
    Item item;
    short flag = (short) ItemFlag.LOCK.getValue();


    if (GameConstants.getInventoryType(itemId) == MapleInventoryType.EQUIP) {
    item = ii.randomizeStats((Equip) ii.getEquipById(itemId));
    } else {
    item = new client.inventory.Item(itemId, (byte) 0, quantity, (byte) 0);
    }
    item.setOwner(c.getPlayer().getName());
    c.getPlayer().gainItem(4310031, -1);
    {
    MapleInventoryManipulator.addbyItem(c, item);
    }
    return 1;
    }
    return 0;
    }
    }
    Thanks ,
    TheJava


  2. #2
    $_SESSION['DEV']; hecari is offline
    MemberRank
    Dec 2008 Join Date
    336Posts

    Re: Item doesn't get deducted after using command !

    Quote Originally Posted by TheJava View Post
    Greetings !

    I've ripped off Vindicated's @BUYIOC command and somehow used it on a v144. But for some reasons it doesn't minus off anything when command is used.



    Thanks ,
    TheJava
    I would like to know more about it. For example, when you say it doesn't minus off anything, did you get anything also?


    PHP Code:
    // What is this bracket for?
    MapleInventoryManipulator.addbyItem(citem);


  3. #3
    Proficient Member TheJava is offline
    MemberRank
    Jan 2014 Join Date
    166Posts

    Re: Item doesn't get deducted after using command !

    Greetings ,

    Yes I do gain the item like @buyioc <item code> I gain the item I want yet the needed requirement item isn't removed.

    Thanks.
    TheJAVA

  4. #4
    $_SESSION['DEV']; hecari is offline
    MemberRank
    Dec 2008 Join Date
    336Posts

    Re: Item doesn't get deducted after using command !

    Why do you have an open brace above this code:-

    PHP Code:
    MapleInventoryManipulator.addbyItem(citem); 
    Also, does the item contain the owner name?

  5. #5
    Proficient Member TheJava is offline
    MemberRank
    Jan 2014 Join Date
    166Posts

    Re: Item doesn't get deducted after using command !

    Yes , it makes the item with the player's name.

    - - - Updated - - -

    I've tried removing the brace and done most of the possible ways already yet no help at all.

  6. #6
    $_SESSION['DEV']; hecari is offline
    MemberRank
    Dec 2008 Join Date
    336Posts

    Re: Item doesn't get deducted after using command !

    Do you mind posting MapleCharacter.java ?

  7. #7
    Account Upgraded | Title Enabled! StripedCow is offline
    MemberRank
    Jun 2011 Join Date
    813Posts

    Re: Item doesn't get deducted after using command !

    you are using addByItem method wrong. subtract instead of adding.

  8. #8
    Proficient Member TheJava is offline
    MemberRank
    Jan 2014 Join Date
    166Posts

    Re: Item doesn't get deducted after using command !

    Greetings

    -Close thread , Fixed it by making the command open an npc and I edited the npc to check for 1 of the currency and deduct it if they have it-
    ( I know it's a fail method but it was out of desperation ! )

    Thanks for all the helps
    -TheJava

  9. #9
    $_SESSION['DEV']; hecari is offline
    MemberRank
    Dec 2008 Join Date
    336Posts

    Re: Item doesn't get deducted after using command !

    Quote Originally Posted by TheJava View Post
    Greetings

    -Close thread , Fixed it by making the command open an npc and I edited the npc to check for 1 of the currency and deduct it if they have it-
    ( I know it's a fail method but it was out of desperation ! )

    Thanks for all the helps
    -TheJava
    Did you try this?

    Quote Originally Posted by StripedCow View Post
    you are using addByItem method wrong. subtract instead of adding.

  10. #10
    Proficient Member TheJava is offline
    MemberRank
    Jan 2014 Join Date
    166Posts

    Re: Item doesn't get deducted after using command !

    Greetings ,

    Apparently , no. Since the npc method was great for now.

    Thanks for all your help.



Advertisement