[Release] Block items from being purchased in the cash shop

Status
Not open for further replies.
Joined
Nov 30, 2007
Messages
511
Reaction score
0
If you don't want players to buy a certain item when using the cash shop, use this.

In BuyCSItemhandler.java:
Under
Code:
private final static Logger log = LoggerFactory.getLogger(MapleServerHandler.class);

Place
Code:
private final static int[] blockedItems = {1};
-------------
Under
Code:
CashItemInfo item = CashItemFactory.getItem(snCS);

Place
PHP:
             for (int i = 0; i < blockedItems.length; i++) {
                if (item.getId() >= 5211000 && item.getId() <= 5211048 || item.getId() != blockedItems[i]) {
                    c.getPlayer().getClient().getSession().write(broadcastPacket(MaplePacketCreator.serverNotice(1, "You may not purchase this item.")));
                    c.getSession().write(MaplePacketCreator.showNXMapleTokens(c.getPlayer()));
                    c.getSession().write(MaplePacketCreator.enableCSUse0());
                    c.getSession().write(MaplePacketCreator.enableCSUse1());
                    c.getSession().write(MaplePacketCreator.enableCSUse2());
                    c.getSession().write(MaplePacketCreator.enableCSUse3());
                    return;
                }
             }

I've already blocked off 2x EXP cards from being bought, so remove that if you want.
 
Last edited:
So would I just add it again like so. For every item.


Code:
             for (int i = 0; i < blockedItems.length; i++) {
                if (item.getId() >= 5211000 && item.getId() <= 5211048 || item.getId() != blockedItems[i]) {
                    c.getPlayer().getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(1, "You may not purchase this item."));
                    c.getSession().write(MaplePacketCreator.showNXMapleTokens(c.getPlayer()));
                    c.getSession().write(MaplePacketCreator.enableCSUse0());
                    c.getSession().write(MaplePacketCreator.enableCSUse1());
                    c.getSession().write(MaplePacketCreator.enableCSUse2());
                    c.getSession().write(MaplePacketCreator.enableCSUse3());
                    return;
                }
             } 
             for (int i = 0; i < blockedItems.length; i++) {
                if (item.getId() >= 5211000 && item.getId() <= 5211048 || item.getId() != blockedItems[i]) {
                    c.getPlayer().getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(1, "You may not purchase this item."));
                    c.getSession().write(MaplePacketCreator.showNXMapleTokens(c.getPlayer()));
                    c.getSession().write(MaplePacketCreator.enableCSUse0());
                    c.getSession().write(MaplePacketCreator.enableCSUse1());
                    c.getSession().write(MaplePacketCreator.enableCSUse2());
                    c.getSession().write(MaplePacketCreator.enableCSUse3());
                    return;
                }
             }
 
I already released something like that, I think my version is also easier and faster... But still nice... And you don't have to remove every double exp cards...

http://forum.ragezone.com/showthread.php?t=443341
That's to disable them :P
Do you not realize that this is for any item you choose? It's not limited, by any means, to 2x EXP cards. I'm not going to disable them when they already work 100% on my server, I just don't want people buying them like crazy.


So would I just add it again like so. For every item.


Code:
             for (int i = 0; i < blockedItems.length; i++) {
                if (item.getId() >= 5211000 && item.getId() <= 5211048 || item.getId() != blockedItems[i]) {
                    c.getPlayer().getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(1, "You may not purchase this item."));
                    c.getSession().write(MaplePacketCreator.showNXMapleTokens(c.getPlayer()));
                    c.getSession().write(MaplePacketCreator.enableCSUse0());
                    c.getSession().write(MaplePacketCreator.enableCSUse1());
                    c.getSession().write(MaplePacketCreator.enableCSUse2());
                    c.getSession().write(MaplePacketCreator.enableCSUse3());
                    return;
                }
             } 
             for (int i = 0; i < blockedItems.length; i++) {
                if (item.getId() >= 5211000 && item.getId() <= 5211048 || item.getId() != blockedItems[i]) {
                    c.getPlayer().getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(1, "You may not purchase this item."));
                    c.getSession().write(MaplePacketCreator.showNXMapleTokens(c.getPlayer()));
                    c.getSession().write(MaplePacketCreator.enableCSUse0());
                    c.getSession().write(MaplePacketCreator.enableCSUse1());
                    c.getSession().write(MaplePacketCreator.enableCSUse2());
                    c.getSession().write(MaplePacketCreator.enableCSUse3());
                    return;
                }
             }
No, that is NOT what you do. This:
Code:
private final static int[] blockedItems = {1};
is what you put the IDs into. It'll loop through the elements of the array when a person buys an item and if the ID you want blocked is there, the player will be given a popup message and won't be able to buy the item.
 
"You may not purchase this item."

For all of the slow people:
Insert IDs for items you want to block into this array:

private final static int[] blockedItems = {1};

Code:
private final static int[[U]ITEMID?[/U]] blockedItems = {1};
 
Do you not realize that this is for any item you choose? It's not limited, by any means, to 2x EXP cards. I'm not going to disable them when they already work 100% on my server, I just don't want people buying them like crazy.



No, that is NOT what you do. This:
Code:
private final static int[] blockedItems = {1};
is what you put the IDs into. It'll loop through the elements of the array when a person buys an item and if the ID you want blocked is there, the player will be given a popup message and won't be able to buy the item.

Work 100% with expiry dates? Oh snap, people won't have them forever now?! WHERE?!
 
Didn't someone already release this Goofy? Anyway, I already had this for items that could bug your char due to pets :3.
 
Can you give an exapmle where you put your IDs?
Like put in your first post an example that you cant buy penguin and tiger (example)

There IDs is:
5000012
5000023
 
Cool thanks :]
So why we need this?:::

for (int i = 0; i < blockedItems.length; i++) {
if (
item.getId() >= 5211000 && item.getId() <= 5211048 || item.getId() != blockedItems[i]) {
c.getPlayer().getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(1, "You may not purchase this item."));
c.getSession().write(MaplePacketCreator.showNXMapleTokens(c.getPlayer()));
c.getSession().write(MaplePacketCreator.enableCSUse0());
c.getSession().write(MaplePacketCreator.enableCSUse1());
c.getSession().write(MaplePacketCreator.enableCSUse2());
c.getSession().write(MaplePacketCreator.enableCSUse3());
return;
}
}
 
Cool thanks :]
So why we need this?:::

for (int i = 0; i < blockedItems.length; i++) {
if (
item.getId() >= 5211000 && item.getId() <= 5211048 || item.getId() != blockedItems[i]) {
c.getPlayer().getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(1, "You may not purchase this item."));
c.getSession().write(MaplePacketCreator.showNXMapleTokens(c.getPlayer()));
c.getSession().write(MaplePacketCreator.enableCSUse0());
c.getSession().write(MaplePacketCreator.enableCSUse1());
c.getSession().write(MaplePacketCreator.enableCSUse2());
c.getSession().write(MaplePacketCreator.enableCSUse3());
return;
}
}
As I've said, that's to block people from buying 2x EXP cards. It's much easier to simply check to see if it's less than or equal/greater than or equal to an ID when they're all grouped together like EXP cards are.
 
Status
Not open for further replies.
Back