Addition of Bathin AI.
Contributed by nasseka.
This commit is contained in:
parent
3b4ab73421
commit
04a99a50c5
@ -17,6 +17,11 @@
|
||||
<reenter apply="ON_ENTER">
|
||||
<reset day="THURSDAY" hour="6" minute="30" />
|
||||
</reenter>
|
||||
<doorlist>
|
||||
<door id="15180100">
|
||||
<openStatus default="close" />
|
||||
</door>
|
||||
</doorlist>
|
||||
<spawnlist>
|
||||
<group name="teleports">
|
||||
<!-- 1st Floor -->
|
||||
@ -3122,5 +3127,8 @@
|
||||
<npc id="24875" x="-152227" y="15178" z="-9398" heading="64668" respawnTime="60sec" /> <!-- Guardian of the Insolence Seal -->
|
||||
<npc id="24875" x="-152233" y="15651" z="-9398" heading="64668" respawnTime="60sec" /> <!-- Guardian of the Insolence Seal -->
|
||||
</group>
|
||||
<group name="bathin" spawnByDefault="false">
|
||||
<npc id="26445" x="-147656" y="10993" z="-9418" /> <!-- Bathin -->
|
||||
</group>
|
||||
</spawnlist>
|
||||
</instance>
|
||||
|
164
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/instances/TimedHunting/Bathin.java
vendored
Normal file
164
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/instances/TimedHunting/Bathin.java
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package instances.TimedHunting;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||
import org.l2jmobius.gameserver.model.zone.type.ScriptZone;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.OnEventTrigger;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
/**
|
||||
* @author NasSeKa
|
||||
*/
|
||||
public class Bathin extends AbstractNpcAI
|
||||
{
|
||||
// NPC
|
||||
private static final int BATHIN = 26445;
|
||||
// Misc
|
||||
private static final int INSTANCE_ID = 1020;
|
||||
private static final int DOOR = 15180100;
|
||||
private static final int DOOR_EMITTER = 15180102;
|
||||
private static final String BATHIN_ALIVE_VAR = "BATHIN_ALIVE";
|
||||
private static final ScriptZone BROADCAST_ZONE = ZoneManager.getInstance().getZoneById(26000, ScriptZone.class);
|
||||
|
||||
public Bathin()
|
||||
{
|
||||
addInstanceCreatedId(INSTANCE_ID);
|
||||
addEnterZoneId(BROADCAST_ZONE.getId());
|
||||
addKillId(BATHIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInstanceCreated(Instance instance, Player player)
|
||||
{
|
||||
if ((instance.getAliveNpcCount(BATHIN) == 0) && GlobalVariablesManager.getInstance().getBoolean(BATHIN_ALIVE_VAR, true))
|
||||
{
|
||||
instance.spawnGroup("bathin");
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final Calendar calendarBathin = Calendar.getInstance();
|
||||
final Calendar calendarSeal = Calendar.getInstance();
|
||||
|
||||
calendarBathin.set(Calendar.DAY_OF_WEEK, 7); // Saturday
|
||||
calendarBathin.set(Calendar.HOUR_OF_DAY, 23);
|
||||
calendarBathin.set(Calendar.MINUTE, 0);
|
||||
calendarBathin.set(Calendar.SECOND, 0);
|
||||
|
||||
calendarSeal.set(Calendar.DAY_OF_WEEK, 2); // Monday
|
||||
calendarSeal.set(Calendar.HOUR_OF_DAY, 12);
|
||||
calendarSeal.set(Calendar.MINUTE, 0);
|
||||
calendarSeal.set(Calendar.SECOND, 0);
|
||||
|
||||
final long calendarTimeBathin = calendarBathin.getTimeInMillis();
|
||||
final long startDelay = Math.max(0, calendarTimeBathin - currentTime);
|
||||
|
||||
final long calendarTimeSeal = calendarSeal.getTimeInMillis();
|
||||
final long startDelayDoor = Math.max(0, calendarTimeSeal - currentTime);
|
||||
|
||||
ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
instance.openCloseDoor(DOOR, true);
|
||||
|
||||
if ((instance.getAliveNpcCount(BATHIN) == 0))
|
||||
{
|
||||
instance.spawnGroup("bathin");
|
||||
}
|
||||
for (Player pplayer : instance.getPlayers())
|
||||
{
|
||||
if (pplayer.isInsideRadius3D(-147664, 13152, -9424, 10000))
|
||||
{
|
||||
pplayer.sendPacket(new OnEventTrigger(DOOR_EMITTER, true));
|
||||
}
|
||||
}
|
||||
GlobalVariablesManager.getInstance().set(BATHIN_ALIVE_VAR, true);
|
||||
}, startDelay, 604800000); // 7 days
|
||||
|
||||
ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
instance.openCloseDoor(DOOR, false);
|
||||
for (Player nearby : instance.getPlayers())
|
||||
{
|
||||
if (nearby.isInsideRadius3D(-147656, 10993, -9418, 10000))
|
||||
{
|
||||
nearby.sendPacket(new OnEventTrigger(DOOR_EMITTER, false));
|
||||
nearby.teleToLocation(-147643, 21372, -9398, instance);
|
||||
}
|
||||
}
|
||||
}, startDelayDoor, 604800000); // 7 days
|
||||
|
||||
instance.openCloseDoor(DOOR, (calendarTimeBathin <= currentTime) && (currentTime <= calendarTimeSeal) && GlobalVariablesManager.getInstance().getBoolean(BATHIN_ALIVE_VAR, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onEnterZone(Creature creature, ZoneType zone)
|
||||
{
|
||||
if (creature.isPlayer() && creature.isInInstance())
|
||||
{
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (zone.getId() == BROADCAST_ZONE.getId())
|
||||
{
|
||||
if (player.getInstanceWorld().getDoor(DOOR).isOpen())
|
||||
{
|
||||
player.sendPacket(new OnEventTrigger(DOOR_EMITTER, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(new OnEventTrigger(DOOR_EMITTER, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onEnterZone(creature, zone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(Npc npc, Player killer, boolean isSummon)
|
||||
{
|
||||
if (killer.isInInstance())
|
||||
{
|
||||
final Instance instance = killer.getInstanceWorld();
|
||||
GlobalVariablesManager.getInstance().set(BATHIN_ALIVE_VAR, false);
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
instance.openCloseDoor(DOOR, false);
|
||||
for (Player player : instance.getPlayers())
|
||||
{
|
||||
if (player.isInsideRadius3D(-147656, 10993, -9418, 2000))
|
||||
{
|
||||
player.teleToLocation(-147643, 21372, -9398, instance);
|
||||
}
|
||||
}
|
||||
}, 300000);
|
||||
}
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Bathin();
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@ public class TimedHunting extends AbstractInstance
|
||||
{
|
||||
1007, // Isle of Souls
|
||||
1013, // Corroded Fields
|
||||
1020, // Corroded Fields
|
||||
1020, // Tower of Insolence
|
||||
};
|
||||
|
||||
public TimedHunting()
|
||||
|
@ -1988,7 +1988,7 @@
|
||||
</drop>
|
||||
</dropLists>
|
||||
</npc>
|
||||
<npc id="26445" level="120" type="RaidBoss" name="Bathin" title="Raid Boss">
|
||||
<npc id="26445" level="125" type="RaidBoss" name="Bathin" title="Raid Boss">
|
||||
<!-- AUTO GENERATED NPC TODO: FIX IT -->
|
||||
<race>UNDEAD</race>
|
||||
<sex>MALE</sex>
|
||||
|
@ -1167,4 +1167,7 @@
|
||||
<zone name="Imperial Tomb - Hunting Zone Spawn" id="93300" type="ScriptZone" shape="Cylinder" minZ="-2750" maxZ="-2700" rad="2000">
|
||||
<node X="181409" Y="-78389" />
|
||||
</zone>
|
||||
<zone name="ToI 6 - Bathin (Boss)" id="26000" type="ScriptZone" shape="Cylinder" minZ="-9800" maxZ="-9000" rad="1000">
|
||||
<node X="-147650" Y="19850" />
|
||||
</zone>
|
||||
</list>
|
Loading…
Reference in New Issue
Block a user