[Add-on] Fully Working Hired Merchants

Page 1 of 3 123 LastLast
Results 1 to 15 of 37
  1. #1
    -Error- xXSnipeDownOo is offline
    MemberRank
    Jul 2010 Join Date
    885Posts

    thumbs up [Add-on] Fully Working Hired Merchants

    I could not find a Full hired merchants thread, so i decided to make on fore you guys.

    This is my first... release... so i hope you enjoy it.
    Any errors? Post them and I'll try to help.
    If I'm missing anything tell me. I got all the methods and stuff included so i think everything's there.

    First off if you do not already have it, download Netbeans:
    http://netbeans.org/downloads/start....=en&option=all

    After you install, follow this guide:
    http://forum.ragezone.com/f428/tut-c...s-odin-406097/

    We will need this later, and also in the end.

    If you want, download the guide:
    Downloads :
    Spoiler:
    All of the Guide - Easier to read
    Hired Merchants.txt
    The SQL -
    Hired Merchants.sql


    First off go to *Repack*/recvops.properties
    Add this at the bottom:

    Spoiler:
    PHP Code:
    HIRED_MERCHANT_REQUEST 0x3B 


    Now go to *Repack*/sendops.properties
    Add this at the bottom:

    Spoiler:
    PHP Code:
    SPAWN_HIRED_MERCHANT 0xCA
    DESTROY_HIRED_MERCHANT 
    0xCB 


    Now you want to go to *Repack*\src\net\sf\odinms\server\maps
    and create a new .java file and name it HiredMerchant
    Now put this code inside:

    Spoiler:
    PHP Code:
    package net.sf.odinms.server.maps;

    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    import java.util.Collections;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.concurrent.ScheduledFuture;
    import net.sf.odinms.client.Equip;
    import net.sf.odinms.client.IItem;
    import net.sf.odinms.client.MapleCharacter;
    import net.sf.odinms.client.MapleClient;
    import net.sf.odinms.database.DatabaseConnection;
    import net.sf.odinms.net.MaplePacket;
    import net.sf.odinms.server.MapleInventoryManipulator;
    import net.sf.odinms.server.MaplePlayerShopItem;
    import net.sf.odinms.server.TimerManager;
    import net.sf.odinms.tools.MaplePacketCreator;

    /**
     *
     * @author XoticStory
     */
    public class HiredMerchant extends AbstractMapleMapObject {

        private int ownerId;
        private int itemId;
        private String ownerName = "";
        private String description = "";
        private MapleCharacter[] visitors = new MapleCharacter[3];
        private List<MaplePlayerShopItem> items = new LinkedList<MaplePlayerShopItem>();
        private boolean open;
        public ScheduledFuture<?schedule null;
        private 
    MapleMap map;

        public 
    HiredMerchant(MapleCharacter ownerint itemIdString desc) {
            
    this.setPosition(owner.getPosition());
            
    this.ownerId owner.getId();
            
    this.itemId itemId;
            
    this.ownerName owner.getName();
            
    this.description desc;
            
    this.map owner.getMap();
            
    this.schedule TimerManager.getInstance().schedule(new Runnable() {

                @
    Override
                
    public void run() {
                    
    HiredMerchant.this.closeShop(true);
                }
            }, 
    1000 60 60 24);
        }

        public 
    void broadcastToVisitors(MaplePacket packet) {
            for (
    MapleCharacter visitor visitors) {
                if (
    visitor != null) {
                    
    visitor.getClient().getSession().write(packet);
                }
            }
        }

        public 
    void addVisitor(MapleCharacter visitor) {
            
    int i this.getFreeSlot();
            if (
    > -1) {
                
    visitors[i] = visitor;
                
    broadcastToVisitors(MaplePacketCreator.hiredMerchantVisitorAdd(visitor1));
            }
        }

        public 
    void removeVisitor(MapleCharacter visitor) {
            
    int slot getVisitorSlot(visitor);
            if (
    visitors[slot] == visitor) {
                
    visitors[slot] = null;
                
    broadcastToVisitors(MaplePacketCreator.hiredMerchantVisitorLeave(slot 1false));
            }
        }

        public 
    int getVisitorSlot(MapleCharacter visitor) {
            for (
    int i 03i++) {
                if (
    visitors[i] == visitor) {
                    return 
    i;
                }
            }
            return 
    1;
        }

        public 
    void removeAllVisitors(String message) {
            for (
    int i 03i++) {
                if (
    visitors[i] != null) {
                    
    visitors[i].getClient().getSession().write(MaplePacketCreator.hiredMerchantForceLeave1());
                    
    visitors[i].getClient().getSession().write(MaplePacketCreator.hiredMerchantForceLeave2());
                    if (
    message.length() > 0) {
                        
    visitors[i].dropMessage(1message);
                    }
                    
    visitors[i] = null;
                }
            }
        }

        public 
    void buy(MapleClient cint itemshort quantity) {
            
    MaplePlayerShopItem pItem items.get(item);
            
    synchronized (items) {
                
    IItem newItem pItem.getItem().copy();
                
    newItem.setQuantity((short) (newItem.getQuantity() * quantity));
                if (
    c.getPlayer().getMeso() >= pItem.getPrice() * quantity) {
                    
    c.getPlayer().gainMeso(-pItem.getPrice() * quantityfalse);
                    
    Connection con DatabaseConnection.getConnection();
                    try {
                        
    PreparedStatement ps con.prepareStatement("UPDATE characters SET MerchantMesos = MerchantMesos + " pItem.getPrice() * quantity " WHERE id = ?");
                        
    ps.setInt(1ownerId);
                        
    ps.executeUpdate();
                        
    ps.close();
                    } catch (
    SQLException se) {
                        
    se.printStackTrace();
                    }
                    
    MapleInventoryManipulator.addFromDrop(cnewItem"");
                    
    pItem.setBundles((short) (pItem.getBundles() - quantity));
                } else {
                    
    c.getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(1"You do not have enough mesos."));
                }
            }
        }

        public 
    void closeShop(boolean saveItems) {
            
    Connection con DatabaseConnection.getConnection();
            
    PreparedStatement ps;
            
    map.removeMapObject(this);
            
    map.broadcastMessage(MaplePacketCreator.destroyHiredMerchant(ownerId));
            try {
                
    ps con.prepareStatement("UPDATE characters SET HasMerchant = 0 WHERE id = ?");
                
    ps.setInt(1ownerId);
                
    ps.executeUpdate();
                
    ps.close();
                if (
    saveItems) {
                    for (
    MaplePlayerShopItem pItems getItems()) {
                        if (
    pItems.getBundles() > 0) {
                            if (
    pItems.getItem().getType() == 1) {
                                
    ps con.prepareStatement("INSERT INTO hiredmerchant (ownerid, itemid, quantity, upgradeslots, level, str, dex, `int`, luk, hp, mp, watk, matk, wdef, mdef, acc, avoid, hands, speed, jump, owner, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
                                
    Equip eq = (EquippItems.getItem();
                                
    ps.setInt(2eq.getItemId());
                                
    ps.setInt(31);
                                
    ps.setInt(4eq.getUpgradeSlots());
                                
    ps.setInt(5eq.getLevel());
                                
    ps.setInt(6eq.getStr());
                                
    ps.setInt(7eq.getDex());
                                
    ps.setInt(8eq.getInt());
                                
    ps.setInt(9eq.getLuk());
                                
    ps.setInt(10eq.getHp());
                                
    ps.setInt(11eq.getMp());
                                
    ps.setInt(12eq.getWatk());
                                
    ps.setInt(13eq.getMatk());
                                
    ps.setInt(14eq.getWdef());
                                
    ps.setInt(15eq.getMdef());
                                
    ps.setInt(16eq.getAcc());
                                
    ps.setInt(17eq.getAvoid());
                                
    ps.setInt(18eq.getHands());
                                
    ps.setInt(19eq.getSpeed());
                                
    ps.setInt(20eq.getJump());
                                
    ps.setString(21eq.getOwner());
                                
    ps.setInt(221);
                            } else {
                                
    ps con.prepareStatement("INSERT INTO hiredmerchant (ownerid, itemid, quantity, owner, type) VALUES (?, ?, ?, ?, 0)");
                                
    ps.setInt(2pItems.getItem().getItemId());
                                
    ps.setInt(3pItems.getItem().getQuantity());
                                
    ps.setString(4pItems.getItem().getOwner());
                            }
                            
    ps.setInt(1ownerId);
                            
    ps.executeUpdate();
                            
    ps.close();
                        }
                    }
                }
            } catch (
    SQLException se) {
            }
            
    schedule.cancel(false);
        }

        public 
    String getOwner() {
            return 
    ownerName;
        }

        public 
    int getOwnerId() {
            return 
    ownerId;
        }

        public 
    String getDescription() {
            return 
    description;
        }

        public 
    MapleCharacter[] getVisitors() {
            return 
    visitors;
        }

        public List<
    MaplePlayerShopItemgetItems() {
            return 
    Collections.unmodifiableList(items);
        }

        public 
    void addItem(MaplePlayerShopItem item) {
            
    items.add(item);
        }

        public 
    boolean removeItem(int item) {
            
    synchronized (items) {
                if (
    items.contains(item)) {
                    
    items.remove(item);
                    return 
    true;
                }
                return 
    false;
            }
        }

        public 
    void removeFromSlot(int slot) {
            
    items.remove(slot);
        }

        public 
    int getFreeSlot() {
            for (
    int i 03i++) {
                if (
    visitors[i] == null) {
                    return 
    i;
                }
            }
            return -
    1;
        }

        public 
    void setDescription(String description) {
            
    this.description description;
        }

        public 
    boolean isOpen() {
            return 
    this.open;
        }

        public 
    void setOpen(boolean set) {
            
    this.open set;
        }

        public 
    int getItemId() {
            return 
    itemId;
        }

        public 
    boolean isOwner(MapleCharacter chr) {
            return 
    chr.getId() == ownerId && chr.getName().equals(ownerName);
        }

        @
    Override
        
    public void sendDestroyData(MapleClient client) {
            throw new 
    UnsupportedOperationException();
        }

        @
    Override
        
    public MapleMapObjectType getType() {
            return 
    MapleMapObjectType.HIRED_MERCHANT;
        }

        @
    Override
        
    public void sendSpawnData(MapleClient client) {
            
    client.getSession().write(MaplePacketCreator.spawnHiredMerchant(this));
        }
    }


    Now go to *Repack*\src\net\sf\odinms\net\channel\handler
    and create a new .java file called HiredMerchantRequest
    Paste this inside of it:
    Spoiler:
    PHP Code:
    package net.sf.odinms.net.channel.handler;

    import java.util.Arrays;
    import net.sf.odinms.client.MapleClient;
    import net.sf.odinms.net.AbstractMaplePacketHandler;
    import net.sf.odinms.server.maps.MapleMapObjectType;
    import net.sf.odinms.tools.MaplePacketCreator;
    import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;

    /**
     *
     * @author XoticStory
     */
    public class HiredMerchantRequest extends AbstractMaplePacketHandler {

        @
    Override
        
    public void handlePacket(SeekableLittleEndianAccessor sleaMapleClient c) {
            if (
    c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), 23000Arrays.asList(MapleMapObjectType.HIRED_MERCHANT)).size() == 0) {
                if (!
    c.getPlayer().hasMerchant())
                    
    c.getSession().write(MaplePacketCreator.hiredMerchantBox());
                 else
                    
    c.getPlayer().dropMessage(1"You already have a store open.");
            } else
                
    c.getPlayer().dropMessage(1"You cannot open your hired merchant here.");
        }



    Now open up netbeans.
    Click File > Open File
    Browse to *Repack*\src\net\sf\odinms\client\MapleCharacter.java
    Open it.

    Add these to the very top where all the other imports are, ignore the side if it says "Unused import"

    Spoiler:
    PHP Code:
    import java.rmi.RemoteException;
    import java.util.Map.Entry;
    import net.sf.odinms.client.messages.ServernoticeMapleClientMessageCallback;

    import java.awt.Point;
    import java.lang.ref.*;
    import java.sql.*;
    import java.text.*;
    import java.util.*;
    import java.util.Map.*;
    import java.util.concurrent.*;
    import java.util.concurrent.atomic.*;
    import net.sf.odinms.client.anticheat.*;
    import net.sf.odinms.database.*;
    import net.sf.odinms.net.*;
    import net.sf.odinms.net.channel.*;
    import net.sf.odinms.net.world.*;
    import net.sf.odinms.net.world.guild.*;
    import net.sf.odinms.net.world.remote.*;
    import net.sf.odinms.scripting.event.*;
    import net.sf.odinms.server.*;
    import net.sf.odinms.server.life.*;
    import net.sf.odinms.server.maps.*;
    import net.sf.odinms.server.quest.*;
    import net.sf.odinms.tools.*; 


    Then ctrl + f (find) "// private int APQScore;" ( No ""'s )
    Above that put this:
    Spoiler:
    PHP Code:
        private HiredMerchant hiredMerchant null


    Now, Ctrl + F (find)
    PHP Code:
                @Override
                
    public void run() { 
    Under it, directly on the line after the "{" put this:
    Spoiler:
    PHP Code:
                                    HiredMerchant merchant MapleCharacter.this.getHiredMerchant(); // just for safety.
                    
    if (merchant != null) {
                        if (
    merchant.isOwner(MapleCharacter.this)) {
                            
    merchant.setOpen(true);
                        } else {
                            
    merchant.removeVisitor(MapleCharacter.this);
                        }
                    } 


    Now, Ctrl + F (find) " public boolean haveItem " or anything that is "public boolean" or "public void"
    After any of them, put these:
    Spoiler:
    PHP Code:
        public HiredMerchant getHiredMerchant() {
            return 
    hiredMerchant;
        }
        public 
    void setHiredMerchant(HiredMerchant merchant) {
            
    hiredMerchant merchant;
        }

            public 
    boolean hasMerchant() {
            return 
    hasMerchant;
        }


        public 
    void dropMessage(int typeString message) {
            
    client.getSession().write(MaplePacketCreator.serverNotice(typemessage));
        }

        public 
    void setHasMerchant(boolean set) {
            try {
                
    PreparedStatement ps DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET HasMerchant = ? WHERE id = ?");
                
    ps.setInt(1set 0);
                
    ps.setInt(2getId());
                
    ps.executeUpdate();
                
    ps.close();
            } catch (
    SQLException se) {
            }
            
    hasMerchant set;
        } 


    Now Ctrl + F (find) " private boolean Berserk, "
    Replace that line with:
    Spoiler:
    PHP Code:
        private boolean Berserk,  hasMerchant


    You can now minimize Netbeans if you want to.
    Now open *repack*\src\net\sf\odinms\net\channel\handler\PlayerInteractionHandler.java

    First, add these imports.
    Spoiler:
    PHP Code:

    import net
    .sf.odinms.client.IItem;
    import net.sf.odinms.client.MapleCharacter;
    import net.sf.odinms.client.MapleClient;
    import net.sf.odinms.client.MapleInventoryType;
    import net.sf.odinms.net.AbstractMaplePacketHandler;
    import net.sf.odinms.server.MapleInventoryManipulator;
    import net.sf.odinms.server.MapleItemInformationProvider;
    import net.sf.odinms.server.MapleMiniGame;
    import net.sf.odinms.server.MaplePlayerShop;
    import net.sf.odinms.server.MaplePlayerShopItem;
    import net.sf.odinms.server.MapleTrade;
    import net.sf.odinms.server.maps.HiredMerchant;
    import net.sf.odinms.server.maps.MapleMapObject;
    import net.sf.odinms.tools.MaplePacketCreator;
    import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor


    Then, add these to a list of green names.
    The list is right after: private enum Action {

    PHP Code:
          PUT_ITEM(0x1F), 
               
    MERCHANT_BUY(0x20), 
               
    TAKE_ITEM_BACK(0x24), 
               
    MAINTENANCE_OFF(0x25), 
               
    CLOSE_MERCHANT(0x27); 
    Then add this after game.sendMatchCard(c, type);
    ( for ThePack users, everyone else just has to find a place to put it. )

    PHP Code:
                } else if (createType == 5) {
                    
    String desc slea.readMapleAsciiString();
                    
    slea.skip(3);
                    
    int itemId slea.readInt();
                    
    HiredMerchant merchant = new HiredMerchant(c.getPlayer(), itemIddesc);
                    
    c.getPlayer().setHiredMerchant(merchant);
                    
    c.getSession().write(MaplePacketCreator.getHiredMerchant(c.getPlayer(), merchanttrue));
                } else {
                    
    System.out.println("Unhandled PLAYER_INTERACTION packet: " slea.toString());
                }
            } else if (
    mode == Action.INVITE.getCode()) {

                
    int otherPlayer slea.readInt();
                
    MapleCharacter otherChar c.getPlayer().getMap().getCharacterById(otherPlayer);
                
    MapleTrade.inviteTrade(c.getPlayer(), otherChar);
            } else if (
    mode == Action.DECLINE.getCode()) {
                
    MapleTrade.declineTrade(c.getPlayer());
            } else if (
    mode == Action.VISIT.getCode()) {
                if (
    c.getPlayer().getTrade() != null && c.getPlayer().getTrade().getPartner() != null) {
                    
    MapleTrade.visitTrade(c.getPlayer(), c.getPlayer().getTrade().getPartner().getChr());
                } else {
                    
    int oid slea.readInt();
                    
    MapleMapObject ob c.getPlayer().getMap().getMapObject(oid);
                    if (
    ob instanceof MaplePlayerShop) {
                        
    MaplePlayerShop shop = (MaplePlayerShopob;
                        if (
    shop.hasFreeSlot() && !shop.isVisitor(c.getPlayer())) {
                            
    shop.addVisitor(c.getPlayer());
                            
    c.getPlayer().setPlayerShop(shop);
                            
    shop.sendShop(c);
                        }
                    } else if (
    ob instanceof MapleMiniGame) {
                        
    MapleMiniGame game = (MapleMiniGameob;
                        if (
    game.hasFreeSlot() && !game.isVisitor(c.getPlayer())) {
                            if (
    game.getGameType().equals("omok")) {
                                
    game.addVisitor(c.getPlayer());
                                
    c.getPlayer().setMiniGame(game);
                                
    game.sendOmok(cgame.getPieceType());
                            }
                            if (
    game.getGameType().equals("matchcard")) {
                                
    game.addVisitor(c.getPlayer());
                                
    c.getPlayer().setMiniGame(game);
                                
    game.sendMatchCard(cgame.getPieceType());
                            }
                        } else {
                            
    c.getPlayer().getClient().getSession().write(MaplePacketCreator.getMiniGameFull());
                        }
                    } else if (
    ob instanceof HiredMerchant && c.getPlayer().getHiredMerchant() == null) {
                        
    HiredMerchant merchant = (HiredMerchantob;
                        
    c.getPlayer().setHiredMerchant(merchant);
                        if (
    merchant.isOwner(c.getPlayer())) {
                            
    merchant.setOpen(false);
                            
    merchant.removeAllVisitors("");
                            
    c.getSession().write(MaplePacketCreator.getHiredMerchant(c.getPlayer(), merchantfalse));
                        } else {
                            if (!
    merchant.isOpen()) {
                                
    c.getPlayer().dropMessage(1"This shop is in maintenance, please come by later.");
                            } else if (
    merchant.getFreeSlot() == -1) {
                                
    c.getPlayer().dropMessage(1"This shop has reached it's maximum capacity, please come by later.");
                            } else {
                                
    merchant.addVisitor(c.getPlayer());
                                
    c.getSession().write(MaplePacketCreator.getHiredMerchant(c.getPlayer(), merchantfalse));
                            }
                        }
                    }
                }
            } else if (
    mode == Action.CHAT.getCode()) { // chat lol
                
    HiredMerchant merchant c.getPlayer().getHiredMerchant();
                if (
    c.getPlayer().getTrade() != null) {
                    
    c.getPlayer().getTrade().chat(slea.readMapleAsciiString());
                } else if (
    c.getPlayer().getPlayerShop() != null) { //mini game
                    
    MaplePlayerShop shop c.getPlayer().getPlayerShop();
                    if (
    shop != null) {
                        
    shop.chat(cslea.readMapleAsciiString());
                    }
                } else if (
    c.getPlayer().getMiniGame() != null) {
                    
    MapleMiniGame game c.getPlayer().getMiniGame();
                    if (
    game != null) {
                        
    game.chat(cslea.readMapleAsciiString());
                    }
                } else if (
    merchant != null) {
                    
    String message slea.readMapleAsciiString();
                    
    merchant.broadcastToVisitors(MaplePacketCreator.hiredMerchantChat(c.getPlayer().getName() + " : " messagemerchant.getVisitorSlot(c.getPlayer()) + 1));
                }
            } else if (
    mode == Action.EXIT.getCode()) {
                if (
    c.getPlayer().getTrade() != null) {
                    
    MapleTrade.cancelTrade(c.getPlayer());
                } else {
                    
    MaplePlayerShop shop c.getPlayer().getPlayerShop();
                    
    MapleMiniGame game c.getPlayer().getMiniGame();
                    
    HiredMerchant merchant c.getPlayer().getHiredMerchant();
                    if (
    shop != null) {
                        
    c.getPlayer().setPlayerShop(null);
                        if (
    shop.isOwner(c.getPlayer())) {
                            
    c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.removeCharBox(c.getPlayer()));
                            
    shop.removeVisitors();
                            for (
    MaplePlayerShopItem item shop.getItems()) {
                                
    IItem iItem item.getItem().copy();
                                
    iItem.setQuantity((short) (item.getBundles() * iItem.getQuantity()));
                                
    MapleInventoryManipulator.addFromDrop(ciItem""false);
                            }
                        } else {
                            
    shop.removeVisitor(c.getPlayer());
                        }
                    } else if (
    game != null) {
                        
    c.getPlayer().setMiniGame(null);
                        if (
    game.isOwner(c.getPlayer())) {
                            
    c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.removeCharBox(c.getPlayer()));
                            
    game.broadcastToVisitor(MaplePacketCreator.getMiniGameClose((byte0));
                        } else {
                            
    game.removeVisitor(c.getPlayer());
                        }
                    } else if (
    merchant != null) {
                        if (!
    merchant.isOwner(c.getPlayer())) {
                            
    merchant.removeVisitor(c.getPlayer());
                        } else {
                            
    c.getSession().write(MaplePacketCreator.hiredMerchantVisitorLeave(0true));
                        }
                        
    c.getPlayer().setHiredMerchant(null);
                    }
                }
            } else if (
    mode == Action.OPEN.getCode()) {
                
    MaplePlayerShop shop c.getPlayer().getPlayerShop();
                
    HiredMerchant merchant c.getPlayer().getHiredMerchant();
                if (
    shop != null && shop.isOwner(c.getPlayer())) {
                    
    slea.readByte();//01
                    
    c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.addCharBox(c.getPlayer(), 4));
                } else if (
    merchant != null && merchant.isOwner(c.getPlayer())) {
                    
    c.getPlayer().setHasMerchant(true);
                    
    merchant.setOpen(true);
                    
    c.getPlayer().getMap().addMapObject(merchant);
                    
    c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.spawnHiredMerchant(merchant));
                    
    slea.readByte();
                } 
    For this one, you will need to open with Netbeans
    Now open up *Repack*\src\net\sf\odinms\net\channel\ChannelServer.java

    First add these imports to the top:
    Spoiler:
    PHP Code:
    import net.sf.odinms.server.AutobanManager;
    import java.awt.Point;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.lang.management.ManagementFactory;
    import java.net.InetSocketAddress;
    import java.rmi.NotBoundException;
    import java.rmi.RemoteException;
    import java.rmi.registry.LocateRegistry;
    import java.rmi.registry.Registry;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.Arrays;
    import java.util.Collection;
    import java.util.Collections;
    import java.util.HashMap;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.Map;
    import java.util.Properties;
    import javax.management.InstanceAlreadyExistsException;
    import javax.management.MBeanRegistrationException;
    import javax.management.MBeanServer;
    import javax.management.MalformedObjectNameException;
    import javax.management.NotCompliantMBeanException;
    import javax.management.ObjectName;
    import javax.rmi.ssl.SslRMIClientSocketFactory;
    import net.sf.odinms.client.MapleCharacter;
    import net.sf.odinms.client.messages.CommandProcessor;
    import net.sf.odinms.database.DatabaseConnection;
    import net.sf.odinms.net.MaplePacket;
    import net.sf.odinms.net.MapleServerHandler;
    import net.sf.odinms.net.PacketProcessor;
    import net.sf.odinms.net.channel.remote.ChannelWorldInterface;
    import net.sf.odinms.net.mina.MapleCodecFactory;
    import net.sf.odinms.net.world.guild.MapleGuild;
    import net.sf.odinms.net.world.guild.MapleGuildCharacter;
    import net.sf.odinms.net.world.guild.MapleGuildSummary;
    import net.sf.odinms.net.world.remote.WorldChannelInterface;
    import net.sf.odinms.net.world.remote.WorldRegistry;
    import net.sf.odinms.provider.MapleDataProviderFactory;
    import net.sf.odinms.scripting.event.EventScriptManager;
    import net.sf.odinms.server.MapleSquad;
    import net.sf.odinms.server.MapleSquadType;
    import net.sf.odinms.server.MapleTrade;
    import net.sf.odinms.server.ShutdownServer;
    import net.sf.odinms.server.TimerManager;
    import net.sf.odinms.server.maps.HiredMerchant;
    import net.sf.odinms.server.maps.MapleMapFactory;
    import net.sf.odinms.tools.MaplePacketCreator;
    import net.sf.odinms.server.maps.MapMonitor;
    import net.sf.odinms.server.maps.MapleMapObject;
    import net.sf.odinms.server.maps.MapleMapObjectType;
    import org.apache.mina.common.ByteBuffer;
    import org.apache.mina.common.CloseFuture;
    import org.apache.mina.common.IoAcceptor;
    import org.apache.mina.common.SimpleByteBufferAllocator;
    import org.apache.mina.filter.codec.ProtocolCodecFilter;
    import org.apache.mina.transport.socket.nio.SocketAcceptor;
    import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory


    Then Ctrl + F (find) "
    PHP Code:
        @Override
        
    public void run() { 
    "

    And then put your curser after the "{" and hit "enter"
    Then paste this right there:

    Spoiler:
    PHP Code:
                            for (ChannelServer channel getAllInstances()) {
                        for (
    int i 910000001<= 910000022i++) {
                            for (
    MapleMapObject obj channel.getMapFactory().getMap(i).getMapObjectsInRange(new Point(00), Double.POSITIVE_INFINITYArrays.asList(MapleMapObjectType.HIRED_MERCHANT))) {
                                
    HiredMerchant hm = (HiredMerchantobj;
                                
    hm.closeShop(true);
                            }
                        }
                        for (
    MapleCharacter mc channel.getPlayerStorage().getAllCharacters()) {
                            
    mc.saveToDB(true);
                        }
                            } 


    You can now minimize Netbeans again.
    Now open up *repack*\src\net\sf\odinms\net\channel\handler\ChangeChannelHandler.java

    Add these imports to the top:
    Spoiler:
    PHP Code:
    import java.net.InetAddress;
    import java.rmi.RemoteException;
    import net.sf.odinms.client.MapleBuffStat;
    import net.sf.odinms.client.MapleClient;
    import net.sf.odinms.net.AbstractMaplePacketHandler;
    import net.sf.odinms.net.MaplePacket;
    import net.sf.odinms.net.channel.ChannelServer;
    import net.sf.odinms.net.world.MapleMessengerCharacter;
    import net.sf.odinms.net.world.remote.WorldChannelInterface;
    import net.sf.odinms.server.MapleTrade;
    import net.sf.odinms.tools.MaplePacketCreator;
    import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;

    import java.net.InetAddress;
    import java.rmi.RemoteException;
    import net.sf.odinms.client.MapleBuffStat;
    import net.sf.odinms.client.MapleClient;
    import net.sf.odinms.net.AbstractMaplePacketHandler;
    import net.sf.odinms.net.world.MapleMessengerCharacter;
    import net.sf.odinms.server.MapleTrade;
    import net.sf.odinms.server.maps.HiredMerchant;
    import net.sf.odinms.tools.MaplePacketCreator;
    import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor


    Then Ctrl + F (find)
    "
    PHP Code:
            c.getPlayer().saveToDB(true);
            if (
    c.getPlayer().getCheatTracker() != null)
                
    c.getPlayer().getCheatTracker().dispose(); 
    "
    Put your cursor after the very last ";" and hit "enter" then paste this there:
    Spoiler:
    PHP Code:
            HiredMerchant merchant c.getPlayer().getHiredMerchant();
            if (
    merchant != null) {
                if (
    merchant.isOwner(c.getPlayer())) {
                    
    merchant.setOpen(true);
                } else {
                    
    merchant.removeVisitor(c.getPlayer());
                }
            } 


    Now open *repacks*\src\net\sf\odinms\scripting\npc\NPCConversationManager.java

    Add these imports to the top:
    Spoiler:
    PHP Code:
    import java.awt.Point;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Calendar;
    import java.util.LinkedList;
    import java.util.List;
    import net.sf.odinms.client.IItem;
    import net.sf.odinms.client.Item;
    import net.sf.odinms.client.MapleCharacter;
    import net.sf.odinms.client.MapleClient;
    import net.sf.odinms.client.MapleInventory;
    import net.sf.odinms.client.MapleInventoryType;
    import net.sf.odinms.client.MapleJob;
    import net.sf.odinms.client.SkillFactory;
    import net.sf.odinms.scripting.AbstractPlayerInteraction;
    import net.sf.odinms.scripting.event.EventManager;
    import net.sf.odinms.server.MapleInventoryManipulator;
    import net.sf.odinms.server.MapleItemInformationProvider;
    import net.sf.odinms.server.MapleShopFactory;
    import net.sf.odinms.server.quest.MapleQuest;
    import net.sf.odinms.tools.MaplePacketCreator;
    import net.sf.odinms.client.MapleStat;
    import net.sf.odinms.net.world.guild.MapleGuild;
    import net.sf.odinms.server.MapleSquad;
    import net.sf.odinms.server.MapleSquadType;
    import net.sf.odinms.server.maps.MapleMap;
    import java.util.Map;
    import java.util.Map.Entry;
    import java.util.Random;
    import net.sf.odinms.client.ExpTable;
    import net.sf.odinms.client.ISkill;
    import net.sf.odinms.client.MapleBuffStat;
    import net.sf.odinms.client.MaplePet;
    import net.sf.odinms.net.channel.ChannelServer;
    import net.sf.odinms.net.world.MapleParty;
    import net.sf.odinms.net.world.MaplePartyCharacter;
    import net.sf.odinms.server.life.MapleLifeFactory;
    import net.sf.odinms.server.life.MapleMonster;
    import net.sf.odinms.server.life.MapleMonsterStats;
    import net.sf.odinms.server.life.MapleNPC;
    import net.sf.odinms.server.maps.MapleMapFactory;
    import net.sf.odinms.server.maps.MapleMapObject;
    import net.sf.odinms.server.maps.MapleMapObjectType;
    import net.sf.odinms.tools.Pair;
    import java.awt.Point
    import net.sf.odinms.server.life.MapleLifeFactory;
    import net.sf.odinms.server.life.MapleMonster;
    import net.sf.odinms.server.life.MapleMonsterStats;
    import java.awt.Point;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.*;
    import net.sf.odinms.scripting.AbstractPlayerInteraction;
    import net.sf.odinms.scripting.event.EventManager;
    import net.sf.odinms.server.quest.MapleQuest;
    import net.sf.odinms.tools.MaplePacketCreator;
    import net.sf.odinms.net.world.guild.MapleGuild;
    import net.sf.odinms.server.*;
    import net.sf.odinms.client.*;
    import net.sf.odinms.database.DatabaseConnection;
    import net.sf.odinms.net.channel.ChannelServer;
    import net.sf.odinms.net.world.*;
    import net.sf.odinms.server.maps.*;
    import net.sf.odinms.tools.Pair


    Now, Ctrl + F (find):
    PHP Code:
        public int getDayOfWeek() {
            return 
    Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
        } 
    Put your cursor after the "}" and press enter then paste this:
    Spoiler:
    PHP Code:
        public void removeHiredMerchantItem(int id) {
            try {
                
    PreparedStatement ps DatabaseConnection.getConnection().prepareStatement("DELETE FROM hiredmerchant WHERE id = ?");
                
    ps.setInt(1id);
                
    ps.executeUpdate();
                
    ps.close();
            } catch (
    Exception e) {
            }
        }

        public 
    int getHiredMerchantMesos() {
            
    int mesos;
            try {
                
    PreparedStatement ps DatabaseConnection.getConnection().prepareStatement("SELECT MerchantMesos FROM characters WHERE id = ?");
                
    ps.setInt(1getPlayer().getId());
                
    ResultSet rs ps.executeQuery();
                
    rs.next();
                
    mesos rs.getInt("MerchantMesos");
                
    rs.close();
                
    ps.close();
            } catch (
    Exception e) {
                return 
    0;
            }
            return 
    mesos;
        }

        public 
    void zeroMerchantMesos() {
            try {
                
    PreparedStatement ps DatabaseConnection.getConnection().prepareStatement("UPDATE characters SET MerchantMesos = 0 WHERE id = ?");
                
    ps.setInt(1getPlayer().getId());
                
    ps.executeUpdate();
                
    ps.close();
            } catch (
    Exception e) {
            }
        }

        public List<
    Pair<IntegerIItem>> getHiredMerchantItems() {
            List<
    Pair<IntegerIItem>> items = new ArrayList<Pair<IntegerIItem>>();
            try {
                
    PreparedStatement ps DatabaseConnection.getConnection().prepareStatement("SELECT * FROM hiredmerchant WHERE ownerid = ?");
                
    ps.setInt(1getPlayer().getId());
                
    ResultSet rs ps.executeQuery();
                while (
    rs.next()) {
                    if (
    rs.getInt("type") == 1) {
                        
    Equip eq = new Equip(rs.getInt("itemid"), (byte0, -1);
                        
    eq.setUpgradeSlots((byters.getInt("upgradeslots"));
                        
    eq.setLevel((byters.getInt("level"));
                        
    eq.setStr((shortrs.getInt("str"));
                        
    eq.setDex((shortrs.getInt("dex"));
                        
    eq.setInt((shortrs.getInt("int"));
                        
    eq.setLuk((shortrs.getInt("luk"));
                        
    eq.setHp((shortrs.getInt("hp"));
                        
    eq.setMp((shortrs.getInt("mp"));
                        
    eq.setWatk((shortrs.getInt("watk"));
                        
    eq.setMatk((shortrs.getInt("matk"));
                        
    eq.setWdef((shortrs.getInt("wdef"));
                        
    eq.setMdef((shortrs.getInt("mdef"));
                        
    eq.setAcc((shortrs.getInt("acc"));
                        
    eq.setAvoid((shortrs.getInt("avoid"));
                        
    eq.setHands((shortrs.getInt("hands"));
                        
    eq.setSpeed((shortrs.getInt("speed"));
                        
    eq.setJump((shortrs.getInt("jump"));
                        
    eq.setOwner(rs.getString("owner"));
                        
    items.add(new Pair<IntegerIItem>(rs.getInt("id"), eq));
                    } else if (
    rs.getInt("type") == 2) {
                        
    Item newItem = new Item(rs.getInt("itemid"), (byte0, (shortrs.getInt("quantity"));
                        
    newItem.setOwner(rs.getString("owner"));
                        
    items.add(new Pair<IntegerIItem>(rs.getInt("id"), newItem));
                    }
                }
                
    ps.close();
                
    rs.close();
            } catch (
    SQLException se) {
                return 
    null;
            }
            return 
    items;
        } 

    You will need Netbeans for this one.
    Open up *Repack*\src\net\sf\odinms\tools\MaplePacketCreator.java

    Add these imports to the top:
    Spoiler:
    PHP Code:
    import java.util.Map.Entry;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import net.sf.odinms.client.IEquip.ScrollResult;
    import net.sf.odinms.net.channel.handler.SummonDamageHandler.SummonAttackEntry;

    import java.awt.*;
    import java.net.*;
    import java.util.*;
    import java.util.List;
    import java.util.Map.*;
    import java.sql.*;
    import net.sf.odinms.client.*;
    import net.sf.odinms.client.IEquip.*;
    import net.sf.odinms.client.status.*;
    import net.sf.odinms.database.*;
    import net.sf.odinms.net.*;
    import net.sf.odinms.net.channel.handler.SummonDamageHandler.*;
    import net.sf.odinms.net.login.*;
    import net.sf.odinms.net.world.*;
    import net.sf.odinms.server.movement.*;
    import net.sf.odinms.tools.data.output.*;
    import net.sf.odinms.net.world.guild.*;
    import net.sf.odinms.server.life.*;
    import net.sf.odinms.server.maps.*;
    import net.sf.odinms.server.*; 


    Now, scroll to the bottom and youll see a bunch of public static .... just find the end of one and paste this after it:
    Spoiler:
    PHP Code:
        public static MaplePacket getHiredMerchant(MapleClient cMapleMiniGame minigameboolean ownerint piece) {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
            
    mplew.write(HexTool.getByteArrayFromHexString("05 05 04 00 00 71 C0 4C 00"));
            
    mplew.writeMapleAsciiString("Hired Merchant");
            
    mplew.write(0xFF);
            
    mplew.write(0);
            
    mplew.write(0);
            
    mplew.writeMapleAsciiString("MyDexIsBroke");
            
    mplew.write(HexTool.getByteArrayFromHexString("1F 7E 00 00 00 00 00 00 00 00 03 00 31 32 33 10 00 00 00 00 01 01 00 01 00 7B 00 00 00 02 52 8C 1E 00 00 00 80 05 BB 46 E6 17 02 01 00 00 00 00 00"));
            return 
    mplew.getPacket();
        }
        public static 
    MaplePacket hiredMerchantBox() {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(0x2F); // header.
            
    mplew.write(0x07);
            return 
    mplew.getPacket();
        }

        public static 
    MaplePacket getHiredMerchant(MapleCharacter chrHiredMerchant hmboolean firstTime) {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue()); // header.
            
    mplew.write(HexTool.getByteArrayFromHexString("05 05 04"));
            
    mplew.write(hm.isOwner(chr) ? 1);
            
    mplew.write(0);
            
    mplew.writeInt(hm.getItemId());
            
    mplew.writeMapleAsciiString("Hired Merchant");
            for (
    int i 03i++) {
                if (
    hm.getVisitors()[i] != null) {
                    
    mplew.write(1);
                    
    addCharLook(mplewhm.getVisitors()[i], false);
                    
    mplew.writeMapleAsciiString(hm.getVisitors()[i].getName());
                }
            }
            
    mplew.write(0xFF);
            
    mplew.writeShort(0);
            
    mplew.writeMapleAsciiString(hm.getOwner());
            if (
    hm.isOwner(chr)) {
                
    mplew.writeInt(Integer.MAX_VALUE); // contains timing, suck my dick we dont need this
                
    mplew.write(firstTime 0);
                
    mplew.write(HexTool.getByteArrayFromHexString("00 00 00 00 00"));
            }
            
    mplew.writeMapleAsciiString(hm.getDescription());
            
    mplew.write(0x10);
            
    mplew.writeInt(0);
            
    mplew.write(hm.getItems().size());
            if (
    hm.getItems().size() == 0) {
                
    mplew.write(0);
            } else {
                for (
    MaplePlayerShopItem item hm.getItems()) {
                    
    mplew.writeShort(item.getBundles());
                    
    mplew.writeShort(item.getItem().getQuantity());
                    
    mplew.writeInt(item.getPrice());
                    
    addItemInfo(mplewitem.getItem(), truetrue);
                }
            }
            return 
    mplew.getPacket();
        }

        public static 
    MaplePacket hiredMerchantUpdate(HiredMerchant hm) {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
            
    mplew.write(0x17);
            
    mplew.writeInt(0);
            
    mplew.write(hm.getItems().size());
            for (
    MaplePlayerShopItem item hm.getItems()) {
                
    mplew.writeShort(item.getBundles());
                
    mplew.writeShort(item.getItem().getQuantity());
                
    mplew.writeInt(item.getPrice());
                
    addItemInfo(mplewitem.getItem(), truetrue);
            }
            return 
    mplew.getPacket();
        }

        public static 
    MaplePacket hiredMerchantChat(String messageint slot) {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
            
    mplew.write(HexTool.getByteArrayFromHexString("06 08"));
            
    mplew.write(slot);
            
    mplew.writeMapleAsciiString(message);
            return 
    mplew.getPacket();
        }

        public static 
    MaplePacket hiredMerchantVisitorLeave(int slotboolean owner) {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
            
    mplew.write(0x0A);
            if (!
    owner) {
                
    mplew.write(slot);
            }
            return 
    mplew.getPacket();
        }

        public static 
    MaplePacket hiredMerchantForceLeave2() {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
            
    mplew.write(0x0A);
            
    mplew.write(HexTool.getByteArrayFromHexString("00 10"));
            return 
    mplew.getPacket();
        }

        public static 
    MaplePacket hiredMerchantForceLeave1() {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
            
    mplew.write(0x0A);
            
    mplew.write(HexTool.getByteArrayFromHexString("01 0D"));
            return 
    mplew.getPacket();
        }

        public static 
    MaplePacket hiredMerchantVisitorAdd(MapleCharacter chrint slot) {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION.getValue());
            
    mplew.write(0x04);
            
    mplew.write(slot);
            
    addCharLook(mplewchrfalse);
            
    mplew.writeMapleAsciiString(chr.getName());
            return 
    mplew.getPacket();
        }

        public static 
    MaplePacket spawnHiredMerchant(HiredMerchant hm) {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.SPAWN_HIRED_MERCHANT.getValue());
            
    mplew.writeInt(hm.getOwnerId());
            
    mplew.writeInt(hm.getItemId());
            
    mplew.writeShort((shorthm.getPosition().getX());
            
    mplew.writeShort((shorthm.getPosition().getY());
            
    mplew.writeShort(0);
            
    mplew.writeMapleAsciiString(hm.getOwner());
            
    mplew.write(0x05);
            
    mplew.writeInt(hm.getObjectId());
            
    mplew.writeMapleAsciiString(hm.getDescription());
            
    mplew.write(hm.getItemId() % 10);
            
    mplew.write(HexTool.getByteArrayFromHexString("01 04"));
            return 
    mplew.getPacket();
        }

        public static 
    MaplePacket destroyHiredMerchant(int id) {
            
    MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            
    mplew.writeShort(SendPacketOpcode.DESTROY_HIRED_MERCHANT.getValue());
            
    mplew.writeInt(id);
            return 
    mplew.getPacket();
        } 


    You can minimize Netbeans again.
    Now, open up *repack*\src\net\sf\odinms\client\MapleClient.java

    Add these imports to the top:
    Spoiler:
    PHP Code:
    import java.rmi.RemoteException;
    import net.sf.odinms.server.maps.FakeCharacter;
    import java.sql.*;
    import java.util.*;
    import java.util.concurrent.ScheduledFuture;
    import javax.script.ScriptEngine;
    import net.sf.odinms.client.messages.MessageCallback;
    import net.sf.odinms.database.DatabaseConnection;
    import net.sf.odinms.database.DatabaseException;
    import net.sf.odinms.net.channel.ChannelServer;
    import net.sf.odinms.net.login.LoginServer;
    import net.sf.odinms.net.world.MapleMessengerCharacter;
    import net.sf.odinms.net.world.MaplePartyCharacter;
    import net.sf.odinms.net.world.PartyOperation;
    import net.sf.odinms.net.world.guild.MapleGuildCharacter;
    import net.sf.odinms.net.world.remote.WorldChannelInterface;
    import net.sf.odinms.scripting.npc.NPCScriptManager;
    import net.sf.odinms.scripting.npc.NPCConversationManager;
    import net.sf.odinms.scripting.quest.QuestScriptManager;
    import net.sf.odinms.scripting.quest.QuestActionManager;
    import net.sf.odinms.server.MapleTrade;
    import net.sf.odinms.server.TimerManager;
    import net.sf.odinms.server.maps.HiredMerchant;
    import net.sf.odinms.tools.IPAddressTool;
    import net.sf.odinms.tools.MapleAESOFB;
    import net.sf.odinms.tools.MaplePacketCreator;
    import net.sf.odinms.tools.Pair;
    import org.apache.mina.common.IoSession;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory


    Now, Ctrl + F (find):
    PHP Code:
                chr.cancelAllBuffs();
                if (
    chr.getEventInstance() != null) {
                    
    chr.getEventInstance().playerDisconnected(chr);
                } 
    Place your cursor after the last ";" and hit "enter" then paste this:
    Spoiler:
    PHP Code:
                HiredMerchant merchant chr.getHiredMerchant();
                if (
    merchant != null) {
                    if (
    merchant.isOwner(chr)) {
                        
    merchant.setOpen(true);
                    } else {
                        
    merchant.removeVisitor(chr);
                    }
                } 


    Now open up *repack*\src\net\sf\odinms\net\PacketProcessor.java

    Add these imports to the top:
    Spoiler:
    PHP Code:
    import net.sf.odinms.net.handler.KeepAliveHandler;
    import net.sf.odinms.net.handler.LoginRequiringNoOpHandler;
    import net.sf.odinms.net.channel.handler.*;
    import net.sf.odinms.net.login.handler.*;

    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;

    import net.sf.odinms.net.handler.KeepAliveHandler;
    import net.sf.odinms.net.handler.LoginRequiringNoOpHandler;
    import net.sf.odinms.net.channel.handler.*;
    import net.sf.odinms.net.login.handler.*;
    import org.slf4j.LoggerFactory


    Now, Ctrl + F (find) " } else if (mode == Mode.CHANNELSERVER) { "
    Now, under it you should see a lot of registerHandler...... just paste it anywhere between any two as long as its below the CHANNELSERVER:

    Spoiler:
    PHP Code:
                registerHandler(RecvPacketOpcode.HIRED_MERCHANT_REQUEST, new HiredMerchantRequest()); 


    Now open up *repack*\src\net\sf\odinms\net\RecvPacketOpcode.java

    You should see a long list of things just put this in between any two:

    Spoiler:
    PHP Code:
        HIRED_MERCHANT_REQUEST


    You'll need netbeans for this one.
    Open up *repack*\src\net\sf\odinms\net\SendPacketOpcode.java

    You should see another long list, jsut add this between any two:

    Spoiler:
    PHP Code:
        SPAWN_HIRED_MERCHANTDESTROY_HIRED_MERCHANT


    Now open ( your still in netbeans ) *repack*\src\net\sf\odinms\server\maps\MapleMap.java

    Add these imports to the top:

    Spoiler:
    PHP Code:
    import java.rmi.RemoteException;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import net.sf.odinms.net.channel.pvp.MaplePvp;
    import net.sf.odinms.database.DatabaseConnection;
    import net.sf.odinms.client.messages.MessageCallback;


    import java.awt.Point;
    import java.awt.Rectangle;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Collection;
    import java.util.Collections;
    import java.util.HashMap;
    import java.util.HashSet;
    import java.util.LinkedHashMap;
    import java.util.LinkedHashSet;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.Map;
    import java.util.Random;
    import java.util.Set;
    import java.util.concurrent.ScheduledFuture;
    import java.util.concurrent.atomic.AtomicInteger;
    import java.util.Calendar;
    import net.sf.odinms.client.Equip;
    import net.sf.odinms.client.IItem;
    import net.sf.odinms.client.Item;
    import net.sf.odinms.client.MapleBuffStat;
    import net.sf.odinms.client.MapleCharacter;
    import net.sf.odinms.client.MapleClient;
    import net.sf.odinms.client.MapleInventoryType;
    import net.sf.odinms.client.MaplePet;
    import net.sf.odinms.client.SkillFactory;
    import net.sf.odinms.client.status.MonsterStatus;
    import net.sf.odinms.client.status.MonsterStatusEffect;
    import net.sf.odinms.net.MaplePacket;
    import net.sf.odinms.net.channel.ChannelServer;
    import net.sf.odinms.net.world.MaplePartyCharacter;
    import net.sf.odinms.server.MapleItemInformationProvider;
    import net.sf.odinms.server.MaplePortal;
    import net.sf.odinms.server.MapleStatEffect;
    import net.sf.odinms.server.TimerManager;
    import net.sf.odinms.server.life.MapleMonster;
    import net.sf.odinms.server.life.MapleNPC;
    import net.sf.odinms.server.life.SpawnPoint;
    import net.sf.odinms.tools.MaplePacketCreator;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory


    Now Ctrl + F (find) "
    PHP Code:
                case NPC:
                case 
    PLAYER
    Put your mouse after the last ":" and hit "enter" and paste this:
    Spoiler:
    [php] case HIRED_MERCHANT:[PHP]


    You can now minimize Netbeans.
    Were almost done!
    Now, open up *repack*\src\net\sf\odinms\server\maps\MapleMapObjectType.java

    In the long list, add this in between two other ones:

    Spoiler:
    PHP Code:
    HIRED_MERCHANT


    Now compile and you are done with the JAVA part!

    Have ERRORS? Post them and i'll try to help.

    SQL ( NEEDED ):
    PHP Code:
    DROP TABLE IF EXISTS `odinms`.`hiredmerchant`;
    CREATE TABLE  `odinms`.`hiredmerchant` (
      `
    idint(11NOT NULL auto_increment,
      `
    owneridint(11) default '0',
      `
    itemidint(10unsigned NOT NULL default '0',
      `
    quantityint(10unsigned NOT NULL default '0',
      `
    upgradeslotsint(11) default '0',
      `
    levelint(11) default '0',
      `
    strint(11) default '0',
      `
    dexint(11) default '0',
      `
    intint(11) default '0',
      `
    lukint(11) default '0',
      `
    hpint(11) default '0',
      `
    mpint(11) default '0',
      `
    watkint(11) default '0',
      `
    matkint(11) default '0',
      `
    wdefint(11) default '0',
      `
    mdefint(11) default '0',
      `
    accint(11) default '0',
      `
    avoidint(11) default '0',
      `
    handsint(11) default '0',
      `
    speedint(11) default '0',
      `
    jumpint(11) default '0',
      `
    ownervarchar(13) default '',
      `
    typetinyint(1unsigned NOT NULL,
      
    PRIMARY KEY  (`id`)
    ENGINE=InnoDB AUTO_INCREMENT=DEFAULT CHARSET=latin1;

    ALTER TABLE `charactersADD COLUMN `MerchantMesosint(11) default '0';
    ALTER TABLE `charactersADD COLUMN `HasMerchanttinyint(1) default '0'

    Credits:
    PHP Code:
    100MrMysterious
    All i did was show you where to put it
    .
    No i did not take this guide from anywhere
    Last edited by xXSnipeDownOo; 04-07-10 at 08:56 PM. Reason: Added downloads, moved downlaods to the top


  2. #2
    ѕнαяιηgαη мαѕтєя -υ¢нιнαвℓα∂є- is offline
    MemberRank
    Oct 2009 Join Date
    υ¢нιнα нLocation
    309Posts

    Re: Fully Working Hired Merchants

    Very nice.

  3. #3
    Account Upgraded | Title Enabled! sident is offline
    MemberRank
    Oct 2008 Join Date
    my houseLocation
    267Posts

    Re: Fully Working Hired Merchants

    very, very nice.

  4. #4
    may web.very maple.pls. iAkira is offline
    MemberRank
    Aug 2009 Join Date
    somewhere..Location
    2,378Posts

    Re: Fully Working Hired Merchants

    Seem usefull a bit o-O but wasn't this made by Beng(MrMysterious)

  5. #5
    -Error- xXSnipeDownOo is offline
    MemberRank
    Jul 2010 Join Date
    885Posts

    Re: Fully Working Hired Merchants

    Quote Originally Posted by iAkira View Post
    Seem usefull a bit o-O but wasn't this made by Beng(MrMysterious)
    No i got all the files from ThePackII and put them into ThePack. I just couldn't find out how to do it/ a thread on what to do. So i basicly leeched, but eh. If it helps one person thats good enough for me.

  6. #6
    may web.very maple.pls. iAkira is offline
    MemberRank
    Aug 2009 Join Date
    somewhere..Location
    2,378Posts

    Re: Fully Working Hired Merchants

    Quote Originally Posted by xXSnipeDownOo View Post
    No i got all the files from ThePackII and put them into ThePack. I just couldn't find out how to do it/ a thread on what to do. So i basicly leeched, but eh. If it helps one person thats good enough for me.
    But, I think Moogra never made this o-O

  7. #7
    -Error- xXSnipeDownOo is offline
    MemberRank
    Jul 2010 Join Date
    885Posts

    Re: Fully Working Hired Merchants

    Quote Originally Posted by iAkira View Post
    But, I think Moogra never made this o-O
    Mmhmm you were right MrMysterious aka beng. Made the files, credits applied accordingly.
    Last edited by xXSnipeDownOo; 01-07-10 at 11:32 PM.

  8. #8
    Account Upgraded | Title Enabled! Cappe is offline
    MemberRank
    Aug 2008 Join Date
    330Posts

    Re: Fully Working Hired Merchants

    Off-topic: Hai NotFlav

    O-t. These ain't 100% ;)
    But it works.

  9. #9
    -Error- xXSnipeDownOo is offline
    MemberRank
    Jul 2010 Join Date
    885Posts

    Re: Fully Working Hired Merchants

    Quote Originally Posted by Cappe View Post
    Off-topic: Hai NotFlav

    O-t. These ain't 100% ;)
    But it works.
    What do you mean its not 100% whats missing?

  10. #10
    Infraction Banned =-=Thomas=-= is offline
    MemberRank
    Sep 2009 Join Date
    282Posts

    Re: Fully Working Hired Merchants

    wait this is for v.62 or all versions?

  11. #11
    -Error- xXSnipeDownOo is offline
    MemberRank
    Jul 2010 Join Date
    885Posts

    Re: Fully Working Hired Merchants

    Quote Originally Posted by {thomas} View Post
    wait this is for v.62 or all versions?
    Ive used on V62 but idk about all versions

  12. #12
    Account Upgraded | Title Enabled! XiuzSu is offline
    MemberRank
    Mar 2009 Join Date
    c.getXiuzSu.posLocation
    826Posts

    Re: Fully Working Hired Merchants

    FYI: Instead of adding unused imports and importing unneeded files by use ' * ' you can just right click and select "Fix imports".
    That will add the imports it needs and remove the unused ones without having to import every file of the folder.

  13. #13
    -Error- xXSnipeDownOo is offline
    MemberRank
    Jul 2010 Join Date
    885Posts

    Re: Fully Working Hired Merchants

    Quote Originally Posted by XiuzSu View Post
    FYI: Instead of adding unused imports and importing unneeded files by use ' * ' you can just right click and select "Fix imports".
    That will add the imports it needs and remove the unused ones without having to import every file of the folder.
    Yes, i know. I'll update that Asap

  14. #14
    Member born996 is offline
    MemberRank
    Oct 2008 Join Date
    58Posts

    Re: Fully Working Hired Merchants

    Quote Originally Posted by XiuzSu View Post
    FYI: Instead of adding unused imports and importing unneeded files by use ' * ' you can just right click and select "Fix imports".
    That will add the imports it needs and remove the unused ones without having to import every file of the folder.
    Netbeans>> "Ctrl + Shift + i" FTW :)

  15. #15
    Novice ThirstyWalrus is offline
    MemberRank
    Jul 2010 Join Date
    Austin TXLocation
    2Posts

    Re: Fully Working Hired Merchants

    Very nice.



Page 1 of 3 123 LastLast

Advertisement