Jump to content
  • 0

Someone who can adapt that mod for L2Jfrozen?


Question

Posted (edited)

I found this mod in a forum, but I could not adapt to L2JFrozen. Someone who can do this?

 

Spoiler
  1. # net.sf.l2j.Config.java
  2.  
  3.  
  4.     /** Party Drop Config */
  5.     public static String NPC_LIST;
  6.     public static int[] NPC_LIST_SET;
  7.     public static Map<Integer, Integer> PARTY_DROP_REWARDS = new HashMap<>();
  8.  
  9.     NPC_LIST = customs.getProperty("NpcListPartyDrop", "10506,10507");
  10.    
  11.     String[] NpcList = NPC_LIST.split(",");
  12.     NPC_LIST_SET = new int[NpcList.length];
  13.     for (int i = 0; i < NpcList.length; i++)
  14.         NPC_LIST_SET[i] = Integer.parseInt(NpcList[i]);
  15.    
  16.     String PARTY_DROP_REWARD_VALUE = customs.getProperty("PartyDropReward", "57,100000000;");
  17.     String[] party_drop_reward_splitted_1 = PARTY_DROP_REWARD_VALUE.split(";");
  18.     for (String i : party_drop_reward_splitted_1)
  19.     {
  20.         String[] party_drop_reward_splitted_2 = i.split(",");
  21.         PARTY_DROP_REWARDS.put(Integer.parseInt(party_drop_reward_splitted_2[1]), Integer.parseInt(party_drop_reward_splitted_2[0]));
  22.     }
  23.  
  24.  
  25. # net.sf.l2j.gameserver.scripting.scripts.custom.PartyDrop.java
  26.  
  27.  
  28. /*
  29.  * This program is free software: you can redistribute it and/or modify it under
  30.  * the terms of the GNU General Public License as published by the Free Software
  31.  * Foundation, either version 3 of the License, or (at your option) any later
  32.  * version.
  33.  *
  34.  * This program is distributed in the hope that it will be useful, but WITHOUT
  35.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  36.  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  37.  * details.
  38.  *
  39.  * You should have received a copy of the GNU General Public License along with
  40.  * this program. If not, see <http://www.gnu.org/licenses/>.
  41.  */
  42. package net.sf.l2j.gameserver.scripting.scripts.custom;
  43.  
  44. import java.util.HashMap;
  45. import java.util.List;
  46. import java.util.Set;
  47.  
  48. import net.sf.l2j.Config;
  49. import net.sf.l2j.gameserver.model.actor.Npc;
  50. import net.sf.l2j.gameserver.model.actor.instance.Player;
  51. import net.sf.l2j.gameserver.scripting.Quest;
  52. import net.sf.l2j.gameserver.network.serverpackets.PlaySound;
  53.  
  54. public class PartyDrop extends Quest
  55. {
  56.     boolean _canReward = false;
  57.     static HashMap<String, Integer> playerIps = new HashMap<>();
  58.  
  59.     public PartyDrop()
  60.     {
  61.         super(-1, "custom");
  62.  
  63.         addKillId(Config.NPC_LIST_SET);
  64.     }
  65.  
  66.     @Override
  67.     public String onKill(Npc npc, Player player, boolean isPet)
  68.     {
  69.         if (player.isInParty())
  70.         {
  71.             List<Player> party = player.getParty().getMembers();
  72.  
  73.             for (Player member : party)
  74.             {
  75.                 String pIp = member.getClient().getConnection().getInetAddress().getHostAddress();
  76.                    
  77.                 if (!playerIps.containsKey(pIp))
  78.                 {
  79.                     playerIps.put(pIp, 1);
  80.                     _canReward = true;
  81.                 }
  82.                 else
  83.                 {
  84.                     int count = playerIps.get(pIp);
  85.                
  86.                     if (count < 1)
  87.                     {
  88.                         playerIps.remove(pIp);
  89.                         playerIps.put(pIp, count + 1);
  90.                         _canReward = true;
  91.                     }
  92.                     else
  93.                     {
  94.                         member.sendMessage("Already 1 member of your ip have been rewarded, so this character won't be rewarded.");
  95.                         _canReward = false;
  96.                     }
  97.                 }
  98.                 if (_canReward)
  99.                 {
  100.                     if (member.isInsideRadius(npc, 1000, false, false))
  101.                     {
  102.                         Set<Integer> rewards = Config.PARTY_DROP_REWARDS.keySet();
  103.                         for (Integer i : rewards)
  104.                         {
  105.                              member.addItem("Party Drop Rewards.", Config.PARTY_DROP_REWARDS.get(i), i, member, true);
  106.                              member.broadcastPacket(new PlaySound("ItemSound.quest_finish"));
  107.                         }
  108.                     }
  109.                     else
  110.                     {
  111.                         member.sendMessage("You are too far to be rewarded.");
  112.                     }
  113.                 }
  114.             }
  115.             playerIps.clear();  
  116.         }
  117.         else
  118.         {
  119.             Set<Integer> rewards = Config.PARTY_DROP_REWARDS.keySet();
  120.             for (Integer i : rewards)
  121.             {
  122.                  player.addItem("Party Drop Rewards.", Config.PARTY_DROP_REWARDS.get(i), i, player, true);
  123.                  player.broadcastPacket(new PlaySound("ItemSound.quest_finish"));
  124.             }
  125.         }
  126.  
  127.         return null;
  128.     }
  129.  
  130.     public static void main(String[] args)
  131.     {
  132.         new PartyDrop();
  133.     }
  134. }
  135.  
  136.  
  137. # customs.properties
  138.  
  139. # Set mobs list ID's for drop items in Party Drop
  140. NpcListPartyDrop = 10506,10507
  141.  
  142. # Set rewards for drop in monsters of Party Drop
  143. PartyDropReward = 57,50;

 

https://pastebin.com/uevvmJ90

Edited by Lowerz

Recommended Posts

  • 0
Posted
4 hours ago, AlmostGood said:

I guess you do it maybe?

  • 0
Posted (edited)
package quests.PartyDrop;
 
import java.util.List;
import java.util.ArrayList;

import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.quest.Quest;
import com.l2jfrozen.gameserver.network.serverpackets.PlaySound;
 
public class PartyDrop extends Quest
{
	

    boolean _canReward = false;
	private static ArrayList<String> playerIps = new ArrayList<String>();
 	private static final int[] MOB_LIST = {10506,10507};
	private static final int[][] DROP_LIST = {{57,50},{57,80}};
    public PartyDrop()
    {
		super(-1, "PartyDrop", "quests");
		for (int mob : MOB_LIST) addKillId(mob);
    }
 
    @Override
    public String onKill(L2NpcInstance 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.contains(pIp))
                {
					playerIps.add(pIp);
                    if (member.isInsideRadius(npc, 1000, false, false))
                    {
                        for (int[] i : DROP_LIST)
                        {
                             member.addItem("Party Drop Rewards.", i[0], i[1], member, true);
                             member.broadcastPacket(new PlaySound("ItemSound.quest_finish"));
                        }
                    }
                    else
                    {
                        member.sendMessage("You are too far to be rewarded.");
                    }
                }
                else
                {
                 member.sendMessage("Already 1 member of your ip have been rewarded, so this character won't be rewarded.");
 
                }
            }
            playerIps.clear();  
        }
        else
        {
            for (int[] i : DROP_LIST)
            {
                 player.addItem("Party Drop Rewards.", i[0], i[1], player, true);
                 player.broadcastPacket(new PlaySound("ItemSound.quest_finish"));
            }
        }
 
        return null;
    }
 
    public static void main(String[] args)
    {
        new PartyDrop();
    }
}

script for frozen. just put to data/scripts/quests/PartyDrop

and add script path to scripts.cfg

 

p.s its without any config file, so just edit in script file what mobs u want and what drop u want..

Edited by wongerlt
  • 0
Posted
54 minutes ago, wongerlt said:

package quests.PartyDrop;
 
import java.util.List;
import java.util.ArrayList;

import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.quest.Quest;
import com.l2jfrozen.gameserver.network.serverpackets.PlaySound;
 
public class PartyDrop extends Quest
{
	

    boolean _canReward = false;
	private static ArrayList<String> playerIps = new ArrayList<String>();
 	private static final int[] MOB_LIST = {10506,10507};
	private static final int[][] DROP_LIST = {{57,50},{57,80}};
    public PartyDrop()
    {
		super(-1, "PartyDrop", "quests");
		for (int mob : MOB_LIST) addKillId(mob);
    }
 
    @Override
    public String onKill(L2NpcInstance 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.contains(pIp))
                {
					playerIps.add(pIp);
                    if (member.isInsideRadius(npc, 1000, false, false))
                    {
                        for (int[] i : DROP_LIST)
                        {
                             member.addItem("Party Drop Rewards.", i[0], i[1], member, true);
                             member.broadcastPacket(new PlaySound("ItemSound.quest_finish"));
                        }
                    }
                    else
                    {
                        member.sendMessage("You are too far to be rewarded.");
                    }
                }
                else
                {
                 member.sendMessage("Already 1 member of your ip have been rewarded, so this character won't be rewarded.");
 
                }
            }
            playerIps.clear();  
        }
        else
        {
            for (int[] i : DROP_LIST)
            {
                 player.addItem("Party Drop Rewards.", i[0], i[1], player, true);
                 player.broadcastPacket(new PlaySound("ItemSound.quest_finish"));
            }
        }
 
        return null;
    }
 
    public static void main(String[] args)
    {
        new PartyDrop();
    }
}

script for frozen. just put to data/scripts/quests/PartyDrop

and add script path to scripts.cfg

 

p.s its without any config file, so just edit in script file what mobs u want and what drop u want..

 

Thanks, but it still did not work on my project.
Follow the mod link, if you can take a look please, thank you very much!

 

https://pastebin.com/uevvmJ90

  • 0
Posted (edited)
25 minutes ago, wongerlt said:

Whaaaaaat???

i just adapted it to for frozen.

so what wrong with me code?

 

Error:

Spoiler

 

Error on: C:\L2JFrozen\gameserver\data\scripts\quests\PartyDrop\__init__.py.error.LOGGER
Line: -1 - Column: -1

Traceback (innermost last):
  (no code object) at line 0
SyntaxError: ('invalid syntax', ('__init__.py', 13, 13, '    boolean _canReward = false;'))

 

 

 

Edited by Lowerz
  • Haha 3
  • 0
Posted

just create file in data/scripts/quests/PartyDrop/PartyDrop. java

and add “data/scripts/quests/PartyDrop/PartyDrop. java“ to data/scripts.cfg

thats all.. 

  • 0
Posted
5 hours ago, wongerlt said:

just create file in data/scripts/quests/PartyDrop/PartyDrop. java

and add “data/scripts/quests/PartyDrop/PartyDrop. java“ to data/scripts.cfg

thats all.. 

 

JFrozen doesn't use .java extension for this mod that goes in the scripts folder. If you use the old method, which is in .py, so it does not work.

  • 0
Posted
4 hours ago, Lowerz said:

 

JFrozen doesn't use .java extension for this mod that goes in the scripts folder. If you use the old method, which is in .py, so it does not work.

what version frozen u use?

im using 1118 and it support both. python and java.

or have you tried???

  • 0
Posted
1 hour ago, wongerlt said:

what version frozen u use?

im using 1118 and it support both. python and java.

or have you tried???

 

You could make a diff patch and post here. L2JFrozen have publuc SVN and make diff not a problem. But you skilled troll and shares script for newbie.

  • 0
Posted
1 hour ago, Rootware said:

 

You could make a diff patch and post here. L2JFrozen have publuc SVN and make diff not a problem. But you skilled troll and shares script for newbie.

so copy paste is hard for newbie? 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...