CitarINFORMACIÓN:
1). La administración del comienzo del evento a través del comando: // startrw.
2). Se envió un mensaje a todos los jugadores y se anuncia en el juego también.
3). Después de haber sido iniciado, cada jugador para derrotar a un oponente en el suyo raza pvp, gana un premio que se coloca.
4). Sólo gana el premio si la carrera que el jugador que mató es diferente a la suya! De lo contrario, no pasa nada.
5). Si matas a un jugador que se opone a su raza, anuncia:
[Razas en guerra]: So-Player (Humanos) fue derrotado por Ciclano (ELF)
Una vez que el administrador quiere terminar con el evento, sólo tienes que escribir el comando // stoprw
Después de esto:
1). Dará a conocer a todo el mundo que el evento se concluyó
2). Anuncia el total de muertes por la raza. Ejemplo: [razas en guerra]: Total Humana Kills -> 5
3.) Con este anuncio, la ADM puede elegir entre un "elemento adicional" para la carrera de matar más!
CitarCORE:
/*
* 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 net.sf.l2j.gameserver.custom.racesonwar;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
import net.sf.l2j.gameserver.util.Broadcast;
/**
* @author Bluur
*/
public class RacesOnWar
{
private static StateRacesOnWar stateRaceOnWar = StateRacesOnWar.INACTIVE;
private static int dElfoPoint = 0;
private static int elfoPoint = 0;
private static int humanPoint = 0;
private static int orcPoint = 0;
private static int dwarfPoint = 0;
public static void setStateRaceOnWar(StateRacesOnWar state)
{
stateRaceOnWar = state;
}
public static StateRacesOnWar getStateRaceOnWar()
{
return stateRaceOnWar;
}
public static void onDie(L2PcInstance player, L2PcInstance killer)
{
if (player != null)
{
if (player.getRace() != killer.getRace())
{
// ID QUANTIDADE
killer.addItem("", 57, 10000000, null, true);
addPointToRace(killer);
Broadcast.announceToOnlinePlayers("[Races On War]: Player "+player.getName() + "(" + player.getRace()+") foi derrotado por " + killer.getName() + "("+killer.getRace()+")");
}
}
}
public static void notifyAllPlayer(boolean notify)
{
if (notify)
{
for (L2PcInstance p : L2World.getInstance().getAllPlayers().values())
p.sendPacket(new ExShowScreenMessage("[Race On War]: Started !!! Go Go Go!!!" , 10000));
}
else
{
for (L2PcInstance p : L2World.getInstance().getAllPlayers().values())
p.sendPacket(new ExShowScreenMessage("[Race On War]: Stopped !!!" , 10000));
}
}
private static void addPointToRace(L2PcInstance player)
{
switch (player.getRace())
{
case DarkElf:
++dElfoPoint;
break;
case Elf:
++elfoPoint;
break;
case Human:
++humanPoint;
break;
case Orc:
++orcPoint;
break;
case Dwarf:
++dwarfPoint;
break;
}
}
public static void endRacesOnWar()
{
Broadcast.announceToOnlinePlayers("[Races On War]: Dark Elfos Total kills -> "+dElfoPoint);
Broadcast.announceToOnlinePlayers("[Races On War]: Elfos Total Kills -> " +elfoPoint);
Broadcast.announceToOnlinePlayers("[Races On War]: Humanos Total Kills -> "+humanPoint);
Broadcast.announceToOnlinePlayers("[Races On War]: Orcs Total Kills -> " +orcPoint);
Broadcast.announceToOnlinePlayers("[Races On War]: Dwarfs Total Kills -> " +dwarfPoint);
dElfoPoint = 0;
elfoPoint = 0;
humanPoint = 0;
orcPoint = 0;
dwarfPoint = 0;
setStateRaceOnWar(StateRacesOnWar.INACTIVE);
}
}
/*
*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 net.sf.l2j.gameserver.custom.racesonwar;
public enum StateRacesOnWar
{
INACTIVE,
ACTIVE
}
CitarDATA:
/*
* 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 late
* 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 net.sf.l2j.gameserver.handler.admincommandhandlers;
import net.sf.l2j.gameserver.custom.racesonwar.RacesOnWar;
import net.sf.l2j.gameserver.custom.racesonwar.StateRacesOnWar;
import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.util.Broadcast;
/**
* @author Bluur
*
*/
public class AdminRacesOnWar implements IAdminCommandHandler
{
private static final String[] commands =
{
"admin_startrw",
"admin_stoprw"
};
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_startrw"))
{
if (RacesOnWar.getStateRaceOnWar() == StateRacesOnWar.ACTIVE)
{
activeChar.sendMessage("[Races On War]: O Evento ja esta ativo!");
return false;
}
RacesOnWar.setStateRaceOnWar(StateRacesOnWar.ACTIVE);
RacesOnWar.notifyAllPlayer(true);
Broadcast.announceToOnlinePlayers("[Races On War]: Evento foi iniciado!");
System.out.println("[Races On War]: Event was started!");
}
if (command.equals("admin_stoprw"))
{
if (RacesOnWar.getStateRaceOnWar() == StateRacesOnWar.INACTIVE)
{
activeChar.sendMessage("[Races On War]: Evento ja foi finalizado!");
return false;
}
RacesOnWar.setStateRaceOnWar(StateRacesOnWar.INACTIVE);
RacesOnWar.notifyAllPlayer(false);
RacesOnWar.endRacesOnWar();
Broadcast.announceToOnlinePlayers("[Races On War]: Evento foi finalizado!");
System.out.println("[Race On War]: Event was stopped");
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return commands;
}
}
CitarIMPLEMENTACIONES:
Suistituir esto:
public static void onDie(L2PcInstance player, L2PcInstance killer)
{
if (player != null)
{
if (player.getRace() != killer.getRace())
{
// ID QUANTIDADE
killer.addItem("", 57, 10000000, null, true);
addPointToRace(killer);
Broadcast.announceToOnlinePlayers("[Races On War]: Player "+player.getName() + "(" + player.getRace()+") foi derrotado por " + killer.getName() + "("+killer.getRace()+")");
}
}
}
Por esto, para tener proteccion dual-box:
public static void onDie(L2PcInstance player, L2PcInstance killer)
{
if (player != null)
{
if (player.getClient().getConnection().getInetAddress().getHostAddress().equalsIgnoreCase(killer.getClient().getConnection().getInetAddress().getHostAddress()))
{
killer.sendMessage("[Races On War]: Player " + player.getName() + " detectado com o mesmo IP!");
player.sendMessage("[Races On War]: Player " + killer.getName() + " detectado com o mesmo IP!");
return;
}
else if (player.getRace() != killer.getRace())
{
// ID QUANTIDADE
killer.addItem("", 57, 10000000, null, true);
addPointToRace(killer);
Broadcast.announceToOnlinePlayers("[Races On War]: Player "+player.getName() + "(" + player.getRace()+") foi derrotado por " + killer.getName() + "("+killer.getRace()+")");
}
}
}
Y no olvidar esto:
Citarif (killer != null)
{
L2PcInstance pk = killer.getActingPlayer();
Coloque abaixo essa isso:
if (RacesOnWar.getStateRaceOnWar() == StateRacesOnWar.ACTIVE)
RacesOnWar.onDie(this, pk);
Va até AdminCommandHandler.java , procure por : AdminZone()
Coloque abaixo: registerAdminCommandHandler(new AdminRacesOnWar());
Edit o arquivo: admin_commands_rights.xml (data/xml)
<!-- Races On War-->
<aCar name="admin_startrw" accessLevel="1" />
<aCar name="admin_stoprw" accessLevel="1" />