Jump to content
  • 0

Question

Posted

Paidia geia sas,

8a h8ela na mou pei kapoios pws 8a kanw auton ton kwdika gia l2jserver to new revision 4 martiou 2011...

 

/*
* 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.handler.itemhandlers;

import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.datatables.NpcTable;
import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.idfactory.IdFactory;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.L2Spawn;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.templates.L2NpcTemplate;

/**
* @author x.v3ndetta@yahoo.com
*
*/
public class VendettaItem implements IItemHandler
{
   public class DeSpawnScheduleTimerTask implements Runnable
   {
      L2Spawn spawnedPlant = null;

      public DeSpawnScheduleTimerTask(L2Spawn spawn)
      {
         spawnedPlant = spawn;
      }

      public void run()
      {
         try
         {
            spawnedPlant.getLastSpawn().decayMe();
         } catch (Throwable t)
         {
         }
      }
   }

   private static int[] _itemIds = { 6391 };
   private static int[] _npcIds = { 18342 };
   private static int[] _npcLifeTime = { 20000 };

   public void useItem(L2PlayableInstance playable, L2ItemInstance item)
   {
      L2PcInstance activeChar = (L2PcInstance) playable;
      L2NpcTemplate template1 = null;
      int lifeTime = 0;
      int itemId = item.getItemId();
      for (int i = 0; i < _itemIds.length; i++)
      {
         if (_itemIds == itemId)
         {
            template1 = NpcTable.getInstance().getTemplate(_npcIds);
            lifeTime = _npcLifeTime;
            break;
         }
      }
      if (template1 == null)
         return;
      try
      {
         L2Spawn spawn = new L2Spawn(template1);
         spawn.setId(IdFactory.getInstance().getNextId());
         spawn.setLocx(activeChar.getX());
         spawn.setLocy(activeChar.getY());
         spawn.setLocz(activeChar.getZ());
         L2World.getInstance().storeObject(spawn.spawnOne());
         ThreadPoolManager.getInstance().scheduleGeneral(new DeSpawnScheduleTimerTask(spawn), lifeTime);
         activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
      } catch (Exception e)
      {
         SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
         sm.addString("Exception in useItem() of VendettaItem.java");
         activeChar.sendPacket(sm);
      }
   }

   public int[] getItemIds()
   {
      return _itemIds;
   }
}

10 answers to this question

Recommended Posts

  • 0
Posted

kanto test ayto file mou kai pes mou ti error  sou exei bgalei

 

workspace\L2J_DataPack\data\scripts\handlers

/*
* 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 handlers.itemhandlers;

import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.datatables.NpcTable;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.L2ItemInstance;
import com.l2jserver.gameserver.model.L2Spawn;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PlayableInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.serverpackets.SystemMessage;
import com.l2jserver.gameserver.templates.L2NpcTemplate;

/**
* @author x.v3ndetta@yahoo.com
*
*/
public class VendettaItem implements IItemHandler
{
   public class DeSpawnScheduleTimerTask implements Runnable
   {
      L2Spawn spawnedPlant = null;

      public DeSpawnScheduleTimerTask(L2Spawn spawn)
      {
         spawnedPlant = spawn;
      }

      public void run()
      {
         try
         {
            spawnedPlant.getLastSpawn().decayMe();
         } catch (Throwable t)
         {
         }
      }
   }

   private static int[] _itemIds = { 6391 };
   private static int[] _npcIds = { 18342 };
   private static int[] _npcLifeTime = { 20000 };

   public void useItem(L2PlayableInstance playable, L2ItemInstance item)
   {
      L2PcInstance activeChar = (L2PcInstance) playable;
      L2NpcTemplate template1 = null;
      int lifeTime = 0;
      int itemId = item.getItemId();
      for (int i = 0; i < _itemIds.length; i++)
      {
         if (_itemIds == itemId)
         {
            template1 = NpcTable.getInstance().getTemplate(_npcIds);
            lifeTime = _npcLifeTime;
            break;
         }
      }
      if (template1 == null)
         return;
      try
      {
         L2Spawn spawn = new L2Spawn(template1);
         spawn.setId(IdFactory.getInstance().getNextId());
         spawn.setLocx(activeChar.getX());
         spawn.setLocy(activeChar.getY());
         spawn.setLocz(activeChar.getZ());
         L2World.getInstance().storeObject(spawn.spawnOne());
         ThreadPoolManager.getInstance().scheduleGeneral(new DeSpawnScheduleTimerTask(spawn), lifeTime);
         activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
      } catch (Exception e)
      {
         SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
         sm.addString("Exception in useItem() of VendettaItem.java");
         activeChar.sendPacket(sm);
      }
   }

   public int[] getItemIds()
   {
      return _itemIds;
   }
}

 

 

  • 0
Posted

Akrivws to idio ekana me kokkino sou evala ta errors!

 

import com.l2jserver.gameserver.model.actor.instance.L2PlayableInstance;

import com.l2jserver.gameserver.network.SystemMessageId;

import com.l2jserver.gameserver.serverpackets.SystemMessage;

import com.l2jserver.gameserver.templates.L2NpcTemplate;

 

-------

 

public class VendettaItem implements IItemHandler

{

  public class DeSpawnScheduleTimerTask implements Runnable

  {

      L2Spawn spawnedPlant = null;

 

      public DeSpawnScheduleTimerTask(L2Spawn spawn)

 

-------

 

public void useItem(L2PlayableInstance playable, L2ItemInstance item)

  {

      L2PcInstance activeChar = (L2PcInstance) playable;

      L2NpcTemplate template1 = null;

      int lifeTime = 0;

      int itemId = item.getItemId();

      for (int i = 0; i < _itemIds.length; i++)

      {

        if (_itemIds == itemId)

        {

            template1 = NpcTable.getInstance().getTemplate(_npcIds);

            lifeTime = _npcLifeTime;

            break;

        }

 

----------

 

  L2Spawn spawn = new L2Spawn(template1);

        spawn.setId(IdFactory.getInstance().getNextId());

        spawn.setLocx(activeChar.getX());

        spawn.setLocy(activeChar.getY());

        spawn.setLocz(activeChar.getZ());

        L2World.getInstance().storeObject(spawn.spawnOne());

        ThreadPoolManager.getInstance().scheduleGeneral(new DeSpawnScheduleTimerTask(spawn), lifeTime);

        activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);

      } catch (Exception e)

      {

        SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);

        sm.addString("Exception in useItem() of VendettaItem.java");

        activeChar.sendPacket(sm);

 

  • 0
Posted

L2PlayableInstance den iparxei ston l2j apoti thimame. Einai L2PcInstance. Episis to SystemMessage exei alaksei , einai SystemMessageId to onoma ( exo amfibolia edo ). Chekare ston core ta onomata ton klaseon kai alakse ta. Episis to _itemsId den to exeis orisei pouthena ston kodika, prepei na to oriseis gia na to xrisimopoieis.

  • 0
Posted

Oxi. Diabase ti sou egrapsa kai lise to. Den thelei poli mialo, ta name apo ta conflicted packages tha alakseis me basei ayta pou tha breis ston core sou. An sto liso ego me teamviewer tote den tha exei kamia aksia giati den tha matheis tipota.

  • 0
Posted

L2PlayableInstance den iparxei ston l2j apoti thimame. Einai L2PcInstance. Episis to SystemMessage exei alaksei , einai SystemMessageId to onoma ( exo amfibolia edo ). Chekare ston core ta onomata ton klaseon kai alakse ta. Episis to _itemsId den to exeis orisei pouthena ston kodika, prepei na to oriseis gia na to xrisimopoieis.

 

pws to orizw sto to _itemsId ? to L2Playable uparxei edw import com.l2jserver.gameserver.model.actor.L2Playable;

kai ta ipolipa imports ta brhka se allou.. ta evala kai mou bgazei ta parakatw la8oi....

twra ta mono errors pou bgazei einai ta parakatw :

 

public class VendettaItem implements IItemHandler

{

  public class DeSpawnScheduleTimerTask implements Runnable

  {

      L2Spawn spawnedPlant = null;

 

      public DeSpawnScheduleTimerTask(L2Spawn spawn)

 

----------------

 

int itemId = item.getItemId();

      for (int i = 0; i < _itemIds.length; i++)

      {

        if (_itemIds == itemId)

        {

            template1 = NpcTable.getInstance().getTemplate(_npcIds);

            lifeTime = _npcLifeTime;

            break;

        }

      }

      if (template1 == null)

        return;

      try

      {

        L2Spawn spawn = new L2Spawn(template1);

        spawn.setId(IdFactory.getInstance().getNextId());

        spawn.setLocx(activeChar.getX());

        spawn.setLocy(activeChar.getY());

        spawn.setLocz(activeChar.getZ());

        L2World.getInstance().storeObject(spawn.spawnOne());

        ThreadPoolManager.getInstance().scheduleGeneral(new DeSpawnScheduleTimerTask(spawn), lifeTime);

        activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);

      } catch (Exception e)

      {

        SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);

        sm.addString("Exception in useItem() of VendettaItem.java");

        activeChar.sendPacket(sm);

 

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


  • Posts

    • Inventory restock: Premium business accounts are now available.   ✔ Wallester Business EU 🇪🇺|💳 Unlimited virtual cards, physical cards, 🏦 multi-currency IBAN, ₿ crypto & stablecoin deposits. ✔ Stripe Business UK 🇬🇧|💳 Instant virtual cards (Visa/Mastercard), high-conversion checkout, multi-currency payouts, ₿ crypto payments, no-code payment links. ✔ Mercury Business US 🇺🇸|🏦 US checking & savings, 💳 unlimited virtual cards, domestic & International wires, native stablecoin settlement. ✔ Payset Business EU 🇪🇺|🏦 Multiple IBANs, UK sort code, SEPA Instant, 💳 unlimited virtual cards, multi-currency accounts. ✔ Novo Business US 🇺🇸|🏦 Business checking account, ACH payments & invoicing, 💳 virtual & physical cards, novo boost.
    • Let me see if I understand correctly, older gentlemen, when a newcomer shows up to create modern things with the help of AI, doing what you charge them to do, you point the finger and laugh. I believe that's why everything is stagnant. The product isn't for programming experts, it's for newcomers. Don't buy from you if they can do it themselves using this base. You're going to deliver a similar product, maybe even worse than this one, so why are you complaining? PowerShell, as you well know, started with it, then came new platforms and new apps, new creation models, all with different languages; I chose the simplest one for my taste. This is about being organized and knowing how to choose the right words for each situation. It's not 100%, but it already gives a good impression. Nothing is 100%, so a topic written by AI, and all the code that you charge an absurd amount for to prohibit and sell hacks, could be open source so that everyone can create new practices, new models, new information for passing packets, prohibiting the use of cheats that cause server owners to break so much. Let's remember that the Admin doesn't always shut down the server; it's the players who find problems and take advantage by buying and reselling items, and they say that the GM shuts down the server every week, but that's a lie. What they do is duplicate items with packages and sell them, but perhaps this could give some future developers a starting point to create their own protection following the model in the initial documentation. Because none of you answer a question from a newbie, you think you're superior because you have knowledge, but with AI, people like that can have the same knowledge as you, but with less practice. And if they practice a lot, 10,000 hours, they can be as good as all of you older developers in the L2J field.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..