• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Cash Shop Help, HeavenMS

Newbie Spellweaver
Joined
Mar 16, 2011
Messages
14
Reaction score
0
Hey guys. How can I go about making items I add into the Cash Shop through WZ files only be able to be purchased by a certain type of point system? Ideally, I'd like to use MaplePoints only, but I'm open to add another point/cash/credits system to the server if need be. --- Also how can I make it so purchased cash items do not expire?
I'm using HeavenMS.
 
Last edited:
Mythic Archon
Joined
Jul 2, 2013
Messages
723
Reaction score
70
Hello,

If you check CashOperationHandler.java, there is a block of code the handlers cash item purchases. Specifically, this is what I am speaking about.

Code:
if (action == 0x03) { // Item
    ....
    Item item = cItem.toItem();
    cs.gainCash(useNX, cItem, chr.getWorld())
    ...
}

If you follow the gainCash function, you can see here the following two functions
Code:
[COLOR=#000000]    public void gainCash(int type, int cash) {[/COLOR]        switch (type) {
            case 1:
                nxCredit += cash;
                break;
            case 2:
                maplePoint += cash;
                break;
            case 4:
                nxPrepaid += cash;
                break;
        }
    }
    
    public void gainCash(int type, CashItem buyItem, int world) {
        gainCash(type, -buyItem.getPrice());
[COLOR=#000000]        ...
}[/COLOR]

As you can probably guess, this is where it deducts the cash / points from the player's balance. The easiest way to make it so an item is only purchasable from a single / specific two points is to add a check before cs.gainCash(...).

For example:
Code:
if (action == 0x03) { // Item
    ....
    Item item = cItem.toItem();
    switch(item.getId()){
         case 1234567: 
             if(useNx == 4){ // disable nxPrepaid for item 1234567
                 return;
              }
     }

    cs.gainCash(useNX, cItem, chr.getWorld())
    ...
}
 
Upvote 0
Initiate Mage
Joined
Oct 15, 2021
Messages
4
Reaction score
0
I encountered a problem after this modification. When I didn't use maplepoint to buy these items, the mall lost its response and didn't respond to anything. I had to quit the mall and enter again to continue buying. How can I solve this problem.
 
Upvote 0
Back
Top