Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_DataPack
- Index: data/scripts/mods/eventmodSubclassTvT/31212-started.htm
- ===================================================================
- --- data/scripts/mods/eventmodSubclassTvT/31212-started.htm (revision 0)
- +++ data/scripts/mods/eventmodSubclassTvT/31212-started.htm (revision 0)
- @@ -0,0 +1,9 @@
- +<html>
- +<body>
- +<center>
- +<br>
- +<font color=ff3333>Subclass event</font><br>
- +Event has already been started.
- +</center>
- +</body>
- +</html>
- \ No newline at end of file
- Index: data/scripts/mods/eventmodSubclassTvT/31212-signed.htm
- ===================================================================
- --- data/scripts/mods/eventmodSubclassTvT/31212-signed.htm (revision 0)
- +++ data/scripts/mods/eventmodSubclassTvT/31212-signed.htm (revision 0)
- @@ -0,0 +1,10 @@
- +<html>
- +<body>
- +<center>
- +<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center">
- +<br>
- +<font color=ff3333>Subclass event</font><br>
- +Thanks for signup. Wait for event start.<br>
- +</center>
- +</body>
- +</html>
- \ No newline at end of file
- Index: data/scripts/mods/eventmodSubclassTvT/31212-unsigned.htm
- ===================================================================
- --- data/scripts/mods/eventmodSubclassTvT/31212-unsigned.htm (revision 0)
- +++ data/scripts/mods/eventmodSubclassTvT/31212-unsigned.htm (revision 0)
- @@ -0,0 +1,10 @@
- +<html>
- +<body>
- +<center>
- +<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center">
- +<br>
- +<font color=ff3333>Subclass event</font><br>
- +You are now unregistered from the event.
- +</center>
- +</body>
- +</html>
- \ No newline at end of file
- Index: data/instances/subclass.xml
- ===================================================================
- --- data/instances/subclass.xml (revision 0)
- +++ data/instances/subclass.xml (revision 0)
- @@ -0,0 +1,4 @@
- +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
- +<instance name="SubclassEventZone">
- + <allowSummon val="false"/>
- +</instance>
- \ No newline at end of file
- Index: data/scripts/mods/eventmodSubclassTvT/31212.htm
- ===================================================================
- --- data/scripts/mods/eventmodSubclassTvT/31212.htm (revision 0)
- +++ data/scripts/mods/eventmodSubclassTvT/31212.htm (revision 0)
- @@ -0,0 +1,13 @@
- +<html>
- +<body>
- +<center>
- +<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center">
- +<br>
- +<font color=ff3333>Subclass event</font><br>
- +You can signup for event here<br>
- +<button value="Participate in Subclass event" action="bypass -h Quest eventmodSubclassTvT signup" width=180 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
- +<button value="Remove participiation" action="bypass -h Quest eventmodSubclassTvT signdown" width=180 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
- +
- +</center>
- +</body>
- +</html>
- \ No newline at end of file
- Index: data/scripts/mods/eventmodSubclassTvT/31212-fail.htm
- ===================================================================
- --- data/scripts/mods/eventmodSubclassTvT/31212-fail.htm (revision 0)
- +++ data/scripts/mods/eventmodSubclassTvT/31212-fail.htm (revision 0)
- @@ -0,0 +1,10 @@
- +<html>
- +<body>
- +<center>
- +<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center">
- +<br>
- +<font color=ff3333>Subclass event</font><br>
- +You must have 40 lvl and be on subclass in order to register<br>
- +</center>
- +</body>
- +</html>
- \ No newline at end of file
- Index: data/scripts/mods/eventmodSubclassTvT/eventmodSubclassTvT.java
- ===================================================================
- --- data/scripts/mods/eventmodSubclassTvT/eventmodSubclassTvT.java (revision 0)
- +++ data/scripts/mods/eventmodSubclassTvT/eventmodSubclassTvT.java (revision 0)
- @@ -0,0 +1,446 @@
- +/*
- + * 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 mods.eventmodSubclassTvT;
- +
- +/**************************************************************************************************************
- + * *
- + * @author horato, Nik *
- + * Made for L2world.org *
- + * *
- + **************************************************************************************************************/
- +import java.util.List;
- +import java.util.concurrent.ScheduledFuture;
- +import java.util.concurrent.TimeUnit;
- +
- +import javolution.util.FastList;
- +
- +import com.l2jserver.gameserver.Announcements;
- +import com.l2jserver.gameserver.ThreadPoolManager;
- +import com.l2jserver.gameserver.datatables.SkillTable;
- +import com.l2jserver.gameserver.instancemanager.InstanceManager;
- +import com.l2jserver.gameserver.instancemanager.QuestManager;
- +import com.l2jserver.gameserver.model.L2Effect;
- +import com.l2jserver.gameserver.model.L2Skill;
- +import com.l2jserver.gameserver.model.actor.L2Character;
- +import com.l2jserver.gameserver.model.actor.L2Npc;
- +import com.l2jserver.gameserver.model.actor.L2Summon;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.gameserver.model.quest.Event;
- +import com.l2jserver.gameserver.model.quest.Quest;
- +import com.l2jserver.gameserver.model.quest.QuestState;
- +import com.l2jserver.gameserver.network.serverpackets.ExCubeGameChangePoints;
- +import com.l2jserver.gameserver.network.serverpackets.ExCubeGameEnd;
- +
- +public class eventmodSubclassTvT extends Event
- +{
- + // Is event active?
- + private static boolean _isActive = false;
- + // Start npc ID
- + private static final int _npc_id = 31212;
- + // Initialize players list
- + private List<L2PcInstance> _players;
- + // Npc
- + private L2Npc _npc;
- + // Event Task
- + ScheduledFuture<?> _eventTask = null;
- + // Teams; Team1 is red, Team2 is blue
- + List<L2PcInstance> _team1 = new FastList<L2PcInstance>();
- + List<L2PcInstance> _team2 = new FastList<L2PcInstance>();
- + // Teams score
- + private static int _team1_score = 0;
- + private static int _team2_score = 0;
- + // Instance ID
- + int _instance_id = 0;
- +
- + public static void main(String[] args)
- + {
- + new eventmodSubclassTvT(-1, "eventmodSubclassTvT", "mods");
- + }
- +
- + public eventmodSubclassTvT(int questId, String name, String descr)
- + {
- + super(questId, name, descr);
- +
- + addStartNpc(_npc_id);
- + addFirstTalkId(_npc_id);
- + addTalkId(_npc_id);
- +
- + // Initialize players list
- + _players = new FastList<L2PcInstance>();
- +
- + }
- +
- + @Override
- + public boolean eventStart()
- + {
- + // Don't start event if its active
- + if (_isActive)
- + return false;
- + //Clear player list, npc lists and score
- + _team1_score = 0;
- + _team2_score = 0;
- + _npc = null;
- + _team1.clear();
- + _team2.clear();
- + _players.clear();
- +
- + // Create instance for event
- + try
- + {
- + _instance_id = InstanceManager.getInstance().createDynamicInstance("subclass.xml");
- + }
- + catch (Exception e)
- + {
- + Announcements.getInstance().announceToAll("Event error");
- + eventStop();
- + e.printStackTrace();
- + }
- +
- + // Set active
- + _isActive = true;
- + // Spawn event manager
- + _npc = addSpawn(_npc_id, 82798, 148650, -3464, 0, false, 0);
- +
- + // Announce event start
- + Announcements.getInstance().announceToAll("Subclass TvT event started");
- + Announcements.getInstance().announceToAll("Visit event manager in Giran castle town for register");
- +
- + _eventTask = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- + {
- + public void run()
- + {
- + Announcements.getInstance().announceToAll("Subclass TvT Event: 10 minutes left");
- + try
- + {
- + Thread.sleep(5 * 60 * 1000); //1 min
- + Announcements.getInstance().announceToAll("Subclass TvT Event: 5 minutes left");
- + Thread.sleep(2 * 60 * 1000); //1 min
- + Announcements.getInstance().announceToAll("Subclass TvT Event: 3 minutes left");
- + Thread.sleep(2 * 60 * 1000); //1 min
- + Announcements.getInstance().announceToAll("Subclass TvT Event: 1 minutes left");
- + Thread.sleep(1 * 60 * 1000); //1 min
- + StartEvent();
- + }
- + catch (InterruptedException e)
- + {
- + Announcements.getInstance().announceToAll("Event error");
- + eventStop();
- + }
- + }
- + }, 1);
- +
- + return true;
- + }
- +
- + @Override
- + public boolean eventStop()
- + {
- + // Don't stop inactive event
- + if (!_isActive)
- + return false;
- +
- + // Set inactive
- + _isActive = false;
- + // Thread stop
- + if (!_eventTask.isDone())
- + _eventTask.cancel(true);
- + // Remove instance
- + InstanceManager.getInstance().destroyInstance(_instance_id);
- + // Remove NPC
- + if (_npc != null)
- + _npc.deleteMe();
- +
- + // Announce winning team
- + if (_team1_score > _team2_score)
- + {
- + Announcements.getInstance().announceToAll("Red team won");
- + }
- + else if (_team1_score < _team2_score)
- + {
- + Announcements.getInstance().announceToAll("Blue team won");
- + }
- + else if (_team1_score == _team2_score)
- + {
- + Announcements.getInstance().announceToAll("No winner this time");
- + }
- +
- + // Remove team marker, give reward and teleport back
- + for (L2PcInstance player : _players)
- + {
- + if (_team1_score > _team2_score)
- + {
- + player.sendPacket(new ExCubeGameEnd(true));
- + if (_team1.contains(player))
- + player.addItem("eventmodSubclassTvT", 4037, 10, _npc, true);
- + }
- + else if (_team1_score < _team2_score)
- + {
- + player.sendPacket(new ExCubeGameEnd(false));
- + if (_team2.contains(player))
- + player.addItem("eventmodSubclassTvT", 4037, 10, _npc, true);
- + }
- + else
- + {
- + player.sendPacket(new ExCubeGameEnd(false));
- + if (player.isDead())
- + player.doRevive();
- + player.removeNotifyQuestOfDeath(player.getQuestState(getName()));
- + player.setTeam(0);
- + player.setInstanceId(0);
- + player.teleToLocation(83478, 148628, -3405);
- + }
- + }
- + // Clear teams
- + _team1.clear();
- + _team2.clear();
- + // Clear player list
- + _players.clear();
- +
- + Announcements.getInstance().announceToAll("Subclass TvT event finished");
- +
- + return true;
- + }
- +
- + @Override
- + public boolean eventBypass(L2PcInstance activeChar, String bypass)
- + {
- + return false;
- + }
- +
- + @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);
- + }
- + if (npc.getNpcId() == _npc_id)
- + {
- + return _npc_id + ".htm";
- + }
- + return npc.getNpcId() + ".htm";
- + }
- +
- + @Override
- + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
- + {
- + // Registering
- + if (event.startsWith("signup"))
- + { //level check
- + if (player.getLevel() == 40)
- + { // Subclass check
- + if (player.isSubClassActive())
- + {
- + if (_players.contains(player))
- + {
- + return _npc_id + "-onlist.htm";
- + }
- + _players.add(player);
- + return _npc_id + "-signed.htm";
- + }
- + else
- + {
- + return _npc_id + "-fail.htm";
- + }
- + }
- + else
- + {
- + return _npc_id + "-fail.htm";
- + }
- +
- + }
- +
- + // Unregistering
- + if (event.startsWith("signdown"))
- + {
- + if (!_players.contains(player))
- + {
- + return _npc_id + "-notreg.htm";
- + }
- + _players.remove(player);
- + return _npc_id + "-unsigned.htm";
- + }
- +
- + return "";
- + }
- +
- + private void StartEvent()
- + {
- +
- + // Check for empty reg list
- + if (_players.size() < 2)
- + {
- + Announcements.getInstance().announceToAll("Not enough players to start event");
- + eventStop();
- + return;
- + }
- +
- + Announcements.getInstance().announceToAll("Subclass TvT event started");
- +
- + // Remove registration NPC
- + if (_npc != null)
- + _npc.deleteMe();
- +
- + // Make teams
- + for (L2PcInstance player : _players)
- + {
- + if (player != null)
- + {
- + if (player.getLevel() == 40 && player.isSubClassActive())
- + {
- + player.addNotifyQuestOfDeath(player.getQuestState(getName()));
- + if (_team1.size() > _team2.size())
- + {
- + player.setTeam(1);
- + _team2.add(player);
- +
- + }
- + else
- + {
- + player.setTeam(2);
- + _team1.add(player);
- + }
- + }
- + else
- + {
- + player.sendMessage("You have been kicked from event because your level is not 40 or you dont have subclass active");
- + _players.remove(player);
- + }
- + }
- + }
- +
- + // Teleport players, remove buffs, remove summons, ressurect and full heal
- + for (L2PcInstance player : _team1)
- + {
- + player.stopAllEffectsExceptThoseThatLastThroughDeath();
- + L2Summon summon = player.getPet();
- + if (summon != null)
- + summon.unSummon(player);
- + if (player.isDead())
- + player.doRevive();
- + player.setCurrentCp(player.getMaxCp());
- + player.setCurrentMp(player.getMaxMp());
- + player.setCurrentHp(player.getMaxHp());
- + player.setInstanceId(_instance_id);
- + player.teleToLocation(150437, 47397, -3413);
- + }
- +
- + for (L2PcInstance player : _team2)
- + {
- + player.stopAllEffectsExceptThoseThatLastThroughDeath();
- + L2Summon summon = player.getPet();
- + if (summon != null)
- + summon.unSummon(player);
- + if (player.isDead())
- + player.doRevive();
- + player.setCurrentCp(player.getMaxCp());
- + player.setCurrentMp(player.getMaxMp());
- + player.setCurrentHp(player.getMaxHp());
- + player.setInstanceId(_instance_id);
- + player.teleToLocation(148513, 46122, -3408);
- + }
- +
- + _eventTask = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- + {
- + public void run()
- + {
- + eventStop();
- + }
- + }, 20 * 60 * 1000);
- +
- + }
- +
- + @Override
- + public String onDeath(final L2Character killer, final L2Character victim, QuestState qs)
- + {
- + if (((L2PcInstance) killer).getExpertiseWeaponPenalty() > 0 || ((L2PcInstance) killer).getExpertiseArmorPenalty() > 0)
- + {
- + SkillTable.getInstance().getInfo(4515, 1).getEffects(victim, killer);
- + if (_team1.contains(killer))
- + _team1_score--;
- + else if (_team2.contains(killer))
- + _team2_score--;
- + killer.sendMessage("Your kill is not counted because you have grade penalty");
- + }
- +
- + if (_team1.size() < 2 || _team2.size() < 2)
- + {
- + ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- + {
- + public void run()
- + {
- + Announcements.getInstance().announceToAll("Too many players disconnected from event. Ending event");
- + eventStop();
- + }
- + }, 2 * 1000);
- + }
- +
- + if (_team1.contains(killer) && _team2.contains(victim))
- + {
- +
- + _team1_score++;
- + ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- + {
- + public void run()
- + {
- + victim.doRevive();
- + victim.teleToLocation(148513, 46122, -3408);
- + }
- + }, 2 * 1000);
- +
- + }
- + else if (_team2.contains(killer) && _team1.contains(victim))
- + {
- + _team2_score++;
- + ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- + {
- + public void run()
- + {
- + victim.doRevive();
- + victim.teleToLocation(150437, 47397, -3413);
- + }
- + }, 2 * 1000);
- +
- + }
- + else
- + {
- + ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- + {
- + public void run()
- + {
- + victim.doRevive();
- + if (_team1.contains(killer))
- + {
- + victim.teleToLocation(148513, 46122, -3408);
- + }
- + else
- + {
- + victim.teleToLocation(150437, 47397, -3413);
- + }
- + }
- + }, 2 * 1000);
- + }
- +
- + for (L2PcInstance player : _players)
- + {
- + player.sendPacket(new ExCubeGameChangePoints((int) _eventTask.getDelay(TimeUnit.SECONDS), _team2_score, _team1_score));
- + }
- + return super.onDeath(killer, victim, qs);
- + }
- +
- +}
- Index: data/scripts/mods/eventmodSubclassTvT/31212-onlist.htm
- ===================================================================
- --- data/scripts/mods/eventmodSubclassTvT/31212-onlist.htm (revision 0)
- +++ data/scripts/mods/eventmodSubclassTvT/31212-onlist.htm (revision 0)
- @@ -0,0 +1,10 @@
- +<html>
- +<body>
- +<center>
- +<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center">
- +<br>
- +<font color=ff3333>Subclass event</font><br>
- +You are already on list.
- +</center>
- +</body>
- +</html>
- \ No newline at end of file
- Index: data/scripts/mods/eventmodSubclassTvT/31212-notreg.htm
- ===================================================================
- --- data/scripts/mods/eventmodSubclassTvT/31212-notreg.htm (revision 0)
- +++ data/scripts/mods/eventmodSubclassTvT/31212-notreg.htm (revision 0)
- @@ -0,0 +1,10 @@
- +<html>
- +<body>
- +<center>
- +<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center">
- +<br>
- +<font color=ff3333>Subclass event</font><br>
- +You are not registered.
- +</center>
- +</body>
- +</html>
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement