Support for Balthus Event.

Contributed by Index.
This commit is contained in:
MobiusDevelopment
2022-03-23 11:23:11 +00:00
parent 7e327f1402
commit 5dd8637495
81 changed files with 3714 additions and 36 deletions

View File

@@ -0,0 +1,6 @@
<html><body>Event Manager Festival Fairy:<br>
Every hour I was trying raffle the item of all the player.<br>
For start to be participant - you need to get coupon and use it.<br>
Every day you can get 3 coupons from the Bag and I can sell you more coupons.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival 34330.htm">Back</Button>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>Event Manager Festival Fairy:<br>
Here we go.<br>
I give you this bag, but on event period you can get only one!<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival 34330.htm">Back</Button>
</body></html>

View File

@@ -0,0 +1,4 @@
<html><body>Event Manager Festival Fairy:<br>
Sorry, but you already have your Event Bag.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival 34330.htm">Back</Button>
</body></html>

View File

@@ -0,0 +1,6 @@
<html><body>Event Manager Festival Fairy:<br>
I can exchange coupons for you, let me see on your coupon.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival exchange_coupon_1">+6 Leviathan Robe</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival exchange_coupon_2">+6 Leviathan Light Armor</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival exchange_coupon_3">+6 Leviathan Heavy Armor</Button>
</body></html>

View File

@@ -0,0 +1,4 @@
<html><body>Event Manager Festival Fairy:<br>
Sorry, but you don't have required coupon.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival 34330.htm">Back</Button>
</body></html>

View File

@@ -0,0 +1,4 @@
<html><body>Event Manager Festival Fairy:<br>
Good luck in next raffle!<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival 34330.htm">Back</Button>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>Event Manager Festival Fairy:<br>
I cant give you Bags with Coupons, because you level is too small!<br>
Back to me, when your level will be %require_level%<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival 34330.htm">Back</Button>
</body></html>

View File

@@ -0,0 +1,10 @@
<html><body>Event Manager Festival Fairy:<br>
Hello! Are you want to win some reward today?<br>
Don't worry, I will give for all player's consolation reward if someone won reward!<br>
If you have some Fairy Coins - I can exchange it on items for you.<br>
Good luck!<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival 34330-1.htm">Learn more about the event</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 343300001">Exchange coins on items</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival 34330-4.htm">I want to exchange reward coupon</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest BalthusFestival get_event_bag">Give me Event Bag for taking Coupons</Button>
</body></html>

View File

@@ -0,0 +1,236 @@
/*
* 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.BalthusFestival;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.gameserver.instancemanager.events.BalthusEventManager;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.ListenerRegisterType;
import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSkillFinishCast;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
import org.l2jmobius.gameserver.model.skill.BuffInfo;
import org.l2jmobius.gameserver.network.serverpackets.balthusevent.ExBalthusEvent;
/**
* @author Index
*/
public class BalthusFestival extends LongTimeEvent
{
// NPC
private static final int FESTIVAL_FAIRY = 34330;
// Item
private static final ItemHolder GOOD_LUCK_BAG = new ItemHolder(60011, 1); // Festival Fairy's Good Luck Bag
// Skills
private static final List<SkillHolder> SKILLS = new ArrayList<>(8);
static
{
SKILLS.add(new SkillHolder(29441, 1)); // Fairy_Coupon_1_Hour
SKILLS.add(new SkillHolder(39171, 1)); // Fairy_Coupon_2_Hour
SKILLS.add(new SkillHolder(39171, 2)); // Fairy_Coupon_3_Hour
SKILLS.add(new SkillHolder(39171, 3)); // Fairy_Coupon_6_Hour
SKILLS.add(new SkillHolder(39171, 4)); // Fairy_Coupon_8_Hour
SKILLS.add(new SkillHolder(39171, 5)); // Fairy_Coupon_Unlimited_Hour
SKILLS.add(new SkillHolder(27859, 1)); // Balthus_Coupon_2_Hour
SKILLS.add(new SkillHolder(48853, 1)); // Balthus_Coupon_2_Hour
}
// Misc
private static final String BALTHUS_BAG_VAR = "BALTHUS_BAG";
private BalthusFestival()
{
addStartNpc(FESTIVAL_FAIRY);
addFirstTalkId(FESTIVAL_FAIRY);
addTalkId(FESTIVAL_FAIRY);
if (isEventPeriod())
{
BalthusEventManager.getInstance();
}
}
@RegisterEvent(EventType.ON_PLAYER_LOGIN)
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
public void onPlayerLogin(OnPlayerLogin event)
{
if (!isEventPeriod())
{
return;
}
final Player player = event.getPlayer();
if (player == null)
{
return;
}
for (SkillHolder skill : SKILLS)
{
final BuffInfo buff = player.getEffectList().getBuffInfoBySkillId(skill.getSkillId());
if (buff != null)
{
cancelQuestTimer("balthusEventBuff" + player.getObjectId(), null, player);
startQuestTimer("balthusEventBuff" + player.getObjectId(), buff.getTime() * 1000, null, player);
BalthusEventManager.getInstance().addPlayer(player);
}
}
player.sendPacket(new ExBalthusEvent(player));
}
@RegisterEvent(EventType.ON_PLAYER_LOGOUT)
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
public void onPlayerLogout(OnPlayerLogout event)
{
if (!isEventPeriod())
{
return;
}
final Player player = event.getPlayer();
if ((player == null))
{
return;
}
cancelQuestTimer("balthusEventBuff" + player.getObjectId(), null, player);
BalthusEventManager.getInstance().removePlayer(player);
}
@RegisterEvent(EventType.ON_CREATURE_SKILL_FINISH_CAST)
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
public void onCreatureSkillFinishCast(OnCreatureSkillFinishCast event)
{
if (!isEventPeriod())
{
return;
}
final Player player = event.getCaster().getActingPlayer();
if (player == null)
{
return;
}
for (SkillHolder skill : SKILLS)
{
if (event.getSkill() == skill.getSkill())
{
startQuestTimer("balthusEventBuff" + player.getObjectId(), skill.getSkill().getAbnormalTime() * 1000, null, player);
BalthusEventManager.getInstance().addPlayer(player);
player.sendPacket(new ExBalthusEvent(player));
}
}
}
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
if (!isEventPeriod())
{
return "Balthus Event disabled.";
}
if (event.equals("balthusEventBuff" + player.getObjectId()))
{
BalthusEventManager.getInstance().removePlayer(player);
player.sendPacket(new ExBalthusEvent(player));
}
if (event.equals("get_event_bag"))
{
if (player.getLevel() < BalthusEventManager.getInstance().getMinimalLevel())
{
return getHtm(player, "34300-7.htm").replace("%require_level%", String.valueOf(BalthusEventManager.getInstance().getMinimalLevel()));
}
else if (player.getVariables().getBoolean(BALTHUS_BAG_VAR, false))
{
return "34330-3.htm";
}
else
{
player.getVariables().set(BALTHUS_BAG_VAR, true);
player.addItem("Balthus Event", GOOD_LUCK_BAG.getId(), GOOD_LUCK_BAG.getCount(), null, true);
return "34330-2.htm";
}
}
else if (event.equals("34330.htm"))
{
return event;
}
else if (event.equals("34330-1.htm"))
{
return event;
}
else if (event.equals("34330-4.htm"))
{
return event;
}
else if (event.startsWith("exchange_coupon_"))
{
switch (event.substring(16))
{
case ("1"):
{
if (!player.destroyItemByItemId("Destroy Coupon", 81726, 1, null, true))
{
return "34330-5.htm";
}
player.addItem("Balthus Coupon", 81711, 1, null, true);
return "34330-6.htm";
}
case ("2"):
{
if (!player.destroyItemByItemId("Destroy Coupon", 81726, 1, null, true))
{
return "34330-5.htm";
}
player.addItem("Balthus Coupon", 81710, 1, null, true);
return "34330-6.htm";
}
case ("3"):
{
if (!player.destroyItemByItemId("Destroy Coupon", 81726, 1, null, true))
{
return "34330-5.htm";
}
player.addItem("Balthus Coupon", 81709, 1, null, true);
return "34330-6.htm";
}
}
}
return null;
}
@Override
public String onFirstTalk(Npc npc, Player player)
{
return npc.getId() + ".htm";
}
public static void main(String[] args)
{
new BalthusFestival();
}
}

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<event name="Balthus Event" active="30 06 2021-29 07 2021" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/eventConfig.xsd">
<!-- Reward sets on reward.xml -->
<spawnlist>
<add npc="34330" x="-14143" y="123176" z="-3096" heading="30212" /> <!-- Gludio -->
<add npc="34330" x="16354" y="142848" z="-2680" heading="14450" /> <!-- Dion -->
<add npc="34330" x="80814" y="147987" z="-3448" heading="3355" /> <!-- Giran -->
<add npc="34330" x="82008" y="53874" z="-1472" heading="3355" /> <!-- Oren -->
<add npc="34330" x="147457" y="27863" z="-2248" heading="17863" /> <!-- Aden -->
<add npc="34330" x="112172" y="220447" z="-3648" heading="30708" /> <!-- Heine -->
<add npc="34330" x="148195" y="-57368" z="-2752" heading="17863" /> <!-- Goddard -->
<add npc="34330" x="44530" y="-48368" z="-776" heading="14450" /> <!-- Rune -->
<add npc="34330" x="86897" y="-141346" z="-1320" heading="49153" /> <!-- Shutgard -->
<add npc="34330" x="-114822" y="256385" z="-1472" heading="49744" /> <!-- Talking Island -->
<add npc="34330" x="-78832" y="249115" z="-3272" heading="56380" /> <!-- Faeron Village -->
<add npc="34330" x="-80485" y="149537" z="-3016" heading="16383" /> <!-- Gluddin -->
<add npc="34330" x="117380" y="76684" z="-2672" heading="40961" /> <!-- Hunters Village -->
<add npc="34330" x="208499" y="87743" z="-1006" heading="11264" /> <!-- Arcan -->
</spawnlist>
<messages>
<add type="onEnd" text="Balthus Festival: Event end!" />
<add type="onEnter" text="Balthus Festival: Event ongoing!" />
</messages>
</event>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
https://l2central.info/main/events_and_promos/848.html?lang=en
https://l2central.info/main/events_and_promos/608.html?lang=ru
https://eu.4gameforum.com/threads/661220/
reward from - hour - to - hour
item id - item_id - count - item_count - chance - chance for been chosen like reward - chance_to_win - chance for item for been raffled;
-->
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="rewards.xsd" easyMode="true" minLevel="105" id="49783" count="100" mailSubject="Balthus Knight Lottery" mailContent="You win reward in Balthus Event!">
<reward from="11" to="19">
<items>
<item id="81453" count="1" chance="50" lotteryChance="12.5"/>
<item id="48910" count="1" chance="50" lotteryChance="12.5"/>
<item id="81832" count="1" chance="50" lotteryChance="12.5"/>
<item id="48677" count="1" chance="50" lotteryChance="12.5"/>
<item id="48678" count="1" chance="50" lotteryChance="12.5"/>
<item id="81726" count="1" chance="50" lotteryChance="12.5"/>
<item id="80501" count="1" chance="50" lotteryChance="12.5"/>
<item id="81429" count="1" chance="50" lotteryChance="12.5"/>
</items>
</reward>
<reward from="20" to="22">
<items>
<item id="35564" count="1" chance="50" lotteryChance="33"/>
<item id="29385" count="1" chance="50" lotteryChance="33"/>
<item id="19464" count="1" chance="50" lotteryChance="34"/>
</items>
</reward>
<reward from="23" to="23">
<items>
<item id="36414" count="1" chance="50" lotteryChance="100"/>
</items>
</reward>
<reward from="00" to="10">
<items>
<item id="47399" count="1" chance="50" lotteryChance="100"/>
</items>
</reward>
</list>

View File

@@ -0,0 +1,41 @@
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list">
<xs:complexType>
<xs:sequence>
<xs:element name="reward" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="items">
<xs:complexType>
<xs:sequence>
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:int" name="id" use="optional"/>
<xs:attribute type="xs:int" name="count" use="optional"/>
<xs:attribute type="xs:double" name="chance" use="optional"/>
<xs:attribute type="xs:double" name="lotteryChance" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:int" name="from" use="optional"/>
<xs:attribute type="xs:int" name="to" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="easyMode"/>
<xs:attribute type="xs:int" name="minLevel"/>
<xs:attribute type="xs:int" name="id"/>
<xs:attribute type="xs:int" name="count"/>
<xs:attribute type="xs:string" name="mailSubject"/>
<xs:attribute type="xs:string" name="mailContent"/>
</xs:complexType>
</xs:element>
</xs:schema>