Jump to content
  • 0

Question

Posted (edited)
Good morning, I was able to find this search for some forums and I was wanting to adapt it to jfrozen, but I could not succeed in adapting it so far! I was wondering if anyone could help me tailor it to jfrozen as a mission or as a mod to add core to the core!

 


 /*

 * 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 custom.PartyDrop;

 

import java.util.HashMap;

import java.util.List;

 

import net.sf.l2j.gameserver.model.actor.L2Npc;

import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

import net.sf.l2j.gameserver.model.quest.Quest;

import net.sf.l2j.gameserver.network.serverpackets.PlaySound;

 

public class PartyDrop extends Quest

{

private static final String qn = "PartyDrop";

 

private static final int[] PARTYMOBS =

{

10505

};

 

boolean _canReward = false;

static HashMap<String, Integer> playerIps = new HashMap<>();

 

public PartyDrop()

{

super(-1, qn, "custom");

 

addKillId(PARTYMOBS);

}

 

@Override

public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)

{

if (player.isInParty())

{

List<L2PcInstance> party = player.getParty().getPartyMembers();

 

for (L2PcInstance 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))

   {

   member.addItem("Luck Box", 9509, 1, member, true);

member.addItem("Ace Coin", 9500, 5000, member, true);

member.addItem("Mochi Token", 9515, 100, member, true);

   member.broadcastPacket(new PlaySound("ItemSound.quest_finish"));

   }

   else

   {

   member.sendMessage("You are too far to be rewarded.");

   }

}

            }

playerIps.clear();   

}

else

{

player.addItem("Luck Box", 9509, 1, player, true);

player.addItem("Ace Coin", 9500, 5000, player, true);

player.addItem("Mochi Token", 9515, 100, player, true);

player.broadcastPacket(new PlaySound("ItemSound.quest_finish"));

}

 

return null;

}

 

public static void main(String[] args)

{

new PartyDrop();

}

}


Edited by nortim

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock