Noticias:

No tienes permiso para ver los enlaces. Para poder verlos Registrate o Conectate.

Menú Principal

Evento Rudolphs Blessing

Iniciado por Swarlog, Jul 15, 2025, 12:05 AM

Tema anterior - Siguiente tema

Swarlog

CitarCORE:

### Eclipse Workspace Patch 1.0
#P L2J_Server_BETA
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(revision 5758)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -372,7 +372,13 @@
 	public FastList<TransformListener> transformListeners = new FastList<TransformListener>().shared();
 	public FastList<ProfessionChangeListener> professionChangeListeners = new FastList<ProfessionChangeListener>().shared();
 	public static FastList<ProfessionChangeListener> globalProfessionChangeListeners = new FastList<ProfessionChangeListener>().shared();
+	public static List<IPlayerAgathionListener> _agathionListeners = new FastList<IPlayerAgathionListener>().shared();
 	
+	public interface IPlayerAgathionListener
+	{
+		public boolean onAgathionSet(L2PcInstance player, int prevAgathion, int newAgathion);
+	}
+	
 	public class AIAccessor extends L2Character.AIAccessor
 	{
 		public L2PcInstance getPlayer()
@@ -14234,6 +14240,13 @@
 	 */
 	public void setAgathionId(int npcId)
 	{
+		for (IPlayerAgathionListener listener : _agathionListeners)
+		{
+			if (!listener.onAgathionSet(this, _agathionId, npcId))
+			{
+				return;
+			}
+		}
 		_agathionId = npcId;
 	}
 	
@@ -16482,4 +16495,14 @@
 	{
 		globalProfessionChangeListeners.remove(listener);
 	}
+	
+	public static void addAgathionListener(IPlayerAgathionListener listener)
+	{
+		_agathionListeners.add(listener);
+	}
+	
+	public static void removeAgathionListener(IPlayerAgathionListener listener)
+	{
+		_agathionListeners.remove(listener);
+	}
 }
\ No newline at end of file

CitarDATA:

Index: dist/game/data/scripts.cfg
===================================================================
--- dist/game/data/scripts.cfg	 (revision 0)
+++ dist/game/data/scripts.cfg   (working copy)
@@ -790,2 +790,3 @@
 #events/FreyaCelebration/FreyaCelebration.java
 #events/MasterOfEnchanting/MasterOfEnchanting.java
+#events/RudolphsBlessing/RudolphsBlessing.java
Index: dist/game/data/scripts/events/RudolphsBlessing/13285.htm
===================================================================
--- dist/game/data/scripts/events/RudolphsBlessing/13285.htm   (revision 0)
+++ dist/game/data/scripts/events/RudolphsBlessing/13285.htm   (working copy)
@@ -0,0 +1,11 @@
+<html><body>Santa Claus:<br>
+Have you heard about the Santa privilege?<br>
+Apprentice Santas spend a lot of time taking care of weak Rudolphs.<br>
+Reising a healthy Rudolph is very important to us.<br>
+But during the Christmas season, we don't have a lot of time to spend taking care of the Rudolphs.<br>
+This year, one apprentice Santa came up with a good idea. We would give people the gift of taking care of a weak Rudolph. It's a great idea, don't you think? We thought it would also give people the gift of joy in doing something good.<br>
+Well? Are you interested in this Santa present?<br>
+<a action="bypass -h Quest RudolphsBlessing 13285-01.htm">I will take cara of a weak Rudolph.</a><br>
+<a action="bypass -h Quest RudolphsBlessing 13285-02.htm">I'm not interested.</a><br>
+<a action="bypass -h Quest RudolphsBlessing reward"><font color="LEVEL">Give 50 Ice Candy Pieces.</font></a>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/RudolphsBlessing/13285-01.htm
===================================================================
--- dist/game/data/scripts/events/RudolphsBlessing/13285-01.htm	  (revision 0)
+++ dist/game/data/scripts/events/RudolphsBlessing/13285-01.htm   (working copy)
@@ -0,0 +1,8 @@
+<html><body>Santa Claus:<br>
+Hahaha... Good!<br>
+Rudolph like to ear <font color="LEVEL">"Fresh Herbs"</font> If you feed it this herb continuously, it will grow into a strong Rudolph. You can find the herbs while hunting without much difficulty.<br>
+When Rudolph's energy runs low, it will go into your pack, find the herb, and eat it. Remember that he'll want to eat about every 10 minutes.<br>
+Also, every time Rudolph eats the herb, it will cast a beneficial spell on you to show you its thanks.<br>
+Finally, you have to donate 2014 adena to receive a weak Rudolph. How should I say this... Think of it as your annual donation to help the less fortunate.<br>
+<a action="bypass -h Quest RudolphsBlessing rudolph">Donate to help the less fortunate. (2014 adena)</a>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/RudolphsBlessing/13285-02.htm
===================================================================
--- dist/game/data/scripts/events/RudolphsBlessing/13285-02.htm   (revision 0)
+++ dist/game/data/scripts/events/RudolphsBlessing/13285-02.htm   (working copy)
@@ -0,0 +1,6 @@
+<html><body>Santa Claus:<br>
+Yes. The role of Santa has meaning for people who are full of love.<br>
+But if you find any <font color="LEVEL">"Ice Candy Pieces"</font> while out hunting, please bring them to me. I had a hole in my bag of presents, and several "Ice Candy" gift boxes fell out.<br>
+I', counting on you.<br>
+If you give me <font color="LEVEL">50 pieces</font> of the <font color="LEVEL">Ice Candy Pieces</font>, I'll give you a fitting Christmas <font color="LEVEL">present.</font>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/RudolphsBlessing/13285-03.htm
===================================================================
--- dist/game/data/scripts/events/RudolphsBlessing/13285-03.htm   (revision 0)
+++ dist/game/data/scripts/events/RudolphsBlessing/13285-03.htm   (working copy)
@@ -0,0 +1,5 @@
+<html><body>Santa Claus:<br>
+Hmm... There aren't enough Ice Candy Pieces.<br>
+<font color="LEVEL">Ice Candy Pieces</font> come in <font color="LEVEL">50 piece</font> units.<br>
+<a action="bypass -h Quest RudolphsBlessing 13285.htm">Back</a>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/RudolphsBlessing/13285-04.htm
===================================================================
--- dist/game/data/scripts/events/RudolphsBlessing/13285-04.htm   (revision 0)
+++ dist/game/data/scripts/events/RudolphsBlessing/13285-04.htm   (working copy)
@@ -0,0 +1,4 @@
+<html><body>Santa Claus:<br>
+Please take good care of him.<br>
+I'll look forward to him growing up into a strong Rudolph by the time Christmas ends.
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/RudolphsBlessing/13285-05.htm
===================================================================
--- dist/game/data/scripts/events/RudolphsBlessing/13285-05.htm   (revision 0)
+++ dist/game/data/scripts/events/RudolphsBlessing/13285-05.htm   (working copy)
@@ -0,0 +1,3 @@
+<html><body>Santa Claus:<br>
+you've already received a Rudolph Agathion.<br>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/RudolphsBlessing/13285-06.htm
===================================================================
--- dist/game/data/scripts/events/RudolphsBlessing/13285-06.htm   (revision 0)
+++ dist/game/data/scripts/events/RudolphsBlessing/13285-06.htm   (working copy)
@@ -0,0 +1,4 @@
+<html><body>Santa Claus:<br>
+Oh no, not enough adena.<br>
+If you donate <font color="LEVEL">"2014 adena"</font> to help the less fortunate, I'll give you Rudolph Agathion that you can raise.
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/RudolphsBlessing/config.xml
===================================================================
--- dist/game/data/scripts/events/RudolphsBlessing/config.xml   (revision 0)
+++ dist/game/data/scripts/events/RudolphsBlessing/config.xml	(working copy)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<event name="Rudolphs Blessing" active="21 12 2011-4 01 2012" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/eventConfig.xsd">
+	<droplist>
+		<add item="21915" min="1" max="1" chance="45%" /> <!-- Ice Candy Piece -->
+		<add item="21872" min="1" max="1" chance="5%" /> <!-- Fresh Herb -->
+	</droplist>
+	<spawnlist>
+		<add npc="13285" x="-119494" y="44882" z="360" heading="24576" />
+		<add npc="13285" x="-117239" y="46842" z="360" heading="49151" />
+		<add npc="13285" x="-84023" y="243051" z="-3728" heading="4096" />
+		<add npc="13285" x="-84411" y="244813" z="-3728" heading="57343" />
+		<add npc="13285" x="46908" y="50856" z="-2992" heading="8192" />
+		<add npc="13285" x="45538" y="48357" z="-3056" heading="18000" />
+		<add npc="13285" x="-45372" y="-114104" z="-240" heading="16384" />
+		<add npc="13285" x="-45278" y="-112766" z="-240" heading="0" />
+		<add npc="13285" x="9929" y="16324" z="-4568" heading="62999" />
+		<add npc="13285" x="11546" y="17599" z="-4584" heading="46900" />
+		<add npc="13285" x="115096" y="-178370" z="-880" heading="0" />
+		<add npc="13285" x="116199" y="-182694" z="-1506" heading="0" />
+		<add npc="13285" x="-13727" y="122117" z="-2984" heading="16384" />
+		<add npc="13285" x="-14129" y="123869" z="-3112" heading="40959" />
+		<add npc="13285" x="-83156" y="150994" z="-3120" heading="0" />
+		<add npc="13285" x="-81031" y="150038" z="-3040" heading="0" />
+		<add npc="13285" x="16111" y="142850" z="-2696" heading="16000" />
+		<add npc="13285" x="117356" y="76708" z="-2695" heading="49151" />
+		<add npc="13285" x="115887" y="76382" z="-2714" heading="0" />
+		<add npc="13285" x="17275" y="145000" z="-3032" heading="25000" />
+		<add npc="13285" x="111004" y="218928" z="-3536" heading="16384" />
+		<add npc="13285" x="108426" y="221876" z="-3600" heading="49151" />
+		<add npc="13285" x="81755" y="146487" z="-3528" heading="32768" />
+		<add npc="13285" x="82145" y="148609" z="-3464" heading="0" />           
+		<add npc="13285" x="83037" y="149324" z="-3464" heading="44000" />
+		<add npc="13285" x="81987" y="53723" z="-1488" heading="0" />
+		<add npc="13285" x="81083" y="56118" z="-1562" heading="32768" />
+		<add npc="13285" x="147200" y="25614" z="-2008" heading="16384" />
+		<add npc="13285" x="148557" y="26806" z="-2200" heading="32768" />
+		<add npc="13285" x="147421" y="-55435" z="-2728" heading="49151" />
+		<add npc="13285" x="148206" y="-55786" z="-2776" heading="61439" />
+		<add npc="13285" x="85584" y="-142490" z="-1336" heading="0" />
+		<add npc="13285" x="86865" y="-142915" z="-1336" heading="26000" />
+		<add npc="13285" x="43966" y="-47709" z="-792" heading="49999" />
+		<add npc="13285" x="43165" y="-48461" z="-792" heading="17000" />
+	</spawnlist>
+	<messages>
+		<add type="onEnd" text="Rudolphs Blessing: Event end!" />
+		<add type="onEnter" text="Rudolphs Blessing: Event ongoing!" />
+	</messages>
+</event>
\ No newline at end of file
Index: dist/game/data/scripts/events/RudolphsBlessing/RudolphsBlessing.java
===================================================================
--- dist/game/data/scripts/events/RudolphsBlessing/RudolphsBlessing.java   (revision 0)
+++ dist/game/data/scripts/events/RudolphsBlessing/RudolphsBlessing.java	(working copy)
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2004-2013 L2J DataPack
+ * 
+ * This file is part of L2J DataPack.
+ * 
+ * L2J DataPack 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.
+ * 
+ * L2J DataPack 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 events.RudolphsBlessing;
+
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.IPlayerAgathionListener;
+import com.l2jserver.gameserver.model.event.LongTimeEvent;
+import com.l2jserver.gameserver.model.holders.ItemHolder;
+import com.l2jserver.gameserver.model.holders.SkillHolder;
+import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.quest.State;
+
+/**
+ * @author IvanTotov
+ */
+public class RudolphsBlessing extends LongTimeEvent implements IPlayerAgathionListener
+{
+	
+	private static final int SANTA_CLAUS = 13285;
+	
+	private static final int AGATHION_SEAL_BRACELET_RUDOLPH = 21709;
+	private static final int AGATHION_SEAL_BRACELET_RUDOLPH_NPC = 1598;
+	private static final int ICE_CANDY_PIECE = 21915;
+	private static final int SANTA_CLAUS_TREASURE_BOX = 21873;
+	
+	private static final int RUDOLPH_PRICE = 2014;
+	
+	private static final SkillHolder RUDOLPH_BLESSING = new SkillHolder(23297, 1);
+	private static final ItemHolder ITEM_REQUIREMENT = new ItemHolder(21872, 2);
+	
+	public RudolphsBlessing(String name, String descr)
+	{
+		super(name, descr);
+		addStartNpc(SANTA_CLAUS);
+		addFirstTalkId(SANTA_CLAUS);
+		addTalkId(SANTA_CLAUS);
+		L2PcInstance.addAgathionListener(this);
+	}
+	
+	@Override
+	public boolean unload(boolean removeFromList)
+	{
+		L2PcInstance.removeAgathionListener(this);
+		return super.unload(removeFromList);
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = event;
+		if (event.equals("rudolph_eat"))
+		{
+			if ((player != null) && player.isOnline())
+			{
+				if (takeItems(player, ITEM_REQUIREMENT.getId(), ITEM_REQUIREMENT.getCount()))
+				{
+					RUDOLPH_BLESSING.getSkill().getEffects(player, player);
+				}
+				startQuestTimer("rudolph_eat", 10 * 60 * 1000, null, player);
+			}
+		}
+		if (player == null)
+		{
+			return null;
+		}
+		QuestState st = player.getQuestState(getName());
+		if (st == null)
+		{
+			return null;
+		}
+		if (event.equalsIgnoreCase("rudolph"))
+		{
+			if (st.isCond(1))
+			{
+				htmltext = "13285-05.htm";
+			}
+			else if (player.getAdena() < RUDOLPH_PRICE)
+			{
+				htmltext = "13285-06.htm";
+			}
+			else
+			{
+				st.setState(State.STARTED);
+				st.setCond(1);
+				st.takeItems(PcInventory.ADENA_ID, RUDOLPH_PRICE);
+				st.giveItems(AGATHION_SEAL_BRACELET_RUDOLPH, 1);
+				htmltext = "13285-04.htm";
+			}
+		}
+		else if (event.equalsIgnoreCase("event_info"))
+		{
+			htmltext = "13285-02.htm";
+		}
+		else if (event.equalsIgnoreCase("reward"))
+		{
+			if (st.getQuestItemsCount(ICE_CANDY_PIECE) >= 50)
+			{
+				st.takeItems(ICE_CANDY_PIECE, 50);
+				st.giveItems(SANTA_CLAUS_TREASURE_BOX, 1);
+			}
+			else
+			{
+				htmltext = "13285-03.htm";
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public boolean onAgathionSet(L2PcInstance player, int prevAgathion, int newAgathion)
+	{
+		if (prevAgathion == AGATHION_SEAL_BRACELET_RUDOLPH_NPC && newAgathion == 0) // unset
+		{
+			cancelQuestTimer("rudolph_eat", null, player);
+		}
+		else if (newAgathion == AGATHION_SEAL_BRACELET_RUDOLPH_NPC)
+		{
+			startQuestTimer("rudolph_eat", 10 * 60 * 1000, null, player);
+		}
+		return true;
+	}
+	
+	@Override
+	public String onFirstTalk(L2Npc npc, L2PcInstance player)
+	{
+		if (player.getQuestState(getName()) == null)
+		{
+			newQuestState(player);
+		}
+		return "13285.htm";
+	}
+	
+	public static void main(String[] args)
+	{
+		new RudolphsBlessing(RudolphsBlessing.class.getSimpleName(), "events");
+	}
+}