Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shared by Nightw0lf at
- https://maxcheaters.com/topic/225148-zodiac-event-engine-acis-370/
- ### Eclipse Workspace Patch 1.0
- #P aCis_datapack
- diff --git data/html/mods/zodiac/CaptureThem.htm data/html/mods/zodiac/CaptureThem.htm
- new file mode 100644
- index 0000000..ccfd04a
- --- /dev/null
- +++ data/html/mods/zodiac/CaptureThem.htm
- @@ -0,0 +1,3 @@
- +<html><title>CaptureThem</title><body>Jail:<br>
- +You will be teleported in 20 seconds.<br>
- +</body></html>
- \ No newline at end of file
- diff --git data/html/mods/zodiac/CastleTutorial.htm data/html/mods/zodiac/CastleTutorial.htm
- new file mode 100644
- index 0000000..0812ad2
- --- /dev/null
- +++ data/html/mods/zodiac/CastleTutorial.htm
- @@ -0,0 +1,14 @@
- +<html><title>CastleWars Tutorial</title><body>Jail:<br>
- +Once the Event starts:<br>
- +-If you are a defender:<br>
- +You need to defend all of the castle's flags<br>
- +2 in the artifact's rooms<br>
- +1 on the roof top<br>
- +If you succeed for 10 minutes you win the event<br>
- +<br>
- +-If you are an attacker:
- +You need to kill all the flags in the castle<br>
- +2 in the artifact's rooms<br>
- +1 on the roof top<br>
- +If you kill all 3 flags the event ends!<br>
- +</body></html>
- \ No newline at end of file
- diff --git data/html/mods/zodiac/ProtectTuto.htm data/html/mods/zodiac/ProtectTuto.htm
- new file mode 100644
- index 0000000..74c7aff
- --- /dev/null
- +++ data/html/mods/zodiac/ProtectTuto.htm
- @@ -0,0 +1,7 @@
- +<html><title>Protect The Leader</title><body>Jail:<br>
- +PLEASE READ!<br>
- +You will be teleported with the rest of your team<br>
- +in a stadium,There a rb will be spawned next to you<br>
- +protect it at all costs.In front of you is the enemy team<br>
- +Kill their rb first and you win!<br>
- +</body></html>
- \ No newline at end of file
- diff --git data/html/mods/zodiac/Treasure.htm data/html/mods/zodiac/Treasure.htm
- new file mode 100644
- index 0000000..072add7
- --- /dev/null
- +++ data/html/mods/zodiac/Treasure.htm
- @@ -0,0 +1,7 @@
- +<html><title>Treasure Chest</title><body>Jail:<br>
- +You are Registered for Treasure Chest Event.<br>
- +During this event you will have to kill treasure chests<br>
- +as quickly as you can only one of them is the lucky one!<br>
- +Killing players is not allowed so you WILL take karma<br>
- +if you kill any other player!!!<br>
- +</body></html>
- \ No newline at end of file
- diff --git data/html/mods/zodiac/Tutorial.htm data/html/mods/zodiac/Tutorial.htm
- new file mode 100644
- index 0000000..b2a20b5
- --- /dev/null
- +++ data/html/mods/zodiac/Tutorial.htm
- @@ -0,0 +1,10 @@
- +<html><title>CaptureThem</title><body>Jail:<br>
- +You are Registered for captureThem Event.<br>
- +During this event you will have the chance to<br>
- +fight othe rplayers for points that can be<br>
- +obtainned by<br>
- +1)killing players(1 point)<br>
- +2)Killing flags(10 points)<br>
- +NOTE: Flags don't respawn so you better<br>
- +choose your targets wiselly<br>
- +</body></html>
- \ No newline at end of file
- diff --git data/html/mods/zodiac/TutorialPelo.htm data/html/mods/zodiac/TutorialPelo.htm
- new file mode 100644
- index 0000000..e916af3
- --- /dev/null
- +++ data/html/mods/zodiac/TutorialPelo.htm
- @@ -0,0 +1,8 @@
- +<html><title>Peloponnesian War</title><body>Jail:<br>
- +How this works:<br>
- +There are 2 teams.Athenians and Spartans.
- +Once you get with your team in an arena<br>
- +you will fight each other,the one that survives<br>
- + will fight the other race's survivor<br>
- + The representative that wins gets<br> rewards for everybody in his team!
- +</body></html>
- \ No newline at end of file
- ### Eclipse Workspace Patch 1.0
- #P aCis_gameserver
- diff --git config/events.properties config/events.properties
- index fb2c293..2da2d2b 100644
- --- config/events.properties
- +++ config/events.properties
- @@ -235,4 +235,25 @@
- AltFishChampionshipReward2 = 500000
- AltFishChampionshipReward3 = 300000
- AltFishChampionshipReward4 = 200000
- -AltFishChampionshipReward5 = 100000
- \ No newline at end of file
- +AltFishChampionshipReward5 = 100000
- +
- +#=============================================================
- +# Zodiac Engine
- +#=============================================================
- +# Enable the events
- +# Default: False
- +Zodiace = False
- +
- +# Reward ID and Reward Count
- +ZodiadReward = 3470
- +ZodiadRewardc = 1
- +
- +# Same IP Protection
- +# Default: False
- +SameIpProtection = False
- +
- +# Engine start with server after XX Seconds
- +MinutesInitial = 10
- +
- +# Engine repeats events in XX minutes
- +MinutesAfterEvent = 60
- diff --git java/net/sf/l2j/Config.java java/net/sf/l2j/Config.java
- index e27eec0..f82522d 100644
- --- java/net/sf/l2j/Config.java
- +++ java/net/sf/l2j/Config.java
- @@ -206,6 +206,14 @@
- public static int ALT_FISH_CHAMPIONSHIP_REWARD_4;
- public static int ALT_FISH_CHAMPIONSHIP_REWARD_5;
- + /** Zodiac Engine */
- + public static boolean ZODIAC_ENABLE;
- + public static int ZODIAC_REWARD;
- + public static int ZODIAC_REWARD_COUN;
- + public static boolean SAME_IP_ZODIAC;
- + public static int INITIAL_START;
- + public static int BETWEEN_EVENTS;
- +
- // --------------------------------------------------
- // GeoEngine
- // --------------------------------------------------
- @@ -878,6 +886,13 @@
- ALT_FISH_CHAMPIONSHIP_REWARD_3 = events.getProperty("AltFishChampionshipReward3", 300000);
- ALT_FISH_CHAMPIONSHIP_REWARD_4 = events.getProperty("AltFishChampionshipReward4", 200000);
- ALT_FISH_CHAMPIONSHIP_REWARD_5 = events.getProperty("AltFishChampionshipReward5", 100000);
- +
- + ZODIAC_ENABLE = events.getProperty("Zodiace", true);
- + ZODIAC_REWARD = events.getProperty("ZodiadReward", 3470);
- + ZODIAC_REWARD_COUN = events.getProperty("ZodiadRewardc", 1);
- + SAME_IP_ZODIAC = events.getProperty("SameIpProtection", true);
- + INITIAL_START = events.getProperty("MinutesInitial", 10);
- + BETWEEN_EVENTS = events.getProperty("MinutesAfterEvent", 60);
- }
- /**
- diff --git java/net/sf/l2j/gameserver/GameServer.java java/net/sf/l2j/gameserver/GameServer.java
- index 9375025..48f5689 100644
- --- java/net/sf/l2j/gameserver/GameServer.java
- +++ java/net/sf/l2j/gameserver/GameServer.java
- @@ -57,6 +57,7 @@
- import net.sf.l2j.gameserver.handler.ItemHandler;
- import net.sf.l2j.gameserver.handler.SkillHandler;
- import net.sf.l2j.gameserver.handler.UserCommandHandler;
- +import net.sf.l2j.gameserver.handler.VoicedCommandHandler;
- import net.sf.l2j.gameserver.idfactory.IdFactory;
- import net.sf.l2j.gameserver.instancemanager.AuctionManager;
- import net.sf.l2j.gameserver.instancemanager.AutoSpawnManager;
- @@ -81,6 +82,7 @@
- import net.sf.l2j.gameserver.instancemanager.games.MonsterRace;
- import net.sf.l2j.gameserver.model.World;
- import net.sf.l2j.gameserver.model.entity.Hero;
- +import net.sf.l2j.gameserver.model.entity.engines.ZodiacMain;
- import net.sf.l2j.gameserver.model.olympiad.Olympiad;
- import net.sf.l2j.gameserver.model.olympiad.OlympiadGameManager;
- import net.sf.l2j.gameserver.model.partymatching.PartyMatchRoomList;
- @@ -266,6 +268,7 @@
- StringUtil.printSection("Events");
- MonsterRace.getInstance();
- + ZodiacMain.ZodiacIn();
- if (Config.ALLOW_WEDDING)
- CoupleManager.getInstance();
- @@ -280,6 +283,7 @@
- _log.config("ItemHandler: Loaded " + ItemHandler.getInstance().size() + " handlers.");
- _log.config("SkillHandler: Loaded " + SkillHandler.getInstance().size() + " handlers.");
- _log.config("UserCommandHandler: Loaded " + UserCommandHandler.getInstance().size() + " handlers.");
- + _log.config("VoicedCommandHandler: Loaded " + VoicedCommandHandler.getInstance().size() + " handlers.");
- StringUtil.printSection("System");
- Runtime.getRuntime().addShutdownHook(Shutdown.getInstance());
- diff --git java/net/sf/l2j/gameserver/handler/IVoicedCommandHandler.java java/net/sf/l2j/gameserver/handler/IVoicedCommandHandler.java
- new file mode 100644
- index 0000000..4c5db06
- --- /dev/null
- +++ java/net/sf/l2j/gameserver/handler/IVoicedCommandHandler.java
- @@ -0,0 +1,10 @@
- +package net.sf.l2j.gameserver.handler;
- +
- +import net.sf.l2j.gameserver.model.actor.instance.Player;
- +
- +public interface IVoicedCommandHandler
- +{
- + public boolean useVoicedCommand(String command, Player activeChar, String params);
- +
- + public String[] getVoicedCommandList();
- +}
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
- new file mode 100644
- index 0000000..b1601b3
- --- /dev/null
- +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
- @@ -0,0 +1,49 @@
- +package net.sf.l2j.gameserver.handler;
- +
- +import java.util.HashMap;
- +import java.util.Map;
- +
- +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.ZodiacRegistrationCMD;
- +
- +public class VoicedCommandHandler
- +{
- + private final Map<Integer, IVoicedCommandHandler> _datatable = new HashMap<>();
- +
- + public static VoicedCommandHandler getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + protected VoicedCommandHandler()
- + {
- + registerHandler(new ZodiacRegistrationCMD());
- + }
- +
- + public void registerHandler(IVoicedCommandHandler handler)
- + {
- + String[] ids = handler.getVoicedCommandList();
- +
- + for (int i = 0; i < ids.length; i++)
- + _datatable.put(ids[i].hashCode(), handler);
- + }
- +
- + public IVoicedCommandHandler getHandler(String voicedCommand)
- + {
- + String command = voicedCommand;
- +
- + if (voicedCommand.indexOf(" ") != -1)
- + command = voicedCommand.substring(0, voicedCommand.indexOf(" "));
- +
- + return _datatable.get(command.hashCode());
- + }
- +
- + public int size()
- + {
- + return _datatable.size();
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final VoicedCommandHandler _instance = new VoicedCommandHandler();
- + }
- +}
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java
- index 5bf1f90..8aa5b69 100644
- --- java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java
- +++ java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java
- @@ -1,11 +1,15 @@
- package net.sf.l2j.gameserver.handler.chathandlers;
- +import java.util.StringTokenizer;
- +
- import net.sf.l2j.gameserver.handler.IChatHandler;
- +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
- +import net.sf.l2j.gameserver.handler.VoicedCommandHandler;
- import net.sf.l2j.gameserver.model.BlockList;
- import net.sf.l2j.gameserver.model.actor.instance.Player;
- -import net.sf.l2j.gameserver.network.FloodProtectors;
- -import net.sf.l2j.gameserver.network.FloodProtectors.Action;
- +import net.sf.l2j.gameserver.model.zone.ZoneId;
- import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- +import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
- public class ChatAll implements IChatHandler
- {
- @@ -17,16 +21,51 @@
- @Override
- public void handleChat(int type, Player activeChar, String params, String text)
- {
- - if (!FloodProtectors.performAction(activeChar.getClient(), Action.GLOBAL_CHAT))
- - return;
- -
- - final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
- - for (Player player : activeChar.getKnownTypeInRadius(Player.class, 1250))
- + boolean vcd_used = false;
- + if (text.startsWith("."))
- {
- - if (!BlockList.isBlocked(player, activeChar))
- - player.sendPacket(cs);
- + StringTokenizer st = new StringTokenizer(text);
- + IVoicedCommandHandler vch;
- + String command = "";
- + if (st.countTokens() > 1)
- + {
- + command = st.nextToken().substring(1);
- + params = text.substring(command.length() + 2);
- + vch = VoicedCommandHandler.getInstance().getHandler(command);
- + }
- + else
- + {
- + command = text.substring(1);
- + vch = VoicedCommandHandler.getInstance().getHandler(command);
- + }
- +
- + if (vch != null)
- + {
- + vch.useVoicedCommand(command, activeChar, params);
- + vcd_used = true;
- + }
- }
- - activeChar.sendPacket(cs);
- + if (!vcd_used)
- + {
- + if (text.startsWith("lol") && activeChar.isInsideZone(ZoneId.TOWN))
- + activeChar.broadcastPacket(new SocialAction(activeChar, 10));
- +
- + if (text.startsWith("hi") && activeChar.isInsideZone(ZoneId.TOWN))
- + activeChar.broadcastPacket(new SocialAction(activeChar, 2));
- +
- + if (text.startsWith("haha") && activeChar.isInsideZone(ZoneId.TOWN))
- + activeChar.broadcastPacket(new SocialAction(activeChar, 10));
- +
- + if (text.startsWith("yes") && activeChar.isInsideZone(ZoneId.TOWN))
- + activeChar.broadcastPacket(new SocialAction(activeChar, 6));
- +
- + if (text.startsWith("no") && activeChar.isInsideZone(ZoneId.TOWN))
- + activeChar.broadcastPacket(new SocialAction(activeChar, 5));
- +
- + final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
- + activeChar.getKnownTypeInRadius(Player.class, 1250).stream().filter(p -> !BlockList.isBlocked(p, activeChar)).forEach(p -> p.sendPacket(cs));
- + activeChar.sendPacket(cs);
- + }
- }
- @Override
- diff --git java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/ZodiacRegistrationCMD.java java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/ZodiacRegistrationCMD.java
- new file mode 100644
- index 0000000..2d9a370
- --- /dev/null
- +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/ZodiacRegistrationCMD.java
- @@ -0,0 +1,78 @@
- +package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
- +
- +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
- +import net.sf.l2j.gameserver.model.actor.instance.Player;
- +import net.sf.l2j.gameserver.model.entity.engines.CaptureThem;
- +import net.sf.l2j.gameserver.model.entity.engines.CastleWars;
- +import net.sf.l2j.gameserver.model.entity.engines.PeloponnesianWar;
- +import net.sf.l2j.gameserver.model.entity.engines.ProtectTheLdr;
- +import net.sf.l2j.gameserver.model.entity.engines.TreasureChest;
- +import net.sf.l2j.gameserver.model.entity.engines.ZodiacMain;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +
- +/**
- + * @author Boorinio
- + */
- +public class ZodiacRegistrationCMD implements IVoicedCommandHandler
- +{
- + private static final String[] VOICED_COMMANDS =
- + {
- + "join",
- + "leave"
- + };
- +
- + @Override
- + public boolean useVoicedCommand(String command, Player activeChar, String params)
- + {
- + if (activeChar == null)
- + return false;
- +
- + String Ip = activeChar.getClient().getConnection().getInetAddress().getHostAddress();
- +
- + if (command.startsWith(VOICED_COMMANDS[0]) && ZodiacMain.isEligible(activeChar, Ip))
- + {
- + activeChar.isinZodiac = true;
- + activeChar.sendMessage("You are now registered!");
- + ZodiacMain.Ips.add(Ip);
- +
- + //final StringBuilder sb = new StringBuilder();
- + final NpcHtmlMessage html = new NpcHtmlMessage(0);
- +
- + if (CastleWars.CastleWarsRunning)
- + {
- + html.setFile("data/html/mods/zodiac/CastleTutorial.htm");
- + //html.replace("%name%", activeChar.getName());
- + }
- + else if (CaptureThem.CaptureThemRunning)
- + {
- + html.setFile("data/html/mods/zodiac/Tutorial.htm");
- + }
- + else if (PeloponnesianWar.PeloRunning)
- + {
- + html.setFile("data/html/mods/zodiac/TutorialPelo.htm");
- + }
- + else if (ProtectTheLdr.ProtectisRunning)
- + {
- + html.setFile("data/html/mods/zodiac/ProtectTuto.htm");
- + }
- + else if (TreasureChest.TreasureRunning)
- + {
- + html.setFile("data/html/mods/zodiac/Treasure.htm");
- + }
- + activeChar.sendPacket(html);
- + }
- + if ((command.startsWith(VOICED_COMMANDS[1]) && activeChar.isinZodiac))
- + {
- + activeChar.isinZodiac = false;
- + activeChar.sendMessage("You are now unregistered!");
- + ZodiacMain.Ips.remove(Ip);
- + }
- + return false;
- + }
- +
- + @Override
- + public String[] getVoicedCommandList()
- + {
- + return VOICED_COMMANDS;
- + }
- +}
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/model/actor/Npc.java java/net/sf/l2j/gameserver/model/actor/Npc.java
- index 7cb912e..6da4b4f 100644
- --- java/net/sf/l2j/gameserver/model/actor/Npc.java
- +++ java/net/sf/l2j/gameserver/model/actor/Npc.java
- @@ -40,6 +40,10 @@
- import net.sf.l2j.gameserver.model.actor.template.NpcTemplate.Race;
- import net.sf.l2j.gameserver.model.actor.template.NpcTemplate.SkillType;
- import net.sf.l2j.gameserver.model.entity.Castle;
- +import net.sf.l2j.gameserver.model.entity.engines.CaptureThem;
- +import net.sf.l2j.gameserver.model.entity.engines.CastleWars;
- +import net.sf.l2j.gameserver.model.entity.engines.ProtectTheLdr;
- +import net.sf.l2j.gameserver.model.entity.engines.TreasureChest;
- import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- import net.sf.l2j.gameserver.model.item.kind.Item;
- import net.sf.l2j.gameserver.model.item.kind.Weapon;
- @@ -1269,6 +1273,28 @@
- if (!super.doDie(killer))
- return false;
- + if (getNpcId() == 18286 && TreasureChest.TreasureRunning)
- + {
- + TreasureChest.LuckyOne((Player) killer);
- + }
- + if (getNpcId() == 36006)
- + {
- + if (!CastleWars.isFinished && CastleWars.CastleWarsRunning)
- + {
- + CastleWars.flagskilled++;
- + CastleWars.attackersWin();
- + }
- + if (CaptureThem.CaptureThemRunning)
- + ((Player) killer).ZodiacPoints = ((Player) killer).ZodiacPoints + 10;
- + }
- + if (getNpcId() == 36007 && ProtectTheLdr.ProtectisRunning)
- + {
- + ProtectTheLdr.team2wins();
- + }
- + if (getNpcId() == 36008 && ProtectTheLdr.ProtectisRunning)
- + {
- + ProtectTheLdr.team1wins();
- + }
- _currentLHandId = getTemplate().getLeftHand();
- _currentRHandId = getTemplate().getRightHand();
- _currentEnchant = getTemplate().getEnchantEffect();
- diff --git java/net/sf/l2j/gameserver/model/actor/instance/Gatekeeper.java java/net/sf/l2j/gameserver/model/actor/instance/Gatekeeper.java
- index f5ba1b9..e3566ca 100644
- --- java/net/sf/l2j/gameserver/model/actor/instance/Gatekeeper.java
- +++ java/net/sf/l2j/gameserver/model/actor/instance/Gatekeeper.java
- @@ -48,6 +48,12 @@
- if (list == null)
- return;
- + if (player.isinZodiac)
- + {
- + player.sendMessage("You cannot teleport while in Zodiac's Event's");
- + return;
- + }
- +
- final Siege siegeOnTeleportLocation = CastleManager.getInstance().getSiege(list.getX(), list.getY(), list.getZ());
- if (siegeOnTeleportLocation != null && siegeOnTeleportLocation.isInProgress())
- {
- diff --git java/net/sf/l2j/gameserver/model/actor/instance/Player.java java/net/sf/l2j/gameserver/model/actor/instance/Player.java
- index 82f58e2..0775fe5 100644
- --- java/net/sf/l2j/gameserver/model/actor/instance/Player.java
- +++ java/net/sf/l2j/gameserver/model/actor/instance/Player.java
- @@ -106,6 +106,10 @@
- import net.sf.l2j.gameserver.model.entity.Hero;
- import net.sf.l2j.gameserver.model.entity.Siege;
- import net.sf.l2j.gameserver.model.entity.Siege.SiegeSide;
- +import net.sf.l2j.gameserver.model.entity.engines.CaptureThem;
- +import net.sf.l2j.gameserver.model.entity.engines.CastleWars;
- +import net.sf.l2j.gameserver.model.entity.engines.PeloponnesianWar;
- +import net.sf.l2j.gameserver.model.entity.engines.ProtectTheLdr;
- import net.sf.l2j.gameserver.model.group.CommandChannel;
- import net.sf.l2j.gameserver.model.group.Party;
- import net.sf.l2j.gameserver.model.group.Party.LootRule;
- @@ -3944,6 +3948,20 @@
- // if the area isn't an arena
- if (!isInArena())
- {
- + if (pk != null && CastleWars.CastleWarsRunning && (isinZodiac && pk.isinZodiac))
- + {
- + sendMessage("You will be revived in your spot");
- + }
- + if (pk != null && (pk.isinZodiac && pk.isinZodiac) && CaptureThem.CaptureThemRunning)
- + pk.ZodiacPoints++;
- + if (isinZodiac && PeloponnesianWar.PeloRunning)
- + {
- + isinZodiac = false;
- + teleToLocation(82698, 148638, -3473, 0);
- + getAppearance().setNameColor(0xFFFFFF);
- + setTitle("");
- + broadcastUserInfo();
- + }
- // if both victim and attacker got clans & aren't academicians
- if (pk != null && pk.getClan() != null && getClan() != null && !isAcademyMember() && !pk.isAcademyMember())
- {
- @@ -8504,6 +8522,36 @@
- _reviveRequested = 0;
- _revivePower = 0;
- + if (CastleWars.CastleWarsRunning)
- + {
- + if (CastleWars.isattacker(this))
- + teleToLocation(CastleWars.attackersx, CastleWars.attackersy, CastleWars.attackersz,0);
- + if (CastleWars.isdefender(this))
- + teleToLocation(CastleWars.defendersx, CastleWars.defendersy, CastleWars.defendersz,0);
- + }
- + if (isinZodiac && CaptureThem.CaptureThemRunning)
- + {
- + getStatus().setCurrentHp(getMaxHp());
- + getStatus().setCurrentMp(getMaxMp());
- + getStatus().setCurrentCp(getMaxCp());
- + teleToLocation(149722, 46700, -3413,0);
- + L2Skill skill;
- + skill = SkillTable.getInstance().getInfo(1323, 1);
- + skill.getEffects(this, this);
- + }
- + if (isinZodiac && ProtectTheLdr.ProtectisRunning)
- + {
- + getStatus().setCurrentHp(getMaxHp());
- + getStatus().setCurrentMp(getMaxMp());
- + getStatus().setCurrentCp(getMaxCp());
- + L2Skill skill;
- + skill = SkillTable.getInstance().getInfo(1323, 1);
- + skill.getEffects(this, this);
- + if (ProtectTheLdr._Team1.containsKey(getObjectId()))
- + teleToLocation(ProtectTheLdr.team1x, ProtectTheLdr.team1y, ProtectTheLdr.team1z, 0);
- + if (ProtectTheLdr._Team2.containsKey(getObjectId()))
- + teleToLocation(ProtectTheLdr.team2x, ProtectTheLdr.team2y, ProtectTheLdr.team2z, 0);
- + }
- if (isMounted())
- startFeed(_mountNpcId);
- @@ -10536,4 +10584,8 @@
- }
- }
- }
- +
- + public boolean isinZodiac;
- + public int ZodiacPoints;
- + public int CountIps;
- }
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/model/entity/engines/CaptureThem.java java/net/sf/l2j/gameserver/model/entity/engines/CaptureThem.java
- new file mode 100644
- index 0000000..1abc82e
- --- /dev/null
- +++ java/net/sf/l2j/gameserver/model/entity/engines/CaptureThem.java
- @@ -0,0 +1,239 @@
- +package net.sf.l2j.gameserver.model.entity.engines;
- +
- +import java.util.ArrayList;
- +import java.util.HashMap;
- +import java.util.List;
- +import java.util.Map;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.commons.concurrent.ThreadPool;
- +import net.sf.l2j.commons.random.Rnd;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.DoorTable;
- +import net.sf.l2j.gameserver.data.NpcTable;
- +import net.sf.l2j.gameserver.data.SkillTable;
- +import net.sf.l2j.gameserver.model.L2Skill;
- +import net.sf.l2j.gameserver.model.L2Spawn;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.Npc;
- +import net.sf.l2j.gameserver.model.actor.instance.Player;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +import net.sf.l2j.gameserver.util.Broadcast;
- +
- +/**
- + * @author Boorinio
- + */
- +public class CaptureThem
- +{
- + protected static final Logger _log = Logger.getLogger(CaptureThem.class.getName());
- + public static boolean CaptureThemRunning;
- + private static int i;
- + private final static Map<Integer, Player> _players = new HashMap<>();
- + private static List<Npc> _flags = new ArrayList<>();
- + private static int flagId = 36006;
- + private static int MostPoints = 0;
- + public static Player MostPointsPlayer;
- + private static int[] flagsx =
- + {
- + 149506,
- + 149412,
- + 150025,
- + 148741,
- + 149999,
- + 150110,
- + 150121,
- + 149550,
- + 149235,
- + };
- + private static int[] flagsy =
- + {
- + 47471,
- + 46144,
- + 46670,
- + 46750,
- + 46221,
- + 46464,
- + 46872,
- + 47105,
- + 47871,
- + };
- + private static int flagsz = -3413;
- +
- + public static void openRegistration()
- + {
- + CaptureThemRunning = true;
- + ZodiacMain.ZodiacRegisterActive = true;
- + Broadcast.announceToOnlinePlayers("CaptureThem Event has Started!");
- + Broadcast.announceToOnlinePlayers("Type .join to enter or .leave to leave!");
- + Broadcast.announceToOnlinePlayers("You have 5 minutes to register!");
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 4 minutes to register!");
- + }, 60 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 3 minutes to register!");
- + }, 120 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 2 minutes to register!");
- + }, 180 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 1 minutes to register!");
- + }, 240 * 1000);
- + ThreadPool.schedule(() -> {
- + stopRegistration();
- + }, 300 * 1000);
- + }
- +
- + public static void stopRegistration()
- + {
- + Broadcast.announceToOnlinePlayers("CaptureThem Registration is Over!");
- + for (Player player : World.getInstance().getPlayers())
- + {
- + if (player == null)
- + continue;
- +
- + ZodiacMain.ZodiacRegisterActive = false;
- + if (player.isinZodiac)
- + {
- + final NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setFile("data/html/mods/zodiac/CaptureThem.htm");
- + player.sendPacket(html);
- + _players.putIfAbsent(player.getObjectId(), player);
- + }
- + }
- + ThreadPool.schedule(() -> {
- + if (_players.size() > 1)
- + StartEvent();
- + else
- + {
- + Broadcast.announceToOnlinePlayers("The event was canceled due to lack of players!");
- + CaptureThemRunning = false;
- + }
- + }, 10 * 1000);
- +
- + }
- +
- + public static void StartEvent()
- + {
- + DoorTable.getInstance().getDoor(24190001).closeMe();
- + DoorTable.getInstance().getDoor(24190002).closeMe();
- + DoorTable.getInstance().getDoor(24190003).closeMe();
- + DoorTable.getInstance().getDoor(24190004).closeMe();
- + Npc flags = null;
- + for (i = 0; i < 9; i++)
- + {
- + flags = addSpawn(flagId, flagsx[i], flagsy[i], flagsz, 0, false, 600, true);
- + _flags.add(flags);
- + }
- + for (Player player : _players.values())
- + {
- + if (player == null)
- + continue;
- + player.ZodiacPoints = 0;
- + player.getAppearance().setNameColor(0xFF0000);
- + player.setTitle("CaptureThem");
- + L2Skill skill;
- + skill = SkillTable.getInstance().getInfo(1323, 1);
- + skill.getEffects(player, player);
- + player.broadcastUserInfo();
- + player.teleToLocation(149527, 46684, -3413,0);
- + player.sendMessage("The Event has Started! And will finish in 10 minutes");
- + }
- + Broadcast.announceToOnlinePlayers("You have 10 minutes until the event is over!");
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 5 minutes until the event is over!");
- + }, 300 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 4 minutes until the event is over!");
- + }, 360 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 3 minutes until the event is over!");
- + }, 420 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 2 minutes until the event is over!");
- + }, 480 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 1 minutes until the event is over!");
- + }, 540 * 1000);
- + ThreadPool.schedule(() -> {
- + StopClean();
- + }, 600 * 1000);
- + }
- +
- + public static void StopClean()
- + {
- + for (Player player : _players.values())
- + {
- + if (player == null)
- + continue;
- + if (player.ZodiacPoints > MostPoints)
- + {
- + MostPointsPlayer = player;
- + MostPoints = player.ZodiacPoints;
- + }
- + }
- + if (MostPointsPlayer != null)
- + {
- + MostPointsPlayer.addItem("Reward", Config.ZODIAC_REWARD, Config.ZODIAC_REWARD_COUN, MostPointsPlayer, true);
- + Broadcast.announceToOnlinePlayers("Winner of the event " + MostPointsPlayer + " With " + MostPoints + " Points!");
- + }
- + for (Player player : _players.values())
- + {
- + if (player == null)
- + continue;
- + player.getAppearance().setNameColor(0xFFFFFF);
- + player.setTitle("");
- + player.broadcastUserInfo();
- + player.teleToLocation(82698, 148638, -3473,0);
- + player.broadcastUserInfo();
- + player.isinZodiac = false;
- + player.sendMessage("The Event is officially finished!");
- + }
- + for (Npc flag : _flags)
- + {
- + if (flag == null)
- + continue;
- + flag.deleteMe();
- +
- + }
- + DoorTable.getInstance().getDoor(24190001).openMe();
- + DoorTable.getInstance().getDoor(24190002).openMe();
- + DoorTable.getInstance().getDoor(24190003).openMe();
- + DoorTable.getInstance().getDoor(24190004).openMe();
- + _players.clear();
- + _flags.clear();
- + CaptureThemRunning = false;
- + }
- +
- + public static Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn)
- + {
- + try
- + {
- + final NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
- + if (template == null)
- + return null;
- +
- + if (randomOffset)
- + {
- + x += Rnd.get(-100, 100);
- + y += Rnd.get(-100, 100);
- + }
- +
- + final L2Spawn spawn = new L2Spawn(template);
- + spawn.setLoc(x, y, z + 20, heading);
- + spawn.setRespawnState(false);
- +
- + final Npc npc = spawn.doSpawn(isSummonSpawn);
- + if (despawnDelay > 0)
- + npc.scheduleDespawn(despawnDelay);
- +
- + return npc;
- + }
- + catch (Exception e1)
- + {
- + _log.warning("Zodiac Engine: Could not spawn Npc " + npcId);
- + return null;
- + }
- + }
- +}
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/model/entity/engines/CastleWars.java java/net/sf/l2j/gameserver/model/entity/engines/CastleWars.java
- new file mode 100644
- index 0000000..0eaadaa
- --- /dev/null
- +++ java/net/sf/l2j/gameserver/model/entity/engines/CastleWars.java
- @@ -0,0 +1,317 @@
- +package net.sf.l2j.gameserver.model.entity.engines;
- +
- +import java.util.ArrayList;
- +import java.util.HashMap;
- +import java.util.List;
- +import java.util.Map;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.commons.concurrent.ThreadPool;
- +import net.sf.l2j.commons.random.Rnd;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.DoorTable;
- +import net.sf.l2j.gameserver.data.NpcTable;
- +import net.sf.l2j.gameserver.model.L2Spawn;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.Npc;
- +import net.sf.l2j.gameserver.model.actor.instance.Player;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.util.Broadcast;
- +
- +/**
- + * @author Boorinio
- + */
- +public class CastleWars
- +{
- + protected static final Logger _log = Logger.getLogger(CastleWars.class.getName());
- + private final static Map<Integer, Player> _defenders = new HashMap<>();
- + private final static Map<Integer, Player> _attackers = new HashMap<>();
- + private static List<Npc> _flags = new ArrayList<>();
- + public static boolean isFinished;
- + public static boolean CastleWarsRunning;
- + private static boolean alaksokolies = false;
- + private static int i;
- + public static int flagskilled = 0;
- + public static int defendersx = 77566;
- + public static int defendersy = -152128;
- + public static int defendersz = -545;
- + public static int attackersx = 84303;
- + public static int attackersy = -140727;
- + public static int attackersz = -1568;
- + public static int[] flagslocx =
- + {
- + 77545,
- + 76663,
- + 78446,
- + };
- + private static int[] flagslocy =
- + {
- + -149937,
- + -154522,
- + -154524,
- + };
- + private static int[] flagslocz =
- + {
- + 345,
- + 128,
- + 235,
- + };
- +
- + public static void openRegi()
- + {
- + ZodiacMain.ZodiacRegisterActive = true;
- + Broadcast.announceToOnlinePlayers("CastleWars Event has Started!");
- + Broadcast.announceToOnlinePlayers("Type .join to enter or .leave to leave!");
- + Broadcast.announceToOnlinePlayers("You have 5 minutes to register!");
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 4 minutes to register!");
- + }, 60 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 3 minutes to register!");
- + }, 120 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 2 minutes to register!");
- + }, 180 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 1 minutes to register!");
- + }, 240 * 1000);
- + ThreadPool.schedule(() -> {
- + if (_defenders.size() == 0 || _attackers.size() == 0)
- + {
- + Broadcast.announceToOnlinePlayers("Event cancelled due to lack of participation.");
- + isFinished = true;
- + cleanevent();
- + return;
- + }
- + CastleWarsRunning = true;
- + ZodiacMain.ZodiacRegisterActive = false;
- + isFinished = false;
- + preparecastle();
- + shufflePlayers();
- + teleportThem();
- + if (!isFinished)
- + Broadcast.announceToOnlinePlayers("You have 10 minutes until the event is over!");
- + ThreadPool.schedule(() -> {
- + if (!isFinished)
- + Broadcast.announceToOnlinePlayers("You have 5 minutes until the event is over!");
- + }, 300 * 1000);
- + ThreadPool.schedule(() -> {
- + if (!isFinished)
- + Broadcast.announceToOnlinePlayers("You have 4 minutes until the event is over!");
- + }, 360 * 1000);
- + ThreadPool.schedule(() -> {
- + if (!isFinished)
- + Broadcast.announceToOnlinePlayers("You have 3 minutes until the event is over!");
- + }, 420 * 1000);
- + ThreadPool.schedule(() -> {
- + if (!isFinished)
- + Broadcast.announceToOnlinePlayers("You have 2 minutes until the event is over!");
- + }, 480 * 1000);
- + ThreadPool.schedule(() -> {
- + if (!isFinished)
- + Broadcast.announceToOnlinePlayers("You have 1 minutes until the event is over!");
- + }, 540 * 1000);
- + ThreadPool.schedule(() -> {
- + if (!isFinished)
- + defendersWin();
- + }, 600 * 1000);
- + }, 300 * 1000);
- + }
- +
- + public static void preparecastle()
- + {
- + DoorTable.getInstance().getDoor(22130001).openMe();
- + DoorTable.getInstance().getDoor(22130002).openMe();
- + DoorTable.getInstance().getDoor(22130003).openMe();
- + DoorTable.getInstance().getDoor(22130004).openMe();
- + DoorTable.getInstance().getDoor(22130005).openMe();
- + DoorTable.getInstance().getDoor(22130010).openMe();
- + DoorTable.getInstance().getDoor(22130007).openMe();
- + DoorTable.getInstance().getDoor(22130011).openMe();
- + DoorTable.getInstance().getDoor(22130009).openMe();
- + DoorTable.getInstance().getDoor(22130008).openMe();
- + DoorTable.getInstance().getDoor(22130010).openMe();
- + DoorTable.getInstance().getDoor(22130006).openMe();
- + Npc flags = null;
- + for (i = 0; i < 3; i++)
- + {
- + flags = addSpawn(36006, flagslocx[i], flagslocy[i], flagslocz[i], 0, false, 600, true);
- + _flags.add(flags);
- + }
- + }
- +
- + public static void cleanevent()
- + {
- + for (Player defender : _defenders.values())
- + {
- + if (defender == null)
- + continue;
- + defender.getAppearance().setNameColor(0xFFFFFF);
- + defender.setTitle("");
- + defender.broadcastUserInfo();
- + defender.teleToLocation(82724, 148307, -3469, 0);
- + defender.isinZodiac = false;
- + }
- + for (Player attacker : _attackers.values())
- + {
- + if (attacker == null)
- + continue;
- + attacker.getAppearance().setNameColor(0xFFFFFF);
- + attacker.setTitle("");
- + attacker.broadcastUserInfo();
- + attacker.teleToLocation(82724, 148307, -3469, 0);
- + attacker.isinZodiac = false;
- + }
- + for (Npc flags : _flags)
- + {
- + flags.deleteMe();
- +
- + }
- + flagskilled = 0;
- + _flags.clear();
- + _defenders.clear();
- + _attackers.clear();
- + DoorTable.getInstance().getDoor(22130001).closeMe();
- + DoorTable.getInstance().getDoor(22130002).closeMe();
- + DoorTable.getInstance().getDoor(22130003).closeMe();
- + DoorTable.getInstance().getDoor(22130004).closeMe();
- + DoorTable.getInstance().getDoor(22130005).closeMe();
- + DoorTable.getInstance().getDoor(22130010).closeMe();
- + DoorTable.getInstance().getDoor(22130007).closeMe();
- + DoorTable.getInstance().getDoor(22130011).closeMe();
- + DoorTable.getInstance().getDoor(22130009).closeMe();
- + DoorTable.getInstance().getDoor(22130008).closeMe();
- + DoorTable.getInstance().getDoor(22130010).closeMe();
- + DoorTable.getInstance().getDoor(22130006).closeMe();
- + }
- +
- + public static void defendersWin()
- + {
- + Broadcast.announceToOnlinePlayers("Defenders Won the event they protected the flags!");
- + for (Player defender : _defenders.values())
- + {
- + if (defender == null)
- + continue;
- + defender.sendMessage("Congratulations! Here is a reward for your effort!");
- + defender.addItem("Reward", Config.ZODIAC_REWARD, Config.ZODIAC_REWARD_COUN, defender, true);
- + }
- + isFinished = true;
- + cleanevent();
- + }
- +
- + public static boolean isattacker(Player player)
- + {
- + if (_attackers.containsKey(player.getObjectId()))
- + {
- + return true;
- + }
- + return false;
- + }
- +
- + public static boolean isdefender(Player player)
- + {
- + if (_defenders.containsKey(player.getObjectId()))
- + {
- + return true;
- + }
- + return false;
- + }
- +
- + public static void attackersWin()
- + {
- + if (flagskilled == 3)
- + {
- + Broadcast.announceToOnlinePlayers("Attackers Won the event they killed all the flags!");
- + for (Player attacker : _attackers.values())
- + {
- + if (attacker == null)
- + continue;
- + attacker.sendMessage("Congratulations! Here is a reward for your effort!");
- + attacker.addItem("Reward", Config.ZODIAC_REWARD, Config.ZODIAC_REWARD_COUN, attacker, true);
- + }
- + isFinished = true;
- + cleanevent();
- + }
- + }
- +
- + public static void teleportThem()
- + {
- + for (Player defender : _defenders.values())
- + {
- + if (defender == null)
- + continue;
- + defender.teleToLocation(defendersx, defendersy, defendersz, 0);
- + }
- + for (Player attacker : _attackers.values())
- + {
- + if (attacker == null)
- + continue;
- + attacker.teleToLocation(attackersx, attackersy, attackersz, 0);
- + }
- + }
- +
- + public static void openRegistration()
- + {
- + Broadcast.announceToOnlinePlayers("Registrations are now over!");
- + }
- +
- + public static void shufflePlayers()
- + {
- + for (Player player : World.getInstance().getPlayers())
- + {
- + if (player == null)
- + continue;
- + if (player.isinZodiac)
- + {
- + if (alaksokolies)
- + {
- + _defenders.putIfAbsent(player.getObjectId(), player);
- + player.getAppearance().setNameColor(0xFF0000);
- + player.setTitle("Defender");
- + player.broadcastUserInfo();
- + alaksokolies = false;
- + }
- + else
- + {
- + _attackers.putIfAbsent(player.getObjectId(), player);
- + player.getAppearance().setNameColor(0x0000FF);
- + player.setTitle("Attacker");
- + player.broadcastUserInfo();
- + alaksokolies = true;
- + }
- + }
- + }
- + }
- +
- + public static Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn)
- + {
- + try
- + {
- + final NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
- + if (template == null)
- + return null;
- +
- + if (randomOffset)
- + {
- + x += Rnd.get(-100, 100);
- + y += Rnd.get(-100, 100);
- + }
- +
- + final L2Spawn spawn = new L2Spawn(template);
- + spawn.setLoc(x, y, z + 20, heading);
- + spawn.setRespawnState(false);
- +
- + final Npc npc = spawn.doSpawn(isSummonSpawn);
- + if (despawnDelay > 0)
- + npc.scheduleDespawn(despawnDelay);
- +
- + return npc;
- + }
- + catch (Exception e1)
- + {
- + _log.warning("Zodiac Engine: Could not spawn Npc " + npcId);
- + return null;
- + }
- + }
- +}
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/model/entity/engines/PeloponnesianWar.java java/net/sf/l2j/gameserver/model/entity/engines/PeloponnesianWar.java
- new file mode 100644
- index 0000000..f7e7925
- --- /dev/null
- +++ java/net/sf/l2j/gameserver/model/entity/engines/PeloponnesianWar.java
- @@ -0,0 +1,349 @@
- +package net.sf.l2j.gameserver.model.entity.engines;
- +
- +import java.util.ArrayList;
- +import java.util.HashMap;
- +import java.util.List;
- +import java.util.Map;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.commons.concurrent.ThreadPool;
- +import net.sf.l2j.commons.random.Rnd;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.NpcTable;
- +import net.sf.l2j.gameserver.model.L2Spawn;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.Npc;
- +import net.sf.l2j.gameserver.model.actor.instance.Player;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.util.Broadcast;
- +
- +/**
- + * @author Boorinio
- + */
- +public class PeloponnesianWar
- +{
- + protected static final Logger _log = Logger.getLogger(PeloponnesianWar.class.getName());
- + private static boolean alaksokolies = true;
- + public static boolean PeloRunning, continuez, continuez2;
- + private static int i, countA, countS;
- + private final static Map<Integer, Player> _participants = new HashMap<>();
- + private final static Map<Integer, Player> _athenians = new HashMap<>();
- + private final static Map<Integer, Player> _spartans = new HashMap<>();
- + private static List<Npc> _protectors = new ArrayList<>();
- + private static int athenianx = 72923;
- + private static int atheniany = 142764;
- + private static int athenianz = -3773;
- + private static int spartanx = -87891;
- + private static int spartany = 142198;
- + private static int spartanz = -3646;
- + private static int protectors = 30627;
- + private static int[] protectorsx =
- + {
- + 72931,
- + 72995,
- + 73011,
- + 73070,
- + -87921,
- + -87998,
- + -87908,
- + -87836,
- + };
- + private static int[] protectorsy =
- + {
- + 143270,
- + 143250,
- + 142272,
- + 142282,
- + 142707,
- + 142679,
- + 141758,
- + 141777,
- + };
- + private static int[] protectorsz =
- + {
- + -3773,
- + -3773,
- + -3773,
- + -3773,
- + -3646,
- + -3646,
- + -3646,
- + -3646,
- + };
- +
- + public static void startevent()
- + {
- + PeloRunning = true;
- + ZodiacMain.ZodiacRegisterActive = true;
- + Broadcast.announceToOnlinePlayers("Peloponnesian War Event has Started!");
- + Broadcast.announceToOnlinePlayers("Type .join to enter or .leave to leave!");
- + Broadcast.announceToOnlinePlayers("You have 5 minutes to register!");
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 4 minutes to register!");
- + }, 60 * 1000);
- +
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 3 minutes to register!");
- + }, 120 * 1000);
- +
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 2 minutes to register!");
- + }, 180 * 1000);
- +
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 1 minutes to register!");
- + }, 240 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("Registrations closed!");
- + if (_participants.size() == 0 || _athenians.size() == 0 ||_spartans.size() == 0)
- + {
- + Broadcast.announceToOnlinePlayers("Event cancelled due to lack of participation.");
- + cleanthemess();
- + return;
- + }
- + ZodiacMain.ZodiacRegisterActive = false;
- + for (Player player : World.getInstance().getPlayers())
- + {
- + if (player == null)
- + continue;
- + if (player.isinZodiac)
- + {
- + _participants.putIfAbsent(player.getObjectId(), player);
- + if (alaksokolies)
- + {
- + _spartans.putIfAbsent(player.getObjectId(), player);
- + player.setTitle("Spartan");
- + player.getAppearance().setNameColor(0x0000FF);
- + player.broadcastUserInfo();
- + alaksokolies = false;
- + }
- + else
- + {
- + _athenians.putIfAbsent(player.getObjectId(), player);
- + player.setTitle("Athenian");
- + player.getAppearance().setNameColor(0xFF0000);
- + player.broadcastUserInfo();
- + alaksokolies = true;
- + }
- +
- + }
- + }
- + spawnProtectors();
- + teleportplayers();
- + Broadcast.announceToOnlinePlayers("Civil War round started!");
- + Broadcast.announceToOnlinePlayers("You have 3 minutes the one who survive will face the opponent race!!");
- + ThreadPool.schedule(() -> {
- + for (Player finals : _athenians.values())
- + {
- + if (finals == null)
- + continue;
- + if (finals.isinZodiac)
- + countA++;
- + }
- + for (Player finals : _spartans.values())
- + {
- + if (finals == null)
- + continue;
- + if (finals.isinZodiac)
- + countS++;
- + }
- + if (countA > 1)
- + {
- + Broadcast.announceToOnlinePlayers("Athenians cheated and tried to send more than two players Spartans won!");
- + reward(false);
- + }
- + else if (countS > 1)
- + {
- + Broadcast.announceToOnlinePlayers("Spartans cheated and tried to send more than two players Athenians won!");
- + reward(true);
- + }
- + else
- + {
- + finalround();
- + Broadcast.announceToOnlinePlayers("Spartan and Athenian representative have 2 minutes to face each other");
- + ThreadPool.schedule(() -> {
- + checkwhowon();
- + }, 120 * 1000);
- + }
- +
- + }, 180 * 1000);
- + }, 300 * 1000);
- + }
- +
- + public static void cleanthemess()
- + {
- + for (Player participant : _participants.values())
- + {
- + if (participant == null)
- + continue;
- + if (participant.isinZodiac)
- + {
- + participant.setTitle("");
- + participant.getAppearance().setNameColor(0xFFFFFF);
- + participant.broadcastUserInfo();
- + participant.teleToLocation(82698, 148638, -3473, 0);
- + }
- + participant.isinZodiac = false;
- + }
- + for (Npc protectors : _protectors)
- + {
- + if (protectors == null)
- + continue;
- + protectors.deleteMe();
- + }
- + continuez = false;
- + continuez2 = false;
- + PeloRunning = false;
- + _protectors.clear();
- + _participants.clear();
- + _athenians.clear();
- + _spartans.clear();
- + }
- +
- + private static void reward(boolean Athenians)
- + {
- + if (Athenians)
- + {
- + for (Player athenians : _athenians.values())
- + {
- +
- + if (athenians == null)
- + continue;
- + athenians.addItem("Reward", Config.ZODIAC_REWARD, Config.ZODIAC_REWARD_COUN, athenians, true);
- +
- + }
- + }
- + else
- + {
- + for (Player spartans : _spartans.values())
- + {
- +
- + if (spartans == null)
- + continue;
- + spartans.addItem("Reward", Config.ZODIAC_REWARD, Config.ZODIAC_REWARD_COUN, spartans, true);
- +
- + }
- + }
- + }
- +
- + public static void checkwhowon()
- + {
- + for (Player winner : _participants.values())
- + {
- + if (winner == null)
- + continue;
- + if (winner.isinZodiac && _athenians.containsKey(winner.getObjectId()))
- + continuez = true;
- + if (winner.isinZodiac && _spartans.containsKey(winner.getObjectId()))
- + continuez2 = true;
- + if (continuez && continuez2)
- + Broadcast.announceToOnlinePlayers("Both representatives are alive blame them for not getting a reward!");
- + else if (continuez)
- + {
- + Broadcast.announceToOnlinePlayers("Athenians won!");
- + reward(true);
- + }
- + else if (continuez2)
- + {
- + Broadcast.announceToOnlinePlayers("Spartans won!");
- + reward(false);
- + }
- + }
- + cleanthemess();
- + }
- +
- + public static void finalround()
- + {
- + for (Player athenian : _athenians.values())
- + {
- + if (athenian == null)
- + continue;
- + if (athenian.isinZodiac)
- + {
- + athenian.sendMessage("You are the best athenian you will face the best spartan");
- + athenian.setTitle("Final Athenian");
- + athenian.setCurrentHp(athenian.getMaxHp());
- + athenian.setCurrentMp(athenian.getMaxMp());
- + athenian.setCurrentCp(athenian.getMaxCp());
- + athenian.addItem("Reward", Config.ZODIAC_REWARD, Config.ZODIAC_REWARD_COUN, athenian, true);
- + athenian.broadcastUserInfo();
- + athenian.teleToLocation(-21754, -20955, -3026, 0);
- + }
- + }
- + for (Player spartan : _spartans.values())
- + {
- + if (spartan == null)
- + continue;
- + if (spartan.isinZodiac)
- + {
- + spartan.sendMessage("You are the best spartan you will face the best athenian");
- + spartan.setTitle("Final Spartan");
- + spartan.setCurrentHp(spartan.getMaxHp());
- + spartan.setCurrentMp(spartan.getMaxMp());
- + spartan.setCurrentCp(spartan.getMaxCp());
- + spartan.addItem("Reward", Config.ZODIAC_REWARD, Config.ZODIAC_REWARD_COUN, spartan, true);
- + spartan.broadcastUserInfo();
- + spartan.teleToLocation(-19821, -20988, -3026, 0);
- + }
- + }
- + }
- +
- + public static void teleportplayers()
- + {
- + for (Player player : _participants.values())
- + {
- + if (player == null)
- + continue;
- + if (_athenians.containsKey(player.getObjectId()))
- + {
- + player.teleToLocation(athenianx, atheniany, athenianz, 0);
- + }
- + else
- + {
- + player.teleToLocation(spartanx, spartany, spartanz, 0);
- + }
- + }
- + }
- +
- + public static void spawnProtectors()
- + {
- + Npc protector = null;
- + for (i = 0; i < 8; i++)
- + {
- + protector = addSpawn(protectors, protectorsx[i], protectorsy[i], protectorsz[i], 0, false, 600, true);
- + _protectors.add(protector);
- + }
- + }
- +
- + public static Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn)
- + {
- + try
- + {
- + final NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
- + if (template == null)
- + return null;
- +
- + if (randomOffset)
- + {
- + x += Rnd.get(-100, 100);
- + y += Rnd.get(-100, 100);
- + }
- +
- + final L2Spawn spawn = new L2Spawn(template);
- + spawn.setLoc(x, y, z + 20, heading);
- + spawn.setRespawnState(false);
- +
- + final Npc npc = spawn.doSpawn(isSummonSpawn);
- + if (despawnDelay > 0)
- + npc.scheduleDespawn(despawnDelay);
- +
- + return npc;
- + }
- + catch (Exception e1)
- + {
- + _log.warning("Zodiac Engine: Could not spawn Npc " + npcId);
- + return null;
- + }
- + }
- +}
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/model/entity/engines/ProtectTheLdr.java java/net/sf/l2j/gameserver/model/entity/engines/ProtectTheLdr.java
- new file mode 100644
- index 0000000..77bb276
- --- /dev/null
- +++ java/net/sf/l2j/gameserver/model/entity/engines/ProtectTheLdr.java
- @@ -0,0 +1,211 @@
- +package net.sf.l2j.gameserver.model.entity.engines;
- +
- +import java.util.ArrayList;
- +import java.util.HashMap;
- +import java.util.List;
- +import java.util.Map;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.commons.concurrent.ThreadPool;
- +import net.sf.l2j.commons.random.Rnd;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.NpcTable;
- +import net.sf.l2j.gameserver.model.L2Spawn;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.Npc;
- +import net.sf.l2j.gameserver.model.actor.instance.Player;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.util.Broadcast;
- +
- +/**
- + * @author Boorinio
- + */
- +public class ProtectTheLdr
- +{
- + protected static final Logger _log = Logger.getLogger(ProtectTheLdr.class.getName());
- + public final static Map<Integer, Player> _Team1 = new HashMap<>();
- + public final static Map<Integer, Player> _Team2 = new HashMap<>();
- + public static int team1x = -19790;
- + public static int team1y = -21023;
- + public static int team1z = -3025;
- + private static int leader1 = 36007;
- + public static int team2x = -21780, team2y = -20976, team2z = -3027, leader2 = 36008;
- + private static int leader2x = -21717, leader2y = -20859, leader2z = -3027;
- + private static int leader1x = -19846, leader1y = -20859, leader1z = -3027;
- + public static boolean ProtectisRunning, alaksokolies;
- + private static List<Npc> _leaders = new ArrayList<>();
- +
- + public static void startevent()
- + {
- + ZodiacMain.ZodiacRegisterActive = true;
- + Broadcast.announceToOnlinePlayers("ProtectTheLeader Event has Started!");
- + Broadcast.announceToOnlinePlayers("Type .join to enter or .leave to leave!");
- + Broadcast.announceToOnlinePlayers("You have 5 minutes to register!");
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 4 minutes to register!");
- + }, 60 * 1000);
- +
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 3 minutes to register!");
- + }, 120 * 1000);
- +
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 2 minutes to register!");
- + }, 180 * 1000);
- +
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 1 minutes to register!");
- + }, 240 * 1000);
- + ThreadPool.schedule(() -> {
- + if (_Team1.size() == 0 || _Team2.size() == 0)
- + {
- + Broadcast.announceToOnlinePlayers("Event cancelled due to lack of participation.");
- + cleanthemess();
- + return;
- + }
- + ZodiacMain.ZodiacRegisterActive = false;
- + ProtectisRunning = true;
- + Broadcast.announceToOnlinePlayers("Registrations are now over!");
- + shufflePlayers();
- + teleportplayers();
- + Npc spawn1 = null;
- + Npc spawn2 = null;
- + spawn1 = addSpawn(leader1, leader1x, leader1y, leader1z, 0, false, 600, true);
- + spawn2 = addSpawn(leader2, leader2x, leader2y, leader2z, 0, false, 600, true);
- + _leaders.add(spawn1);
- + _leaders.add(spawn2);
- + Broadcast.announceToOnlinePlayers("Go kill the enemy's Leader rb!");
- + }, 300 * 1000);
- + }
- +
- + public static void team1wins()
- + {
- + Broadcast.announceToOnlinePlayers("Team 1 won team's 2 leader is dead!");
- + for (Player member : _Team1.values())
- + {
- + if (member == null)
- + continue;
- + member.sendMessage("Congratulations! The enemy leader is dead!");
- + member.addItem("Reward", Config.ZODIAC_REWARD, Config.ZODIAC_REWARD_COUN, member, true);
- + }
- + cleanthemess();
- + }
- +
- + public static void team2wins()
- + {
- + Broadcast.announceToOnlinePlayers("Team 2 won team's 1 leader is dead!");
- + for (Player member : _Team2.values())
- + {
- + if (member == null)
- + continue;
- + member.sendMessage("Congratulations! The enemy leader is dead!");
- + member.addItem("Reward", Config.ZODIAC_REWARD, Config.ZODIAC_REWARD_COUN, member, true);
- + }
- + cleanthemess();
- + }
- +
- + public static void cleanthemess()
- + {
- + for (Player member : _Team1.values())
- + {
- + if (member == null)
- + continue;
- + member.getAppearance().setNameColor(0xFFFFFF);
- + member.setTitle("");
- + member.broadcastUserInfo();
- + member.isinZodiac = false;
- + member.teleToLocation(82743, 148219, -3470, 0);
- + }
- + for (Player member : _Team2.values())
- + {
- + if (member == null)
- + continue;
- + member.getAppearance().setNameColor(0xFFFFFF);
- + member.setTitle("");
- + member.broadcastUserInfo();
- + member.isinZodiac = false;
- + member.teleToLocation(82743, 148219, -3470, 0);
- + }
- + for (Npc leader : _leaders)
- + {
- + leader.deleteMe();
- + }
- + ProtectisRunning = false;
- + }
- +
- + public static void teleportplayers()
- + {
- + for (Player member : _Team1.values())
- + {
- + if (member == null)
- + continue;
- + member.teleToLocation(team1x, team1y, team1z, 0);
- + }
- + for (Player member : _Team2.values())
- + {
- + if (member == null)
- + continue;
- + member.teleToLocation(team2x, team2y, team2z, 0);
- + }
- + }
- +
- + public static void shufflePlayers()
- + {
- + for (Player player : World.getInstance().getPlayers())
- + {
- + if (player == null)
- + continue;
- + if (player.isinZodiac)
- + {
- + if (alaksokolies)
- + {
- + _Team1.putIfAbsent(player.getObjectId(), player);
- + player.getAppearance().setNameColor(0xFF0000);
- + player.setTitle("Team1");
- + player.broadcastUserInfo();
- + alaksokolies = false;
- + }
- + else
- + {
- + _Team2.putIfAbsent(player.getObjectId(), player);
- + player.getAppearance().setNameColor(0x0000FF);
- + player.setTitle("Team2");
- + player.broadcastUserInfo();
- + alaksokolies = true;
- + }
- + }
- + }
- + }
- +
- + public static Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn)
- + {
- + try
- + {
- + final NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
- + if (template == null)
- + return null;
- +
- + if (randomOffset)
- + {
- + x += Rnd.get(-100, 100);
- + y += Rnd.get(-100, 100);
- + }
- +
- + final L2Spawn spawn = new L2Spawn(template);
- + spawn.setLoc(x, y, z + 20, heading);
- + spawn.setRespawnState(false);
- +
- + final Npc npc = spawn.doSpawn(isSummonSpawn);
- + if (despawnDelay > 0)
- + npc.scheduleDespawn(despawnDelay);
- +
- + return npc;
- + }
- + catch (Exception e1)
- + {
- + _log.warning("Zodiac Engine: Could not spawn Npc " + npcId);
- + return null;
- + }
- + }
- +}
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/model/entity/engines/TreasureChest.java java/net/sf/l2j/gameserver/model/entity/engines/TreasureChest.java
- new file mode 100644
- index 0000000..8a37a6b
- --- /dev/null
- +++ java/net/sf/l2j/gameserver/model/entity/engines/TreasureChest.java
- @@ -0,0 +1,144 @@
- +package net.sf.l2j.gameserver.model.entity.engines;
- +
- +import java.util.ArrayList;
- +import java.util.HashMap;
- +import java.util.List;
- +import java.util.Map;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.commons.concurrent.ThreadPool;
- +import net.sf.l2j.commons.random.Rnd;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.NpcTable;
- +import net.sf.l2j.gameserver.model.L2Spawn;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.Npc;
- +import net.sf.l2j.gameserver.model.actor.instance.Player;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.util.Broadcast;
- +
- +/**
- + * @author Boorinio
- + */
- +public class TreasureChest
- +{
- + protected static final Logger _log = Logger.getLogger(TreasureChest.class.getName());
- + public static boolean TreasureRunning;
- + private final static Map<Integer, Player> _players = new HashMap<>();
- + private static List<Npc> _Npcs = new ArrayList<>();
- + private static int x = 87377, y = 20459, z = -5270, i;
- +
- + public static void registration()
- + {
- + ZodiacMain.ZodiacRegisterActive = true;
- + Broadcast.announceToOnlinePlayers("TreasureChest Event has Started!");
- + Broadcast.announceToOnlinePlayers("Type .join to enter or .leave to leave!");
- + Broadcast.announceToOnlinePlayers("You have 5 minutes to register!");
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 4 minutes to register!");
- + }, 60 * 1000);
- +
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 3 minutes to register!");
- + }, 120 * 1000);
- +
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 2 minutes to register!");
- + }, 180 * 1000);
- +
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 1 minutes to register!");
- + }, 240 * 1000);
- +
- + ThreadPool.schedule(() -> {
- + for (Player player : World.getInstance().getPlayers())
- + {
- + if (player == null)
- + continue;
- + if (player.isinZodiac)
- + {
- + _players.putIfAbsent(player.getObjectId(), player);
- + }
- + }
- + if (_players.size() > 0)
- + startevent();
- + else
- + Broadcast.announceToOnlinePlayers("Event was cancelled cause no one registered!");
- + }, 300 * 1000);
- +
- + }
- +
- + public static void startevent()
- + {
- + ZodiacMain.ZodiacRegisterActive = false;
- + TreasureRunning = true;
- + for (Player players : _players.values())
- + {
- + players.teleToLocation(x, y, z, 0);
- + players.sendMessage("Kill as many chest as you can!");
- + }
- + Npc npcs = null;
- + for (i = 0; i < 40; i++)
- + {
- + npcs = addSpawn(18286, x + Rnd.get(-750, +750), y + Rnd.get(-750, +750), z, 0, false, 600, true);
- + _Npcs.add(npcs);
- + }
- + }
- +
- + public static void LuckyOne(Player killer)
- + {
- + if (Rnd.get(50) == 2)
- + {
- + Broadcast.announceToOnlinePlayers(killer + " killed the lucky chest!");
- + killer.addItem("Reward", Config.ZODIAC_REWARD, Config.ZODIAC_REWARD_COUN, killer, true);
- + cleanthemess();
- + }
- + }
- +
- + public static void cleanthemess()
- + {
- + for (Player players : _players.values())
- + {
- + players.teleToLocation(83225, 148068, -3430, 0);
- + }
- + for (Npc npc : _Npcs)
- + {
- + npc.deleteMe();
- + }
- + TreasureRunning = false;
- + _players.clear();
- + _Npcs.clear();
- + }
- +
- + public static Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn)
- + {
- + try
- + {
- + final NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
- + if (template == null)
- + return null;
- +
- + if (randomOffset)
- + {
- + x += Rnd.get(-100, 100);
- + y += Rnd.get(-100, 100);
- + }
- +
- + final L2Spawn spawn = new L2Spawn(template);
- + spawn.setLoc(x, y, z + 20, heading);
- + spawn.setRespawnState(false);
- +
- + final Npc npc = spawn.doSpawn(isSummonSpawn);
- + if (despawnDelay > 0)
- + npc.scheduleDespawn(despawnDelay);
- +
- + return npc;
- + }
- + catch (Exception e1)
- + {
- + _log.warning("Zodiac Engine: Could not spawn Npc " + npcId);
- + return null;
- + }
- + }
- +}
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/model/entity/engines/ZodiacMain.java java/net/sf/l2j/gameserver/model/entity/engines/ZodiacMain.java
- new file mode 100644
- index 0000000..c8bf8ae
- --- /dev/null
- +++ java/net/sf/l2j/gameserver/model/entity/engines/ZodiacMain.java
- @@ -0,0 +1,222 @@
- +package net.sf.l2j.gameserver.model.entity.engines;
- +
- +import java.util.ArrayList;
- +import java.util.List;
- +
- +import net.sf.l2j.commons.concurrent.ThreadPool;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.instance.Player;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +import net.sf.l2j.gameserver.util.Broadcast;
- +
- +/**
- + * @author Boorinio
- + */
- +public class ZodiacMain
- +{
- + public static List<String> Ips = new ArrayList<>();
- + public static boolean ZodiacRegisterActive;
- + public static int i, max;
- + public static int[] count =
- + {
- + 0,
- + 0,
- + 0,
- + 0,
- + 0
- + };
- + public static boolean voting;
- +
- + public static void ZodiacIn()
- + {
- + ThreadPool.scheduleAtFixedRate(() -> {
- + if (!ZodiacRegisterActive)
- + startVoting();
- + }, Config.INITIAL_START * 1000, Config.BETWEEN_EVENTS * 1000);
- + }
- +
- + public static void startVoting()
- + {
- + voting = true;
- + for (Player player : World.getInstance().getPlayers())
- + {
- + if (player == null)
- + continue;
- +
- + showHtmlWindow(player);
- + }
- + Broadcast.announceToOnlinePlayers("You have 5 minutes to vote for the event you like!");
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 4 minutes to vote for the event you like!");
- + }, 60 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 3 minutes to vote for the event you like!");
- + }, 120 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 2 minutes to vote for the event you like!");
- + }, 180 * 1000);
- + ThreadPool.schedule(() -> {
- + Broadcast.announceToOnlinePlayers("You have 1 minute to vote for the event you like!");
- + }, 240 * 1000);
- + ThreadPool.schedule(() -> {
- + voting = false;
- + endit();
- + }, 500 * 1000);
- + }
- +
- + public static void showHtmlWindow(Player activeChar)
- + {
- + NpcHtmlMessage nhm = new NpcHtmlMessage(5);
- + StringBuilder tb = new StringBuilder("");
- + tb.append("<html><head><title>Zodiac Event Voting</title></head><body>");
- + tb.append("<center>");
- + tb.append("<td valign=\"top\"><font color=\"FF6600\">Vote for the event you want to play!</font>");
- + tb.append("<br>");
- + tb.append("<img src=\"SSQ_dungeon_T.SSQ_fire1_e013\" width=256 height=64>");
- + tb.append("<br1>");
- + tb.append("<img src=\"L2UI.SquareWhite\" width=194 height=1>");
- + tb.append("<table bgcolor=333333 width=204>");
- + tb.append("<tr>");
- + tb.append("<td><center><button value=\"CaptureThem\" action=\"bypass -h CaptureThem\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center></td>");
- + tb.append("</tr>");
- + tb.append(" <tr>");
- + tb.append("<td><center><button value=\"Peloponnesian\" action=\"bypass -h PeloponnesianWar\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center></td>");
- + tb.append("</tr>");
- + tb.append("<tr>");
- + tb.append("<td><center><button value=\"CastleWars\" action=\"bypass -h CastleWars\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center></td>");
- + tb.append("</tr>");
- + tb.append("<tr>");
- + tb.append("<td><center><button value=\"ProtectTheLdr\" action=\"bypass -h ProtectTheLdr\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center></td>");
- + tb.append("</tr>");
- + tb.append("<tr>");
- + tb.append("<td><center><button value=\"TreasureChest\" action=\"bypass -h TreasureChest\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></center></td>");
- + tb.append("</tr>");
- + tb.append("</table>");
- + tb.append("<font color=\"FF6600\">By Boorinio!</font>");
- + tb.append("</center>");
- + tb.append("</body></html>");
- + nhm.setHtml(tb.toString());
- + activeChar.sendPacket(nhm);
- + }
- +
- + public static void showFinalWindow(Player player)
- + {
- + NpcHtmlMessage nhm = new NpcHtmlMessage(5);
- + StringBuilder tb = new StringBuilder("");
- + tb.append("<html><title>Zodiac Event Engine</title><body>Current Votes:<br>");
- + tb.append("Current Votes:<br><br>");
- + tb.append("Peloponnesian War: " + count[0] + "<br>");
- + tb.append("Capture Them: " + count[1] + "<br>");
- + tb.append("Castle Wars: " + count[2] + "<br>");
- + tb.append("Treasure Chests: " + count[4] + "<br>");
- + tb.append("Protect The Leader: " + count[3] + "<br><br>");
- + tb.append("</body></html>");
- + nhm.setHtml(tb.toString());
- + player.sendPacket(nhm);
- + }
- +
- + public static void endit()
- + {
- + max = 0;
- + for (i = 0; i < 5; i++)
- + {
- + if (count[i] > max)
- + max = i;
- + }
- + if (max == 0)
- + {
- + Broadcast.announceToOnlinePlayers("Peloponnesian Event has the most votes!");
- + Broadcast.announceToOnlinePlayers("In 10 seconds the registration will open!");
- + ThreadPool.schedule(() -> {
- + PeloponnesianWar.startevent();
- + }, 10 * 1000);
- + }
- + else if (max == 1)
- + {
- + Broadcast.announceToOnlinePlayers("CaptureThem Event has the most votes!");
- + Broadcast.announceToOnlinePlayers("In 10 seconds the registration will open!");
- + ThreadPool.schedule(() -> {
- + CaptureThem.openRegistration();
- + }, 10 * 1000);
- + }
- + else if (max == 2)
- + {
- + Broadcast.announceToOnlinePlayers("CastleWars Event has the most votes!");
- + Broadcast.announceToOnlinePlayers("In 10 seconds the registration will open!");
- + ThreadPool.schedule(() -> {
- + CastleWars.openRegistration();
- + }, 10 * 1000);
- +
- + }
- + else if (max == 3)
- + {
- + Broadcast.announceToOnlinePlayers("ProtectTheLeader Event has the most votes!");
- + Broadcast.announceToOnlinePlayers("In 10 seconds the registration will open!");
- + ThreadPool.schedule(() -> {
- + ProtectTheLdr.startevent();
- + }, 10 * 1000);
- + }
- + else if (max == 4)
- + {
- + Broadcast.announceToOnlinePlayers("Treasure Chest Event has the most votes!");
- + Broadcast.announceToOnlinePlayers("In 10 seconds the registration will open!");
- + ThreadPool.schedule(() -> {
- + TreasureChest.registration();
- + }, 10 * 1000);
- + }
- + else
- + {
- + Broadcast.announceToOnlinePlayers("No votes event canceled!");
- + }
- + max = 0;
- + for (i = 0; i < 4; i++)
- + {
- + count[i] = 0;
- + }
- + }
- +
- + public static boolean isEligible(Player player, String ip)
- + {
- +
- + if (player.isinZodiac)
- + {
- + player.sendMessage("You are Already in Zodiac");
- + return false;
- + }
- + if (!ZodiacRegisterActive)
- + {
- + player.sendMessage("Zodiac's Registrations are offline!");
- + return false;
- + }
- + if (player.getLevel() < 76)
- + {
- + player.sendMessage("You are lower than 76 lvl");
- + return false;
- + }
- + if (player.isInJail())
- + {
- + player.sendMessage("You are in jail...daah");
- + return false;
- + }
- + if (player.isInOlympiadMode())
- + {
- + player.sendMessage("You are in olympiad mode");
- + return false;
- + }
- + if (hasbots(ip) && Config.SAME_IP_ZODIAC)
- + {
- + player.sendMessage("You have already joinned with that ip");
- + return false;
- + }
- + return true;
- + }
- +
- + public static boolean hasbots(String ip)
- + {
- + if (Ips.contains(ip))
- + return true;
- + return false;
- + }
- +}
- \ No newline at end of file
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
- index f43c397..2347db8 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
- @@ -15,6 +15,7 @@
- import net.sf.l2j.gameserver.model.actor.instance.OlympiadManagerNpc;
- import net.sf.l2j.gameserver.model.actor.instance.Player;
- import net.sf.l2j.gameserver.model.entity.Hero;
- +import net.sf.l2j.gameserver.model.entity.engines.ZodiacMain;
- import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
- import net.sf.l2j.gameserver.network.FloodProtectors;
- import net.sf.l2j.gameserver.network.FloodProtectors.Action;
- @@ -169,6 +170,36 @@
- final int arenaId = Integer.parseInt(_command.substring(12).trim());
- activeChar.enterOlympiadObserverMode(arenaId);
- }
- + else if (_command.startsWith("PeloponnesianWar") && ZodiacMain.voting)
- + {
- + activeChar.sendMessage("You have voted for PeloponnesianWar!");
- + ZodiacMain.count[0]++;
- + ZodiacMain.showFinalWindow(activeChar);
- + }
- + else if (_command.startsWith("CaptureThem") && ZodiacMain.voting)
- + {
- + activeChar.sendMessage("You have voted for CaptureThem!");
- + ZodiacMain.count[1]++;
- + ZodiacMain.showFinalWindow(activeChar);
- + }
- + else if (_command.startsWith("CastleWars") && ZodiacMain.voting)
- + {
- + activeChar.sendMessage("You have voted for CastleWars!");
- + ZodiacMain.count[2]++;
- + ZodiacMain.showFinalWindow(activeChar);
- + }
- + else if (_command.startsWith("ProtectTheLdr") && ZodiacMain.voting)
- + {
- + activeChar.sendMessage("You have voted for ProtectTheLeader!");
- + ZodiacMain.count[3]++;
- + ZodiacMain.showFinalWindow(activeChar);
- + }
- + else if (_command.startsWith("TreasureChest") && ZodiacMain.voting)
- + {
- + activeChar.sendMessage("You have voted for TreasureChest!");
- + ZodiacMain.count[4]++;
- + ZodiacMain.showFinalWindow(activeChar);
- + }
- }
- catch (Exception e)
- {
- diff --git java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
- index accc86d..86fb870 100644
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
- @@ -30,6 +30,12 @@
- return;
- }
- + if (player.isinZodiac)
- + {
- + player.sendMessage("You cant logout while in zodiac");
- + return;
- + }
- +
- if (player.isInsideZone(ZoneId.NO_RESTART))
- {
- player.sendPacket(SystemMessageId.NO_RESTART_HERE);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement