Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # net.sf.l2j.Config.java
- /** Party Drop Config */
- public static String NPC_LIST;
- public static int[] NPC_LIST_SET;
- public static Map<Integer, Integer> PARTY_DROP_REWARDS = new HashMap<>();
- NPC_LIST = customs.getProperty("NpcListPartyDrop", "10506,10507");
- String[] NpcList = NPC_LIST.split(",");
- NPC_LIST_SET = new int[NpcList.length];
- for (int i = 0; i < NpcList.length; i++)
- NPC_LIST_SET[i] = Integer.parseInt(NpcList[i]);
- String PARTY_DROP_REWARD_VALUE = customs.getProperty("PartyDropReward", "57,100000000;");
- String[] party_drop_reward_splitted_1 = PARTY_DROP_REWARD_VALUE.split(";");
- for (String i : party_drop_reward_splitted_1)
- {
- String[] party_drop_reward_splitted_2 = i.split(",");
- PARTY_DROP_REWARDS.put(Integer.parseInt(party_drop_reward_splitted_2[1]), Integer.parseInt(party_drop_reward_splitted_2[0]));
- }
- # net.sf.l2j.gameserver.scripting.scripts.custom.PartyDrop.java
- /*
- * 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.scripting.scripts.custom;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Set;
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.model.actor.Npc;
- import net.sf.l2j.gameserver.model.actor.instance.Player;
- import net.sf.l2j.gameserver.scripting.Quest;
- import net.sf.l2j.gameserver.network.serverpackets.PlaySound;
- public class PartyDrop extends Quest
- {
- boolean _canReward = false;
- static HashMap<String, Integer> playerIps = new HashMap<>();
- public PartyDrop()
- {
- super(-1, "custom");
- addKillId(Config.NPC_LIST_SET);
- }
- @Override
- public String onKill(Npc npc, Player player, boolean isPet)
- {
- if (player.isInParty())
- {
- List<Player> party = player.getParty().getMembers();
- for (Player member : party)
- {
- String pIp = member.getClient().getConnection().getInetAddress().getHostAddress();
- if (!playerIps.containsKey(pIp))
- {
- playerIps.put(pIp, 1);
- _canReward = true;
- }
- else
- {
- int count = playerIps.get(pIp);
- if (count < 1)
- {
- playerIps.remove(pIp);
- playerIps.put(pIp, count + 1);
- _canReward = true;
- }
- else
- {
- member.sendMessage("Already 1 member of your ip have been rewarded, so this character won't be rewarded.");
- _canReward = false;
- }
- }
- if (_canReward)
- {
- if (member.isInsideRadius(npc, 1000, false, false))
- {
- Set<Integer> rewards = Config.PARTY_DROP_REWARDS.keySet();
- for (Integer i : rewards)
- {
- member.addItem("Party Drop Rewards.", Config.PARTY_DROP_REWARDS.get(i), i, member, true);
- member.broadcastPacket(new PlaySound("ItemSound.quest_finish"));
- }
- }
- else
- {
- member.sendMessage("You are too far to be rewarded.");
- }
- }
- }
- playerIps.clear();
- }
- else
- {
- Set<Integer> rewards = Config.PARTY_DROP_REWARDS.keySet();
- for (Integer i : rewards)
- {
- player.addItem("Party Drop Rewards.", Config.PARTY_DROP_REWARDS.get(i), i, player, true);
- player.broadcastPacket(new PlaySound("ItemSound.quest_finish"));
- }
- }
- return null;
- }
- public static void main(String[] args)
- {
- new PartyDrop();
- }
- }
- # customs.properties
- # Set mobs list ID's for drop items in Party Drop
- NpcListPartyDrop = 10506,10507
- # Set rewards for drop in monsters of Party Drop
- PartyDropReward = 57,50;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement