diff --git a/trunk/dist/game/data/scripts.cfg b/trunk/dist/game/data/scripts.cfg index 104bf104da..0dcec6b0d6 100644 --- a/trunk/dist/game/data/scripts.cfg +++ b/trunk/dist/game/data/scripts.cfg @@ -122,6 +122,7 @@ ai/group_template/FairyTrees.java ai/group_template/FeedableBeasts.java ai/group_template/FleeMonsters.java ai/group_template/FrozenLabyrinth.java +ai/group_template/EventShrines.java ai/group_template/GiantsCave.java ai/group_template/HillsOfGold.java ai/group_template/HotSprings.java diff --git a/trunk/dist/game/data/scripts/ai/group_template/EventShrines.java b/trunk/dist/game/data/scripts/ai/group_template/EventShrines.java new file mode 100644 index 0000000000..6d92540465 --- /dev/null +++ b/trunk/dist/game/data/scripts/ai/group_template/EventShrines.java @@ -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 . + */ +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 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(); + } +} \ No newline at end of file diff --git a/trunk/dist/game/data/xsd/eventConfig.xsd b/trunk/dist/game/data/xsd/eventConfig.xsd index 01812477c8..7e58ebd06c 100644 --- a/trunk/dist/game/data/xsd/eventConfig.xsd +++ b/trunk/dist/game/data/xsd/eventConfig.xsd @@ -54,6 +54,7 @@ + \ No newline at end of file diff --git a/trunk/dist/game/data/zones/custom_town.xml b/trunk/dist/game/data/zones/custom_town.xml index 5ddfdb78b4..c82ac5a821 100644 --- a/trunk/dist/game/data/zones/custom_town.xml +++ b/trunk/dist/game/data/zones/custom_town.xml @@ -65,51 +65,13 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -635,4 +597,21 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/java/com/l2jmobius/gameserver/instancemanager/EventShrineManager.java b/trunk/java/com/l2jmobius/gameserver/instancemanager/EventShrineManager.java new file mode 100644 index 0000000000..fc253300b8 --- /dev/null +++ b/trunk/java/com/l2jmobius/gameserver/instancemanager/EventShrineManager.java @@ -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 . + */ +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; + } +} diff --git a/trunk/java/com/l2jmobius/gameserver/model/event/LongTimeEvent.java b/trunk/java/com/l2jmobius/gameserver/model/event/LongTimeEvent.java index 42aee19acd..31bfd0de9a 100644 --- a/trunk/java/com/l2jmobius/gameserver/model/event/LongTimeEvent.java +++ b/trunk/java/com/l2jmobius/gameserver/model/event/LongTimeEvent.java @@ -36,6 +36,7 @@ import com.l2jmobius.gameserver.data.sql.impl.AnnouncementsTable; import com.l2jmobius.gameserver.data.xml.impl.NpcData; import com.l2jmobius.gameserver.datatables.EventDroplist; import com.l2jmobius.gameserver.datatables.ItemTable; +import com.l2jmobius.gameserver.instancemanager.EventShrineManager; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.announce.EventAnnouncement; 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(); _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) { final String dropPeriod = doc.getDocumentElement().getAttributes().getNamedItem("dropPeriod").getNodeValue();