Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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.RabbitRampage;
- import com.l2jserver.gameserver.instancemanager.QuestManager;
- import com.l2jserver.gameserver.model.actor.L2Npc;
- import com.l2jserver.gameserver.model.L2Object;
- import com.l2jserver.gameserver.model.L2Skill;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
- import com.l2jserver.gameserver.model.quest.Quest;
- import com.l2jserver.gameserver.model.quest.QuestState;
- import com.l2jserver.gameserver.model.quest.State;
- import com.l2jserver.gameserver.network.SystemMessageId;
- import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
- import com.l2jserver.gameserver.network.clientpackets.Say2;
- import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
- import com.l2jserver.gameserver.skills.SkillHolder;
- import com.l2jserver.util.Rnd;
- /**
- ** @author Gladicek
- **
- ** Retail Event : 'Rabbit Rampage'
- *
- * TODO:
- * 2) Retail values for exchange items
- * 4) Rabbits should cast skill which make your head big (like from herb)
- * 5) Need to add all bunnies to script/sql + Huge Pig
- * 8) All monsters should have chance to drop items for event (scrolls/juice)
- *
- */
- public class RabbitRampage extends Quest
- {
- // Npc (Magic Research Institute Employee
- private static final int MRIE = 153;
- // Skills
- private static final int BUNNY_ANGER_JUICE_SKILL = ; // Skill is not done yet
- private static final int IMPROVED_BUNNY_ANGER_JUICE_SKILL = ; // Skill is not done yet
- // Rabbit skills
- // private static final SkillHolder[] SKILLS_DMG_BY_ME = { new SkillHolder(, 1) }; // Skill is not done yet
- // Monsters
- private static final int[] BUNNIES = { 36600 };
- private static final int HUGE_PIG = 13196;
- // Items
- private static final int BUNNY_ANGER_MANAGEMENT_KIT = 22180;
- private static final int BUNNY_PACIFIER_JUICE = 22181;
- private static final int EVENT_APIGA = 14720;
- private static final int EVENT_GOLDEN_APIGA = 14721;
- // Time
- private static final int _hours = 24;
- // Spawns for Npc
- private static final int[][] _spawns =
- {
- { 82766, 149438, -3464, 33865 },
- { 82286, 53291, -1488, 15250 },
- { 147060, 25943, -2008, 18774 },
- { 148096, -55466, -2728, 40541 },
- { 87116, -141332, -1336, 52193 },
- { 43521, -47542, -792, 31655 },
- { 17203, 144949, -3024, 18166 },
- { 111164, 221062, -3544, 2714 },
- { -13869, 122063, -2984, 18270 },
- { -83161, 150915, -3120, 17311 },
- { 45402, 48355, -3056, 49153 },
- { 115616, -177941, -896, 30708 },
- { -44928, -113608, -192, 30212 },
- { -84037, 243194, -3728, 8992 },
- {-119690, 44583, 360, 29289 },
- { 12084, 16576, -4584, 57345 }
- };
- private static final String[] _NOSKILL_TEXT = {
- "Rage level is rising...FEEL MY RAGE!",
- "Wiw! I feel so warm and fuzzy now!",
- "Boy, the next time I feel like going on a rampage I hope you are there",
- "Here comes the furry flurry of fury! *Quick, use the Bunny Pacifier Juice*"
- };
- private static final String[] _SKILL_TEXT = {
- "I'm feeling, less angry...what is this witchcraft?",
- "That tickless..I still want you dead.",
- "Feel kind of funny... but also so joyful.",
- "World cannot express my happiness!",
- "I'm on cloud nine!",
- "Squee! Are you a rabbit whisperer %nick%, cause I feel great.",
- "I hope your happy because I'm not. Next time try bringing some friends."
- };
- private static final String[] _DEAD_TEXT = {
- "I feel so happy now.",
- "Thanks for taking care of my rage %nick%!",
- "Whew...I need a nap now."
- };
- private static final String[] _PIG_TEXT = {
- "Where am I? This doesn't look night at all..Oink oink!",
- "What's going on...How did I get here... Oink oink!"
- };
- public RabbitRampage(int questId, String name, String descr)
- {
- super(questId, name, descr);
- addStartNpc(MRIE);
- addFirstTalkId(MRIE);
- addTalkId(MRIE);
- for(int[] _spawn : _spawns)
- addSpawn(MRIE, _spawn[0], _spawn[1], _spawn[2], _spawn[3], false, 0);
- for (int i : BUNNIES)
- {
- addKillId(i);
- addAttackId(i);
- addSpawnId(i);
- addSkillSeeId(i);
- }
- }
- @Override
- public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
- {
- String htmltext = "";
- Quest q = QuestManager.getInstance().getQuest(getName());
- QuestState st = player.getQuestState(getName());
- htmltext = event;
- int prize;
- if (event.equalsIgnoreCase("kit"))
- {
- // Check if player have 2011 Adena = if yes give him bunny anger management kit
- if (st.getQuestItemsCount(57) > 2011)
- {
- long _curr_time = System.currentTimeMillis();
- String value = q.loadGlobalQuestVar(player.getAccountName());
- long _reuse_time = value == "" ? 0 : Long.parseLong(value);
- if (_curr_time > _reuse_time)
- {
- st.setState(State.STARTED);
- st.takeItems(57, 2011);
- st.giveItems(BUNNY_ANGER_MANAGEMENT_KIT, 1);
- q.saveGlobalQuestVar(player.getAccountName(), Long.toString(System.currentTimeMillis() + (_hours * 3600000)));
- return null;
- }
- else
- {
- long remainingTime = (_reuse_time - System.currentTimeMillis()) / 1000;
- int hours = (int) (remainingTime / 3600);
- int minutes = (int) ((remainingTime % 3600) / 60);
- SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.AVAILABLE_AFTER_S1_S2_HOURS_S3_MINUTES);
- sm.addItemName(BUNNY_ANGER_MANAGEMENT_KIT);
- sm.addNumber(hours);
- sm.addNumber(minutes);
- player.sendPacket(sm);
- return null;
- }
- }
- else
- {
- // if no = show html 13292-4.htm
- htmltext = "13292-4.htm";
- }
- }
- // Check if player have 2011 Adena = if yes give him bunny anger juice
- else if (event.equalsIgnoreCase("juice"))
- {
- if (st.getQuestItemsCount(57) > 2011)
- {
- st.takeItems(57, 2011);
- st.giveItems(BUNNY_PACIFIER_JUICE, 200);
- return null;
- }
- else
- {
- // if no = show html 13292-4a.htm
- htmltext = "13292-4a.htm";
- }
- }
- else if (event.equalsIgnoreCase("goldenapiga"))
- {
- // Check if player have 20 Event Apiga = if yes give him reward
- if (st.getQuestItemsCount(EVENT_GOLDEN_APIGA) > 20)
- {
- st.takeItems(EVENT_GOLDEN_APIGA,20);
- prize = Rnd.get(1000);
- // Need to get retail values and list of all items
- if (prize <= 100)
- st.giveItems(22208,1); // 1 - Angry Bunny Necklace Box
- else if (prize <= 100)
- st.giveItems(22209,1); // 1 - Angry Bunny Earring Box
- else if (prize <= 100)
- st.giveItems(22210,1); // 1 - Angry Bunny Ring Box
- else if (prize <= 50)
- st.giveItems(22206,1); // 1 - Soul Crystal - Stage 17 Box
- else if (prize <= 50)
- st.giveItems(22207,1); // 1 - Soul Crystal - Stage 18 Box
- else if (prize <= 100)
- st.giveItems(22205,1); // 1 - Attribute Crystal Box
- else if (prize <= 350)
- st.giveItems(8752,1); // 1 - High-Grade 76 Life Stone
- else if (prize <= 300)
- st.giveItems(9575,1); // 1 - High-Grade 80 Life Stone
- else if (prize <= 250)
- st.giveItems(10485,1); // 1 - High-Grade 82 Life Stone
- else if (prize <= 200)
- st.giveItems(8762,1); // 1 - Top-Grade 76 Life Stone
- else if (prize <= 150)
- st.giveItems(9576,1); // 1 - Top-Grade 80 Life Stone
- else if (prize <= 100)
- st.giveItems(10486,1); // 1 - Top-Grade 82 Life Stone
- else if (prize <= 100)
- st.giveItems(2134,2); // 2 - Gemstone S
- return null;
- }
- else
- // if no = show html 13292-6.htm
- htmltext = "13292-6.htm";
- }
- else if (event.equalsIgnoreCase("apiga"))
- {
- if (st.getQuestItemsCount(EVENT_APIGA) > 10)
- {
- st.takeItems(EVENT_APIGA,10);
- prize = Rnd.get(1000);
- // Need to get retail values and list of all items
- if (prize <= 100)
- st.giveItems(22208,1); // 1 - Angry Bunny Necklace Box
- else if (prize <= 100)
- st.giveItems(22209,1); // 1 - Angry Bunny Earring Box
- return null;
- }
- else
- // if no = show html 13292-7.htm
- htmltext = "13292-7.htm";
- }
- return htmltext;
- }
- @Override
- public String onSkillSee(L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)
- {
- L2Object trg = caster.getTarget();
- if (trg != null && trg.getObjectId() == npc.getObjectId())
- {
- if (skill.getId() == BUNNY_ANGER_JUICE_SKILL)
- {
- if(Rnd.get(100) < 10)
- {
- npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.ALL, npc.getName(), _SKILL_TEXT[Rnd.get(_SKILL_TEXT.length)].replaceAll("%nick%", caster.getName())));
- npc.setIsInvul(false);
- npc.getStatus().reduceHp(1000, caster);
- return null;
- }
- }
- else if (skill.getId() == IMPROVED_BUNNY_ANGER_JUICE_SKILL)
- {
- if(Rnd.get(100) < 10)
- {
- npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.ALL, npc.getName(), _SKILL_TEXT[Rnd.get(_SKILL_TEXT.length)].replaceAll("%nick%", caster.getName())));
- npc.setIsInvul(false);
- npc.setTarget(attacker);
- npc.getStatus().reduceHp(5000, caster);
- return null;
- }
- }
- else
- {
- if(Rnd.get(100) < 20)
- {
- npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.ALL, npc.getName(), _NOSKILL_TEXT[Rnd.get(_NOSKILL_TEXT.length)]));
- npc.setIsInvul(true);
- return null;
- }
- }
- }
- return super.onSkillSee(npc, caster, skill, targets, isPet);
- }
- @Override
- public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)
- {
- for(int npcId : BUNNIES)
- {
- // if player is trying to attack rabbit without skill -> set rabbit invulnerable
- if (npc.getNpcId() == npcId)
- {
- // if dd is pet set npc invul.
- if(isPet)
- {
- if(Rnd.get(100) < 20)
- {
- npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.ALL, npc.getName(), _NOSKILL_TEXT[Rnd.get(_NOSKILL_TEXT.length)]));
- npc.setIsInvul(true);
- return null;
- }
- }
- npc.setTarget(attacker);
- npc.setIsInvul(true);
- if(Rnd.get(100) < 20)
- {
- npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.ALL, npc.getName(), _NOSKILL_TEXT[Rnd.get(_NOSKILL_TEXT.length)]));
- return null;
- }
- }
- }
- return super.onAttack(npc, attacker, damage, isPet);
- }
- @Override
- public String onKill (L2Npc npc, L2PcInstance killer, boolean isPet)
- {
- dropItem(npc, killer);
- npc.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.ALL, npc.getName(), _DEAD_TEXT[Rnd.get(_DEAD_TEXT.length)].replaceAll("%nick%", killer.getName())));
- // 10% chance to get spawn for Huge Pig
- if(Rnd.get(100) < 90)
- {
- L2MonsterInstance monster = (L2MonsterInstance) addSpawn(HUGE_PIG, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 60000);
- monster.broadcastPacket(new CreatureSay(npc.getObjectId(), Say2.ALL, npc.getName(), _PIG_TEXT[Rnd.get(_PIG_TEXT.length)]));
- return null;
- }
- return super.onKill(npc, killer, isPet);
- }
- @Override
- public String onFirstTalk(L2Npc npc, L2PcInstance player)
- {
- QuestState st = player.getQuestState(getName());
- if (st == null)
- {
- Quest q = QuestManager.getInstance().getQuest(getName());
- st = q.newQuestState(player);
- }
- return "153.htm";
- }
- public static void main(String[] args)
- {
- new RabbitRampage(-1, "RabbitRampage", "events");
- _log.info("Event - Rabbit Rampage is now active! *Created by Gladicek*");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment