Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### 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,71 @@
- +/*
- + * 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.actor.L2Character;
- +
- +/**
- + *
- + * @author Wyatt
- + *
- + */
- +
- +public class PkHunterEvent
- +{
- + private static boolean isActive = false;
- + private static String PkName = "";
- + private static int[] PkLocation = {0,0,0};
- +
- + public static boolean isActive()
- + {
- + return isActive;
- + }
- +
- + public static String getPkName()
- + {
- + return PkName;
- + }
- +
- + public static void setPkName(String name)
- + {
- + PkName = name;
- + }
- +
- + 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.getName().equals(getPkName()))
- + {
- + return true;
- + }
- + return false;
- + }
- +}
- 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,7 @@
- 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.PkHunterEventConditions;
- import com.l2jserver.gameserver.model.entity.Siege;
- import com.l2jserver.gameserver.model.entity.TvTEvent;
- import com.l2jserver.gameserver.model.fishing.L2Fish;
- @@ -5507,6 +5532,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 +5997,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/network/clientpackets/RequestRestartPoint.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/clientpackets/RequestRestartPoint.java (revision 5822)
- +++ java/com/l2jserver/gameserver/network/clientpackets/RequestRestartPoint.java (working copy)
- @@ -28,6 +28,7 @@
- import com.l2jserver.gameserver.model.entity.Castle;
- import com.l2jserver.gameserver.model.entity.ClanHall;
- import com.l2jserver.gameserver.model.entity.Fort;
- +import com.l2jserver.gameserver.model.entity.PkHunterEvent;
- import com.l2jserver.gameserver.model.entity.TvTEvent;
- import com.l2jserver.gameserver.model.entity.clanhall.SiegableHall;
- @@ -76,6 +77,10 @@
- if (TvTEvent.isStarted() && TvTEvent.isPlayerParticipant(activeChar.getObjectId()))
- return;
- + if (PkHunterEvent.isPk(activeChar))
- + {
- + return;
- + }
- //SystemMessage sm2 = SystemMessage.getSystemMessage(SystemMessage.S1_S2);
- //sm2.addString("type:"+requestedPointType);
- //activeChar.sendPacket(sm2);
- 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,6 +765,9 @@
- 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 List<int[]> PKHUNTEREVENT_REWARD;
- // --------------------------------------------------
- // NPC Settings
- @@ -2728,6 +2731,34 @@
- }
- }
- 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"));
- +
- + 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, "\""));
- + }
- + }
- + }
- }
- 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,136 @@
- +/*
- + * 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.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
- +{
- + 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.setPkName("");
- + PkHunterEvent.setActive(false);
- + killer.setTeam(0);
- + }
- + }
- + }
- +
- + 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.setPkName("");
- +
- + 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:
- + Announcements.getInstance().announceToAll("PkHunter Event started: "+killer.getName()+" is the PK, write .gopk to teleport where the pk was done.", true);
- + killer.setKarma(900000);
- + killer.setTeam(2);
- + PkHunterEvent.setActive(true);
- + PkHunterEvent.setPkName(killer.getName());
- + PkHunterEvent.setPkLocation(killer.getX(), killer.getY(), killer.getZ());
- + break;
- + }
- + }
- + }
- +
- + public static void endCoward(L2PcInstance activeChar)
- + {
- + PkHunterEvent.setActive(false);
- + PkHunterEvent.setPkName("");
- + Announcements.getInstance().announceToAll("PkHunter Event ended.", true);
- + activeChar.setKarma(10000);
- + activeChar.sendMessage("You karma updated to 10.000 due to be a coward, PkHunter Event ended.");
- + }
- +
- +}
- Index: dist/game/config/l2jmods.properties
- ===================================================================
- --- dist/game/config/l2jmods.properties (revision 5822)
- +++ dist/game/config/l2jmods.properties (working copy)
- @@ -461,4 +461,18 @@
- # ---------------------------------------------------------------------------
- # 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 winner.
- +# Example: PKHunterEventRewards = itemId,amount;itemId,amount;itemId,amount
- +PKHunterEventRewards = 14720,5;14721,2
- +
- +# Enable/Disable if the PK of the event will have chances to drop or not, Default: False
- +PKHunterEventDrop = False
- \ 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,8 @@
- 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.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.entity.clanhall.AuctionableHall;
- @@ -218,6 +220,13 @@
- SkillTreesData.getInstance().addSkills(activeChar, true);
- }
- }
- + else
- + {
- + if (activeChar.getKarma() >= 500000 && !activeChar.isCursedWeaponEquipped() && PkHunterEvent.isActive() && Config.ENABLE_PKHUNTEREVENT)
- + {
- + PkHunterEventConditions.endCoward(activeChar);
- + }
- + }
- // Set dead status if applies
- if (activeChar.getCurrentHp() < 0.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement