Autor Tema: [IMP] Auto Adena Bar  (Leído 2399 veces)

Noviembre 06, 2015, 03:29:03 pm

Conectado swarlog

  • Desarrollador
  • Usuario
  • *
  • Mensajes: 1.641
  • Karma: 5
  • Sexo: Masculino
    • U3Games
Con este custom handlers si tenemos en el inventario más de X adenas, se transformarán de forma automática en GoldBars. Por defecto esta puesto en "1100000000" adenas, lo cambiais por el deseado y listo!

Código: You are not allowed to view links. Register or Login
/*
 * Copyright (C) 2004-2015 L2J DataPack
 *
 * This file is part of L2J DataPack.
 *
 * L2J DataPack 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.
 *
 * L2J DataPack 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.custom;

import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.events.Containers;
import com.l2jserver.gameserver.model.events.EventType;
import com.l2jserver.gameserver.model.events.impl.character.player.inventory.OnPlayerItemAdd;
import com.l2jserver.gameserver.model.events.listeners.ConsumerEventListener;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;

/**
 * @author Zealar
 */
public class AutoAdenaBar
{

public AutoAdenaBar()
{
Containers.Players().addListener(new ConsumerEventListener(Containers.Players(), EventType.ON_PLAYER_ITEM_ADD, (OnPlayerItemAdd event) -> OnPlayerItemAdd(event), this));
}

/**
* @param event
* @return
*/
private Object OnPlayerItemAdd(OnPlayerItemAdd event)
{
L2PcInstance player = event.getActiveChar();
L2ItemInstance item = event.getItem();
if (item.getId() != 57)
{
return null;
}
if (player.getAdena() > 1100000000)
{
player.getInventory().reduceAdena("goldbar", 1000000000, player, null);
player.getInventory().addItem("goldbar", 3470, 1, player, null);
}
return null;
}
}

Y no olvidar añadirlo en "MasterHandler.java":

Código: You are not allowed to view links. Register or Login
// Custom Handlers
         AutoAdenaBar.class,

PD: Commit requerido --> You are not allowed to view links. Register or Login

Mayo 12, 2017, 02:52:44 pm
Respuesta #1

Desconectado Cody

  • Usuario
  • *
  • Mensajes: 22
  • Karma: 0
  • Sexo: Masculino
  • Loading...
    • Cody
I get this error

You are not allowed to view links. Register or Login

Mayo 12, 2017, 04:11:22 pm
Respuesta #2

Conectado swarlog

  • Desarrollador
  • Usuario
  • *
  • Mensajes: 1.641
  • Karma: 5
  • Sexo: Masculino
    • U3Games
You are not allowed to view links. Register or Login
I get this error

You are not allowed to view links. Register or Login

Add missing import of AutoAdenaBar to load ^^

Mayo 12, 2017, 05:08:43 pm
Respuesta #3

Desconectado Cody

  • Usuario
  • *
  • Mensajes: 22
  • Karma: 0
  • Sexo: Masculino
  • Loading...
    • Cody
What do you mean? I already added on scriipts.cfg

Abril 10, 2021, 07:11:40 am
Respuesta #4

Desconectado Alexiszero

  • Usuario
  • *
  • Mensajes: 5
  • Karma: 0
Dont work for me
cna you make it for freya??please!

Abril 18, 2021, 04:52:24 pm
Respuesta #5

Conectado swarlog

  • Desarrollador
  • Usuario
  • *
  • Mensajes: 1.641
  • Karma: 5
  • Sexo: Masculino
    • U3Games
You are not allowed to view links. Register or Login
Dont work for me
cna you make it for freya??please!

print error pls ;)

Abril 19, 2021, 10:45:56 am
Respuesta #6

Desconectado Alexiszero

  • Usuario
  • *
  • Mensajes: 5
  • Karma: 0
is not error man just dont work
when i take 1000000kk dont change to gold bar .
code is fine.
maybe i make wrong imports you can show where you put this import or i dont know