Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2UFS
- Index: dist/config/players.properties
- ===================================================================
- --- dist/config/players.properties (revision 171)
- +++ dist/config/players.properties (working copy)
- @@ -29,6 +29,11 @@
- # Consume shots (Soulshots, BlessedSpiritShots, Spiritshots, BeastSoulShot)
- ConsumeSpiritSoulShots = True
- +# Enable / disable pvp reward
- +# Note: pvp_reward.xml are located in "data/xml" folder
- +# Default: false
- +EnablePvpReward = true
- +
- #=============================================================
- # Misc
- #=============================================================
- Index: dist/data/html/admin/server_menu.htm
- ===================================================================
- --- dist/data/html/admin/server_menu.htm (revision 170)
- +++ dist/data/html/admin/server_menu.htm (working copy)
- @@ -18,7 +18,7 @@
- Reload
- <table width=240>
- <tr>
- - <td><combobox width=120 height=21 var="cb" list=acar;announcement;config;crest;cw;door;htm;item;multisell;npc;npcwalker;skill;teleport;zone;></td>
- + <td><combobox width=120 height=21 var="cb" list=acar;announcement;config;crest;cw;door;htm;item;multisell;npc;npcwalker;pvp;skill;teleport;zone;></td>
- <td><button value="Reload" action="bypass -h admin_reload $cb" width=75 height=21 back="L2UI_ch3.Btn1_normalOn" fore="L2UI_ch3.Btn1_normal"></td>
- </tr>
- </table><br>
- Index: java/net/sf/l2j/gameserver/GameServer.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/GameServer.java (revision 170)
- +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
- @@ -57,6 +57,7 @@
- import net.sf.l2j.gameserver.datatables.MultisellData;
- import net.sf.l2j.gameserver.datatables.NpcTable;
- import net.sf.l2j.gameserver.datatables.NpcWalkerRoutesTable;
- +import net.sf.l2j.gameserver.datatables.PvpRewardTable;
- import net.sf.l2j.gameserver.datatables.RecipeTable;
- import net.sf.l2j.gameserver.datatables.ServerMemo;
- import net.sf.l2j.gameserver.datatables.SkillTable;
- @@ -206,6 +207,9 @@
- PartyMatchRoomList.getInstance();
- RaidBossPointsManager.getInstance();
- + if (Config.ENABLE_PVP_REWARD)
- + PvpRewardTable.getInstance();
- +
- StringUtil.printSection("Community server");
- if (Config.ENABLE_COMMUNITY_BOARD) // Forums has to be loaded before clan data
- ForumsBBSManager.getInstance().initRoot();
- Index: java/net/sf/l2j/gameserver/datatables/PvpRewardTable.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/datatables/PvpRewardTable.java (nonexistent)
- +++ java/net/sf/l2j/gameserver/datatables/PvpRewardTable.java (working copy)
- @@ -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 net.sf.l2j.gameserver.datatables;
- +
- +import java.io.File;
- +import java.util.ArrayList;
- +import java.util.List;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.gameserver.templates.StatsSet;
- +import net.sf.l2j.gameserver.xmlfactory.XMLDocumentFactory;
- +
- +import org.w3c.dom.Document;
- +import org.w3c.dom.NamedNodeMap;
- +import org.w3c.dom.Node;
- +
- +/**
- + * @author rapfersan92
- + */
- +public class PvpRewardTable
- +{
- + protected static final Logger _log = Logger.getLogger(PvpRewardTable.class.getName());
- +
- + private static List<PvpReward> _pvpRewards;
- +
- + public static PvpRewardTable getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final PvpRewardTable _instance = new PvpRewardTable();
- + }
- +
- + protected PvpRewardTable()
- + {
- + _pvpRewards = new ArrayList<>();
- + loadPvpReward();
- + }
- +
- + public void reload()
- + {
- + _pvpRewards.clear();
- + loadPvpReward();
- + }
- +
- + private void loadPvpReward()
- + {
- + try
- + {
- + File f = new File("./data/xml/pvp_reward.xml");
- + Document doc = XMLDocumentFactory.getInstance().loadDocument(f);
- +
- + Node n = doc.getFirstChild();
- + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
- + {
- + if (d.getNodeName().equalsIgnoreCase("template"))
- + {
- + NamedNodeMap attrs = d.getAttributes();
- + int pvpAmount = Integer.valueOf(attrs.getNamedItem("pvpAmount").getNodeValue());
- + int itemId = Integer.valueOf(attrs.getNamedItem("itemId").getNodeValue());
- + int itemCount = Integer.valueOf(attrs.getNamedItem("itemCount").getNodeValue());
- + double chance = Double.valueOf(attrs.getNamedItem("chance").getNodeValue());
- +
- + StatsSet set = new StatsSet();
- + set.set("pvpAmount", pvpAmount);
- + set.set("itemId", itemId);
- + set.set("itemCount", itemCount);
- + set.set("chance", chance);
- +
- + _pvpRewards.add(new PvpReward(set));
- + }
- + }
- + }
- + catch (Exception e)
- + {
- + _log.warning("Exception: PvpRewardTable loadPvpReward: " + e);
- + }
- +
- + _log.info("PvpRewardTable: Loaded " + _pvpRewards.size() + " reward's template(s).");
- + }
- +
- + public List<PvpReward> getPvpRewardsTable()
- + {
- + return _pvpRewards;
- + }
- +
- + public class PvpReward
- + {
- + private int _pvpAmount;
- + private int _itemId;
- + private int _itemCount;
- + private double _chance;
- +
- + public PvpReward(StatsSet set)
- + {
- + _pvpAmount = set.getInteger("pvpAmount");
- + _itemId = set.getInteger("itemId");
- + _itemCount = set.getInteger("itemCount");
- + _chance = set.getDouble("chance");
- + }
- +
- + public int getPvpAmount()
- + {
- + return _pvpAmount;
- + }
- +
- + public int getItemId()
- + {
- + return _itemId;
- + }
- +
- + public int getItemCount()
- + {
- + return _itemCount;
- + }
- +
- + public double getChance()
- + {
- + return _chance;
- + }
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 170)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -413,7 +413,7 @@
- public static boolean AUTO_ACTIVATE_SHOTS;
- public static int AUTO_ACTIVATE_SHOTS_MIN;
- public static boolean CONSUME_SPIRIT_SOUL_SHOTS;
- -
- + public static boolean ENABLE_PVP_REWARD;
- public static boolean EFFECT_CANCELING;
- public static double HP_REGEN_MULTIPLIER;
- public static double MP_REGEN_MULTIPLIER;
- @@ -1168,6 +1168,8 @@
- AUTO_ACTIVATE_SHOTS = players.getProperty("AutoActivateShotsEnabled", false);
- AUTO_ACTIVATE_SHOTS_MIN = players.getProperty("AutoActivateShotsMin", 200);
- CONSUME_SPIRIT_SOUL_SHOTS = players.getProperty("ConsumeSpiritSoulShots", true);
- + ENABLE_PVP_REWARD = players.getProperty("EnablePvpReward", false);
- +
- EFFECT_CANCELING = players.getProperty("CancelLesserEffect", true);
- HP_REGEN_MULTIPLIER = players.getProperty("HpRegenMultiplier", 1.);
- Index: dist/data/xml/pvp_reward.xml
- ===================================================================
- --- dist/data/xml/pvp_reward.xml (nonexistent)
- +++ dist/data/xml/pvp_reward.xml (working copy)
- @@ -0,0 +1,4 @@
- +<?xml version='1.0' encoding='utf-8'?>
- +<list>
- + <template pvpAmount="5" itemId="5592" itemCount="10" chance="1.0"/>
- +</list>
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java (revision 170)
- +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java (working copy)
- @@ -28,6 +28,7 @@
- import net.sf.l2j.gameserver.datatables.MultisellData;
- import net.sf.l2j.gameserver.datatables.NpcTable;
- import net.sf.l2j.gameserver.datatables.NpcWalkerRoutesTable;
- +import net.sf.l2j.gameserver.datatables.PvpRewardTable;
- import net.sf.l2j.gameserver.datatables.SkillTable;
- import net.sf.l2j.gameserver.datatables.TeleportLocationTable;
- import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
- @@ -240,6 +241,11 @@
- NpcWalkerRoutesTable.getInstance().reload();
- activeChar.sendMessage("NPCwalkers' routes have been reloaded.");
- }
- + else if (type.startsWith("pvp"))
- + {
- + PvpRewardTable.getInstance().reload();
- + activeChar.sendMessage("Pvp's reward have been reloaded.");
- + }
- else if (type.startsWith("skill"))
- {
- SkillTable.getInstance().reload();
- @@ -259,7 +265,7 @@
- {
- activeChar.sendMessage("Usage : //reload <acar|announcement|config|crest|door>");
- activeChar.sendMessage("Usage : //reload <htm|item|multisell|npc|npcwalker>");
- - activeChar.sendMessage("Usage : //reload <skill|teleport|zone>");
- + activeChar.sendMessage("Usage : //reload <pvp|skill|teleport|zone>");
- }
- }
- while (st.hasMoreTokens());
- @@ -268,7 +274,7 @@
- {
- activeChar.sendMessage("Usage : //reload <acar|announcement|config|crest|door>");
- activeChar.sendMessage("Usage : //reload <htm|item|multisell|npc|npcwalker>");
- - activeChar.sendMessage("Usage : //reload <skill|teleport|zone>");
- + activeChar.sendMessage("Usage : //reload <pvp|skill|teleport|zone>");
- }
- }
- return true;
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 170)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -58,6 +58,8 @@
- import net.sf.l2j.gameserver.datatables.ItemTable;
- import net.sf.l2j.gameserver.datatables.MapRegionTable;
- import net.sf.l2j.gameserver.datatables.NpcTable;
- +import net.sf.l2j.gameserver.datatables.PvpRewardTable;
- +import net.sf.l2j.gameserver.datatables.PvpRewardTable.PvpReward;
- import net.sf.l2j.gameserver.datatables.RecipeTable;
- import net.sf.l2j.gameserver.datatables.SkillTable;
- import net.sf.l2j.gameserver.datatables.SkillTable.FrequentSkill;
- @@ -363,7 +365,7 @@
- private L2GameClient _client;
- private final Map<Integer, String> _chars = new HashMap<>();
- -
- +
- private String _accountName;
- private long _deleteTimer;
- @@ -410,7 +412,7 @@
- private boolean _antifeedSex;
- public boolean eventSitForced = false;
- public boolean atEvent = false;
- -
- +
- private boolean _isInDuel;
- private DuelState _duelState = DuelState.NO_DUEL;
- private int _duelId;
- @@ -662,7 +664,7 @@
- initCharStatusUpdateValues();
- }
- -
- +
- /**
- * Create a new L2PcInstance and add it in the characters table of the database.
- * <ul>
- @@ -765,7 +767,7 @@
- {
- return (PcStatus) super.getStatus();
- }
- -
- +
- public final PcAppearance getAppearance()
- {
- return _appearance;
- @@ -1124,17 +1126,17 @@
- {
- _shortCuts.deleteShortCut(slot, page, fromDb);
- }
- -
- +
- public void restoreShortCuts()
- {
- _shortCuts.restore();
- }
- -
- +
- public void removeAllShortcuts()
- {
- _shortCuts.tempRemoveAll();
- }
- -
- +
- /**
- * Add a L2Macro to the L2PcInstance _macroses.
- * @param macro The Macro object to add.
- @@ -2153,7 +2155,7 @@
- stopEffects(L2EffectType.RELAXING);
- broadcastPacket(new ChangeWaitType(this, ChangeWaitType.WT_STANDING));
- -
- +
- // Schedule a stand up task to wait for the animation to finish
- ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- {
- @@ -3698,7 +3700,7 @@
- return;
- }
- }
- -
- +
- boolean isParty = (((newTarget instanceof L2PcInstance) && isInParty() && getParty().getPartyMembers().contains(newTarget)));
- // Check if the new target is visible
- @@ -3932,19 +3934,19 @@
- {
- L2PcInstance pk = killer.getActingPlayer();
- - if(NexusEvents.isInEvent(this))
- + if (NexusEvents.isInEvent(this))
- {
- NexusEvents.onDie(this, killer);
- - if(pk != null && NexusEvents.isInEvent(pk))
- + if (pk != null && NexusEvents.isInEvent(pk))
- NexusEvents.onKill(pk, this);
- }
- -
- +
- // Clear resurrect xp calculation
- setExpBeforeDeath(0);
- // Remove uber kills
- _uberKills = 0;
- -
- +
- if (isCursedWeaponEquipped())
- CursedWeaponsManager.getInstance().drop(_cursedWeaponEquippedId, killer);
- else
- @@ -4104,7 +4106,7 @@
- {
- _uberKills++;
- String text = "";
- -
- +
- if (target == null)
- return;
- @@ -4112,13 +4114,13 @@
- if (targetPlayer == null || targetPlayer == this)
- return;
- - if(NexusEvents.isInEvent(this) && NexusEvents.canAttack(this, target) && NexusEvents.gainPvpPointsOnEvents())
- + if (NexusEvents.isInEvent(this) && NexusEvents.canAttack(this, target) && NexusEvents.gainPvpPointsOnEvents())
- {
- setPvpKills(getPvpKills() + 1);
- sendPacket(new UserInfo(this));
- return;
- }
- -
- +
- // Don't rank up the CW if it was a summon.
- if (isCursedWeaponEquipped() && target instanceof L2PcInstance)
- {
- @@ -4156,6 +4158,11 @@
- // Add PvP point to attacker.
- setPvpKills(getPvpKills() + 1);
- + if (Config.ENABLE_PVP_REWARD)
- + {
- + pvpReward();
- + }
- +
- // Send UserInfo packet to attacker with its Karma and PK Counter
- sendPacket(new UserInfo(this));
- }
- @@ -4173,7 +4180,7 @@
- // Send UserInfo packet to attacker with its Karma and PK Counter
- sendPacket(new UserInfo(this));
- }
- -
- +
- if (_uberKills >= 3)
- {
- String names[] =
- @@ -4772,12 +4779,12 @@
- if (isCursedWeaponEquipped())
- return false;
- - if(NexusEvents.isInEvent(this))
- + if (NexusEvents.isInEvent(this))
- {
- - if(!NexusEvents.canBeDisarmed(this))
- + if (!NexusEvents.canBeDisarmed(this))
- return false;
- }
- -
- +
- // Unequip the weapon
- ItemInstance wpn = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
- if (wpn != null)
- @@ -4839,7 +4846,7 @@
- setRunning();
- stopAllToggles();
- -
- +
- Ride mount = new Ride(getObjectId(), Ride.ACTION_MOUNT, pet.getTemplate().getNpcId());
- setMount(pet.getNpcId(), pet.getLevel(), mount.getMountType());
- @@ -4846,7 +4853,7 @@
- _petTemplate = (PetTemplate) pet.getTemplate();
- _petData = _petTemplate.getPetDataEntry(pet.getLevel());
- _mountObjectId = pet.getControlItemId();
- -
- +
- startFeed(pet.getNpcId());
- broadcastPacket(mount);
- @@ -4864,7 +4871,7 @@
- setRunning();
- stopAllToggles();
- -
- +
- Ride mount = new Ride(getObjectId(), Ride.ACTION_MOUNT, npcId);
- if (setMount(npcId, getLevel(), mount.getMountType()))
- {
- @@ -4871,7 +4878,7 @@
- _petTemplate = (PetTemplate) NpcTable.getInstance().getTemplate(npcId);
- _petData = _petTemplate.getPetDataEntry(getLevel());
- _mountObjectId = controlItemId;
- -
- +
- broadcastPacket(mount);
- // Notify self and others about speed change
- @@ -4978,7 +4985,7 @@
- _petTemplate = null;
- _petData = null;
- _mountObjectId = 0;
- -
- +
- storePetFood(petId);
- // Notify self and others about speed change
- @@ -6658,15 +6665,15 @@
- return false;
- }
- - if(NexusEvents.isInEvent(this))
- + if (NexusEvents.isInEvent(this))
- {
- - if(!NexusEvents.canUseSkill(this, skill))
- + if (!NexusEvents.canUseSkill(this, skill))
- {
- sendPacket(ActionFailed.STATIC_PACKET);
- return false;
- }
- }
- -
- +
- // Cancels the use of skills when player uses a cursed weapon or is flying.
- if ((isCursedWeaponEquipped() && !skill.isDemonicSkill()) // If CW, allow ONLY demonic skills.
- || (getMountType() == 1 && !skill.isStriderSkill()) // If mounted, allow ONLY Strider skills.
- @@ -8232,9 +8239,9 @@
- try
- {
- - if(NexusEvents.isRegistered(this))
- + if (NexusEvents.isRegistered(this))
- return false;
- -
- +
- if (_subClasses.size() == Config.MAX_SUBCLASS || classIndex == 0 || _subClasses.containsKey(classIndex))
- return false;
- @@ -9081,7 +9088,7 @@
- OlympiadManager.getInstance().removeDisconnectedCompetitor(this);
- NexusEvents.onLogout(this);
- -
- +
- // set the status for pledge member list to OFFLINE
- if (getClan() != null)
- {
- @@ -9761,7 +9768,7 @@
- html.setFile("data/html/jail_in.htm");
- sendPacket(html);
- - setInstanceId(0);
- + setInstanceId(0);
- setIsIn7sDungeon(false);
- teleToLocation(-114356, -249645, -2984, 0); // Jail
- break;
- @@ -10653,13 +10660,13 @@
- {
- return getBaseTemplate().getCollisionHeightBySex(getAppearance().getSex());
- }
- -
- +
- public PlayerEventInfo getEventInfo()
- {
- return _eventInfo;
- }
- - private PcTemplate createRandomAntifeedTemplate() //TODO Rework
- + private PcTemplate createRandomAntifeedTemplate() // TODO Rework
- {
- // @formatter:off
- /*Race race = null;
- @@ -10688,7 +10695,7 @@
- public void startAntifeedProtection(boolean start, boolean broadcast)
- {
- - if(!start)
- + if (!start)
- {
- getAppearance().setVisibleName(getName());
- _antifeedTemplate = null;
- @@ -10786,4 +10793,13 @@
- else
- cancelActiveTrade();
- }
- +
- + private void pvpReward()
- + {
- + for (PvpReward pvpReward : PvpRewardTable.getInstance().getPvpRewardsTable())
- + {
- + if (Rnd.nextDouble() < pvpReward.getChance() && getPvpKills() >= pvpReward.getPvpAmount())
- + addItem("Pvp Reward", pvpReward.getItemId(), pvpReward.getItemCount(), this, true);
- + }
- + }
- }
- \ No newline at end of file
Add Comment
Please, Sign In to add comment