Addition of Smash It Completely event.
Contributed by CostyKiller.
This commit is contained in:
8
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/34575-1.htm
vendored
Normal file
8
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/34575-1.htm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<html><body>Baby Shark Doo Doo Doo:<br>
|
||||
<font color="LEVEL">Once a day!</font> Gift giveaway! Delicious watermelons!<br>
|
||||
Of course, you can only receive a Watermelon if you have a Watermelon Seed.<br>
|
||||
Oh, you don't know what I'm talking about, do you?<br>
|
||||
You can try it if you've reached <font color="LEVEL">Lv. 105 or higher</font>! <font color="LEVEL">(once a day per account)</font>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest SmashItCompletely getSeed"><font color="058fd8">Get one Watermelon Seed a day (Lv. 105+)</font></Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest SmashItCompletely 34575.htm">Back</Button>
|
||||
</body></html>
|
10
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/34575-2.htm
vendored
Normal file
10
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/34575-2.htm
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<html><body>Baby Shark Doo Doo Doo:<br>
|
||||
Calm down? Why? I might look a bit crazy, but I am in fact very calm!<br>
|
||||
You want to know more about the buff?<br>
|
||||
Well... I'll try to keep calm. Listen here! Woo-hoo!<br>
|
||||
1. When you use a <font color="058fd8">Watermelon Seed</font>, a Watermelon will appear. Its size is up to a chance!<br>
|
||||
2. The Watermelon will break open in 30 sec., but you can attack it and break it faster. When you do, you have a chance to receive a <font color="058fd8">buff</font> and an <font color="058fd8">Ice Box</font>.<br>
|
||||
3. <font color="058fd8">The bigger the Watermelon</font>, the longer you have to hit it until it breaks and the <font color="058fd8">higher</font> probability of receiving a buff and an Ice Box.<br>
|
||||
4. Be careful, <font color="LEVEL">you can't receive the buff and the reward if you are standing too far from the Watermelon</font>.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest SmashItCompletely 34575.htm">Back</Button>
|
||||
</body></html>
|
8
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/34575-3.htm
vendored
Normal file
8
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/34575-3.htm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<html><body>Baby Shark Doo Doo Doo:<br>
|
||||
Huh? Hm...<br>
|
||||
Watermelons are tasty, aren't they? Once you start eating them, it's hard to stop!<br>
|
||||
To get a Watermelon Seed, join a <font color="LEVEL">clan</font> and complete a <font color="LEVEL">clan quest</font>.<br>
|
||||
If you've joined a clan during the event, click <font color="LEVEL">N</font> and then press the Clan Quests button.<br>
|
||||
Open the General and Events tabs of the main UI to learn more about the clan quests that have a <font color="058fd8">Watermelon Seed</font> as a reward.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest SmashItCompletely 34575.htm">Back</Button>
|
||||
</body></html>
|
@@ -0,0 +1,6 @@
|
||||
<html><body>Baby Shark Doo Doo Doo:<br>
|
||||
No-no-no! Bad!<br>
|
||||
Babies below Lv. 105 can't have watermelons! They'll upset their tummies!<br>
|
||||
<font color="LEVEL">Available to characters of Lv. 105 and higher.</font>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest SmashItCompletely 34575.htm">Back</Button>
|
||||
</body></html>
|
@@ -0,0 +1,5 @@
|
||||
<html><body>Baby Shark Doo Doo Doo:<br>
|
||||
Let's fight the summer heat together - the freshness of the watermelon will help us!<br>
|
||||
<font color="LEVEL">(1 time per day per account, reset at 06:30)</font>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest SmashItCompletely 34575.htm">Back</Button>
|
||||
</body></html>
|
11
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/34575.htm
vendored
Normal file
11
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/34575.htm
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<html><body>Baby Shark Doo Doo Doo:<br>
|
||||
it's not hot today, isn't it? Heh-heh...<br>
|
||||
A cold watermelon on a day like this would be a godsend, wouldn't it? Do you want to know who I am?<br>
|
||||
It's me! Baby Shark, doo doo doo doo doo doo! That is actually my name - Doo Doo Doo!<br>
|
||||
You've heard the song, right? Saw the video? Anyway, since it's summertime i've prepared <font color="LEVEL">Watermelon Seeds</font>!<br>
|
||||
You can receive one gift a day now.<br>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest SmashItCompletely 34575-1.htm"><font color="058fd8">Get one Watermelon Seed a day (Lv. 105+)</font></Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest SmashItCompletely 34575-2.htm">Tell to calm down and ask about the buff</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest SmashItCompletely 34575-3.htm">Tell to calm down and ask about Watermelon Seeds</Button>
|
||||
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_multisell 2450">Exchange Watermelon Seeds</Button>
|
||||
</body></html>
|
297
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/SmashItCompletely.java
vendored
Normal file
297
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/SmashItCompletely.java
vendored
Normal file
@@ -0,0 +1,297 @@
|
||||
/*
|
||||
* 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.SmashItCompletely;
|
||||
|
||||
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.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
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.Id;
|
||||
import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||
import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.item.OnItemUse;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
|
||||
import org.l2jmobius.gameserver.model.skill.SkillCaster;
|
||||
import org.l2jmobius.gameserver.network.NpcStringId;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.NpcSay;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @URL https://l2central.info/main/events_and_promos/1444.html
|
||||
* @author CostyKiller
|
||||
* @apiNote You need to edit client file to add additional seed rewards to clan missions.
|
||||
* @TODO Fix autoloot and self destruction skill for melons.
|
||||
*/
|
||||
public class SmashItCompletely extends LongTimeEvent
|
||||
{
|
||||
// NPCs
|
||||
private static final int DOODOODOO = 34575; // Baby Shark Doo Doo Doo
|
||||
private static final int SWEET_WATERMELON = 13608;
|
||||
private static final int PRIME_WATERMELON = 13609;
|
||||
private static final int LARGE_PRIME_WATERMELON = 13610;
|
||||
// Items
|
||||
private static final int WATERMELON_SEED = 81782;
|
||||
private static final int ICE_BOX = 81783;
|
||||
// Skills
|
||||
private static final SkillHolder[] SKILLS =
|
||||
{
|
||||
new SkillHolder(39714, 2), // Sweet Watermelon
|
||||
new SkillHolder(39714, 3), // Prime Watermelon
|
||||
new SkillHolder(39714, 4), // Large Prime Watermelon
|
||||
new SkillHolder(33927, 1), // Watermelon Burst
|
||||
};
|
||||
// Buffs
|
||||
private static final SkillHolder[] BUFFS =
|
||||
{
|
||||
new SkillHolder(33928, 1), // Dizzy Lv. 1 = 1 hour
|
||||
new SkillHolder(33928, 2), // Dizzy Lv. 2 = 2 hours
|
||||
new SkillHolder(33928, 3), // Dizzy Lv. 3 = 3 hours
|
||||
};
|
||||
// Misc
|
||||
private static final String SMASH_IT_COMPLETELY_VAR = "SMASH_IT_COMPLETELY_SEED_RECEIVED";
|
||||
private static final int PLAYER_LEVEL = 105;
|
||||
private static final NpcStringId[] DOODOODOO_TEXT =
|
||||
{
|
||||
NpcStringId.HERE_COMES_BABY_SHARK_DOO_DOO_DOO,
|
||||
NpcStringId.HEY_I_WANT_A_WATERMELON_TOO
|
||||
};
|
||||
// Chances for higher quality watermelons
|
||||
private static final int LARGE_PRIME_WATERMELON_SUMMON_CHANCE = 15; // Large Watermelon summon chance
|
||||
private static final int PRIME_WATERMELON_SUMMON_CHANCE = 40; // Prime Watermelon summon chance
|
||||
// Chances to get Dizzy buff
|
||||
private static final int LARGE_PRIME_WATERMELON_BUFF_CHANCE = 80; // Large Watermelon buff chance
|
||||
private static final int PRIME_WATERMELON_BUFF_CHANCE = 60; // Prime Watermelon buff chance
|
||||
private static final int SWEET_WATERMELON_BUFF_CHANCE = 40; // Sweet Watermelon buff chance
|
||||
|
||||
public SmashItCompletely()
|
||||
{
|
||||
addStartNpc(DOODOODOO);
|
||||
addFirstTalkId(DOODOODOO);
|
||||
addTalkId(DOODOODOO);
|
||||
addSpawnId(DOODOODOO, SWEET_WATERMELON, PRIME_WATERMELON, LARGE_PRIME_WATERMELON);
|
||||
addKillId(SWEET_WATERMELON, PRIME_WATERMELON, LARGE_PRIME_WATERMELON);
|
||||
|
||||
startQuestTimer("schedule", 1000, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, Npc npc, Player player)
|
||||
{
|
||||
String htmltext = null;
|
||||
switch (event)
|
||||
{
|
||||
case "getSeed":
|
||||
{
|
||||
if (npc.getId() != DOODOODOO)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (player.getLevel() < PLAYER_LEVEL)
|
||||
{
|
||||
htmltext = "34575-no-level.htm";
|
||||
break;
|
||||
}
|
||||
if (player.getAccountVariables().getBoolean(SMASH_IT_COMPLETELY_VAR, false))
|
||||
{
|
||||
player.sendMessage("This account has already received a seed. An account can receive a seed only once a day.");
|
||||
break;
|
||||
}
|
||||
|
||||
giveItems(player, WATERMELON_SEED, 1);
|
||||
player.getAccountVariables().set(SMASH_IT_COMPLETELY_VAR, true);
|
||||
player.getAccountVariables().storeMe();
|
||||
htmltext = "34575-successful.htm";
|
||||
break;
|
||||
}
|
||||
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":
|
||||
{
|
||||
if (isEventPeriod())
|
||||
{
|
||||
// Update data for offline players.
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var=?"))
|
||||
{
|
||||
ps.setString(1, SMASH_IT_COMPLETELY_VAR);
|
||||
ps.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, "Could not reset Smash It Completely Event var: ", e);
|
||||
}
|
||||
|
||||
// Update data for online players.
|
||||
for (Player plr : World.getInstance().getPlayers())
|
||||
{
|
||||
plr.getAccountVariables().remove(SMASH_IT_COMPLETELY_VAR);
|
||||
plr.getAccountVariables().storeMe();
|
||||
}
|
||||
}
|
||||
cancelQuestTimers("schedule");
|
||||
startQuestTimer("schedule", 1000, null, null);
|
||||
break;
|
||||
}
|
||||
case "DOODOODOO_SHOUT":
|
||||
{
|
||||
Broadcast.toKnownPlayersInRadius(npc, new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), getRandomEntry(DOODOODOO_TEXT)), 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(Npc npc, Player player)
|
||||
{
|
||||
return npc.getId() + ".htm";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(Npc npc, Player killer, boolean isPet)
|
||||
{
|
||||
if (killer.getSummonedNpc(npc.getObjectId()) == null)
|
||||
{
|
||||
killer.sendMessage("You must grow your own watermelon to get reward.");
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (npc.getId())
|
||||
{
|
||||
case SWEET_WATERMELON:
|
||||
{
|
||||
if (getRandom(100) < SWEET_WATERMELON_BUFF_CHANCE)
|
||||
{
|
||||
SkillCaster.triggerCast(killer, killer, BUFFS[0].getSkill());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PRIME_WATERMELON:
|
||||
{
|
||||
if (getRandom(100) < PRIME_WATERMELON_BUFF_CHANCE)
|
||||
{
|
||||
SkillCaster.triggerCast(killer, killer, BUFFS[1].getSkill());
|
||||
}
|
||||
if (killer.isInventoryUnder80(false))
|
||||
{
|
||||
killer.doAutoLoot((Attackable) npc, ICE_BOX, 1); // Prime Watermelon Ice Box x1
|
||||
}
|
||||
else
|
||||
{
|
||||
killer.sendPacket(SystemMessageId.NOT_ENOUGH_SPACE_IN_THE_INVENTORY_UNABLE_TO_PROCESS_THIS_REQUEST_UNTIL_YOUR_INVENTORY_S_WEIGHT_AND_SLOT_COUNT_ARE_LESS_THAN_80_PERCENT_OF_CAPACITY);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LARGE_PRIME_WATERMELON:
|
||||
{
|
||||
if (getRandom(100) < LARGE_PRIME_WATERMELON_BUFF_CHANCE)
|
||||
{
|
||||
SkillCaster.triggerCast(killer, killer, BUFFS[2].getSkill());
|
||||
}
|
||||
if (killer.isInventoryUnder80(false))
|
||||
{
|
||||
killer.doAutoLoot((Attackable) npc, ICE_BOX, 2); // Large Prime Watermelon Ice Box x2
|
||||
}
|
||||
else
|
||||
{
|
||||
killer.sendPacket(SystemMessageId.NOT_ENOUGH_SPACE_IN_THE_INVENTORY_UNABLE_TO_PROCESS_THIS_REQUEST_UNTIL_YOUR_INVENTORY_S_WEIGHT_AND_SLOT_COUNT_ARE_LESS_THAN_80_PERCENT_OF_CAPACITY);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpawn(Npc npc)
|
||||
{
|
||||
switch (npc.getId())
|
||||
{
|
||||
case DOODOODOO:
|
||||
{
|
||||
startQuestTimer("DOODOODOO_SHOUT", (5 * 60 * 1000), npc, null, true); // Spam texts every 5 min
|
||||
break;
|
||||
}
|
||||
case SWEET_WATERMELON:
|
||||
case PRIME_WATERMELON:
|
||||
case LARGE_PRIME_WATERMELON:
|
||||
{
|
||||
SkillCaster.triggerCast(npc, npc, BUFFS[3].getSkill()); // TODO: FIX death skill.
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
||||
@RegisterEvent(EventType.ON_ITEM_USE)
|
||||
@RegisterType(ListenerRegisterType.ITEM)
|
||||
@Id(81782) // Watermelon Seed
|
||||
public void onItemUse(OnItemUse event)
|
||||
{
|
||||
if (isEventPeriod())
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
for (SkillHolder skill : BUFFS)
|
||||
{
|
||||
if (player.isAffectedBySkill(skill))
|
||||
{
|
||||
player.sendMessage("You must remove current Dizzy buff effect to be able to grow another watermelon.");
|
||||
player.getInventory().addItem("Watermelon Seed refund", event.getItem().getId(), 1, player, player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final int chance = getRandom(100);
|
||||
if (chance < LARGE_PRIME_WATERMELON_SUMMON_CHANCE)
|
||||
{
|
||||
SkillCaster.triggerCast(player, player, SKILLS[2].getSkill());
|
||||
}
|
||||
else if (chance < PRIME_WATERMELON_SUMMON_CHANCE)
|
||||
{
|
||||
SkillCaster.triggerCast(player, player, SKILLS[1].getSkill());
|
||||
}
|
||||
else
|
||||
{
|
||||
SkillCaster.triggerCast(player, player, SKILLS[0].getSkill());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new SmashItCompletely();
|
||||
}
|
||||
}
|
34
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/config.xml
vendored
Normal file
34
L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/events/SmashItCompletely/config.xml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<event name="Smash It Completely" active="24 08 2022-21 09 2022" enableShrines="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/eventConfig.xsd">
|
||||
<spawnlist>
|
||||
<add npc="34575" x="-14143" y="123127" z="-3096" heading="30212" /> <!-- Gludio -->
|
||||
<add npc="34575" x="16294" y="142848" z="-2680" heading="14450" /> <!-- Dion -->
|
||||
<add npc="34575" x="80814" y="148037" z="-3448" heading="3355" /> <!-- Giran -->
|
||||
<add npc="34575" x="81998" y="53924" z="-1472" heading="3355" /> <!-- Oren -->
|
||||
<add npc="34575" x="147407" y="27863" z="-2248" heading="17863" /> <!-- Aden -->
|
||||
<add npc="34575" x="112172" y="220397" z="-3648" heading="30708" /> <!-- Heine -->
|
||||
<add npc="34575" x="148161" y="-57392" z="-2752" heading="17863" /> <!-- Goddard -->
|
||||
<add npc="34575" x="44470" y="-48378" z="-776" heading="14450" /> <!-- Rune -->
|
||||
<add npc="34575" x="86940" y="-141315" z="-1336" heading="53153" /> <!-- Schuttgart -->
|
||||
<add npc="34575" x="-114772" y="256375" z="-1472" heading="49744" /> <!-- Talking Island -->
|
||||
<add npc="34575" x="-78792" y="249165" z="-3272" heading="56380" /> <!-- Faeron Village -->
|
||||
<add npc="34575" x="-80535" y="149537" z="-3016" heading="16383" /> <!-- Gludin -->
|
||||
<add npc="34575" x="117420" y="76654" z="-2672" heading="40961" /> <!-- Hunters Village -->
|
||||
<add npc="34575" x="208479" y="87693" z="-1006" heading="28764" /> <!-- Arcan -->
|
||||
</spawnlist>
|
||||
<destroyItemsOnEnd>
|
||||
<item id="48755" /> <!-- Glowing Dragon's Attribute Potion (XP) Event -->
|
||||
<item id="80612" /> <!-- Freya's Ice Rose Event -->
|
||||
<item id="80797" /> <!-- Shining Nevit's Gold Hourglass Event -->
|
||||
<item id="80832" /> <!-- Emperor's Special Cocktail Event -->
|
||||
<item id="81460" /> <!-- Honey Dark Beer Event -->
|
||||
<item id="81776" /> <!-- Appearance Stone: Beach Swimsuit Event -->
|
||||
<item id="81781" /> <!-- Appearance Stone: Baby Shark Doo Doo Doo Event -->
|
||||
<item id="81782" /> <!-- Watermelon Seed Event -->
|
||||
<item id="81783" /> <!-- Ice Box Event -->
|
||||
</destroyItemsOnEnd>
|
||||
<messages>
|
||||
<add type="onEnd" text="[Event] Smash It Completely has ended!" />
|
||||
<add type="onEnter" text="[Event] Smash It Completely (until September 21)" />
|
||||
</messages>
|
||||
</event>
|
Reference in New Issue
Block a user