This commit is contained in:
7
trunk/dist/game/data/scripts/events/FreyaCelebration/13296.htm
vendored
Normal file
7
trunk/dist/game/data/scripts/events/FreyaCelebration/13296.htm
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<html><body>
|
||||
These warm spring sunrays feel strange to me undoubtedly because I'm used to the frozen eternal winter of the Ice Palace. I fear they may be causing some equally strange thoughts, as I'm feeling rather generous right now.<br>
|
||||
Give me one Adena and I shall bestow a gift upon you for visiting me.<br>
|
||||
However, if you don't intend to bother me, leave me alone a while, say... 20 hours, so that I might enjoy this change of weather.<br>
|
||||
Oh and also, should you find any heart-warming items during your adventures, bring them back to me and I might feel even more generous...<br><br>
|
||||
<a action="bypass -h Quest FreyaCelebration give_potion">Give one Adena to Freya.</a>
|
||||
</body></html>
|
167
trunk/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java
vendored
Normal file
167
trunk/dist/game/data/scripts/events/FreyaCelebration/FreyaCelebration.java
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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.FreyaCelebration;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.event.LongTimeEvent;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.model.quest.QuestState;
|
||||
import com.l2jserver.gameserver.model.quest.State;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.network.NpcStringId;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.Say2;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Freya Celebration event AI.
|
||||
* @author Gnacik
|
||||
*/
|
||||
public final class FreyaCelebration extends LongTimeEvent
|
||||
{
|
||||
// NPC
|
||||
private static final int FREYA = 13296;
|
||||
// Items
|
||||
private static final int FREYA_POTION = 15440;
|
||||
private static final int FREYA_GIFT = 17138;
|
||||
// Misc
|
||||
private static final int HOURS = 20;
|
||||
|
||||
private static final int[] SKILLS =
|
||||
{
|
||||
9150,
|
||||
9151,
|
||||
9152,
|
||||
9153,
|
||||
9154,
|
||||
9155,
|
||||
9156
|
||||
};
|
||||
|
||||
private static final NpcStringId[] FREYA_TEXT =
|
||||
{
|
||||
NpcStringId.EVEN_THOUGH_YOU_BRING_SOMETHING_CALLED_A_GIFT_AMONG_YOUR_HUMANS_IT_WOULD_JUST_BE_PROBLEMATIC_FOR_ME,
|
||||
NpcStringId.I_JUST_DON_T_KNOW_WHAT_EXPRESSION_I_SHOULD_HAVE_IT_APPEARED_ON_ME_ARE_HUMAN_S_EMOTIONS_LIKE_THIS_FEELING,
|
||||
NpcStringId.THE_FEELING_OF_THANKS_IS_JUST_TOO_MUCH_DISTANT_MEMORY_FOR_ME,
|
||||
NpcStringId.BUT_I_KIND_OF_MISS_IT_LIKE_I_HAD_FELT_THIS_FEELING_BEFORE,
|
||||
NpcStringId.I_AM_ICE_QUEEN_FREYA_THIS_FEELING_AND_EMOTION_ARE_NOTHING_BUT_A_PART_OF_MALISS_A_MEMORIES
|
||||
};
|
||||
|
||||
private FreyaCelebration()
|
||||
{
|
||||
super(FreyaCelebration.class.getSimpleName(), "events");
|
||||
addStartNpc(FREYA);
|
||||
addFirstTalkId(FREYA);
|
||||
addTalkId(FREYA);
|
||||
addSkillSeeId(FREYA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
QuestState st = getQuestState(player, false);
|
||||
if (st == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (event.equalsIgnoreCase("give_potion"))
|
||||
{
|
||||
if (st.getQuestItemsCount(Inventory.ADENA_ID) > 1)
|
||||
{
|
||||
long _curr_time = System.currentTimeMillis();
|
||||
String value = loadGlobalQuestVar(player.getAccountName());
|
||||
long _reuse_time = value == "" ? 0 : Long.parseLong(value);
|
||||
|
||||
if (_curr_time > _reuse_time)
|
||||
{
|
||||
st.setState(State.STARTED);
|
||||
st.takeItems(Inventory.ADENA_ID, 1);
|
||||
st.giveItems(FREYA_POTION, 1);
|
||||
saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (HOURS * 3600000)));
|
||||
}
|
||||
else
|
||||
{
|
||||
long remainingTime = (_reuse_time - System.currentTimeMillis()) / 1000;
|
||||
int hours = (int) (remainingTime / 3600);
|
||||
int minutes = (int) ((remainingTime % 3600) / 60);
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);
|
||||
sm.addItemName(FREYA_POTION);
|
||||
sm.addInt(hours);
|
||||
sm.addInt(minutes);
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_NEED_S2_S1_S);
|
||||
sm.addItemName(Inventory.ADENA_ID);
|
||||
sm.addInt(1);
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon)
|
||||
{
|
||||
if ((caster == null) || (npc == null))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((npc.getId() == FREYA) && Util.contains(targets, npc) && Util.contains(SKILLS, skill.getId()))
|
||||
{
|
||||
if (getRandom(100) < 5)
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), NpcStringId.DEAR_S1_THINK_OF_THIS_AS_MY_APPRECIATION_FOR_THE_GIFT_TAKE_THIS_WITH_YOU_THERE_S_NOTHING_STRANGE_ABOUT_IT_IT_S_JUST_A_BIT_OF_MY_CAPRICIOUSNESS);
|
||||
cs.addStringParameter(caster.getName());
|
||||
|
||||
npc.broadcastPacket(cs);
|
||||
|
||||
caster.addItem("FreyaCelebration", FREYA_GIFT, 1, npc, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getRandom(10) < 2)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.NPC_ALL, npc.getName(), FREYA_TEXT[getRandom(FREYA_TEXT.length - 1)]));
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onSkillSee(npc, caster, skill, targets, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
getQuestState(player, true);
|
||||
return "13296.htm";
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new FreyaCelebration();
|
||||
}
|
||||
}
|
39
trunk/dist/game/data/scripts/events/FreyaCelebration/config.xml
vendored
Normal file
39
trunk/dist/game/data/scripts/events/FreyaCelebration/config.xml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<event name="Freya Celebration" active="27 02 2009-28 02 2009" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/eventConfig.xsd">
|
||||
<spawnlist>
|
||||
<add npc="13296" x="-119494" y="44882" z="360" heading="24576" />
|
||||
<add npc="13296" x="-117239" y="46842" z="360" heading="49151" />
|
||||
<add npc="13296" x="-84023" y="243051" z="-3728" heading="4096" />
|
||||
<add npc="13296" x="-84411" y="244813" z="-3728" heading="57343" />
|
||||
<add npc="13296" x="46908" y="50856" z="-2992" heading="8192" />
|
||||
<add npc="13296" x="45538" y="48357" z="-3056" heading="18000" />
|
||||
<add npc="13296" x="-45372" y="-114104" z="-240" heading="16384" />
|
||||
<add npc="13296" x="-45278" y="-112766" z="-240" heading="0" />
|
||||
<add npc="13296" x="9929" y="16324" z="-4568" heading="62999" />
|
||||
<add npc="13296" x="11546" y="17599" z="-4584" heading="46900" />
|
||||
<add npc="13296" x="115096" y="-178370" z="-880" heading="0" />
|
||||
<add npc="13296" x="-13727" y="122117" z="-2984" heading="16384" />
|
||||
<add npc="13296" x="-14129" y="123869" z="-3112" heading="40959" />
|
||||
<add npc="13296" x="-83156" y="150994" z="-3120" heading="0" />
|
||||
<add npc="13296" x="-81031" y="150038" z="-3040" heading="0" />
|
||||
<add npc="13296" x="16111" y="142850" z="-2696" heading="16000" />
|
||||
<add npc="13296" x="17275" y="145000" z="-3032" heading="25000" />
|
||||
<add npc="13296" x="111004" y="218928" z="-3536" heading="16384" />
|
||||
<add npc="13296" x="81755" y="146487" z="-3528" heading="32768" />
|
||||
<add npc="13296" x="82145" y="148609" z="-3464" heading="0" />
|
||||
<add npc="13296" x="83037" y="149324" z="-3464" heading="44000" />
|
||||
<add npc="13296" x="81987" y="53723" z="-1488" heading="0" />
|
||||
<add npc="13296" x="147200" y="25614" z="-2008" heading="16384" />
|
||||
<add npc="13296" x="148557" y="26806" z="-2200" heading="32768" />
|
||||
<add npc="13296" x="147421" y="-55435" z="-2728" heading="49151" />
|
||||
<add npc="13296" x="148206" y="-55786" z="-2776" heading="61439" />
|
||||
<add npc="13296" x="85584" y="-142490" z="-1336" heading="0" />
|
||||
<add npc="13296" x="86865" y="-142915" z="-1336" heading="26000" />
|
||||
<add npc="13296" x="43966" y="-47709" z="-792" heading="49999" />
|
||||
<add npc="13296" x="43165" y="-48461" z="-792" heading="17000" />
|
||||
</spawnlist>
|
||||
<messages>
|
||||
<add type="onEnd" text="Freya Celebration: Event end!" />
|
||||
<add type="onEnter" text="Freya Celebration: Event ongoing!" />
|
||||
</messages>
|
||||
</event>
|
Reference in New Issue
Block a user