/*
* 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.handler.voicedcommandhandlers;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.cache.HtmCache;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.instancemanager.SiegeManager;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.entity.Siege;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
public class Buff implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS = { "buff" };
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if (command.startsWith("buff"))
{
String filename = "data/html/optional/buff.htm";
String content = HtmCache.getInstance().getHtm(filename);
if (content == null)
{
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setHtml("<html><body>My Text is missing:<br>"+filename+"</body></html>");
activeChar.sendPacket(html);
}
else
{
NpcHtmlMessage html = new NpcHtmlMessage(5);
html.setHtml(content);
activeChar.sendPacket(html);
}
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
return true;
}
private boolean buff(L2PcInstance activeChar, String text)
{
// Check player if player is dead
if (activeChar.isDead())
{
activeChar.sendMessage("You can't use buff While you are dead!");
return false;
}
// Check player if is sitting
if (activeChar.isSitting())
{
activeChar.sendMessage("You can't use buff While You are Sitting");
return false;
}
//check is in DimensionsRift
if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
{
activeChar.sendMessage("You can't use buff! You are in the dimensional rift.");
return false;
}
// Check player is in observer mode
if (activeChar.inObserverMode())
{
activeChar.sendMessage("You can't use buff in Observer mode!");
return false;
}
return true;
}
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}