Created
March 16, 2014 20:20
-
-
Save oxysoft/9589295 to your computer and use it in GitHub Desktop.
shortened
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This file is part of the OdinMS Maple Story Server | |
Copyright (C) 2008 Patrick Huy <[email protected]> | |
Matthias Butz <[email protected]> | |
Jan Christian Meyer <[email protected]> | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU Affero General Public License as | |
published by the Free Software Foundation 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 handling.channel; | |
import client.MapleCharacter; | |
import client.MapleClient; | |
import client.inventory.Item; | |
import client.inventory.MapleInventoryType; | |
import handling.AbstractMaplePacketHandler; | |
import server.MapleInventoryManipulator; | |
import server.maps.FieldLimit; | |
import server.maps.MapleMap; | |
import tools.data.input.SeekableLittleEndianAccessor; | |
import tools.packets.CWvsContext_OnPacket; | |
/* | |
* @author sunnyboy | |
*/ | |
public final class TeleportRock extends AbstractMaplePacketHandler { | |
@Override | |
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {byte slot = (byte) slea.readShort();int itemId = slea.readInt();Item TeleportRock = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem(slot);if (TeleportRock.getQuantity() < 1 || TeleportRock == null || TeleportRock.getItemId() != itemId) {c.announce(CWvsContext_OnPacket.enableActions());return;}byte rocktype = slea.readByte();if (rocktype == 0) {MapleMap target = c.getChannelServer().getMapFactory().getMap(slea.readInt());if (!FieldLimit.VipRock.check(c.getPlayer().getMap().getFieldLimit()) && !FieldLimit.VipRock.check(target.getFieldLimit())) {c.getPlayer().changeMap(target, target.getPortal(0));MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, slot, (short) 1, false);}}} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment