Talking Island double walkers.

Contributed by Liamxroy.
This commit is contained in:
MobiusDev 2017-11-05 20:42:54 +00:00
parent 2ffde9c10a
commit 1ac94c03c9
30 changed files with 1635 additions and 0 deletions

View File

@ -1396,6 +1396,16 @@
<point X="-116531" Y="257318" Z="-1512" delay="0" run="false" />
<point X="-116741" Y="255686" Z="-1424" delay="0" run="false" />
</route>
<route name="si_town_01" repeat="true" repeatStyle="back">
<target id="33234" spawnX="-113733" spawnY="249870" spawnZ="-1693" />
<point X="-113440" Y="249824" Z="-1816" delay="0" run="false" />
<point X="-113979" Y="250268" Z="-1816" delay="0" run="false" />
<point X="-114541" Y="252889" Z="-1536" delay="0" run="false" />
<point X="-114682" Y="254170" Z="-1528" delay="0" run="false" />
<point X="-114775" Y="255221" Z="-1512" delay="0" run="false" />
<point X="-113605" Y="256342" Z="-1496" delay="0" run="false" />
<point X="-112448" Y="256969" Z="-1480" delay="0" run="false" />
</route>
<route name="si_town_03" repeat="true" repeatStyle="back">
<target id="33208" spawnX="-114344" spawnY="255204" spawnZ="-1520" />
<point X="-114166" Y="255085" Z="-1528" delay="0" run="false" />
@ -1416,6 +1426,38 @@
<point X="-114550" Y="253273" Z="-1536" delay="0" run="false" />
<point X="-114343" Y="252676" Z="-1544" delay="0" run="false" />
</route>
<route name="si_monkey_road02" repeat="true" repeatStyle="back">
<target id="33218" spawnX="-113404" spawnY="249823" spawnZ="-1816" />
<point X="-114280" Y="252371" Z="-1560" delay="0" run="false" />
<point X="-114395" Y="250846" Z="-1760" delay="0" run="false" />
<point X="-113147" Y="250428" Z="-1920" delay="0" run="false" />
<point X="-112726" Y="250467" Z="-1984" delay="0" run="false" />
<point X="-112411" Y="250372" Z="-2032" delay="0" run="false" />
<point X="-112015" Y="249579" Z="-2280" delay="0" run="false" />
<point X="-110878" Y="249113" Z="-2512" delay="0" run="false" />
<point X="-110040" Y="248279" Z="-2704" delay="0" run="false" />
<point X="-109804" Y="247916" Z="-2776" delay="0" run="false" />
<point X="-109707" Y="246949" Z="-2960" delay="0" run="false" />
<point X="-109043" Y="246986" Z="-3112" delay="0" run="false" />
<point X="-107786" Y="248825" Z="-3216" delay="0" run="false" />
</route>
<route name="si_lib_02" repeat="true" repeatStyle="back">
<target id="33111" spawnX="-114945" spawnY="243991" spawnZ="-7968" />
<point X="-115087" Y="244056" Z="-7968" delay="0" run="false" />
<point X="-115376" Y="244716" Z="-7968" delay="0" run="false" />
<point X="-115247" Y="245152" Z="-7968" delay="0" run="false" />
<point X="-115087" Y="245291" Z="-7968" delay="0" run="false" />
<point X="-114628" Y="245384" Z="-7968" delay="0" run="false" />
<point X="-114285" Y="245265" Z="-7968" delay="0" run="false" />
<point X="-114178" Y="245119" Z="-7968" delay="0" run="false" />
<point X="-114112" Y="244728" Z="-7968" delay="0" run="false" />
<point X="-114155" Y="244311" Z="-7968" delay="0" run="false" />
<point X="-114375" Y="244073" Z="-7968" delay="0" run="false" />
<point X="-114634" Y="244011" Z="-7968" delay="0" run="false" />
<point X="-115037" Y="244079" Z="-7968" delay="0" run="false" />
<point X="-115320" Y="244411" Z="-7968" delay="0" run="false" />
<point X="-115322" Y="245040" Z="-7968" delay="0" run="false" />
</route>
<!-- Windmill Hill walkers -->
<route name="windmill_decoline1" repeat="true" repeatStyle="back">
<target id="33422" spawnX="-77644" spawnY="165991" spawnZ="-3704" />

View File

@ -18,6 +18,8 @@ package ai;
import java.util.logging.Logger;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.model.holders.MinionHolder;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
import com.l2jmobius.gameserver.util.Broadcast;
import com.l2jmobius.gameserver.util.Util;
/**
* Abstract NPC AI class for datapack based AIs.
@ -101,4 +104,36 @@ public abstract class AbstractNpcAI extends Quest
addMinion((L2MonsterInstance) npc, is.getId());
}
}
protected void followNpc(final L2Npc npc, int followedNpcId, int followingAngle, int minDistance, int maxDistance)
{
L2World.getInstance().forEachVisibleObject(npc, L2Npc.class, npcAround ->
{
if (npcAround.getId() != followedNpcId)
{
return;
}
final double distance = npc.calculateDistance(npcAround, true, false);
if ((distance >= maxDistance) && npc.isScriptValue(0))
{
npc.setRunning();
npc.setScriptValue(1);
}
else if ((distance <= (minDistance * 1.5)) && npc.isScriptValue(1))
{
npc.setWalking();
npc.setScriptValue(0);
}
final double course = Math.toRadians(followingAngle);
final double radian = Math.toRadians(Util.convertHeadingToDegree(npcAround.getHeading()));
final double nRadius = npc.getCollisionRadius() + npcAround.getCollisionRadius() + minDistance;
final int x = npcAround.getLocation().getX() + (int) (Math.cos(Math.PI + radian + course) * nRadius);
final int y = npcAround.getLocation().getY() + (int) (Math.sin(Math.PI + radian + course) * nRadius);
final int z = npcAround.getLocation().getZ();
npc.getAI().moveTo(new Location(x, y, z));
});
}
}

View File

@ -0,0 +1,80 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Allada AI.
* @author Gladicek
*/
public final class Allada extends AbstractNpcAI
{
// NPC
private static final int RINNE = 33234;
private static final int ALLADA = 33220;
// Items
private static final int WEAPON = 15304;
// Distances
private static final int MIN_DISTANCE = 70;
private static final int MAX_DISTANCE = 200;
private Allada()
{
addSpawnId(ALLADA);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_A_MIRACLE_THAT_THE_TALKING_ISLAND_HAS_RESTORED);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "WALK_AROUND_RINNE":
{
followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
npc.setRHandId(WEAPON);
followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addRepeatingTimer("WALK_AROUND_RINNE", 1000, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Allada();
}
}

View File

@ -0,0 +1,68 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Mei AI.
* @author Gladicek
*/
public final class Mei extends AbstractNpcAI
{
// NPC
private static final int MEI = 33280;
private static final int ROTINA = 33027;
private Mei()
{
addSpawnId(MEI);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
if (event.equals("NPC_SHOUT"))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IF_YOU_IGNORE_THE_TRAINING_GROUNDS_YOU_LL_REGRET_IT);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
}
else if (event.equals("NPC_FOLLOW"))
{
addSpawn(ROTINA, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0);
}
}
@Override
public String onSpawn(L2Npc npc)
{
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_FOLLOW", 100, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Mei();
}
}

View File

@ -0,0 +1,77 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Remons AI.
* @author Gladicek
*/
public final class Remons extends AbstractNpcAI
{
// NPC
private static final int REMONS = 33570;
private static final int SOROS = 33218;
// Distances
private static final int MIN_DISTANCE = 70;
private static final int MAX_DISTANCE = 200;
private Remons()
{
addSpawnId(REMONS);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.PERHAPS_EVEN_THE_VILLAGE_BECOMES_DANGEROUS);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "WALK_AROUND_SOROS":
{
followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addRepeatingTimer("WALK_AROUND_SOROS", 1000, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Remons();
}
}

View File

@ -0,0 +1,88 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Rinne AI.
* @author Gladicek
*/
public final class Rinne extends AbstractNpcAI
{
// NPC
private static final int RINNE = 33234;
private static final int ALLADA = 33220;
// Items
private static final int WEAPON = 15302;
private Rinne()
{
addSpawnId(RINNE);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "TID_LEFTWALK":
{
npc.setRHandId(WEAPON);
getTimers().addTimer("TID_STRAIGHTWALK", (5000 + getRandom(5)) * 1000, npc, null);
break;
}
case "TID_STRAIGHTWALK":
{
npc.setRHandId(0);
getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null);
break;
}
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ALL_RACES_CAME_TOGETHER_TO_REBUILD_TALKING_ISLAND_VILLAGE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "NPC_FOLLOW":
{
addSpawn(ALLADA, npc.getX() + 10, npc.getY() + 10, npc.getZ(), 0, false, 0);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_FOLLOW", 100, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Rinne();
}
}

View File

@ -0,0 +1,80 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Rotina AI.
* @author Gladicek
*/
public final class Rotina extends AbstractNpcAI
{
// NPC
private static final int ROTINA = 33027;
private static final int MEI = 33280;
// Items
private static final int WEAPON = 15304;
// Distances
private static final int MIN_DISTANCE = 70;
private static final int MAX_DISTANCE = 200;
private Rotina()
{
addSpawnId(ROTINA);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_LL_EARN_TONS_OF_ITEMS_USING_THE_TRAINING_GROUNDS);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "WALK_AROUND_MEI":
{
followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
npc.setRHandId(WEAPON);
followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addRepeatingTimer("WALK_AROUND_MEI", 1000, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Rotina();
}
}

View File

@ -0,0 +1,73 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Soros AI.
* @author Gladicek
*/
public final class Soros extends AbstractNpcAI
{
// NPC
private static final int SOROS = 33218;
private static final int REMONS = 33570;
private Soros()
{
addSpawnId(SOROS);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SOMETHING_LIKE_THAT_COMES_OUT_OF_THE_RUINS);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "NPC_FOLLOW":
{
addSpawn(REMONS, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_FOLLOW", 100, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Soros();
}
}

View File

@ -385,6 +385,7 @@
<npc id="33203" x="-104373" y="237534" z="-1832" heading="45762" respawnTime="60sec" /> <!-- -->
<npc id="33203" x="-104435" y="238801" z="-1704" heading="42818" respawnTime="60sec" /> <!-- -->
<npc id="33206" x="-117502" y="248539" z="-1968" heading="40800" respawnTime="60sec" /> <!-- Guard Captain -->
<npc id="33218" x="-113404" y="249823" z="-1816" heading="0" respawnTime="60sec" /> <!-- Soros -->
<npc id="33219" x="-105210" y="247610" z="-3640" heading="59900" respawnTime="60sec" /> <!-- Holly -->
<npc id="33223" x="-119816" y="246292" z="-968" heading="843" respawnTime="60sec" /> <!-- Bink -->
<npc id="33223" x="-114723" y="230366" z="-1664" heading="16383" respawnTime="60sec" /> <!-- Bink -->

View File

@ -188,6 +188,7 @@
<npc id="33229" x="-113856" y="253680" z="-1496" heading="32648" respawnTime="60sec" /> <!-- Sodian -->
<npc id="33231" x="-114670" y="250225" z="-1744" heading="31161" respawnTime="60sec" /> <!-- -->
<npc id="33232" x="-113520" y="255104" z="-1496" heading="51488" respawnTime="60sec" /> <!-- -->
<npc id="33234" x="-113733" y="249870" z="-1693" heading="18544" respawnTime="60sec" /> <!-- Rinne -->
<npc id="33235" x="-113664" y="255584" z="-1496" heading="56420" respawnTime="60sec" /> <!-- -->
<npc id="33236" x="-113440" y="255952" z="-1496" heading="5188" respawnTime="60sec" /> <!-- -->
<npc id="33237" x="-113424" y="256240" z="-1496" heading="32256" respawnTime="60sec" /> <!-- -->

View File

@ -1396,6 +1396,16 @@
<point X="-116531" Y="257318" Z="-1512" delay="0" run="false" />
<point X="-116741" Y="255686" Z="-1424" delay="0" run="false" />
</route>
<route name="si_town_01" repeat="true" repeatStyle="back">
<target id="33234" spawnX="-113733" spawnY="249870" spawnZ="-1693" />
<point X="-113440" Y="249824" Z="-1816" delay="0" run="false" />
<point X="-113979" Y="250268" Z="-1816" delay="0" run="false" />
<point X="-114541" Y="252889" Z="-1536" delay="0" run="false" />
<point X="-114682" Y="254170" Z="-1528" delay="0" run="false" />
<point X="-114775" Y="255221" Z="-1512" delay="0" run="false" />
<point X="-113605" Y="256342" Z="-1496" delay="0" run="false" />
<point X="-112448" Y="256969" Z="-1480" delay="0" run="false" />
</route>
<route name="si_town_03" repeat="true" repeatStyle="back">
<target id="33208" spawnX="-114344" spawnY="255204" spawnZ="-1520" />
<point X="-114166" Y="255085" Z="-1528" delay="0" run="false" />
@ -1416,6 +1426,38 @@
<point X="-114550" Y="253273" Z="-1536" delay="0" run="false" />
<point X="-114343" Y="252676" Z="-1544" delay="0" run="false" />
</route>
<route name="si_monkey_road02" repeat="true" repeatStyle="back">
<target id="33218" spawnX="-113404" spawnY="249823" spawnZ="-1816" />
<point X="-114280" Y="252371" Z="-1560" delay="0" run="false" />
<point X="-114395" Y="250846" Z="-1760" delay="0" run="false" />
<point X="-113147" Y="250428" Z="-1920" delay="0" run="false" />
<point X="-112726" Y="250467" Z="-1984" delay="0" run="false" />
<point X="-112411" Y="250372" Z="-2032" delay="0" run="false" />
<point X="-112015" Y="249579" Z="-2280" delay="0" run="false" />
<point X="-110878" Y="249113" Z="-2512" delay="0" run="false" />
<point X="-110040" Y="248279" Z="-2704" delay="0" run="false" />
<point X="-109804" Y="247916" Z="-2776" delay="0" run="false" />
<point X="-109707" Y="246949" Z="-2960" delay="0" run="false" />
<point X="-109043" Y="246986" Z="-3112" delay="0" run="false" />
<point X="-107786" Y="248825" Z="-3216" delay="0" run="false" />
</route>
<route name="si_lib_02" repeat="true" repeatStyle="back">
<target id="33111" spawnX="-114945" spawnY="243991" spawnZ="-7968" />
<point X="-115087" Y="244056" Z="-7968" delay="0" run="false" />
<point X="-115376" Y="244716" Z="-7968" delay="0" run="false" />
<point X="-115247" Y="245152" Z="-7968" delay="0" run="false" />
<point X="-115087" Y="245291" Z="-7968" delay="0" run="false" />
<point X="-114628" Y="245384" Z="-7968" delay="0" run="false" />
<point X="-114285" Y="245265" Z="-7968" delay="0" run="false" />
<point X="-114178" Y="245119" Z="-7968" delay="0" run="false" />
<point X="-114112" Y="244728" Z="-7968" delay="0" run="false" />
<point X="-114155" Y="244311" Z="-7968" delay="0" run="false" />
<point X="-114375" Y="244073" Z="-7968" delay="0" run="false" />
<point X="-114634" Y="244011" Z="-7968" delay="0" run="false" />
<point X="-115037" Y="244079" Z="-7968" delay="0" run="false" />
<point X="-115320" Y="244411" Z="-7968" delay="0" run="false" />
<point X="-115322" Y="245040" Z="-7968" delay="0" run="false" />
</route>
<!-- Windmill Hill walkers -->
<route name="windmill_decoline1" repeat="true" repeatStyle="back">
<target id="33422" spawnX="-77644" spawnY="165991" spawnZ="-3704" />

View File

@ -18,6 +18,8 @@ package ai;
import java.util.logging.Logger;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.model.holders.MinionHolder;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
import com.l2jmobius.gameserver.util.Broadcast;
import com.l2jmobius.gameserver.util.Util;
/**
* Abstract NPC AI class for datapack based AIs.
@ -101,4 +104,36 @@ public abstract class AbstractNpcAI extends Quest
addMinion((L2MonsterInstance) npc, is.getId());
}
}
protected void followNpc(final L2Npc npc, int followedNpcId, int followingAngle, int minDistance, int maxDistance)
{
L2World.getInstance().forEachVisibleObject(npc, L2Npc.class, npcAround ->
{
if (npcAround.getId() != followedNpcId)
{
return;
}
final double distance = npc.calculateDistance(npcAround, true, false);
if ((distance >= maxDistance) && npc.isScriptValue(0))
{
npc.setRunning();
npc.setScriptValue(1);
}
else if ((distance <= (minDistance * 1.5)) && npc.isScriptValue(1))
{
npc.setWalking();
npc.setScriptValue(0);
}
final double course = Math.toRadians(followingAngle);
final double radian = Math.toRadians(Util.convertHeadingToDegree(npcAround.getHeading()));
final double nRadius = npc.getCollisionRadius() + npcAround.getCollisionRadius() + minDistance;
final int x = npcAround.getLocation().getX() + (int) (Math.cos(Math.PI + radian + course) * nRadius);
final int y = npcAround.getLocation().getY() + (int) (Math.sin(Math.PI + radian + course) * nRadius);
final int z = npcAround.getLocation().getZ();
npc.getAI().moveTo(new Location(x, y, z));
});
}
}

View File

@ -0,0 +1,80 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Allada AI.
* @author Gladicek
*/
public final class Allada extends AbstractNpcAI
{
// NPC
private static final int RINNE = 33234;
private static final int ALLADA = 33220;
// Items
private static final int WEAPON = 15304;
// Distances
private static final int MIN_DISTANCE = 70;
private static final int MAX_DISTANCE = 200;
private Allada()
{
addSpawnId(ALLADA);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_A_MIRACLE_THAT_THE_TALKING_ISLAND_HAS_RESTORED);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "WALK_AROUND_RINNE":
{
followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
npc.setRHandId(WEAPON);
followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addRepeatingTimer("WALK_AROUND_RINNE", 1000, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Allada();
}
}

View File

@ -0,0 +1,68 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Mei AI.
* @author Gladicek
*/
public final class Mei extends AbstractNpcAI
{
// NPC
private static final int MEI = 33280;
private static final int ROTINA = 33027;
private Mei()
{
addSpawnId(MEI);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
if (event.equals("NPC_SHOUT"))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IF_YOU_IGNORE_THE_TRAINING_GROUNDS_YOU_LL_REGRET_IT);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
}
else if (event.equals("NPC_FOLLOW"))
{
addSpawn(ROTINA, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0);
}
}
@Override
public String onSpawn(L2Npc npc)
{
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_FOLLOW", 100, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Mei();
}
}

View File

@ -0,0 +1,77 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Remons AI.
* @author Gladicek
*/
public final class Remons extends AbstractNpcAI
{
// NPC
private static final int REMONS = 33570;
private static final int SOROS = 33218;
// Distances
private static final int MIN_DISTANCE = 70;
private static final int MAX_DISTANCE = 200;
private Remons()
{
addSpawnId(REMONS);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.PERHAPS_EVEN_THE_VILLAGE_BECOMES_DANGEROUS);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "WALK_AROUND_SOROS":
{
followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addRepeatingTimer("WALK_AROUND_SOROS", 1000, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Remons();
}
}

View File

@ -0,0 +1,88 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Rinne AI.
* @author Gladicek
*/
public final class Rinne extends AbstractNpcAI
{
// NPC
private static final int RINNE = 33234;
private static final int ALLADA = 33220;
// Items
private static final int WEAPON = 15302;
private Rinne()
{
addSpawnId(RINNE);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "TID_LEFTWALK":
{
npc.setRHandId(WEAPON);
getTimers().addTimer("TID_STRAIGHTWALK", (5000 + getRandom(5)) * 1000, npc, null);
break;
}
case "TID_STRAIGHTWALK":
{
npc.setRHandId(0);
getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null);
break;
}
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ALL_RACES_CAME_TOGETHER_TO_REBUILD_TALKING_ISLAND_VILLAGE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "NPC_FOLLOW":
{
addSpawn(ALLADA, npc.getX() + 10, npc.getY() + 10, npc.getZ(), 0, false, 0);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_FOLLOW", 100, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Rinne();
}
}

View File

@ -0,0 +1,80 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Rotina AI.
* @author Gladicek
*/
public final class Rotina extends AbstractNpcAI
{
// NPC
private static final int ROTINA = 33027;
private static final int MEI = 33280;
// Items
private static final int WEAPON = 15304;
// Distances
private static final int MIN_DISTANCE = 70;
private static final int MAX_DISTANCE = 200;
private Rotina()
{
addSpawnId(ROTINA);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_LL_EARN_TONS_OF_ITEMS_USING_THE_TRAINING_GROUNDS);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "WALK_AROUND_MEI":
{
followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
npc.setRHandId(WEAPON);
followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addRepeatingTimer("WALK_AROUND_MEI", 1000, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Rotina();
}
}

View File

@ -0,0 +1,73 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Soros AI.
* @author Gladicek
*/
public final class Soros extends AbstractNpcAI
{
// NPC
private static final int SOROS = 33218;
private static final int REMONS = 33570;
private Soros()
{
addSpawnId(SOROS);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SOMETHING_LIKE_THAT_COMES_OUT_OF_THE_RUINS);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "NPC_FOLLOW":
{
addSpawn(REMONS, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_FOLLOW", 100, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Soros();
}
}

View File

@ -385,6 +385,7 @@
<npc id="33203" x="-104373" y="237534" z="-1832" heading="45762" respawnTime="60sec" /> <!-- -->
<npc id="33203" x="-104435" y="238801" z="-1704" heading="42818" respawnTime="60sec" /> <!-- -->
<npc id="33206" x="-117502" y="248539" z="-1968" heading="40800" respawnTime="60sec" /> <!-- Guard Captain -->
<npc id="33218" x="-113404" y="249823" z="-1816" heading="0" respawnTime="60sec" /> <!-- Soros -->
<npc id="33219" x="-105210" y="247610" z="-3640" heading="59900" respawnTime="60sec" /> <!-- Holly -->
<npc id="33223" x="-119816" y="246292" z="-968" heading="843" respawnTime="60sec" /> <!-- Bink -->
<npc id="33223" x="-114723" y="230366" z="-1664" heading="16383" respawnTime="60sec" /> <!-- Bink -->

View File

@ -188,6 +188,7 @@
<npc id="33229" x="-113856" y="253680" z="-1496" heading="32648" respawnTime="60sec" /> <!-- Sodian -->
<npc id="33231" x="-114670" y="250225" z="-1744" heading="31161" respawnTime="60sec" /> <!-- -->
<npc id="33232" x="-113520" y="255104" z="-1496" heading="51488" respawnTime="60sec" /> <!-- -->
<npc id="33234" x="-113733" y="249870" z="-1693" heading="18544" respawnTime="60sec" /> <!-- Rinne -->
<npc id="33235" x="-113664" y="255584" z="-1496" heading="56420" respawnTime="60sec" /> <!-- -->
<npc id="33236" x="-113440" y="255952" z="-1496" heading="5188" respawnTime="60sec" /> <!-- -->
<npc id="33237" x="-113424" y="256240" z="-1496" heading="32256" respawnTime="60sec" /> <!-- -->

View File

@ -1396,6 +1396,16 @@
<point X="-116531" Y="257318" Z="-1512" delay="0" run="false" />
<point X="-116741" Y="255686" Z="-1424" delay="0" run="false" />
</route>
<route name="si_town_01" repeat="true" repeatStyle="back">
<target id="33234" spawnX="-113733" spawnY="249870" spawnZ="-1693" />
<point X="-113440" Y="249824" Z="-1816" delay="0" run="false" />
<point X="-113979" Y="250268" Z="-1816" delay="0" run="false" />
<point X="-114541" Y="252889" Z="-1536" delay="0" run="false" />
<point X="-114682" Y="254170" Z="-1528" delay="0" run="false" />
<point X="-114775" Y="255221" Z="-1512" delay="0" run="false" />
<point X="-113605" Y="256342" Z="-1496" delay="0" run="false" />
<point X="-112448" Y="256969" Z="-1480" delay="0" run="false" />
</route>
<route name="si_town_03" repeat="true" repeatStyle="back">
<target id="33208" spawnX="-114344" spawnY="255204" spawnZ="-1520" />
<point X="-114166" Y="255085" Z="-1528" delay="0" run="false" />
@ -1416,6 +1426,38 @@
<point X="-114550" Y="253273" Z="-1536" delay="0" run="false" />
<point X="-114343" Y="252676" Z="-1544" delay="0" run="false" />
</route>
<route name="si_monkey_road02" repeat="true" repeatStyle="back">
<target id="33218" spawnX="-113404" spawnY="249823" spawnZ="-1816" />
<point X="-114280" Y="252371" Z="-1560" delay="0" run="false" />
<point X="-114395" Y="250846" Z="-1760" delay="0" run="false" />
<point X="-113147" Y="250428" Z="-1920" delay="0" run="false" />
<point X="-112726" Y="250467" Z="-1984" delay="0" run="false" />
<point X="-112411" Y="250372" Z="-2032" delay="0" run="false" />
<point X="-112015" Y="249579" Z="-2280" delay="0" run="false" />
<point X="-110878" Y="249113" Z="-2512" delay="0" run="false" />
<point X="-110040" Y="248279" Z="-2704" delay="0" run="false" />
<point X="-109804" Y="247916" Z="-2776" delay="0" run="false" />
<point X="-109707" Y="246949" Z="-2960" delay="0" run="false" />
<point X="-109043" Y="246986" Z="-3112" delay="0" run="false" />
<point X="-107786" Y="248825" Z="-3216" delay="0" run="false" />
</route>
<route name="si_lib_02" repeat="true" repeatStyle="back">
<target id="33111" spawnX="-114945" spawnY="243991" spawnZ="-7968" />
<point X="-115087" Y="244056" Z="-7968" delay="0" run="false" />
<point X="-115376" Y="244716" Z="-7968" delay="0" run="false" />
<point X="-115247" Y="245152" Z="-7968" delay="0" run="false" />
<point X="-115087" Y="245291" Z="-7968" delay="0" run="false" />
<point X="-114628" Y="245384" Z="-7968" delay="0" run="false" />
<point X="-114285" Y="245265" Z="-7968" delay="0" run="false" />
<point X="-114178" Y="245119" Z="-7968" delay="0" run="false" />
<point X="-114112" Y="244728" Z="-7968" delay="0" run="false" />
<point X="-114155" Y="244311" Z="-7968" delay="0" run="false" />
<point X="-114375" Y="244073" Z="-7968" delay="0" run="false" />
<point X="-114634" Y="244011" Z="-7968" delay="0" run="false" />
<point X="-115037" Y="244079" Z="-7968" delay="0" run="false" />
<point X="-115320" Y="244411" Z="-7968" delay="0" run="false" />
<point X="-115322" Y="245040" Z="-7968" delay="0" run="false" />
</route>
<!-- Windmill Hill walkers -->
<route name="windmill_decoline1" repeat="true" repeatStyle="back">
<target id="33422" spawnX="-77644" spawnY="165991" spawnZ="-3704" />

View File

@ -18,6 +18,8 @@ package ai;
import java.util.logging.Logger;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.model.holders.MinionHolder;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
import com.l2jmobius.gameserver.util.Broadcast;
import com.l2jmobius.gameserver.util.Util;
/**
* Abstract NPC AI class for datapack based AIs.
@ -101,4 +104,36 @@ public abstract class AbstractNpcAI extends Quest
addMinion((L2MonsterInstance) npc, is.getId());
}
}
protected void followNpc(final L2Npc npc, int followedNpcId, int followingAngle, int minDistance, int maxDistance)
{
L2World.getInstance().forEachVisibleObject(npc, L2Npc.class, npcAround ->
{
if (npcAround.getId() != followedNpcId)
{
return;
}
final double distance = npc.calculateDistance(npcAround, true, false);
if ((distance >= maxDistance) && npc.isScriptValue(0))
{
npc.setRunning();
npc.setScriptValue(1);
}
else if ((distance <= (minDistance * 1.5)) && npc.isScriptValue(1))
{
npc.setWalking();
npc.setScriptValue(0);
}
final double course = Math.toRadians(followingAngle);
final double radian = Math.toRadians(Util.convertHeadingToDegree(npcAround.getHeading()));
final double nRadius = npc.getCollisionRadius() + npcAround.getCollisionRadius() + minDistance;
final int x = npcAround.getLocation().getX() + (int) (Math.cos(Math.PI + radian + course) * nRadius);
final int y = npcAround.getLocation().getY() + (int) (Math.sin(Math.PI + radian + course) * nRadius);
final int z = npcAround.getLocation().getZ();
npc.getAI().moveTo(new Location(x, y, z));
});
}
}

View File

@ -0,0 +1,80 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Allada AI.
* @author Gladicek
*/
public final class Allada extends AbstractNpcAI
{
// NPC
private static final int RINNE = 33234;
private static final int ALLADA = 33220;
// Items
private static final int WEAPON = 15304;
// Distances
private static final int MIN_DISTANCE = 70;
private static final int MAX_DISTANCE = 200;
private Allada()
{
addSpawnId(ALLADA);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_A_MIRACLE_THAT_THE_TALKING_ISLAND_HAS_RESTORED);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "WALK_AROUND_RINNE":
{
followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
npc.setRHandId(WEAPON);
followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addRepeatingTimer("WALK_AROUND_RINNE", 1000, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Allada();
}
}

View File

@ -0,0 +1,68 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Mei AI.
* @author Gladicek
*/
public final class Mei extends AbstractNpcAI
{
// NPC
private static final int MEI = 33280;
private static final int ROTINA = 33027;
private Mei()
{
addSpawnId(MEI);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
if (event.equals("NPC_SHOUT"))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IF_YOU_IGNORE_THE_TRAINING_GROUNDS_YOU_LL_REGRET_IT);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
}
else if (event.equals("NPC_FOLLOW"))
{
addSpawn(ROTINA, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0);
}
}
@Override
public String onSpawn(L2Npc npc)
{
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_FOLLOW", 100, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Mei();
}
}

View File

@ -0,0 +1,77 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Remons AI.
* @author Gladicek
*/
public final class Remons extends AbstractNpcAI
{
// NPC
private static final int REMONS = 33570;
private static final int SOROS = 33218;
// Distances
private static final int MIN_DISTANCE = 70;
private static final int MAX_DISTANCE = 200;
private Remons()
{
addSpawnId(REMONS);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.PERHAPS_EVEN_THE_VILLAGE_BECOMES_DANGEROUS);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "WALK_AROUND_SOROS":
{
followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addRepeatingTimer("WALK_AROUND_SOROS", 1000, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Remons();
}
}

View File

@ -0,0 +1,88 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Rinne AI.
* @author Gladicek
*/
public final class Rinne extends AbstractNpcAI
{
// NPC
private static final int RINNE = 33234;
private static final int ALLADA = 33220;
// Items
private static final int WEAPON = 15302;
private Rinne()
{
addSpawnId(RINNE);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "TID_LEFTWALK":
{
npc.setRHandId(WEAPON);
getTimers().addTimer("TID_STRAIGHTWALK", (5000 + getRandom(5)) * 1000, npc, null);
break;
}
case "TID_STRAIGHTWALK":
{
npc.setRHandId(0);
getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null);
break;
}
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ALL_RACES_CAME_TOGETHER_TO_REBUILD_TALKING_ISLAND_VILLAGE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "NPC_FOLLOW":
{
addSpawn(ALLADA, npc.getX() + 10, npc.getY() + 10, npc.getZ(), 0, false, 0);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_FOLLOW", 100, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Rinne();
}
}

View File

@ -0,0 +1,80 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Rotina AI.
* @author Gladicek
*/
public final class Rotina extends AbstractNpcAI
{
// NPC
private static final int ROTINA = 33027;
private static final int MEI = 33280;
// Items
private static final int WEAPON = 15304;
// Distances
private static final int MIN_DISTANCE = 70;
private static final int MAX_DISTANCE = 200;
private Rotina()
{
addSpawnId(ROTINA);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_LL_EARN_TONS_OF_ITEMS_USING_THE_TRAINING_GROUNDS);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "WALK_AROUND_MEI":
{
followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
npc.setRHandId(WEAPON);
followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addRepeatingTimer("WALK_AROUND_MEI", 1000, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Rotina();
}
}

View File

@ -0,0 +1,73 @@
/*
* 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 ai.areas.TalkingIsland.Walkers;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Soros AI.
* @author Gladicek
*/
public final class Soros extends AbstractNpcAI
{
// NPC
private static final int SOROS = 33218;
private static final int REMONS = 33570;
private Soros()
{
addSpawnId(SOROS);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "NPC_SHOUT":
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SOMETHING_LIKE_THAT_COMES_OUT_OF_THE_RUINS);
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
break;
}
case "NPC_FOLLOW":
{
addSpawn(REMONS, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0);
break;
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
getTimers().addTimer("NPC_FOLLOW", 100, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new Soros();
}
}

View File

@ -376,6 +376,7 @@
<npc id="33203" x="-104373" y="237534" z="-1832" heading="45762" respawnTime="60sec" /> <!-- -->
<npc id="33203" x="-104435" y="238801" z="-1704" heading="42818" respawnTime="60sec" /> <!-- -->
<npc id="33206" x="-117502" y="248539" z="-1968" heading="40800" respawnTime="60sec" /> <!-- Guard Captain -->
<npc id="33218" x="-113404" y="249823" z="-1816" heading="0" respawnTime="60sec" /> <!-- Soros -->
<npc id="33219" x="-105210" y="247610" z="-3640" heading="59900" respawnTime="60sec" /> <!-- Holly -->
<npc id="33223" x="-119816" y="246292" z="-968" heading="843" respawnTime="60sec" /> <!-- Bink -->
<npc id="33223" x="-114723" y="230366" z="-1664" heading="16383" respawnTime="60sec" /> <!-- Bink -->

View File

@ -188,6 +188,7 @@
<npc id="33229" x="-113856" y="253680" z="-1496" heading="32648" respawnTime="60sec" /> <!-- Sodian -->
<npc id="33231" x="-114670" y="250225" z="-1744" heading="31161" respawnTime="60sec" /> <!-- -->
<npc id="33232" x="-113520" y="255104" z="-1496" heading="51488" respawnTime="60sec" /> <!-- -->
<npc id="33234" x="-113733" y="249870" z="-1693" heading="18544" respawnTime="60sec" /> <!-- Rinne -->
<npc id="33235" x="-113664" y="255584" z="-1496" heading="56420" respawnTime="60sec" /> <!-- -->
<npc id="33236" x="-113440" y="255952" z="-1496" heading="5188" respawnTime="60sec" /> <!-- -->
<npc id="33237" x="-113424" y="256240" z="-1496" heading="32256" respawnTime="60sec" /> <!-- -->