Autor Tema: Event Raid  (Leído 219 veces)

SGER@fjs

  • Newbie
  • *
  • Mensajes: 15
  • Karma: +0/-0
  • I'm not lazy. I just have no inspiration.
    • Ver Perfil
Event Raid
« en: Enero 22, 2018, 11:30:28 am »
Hola gente, les comparto este sencillo evento de Hi5 adaptado a l2jadmin c4
Código
/*
 * Copyright (C) 2013 AdminsProL2
 *
 * 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 events.raidspawn;

import java.util.List;

import java.util.ArrayList;

import net.sf.l2j.gameserver.datatables.AnnouncementsData;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2MonsterInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;

/**
 * @autor: fissban
 */
public class RaidSpawn extends Quest
{
private static final int _first_event = 1;// min
private static final int _time_event = 2;// min

private static List<L2Npc> _npc_spawn = new ArrayList<>();

private static final int[] _raids =
{
10286,
10286,
10286,
10286
};

private static final String[] _name_raids =
{
"Queen Shyeed",
"Tyrannosaurus",
"Anakim",
"Lilith"
};

private static final String[] _locations =
{
"in the colliseum",
"near the entrance of the Garden of Eva",
"close to the western entrance of the Cemetary",
"at Gludin's Harbor"
};

/**
* x, y, z.
*/
private static final int[][] _spawns =
{
{
150086,
46733,
-3407
},
{
84805,
233832,
-3669
},
{
161385,
21032,
-3671
},
{
89199,
149962,
-3581
}
};

/**
* ItemdId, Chance, Max Drop, Min Drop.
*/
private static final int[][] DROPLIST =
{
{// Giant's Codex
7575,
1,
1,
1
},
{// Revita Pop
7575,
1,
1,
1
}

};

public RaidSpawn()
{
super(10, "Raid Spawn");

addKillId(_raids);

startTimer("SpawnRaid", _first_event * 60000, null, null);
}

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

@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
cancelTimer("DespawnRaid", null, null);
startTimer("SpawnRaid", _time_event * 60000, null, null);

dropItem(npc, killer, DROPLIST);
_npc_spawn.clear();
AnnouncementsData.getInstance().announceToAll("Next Raid Spawn in " + _time_event);
return super.onKill(npc, killer, isSummon);
}

@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equals("SpawnRaid"))
{
final int random = getRandom(_raids.length - 1);

L2Npc mobs = addSpawn(_raids[random], _spawns[random][0], _spawns[random][1], _spawns[random][2], 0, false, 0);
_npc_spawn.add(mobs);

AnnouncementsData.getInstance().announceToAll("Raid " + _name_raids[random] + " Spawn " + _locations[random]);
AnnouncementsData.getInstance().announceToAll("Have " + _time_event + " minutes to kill");

startTimer("DespawnRaid", _time_event * 60000, null, null);
return null;
}
if (event.equals("DespawnRaid"))
{
if (!_npc_spawn.isEmpty())
{
for (L2Npc h : _npc_spawn)
{
h.deleteMe();
}
}
_npc_spawn.clear();
startTimer("SpawnRaid", 1000, null, null);// 1 min spawn raid
return null;
}
return null;
}

private static void dropItem(L2Npc mob, L2PcInstance player, int[][] droplist)
{
final int chance = getRandom(100);

for (int[] drop : droplist)
{
if (chance > drop[1])
{
((L2MonsterInstance) mob).dropItem(player, drop[0], getRandom(drop[2], drop[3]));
return;
}
}
}
}
La instalación es la siguiente:
Crean una carpeta con el nombre de "raidspawn" en la siguiente ruta: ..\game\data\scripts\events
Dentro de la carpeta crean un archivo con el formato .java con el nombre de RaidSpawn quedaría: RaidSpawn.java
Copian y pegan el contenido mencionado arriba.
Luego vamos a ..\game\data\scripts\events en el archivo MasterEvents.java agregamos lo siguiente:

Código
import events.raidspawn.RaidSpawn;
RaidSpawn.class

como se ve en el siguiente codigo:

Código
/*
 * Copyright (C) 2014-2020 L2jAdjmins
 *
 * This file is part of L2jAdmins.
 *
 * L2jAdmins 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.
 *
 * L2jAdmins 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 events;

import java.util.logging.Logger;

import events.bonusweekend.BonusWeekend;
import events.classmaster.ClassMaster;
import events.firecat.FireCat;
import events.heavymedals.HeavyMedals;
import events.l2day.L2Day;
import events.raidspawn.RaidSpawn;

/**
 * @author fissban
 */
public class MasterEvents
{
private static final Logger LOG = Logger.getLogger(MasterEvents.class.getName());

private static final Class<?>[] EVENTS =
{
BonusWeekend.class,
HeavyMedals.class,
ClassMaster.class,
FireCat.class,
L2Day.class,
RaidSpawn.class
};

public static void main(String[] args)
{
for (final Class<?> ai : EVENTS)
{
try
{
ai.newInstance();
}
catch (final Exception e)
{
LOG.severe(MasterEvents.class.getSimpleName() + ": Failed loading " + ai.getSimpleName() + ": " + e);
}
}
LOG.info(MasterEvents.class.getSimpleName() + ": Load " + EVENTS.length + " Events.");
}
}


Aca editan el drop:
Código
private static final int[][] DROPLIST =
{
{// Giant's Codex
7575,
1,
1,
1
},
{// Revita Pop
7575,
1,
1,
1
}

y acá los id de los boss que quieren respawn:
Código
private static final int[] _raids =
{
10286,
10286,
10286,
10286
};

Y aca editan el lugar donde quieren que aparezcan y el mensaje que dira al respawn
Código
private static final String[] _name_raids =
{
"Queen Shyeed",
"Tyrannosaurus",
"Anakim",
"Lilith"
};

private static final String[] _locations =
{
"in the colliseum",
"near the entrance of the Garden of Eva",
"close to the western entrance of the Cemetary",
"at Gludin's Harbor"
};

/**
* x, y, z.
*/
private static final int[][] _spawns =
{
{
150086,
46733,
-3407
},
{
84805,
233832,
-3669
},
{
161385,
21032,
-3671
},
{
89199,
149962,
-3581
}
};

Créditos: Fissban
« Última modificación: Enero 24, 2018, 09:02:44 pm por fissban »

fissban

  • Administrador
  • Full Member
  • *
  • Mensajes: 152
  • Karma: +0/-0
    • Ver Perfil
Re:Event Raid
« Respuesta #1 en: Enero 22, 2018, 01:26:43 pm »
Gracias por el aporte :D