MapleSolaxia || Blocking Cash Shop Items & ReloadMap

Results 1 to 7 of 7
  1. #1
    Elite Member Modify is offline
    Member +Rank
    Dec 2013 Join Date
    636f6f6b696573Location
    140Posts

    config MapleSolaxia || Blocking Cash Shop Items & ReloadMap

    Hello ~

    Cash Shop:
    I've been trying to block Cash Shop items, but nothing seems to work. In a previous source that I've used (TiredStory), it was as simple and straightforward. I thought trying the same thing with Solaxia source would work too, but I thought wrong. Nothing appears, and I'm still able to purchase items that I've supposedly blocked.

    I've tried
    http://forum.ragezone.com/f566/help-...shshop-840694/

    ReloadMap:
    Similar with the Cash Shop, I've tried MoopleDev reloadmaps as well as other sources, but nothing seems to work. The command seems to only rewarp the character, but not actually load the XML of the map that I'm on.

    I've tried
    http://forum.ragezone.com/f427/reloa...nction-926676/
    http://forum.ragezone.com/f566/reloa...s-xml-1084463/
    Using other ReloadMap functions


    Anyone have any idea on how to make these work? :o Thanks in advance!


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

    Re: MapleSolaxia || Blocking Cash Shop Items & ReloadMap

    Blocking a Cash Item isn't actually that hard, and it shouldn't be different either.

    In CashOperationHandler like usual, you'll see this:
    Code:
    if (action == 0x03 || action == 0x1E) {
    Below it you'll find:
    Code:
    if (cItem == null || !cItem.isOnSale() || cs.getCash(useNX) < cItem.getPrice()) {
                    return;
                }
    You can either add on to it one specific id or a few:
    [code]if (cItem == null || !cItem.isOnSale() || cs.getCash(useNX) < cItem.getPrice() || cItem.getItemId() == XXXX || cItem.getItemId() == YYYY) {
    return;
    }/code]

    Or, you can create a constant in like GameConstants with an integer array of blocked itemID's.
    Code:
    public static final int[] aBlockedCash = {1, 2, 3};//ItemID's here
    and then under that if-statement, you would do:
    Code:
    for (int itemID : GameConstants.aBlockedCash) {
        if (cItem.getItemId() == itemID) {
            return;
        }
    }
    As for reloadMap, I don't see why that should be much different either? In MapleMapFactory of Solaxia, add this function:
    Code:
    public MapleMap disposeMap(int mapId) {
        if (isMapLoaded(mapId)) {
            lock.lock(); //What the Concurrent.
            try {
                final MapleMap remove = maps.remove(mapId);
                List<MapleCharacter> chrs = new ArrayList(remove.getCharacters());
                final MapleMap newMap = getMap(mapId);
                for (MapleCharacter chr : chrs) chr.changeMap(newMap, newMap.getPortal(remove.findClosestSpawnpoint(chr.getPosition()).getId()));
                return newMap;
            } finally {
                lock.unlock();
            }    
        }
        return getMap(mapId);
    }
    Then in your reloadMap function, you should be using this:
    Code:
    public reloadMap(int mid) {
        c.getChannelServer().getMapFactory().disposeMap(mid);
    }
    Just reading by what @kkong1001 replied. I think I had followed that years ago myself, but yeah you have to remove the map from MapleMapFactory's HashMap and then call getMap to reload the XML. That's why you call disposeMap from the factory, and you call that function from the NPC or even a GM Command.

  3. #3
    Elite Member Modify is offline
    Member +Rank
    Dec 2013 Join Date
    636f6f6b696573Location
    140Posts

    Re: MapleSolaxia || Blocking Cash Shop Items & ReloadMap

    Thank you for replying ~

    Regarding the cash shop, I've tried what you suggested as well as tested it, it works after I fixed my slight mistake (Having only one jar file instead of 2), but now it doesn't let me purchase anything else when I try to buy another item.

    tl;dr Cash Shop says get out after trying to buy blocked item

    >>>>>>

    Okay the reloadMap is fixed ~ I just placed
    Code:
    c.getChannelServer().getMapFactory().disposeMap(c.getPlayer().getMap().getId());
    Like you said and it worked like a charm ^o^
    Last edited by Modify; 07-09-16 at 01:43 AM. Reason: Solved ReloadMap Problem

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

    Re: MapleSolaxia || Blocking Cash Shop Items & ReloadMap

    Quote Originally Posted by Modify View Post
    Thank you for replying ~

    Regarding the cash shop, I've tried what you suggested as well as tested it, it works after I fixed my slight mistake (Having only one jar file instead of 2), but now it doesn't let me purchase anything else when I try to buy another item.

    tl;dr Cash Shop says get out after trying to buy blocked item

    >>>>>>

    Okay the reloadMap is fixed ~ I just placed
    Code:
    c.getChannelServer().getMapFactory().disposeMap(c.getPlayer().getMap().getId());
    Like you said and it worked like a charm ^o^
    Well, glad to hear you fixed that. As for the cash shop issue, you need to send the packets to refresh your actions. I forgot the name of it in Odin sources, but look for something they send every time they return. In Lithium I think it's doCSPackets, not sure if it's the same for the older v83 sources. Additionally you could always send a fail packet, that'd work as well (the packets where if purchases fail on server-side it gives a client msg error).

  5. #5
    Elite Member Modify is offline
    Member +Rank
    Dec 2013 Join Date
    636f6f6b696573Location
    140Posts

    Re: MapleSolaxia || Blocking Cash Shop Items & ReloadMap

    Quote Originally Posted by Eric View Post
    Well, glad to hear you fixed that. As for the cash shop issue, you need to send the packets to refresh your actions. I forgot the name of it in Odin sources, but look for something they send every time they return. In Lithium I think it's doCSPackets, not sure if it's the same for the older v83 sources. Additionally you could always send a fail packet, that'd work as well (the packets where if purchases fail on server-side it gives a client msg error).
    This is my current Cash Shop thingy
    Code:
            if (action == 0x03 || action == 0x1E) {            
                slea.readByte();
                final int useNX = slea.readInt();
                final int snCS = slea.readInt();
                CashItem cItem = CashItemFactory.getItem(snCS);
                if (cItem == null || !cItem.isOnSale() || cs.getCash(useNX) < cItem.getPrice() ||
                    cItem.getItemId() >= 5211000 && cItem.getItemId() <= 5211048 || cItem.getItemId() == 5211048) {
                    
                }
                if (action == 0x03) { // Item
                    Item item = cItem.toItem();
                    cs.addToInventory(item);               
                    c.announce(MaplePacketCreator.showBoughtCashItem(item, c.getAccID()));
                } else { // Package
                    List<Item> cashPackage = CashItemFactory.getPackage(cItem.getItemId());
                    for (Item item : cashPackage) {
                        cs.addToInventory(item);
                    }
                    c.announce(MaplePacketCreator.showBoughtCashPackage(cashPackage, c.getAccID()));
                }
                cs.gainCash(useNX, -cItem.getPrice());
                c.announce(MaplePacketCreator.showCash(chr));
                }
    The only 'hint' I've found is placing
    Code:
    c.announce(MaplePacketCreator.enableActions());
    at the end. I saw this quite a bit when people were blocking Cash Shop items :o

    MaplePacketCreator
    Code:
    public static byte[] enableActions() {        
    return updatePlayerStats(EMPTY_STATUPDATE, true, null);
        }
    Not sure it'll work but I'll get back to the post once I see if this will work *-*

    EDIT: It just re-enabled all the items I blocked T^T
    Last edited by Modify; 07-09-16 at 03:35 PM.

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

    Re: MapleSolaxia || Blocking Cash Shop Items & ReloadMap

    @Modify Try this, I've bolded the fix.

    Code:
    if (action == 0x03 || action == 0x1E) {            
                slea.readByte();
                final int useNX = slea.readInt();
                final int snCS = slea.readInt();
                CashItem cItem = CashItemFactory.getItem(snCS);
                if (cItem == null || !cItem.isOnSale() || cs.getCash(useNX) < cItem.getPrice() ||
                    cItem.getItemId() >= 5211000 && cItem.getItemId() <= 5211048 || cItem.getItemId() == 5211048) {
                    c.announce(MaplePacketCreator.showCash(chr));//this should send a packet back to the client and enable your buy options again.
                    return;//if you don't return here it will just continue down and purchase!
                }
                if (action == 0x03) { // Item
                    Item item = cItem.toItem();
                    cs.addToInventory(item);               
                    c.announce(MaplePacketCreator.showBoughtCashItem(item, c.getAccID()));
                } else { // Package
                    List<Item> cashPackage = CashItemFactory.getPackage(cItem.getItemId());
                    for (Item item : cashPackage) {
                        cs.addToInventory(item);
                    }
                    c.announce(MaplePacketCreator.showBoughtCashPackage(cashPackage, c.getAccID()));
                }
                cs.gainCash(useNX, -cItem.getPrice());
                c.announce(MaplePacketCreator.showCash(chr));
                }

  7. #7
    Elite Member Modify is offline
    Member +Rank
    Dec 2013 Join Date
    636f6f6b696573Location
    140Posts

    Re: MapleSolaxia || Blocking Cash Shop Items & ReloadMap

    Quote Originally Posted by Eric View Post
    @Modify Try this, I've bolded the fix.

    Code:
    if (action == 0x03 || action == 0x1E) {            
                slea.readByte();
                final int useNX = slea.readInt();
                final int snCS = slea.readInt();
                CashItem cItem = CashItemFactory.getItem(snCS);
                if (cItem == null || !cItem.isOnSale() || cs.getCash(useNX) < cItem.getPrice() ||
                    cItem.getItemId() >= 5211000 && cItem.getItemId() <= 5211048 || cItem.getItemId() == 5211048) {
                    c.announce(MaplePacketCreator.showCash(chr));//this should send a packet back to the client and enable your buy options again.
                    return;//if you don't return here it will just continue down and purchase!
                }
                if (action == 0x03) { // Item
                    Item item = cItem.toItem();
                    cs.addToInventory(item);               
                    c.announce(MaplePacketCreator.showBoughtCashItem(item, c.getAccID()));
                } else { // Package
                    List<Item> cashPackage = CashItemFactory.getPackage(cItem.getItemId());
                    for (Item item : cashPackage) {
                        cs.addToInventory(item);
                    }
                    c.announce(MaplePacketCreator.showBoughtCashPackage(cashPackage, c.getAccID()));
                }
                cs.gainCash(useNX, -cItem.getPrice());
                c.announce(MaplePacketCreator.showCash(chr));
                }
    It worked like a charm, thank you so much!



Advertisement