U3Games
Lineage II | Desarrollo & Soporte => Desarrollo de Servidores => Implementaciones => Mensaje iniciado por: Swarlog en Ago 19, 2022, 01:12 AM
Debes de estar registrado para poder ver el contenido indicado.
Registrate o ConectateBuenas Tardes a todos, hoy les traigo otro codigo salido como pan caliente de horno jaja, es bastante simple y divertido, hoy les traigo un mini reproductor de musica [formato .ogg] para la cartera de la dama y bolsillo del caballero. En esta ocasion les presento como ya dije un reproductor de musica por comandos, dicho audio debe estar en la carpeta del cliente /lineage II/music en el formato ya comentado, basicamente al escribir los comandos especificados en el codigo, usted podra disfrutar de la musica, e incluso si tenes un poco de mania editando audio en formato .ogg, PODES PONER TU PROPIA MUSICA!!
NOTA: Al reproducir el audio, veras un mensaje en el log que dice ''now playing - Rodrigo - Soy Cordobes'' [suponiendo que editaras el mensaje con la cancion correspondiente].
P.D: SOY TODO UN VENDEDOR, LO SE
En esta ocasion el presente codigo esta formado para soportar 5 comandos distintos, correspondientes a 5 pistas de audio.
Se puede adaptar para solo reproducir una? - Perfectamente
Se puede adaptar para reproducir mas de 5 pistas? - Perfectamente
AUTOR? YO por supuesto, no por haberme basado en otro similar significa que este sea de otro fulano.
==========================================================================================
--- head-src/com/l2jfrozen/gameserver/handlers/voicedcommandhandlers/Play.java
+++ head-src/com/l2jfrozen/gameserver/handlers/voicedcommandhandlers/Play.java
@ -0,1 +0,1@
package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.PlaySound;
/**
* @author CAI
*/
public class Play implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{
"play1", "play2", "play3", "play4", "play5"
};
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if (command.equalsIgnoreCase("play1"))
{
PlaySound _snd = new PlaySound(1, "cancion1", 0, 0, 0, 0, 0);
activeChar.sendPacket(_snd);
activeChar.sendMessage("Now Playing - Interprete 1 - Audio 1");
activeChar.broadcastUserInfo();
}
else if (command.equalsIgnoreCase("play2"))
{
PlaySound _snd = new PlaySound(1, "cancion2", 0, 0, 0, 0, 0);
activeChar.sendPacket(_snd);
activeChar.sendMessage("Now Playing - Interprete 2 - Audio 2");
activeChar.broadcastUserInfo();
}
else if (command.equalsIgnoreCase("play3"))
{
PlaySound _snd = new PlaySound(1, "cancion3", 0, 0, 0, 0, 0);
activeChar.sendPacket(_snd);
activeChar.sendMessage("Now Playing - Interprete 3 - Audio 3");
activeChar.broadcastUserInfo();
}
else if (command.equalsIgnoreCase("play4"))
{
PlaySound _snd = new PlaySound(1, "cancion4", 0, 0, 0, 0, 0);
activeChar.sendPacket(_snd);
activeChar.sendMessage("Now Playing - Interprete 4 - Audio 4");
activeChar.broadcastUserInfo();
}
else if (command.equalsIgnoreCase("play5"))
{
PlaySound _snd = new PlaySound(1, "cancion5", 0, 0, 0, 0, 0);
activeChar.sendPacket(_snd);
activeChar.sendMessage("Now Playing - Interprete 5 - Audio 5");
activeChar.broadcastUserInfo();
}
return false;
}
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
==========================================================================================
--- head-src/com/l2jfrozen/gameserver/handlers/VoicedCommandHandlers
+++ head-src/com/l2jfrozen/gameserver/handlers/VoicedCommandHandlers
@ -37,1 +37,1@
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Online;
-import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.StatsCmd;
+import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Play;
+import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.StatsCmd;
@ -13751 +137,1@
if (Config.OFFLINE_TRADE_ENABLE && Config.OFFLINE_COMMAND2)
{
registerVoicedCommandHandler(new OfflineShop());
}
-
+ registerVoicedCommandHandler(new Play());
+
_log.config("VoicedCommandHandler: Loaded " + _datatable.size() + " handlers.");
Creditos: CAI