Noticias:

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

Menú Principal

Mostrar HTML al matar X mobs

Iniciado por Swarlog, Ago 12, 2022, 02:14 AM

Tema anterior - Siguiente tema

Swarlog

Básicamente es un script que tiene como funcion la de aparecer un mensaje "htm" cuando matas a "X" mobs. El rate puede ser cambiado en el script, recomendado 5% o menos en servidores low.

/*
 * Copyright (C) 2004-2013 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 custom.htmlExample;

import ai.npc.AbstractNpcAI;

import com.l2jserver.gameserver.datatables.NpcTable;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;

/**
 * Show HTML after kill example for u3games.
 * @author St3eT
 */
public final class htmlExample extends AbstractNpcAI
{
// Misc
private static final int CHANCE = 23; // 23% for show HTML after kill monster

private htmlExample()
{
super(htmlExample.class.getSimpleName(), "ai/group_template");

for (L2NpcTemplate template : NpcTable.getInstance().getAllNpcOfClassType("L2Monster"))
{
addKillId(template.getId());
}
}

@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
if (getRandom(100) < CHANCE)
{
return "htmlName.html";
}
return super.onKill(npc, killer, isSummon);
}


public static void main(String[] args)
{
new htmlExample();
}
}

Si quieres que unicamente sea matando determinados mobs, modifica lo siguiente:

            for (L2NpcTemplate template : NpcTable.getInstance().getAllNpcOfClassType("L2Monster"))
            {
                addKillId(template.getId());
            }

Por esto otro:

addKillId(MOB_ID_HERE);