[v117] Blocking CS item

Results 1 to 12 of 12
  1. #1
    Zaytron is offline
    MemberRank
    Nov 2012 Join Date
    320Posts

    [v117] Blocking CS item

    Someone help me , I've tried adding into gameconstants but doesn't help .

    I tried buying a x2 EXP coupon but it's blocked & I get stucked in CS , I don't mind if my cubes are blocked the way the x2 EXP is done though I don't know what have been done. It's based off FuckMs.


    -Edit-
    Another questions , how do I set limits for a Mob Spawner to only spawn 10 and only able to spawn another 10 after all the mobs are cleared in that certain map .
    Last edited by Zaytron; 17-10-13 at 08:37 PM.


  2. #2
    - potimus is offline
    MemberRank
    Dec 2012 Join Date
    Ontario, CanadaLocation
    330Posts

    Re: [v117] Blocking CS item

    Blocking and unblocking CS items is usually contained somewhere in GameConstants, though for FuckMS it could be a totally seperate area. Search the item ID you wish to block / unblock in your source files, and something will come up, just gotta do some looking.

    As for setting the mob spawn and what not, that's going to be mainly wz related - however you can do it without formally "wz editing".

    Most of the time it can be done through the server XML's.

  3. #3
    Zaytron is offline
    MemberRank
    Nov 2012 Join Date
    320Posts

    Re: [v117] Blocking CS item

    Alright, Thanks for your help but for spawner , I'm talking bout NPC scripts sided . Like a FM NPC Spawner.

    If anyone got any other " fixes " for my case , please do help !

    -Edit-
    I've another question again , Is it possible to set !pmob to spawn 1 mob every 6 hours ?

  4. #4
    Proficient Member itai5001 is offline
    MemberRank
    Nov 2012 Join Date
    GarbageLocation
    174Posts

    Re: [v117] Blocking CS item

    Quote Originally Posted by Zaytron View Post
    Alright, Thanks for your help but for spawner , I'm talking bout NPC scripts sided . Like a FM NPC Spawner.

    If anyone got any other " fixes " for my case , please do help !

    -Edit-
    I've another question again , Is it possible to set !pmob to spawn 1 mob every 6 hours ?
    Try it urself, the timing should be 21,600.

    gl

  5. #5
    Zaytron is offline
    MemberRank
    Nov 2012 Join Date
    320Posts

    Re: [v117] Blocking CS item

    Thanks ! I was looking for the exact time for the mob haha .


    I still can't solve the blocking CS item part , I've blocked it . The item when bought says " This item have been blocked " but the item still appear in the inventory . Bump

  6. #6
    Proficient Member itai5001 is offline
    MemberRank
    Nov 2012 Join Date
    GarbageLocation
    174Posts

    Re: [v117] Blocking CS item

    Quote Originally Posted by Zaytron View Post
    Thanks ! I was looking for the exact time for the mob haha .


    I still can't solve the blocking CS item part , I've blocked it . The item when bought says " This item have been blocked " but the item still appear in the inventory . Bump
    At the: check if item is blocked, remove the lines that actually buying this item..

    Or something fimiler according to ur source/repack.

  7. #7
    Zaytron is offline
    MemberRank
    Nov 2012 Join Date
    320Posts

    Re: [v117] Blocking CS item

    I don't get it lol , what do you meant by " At the: check if item is blocked " , where is it located at ? I'll find it myself.

    I'm using FuckMs

  8. #8
    Proficient Member itai5001 is offline
    MemberRank
    Nov 2012 Join Date
    GarbageLocation
    174Posts

    Re: [v117] Blocking CS item

    Quote Originally Posted by Zaytron View Post
    I don't get it lol , what do you meant by " At the: check if item is blocked " , where is it located at ? I'll find it myself.

    I'm using FuckMs
    I don't know, just search for that function in all of ur files.

    Hint: CS file..

    GL..

  9. #9
    Wut. QuietCrystal is offline
    MemberRank
    Aug 2010 Join Date
    SingaporeLocation
    346Posts

    Re: [v117] Blocking CS item

    Quote Originally Posted by Zaytron View Post
    Someone help me , I've tried adding into gameconstants but doesn't help .
    Spoiler:
    Try look for the functions that look like some of the following
    - handlePacket (in net.channel.handler.BuyCSItemHandler in common v83 sources)
    - BuyCashItem (in handling.cashshop.handler.CashShopOperation in Lithium-based (I think) sources. v117)

    Just add a check for the ID, and simply call "return;" without ever giving the item to the player. In v117 it should be
    Code:
    c.getSession().write(CWvsContext.serverNotice(1, "This item cannot be purchased through the cash shop.")
    c.getSession().write(CWvsContext.enableActions());
    return;
    to allow the player to continue to remain in the cash shop, without having to DC.


    Quote Originally Posted by Zaytron View Post
    Another questions , how do I set limits for a Mob Spawner to only spawn 10 and only able to spawn another 10 after all the mobs are cleared in that certain map .
    Spoiler:
    Two solutions I can offer.
    Solution A) Add a variable to mob spawners to count how many mobs it has spawned. Remove it after 10 mobs has spawned. I DO NOT SUGGEST USING THIS

    Solution B) Instead of using mob spawners, go to NPCConversationManager, and add the function "spawnTenSnails" (or whatever you want to call it). Put this in the function:
    Code:
    List<MapleMonster> tempSpawn = new ArrayList<MapleMonster>();
    for (int i = 0; i < 10; i++) {
     MapleMonster tempMob = MapleLifeFactory.getMonster(100100);
     tempSpawn.add(tempMob);
    }
    final List<MapleMonster> toSpawn = tempSpawn;
    for (int i = 0; i < (toSpawn.size() - 1); i++) {
     final int nextIndex = i + 1;
     toSpawn.get(i).addListener(
    	new MonsterListener() {
    		public void monsterKilled() {
    			pqMap.spawnMonsterOnGroudBelow(toSpawn.get(nextIndex), new Point(X, Y));
    		}
    	}
     );
    }
    Change 100100 to the monster ID of your choice.
    If you want to change the number of monsters spawned, just find the line "for (int i = 0; i < 10; i++) {" and change 10 to whatever you want.
    Change X, Y as the location of the spawnPoint.

    Here's a more generalized version you can use:
    Code:
    public void tempSpawnPoint(int mobId, int spawnAmt, int respawnTime, int x, int y)
    	List<MapleMonster> tempSpawn = new ArrayList<MapleMonster>();
    	for (int i = 0; i < spawnAmt; i++) {
    	 MapleMonster tempMob = MapleLifeFactory.getMonster(mobId);
    	 tempSpawn.add(tempMob);
    	}
    	final List<MapleMonster> toSpawn = tempSpawn;
    	final Point spawnPoint = new Point(x, y);
    	for (int i = 0; i < (toSpawn.size() - 1); i++) {
    		final int nextIndex = i + 1;
    		toSpawn.get(i).addListener(
    			new MonsterListener() {
    				public void monsterKilled() {
    					Timer.EventTimer.getInstance().schedule(new Runnable() {
    						@Override
    						public void run() {
    							pqMap.spawnMonsterOnGroudBelow(toSpawn.get(nextIndex), spawnPoint);
    						}
    					}, respawnTime);
    				}
    			);
    		}
    	}
    }
    So just call cm.tempSpawnPoint(<mobId>, <how many times to spawn>, <respawn time>, <x position>, <y position); to start it.

    For example:
    Code:
    cm.tempSpawnPoint(100100, 5, 1000, cm.getPlayer().getPosition().x, cm.getPlayer().getPosition().y);
    will spawn 5 snails. Each one will spawn 1 second (1000 milliseconds) after the previous one dies. Spawn point is set to player's location.

    DISCLAIMER: Code not tested. But it should work. Should.


    Quote Originally Posted by Zaytron View Post
    I've another question again , Is it possible to set !pmob to spawn 1 mob every 6 hours ?
    Spoiler:
    Go to your server's scripts folder, and go into the event folder. Create a new javascript file. For this example I shall use "MonsterParty.js".

    Put enter the following in MonsterParty.js:
    Code:
    function init() {
        scheduleNew();
    }
    
    function scheduleNew() {
        var cal = java.util.Calendar.getInstance();
        cal.set(java.util.Calendar.HOUR, 0);
        cal.set(java.util.Calendar.MINUTE, 0);
        cal.set(java.util.Calendar.SECOND, 0);
        var nextTime = cal.getTimeInMillis();
        while (nextTime <= java.lang.System.currentTimeMillis())
            nextTime += 6 * 60 * 60 * 1000; // 6 hours
        setupTask = em.scheduleAtTimestamp("start", nextTime);
    }
    
    function cancelSchedule() {
        setupTask.cancel(true);
    }
    
    function start() {
        scheduleNew();
        // SPAWN MONSTER CODE HERE. You can code, right? :D
    }
    After that, to make your server run the event, go to ServerConstants, and under their Events variable, add your event:
    Code:
    public static String EVENTS = "automsg TTPQ BossQuest";
    to
    Code:
    public static String EVENTS = "automsg TTPQ BossQuest MonsterParty";
    In older sources, you'll find the list of events in world.properties for easy editing:
    Code:
    net.sf.odinms.channel.events=automsg,TTPQ,BossQuest;
    to
    Code:
    net.sf.odinms.channel.events=automsg,TTPQ,BossQuest,MonsterParty;
    DONE! Now mobs will spawn every 6 hours after the server has started up.
    Last edited by QuietCrystal; 19-10-13 at 02:45 AM.

  10. #10
    Zaytron is offline
    MemberRank
    Nov 2012 Join Date
    320Posts

    Re: [v117] Blocking CS item

    Thanks for helping with the Cash Shop , it worked! As for the mob spawner there seem to be some small errors but I could handle it .
    Finally for the mob every 6 hours , I'll try your way if the pmob command doesn't work well. Thanks a lot.

  11. #11
    Wut. QuietCrystal is offline
    MemberRank
    Aug 2010 Join Date
    SingaporeLocation
    346Posts

    Re: [v117] Blocking CS item

    Errors would arise because different sources name the same functions differently. If you really need help with your source just PM me.

  12. #12
    Account Upgraded | Title Enabled! ooSnowCapxx is offline
    MemberRank
    Jul 2011 Join Date
    250Posts

    Re: [v117] Blocking CS item

    This is way of blocking CS Items.

    Step 1 :
    Open up BuyCSItemHandler.java , which can found in /src/net/sf/odinms/net/channel/handler

    Under (Just incase you've never blocked CS items like this) *YOU DON'T HAVE TO DO THIS UNLESS ITS NOT WORKING WITHOUT IT!*
    Code:
    private final static Logger log = LoggerFactory.getLogger(MapleServerHandler.class
    Place
    Code:
    private final static int[] blockedItems = {1};
    And Under
    Code:
    CashItemInfo item = CashItemFactory.getItem(snCS);
    And Above
    Code:
            if (!c.getPlayer().inCS() || c.getPlayer().getCSPoints(way) < 0 || c.getPlayer().getCSPoints(way) < item.getPrice()) {
    Place
    Code:
                    if (item.getId() >= 5211000 && item.getId() <= 5211048 || item.getId() >= 1112000 && item.getId() <= 1112904 || item.getId() == 5040000 || item.getId() == 5041000 || item.getId() >= 1812002 && item.getId() <= 1812005 || item.getId() >= 1802000 && item.getId() <= 1802037 || item.getId() >= 1812000 && item.getId() <= 1812006 || item.getId() == 1802100) {
                        c.getPlayer().getClient().getSession().write(MaplePacketCreator.serverNotice(1, "You may not purchase this item."));
                        c.getSession().write(MaplePacketCreator.showNXMapleTokens(c.getPlayer()));
                        c.getSession().write(MaplePacketCreator.enableCSUse1());
                        c.getSession().write(MaplePacketCreator.enableCSUse2());
                        c.getSession().write(MaplePacketCreator.enableCSUse3());
                        return;
                    }
    Save & Compile !

    Step 2 :
    Ok, I wrote this Execute code for MySQL its quite long by very easy to use :]

    1. Open up your MySQL Query Browser login to your database obviously..
    2. Paste the following code in the Execute text box, and run both of the lines!

    Run this :
    PHP Code:
    DELETE FROM shopitems WHERE itemid '1802022' || itemid '1802027' || itemid '1802003' || itemid '1802006' || itemid '1802025' || itemid '1802012' || itemid '1802018' || itemid '1802031' || itemid '1802033' || itemid '1802015' || itemid '1802021' || itemid '1802028' || itemid '1802036' || itemid '1802016' || itemid '1802035' || itemid '1802014' || itemid '1802017' || itemid '1802010' || itemid '1802037' || itemid '1802023' || itemid '1802030' || itemid '1802100' || itemid '1802029' || itemid '1802004' || itemid '1802026' || itemid '1802011' || itemid '1802002' || itemid '1802000' || itemid '1802013' || itemid '1802007' || itemid '1802008' || itemid '1802019' || itemid '1802005' || itemid '1802032' || itemid '1802009' || itemid '1802034' || itemid '1802020' || itemid '1802024' || itemid '1802001' || itemid '1812002' || itemid '1812003' || itemid '1812005' || itemid '1812001' || itemid '1812006' || itemid '1812000' || itemid '1812004'
    And then this :

    PHP Code:
    DELETE FROM inventoryitems WHERE itemid '1802022' || itemid '1802027' || itemid '1802003' || itemid '1802006' || itemid '1802025' || itemid '1802012' || itemid '1802018' || itemid '1802031' || itemid '1802033' || itemid '1802015' || itemid '1802021' || itemid '1802028' || itemid '1802036' || itemid '1802016' || itemid '1802035' || itemid '1802014' || itemid '1802017' || itemid '1802010' || itemid '1802037' || itemid '1802023' || itemid '1802030' || itemid '1802100' || itemid '1802029' || itemid '1802004' || itemid '1802026' || itemid '1802011' || itemid '1802002' || itemid '1802000' || itemid '1802013' || itemid '1802007' || itemid '1802008' || itemid '1802019' || itemid '1802005' || itemid '1802032' || itemid '1802009' || itemid '1802034' || itemid '1802020' || itemid '1802024' || itemid '1802001' || itemid '1812002' || itemid '1812003' || itemid '1812005' || itemid '1812001' || itemid '1812006' || itemid '1812000' || itemid '1812004'
    That's it. Edit the items you want to be blocked.



Advertisement