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!

Fix for disappearing items and skills

Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
This is a fix for disappearing items and skills after you equiped your pet with Magic Scales. What this does is that users don't get the item and don't lose NX Cash when they buy Magic Scales.
Credits to Matze for OdinMS, to Leifde for pets and to flav (me) for this.


Open BuyCSItemHandler.java and find this lines...
Code:
		} else {
                    MapleInventoryManipulator.addById(c, item.getId(), (short) item.getCount(), "Cash Item was purchased.");
		}
...replace them with this lines to disable Magic Scales...
Code:
		} else if (item.getId() == 1812006) {
                    c.getPlayer().modifyCSPoints(0, item.getPrice());
                } else {
                    MapleInventoryManipulator.addById(c, item.getId(), (short) item.getCount(), "Cash Item was purchased.");
		}
...or replace them with this lines to disable Magic Scales, Meso Magnet and so on....
Code:
		} else if (item.getId() >= 1812000 && item.getId() <= 1812006) {
                    c.getPlayer().modifyCSPoints(0, item.getPrice());
                } else {
                    MapleInventoryManipulator.addById(c, item.getId(), (short) item.getCount(), "Cash Item was purchased.");
		}
...use 1812001 instead of 1812000 if you are going to use my Super Meso Magnet...
...save, compile, done!
 
Last edited:
Skilled Illusionist
Joined
May 12, 2008
Messages
321
Reaction score
0
Re: [Release] Magic Scales Fix

tested? :D
if it is, yum.
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Re: [Release] Magic Scales (disapearing items and skills) Fix

Yes, tested it...
 
Skilled Illusionist
Joined
May 12, 2008
Messages
321
Reaction score
0
Re: [Release] Magic Scales (disapearing items and skills) Fix

Thanks, used it :D
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Re: [Release] Magic Scales (disapearing items and skills) Fix

No problem...
Btw, now I know how to disable Double EXP cards... :p
 
Skilled Illusionist
Joined
Apr 12, 2008
Messages
397
Reaction score
0
Re: [Release] Magic Scales (disapearing items and skills) Fix

Thanks~
 
Experienced Elementalist
Joined
Apr 2, 2008
Messages
255
Reaction score
0
Re: [Release] Magic Scales (disapearing items and skills) Fix

nice =) i was triying to make something like this but i was lazy 0.0
 
Newbie Spellweaver
Joined
Jun 30, 2008
Messages
71
Reaction score
0
Re: [Release] Magic Scales (disapearing items and skills) Fix

thats the perfect realse ever!
tnx u sooooooo much!!!!!!!!!!!!!!$%&%^*&^
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Re: [Release] Magic Scales (disapearing items and skills) Fix

Should I also add Meso Magnet and so on? They are not bugged but not working and users will spent mesos on it.
 
Last edited:
LeviathanStory
Joined
Apr 21, 2007
Messages
251
Reaction score
0
Re: [Release] Magic Scales (disapearing items and skills) Fix

Thank You, kind sir.
 
Junior Spellweaver
Joined
Apr 4, 2008
Messages
157
Reaction score
11
Re: [Release] Magic Scales (disapearing items and skills) Fix

Nice job
 
Newbie Spellweaver
Joined
Apr 29, 2008
Messages
59
Reaction score
0
Re: [Release] Magic Scales (disapearing items and skills) Fix

great job been trying to figure this out =.=
 
Newbie Spellweaver
Joined
Jun 30, 2008
Messages
71
Reaction score
0
Re: [Release] Magic Scales (disapearing items and skills) Fix

Doesnt work!!!!!!!!!1
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Re: [Release] Magic Scales (disapearing items and skills) Fix

Doesnt work!!!!!!!!!1

Try to replace your whole BuyCSItemHandler.java with this...
Code:
/*
	This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> 
                       Matthias Butz <matze@odinms.de>
                       Jan Christian Meyer <vimes@odinms.de>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package net.sf.odinms.net.channel.handler;

import java.util.logging.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import net.sf.odinms.client.MapleClient;
import net.sf.odinms.net.AbstractMaplePacketHandler;
import net.sf.odinms.database.DatabaseConnection;
import net.sf.odinms.net.MapleServerHandler;
import net.sf.odinms.server.MapleInventoryManipulator;
import net.sf.odinms.server.MapleItemInformationProvider;
import net.sf.odinms.tools.MaplePacketCreator;
import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;
import net.sf.odinms.server.CashItemFactory;
import net.sf.odinms.server.CashItemInfo;

/**
*
* @author Penguins (Acrylic)
*/
public class BuyCSItemHandler extends AbstractMaplePacketHandler {
	private final static Logger log = LoggerFactory.getLogger(MapleServerHandler.class);
	@Override
	public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
               log.info(slea.toString());
                int mode = slea.readByte();
		MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
		slea.skip(1);
		int snCS = slea.readInt();
		CashItemInfo item = CashItemFactory.getItem(snCS);
				
		if (item.getId() >= 5000000 && item.getId() <= 5000045) {
			try {
				Connection con = DatabaseConnection.getConnection();
				PreparedStatement ps = con.prepareStatement("INSERT INTO pets (name, level, closeness, fullness) VALUES (?, ?, ?, ?)");
				ps.setString(1, ii.getName(item.getId()));
				ps.setInt(2, 1);
				ps.setInt(3, 0);
				ps.setInt(4, 100);
				ps.executeUpdate();
				ResultSet rs = ps.getGeneratedKeys();
				rs.next();
				//c.getPlayer().equipChanged();
				MapleInventoryManipulator.addById(c, item.getId(), (short) item.getCount(), "Cash Item was purchased.", null, rs.getInt(1));
				rs.close();
				ps.close();
			} catch (SQLException ex) {
				java.util.logging.Logger.getLogger(BuyCSItemHandler.class.getName()).log(Level.SEVERE, null, ex);
			}
		} else if (item.getId() == 1812006) {
                    c.getPlayer().modifyCSPoints(0, item.getPrice());
                } else {
                    MapleInventoryManipulator.addById(c, item.getId(), (short) item.getCount(), "Cash Item was purchased.");
		}
		c.getSession().write(MaplePacketCreator.showBoughtCSItem(item.getId()));
		c.getPlayer().modifyCSPoints(0, -item.getPrice());
		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());
	}
}
...and don't forget to save and compile it...
I think you know that you have to put the compiled odinms.jar file in your dist folder and restart the server!?
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Re: [Release] Magic Scales (disapearing items and skills) Fix

Update
- Added Meso Magnet & co. version
 
Newbie Spellweaver
Joined
Jun 30, 2008
Messages
71
Reaction score
0
Re: [Release] Fix for disappearing items and skills

but thats work for u?
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Re: [Release] Fix for disappearing items and skills

Yes, I tested it. :p
Tell me exactly what you did and did you compile?
 
Newbie Spellweaver
Joined
Jun 30, 2008
Messages
71
Reaction score
0
Re: [Release] Fix for disappearing items and skills

Yep im not noob
lemme cheack again :]
 
Newbie Spellweaver
Joined
Jun 30, 2008
Messages
71
Reaction score
0
Re: [Release] Fix for disappearing items and skills

dude its make that u can buy it but not for real?
sry about my bad english :/
 
Elite Diviner
Joined
Jul 13, 2008
Messages
419
Reaction score
217
Re: [Release] Fix for disappearing items and skills

dude its make that u can buy it but not for real?
sry about my bad english :/

yes, they buy item but don't get it and won't lose nx cash... well, better than nothing? and it helps :p
 
Back
Top