Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

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