From d0550f696c4cd5c10573649f5c0459e623069c85 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 30 Nov 2015 21:10:36 +0000 Subject: [PATCH] The Hunt for Santa Begins! --- trunk/dist/game/data/AppearanceStones.xml | 13 ++ .../game/data/buylists/custom/0000006.xml | 4 + trunk/dist/game/data/multisell/3400801.xml | 30 ++++ trunk/dist/game/data/scripts.cfg | 1 + .../scripts/events/HuntForSanta/34008-1.htm | 18 ++ .../scripts/events/HuntForSanta/34008-2.htm | 4 + .../scripts/events/HuntForSanta/34008-3.htm | 4 + .../scripts/events/HuntForSanta/34008-4.htm | 3 + .../scripts/events/HuntForSanta/34008.htm | 8 + .../events/HuntForSanta/HuntForSanta.java | 155 ++++++++++++++++++ .../scripts/events/HuntForSanta/config.xml | 37 +++++ .../scripts/handlers/EffectMasterHandler.java | 1 + .../effecthandlers/RewardItemOnExit.java | 51 ++++++ .../game/data/stats/items/40300-40399.xml | 9 + .../dist/game/data/stats/npcs/34000-34099.xml | 6 +- .../game/data/stats/skills/16400-16499.xml | 59 ++++++- trunk/dist/game/data/xsd/skills.xsd | 1 + .../gameserver/model/AbstractPlayerGroup.java | 17 ++ 18 files changed, 408 insertions(+), 13 deletions(-) create mode 100644 trunk/dist/game/data/multisell/3400801.xml create mode 100644 trunk/dist/game/data/scripts/events/HuntForSanta/34008-1.htm create mode 100644 trunk/dist/game/data/scripts/events/HuntForSanta/34008-2.htm create mode 100644 trunk/dist/game/data/scripts/events/HuntForSanta/34008-3.htm create mode 100644 trunk/dist/game/data/scripts/events/HuntForSanta/34008-4.htm create mode 100644 trunk/dist/game/data/scripts/events/HuntForSanta/34008.htm create mode 100644 trunk/dist/game/data/scripts/events/HuntForSanta/HuntForSanta.java create mode 100644 trunk/dist/game/data/scripts/events/HuntForSanta/config.xml create mode 100644 trunk/dist/game/data/scripts/handlers/effecthandlers/RewardItemOnExit.java diff --git a/trunk/dist/game/data/AppearanceStones.xml b/trunk/dist/game/data/AppearanceStones.xml index 3daf68be05..3413b32300 100644 --- a/trunk/dist/game/data/AppearanceStones.xml +++ b/trunk/dist/game/data/AppearanceStones.xml @@ -444,6 +444,19 @@ fullarmor + + + chest + fullarmor + + + + + hair + hair2 + hairall + + chest diff --git a/trunk/dist/game/data/buylists/custom/0000006.xml b/trunk/dist/game/data/buylists/custom/0000006.xml index e24f8a328d..53eca7b45d 100644 --- a/trunk/dist/game/data/buylists/custom/0000006.xml +++ b/trunk/dist/game/data/buylists/custom/0000006.xml @@ -74,4 +74,8 @@ + + + + diff --git a/trunk/dist/game/data/multisell/3400801.xml b/trunk/dist/game/data/multisell/3400801.xml new file mode 100644 index 0000000000..a39410767d --- /dev/null +++ b/trunk/dist/game/data/multisell/3400801.xml @@ -0,0 +1,30 @@ + + + + 34008 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts.cfg b/trunk/dist/game/data/scripts.cfg index 268b7e9094..713ea57a0c 100644 --- a/trunk/dist/game/data/scripts.cfg +++ b/trunk/dist/game/data/scripts.cfg @@ -249,6 +249,7 @@ conquerablehalls/RainbowSpringsChateau/RainbowSpringsChateau.java # Events events/CharacterBirthday/CharacterBirthday.java +events/HuntForSanta/HuntForSanta.java # Disabled by default events #events/GiftOfVitality/GiftOfVitality.java diff --git a/trunk/dist/game/data/scripts/events/HuntForSanta/34008-1.htm b/trunk/dist/game/data/scripts/events/HuntForSanta/34008-1.htm new file mode 100644 index 0000000000..82bb683284 --- /dev/null +++ b/trunk/dist/game/data/scripts/events/HuntForSanta/34008-1.htm @@ -0,0 +1,18 @@ +Noelle:
+I said Noelle won't make you labor for free. My fairies are extremly powerful!
+Stocking Fairy's Blessing +STR +3, INT +3, Speed +7
+Tree Fairy's Blessing +STR +3, MEN +3, +30 P. Critical Rate, +30 M. Critical Rate
+Snowman Fairy's Blessing +STR +3, WIT +3, Max HP/MP +2013
+What do you think? Aren't my fairies amazing? Which one will you take with you?

+ + + + +Requirements: Must be a party leader of a party with 3 races or more, or a party of 7.
+ +(Note: All of your Blessed Buffs will be deleted.)
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/events/HuntForSanta/34008-2.htm b/trunk/dist/game/data/scripts/events/HuntForSanta/34008-2.htm new file mode 100644 index 0000000000..4d3d46fa44 --- /dev/null +++ b/trunk/dist/game/data/scripts/events/HuntForSanta/34008-2.htm @@ -0,0 +1,4 @@ +Noelle:
+The spirits will find Santa in 2 hours. Find Santa bring back Santa's Marks to me and I'll give you a small gift.
+(You can receive your reward after 2 hours. You cannot receive your reward if you die or you don't have space in your inventory.) + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/events/HuntForSanta/34008-3.htm b/trunk/dist/game/data/scripts/events/HuntForSanta/34008-3.htm new file mode 100644 index 0000000000..c8253d2b52 --- /dev/null +++ b/trunk/dist/game/data/scripts/events/HuntForSanta/34008-3.htm @@ -0,0 +1,4 @@ +Noelle:
+Look. If you want to take all three spirits, you need 3 or more races, or 7 members in your party and have the party leader come talk to me.
+Or. If you want to take a different one, click on the button that says I want a different Fairy's Blessing. + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/events/HuntForSanta/34008-4.htm b/trunk/dist/game/data/scripts/events/HuntForSanta/34008-4.htm new file mode 100644 index 0000000000..ef64a43ead --- /dev/null +++ b/trunk/dist/game/data/scripts/events/HuntForSanta/34008-4.htm @@ -0,0 +1,3 @@ +Noelle:
+You need 3 or more races, or 7 members in your party and have the party leader come talk to me. + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/events/HuntForSanta/34008.htm b/trunk/dist/game/data/scripts/events/HuntForSanta/34008.htm new file mode 100644 index 0000000000..9c0ec1b4bb --- /dev/null +++ b/trunk/dist/game/data/scripts/events/HuntForSanta/34008.htm @@ -0,0 +1,8 @@ +Noelle:
+Hey, You! Have you seen an old fatso wearing a red hat turned inside out with a white beard that billows about like a cloud?
+He left in the middle of our busiest season! How dare he leave all this work behind and run away like that? It's completely unacceptable!
+Look here, noble warrior, I mean warrior, sir, er... ma'am, er...? Look here! You seem to have a lot of time, so how about a little help? Don't worry. I can pay!
+My cute Stocking Fairy, Tree Fairy, and Snowman Fairy are experts at finding the old man. Just bring one of them around, and it will be a cinch!
+ + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/events/HuntForSanta/HuntForSanta.java b/trunk/dist/game/data/scripts/events/HuntForSanta/HuntForSanta.java new file mode 100644 index 0000000000..0adf6e2726 --- /dev/null +++ b/trunk/dist/game/data/scripts/events/HuntForSanta/HuntForSanta.java @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2004-2015 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 . + */ +package events.HuntForSanta; + +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.holders.SkillHolder; +import com.l2jserver.gameserver.model.skills.BuffInfo; +import com.l2jserver.gameserver.model.skills.Skill; +import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; +import com.l2jserver.gameserver.util.Util; + +/** + * The Hunt for Santa Begins!
+ * Info - http://www.lineage2.com/en/news/events/hunt-for-santa.php + * @author Mobius + */ +public final class HuntForSanta extends LongTimeEvent +{ + // NPC + private static final int NOELLE = 34008; + // Skills + private static final SkillHolder BUFF_STOCKING = new SkillHolder(16419, 1); + private static final SkillHolder BUFF_TREE = new SkillHolder(16420, 1); + private static final SkillHolder BUFF_SNOWMAN = new SkillHolder(16421, 1); + + private HuntForSanta() + { + super(HuntForSanta.class.getSimpleName(), "events"); + addStartNpc(NOELLE); + addFirstTalkId(NOELLE); + addTalkId(NOELLE); + } + + @Override + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) + { + String htmltext = null; + switch (event) + { + case "34008.htm": + case "34008-1.htm": + { + htmltext = event; + break; + } + case "receiveBuffStocking": + { + htmltext = applyBuff(npc, player, BUFF_STOCKING.getSkill()); + break; + } + case "receiveBuffTree": + { + htmltext = applyBuff(npc, player, BUFF_TREE.getSkill()); + break; + } + case "receiveBuffSnowman": + { + htmltext = applyBuff(npc, player, BUFF_SNOWMAN.getSkill()); + break; + } + case "receiveBuffAll": + { + htmltext = applyAllBuffs(npc, player); + break; + } + case "changeBuff": + { + removeBuffs(player); + htmltext = "34008-1.htm"; + break; + } + } + return htmltext; + } + + @Override + public String onFirstTalk(L2Npc npc, L2PcInstance player) + { + return "34008.htm"; + } + + private String applyBuff(L2Npc npc, L2PcInstance player, Skill skill) + { + removeBuffs(player); + npc.broadcastPacket(new MagicSkillUse(npc, player, skill.getId(), 1, 0, 0)); + skill.applyEffects(npc, player); + return "34008-2.htm"; + } + + private String applyAllBuffs(L2Npc npc, L2PcInstance player) + { + if ((player.getParty() != null) && (player.getParty().getLeader() == player) && ((player.getParty().getMemberCount() > 6) || (player.getParty().getRaceCount() > 2))) + { + for (L2PcInstance member : player.getParty().getMembers()) + { + if (Util.calculateDistance(npc, member, false, false) < 500) + { + removeBuffs(member); + npc.broadcastPacket(new MagicSkillUse(npc, member, BUFF_STOCKING.getSkillId(), 1, 0, 0)); + BUFF_STOCKING.getSkill().applyEffects(npc, member); + BUFF_TREE.getSkill().applyEffects(npc, member); + BUFF_SNOWMAN.getSkill().applyEffects(npc, member); + } + } + return "34008-2.htm"; + } + else if (player.getParty() == null) + { + return "34008-3.htm"; + } + return "34008-4.htm"; + } + + private void removeBuffs(L2PcInstance player) + { + final BuffInfo buffStocking = player.getEffectList().getBuffInfoBySkillId(BUFF_STOCKING.getSkillId()); + final BuffInfo buffTree = player.getEffectList().getBuffInfoBySkillId(BUFF_TREE.getSkillId()); + final BuffInfo buffSnowman = player.getEffectList().getBuffInfoBySkillId(BUFF_SNOWMAN.getSkillId()); + if (buffStocking != null) + { + player.getEffectList().remove(true, buffStocking); + } + if (buffTree != null) + { + player.getEffectList().remove(true, buffTree); + } + if (buffSnowman != null) + { + player.getEffectList().remove(true, buffSnowman); + } + } + + public static void main(String[] args) + { + new HuntForSanta(); + } +} diff --git a/trunk/dist/game/data/scripts/events/HuntForSanta/config.xml b/trunk/dist/game/data/scripts/events/HuntForSanta/config.xml new file mode 100644 index 0000000000..52f8172c05 --- /dev/null +++ b/trunk/dist/game/data/scripts/events/HuntForSanta/config.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java b/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java index 9734e231ed..8b3f557e09 100644 --- a/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -161,6 +161,7 @@ public final class EffectMasterHandler RestorationRandom.class, Resurrection.class, ResurrectionSpecial.class, + RewardItemOnExit.class, Root.class, RunAway.class, ServitorShare.class, diff --git a/trunk/dist/game/data/scripts/handlers/effecthandlers/RewardItemOnExit.java b/trunk/dist/game/data/scripts/handlers/effecthandlers/RewardItemOnExit.java new file mode 100644 index 0000000000..5bcf813035 --- /dev/null +++ b/trunk/dist/game/data/scripts/handlers/effecthandlers/RewardItemOnExit.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2004-2015 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 . + */ +package handlers.effecthandlers; + +import com.l2jserver.gameserver.model.StatsSet; +import com.l2jserver.gameserver.model.conditions.Condition; +import com.l2jserver.gameserver.model.effects.AbstractEffect; +import com.l2jserver.gameserver.model.skills.BuffInfo; + +/** + * Reward Item on Exit effect implementation. + * @author Mobius + */ +public final class RewardItemOnExit extends AbstractEffect +{ + private final int _itemId; + private final long _itemCount; + + public RewardItemOnExit(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) + { + super(attachCond, applyCond, set, params); + + _itemId = params.getInt("itemId", 40313); // Default item is Santa's Mark. + _itemCount = params.getLong("itemCount", 1); + } + + @Override + public void onExit(BuffInfo info) + { + if (!info.isRemoved() && info.getEffected().isPlayer() && !info.getEffected().getActingPlayer().isDead()) + { + info.getEffected().getActingPlayer().addItem("RewardItemOnExitEffect", _itemId, _itemCount, info.getEffected(), true); + } + } +} diff --git a/trunk/dist/game/data/stats/items/40300-40399.xml b/trunk/dist/game/data/stats/items/40300-40399.xml index 9003888ef7..9732311517 100644 --- a/trunk/dist/game/data/stats/items/40300-40399.xml +++ b/trunk/dist/game/data/stats/items/40300-40399.xml @@ -125,6 +125,10 @@ + + + +
@@ -141,6 +145,7 @@ + @@ -325,6 +330,10 @@ + + + + diff --git a/trunk/dist/game/data/stats/npcs/34000-34099.xml b/trunk/dist/game/data/stats/npcs/34000-34099.xml index 48bc0c8d2f..5ff74e0e9d 100644 --- a/trunk/dist/game/data/stats/npcs/34000-34099.xml +++ b/trunk/dist/game/data/stats/npcs/34000-34099.xml @@ -137,7 +137,6 @@ - HUMAN FEMALE @@ -154,8 +153,7 @@ - - HUMAN + PLANT FEMALE @@ -164,7 +162,7 @@ - + diff --git a/trunk/dist/game/data/stats/skills/16400-16499.xml b/trunk/dist/game/data/stats/skills/16400-16499.xml index 6919697c2d..1a2b090432 100644 --- a/trunk/dist/game/data/stats/skills/16400-16499.xml +++ b/trunk/dist/game/data/stats/skills/16400-16499.xml @@ -181,37 +181,78 @@ - 1000 0
- - + + + + + + + + + + + + + + + +
- 1000 0
- - + + + + + + + + + + + + + + + + +
- 1000 0
- - + + + + + + + + + + + + + + + + +
diff --git a/trunk/dist/game/data/xsd/skills.xsd b/trunk/dist/game/data/xsd/skills.xsd index 9fd64536d1..516296ae1e 100644 --- a/trunk/dist/game/data/xsd/skills.xsd +++ b/trunk/dist/game/data/xsd/skills.xsd @@ -673,6 +673,7 @@ + diff --git a/trunk/java/com/l2jserver/gameserver/model/AbstractPlayerGroup.java b/trunk/java/com/l2jserver/gameserver/model/AbstractPlayerGroup.java index 75b280baa2..6690880872 100644 --- a/trunk/java/com/l2jserver/gameserver/model/AbstractPlayerGroup.java +++ b/trunk/java/com/l2jserver/gameserver/model/AbstractPlayerGroup.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Function; +import com.l2jserver.gameserver.enums.Race; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.CreatureSay; @@ -90,6 +91,22 @@ public abstract class AbstractPlayerGroup return getMembers().size(); } + /** + * @return the count of all player races in this group + */ + public int getRaceCount() + { + List partyRaces = new ArrayList<>(); + for (L2PcInstance member : getMembers()) + { + if (!partyRaces.contains(member.getRace())) + { + partyRaces.add(member.getRace()); + } + } + return partyRaces.size(); + } + /** * @return the level of this group */