Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Evento Pk Hunter Event

Iniciado por Swarlog, Ago 06, 2022, 02:14 AM

Tema anterior - Siguiente tema

Swarlog

Se trata de un evento en donde los jugadores PK son anunciados y quien los maten son recompensados. Ademas, el evento dispone de comandos para saber si estas cerca de dicho jugador o en que lugar esta situado con el comando ".gopk".

CitarCORE:

### Eclipse Workspace Patch 1.0
#P L2J_Server
Index: java/com/l2jserver/gameserver/model/entity/PkHunterEvent.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/PkHunterEvent.java (revision 0)
+++ java/com/l2jserver/gameserver/model/entity/PkHunterEvent.java (revision 0)
@@ -0,0 +1,158 @@
+/*
+ * 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 com.l2jserver.gameserver.model.entity;
+
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.util.Util;
+
+/**
+ *
+ * @author Wyatt
+ *
+ */
+
+public class PkHunterEvent
+{
+ private static boolean isActive = false;
+ private static L2PcInstance Pk = null;
+ private static int[] PkLocation = {0,0,0};
+
+ public static boolean isActive()
+ {
+ return isActive;
+ }
+
+ public static L2PcInstance getPk()
+ {
+ return Pk;
+ }
+
+ public static void setPk(L2PcInstance player)
+ {
+ Pk = player;
+ }
+
+ public static void setActive(Boolean active)
+ {
+ isActive = active;
+ }
+
+ public static void setPkLocation(int x, int y, int z)
+ {
+ PkLocation[0] = x;
+ PkLocation[1] = y;
+ PkLocation[2] = z;
+ }
+
+ public static int[] getPkLocation()
+ {
+ return PkLocation;
+ }
+
+ public static boolean isPk(L2Character pk)
+ {
+ if(pk != null && getPk() != null && pk.getName().equals(getPk().getName()))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isPkOnline()
+ {
+ if(getPk() != null && getPk().isOnline())
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static void sendLocationMessage(L2PcInstance activeChar)
+ {
+ if(isPkOnline())
+ {
+ L2PcInstance target = L2World.getInstance().getPlayer(PkHunterEvent.getPk().getName());
+ double angle = activeChar.getHeading()/182.044444444;
+ double angle2 = Util.calculateAngleFrom(activeChar, target);
+ String location = "";
+ String distance = "";
+ double finalAngle = angle - angle2;
+
+ if(finalAngle < 0)
+ finalAngle +=360;
+
+ double octamore = 22.5;
+
+ if(finalAngle>=octamore*15 && finalAngle <octamore*17)
+ {
+ location = " infront of you";
+ }
+ else if(finalAngle >= octamore*1 && finalAngle < octamore * 3)
+ {
+ location = " infront of you, on your left";
+ }
+ else if(finalAngle >= octamore*3 && finalAngle < octamore * 5)
+ {
+ location = " on your left";
+ }
+ else if(finalAngle >= octamore*5 && finalAngle < octamore * 7)
+ {
+ location = " behind you, on your left";
+ }
+ else if(finalAngle >= octamore*7 && finalAngle < octamore * 9)
+ {
+ location = " behind you";
+ }
+ else if(finalAngle >= octamore*9 && finalAngle < octamore * 11)
+ {
+ location = " behind you, on your right";
+ }
+ else if(finalAngle >= octamore*11 && finalAngle < octamore * 13)
+ {
+ location = " on your right";
+ }
+ else if(finalAngle >= octamore*13 && finalAngle < octamore * 15)
+ {
+ location = " infront of you, on your right";
+ }
+ else
+ {
+ location = " infront of you";
+ }
+
+ double dist = Util.calculateDistance(activeChar, target, false);
+
+ if(dist < 400)
+ distance = ", very close";
+ else if(dist < 1000)
+ distance = ", close";
+ else if(dist < 4000)
+ distance = ", at medium range";
+ else if(dist < 12000)
+ distance = ", quite some distance away";
+ else if(dist < 20000)
+ distance = ", far away";
+ else
+ distance = ", very very far away";
+ activeChar.sendMessage(target.getName()+ " is" + location + " "+ distance+".");
+ }
+ else
+ {
+ activeChar.sendMessage("The PK is Offline now.");
+ }
+ }
+}
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 5822)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -160,6 +160,8 @@
 import com.l2jserver.gameserver.model.entity.Hero;
 import com.l2jserver.gameserver.model.entity.Instance;
 import com.l2jserver.gameserver.model.entity.L2Event;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
+import com.l2jserver.gameserver.model.entity.PkHunterEventConditions;
 import com.l2jserver.gameserver.model.entity.Siege;
 import com.l2jserver.gameserver.model.entity.TvTEvent;
 import com.l2jserver.gameserver.model.fishing.L2Fish;
@@ -5507,6 +5533,7 @@
  L2PcInstance pk = killer.getActingPlayer();
 
  TvTEvent.onKill(killer, this);
+ PkHunterEventConditions.checkDie(killer, this);
 
  if (L2Event.isParticipant(pk) && pk != null)
  pk.getEventStatus().kills.add(this);
@@ -5673,6 +5703,11 @@
  )
  return;
 
+ if(PkHunterEvent.isPk(killer) && !Config.DROP_PKHUNTEREVENT)
+ {
+ return;
+ }
+
  if ((!isInsideZone(ZONE_PVP) || pk == null) && (!isGM() || Config.KARMA_DROP_GM))
  {
  boolean isKarmaDrop = false;
@@ -5914,6 +6003,7 @@
  && AntiFeedManager.getInstance().check(this, target))
  setPkKills(getPkKills() + 1);
 
+ PkHunterEventConditions.checkPk(this, target);
  // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
  sendPacket(new UserInfo(this));
  sendPacket(new ExBrExtraUserInfo(this));
Index: java/com/l2jserver/gameserver/network/clientpackets/Logout.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/Logout.java (revision 5822)
+++ java/com/l2jserver/gameserver/network/clientpackets/Logout.java (working copy)
@@ -23,6 +23,7 @@
 import com.l2jserver.gameserver.model.L2Party;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.entity.L2Event;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
@@ -59,6 +60,13 @@
  return;
  }
 
+ if (PkHunterEvent.isPk(player))
+ {
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ player.sendMessage("You can't logout while in event.");
+ return;
+ }
+
  if (player.isLocked())
  {
  _log.warning("Player " + player.getName() + " tried to logout during class change.");
Index: java/com/l2jserver/gameserver/model/olympiad/OlympiadManager.java
===================================================================
--- java/com/l2jserver/gameserver/model/olympiad/OlympiadManager.java (revision 5822)
+++ java/com/l2jserver/gameserver/model/olympiad/OlympiadManager.java (working copy)
@@ -28,6 +28,7 @@
 import com.l2jserver.gameserver.model.L2World;
 import com.l2jserver.gameserver.model.StatsSet;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
 import com.l2jserver.gameserver.model.entity.TvTEvent;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
@@ -456,6 +457,12 @@
  return false;
  }
 
+ if (PkHunterEvent.isPk(player))
+ {
+ player.sendMessage("You can't participate in Olympiads while in event.");
+ return false;
+ }
+
  final int charId = noble.getObjectId();
  if (TvTEvent.isPlayerParticipant(charId))
  {
Index: java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillTeleport.java
===================================================================
--- java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillTeleport.java (revision 5822)
+++ java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillTeleport.java (working copy)
@@ -23,6 +23,7 @@
 import com.l2jserver.gameserver.model.StatsSet;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
 import com.l2jserver.gameserver.model.entity.TvTEvent;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 import com.l2jserver.gameserver.model.skills.L2SkillType;
@@ -63,6 +64,12 @@
  return;
  }
 
+ if (PkHunterEvent.isPk(activeChar))
+ {
+ activeChar.sendMessage("You can't use escape skills while in event.");
+ return;
+ }
+
  if (activeChar.isAfraid())
  {
  activeChar.sendPacket(ActionFailed.STATIC_PACKET);
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java (revision 5822)
+++ java/com/l2jserver/Config.java (working copy)
@@ -765,7 +765,14 @@
  public static int L2JMOD_DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP;
  public static TIntIntHashMap L2JMOD_DUALBOX_CHECK_WHITELIST;
  public static boolean L2JMOD_ALLOW_CHANGE_PASSWORD;
+ public static boolean ENABLE_PKHUNTEREVENT;
+ public static boolean DROP_PKHUNTEREVENT;
+ public static int PKHUNTEREVENT_CHANCE;
+ public static int TIME_PKHUNTEREVENT;
+ public static List<int[]> PKHUNTEREVENT_REWARD;
+ public static List<int[]> PKHUNTEREVENT_PK_REWARD;
 
+
  // --------------------------------------------------
  // NPC Settings
  // --------------------------------------------------
@@ -2728,6 +2735,57 @@
  }
  }
  L2JMOD_ALLOW_CHANGE_PASSWORD = Boolean.parseBoolean(L2JModSettings.getProperty("AllowChangePassword", "False"));
+ ENABLE_PKHUNTEREVENT = Boolean.parseBoolean(L2JModSettings.getProperty("EnablePKHunterEvent", "True"));
+ DROP_PKHUNTEREVENT = Boolean.parseBoolean(L2JModSettings.getProperty("PKHunterEventDrop", "False"));
+ PKHUNTEREVENT_CHANCE = Integer.parseInt(L2JModSettings.getProperty("PKHunterEventChance", "20"));
+ TIME_PKHUNTEREVENT = Integer.parseInt(L2JModSettings.getProperty("PKHunterEventTime", "5"));
+
+ if(PKHUNTEREVENT_CHANCE < 1)
+ {
+ PKHUNTEREVENT_CHANCE = 1;
+ }
+ PKHUNTEREVENT_REWARD = new ArrayList<>();
+ propertySplit = L2JModSettings.getProperty("PKHunterEventRewards", "14720,5;14721,2").split(";");
+
+ for (String reward : propertySplit)
+ {
+ String[] rewardSplit = reward.split(",");
+ if (rewardSplit.length != 2)
+ _log.warning(StringUtil.concat("PkHunterEvent: invalid config property ->PkHunterEventRewards \"", reward, "\""));
+ else
+ {
+ try
+ {
+ PKHUNTEREVENT_REWARD.add(new int[]{Integer.parseInt(rewardSplit[0]), Integer.parseInt(rewardSplit[1])});
+ }
+ catch (NumberFormatException nfe)
+ {
+ if (!reward.isEmpty())
+ _log.warning(StringUtil.concat("PkHunterEvent: invalid config property -> PkHunterEventRewards \"", reward, "\""));
+ }
+ }
+ }
+ PKHUNTEREVENT_PK_REWARD = new ArrayList<>();
+ propertySplit = L2JModSettings.getProperty("PKHunterEventPkRewards", "14720,5;14721,2").split(";");
+
+ for (String reward : propertySplit)
+ {
+ String[] rewardSplit = reward.split(",");
+ if (rewardSplit.length != 2)
+ _log.warning(StringUtil.concat("PkHunterEvent: invalid config property ->PkHunterEventPkRewards \"", reward, "\""));
+ else
+ {
+ try
+ {
+ PKHUNTEREVENT_PK_REWARD.add(new int[]{Integer.parseInt(rewardSplit[0]), Integer.parseInt(rewardSplit[1])});
+ }
+ catch (NumberFormatException nfe)
+ {
+ if (!reward.isEmpty())
+ _log.warning(StringUtil.concat("PkHunterEvent: invalid config property -> PkHunterEventPkRewards \"", reward, "\""));
+ }
+ }
+ }
  }
  catch (Exception e)
  {
Index: java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java (revision 5822)
+++ java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java (working copy)
@@ -26,9 +26,11 @@
 import com.l2jserver.gameserver.instancemanager.AntiFeedManager;
 import com.l2jserver.gameserver.model.L2Party;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
 import com.l2jserver.gameserver.network.L2GameClient;
 import com.l2jserver.gameserver.network.L2GameClient.GameClientState;
 import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.CharSelectionInfo;
 import com.l2jserver.gameserver.network.serverpackets.RestartResponse;
 import com.l2jserver.gameserver.scripting.scriptengine.listeners.player.PlayerDespawnListener;
@@ -65,6 +67,13 @@
  return;
  }
 
+ if (PkHunterEvent.isPk(player))
+ {
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ sendPacket(RestartResponse.valueOf(false));
+ return;
+ }
+
  if (player.isLocked())
  {
  _log.warning("Player " + player.getName() + " tried to restart during class change.");
Index: java/com/l2jserver/gameserver/model/entity/PkHunterEventConditions.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/PkHunterEventConditions.java (revision 0)
+++ java/com/l2jserver/gameserver/model/entity/PkHunterEventConditions.java (revision 0)
@@ -0,0 +1,199 @@
+/*
+ * 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 com.l2jserver.gameserver.model.entity;
+
+import java.util.concurrent.ScheduledFuture;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.Announcements;
+import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.datatables.ItemTable;
+import com.l2jserver.gameserver.model.L2Object;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+import com.l2jserver.util.Rnd;
+
+/**
+ *
+ * @author Wyatt
+ *
+ */
+
+public class PkHunterEventConditions
+{
+ private static ScheduledFuture<?> _timerTask;
+
+ public static void checkFinishByMobs(L2PcInstance killer)
+ {
+ if (PkHunterEvent.isPk(killer) && Config.ENABLE_PKHUNTEREVENT)
+ {
+ if(killer.getKarma() == 0)
+ {
+ Announcements.getInstance().announceToAll("PkHunter Event ended. "+killer.getName()+" has survived.", true);
+ PkHunterEvent.setPk(killer);
+ PkHunterEvent.setActive(false);
+ killer.setTeam(0);
+ endTask();
+ rewardPk(killer);
+ }
+ }
+ }
+
+ public static void checkDie(L2Object killer, final L2PcInstance killed)
+ {
+ if(PkHunterEvent.isPk(killed) && Config.ENABLE_PKHUNTEREVENT)
+ {
+ if(killer instanceof L2PcInstance)
+ {
+ L2PcInstance kr = ((L2PcInstance)killer);
+ SystemMessage systemMessage = null;
+
+ for (int[] reward : Config.PKHUNTEREVENT_REWARD)
+ {
+ PcInventory inv = kr.getInventory();
+
+ if (ItemTable.getInstance().createDummyItem(reward[0]).isStackable())
+ {
+ inv.addItem("PKHunter Event", reward[0], reward[1], kr, kr);
+
+ if (reward[1] > 1)
+ {
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S);
+ systemMessage.addItemName(reward[0]);
+ systemMessage.addItemNumber(reward[1]);
+ }
+ else
+ {
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
+ systemMessage.addItemName(reward[0]);
+ }
+ kr.sendPacket(systemMessage);
+ }
+ else
+ {
+ for (int i = 0; i < reward[1]; ++i)
+ {
+ inv.addItem("PkHunter Event", reward[0], 1, kr, kr);
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
+ systemMessage.addItemName(reward[0]);
+ kr.sendPacket(systemMessage);
+ }
+ }
+ }
+ }
+ Announcements.getInstance().announceToAll("Pk Hunting Event: Event ended. "+killer.getName()+" killed the Pk.", true);
+ killed.setTeam(0);
+ PkHunterEvent.setActive(false);
+ PkHunterEvent.setPk(null);
+ endTask();
+
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ killed.setKarma(0);
+ }
+ },100);
+ }
+ }
+
+ public static void checkPk(L2PcInstance killer, L2Character target)
+ {
+ if (Config.ENABLE_PKHUNTEREVENT && !PkHunterEvent.isActive())
+ {
+ switch(Rnd.get(1, Config.PKHUNTEREVENT_CHANCE))
+ {
+ case 1:
+ killer.setKarma(900000);
+ killer.setTeam(2);
+ PkHunterEvent.setActive(true);
+ PkHunterEvent.setPk(killer);
+ PkHunterEvent.setPkLocation(killer.getX(), killer.getY(), killer.getZ());
+ startEvent();
+ break;
+ }
+ }
+ }
+
+ public static void endCoward(L2PcInstance activeChar)
+ {
+ if(PkHunterEvent.isActive())
+ {
+ PkHunterEvent.setActive(false);
+ PkHunterEvent.setPk(null);
+ Announcements.getInstance().announceToAll("PkHunter Event ended.", true);
+ endTask();
+ }
+ activeChar.setKarma(10000);
+ activeChar.sendMessage("You karma updated to 10.000 due to be a coward, PkHunter Event ended.");
+ }
+
+ public static void startEvent()
+ {
+ Announcements.getInstance().announceToAll("PkHunter Event started: "+PkHunterEvent.getPk().getName()+" is the PK, write .gopk to teleport where the pk was done. Write .pkinfo to know if you are far or near to him.", true);
+ _timerTask = ThreadPoolManager.getInstance().scheduleGeneral(new PkHunterEventTask(), Config.TIME_PKHUNTEREVENT * 60000);
+ }
+
+ static void endTask()
+ {
+ if(_timerTask != null)
+ {
+ _timerTask.cancel(false);
+ }
+ _timerTask = null;
+ }
+
+ public static void rewardPk(L2PcInstance kr)
+ {
+ SystemMessage systemMessage = null;
+
+ for (int[] reward : Config.PKHUNTEREVENT_PK_REWARD)
+ {
+ PcInventory inv = kr.getInventory();
+
+ if (ItemTable.getInstance().createDummyItem(reward[0]).isStackable())
+ {
+ inv.addItem("PKHunter Event", reward[0], reward[1], kr, kr);
+
+ if (reward[1] > 1)
+ {
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S);
+ systemMessage.addItemName(reward[0]);
+ systemMessage.addItemNumber(reward[1]);
+ }
+ else
+ {
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
+ systemMessage.addItemName(reward[0]);
+ }
+ kr.sendPacket(systemMessage);
+ }
+ else
+ {
+ for (int i = 0; i < reward[1]; ++i)
+ {
+ inv.addItem("PkHunter Event", reward[0], 1, kr, kr);
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
+ systemMessage.addItemName(reward[0]);
+ kr.sendPacket(systemMessage);
+ }
+ }
+ }
+ }
+}
Index: java/com/l2jserver/gameserver/model/entity/PkHunterEventTask.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/PkHunterEventTask.java (revision 0)
+++ java/com/l2jserver/gameserver/model/entity/PkHunterEventTask.java (revision 0)
@@ -0,0 +1,42 @@
+/*
+ * 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 com.l2jserver.gameserver.model.entity;
+
+import com.l2jserver.gameserver.Announcements;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ *
+ * @author Wyatt
+ *
+ */
+
+public class PkHunterEventTask implements Runnable
+{
+ @Override
+ public void run()
+ {
+ if(PkHunterEvent.isPkOnline())
+ {
+ L2PcInstance kr = PkHunterEvent.getPk();
+ kr.setKarma(0);
+ kr.setTeam(0);
+ PkHunterEventConditions.rewardPk(kr);
+ }
+ Announcements.getInstance().announceToAll("PkHunter Event ended. "+PkHunterEvent.getPk().getName()+" has survived.", true);
+ PkHunterEvent.setActive(false);
+ PkHunterEvent.setPk(null);
+ }
+}
Index: dist/game/config/l2jmods.properties
===================================================================
--- dist/game/config/l2jmods.properties (revision 5822)
+++ dist/game/config/l2jmods.properties (working copy)
@@ -461,4 +461,29 @@
 # ---------------------------------------------------------------------------
 # Enables .changepassword voiced command which allows the players to change their account's password ingame.
 # Default: False
-AllowChangePassword = False
\ No newline at end of file
+AllowChangePassword = False
+
+# ---------------------------------------------------------------------------
+# PkHunter - Event       
+# ---------------------------------------------------------------------------
+# Enable/Disable PkHunter Event, Default: True
+EnablePKHunterEvent = True
+
+# Chance to start the event when someone gets PK. The probability will be 1/20 if its default.
+# Default: 20
+PKHunterEventChance = 20
+
+# Reward for the player that kills the PK.
+# Example: PKHunterEventRewards = itemId,amount;itemId,amount;itemId,amount
+PKHunterEventRewards = 14720,5;14721,2
+
+# Reward for the PK if he survives.
+# Example: PKHunterEventRewards = itemId,amount;itemId,amount;itemId,amount
+PKHunterEventPkRewards = 14720,25;14721,10
+
+# Enable/Disable if the PK of the event will have chances to drop or not, Default: False
+PKHunterEventDrop = False
+
+# Time that will take the event to end if noone kills the PK. In minutes.
+# Default: 5
+PKHunterEventTime = 5
\ No newline at end of file
Index: java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillMount.java
===================================================================
--- java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillMount.java (revision 5822)
+++ java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillMount.java (working copy)
@@ -18,6 +18,7 @@
 import com.l2jserver.gameserver.model.StatsSet;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
 import com.l2jserver.gameserver.model.entity.TvTEvent;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 import com.l2jserver.gameserver.network.SystemMessageId;
@@ -54,6 +55,12 @@
  return;
  }
 
+ if (PkHunterEvent.isPk(activePlayer))
+ {
+ activePlayer.sendMessage("You can't mount while in event.");
+ return;
+ }
+
  // Dismount Action
  if (_npcId == 0)
  {
Index: java/com/l2jserver/gameserver/model/actor/L2Attackable.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/L2Attackable.java (revision 5822)
+++ java/com/l2jserver/gameserver/model/actor/L2Attackable.java (working copy)
@@ -52,6 +52,7 @@
 import com.l2jserver.gameserver.model.actor.knownlist.AttackableKnownList;
 import com.l2jserver.gameserver.model.actor.status.AttackableStatus;
 import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
+import com.l2jserver.gameserver.model.entity.PkHunterEventConditions;
 import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
 import com.l2jserver.gameserver.model.items.L2Item;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
@@ -540,6 +541,8 @@
 
  if (player != null)
  {
+ PkHunterEventConditions.checkFinishByMobs(player);
+
  if (getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL) != null)
  {
  for (Quest quest : getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL))
Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 5822)
+++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -53,6 +53,7 @@
 import com.l2jserver.gameserver.model.entity.Fort;
 import com.l2jserver.gameserver.model.entity.FortSiege;
 import com.l2jserver.gameserver.model.entity.L2Event;
+import com.l2jserver.gameserver.model.entity.PkHunterEventConditions;
 import com.l2jserver.gameserver.model.entity.Siege;
 import com.l2jserver.gameserver.model.entity.TvTEvent;
 import com.l2jserver.gameserver.model.entity.clanhall.AuctionableHall;
@@ -218,6 +219,13 @@
  SkillTreesData.getInstance().addSkills(activeChar, true);
  }
  }
+ else
+ {
+ if (activeChar.getKarma() >= 500000 && !activeChar.isCursedWeaponEquipped() && Config.ENABLE_PKHUNTEREVENT)
+ {
+ PkHunterEventConditions.endCoward(activeChar);
+ }
+ }
 
  // Set dead status if applies
  if (activeChar.getCurrentHp() < 0.5)

CitarDATA:

### Eclipse Workspace Patch 1.0
#P L2J_DataPack
Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 9467)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy);
@@ -290,6 +291,7 @@
 import handlers.voicedcommandhandlers.Debug;
 import handlers.voicedcommandhandlers.Hellbound;
 import handlers.voicedcommandhandlers.Lang;
+import handlers.voicedcommandhandlers.PkHunterVoiced;
 import handlers.voicedcommandhandlers.StatsVCmd;
 import handlers.voicedcommandhandlers.TvTVoicedInfo;
 import handlers.voicedcommandhandlers.Wedding;
@@ -603,6 +606,7 @@
  (Config.L2JMOD_DEBUG_VOICE_COMMAND ? Debug.class : null),
  (Config.L2JMOD_ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null),
  (Config.L2JMOD_HELLBOUND_STATUS ? Hellbound.class : null),
+ (Config.ENABLE_PKHUNTEREVENT ? PkHunterVoiced.class : null),
  },
  {
  // Target Handlers
Index: dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java
===================================================================
--- dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java (revision 9467)
+++ dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java (working copy)
@@ -14,8 +14,10 @@
  */
 package handlers.itemhandlers;
 
+import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Playable;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.network.SystemMessageId;
 
@@ -33,6 +35,16 @@
  activeChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
  return false;
  }
+ else if((activeChar != null) && PkHunterEvent.isPk(activeChar))
+ {
+ activeChar.sendMessage("You cannot use this item while in this zone.");
+ return false;
+ }
+ else if(activeChar != null && activeChar.isInsideZone(L2Character.MASS_ZONE) && item.getItemId() != 728 && item.getItemId() != 5592 && item.getItemId() != 20353)
+ {
+ activeChar.sendMessage("You cannot use this item while in this zone.");
+ return false;
+ }
  return super.useItem(playable, item, forceUse);
  }
 }

Index: dist/game/data/scripts/handlers/skillhandlers/SummonFriend.java
===================================================================
--- dist/game/data/scripts/handlers/skillhandlers/SummonFriend.java (revision 9467)
+++ dist/game/data/scripts/handlers/skillhandlers/SummonFriend.java (working copy)
@@ -21,6 +21,7 @@
 import com.l2jserver.gameserver.model.L2Party;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 import com.l2jserver.gameserver.model.skills.L2SkillType;
 import com.l2jserver.gameserver.network.SystemMessageId;
@@ -98,6 +99,11 @@
 
  if (skill.getId() == 1403) //Summon Friend
  {
+ if (PkHunterEvent.isPk(activePlayer) || PkHunterEvent.isPk(targetPlayer))
+ {
+ activeChar.sendMessage("Players can't be summoned while in event.");
+ return;
+ }
  // Send message
  final ConfirmDlg confirm = new ConfirmDlg(SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId());
  confirm.addCharName(activeChar);
Index: dist/game/data/scripts/handlers/usercommandhandlers/Escape.java
===================================================================
--- dist/game/data/scripts/handlers/usercommandhandlers/Escape.java (revision 9467)
+++ dist/game/data/scripts/handlers/usercommandhandlers/Escape.java (working copy)
@@ -25,6 +25,7 @@
 import com.l2jserver.gameserver.instancemanager.GrandBossManager;
 import com.l2jserver.gameserver.instancemanager.MapRegionManager;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
 import com.l2jserver.gameserver.model.entity.TvTEvent;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
@@ -75,6 +76,12 @@
  return false;
  }
 
+ if (PkHunterEvent.isPk(activeChar))
+ {
+ activeChar.sendMessage("You can't escape while in event.");
+ return false;
+ }
+
  if (activeChar.isCastingNow() || activeChar.isMovementDisabled() || activeChar.isMuted()
  || activeChar.isAlikeDead() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isCombatFlagEquipped())
  return false;
Index: dist/game/data/scripts/handlers/itemhandlers/SummonItems.java
===================================================================
--- dist/game/data/scripts/handlers/itemhandlers/SummonItems.java (revision 9467)
+++ dist/game/data/scripts/handlers/itemhandlers/SummonItems.java (working copy)
@@ -37,6 +37,7 @@
 import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2XmassTreeInstance;
 import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
 import com.l2jserver.gameserver.model.entity.TvTEvent;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.network.SystemMessageId;
@@ -85,6 +86,11 @@
  activeChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
  return false;
  }
+ if (PkHunterEvent.isPk(activeChar))
+ {
+ activeChar.sendMessage("You can't use this item while in event.");
+ return false;
+ }
  if (activeChar.isAllSkillsDisabled() || activeChar.isCastingNow())
  return false;
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/PkHunterVoiced.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/PkHunterVoiced.java (revision 0)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/PkHunterVoiced.java (revision 0)
@@ -0,0 +1,80 @@
+/*
+ * 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 handlers.voicedcommandhandlers;
+
+
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.StatsSet;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
+import com.l2jserver.gameserver.model.skills.l2skills.L2SkillTeleport;
+
+/**
+ *
+ * @author  Wyatt
+ */
+
+public class PkHunterVoiced implements IVoicedCommandHandler
+{
+    private static final String[] VOICED_COMMANDS = { "gopk", "pkinfo"};
+   
+ @Override
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+ {
+ if (command.toLowerCase().equals("gopk"))
+ {
+ if (activeChar.isFestivalParticipant() || activeChar.isInJail() || activeChar.isInDuel()
+ || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || PkHunterEvent.isPk(activeChar)
+ )
+            {
+            activeChar.sendMessage("You can't use this command while participating in the Festival!");
+            return false;
+            }
+
+ if (PkHunterEvent.isActive())
+ {
+ StatsSet set = new StatsSet();
+ set.set("skill_id", "2525");
+ set.set("level", "1");
+ set.set("target", "TARGET_SELF");
+ set.set("name", "Scroll to move to PkHunter Event area");
+ set.set("isMagic", "2");
+ set.set("itemConsumeCount", "0");
+ set.set("hitTime", "10000");
+ set.set("operateType", "A1");
+ set.set("skillType", "TELEPORT");
+ set.set("teleCoords", PkHunterEvent.getPkLocation()[0]+","+PkHunterEvent.getPkLocation()[1]+","+PkHunterEvent.getPkLocation()[2]);
+ activeChar.useMagic(new L2SkillTeleport(set), false, true);
+ activeChar.sendMessage("Moving to PkHunter Event area...");
+ }
+ else
+ {
+ activeChar.sendMessage("PkHunter Event is not currently active.");
+ return false;
+ }
+ }
+ else if (command.toLowerCase().equals("pkinfo"))
+ {
+ PkHunterEvent.sendLocationMessage(activeChar);
+ }
+ return true;
+ }
+
+ @Override
+ public String[] getVoicedCommandList()
+ {
+ return VOICED_COMMANDS;
+ }
+}
\ No newline at end of file
Index: dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java
===================================================================
--- dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java (revision 9467)
+++ dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java (working copy)
@@ -14,6 +14,7 @@
  */
 package handlers.itemhandlers;
 
+import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Playable;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
@@ -33,6 +34,11 @@
  activeChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
  return false;
  }
+ else if(activeChar != null && activeChar.isInsideZone(L2Character.MASS_ZONE) && item.getItemId() != 728 && item.getItemId() != 5592 && item.getItemId() != 20353)
+ {
+ activeChar.sendMessage("You cannot use this item while in this zone.");
+ return false;
+ }
  return super.useItem(playable, item, forceUse);
  }
 }
Index: dist/game/data/scripts/handlers/bypasshandlers/OlympiadObservation.java
===================================================================
--- dist/game/data/scripts/handlers/bypasshandlers/OlympiadObservation.java (revision 9467)
+++ dist/game/data/scripts/handlers/bypasshandlers/OlympiadObservation.java (working copy)
@@ -20,6 +20,7 @@
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2OlympiadManagerInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
 import com.l2jserver.gameserver.model.entity.TvTEvent;
 import com.l2jserver.gameserver.model.olympiad.Olympiad;
 import com.l2jserver.gameserver.model.olympiad.OlympiadGameManager;
@@ -216,6 +217,11 @@
  activeChar.sendMessage("You can not observe games while registered for TvT");
  return false;
  }
+ if (PkHunterEvent.isPk(activeChar))
+ {
+ activeChar.sendMessage("You can't observe games while in event.");
+ return false;
+ }
  }
 
  final int arenaId = Integer.parseInt(command.substring(12).trim());