Donator NPC that sells edited stat items

Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    Valued Member joost1500 is offline
    MemberRank
    Jul 2010 Join Date
    NetherlandsLocation
    123Posts

    Donator NPC that sells edited stat items

    Hi,

    I want to make a npc that sells edited stat items, like this: transparent gloves with 50 str etc...
    I am currently using this code in NPCConverstationManager.java, but I don't know how to make this script work in a npc

    NPCConverstationManager.java
    Code:
    public void ProDonatorItem(byte slot, MapleCharacter player) {
            MapleInventory equip = player.getInventory(MapleInventoryType.EQUIP);
            Equip eu = (Equip) equip.getItem(slot);
            int item = equip.getItem(slot).getItemId();
            short hand = eu.getHands();
            byte level = eu.getLevel();
            Equip nItem = new Equip(item, equip.getNextFreeSlot());
            nItem.setStr((short) 250); //STR
            nItem.setDex((short) 250); //DEX 
            nItem.setInt((short) 250); //INT
            nItem.setLuk((short) 250); //LUK
            nItem.setWatk((short) 100); // WA
            nItem.setUpgradeSlots((byte) 0);
            nItem.setHands(hand);
            nItem.setLevel(level);
            player.getInventory(MapleInventoryType.EQUIP).addFromDB(nItem);
            player.getInventory(MapleInventoryType.EQUIP).removeItem(slot);
        }
    Please help me!


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

    Re: Donator NPC that sells edited stat items

    use

    PHP Code:
    cm.sendSimple(cm.EquipList(cm.getC())); 
    to get the slot then apply your code

    PHP Code:
    cm.ProDonatorItem(selectioncm.getPlayer()); 

  3. #3
    Valued Member joost1500 is offline
    MemberRank
    Jul 2010 Join Date
    NetherlandsLocation
    123Posts

    Re: Donator NPC that sells edited stat items

    So where can I put the item id that I want to make my npc sell?

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

    Re: Donator NPC that sells edited stat items

    Wait? You want your NPC to sell any donor item? or you want your donor to pick a item in their inventory to make into a donor item.

  5. #5
    Valued Member joost1500 is offline
    MemberRank
    Jul 2010 Join Date
    NetherlandsLocation
    123Posts

    Re: Donator NPC that sells edited stat items

    I want a NPC that sells the items for DP ;)

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

    Re: Donator NPC that sells edited stat items

    Any item? Or specific item?

    Based on Item ID.
    PHP Code:
    public void ProDonatorItem(int itemMapleCharacter player) {
            
    Equip nItem = new Equip(itemequip.getNextFreeSlot());
            
    nItem.setStr((short250); //STR
            
    nItem.setDex((short250); //DEX 
            
    nItem.setInt((short250); //INT
            
    nItem.setLuk((short250); //LUK
            
    nItem.setWatk((short100); // WA
            
    nItem.setUpgradeSlots((byte0);
            
    player.getInventory(MapleInventoryType.EQUIP).addFromDB(nItem);
        } 
    You use:

    PHP Code:
    cm.ProDonatorItem(<itemID>, c.getPlayer()); 

  7. #7
    Valued Member joost1500 is offline
    MemberRank
    Jul 2010 Join Date
    NetherlandsLocation
    123Posts

    Re: Donator NPC that sells edited stat items

    Ehmm that looks good, but I need to create a class/field for equip in (item, equip.getNextFreeSlot());
    What shall I do?
    Btw sorry for asking so much from you..

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

    Re: Donator NPC that sells edited stat items

    Quote Originally Posted by joost1500 View Post
    Ehmm that looks good, but I need to create a class/field for equip in (item, equip.getNextFreeSlot());
    What shall I do?
    Btw sorry for asking so much from you..
    Import the equip class. I do not know which class. I'm lazy to check.

    Should be:

    PHP Code:
    import client.inventory.Equip

  9. #9
    Valued Member joost1500 is offline
    MemberRank
    Jul 2010 Join Date
    NetherlandsLocation
    123Posts

    Re: Donator NPC that sells edited stat items

    I can't find it ...
    Would you mind to tv me, i'll send a pm with my id + pass

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

    Re: Donator NPC that sells edited stat items

    Quote Originally Posted by joost1500 View Post
    I can't find it ...
    Would you mind to tv me, i'll send a pm with my id + pass
    Just place
    PHP Code:
    import client.inventory.Equip
    anywhere near all your import in the NPCConversationManager.java

  11. #11
    Valued Member joost1500 is offline
    MemberRank
    Jul 2010 Join Date
    NetherlandsLocation
    123Posts

    Re: Donator NPC that sells edited stat items

    Lol ty

  12. #12
    Valued Member joost1500 is offline
    MemberRank
    Jul 2010 Join Date
    NetherlandsLocation
    123Posts

    Re: Donator NPC that sells edited stat items

    EDIT: I made it work, but players do have to cc before it takes any effect, how could I fix this?
    Last edited by joost1500; 22-04-13 at 11:19 PM.

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

    Re: Donator NPC that sells edited stat items

    You forced them cc by enforcing a method in NPCConversationManager.java using ideas from fake relog.

  14. #14
    Moderator Eric is offline
    ModeratorRank
    Jan 2010 Join Date
    DEV CityLocation
    3,188Posts

    Re: Donator NPC that sells edited stat items

    Quote Originally Posted by joost1500 View Post
    EDIT: I made it work, but players do have to cc before it takes any effect, how could I fix this?
    PHP Code:
    public void reloadChar() {
            
    getPlayer().getClient().getSession().write(MaplePacketCreator.getCharInfo(getPlayer()));
            
    getPlayer().getMap().removePlayer(getPlayer());
            
    getPlayer().getMap().addPlayer(getPlayer());
        } 
    Add this into NPCConversationManager.java.

    Then in your npc below cm.ProDonatorItem or whatever, add: cm.reloadChar(); and it should fix this.

    EDIT: Also, if you want a more advanced function that becomes user-friendly, use this :

    PHP Code:
    public void ProDonatorItem(int itemint strint dexint int_int luk){
             
    Equip eu = new Equip(itemequip.getNextFreeSlot());
             
    MapleJob job eu.getJob(); // JOB
             
    short hand eu.getHands(); // HANDS
             
    byte level eu.getLevel(); // LEVEL
             
    eu.setStr((shortstr); // STR
             
    eu.setDex((shortdex); // DEX
             
    eu.setInt((shortint_); // INT
             
    eu.setLuk((shortluk); //LUK
             
    eu.setUpgradeSlots((byte0); // Feel free to change
             
    eu.setJob(job);
             
    eu.setHands(hand);
             
    eu.setLevel(level);
             
    getPlayer().getInventory(MapleInventoryType.EQUIP).addFromDB(eu);
        } 
    Pretty much, every item you give them can have the stats you want.
    Just use cm.ProDonatorItem(itemID, STR, DEX, INT, LUK);

    Hope this helps! (:
    Last edited by Eric; 23-04-13 at 03:51 AM.

  15. #15
    Account Upgraded | Title Enabled! bbhing98 is offline
    MemberRank
    Jul 2012 Join Date
    314Posts

    Re: Donator NPC that sells edited stat items

    sorry for bumping this thread again, but may i ask, how do i change the level, add speed, add jump, upgrade slot to an item with this function? like
    cm.ProDonatorItem(itemID,str,dex,int,luk,level,speed,jump,upgrade slot? )?
    something like
    PHP Code:
    public void ProDonatorItem(int itemint strint dexint int_int lukint levelint speedint jumpint upgradeslots){
    Equip eu = new Equip(itemequip.getNextFreeSlot());
             
    MapleJob job eu.getJob(); // JOB
             
    short hand eu.getHands(); // HANDS
             
    byte level eu.getLevel(); // LEVEL
             
    eu.setStr((shortstr); // STR
             
    eu.setDex((shortdex); // DEX
             
    eu.setInt((shortint_); // INT
             
    eu.setLuk((shortluk); //LUK
             
    eu.setUpgradeSlots((byteupgradeslots); // Feel free to change
             
    eu.setJob(job);
             
    eu.setHands(hand);
             
    eu.setLevel(level);
             
    eu.setSpeed(speed);
             
    eu.setJump(jump);
             
    getPlayer().getInventory(MapleInventoryType.EQUIP).addFromDB(eu);
    getPlayer().getInventory(MapleInventoryType.EQUIP).removeItem(slot);   
     } 
    CORRECT ME IF IM WRONG
    also, how can i add potential to an item? someone can write a complete code for it?

    edit: i've also found this in my npcconversationmanager.java.

    public void changeStat(byte slot, int type, int amount) {
    Equip sel = (Equip) c.getPlayer().getInventory(MapleInventoryType.EQUIPPED).getItem(slot);
    switch (type) {
    case 0:
    sel.setStr((short) amount);
    break;
    case 1:
    sel.setDex((short) amount);
    break;
    case 2:
    sel.setInt((short) amount);
    break;
    case 3:
    sel.setLuk((short) amount);
    break;
    case 4:
    sel.setHp((short) amount);
    break;
    case 5:
    sel.setMp((short) amount);
    break;
    case 6:
    sel.setWatk((short) amount);
    break;
    case 7:
    sel.setMatk((short) amount);
    break;
    case 8:
    sel.setWdef((short) amount);
    break;
    case 9:
    sel.setMdef((short) amount);
    break;
    case 10:
    sel.setAcc((short) amount);
    break;
    case 11:
    sel.setAvoid((short) amount);
    break;
    case 12:
    sel.setHands((short) amount);
    break;
    case 13:
    sel.setSpeed((short) amount);
    break;
    case 14:
    sel.setJump((short) amount);
    break;
    case 15:
    sel.setUpgradeSlots((byte) amount);
    break;
    case 16:
    sel.setViciousHammer((byte) amount);
    break;
    case 17:
    sel.setLevel((byte) amount);
    break;
    case 18:
    sel.setEnhance((byte) amount);
    break;
    case 19:
    sel.setPotential1(amount);
    break;
    case 20:
    sel.setPotential2(amount);
    break;
    case 21:
    sel.setPotential3(amount);
    break;
    case 22:
    sel.setPotential4(amount);
    break;
    case 23:
    sel.setPotential5(amount);
    break;
    case 24:
    sel.setOwner(getText());
    break;
    default:
    break;
    }
    what does this do?

    edit: guess i'll make another thread
    Last edited by bbhing98; 28-04-13 at 09:14 AM.



Page 1 of 2 12 LastLast

Advertisement