/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 ~ 2010 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 server.life; import client.MapleClient; import custom.MoonlightRevamp; import custom.CustomShop; import server.shops.MapleShopFactory; import server.maps.MapleMapObjectType; import tools.packet.CField.NPCPacket; public class MapleNPC extends AbstractLoadedMapleLife { private String name = "MISSINGNO"; private boolean custom = false; public MapleNPC(final int id, final String name) { super(id); this.name = name; } public final boolean hasShop() { return getId() == MoonlightRevamp.shopNpc && MoonlightRevamp.MoonlightRevamp ? true : getId() == CustomShop.shopNpc && CustomShop.active ? true : MapleShopFactory.getInstance().getShopForNPC(getId()) != null; } public final void sendShop(final MapleClient c) { MapleShopFactory.getInstance().getShopForNPC(getId()).sendShop(c); } @Override public void sendSpawnData(final MapleClient client) { if (getId() >= 9901000) { } else { client.getSession().write(NPCPacket.spawnNPC(this, true)); client.getSession().write(NPCPacket.spawnNPCRequestController(this, true)); } } @Override public final void sendDestroyData(final MapleClient client) { client.getSession().write(NPCPacket.removeNPCController(getObjectId())); client.getSession().write(NPCPacket.removeNPC(getObjectId())); } @Override public final MapleMapObjectType getType() { return MapleMapObjectType.NPC; } public final String getName() { return name; } public void setName(String n) { this.name = n; } public final boolean isCustom() { return custom; } public final void setCustom(final boolean custom) { this.custom = custom; } }