Event Shrines.

Contributed by hlwrave.
This commit is contained in:
MobiusDev
2016-02-18 21:00:01 +00:00
parent a2263e7014
commit af3f5ce7b7
6 changed files with 142 additions and 43 deletions

View File

@ -122,6 +122,7 @@ ai/group_template/FairyTrees.java
ai/group_template/FeedableBeasts.java ai/group_template/FeedableBeasts.java
ai/group_template/FleeMonsters.java ai/group_template/FleeMonsters.java
ai/group_template/FrozenLabyrinth.java ai/group_template/FrozenLabyrinth.java
ai/group_template/EventShrines.java
ai/group_template/GiantsCave.java ai/group_template/GiantsCave.java
ai/group_template/HillsOfGold.java ai/group_template/HillsOfGold.java
ai/group_template/HotSprings.java ai/group_template/HotSprings.java

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.group_template;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.instancemanager.EventShrineManager;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.model.zone.L2ZoneType;
import com.l2jmobius.gameserver.network.serverpackets.OnEventTrigger;
/**
* @author hlwrave, Mobius
* @Add in event config.xml enableShrines="true" after event name to enable them.
*/
final class EventShrines extends Quest
{
private static final Map<Integer, Integer> ZONE_TRIGGERS = new HashMap<>();
static
{
ZONE_TRIGGERS.put(11030, 23206292); // Hunter
ZONE_TRIGGERS.put(11031, 24186292); // Aden
ZONE_TRIGGERS.put(11032, 24166292); // Goddard
ZONE_TRIGGERS.put(11035, 22136292); // Shuttgard
ZONE_TRIGGERS.put(11028, 20226292); // Dion
ZONE_TRIGGERS.put(11029, 22196292); // Oren
ZONE_TRIGGERS.put(11020, 22226292); // Giran
ZONE_TRIGGERS.put(11027, 19216292); // Gludio
ZONE_TRIGGERS.put(11034, 23246292); // Heine
ZONE_TRIGGERS.put(11025, 17226292); // Gluddin
ZONE_TRIGGERS.put(11033, 21166292); // Rune
ZONE_TRIGGERS.put(11042, 17256292); // Faeron
ZONE_TRIGGERS.put(11043, 26206292); // Arcan
ZONE_TRIGGERS.put(11022, 16256292); // Talking Island
}
public EventShrines()
{
super(-1, "Event Shrines", "Event Shrines");
addEnterZoneId(ZONE_TRIGGERS.keySet());
}
@Override
public String onEnterZone(L2Character character, L2ZoneType zone)
{
if (character.isPlayer() && EventShrineManager.areShrinesEnabled())
{
character.sendPacket(new OnEventTrigger(ZONE_TRIGGERS.get(zone.getId()), true));
}
return super.onEnterZone(character, zone);
}
public static void main(String[] args)
{
new EventShrines();
}
}

View File

@ -54,6 +54,7 @@
</xs:sequence> </xs:sequence>
<xs:attribute name="name" type="xs:token" use="required" /> <xs:attribute name="name" type="xs:token" use="required" />
<xs:attribute name="active" type="xs:token" use="required" /> <xs:attribute name="active" type="xs:token" use="required" />
<xs:attribute name="enableShrines" type="xs:token" />
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:schema> </xs:schema>

View File

@ -65,51 +65,13 @@
<node X="13891" Y="13025" /> <node X="13891" Y="13025" />
<node X="15542" Y="15230" /> <node X="15542" Y="15230" />
</zone> </zone>
<zone name="Talking Island" id="11022" type="TownZone" shape="NPoly" minZ="-3800" maxZ="-3700"> <zone name="Talking Island" id="11022" type="TownZone" shape="NPoly" minZ="-1100" maxZ="-1700">
<stat name="townId" val="2" /> <stat name="townId" val="2" />
<stat name="taxById" val="1" /> <stat name="taxById" val="1" />
<node X="-83739" Y="245733" /> <node X="-110711" Y="257870" />
<node X="-84049" Y="246087" /> <node X="-117310" Y="257714" />
<node X="-84289" Y="246258" /> <node X="-116972" Y="252254" />
<node X="-84556" Y="246243" /> <node X="-111850" Y="252314" />
<node X="-84984" Y="245820" />
<node X="-85336" Y="245426" />
<node X="-85684" Y="245099" />
<node X="-85969" Y="244770" />
<node X="-86400" Y="244292" />
<node X="-86664" Y="243997" />
<node X="-86940" Y="243631" />
<node X="-87517" Y="243034" />
<node X="-87650" Y="242799" />
<node X="-87613" Y="242572" />
<node X="-87348" Y="242246" />
<node X="-86956" Y="241942" />
<node X="-86656" Y="241684" />
<node X="-86343" Y="241365" />
<node X="-85829" Y="240966" />
<node X="-85544" Y="240765" />
<node X="-85193" Y="240440" />
<node X="-84865" Y="240185" />
<node X="-84594" Y="239866" />
<node X="-84284" Y="239666" />
<node X="-84002" Y="239734" />
<node X="-83822" Y="239922" />
<node X="-83640" Y="240190" />
<node X="-83295" Y="240492" />
<node X="-82990" Y="240878" />
<node X="-82635" Y="241208" />
<node X="-82234" Y="241698" />
<node X="-82027" Y="241985" />
<node X="-81684" Y="242328" />
<node X="-81421" Y="242741" />
<node X="-81113" Y="243073" />
<node X="-81011" Y="243228" />
<node X="-81029" Y="243496" />
<node X="-81340" Y="243797" />
<node X="-81691" Y="244028" />
<node X="-82292" Y="244585" />
<node X="-82787" Y="244999" />
<node X="-83726" Y="245721" />
</zone> </zone>
<zone name="Elven Village" id="11023" type="TownZone" shape="NPoly" minZ="-3600" maxZ="-2750"> <zone name="Elven Village" id="11023" type="TownZone" shape="NPoly" minZ="-3600" maxZ="-2750">
<stat name="townId" val="3" /> <stat name="townId" val="3" />
@ -635,4 +597,21 @@
<node X="32768" Y="262143" /> <node X="32768" Y="262143" />
<node X="-32768" Y="262143" /> <node X="-32768" Y="262143" />
</zone> </zone>
<zone name="Faeron Village" id="11042" type="TownZone" shape="NPoly" minZ="-3866" maxZ="-2866">
<node X="-82791" Y="248383" />
<node X="-81763" Y="247611" />
<node X="-79546" Y="246146" />
<node X="-78124" Y="246275" />
<node X="-76771" Y="247497" />
<node X="-76094" Y="248657" />
<node X="-77833" Y="252164" />
<node X="-79415" Y="253191" />
<node X="-81691" Y="255369" />
<node X="-84012" Y="254772" />
<node X="-84175" Y="254116" />
<node X="-83749" Y="251334" />
</zone>
<zone name="Arcan City" id="11043" type="TownZone" shape="Cylinder" minZ="-2000" maxZ="-200" rad="4500">
<node X="207096" Y="88696" />
</zone>
</list> </list>

View File

@ -0,0 +1,35 @@
/*
* 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 com.l2jmobius.gameserver.instancemanager;
/**
* @author Mobius
*/
public final class EventShrineManager
{
private static boolean ENABLE_SHRINES = false;
public static boolean areShrinesEnabled()
{
return ENABLE_SHRINES;
}
public static void setEnabled(boolean enabled)
{
ENABLE_SHRINES = enabled;
}
}

View File

@ -36,6 +36,7 @@ import com.l2jmobius.gameserver.data.sql.impl.AnnouncementsTable;
import com.l2jmobius.gameserver.data.xml.impl.NpcData; import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.datatables.EventDroplist; import com.l2jmobius.gameserver.datatables.EventDroplist;
import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.instancemanager.EventShrineManager;
import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.announce.EventAnnouncement; import com.l2jmobius.gameserver.model.announce.EventAnnouncement;
import com.l2jmobius.gameserver.model.drops.DropListScope; import com.l2jmobius.gameserver.model.drops.DropListScope;
@ -123,6 +124,15 @@ public class LongTimeEvent extends Quest
final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue(); final String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
_eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US)); _eventPeriod = DateRange.parse(period, new SimpleDateFormat("dd MM yyyy", Locale.US));
if (doc.getDocumentElement().getAttributes().getNamedItem("enableShrines") != null)
{
final String enableShrines = doc.getDocumentElement().getAttributes().getNamedItem("enableShrines").getNodeValue();
if (enableShrines.equalsIgnoreCase("true"))
{
EventShrineManager.setEnabled(true);
}
}
if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null) if (doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod") != null)
{ {
final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue(); final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();