Help Script.ext.jar Trade Wolf to Greate Wolf


Code:
package service;

import l2.gameserver.data.xml.holder.NpcHolder;
import l2.gameserver.data.xml.holder.PetDataHolder;
import l2.gameserver.model.PetData;
import l2.gameserver.model.Player;
import l2.gameserver.model.instances.NpcInstance;
import l2.gameserver.model.instances.PetInstance;
import l2.gameserver.model.items.ItemInstance;
import l2.gameserver.network.l2.s2c.SystemMessage;
import l2.gameserver.scripts.Functions;
import l2.gameserver.templates.npc.NpcTemplate;

public class exchangeWolf extends Functions
{
  private static final int WHITE_WOLF_NECKLACE = 10307;
  private static final int GREAT_WOLF_NECKLACE = 10611;

  private static final int GREAT_WOLF = 16025;
  private static final int WHITE_WOLF = 16037;

  public void greatsw(String[] direction)
  {
    Player player = getSelf();
    NpcInstance npc = getNpc();
    if(player == null || npc == null)
      return;
    boolean fwd = Integer.parseInt(direction[0]) == 1;

    if(player.getInventory().getCountOf(fwd ? GREAT_WOLF_NECKLACE : WHITE_WOLF_NECKLACE) > 1)
    {
      show("scripts/services/petevolve/error_3.htm", player, npc);
      return;
    }
    if(player.getPet() != null)
    {
      show("scripts/services/petevolve/error_4.htm", player, npc);
      return;
    }
    ItemInstance collar = player.getInventory().getItemByItemId(fwd ? GREAT_WOLF_NECKLACE : WHITE_WOLF_NECKLACE);
    if(collar == null)
    {
      show("scripts/services/petevolve/no_item.htm", player, npc);
      return;
    }
    PetData npcId = PetDataHolder.getInstance().getByControlItemId(collar);
    if(npcId == null)
      return;
    NpcTemplate petTemplate = NpcHolder.getInstance().getTemplate(npcId.getID());
    if(petTemplate == null)
      return;
    PetInstance pet = PetInstance.restore(collar, petTemplate, player);

    if(npcId != (fwd ? PetDataHolder.getInstance().getInfo(GREAT_WOLF) : PetDataHolder.getInstance().getInfo(WHITE_WOLF)))
    {
      show("scripts/services/petevolve/error_2.htm", player, npc);
      return;
    }
    if(pet != null && pet.getLevel() < 55)
    {
      show("scripts/services/petevolve/error_lvl_strider.htm", player, npc);
      return;
    }

    collar.setItemId(fwd ? WHITE_WOLF_NECKLACE : GREAT_WOLF_NECKLACE);
    player.sendItemList(false);
    player.sendPacket(SystemMessage.obtainItems((fwd ? WHITE_WOLF_NECKLACE : GREAT_WOLF_NECKLACE), 1, 0));
    show("scripts/services/petevolve/end_msg_strider.htm", player, npc);
  }
}
 
Last edited:
make your own scripts with path
for example "bypass -h services.petevolve.clanhall:greatsw"
 
sorry for the wrong post but if you can help me I will be very much obliged
"bypass -h services.exchangeWolf:greatsw"

Java:
package service;

import l2.gameserver.data.xml.holder.NpcHolder;
import l2.gameserver.data.xml.holder.PetDataHolder;
import l2.gameserver.model.PetData;
import l2.gameserver.model.Player;
import l2.gameserver.model.instances.NpcInstance;
import l2.gameserver.model.instances.PetInstance;
import l2.gameserver.model.items.ItemInstance;
import l2.gameserver.network.l2.s2c.SystemMessage;
import l2.gameserver.scripts.Functions;
import l2.gameserver.templates.npc.NpcTemplate;

public class exchangeWolf extends Functions
{
  private static final int WHITE_WOLF_NECKLACE = 10307;
  private static final int GREAT_WOLF_NECKLACE = 10611;

  private static final int GREAT_WOLF = 16025;
  private static final int WHITE_WOLF = 16037;

  public void greatsw(String[] direction)
  {
    Player player = getSelf();
    NpcInstance npc = getNpc();
    if(player == null || npc == null)
      return;
    boolean fwd = Integer.parseInt(direction[0]) == 1;

    if(player.getInventory().getCountOf(fwd ? GREAT_WOLF_NECKLACE : WHITE_WOLF_NECKLACE) > 1)
    {
      show("scripts/services/petevolve/error_3.htm", player, npc);
      return;
    }
    if(player.getPet() != null)
    {
      show("scripts/services/petevolve/error_4.htm", player, npc);
      return;
    }
    ItemInstance collar = player.getInventory().getItemByItemId(fwd ? GREAT_WOLF_NECKLACE : WHITE_WOLF_NECKLACE);
    if(collar == null)
    {
      show("scripts/services/petevolve/no_item.htm", player, npc);
      return;
    }
    PetData npcId = PetDataHolder.getInstance().getByControlItemId(collar);
    if(npcId == null)
      return;
    NpcTemplate petTemplate = NpcHolder.getInstance().getTemplate(npcId.getID());
    if(petTemplate == null)
      return;
    PetInstance pet = PetInstance.restore(collar, petTemplate, player);

    if(npcId != (fwd ? PetDataHolder.getInstance().getInfo(GREAT_WOLF) : PetDataHolder.getInstance().getInfo(WHITE_WOLF)))
    {
      show("scripts/services/petevolve/error_2.htm", player, npc);
      return;
    }
    if(pet != null && pet.getLevel() < 55)
    {
      show("scripts/services/petevolve/error_lvl_strider.htm", player, npc);
      return;
    }

    collar.setItemId(fwd ? WHITE_WOLF_NECKLACE : GREAT_WOLF_NECKLACE);
    player.sendItemList(false);
    player.sendPacket(SystemMessage.obtainItems((fwd ? WHITE_WOLF_NECKLACE : GREAT_WOLF_NECKLACE), 1, 0));
    show("scripts/services/petevolve/end_msg_strider.htm", player, npc);
  }
}
 
Back
Top