Gainak Siege.
Contributed by gigilo1968.
This commit is contained in:
@@ -73,3 +73,12 @@ MaxReputation = 500
|
|||||||
# Reputation increase for kill one PK
|
# Reputation increase for kill one PK
|
||||||
# Default: 100
|
# Default: 100
|
||||||
ReputationIncrease = 100
|
ReputationIncrease = 100
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Gainak Siege
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Announce Gainak siege in all chat
|
||||||
|
# Default: false
|
||||||
|
AnnounceGainakSiege = false
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- TODO: Remove "castle" attributes from here, it should be loaded from TaxZones -->
|
<!-- TODO: Remove "castle" attributes from here, it should be loaded from TaxZones -->
|
||||||
<list enabled="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/MapRegion.xsd">
|
<list enabled="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/MapRegion.xsd">
|
||||||
<!-- Gainak -->
|
<!-- Gainak Town -->
|
||||||
<region name="gainak" town="Gainak" castle="9" locId="249" bbs="9">
|
<region name="gainak_town" town="Gainak Town" castle="9" locId="249" bbs="9">
|
||||||
<respawnPoint X="16319" Y="-114101" Z="-224" />
|
<respawnPoint X="16319" Y="-114101" Z="-224" />
|
||||||
<respawnPoint X="13612" Y="-113089" Z="-280" isChaotic="true" />
|
<respawnPoint X="13612" Y="-113089" Z="-280" isChaotic="true" />
|
||||||
<respawnPoint X="14357" Y="-111124" Z="-232" isChaotic="true" />
|
<respawnPoint X="14357" Y="-111124" Z="-232" isChaotic="true" />
|
184
L2J_Mobius_Underground/dist/game/data/scripts/ai/areas/GainakUnderground/GainakSiege.java
vendored
Normal file
184
L2J_Mobius_Underground/dist/game/data/scripts/ai/areas/GainakUnderground/GainakSiege.java
vendored
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
/*
|
||||||
|
* 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.GainakUnderground;
|
||||||
|
|
||||||
|
import com.l2jmobius.Config;
|
||||||
|
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||||
|
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||||
|
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.L2PcInstance;
|
||||||
|
import com.l2jmobius.gameserver.model.events.EventType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||||
|
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||||
|
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
|
||||||
|
import com.l2jmobius.gameserver.model.zone.L2ZoneType;
|
||||||
|
import com.l2jmobius.gameserver.model.zone.type.L2PeaceZone;
|
||||||
|
import com.l2jmobius.gameserver.model.zone.type.L2SiegeZone;
|
||||||
|
import com.l2jmobius.gameserver.network.NpcStringId;
|
||||||
|
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
|
import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
|
||||||
|
import com.l2jmobius.gameserver.network.serverpackets.OnEventTrigger;
|
||||||
|
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||||
|
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||||
|
import com.l2jmobius.gameserver.util.Broadcast;
|
||||||
|
|
||||||
|
import ai.AbstractNpcAI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author LasTravel, Gigi
|
||||||
|
* @URL http://l2wiki.com/Gainak
|
||||||
|
*/
|
||||||
|
public final class GainakSiege extends AbstractNpcAI
|
||||||
|
{
|
||||||
|
private static final int SIEGE_EFFECT = 20140700;
|
||||||
|
private static final int SIEGE_DURATION = 30;
|
||||||
|
private static final L2PeaceZone GAINAK_PEACE_ZONE = ZoneManager.getInstance().getZoneById(60018, L2PeaceZone.class);
|
||||||
|
private static final L2SiegeZone GAINAK_SIEGE_ZONE = ZoneManager.getInstance().getZoneById(60019, L2SiegeZone.class);
|
||||||
|
private static final L2PeaceZone GAINAK_TOWN_ZONE = ZoneManager.getInstance().getZoneById(60020, L2PeaceZone.class);
|
||||||
|
protected static final int[] ASSASSIN_IDS =
|
||||||
|
{
|
||||||
|
19471,
|
||||||
|
19472,
|
||||||
|
19473
|
||||||
|
};
|
||||||
|
private static final Location[] ASSASSIN_SPAWNS =
|
||||||
|
{
|
||||||
|
new Location(17085, -115385, -249, 41366),
|
||||||
|
new Location(15452, -114531, -243, 5464),
|
||||||
|
new Location(15862, -113121, -250, 53269)
|
||||||
|
};
|
||||||
|
private boolean _isInSiege = false;
|
||||||
|
|
||||||
|
public GainakSiege()
|
||||||
|
{
|
||||||
|
addEnterZoneId(GAINAK_SIEGE_ZONE.getId(), GAINAK_TOWN_ZONE.getId());
|
||||||
|
addKillId(ASSASSIN_IDS);
|
||||||
|
addSpawnId(ASSASSIN_IDS);
|
||||||
|
startQuestTimer("GAINAK_WAR", getTimeBetweenSieges() * 60000, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final int getTimeBetweenSieges()
|
||||||
|
{
|
||||||
|
return getRandom(120, 180); // 2 to 3 hours.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String onEnterZone(L2Character character, L2ZoneType zone)
|
||||||
|
{
|
||||||
|
if (_isInSiege && character.isPlayer())
|
||||||
|
{
|
||||||
|
character.broadcastPacket(new OnEventTrigger(SIEGE_EFFECT, true));
|
||||||
|
}
|
||||||
|
return super.onEnterZone(character, zone);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||||
|
{
|
||||||
|
if (event.equalsIgnoreCase("GAINAK_WAR"))
|
||||||
|
{
|
||||||
|
if (_isInSiege)
|
||||||
|
{
|
||||||
|
_isInSiege = false;
|
||||||
|
GAINAK_PEACE_ZONE.setEnabled(true);
|
||||||
|
GAINAK_SIEGE_ZONE.setIsActive(false);
|
||||||
|
GAINAK_SIEGE_ZONE.updateZoneStatusForCharactersInside();
|
||||||
|
GAINAK_TOWN_ZONE.broadcastPacket(new OnEventTrigger(SIEGE_EFFECT, false));
|
||||||
|
GAINAK_TOWN_ZONE.broadcastPacket(new ExShowScreenMessage(NpcStringId.GAINAK_IN_PEACE, ExShowScreenMessage.TOP_CENTER, 5000, true));
|
||||||
|
startQuestTimer("GAINAK_WAR", getTimeBetweenSieges() * 60000, null, null);
|
||||||
|
if (Config.ANNOUNCE_GAINAK_SIEGE)
|
||||||
|
{
|
||||||
|
SystemMessage s = SystemMessage.getSystemMessage(SystemMessageId.PROGRESS_EVENT_STAGE_S1);
|
||||||
|
s.addString("Gainak is now in peace.");
|
||||||
|
Broadcast.toAllOnlinePlayers(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (Location loc : ASSASSIN_SPAWNS)
|
||||||
|
{
|
||||||
|
addSpawn(ASSASSIN_IDS[getRandom(ASSASSIN_IDS.length)], loc, true, 1800000);
|
||||||
|
}
|
||||||
|
_isInSiege = true;
|
||||||
|
GAINAK_PEACE_ZONE.setEnabled(false);
|
||||||
|
GAINAK_SIEGE_ZONE.setIsActive(true);
|
||||||
|
GAINAK_SIEGE_ZONE.updateZoneStatusForCharactersInside();
|
||||||
|
GAINAK_TOWN_ZONE.broadcastPacket(new OnEventTrigger(SIEGE_EFFECT, true));
|
||||||
|
GAINAK_TOWN_ZONE.broadcastPacket(new ExShowScreenMessage(NpcStringId.GAINAK_IN_WAR, ExShowScreenMessage.TOP_CENTER, 5000, true));
|
||||||
|
startQuestTimer("GAINAK_WAR", SIEGE_DURATION * 60000, null, null);
|
||||||
|
if (Config.ANNOUNCE_GAINAK_SIEGE)
|
||||||
|
{
|
||||||
|
SystemMessage s = SystemMessage.getSystemMessage(SystemMessageId.PROGRESS_EVENT_STAGE_S1);
|
||||||
|
s.addString("Gainak is now under siege.");
|
||||||
|
Broadcast.toAllOnlinePlayers(s);
|
||||||
|
}
|
||||||
|
ZoneManager.getInstance().getZoneById(GAINAK_TOWN_ZONE.getId(), L2PeaceZone.class).setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.onAdvEvent(event, npc, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
|
||||||
|
{
|
||||||
|
final L2SiegeZone zone = ZoneManager.getInstance().getZone(npc, L2SiegeZone.class);
|
||||||
|
if ((zone != null) && (zone.getId() == 60019) && zone.isActive())
|
||||||
|
{
|
||||||
|
ThreadPoolManager.getInstance().scheduleAi(new RespawnNewAssassin(npc.getLocation()), 60000);
|
||||||
|
}
|
||||||
|
return super.onKill(npc, killer, isSummon);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class RespawnNewAssassin implements Runnable
|
||||||
|
{
|
||||||
|
private final Location _loc;
|
||||||
|
|
||||||
|
public RespawnNewAssassin(Location loc)
|
||||||
|
{
|
||||||
|
_loc = loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
addSpawn(ASSASSIN_IDS[getRandom(ASSASSIN_IDS.length)], _loc, true, 1800000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RegisterEvent(EventType.ON_CREATURE_DEATH)
|
||||||
|
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
|
||||||
|
public void onPlayerDeath(OnCreatureDeath event)
|
||||||
|
{
|
||||||
|
if (_isInSiege && GAINAK_SIEGE_ZONE.getCharactersInside().contains(event.getTarget()))
|
||||||
|
{
|
||||||
|
if (event.getAttacker().isPlayer() && event.getTarget().isPlayer())
|
||||||
|
{
|
||||||
|
final L2PcInstance attackerPlayer = event.getAttacker().getActingPlayer();
|
||||||
|
attackerPlayer.setPvpKills(attackerPlayer.getPvpKills() + 1);
|
||||||
|
attackerPlayer.sendPacket(new UserInfo(attackerPlayer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
new GainakSiege();
|
||||||
|
}
|
||||||
|
}
|
@@ -734,4 +734,23 @@
|
|||||||
<node X="174301" Y="-75214" />
|
<node X="174301" Y="-75214" />
|
||||||
<node X="172174" Y="-75213" />
|
<node X="172174" Y="-75213" />
|
||||||
</zone>
|
</zone>
|
||||||
|
<zone name="GainakSiege" id="60019" type="SiegeZone" shape="NPoly" minZ="-265" maxZ="-11">
|
||||||
|
<node X="14816" Y="-114416" />
|
||||||
|
<node X="14576" Y="-113968" />
|
||||||
|
<node X="14752" Y="-112736" />
|
||||||
|
<node X="15415" Y="-111960" />
|
||||||
|
<node X="15691" Y="-111730" />
|
||||||
|
<node X="17559" Y="-110950" />
|
||||||
|
<node X="18291" Y="-112548" />
|
||||||
|
<node X="15936" Y="-113920" />
|
||||||
|
<node X="16275" Y="-114501" />
|
||||||
|
<node X="17642" Y="-113922" />
|
||||||
|
<node X="18222" Y="-114615" />
|
||||||
|
<node X="18637" Y="-115667" />
|
||||||
|
<node X="17536" Y="-116128" />
|
||||||
|
<node X="17138" Y="-116183" />
|
||||||
|
<node X="16080" Y="-116096" />
|
||||||
|
<node X="15130" Y="-115345" />
|
||||||
|
<node X="14972" Y="-114864" />
|
||||||
|
</zone>
|
||||||
</list>
|
</list>
|
@@ -715,4 +715,25 @@
|
|||||||
<node X="15990" Y="156337" />
|
<node X="15990" Y="156337" />
|
||||||
<node X="16918" Y="156180" />
|
<node X="16918" Y="156180" />
|
||||||
</zone>
|
</zone>
|
||||||
|
<zone name="Gainak" id="60018" type="PeaceZone" shape="NPoly" minZ="-265" maxZ="-11">
|
||||||
|
<node X="16730" Y="-114228" />
|
||||||
|
<node X="16332" Y="-114494" />
|
||||||
|
<node X="15950" Y="-113926" />
|
||||||
|
<node X="16463" Y="-113659" />
|
||||||
|
</zone>
|
||||||
|
<zone name="Town_Gainak" id="60020" type="PeaceZone" shape="NPoly" minZ="-265" maxZ="-11">
|
||||||
|
<node X="18516" Y="-115719" />
|
||||||
|
<node X="17559" Y="-116151" />
|
||||||
|
<node X="17082" Y="-116262" />
|
||||||
|
<node X="16104" Y="-116077" />
|
||||||
|
<node X="15137" Y="-115336" />
|
||||||
|
<node X="14933" Y="-114923" />
|
||||||
|
<node X="14733" Y="-114375" />
|
||||||
|
<node X="14604" Y="-113963" />
|
||||||
|
<node X="14768" Y="-112741" />
|
||||||
|
<node X="15404" Y="-111955" />
|
||||||
|
<node X="15687" Y="-111689" />
|
||||||
|
<node X="16823" Y="-111297" />
|
||||||
|
<node X="18541" Y="-115694" />
|
||||||
|
</zone>
|
||||||
</list>
|
</list>
|
@@ -768,6 +768,7 @@ public final class Config
|
|||||||
public static boolean ANTIFEED_DUALBOX;
|
public static boolean ANTIFEED_DUALBOX;
|
||||||
public static boolean ANTIFEED_DISCONNECTED_AS_DUALBOX;
|
public static boolean ANTIFEED_DISCONNECTED_AS_DUALBOX;
|
||||||
public static int ANTIFEED_INTERVAL;
|
public static int ANTIFEED_INTERVAL;
|
||||||
|
public static boolean ANNOUNCE_GAINAK_SIEGE;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Rate Settings
|
// Rate Settings
|
||||||
@@ -2268,6 +2269,7 @@ public final class Config
|
|||||||
PVP_PVP_TIME = PVPSettings.getInt("PvPVsPvPTime", 60000);
|
PVP_PVP_TIME = PVPSettings.getInt("PvPVsPvPTime", 60000);
|
||||||
MAX_REPUTATION = PVPSettings.getInt("MaxReputation", 500);
|
MAX_REPUTATION = PVPSettings.getInt("MaxReputation", 500);
|
||||||
REPUTATION_INCREASE = PVPSettings.getInt("ReputationIncrease", 100);
|
REPUTATION_INCREASE = PVPSettings.getInt("ReputationIncrease", 100);
|
||||||
|
ANNOUNCE_GAINAK_SIEGE = PVPSettings.getBoolean("AnnounceGainakSiege", false);
|
||||||
|
|
||||||
// Load Olympiad L2Properties file (if exists)
|
// Load Olympiad L2Properties file (if exists)
|
||||||
final PropertiesParser Olympiad = new PropertiesParser(OLYMPIAD_CONFIG_FILE);
|
final PropertiesParser Olympiad = new PropertiesParser(OLYMPIAD_CONFIG_FILE);
|
||||||
|
Reference in New Issue
Block a user