Addition of Chuseok Harvest Festival event.

Contributed by CostyKiller.
This commit is contained in:
MobiusDevelopment
2022-09-22 08:26:16 +00:00
parent f0146e42c8
commit 70b98b3da5
39 changed files with 929 additions and 64 deletions

View File

@@ -0,0 +1,5 @@
<html><body>
I don't understand your surprise. In Chuseok, which falls on the 15th day of the 8th moon of the lunar calendar, the largest full moon rises in the sky once a year. Right now it is shining brightly in the center of Giran. I can take you there, you'll see with your own eyes.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest ChuseokHarvestFestival moveToTheMoon"><font color="FF6868">Move to the moon</font></Button>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h Quest ChuseokHarvestFestival 34604.htm">To the beginning</Button>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>Happy holiday, traveler!<br>
Have you seen this huge moon on Giran Square? I look at it an think that the specks on the moon are similar in shape to... a carrot. What do they remind you of?<br>
Imagine, there is a belief that the dark markings on the near side of the moon are a giant rabbit that cooks rice cakes. And if you look at the moon and you see the outline of such a rabbit, then you need to make a wish right away, because it will certainly come true.<br>
*rabbit laughs*<br>
Ha! To be honest, I'm terribly bad at cooking, but I love making others happy. If suddenly you have a Wish Ticket, then I will exchange it for supplies that will definitely come in handy on your travels. How do I get a ticket? Look at the moon and make a wish!<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest ChuseokHarvestFestival 34604-1.htm"><font color="LEVEL">"The moon on Giran Square... What!?"</font></Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 2466"><font color="FF6868">Exchange a Wish Ticket</font></Button>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>
You can make a wish at the Full Moon once a day. For this you will receive a Wish Ticket. Take it to the Moon Rabbit to exchange for a small gift in honor of the Chuseok holiday.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest ChuseokHarvestFestival getTicket"><font color="FF6868">Make a wish (once a day)</font></Button>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h Quest ChuseokHarvestFestival 34605.htm">To the beginning</Button>
</body></html>

View File

@@ -0,0 +1,6 @@
<html><body>
In honor of the celebration, the moon is ready to give you the Full Moon's Energy buff.<br>
It is valid for 24 hours. Every hour that energy fills your body, you will receive a Chuseok Gift Bag in your inventory. In total - 24 small but pleasant gifts. You can renew the buff at any time.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest ChuseokHarvestFestival getBuff"><font color="FF6868">Get a buff</font></Button>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h Quest ChuseokHarvestFestival 34605.htm">To the beginning</Button>
</body></html>

View File

@@ -0,0 +1,4 @@
<html><body>
I'm sorry, but you have to be at least level 105.<br>
<Button ALIGN=LEFT ICON="RETURN" action="bypass -h Quest ChuseokHarvestFestival 34605.htm"><font color="LEVEL">To the beginning</font></Button>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>
*A large and bright moon appeared in Giran. One has only to look at her, as the soul immediately becomes calm*<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest ChuseokHarvestFestival 34605-1.htm"><font color="LEVEL">Make a wish (once a day)</font></Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest ChuseokHarvestFestival 34605-2.htm"><font color="FF6868">Get a buff</font></Button>
</body></html>

View File

@@ -0,0 +1,154 @@
/*
* 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 events.ChuseokHarvestFestival;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.Calendar;
import java.util.logging.Level;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
/**
* @URL https://l2central.info/main/events_and_promos/1459.html
* @author CostyKiller
*/
public class ChuseokHarvestFestival extends LongTimeEvent
{
// NPCs
private static final int MOON_RABBIT = 34604;
private static final int FULL_MOON = 34605;
// Item
private static final int WISH_TICKET = 82196;
// Skill
private static final SkillHolder ENERGY_BUFF = new SkillHolder(34288, 1); // Full Moon's Festive Energy
// Misc
private static final String CHUSEOK_HARVEST_FESTIVAL_VAR = "CHUSEOK_HARVEST_FESTIVAL_TICKET_RECEIVED";
private static final int PLAYER_LEVEL = 105;
// Moon Location
private static final Location FULL_MOON_LOC = new Location(81241, 148863, -3472);
public ChuseokHarvestFestival()
{
addStartNpc(MOON_RABBIT);
addFirstTalkId(MOON_RABBIT, FULL_MOON);
addTalkId(MOON_RABBIT, FULL_MOON);
if (isEventPeriod())
{
startQuestTimer("schedule", 1000, null, null);
}
}
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
String htmltext = event;
switch (event)
{
case "getTicket":
{
if (player.getLevel() < PLAYER_LEVEL)
{
htmltext = "no-level.htm";
break;
}
else if (player.getVariables().getBoolean(CHUSEOK_HARVEST_FESTIVAL_VAR, false))
{
player.sendMessage("This character has already received a ticket. An account can receive a ticket once a day.");
return null;
}
else
{
giveItems(player, WISH_TICKET, 1);
player.getVariables().set(CHUSEOK_HARVEST_FESTIVAL_VAR, true);
player.getVariables().storeMe();
// htmltext = "34065-successful.htm"; // TODO: Addd retail html if any.
break;
}
}
case "getBuff":
{
if (player.getLevel() < PLAYER_LEVEL)
{
htmltext = "no-level.htm";
break;
}
npc.setTarget(player);
npc.doCast(ENERGY_BUFF.getSkill());
return null;
}
case "moveToTheMoon":
{
player.teleToLocation(FULL_MOON_LOC, true);
return "";
}
case "schedule":
{
final Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 6);
calendar.set(Calendar.MINUTE, 30);
cancelQuestTimers("reset");
startQuestTimer("reset", calendar.getTimeInMillis() - System.currentTimeMillis(), null, null);
break;
}
case "reset":
{
// Update data for offline players.
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_variables WHERE var=?"))
{
ps.setString(1, CHUSEOK_HARVEST_FESTIVAL_VAR);
ps.executeUpdate();
}
catch (Exception e)
{
LOGGER.log(Level.SEVERE, "Could not reset Chuseok Harvest Festival Event var: ", e);
}
// Update data for online players.
for (Player plr : World.getInstance().getPlayers())
{
plr.getVariables().remove(CHUSEOK_HARVEST_FESTIVAL_VAR);
plr.getVariables().storeMe();
}
cancelQuestTimers("schedule");
startQuestTimer("schedule", 1000, null, null);
break;
}
}
return htmltext;
}
@Override
public String onFirstTalk(Npc npc, Player player)
{
return npc.getId() + ".htm";
}
public static void main(String[] args)
{
new ChuseokHarvestFestival();
}
}

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<event name="Chuseok Harvest Festival" active="07 09 2022-28 09 2022" enableShrines="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/eventConfig.xsd">
<spawnlist>
<!-- Full Moon -->
<add npc="34605" x="80939" y="149068" z="-3472" heading="3355" /> <!-- Giran -->
<!-- Moon Rabbit -->
<add npc="34604" x="-14143" y="123176" z="-3096" heading="30212" /> <!-- Gludio -->
<add npc="34604" x="16354" y="142848" z="-2680" heading="14450" /> <!-- Dion -->
<add npc="34604" x="80824" y="147987" z="-3448" heading="3355" /> <!-- Giran -->
<add npc="34604" x="82008" y="53874" z="-1472" heading="3355" /> <!-- Oren -->
<add npc="34604" x="147457" y="27863" z="-2248" heading="17863" /> <!-- Aden -->
<add npc="34604" x="112172" y="220447" z="-3648" heading="30708" /> <!-- Heine -->
<add npc="34604" x="148195" y="-57368" z="-2752" heading="17863" /> <!-- Goddard -->
<add npc="34604" x="44530" y="-48368" z="-776" heading="14450" /> <!-- Rune -->
<add npc="34604" x="86897" y="-141346" z="-1320" heading="53153" /> <!-- Schuttgart -->
<add npc="34604" x="-114822" y="256375" z="-1472" heading="49744" /> <!-- Talking Island -->
<add npc="34604" x="-78832" y="249115" z="-3272" heading="56380" /> <!-- Faeron Village -->
<add npc="34604" x="-80485" y="149537" z="-3016" heading="16383" /> <!-- Gludin -->
<add npc="34604" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
<add npc="34604" x="208499" y="87743" z="-1006" heading="28764" /> <!-- Arcan -->
</spawnlist>
<destroyItemsOnEnd>
<item id="82195" /> <!-- Harvest Festival's Gift Pouch Event -->
<item id="80800" /> <!-- Ruler's Authority Event -->
<item id="81873" /> <!-- Heavenly Talisman Event -->
<item id="81368" /> <!-- Appearance Stone: Lovely Hanbok Event -->
<item id="81125" /> <!-- Festival Fairy's Style Cancelling Oil Event -->
<item id="81038" /> <!-- PA Event's Appearance Potion - Lovely Hanbok -->
<item id="82196" /> <!-- Wish Ticket Event -->
<item id="48225" /> <!-- Multicolored Songpyeon Event -->
<item id="81367" /> <!-- Songpyeon Event -->
</destroyItemsOnEnd>
<messages>
<add type="onEnd" text="[Event] Chuseok Harvest Festival has ended!" />
<add type="onEnter" text="[Event] Chuseok Harvest Festival (until September 28)" />
</messages>
</event>