public static void main(String[] args) { final L2BoatInstance boat = BoatManager.getInstance().getNewBoat(2, 48950, 190613, -3610, 60800); if (boat != null) { boat.registerEngine(new BoatGiranTalking(boat)); boat.runEngine(180000); } }
@Override public void run() { try { switch (_cycle) { case 0: BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], LEAVE_GIRAN5); ThreadPoolManager.getInstance().scheduleGeneral(this, 240000); break; case 1: BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], LEAVE_GIRAN1); ThreadPoolManager.getInstance().scheduleGeneral(this, 40000); break; case 2: BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], LEAVE_GIRAN0); ThreadPoolManager.getInstance().scheduleGeneral(this, 20000); break; case 3: BoatManager.getInstance() .broadcastPackets(GIRAN_DOCK, TALKING_DOCK[0], LEAVING_GIRAN, ARRIVAL_TALKING15); _boat.broadcastPacket(GIRAN_SOUND); _boat.payForRide(3946, 1, 46763, 187041, -3451); _boat.executePath(GIRAN_TO_TALKING); ThreadPoolManager.getInstance().scheduleGeneral(this, 250000); break; case 4: BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, ARRIVAL_TALKING10); ThreadPoolManager.getInstance().scheduleGeneral(this, 300000); break; case 5: BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, ARRIVAL_TALKING5); ThreadPoolManager.getInstance().scheduleGeneral(this, 240000); break; case 6: BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, ARRIVAL_TALKING1); break; case 7: if (BoatManager.getInstance().dockBusy(BoatManager.TALKING_ISLAND)) { if (_shoutCount == 0) BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, BUSY_TALKING); _shoutCount++; if (_shoutCount > 35) _shoutCount = 0; ThreadPoolManager.getInstance().scheduleGeneral(this, 5000); return; } _boat.executePath(TALKING_DOCK); break; case 8: BoatManager.getInstance().dockShip(BoatManager.TALKING_ISLAND, true); BoatManager.getInstance() .broadcastPackets( TALKING_DOCK[0], GIRAN_DOCK, ARRIVED_AT_TALKING, ARRIVED_AT_TALKING_2); _boat.broadcastPacket(TALKING_SOUND); ThreadPoolManager.getInstance().scheduleGeneral(this, 300000); break; case 9: BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, LEAVE_TALKING5); ThreadPoolManager.getInstance().scheduleGeneral(this, 240000); break; case 10: BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, LEAVE_TALKING1); ThreadPoolManager.getInstance().scheduleGeneral(this, 40000); break; case 11: BoatManager.getInstance().broadcastPacket(TALKING_DOCK[0], GIRAN_DOCK, LEAVE_TALKING0); ThreadPoolManager.getInstance().scheduleGeneral(this, 20000); break; case 12: BoatManager.getInstance().dockShip(BoatManager.TALKING_ISLAND, false); BoatManager.getInstance().broadcastPackets(TALKING_DOCK[0], GIRAN_DOCK, LEAVING_TALKING); _boat.broadcastPacket(TALKING_SOUND); _boat.payForRide(3945, 1, -96777, 258970, -3623); _boat.executePath(TALKING_TO_GIRAN); ThreadPoolManager.getInstance().scheduleGeneral(this, 200000); break; case 13: BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], ARRIVAL_GIRAN20); ThreadPoolManager.getInstance().scheduleGeneral(this, 300000); break; case 14: BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], ARRIVAL_GIRAN15); ThreadPoolManager.getInstance().scheduleGeneral(this, 300000); break; case 15: BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], ARRIVAL_GIRAN10); ThreadPoolManager.getInstance().scheduleGeneral(this, 300000); break; case 16: BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], ARRIVAL_GIRAN5); ThreadPoolManager.getInstance().scheduleGeneral(this, 240000); break; case 17: BoatManager.getInstance().broadcastPacket(GIRAN_DOCK, TALKING_DOCK[0], ARRIVAL_GIRAN1); break; case 18: BoatManager.getInstance() .broadcastPackets(GIRAN_DOCK, TALKING_DOCK[0], ARRIVED_AT_GIRAN, ARRIVED_AT_GIRAN_2); _boat.broadcastPacket(GIRAN_SOUND); ThreadPoolManager.getInstance().scheduleGeneral(this, 300000); break; } _shoutCount = 0; _cycle++; if (_cycle > 18) _cycle = 0; } catch (Exception e) { _log.log(Level.WARNING, e.getMessage()); } }
public BoatGiranTalking(L2BoatInstance boat) { _boat = boat; ARRIVED_AT_GIRAN = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_ARRIVED_AT_GIRAN); ARRIVED_AT_GIRAN_2 = new CreatureSay( 0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_TALKING_AFTER_10_MINUTES); LEAVE_GIRAN5 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_TALKING_IN_5_MINUTES); LEAVE_GIRAN1 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_TALKING_IN_1_MINUTE); LEAVE_GIRAN0 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_SOON_FOR_TALKING); LEAVING_GIRAN = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVING_FOR_TALKING); ARRIVED_AT_TALKING = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_ARRIVED_AT_TALKING); ARRIVED_AT_TALKING_2 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_GIRAN_AFTER_10_MINUTES); LEAVE_TALKING5 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_GIRAN_IN_5_MINUTES); LEAVE_TALKING1 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_FOR_GIRAN_IN_1_MINUTE); LEAVE_TALKING0 = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVE_SOON_FOR_GIRAN); LEAVING_TALKING = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_LEAVING_FOR_GIRAN); BUSY_TALKING = new CreatureSay(0, Say2.BOAT, 801, SystemMessageId.FERRY_GIRAN_TALKING_DELAYED); ARRIVAL_TALKING15 = new CreatureSay( 0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_GIRAN_ARRIVE_AT_TALKING_15_MINUTES); ARRIVAL_TALKING10 = new CreatureSay( 0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_GIRAN_ARRIVE_AT_TALKING_10_MINUTES); ARRIVAL_TALKING5 = new CreatureSay( 0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_GIRAN_ARRIVE_AT_TALKING_5_MINUTES); ARRIVAL_TALKING1 = new CreatureSay( 0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_GIRAN_ARRIVE_AT_TALKING_1_MINUTE); ARRIVAL_GIRAN20 = new CreatureSay( 0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_TALKING_ARRIVE_AT_GIRAN_20_MINUTES); ARRIVAL_GIRAN15 = new CreatureSay( 0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_TALKING_ARRIVE_AT_GIRAN_15_MINUTES); ARRIVAL_GIRAN10 = new CreatureSay( 0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_TALKING_ARRIVE_AT_GIRAN_10_MINUTES); ARRIVAL_GIRAN5 = new CreatureSay( 0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_TALKING_ARRIVE_AT_GIRAN_5_MINUTES); ARRIVAL_GIRAN1 = new CreatureSay( 0, Say2.BOAT, 801, SystemMessageId.FERRY_FROM_TALKING_ARRIVE_AT_GIRAN_1_MINUTE); GIRAN_SOUND = new PlaySound( 0, "itemsound.ship_arrival_departure", 1, _boat.getObjectId(), GIRAN_DOCK.x, GIRAN_DOCK.y, GIRAN_DOCK.z); TALKING_SOUND = new PlaySound( 0, "itemsound.ship_arrival_departure", 1, _boat.getObjectId(), TALKING_DOCK[0].x, TALKING_DOCK[0].y, TALKING_DOCK[0].z); }