Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Auto Adena Bar

Iniciado por Swarlog, Sep 01, 2022, 12:59 AM

Tema anterior - Siguiente tema

Swarlog

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!

/*
 * 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":

// Custom Handlers
         AutoAdenaBar.class,

PD: Commit requerido --> Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate