Jump to content
  • 0

[Problem] Buffers Bad Request


Question

Posted

Hello my friends.

In this buffer:

 

/*

* 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 2, 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, write to the Free Software

* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA

* 02111-1307, USA.

*

* http://www.gnu.org/copyleft/gpl.html

*/

package net.sf.l2j.gameserver.model.actor.instance;

 

import java.util.StringTokenizer;

 

import net.sf.l2j.gameserver.ai.CtrlIntention;

import net.sf.l2j.gameserver.datatables.SkillTable;

import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;

import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;

import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;

import net.sf.l2j.gameserver.network.serverpackets.SocialAction;

import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;

import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;

import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;

import net.sf.l2j.util.StringUtil;

import net.sf.l2j.util.Rnd;

 

/**

* @author DarthVader

* @version 1.3

*/

public final class L2BufferInstance extends L2NpcInstance

{

    public L2BufferInstance(int objectId, L2NpcTemplate template)

    {

        super(objectId, template);

    }

 

    @Override

    public void onBypassFeedback(L2PcInstance player, String command)

    {

      StringTokenizer st = new StringTokenizer(command, " ");

      String actualCommand = st.nextToken();

 

      int buffid = 0;

      int bufflevel = 1;

      if (st.countTokens() == 2)

      {

        buffid = Integer.valueOf(st.nextToken());

        bufflevel = Integer.valueOf(st.nextToken());

      }

      else if (st.countTokens() == 1)

        buffid = Integer.valueOf(st.nextToken());

 

      if (actualCommand.equalsIgnoreCase("getbuff"))

      {

        if (buffid != 0)

        {

            MagicSkillUse mgc = new MagicSkillUse(this, player, buffid, bufflevel, 5, 0);

            SkillTable.getInstance().getInfo(buffid, bufflevel).getEffects(this, player);

            showMessageWindow(player);

            player.broadcastPacket(mgc);

        }

      }

      else if (actualCommand.equalsIgnoreCase("restore"))

      {

        player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp());

        player.setCurrentCp(player.getMaxCp());

        showMessageWindow(player);

      }

      else if (actualCommand.equalsIgnoreCase("cancel"))

      {

        player.stopAllEffects();

        showMessageWindow(player);

      }

 

      else if (actualCommand.equalsIgnoreCase("mage"))

      {

        SkillTable.getInstance().getInfo(1204, 2).getEffects(this, player);

        SkillTable.getInstance().getInfo(1040, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1243, 6).getEffects(this, player);

        SkillTable.getInstance().getInfo(1036, 2).getEffects(this, player);

        SkillTable.getInstance().getInfo(1259, 4).getEffects(this, player);

        SkillTable.getInstance().getInfo(1035, 4).getEffects(this, player);

        SkillTable.getInstance().getInfo(1045, 6).getEffects(this, player);

        SkillTable.getInstance().getInfo(1304, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1048, 6).getEffects(this, player);

        SkillTable.getInstance().getInfo(1062, 2).getEffects(this, player);

        SkillTable.getInstance().getInfo(1189, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1393, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1033, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1191, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1085, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1059, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1182, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1303, 2).getEffects(this, player);

        SkillTable.getInstance().getInfo(1078, 6).getEffects(this, player);

        SkillTable.getInstance().getInfo(1352, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(1353, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(1397, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1392, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1044, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1087, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(273, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(365, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(276, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(311, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(309, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(307, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(264, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(270, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(266, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(267, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(304, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(268, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(364, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(349, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(265, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(363, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(305, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(308, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(306, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(1002, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1009, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1006, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1252, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1253, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1284, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1308, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1362, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(1461, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(1306, 6).getEffects(this, player);

        SkillTable.getInstance().getInfo(1307, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1389, 3).getEffects(this, player);

        showMessageWindow(player);

      }

      else if (actualCommand.equalsIgnoreCase("fighter"))

      {

        SkillTable.getInstance().getInfo(1204, 2).getEffects(this, player);

        SkillTable.getInstance().getInfo(1040, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1243, 6).getEffects(this, player);

        SkillTable.getInstance().getInfo(1068, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1036, 2).getEffects(this, player);

        SkillTable.getInstance().getInfo(1259, 4).getEffects(this, player);

        SkillTable.getInstance().getInfo(1035, 4).getEffects(this, player);

        SkillTable.getInstance().getInfo(1045, 6).getEffects(this, player);

        SkillTable.getInstance().getInfo(1304, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1048, 6).getEffects(this, player);

        SkillTable.getInstance().getInfo(1086, 2).getEffects(this, player);

        SkillTable.getInstance().getInfo(1189, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1393, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1033, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1191, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1240, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1242, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1182, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1077, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1078, 6).getEffects(this, player);

        SkillTable.getInstance().getInfo(1352, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(1353, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(1397, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1392, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1044, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1268, 4).getEffects(this, player);

        SkillTable.getInstance().getInfo(1087, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1043, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(310, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(274, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(275, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(272, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(277, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(271, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(311, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(309, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(307, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(269, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(264, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(270, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(266, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(267, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(304, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(268, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(364, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(349, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(265, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(363, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(305, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(308, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(306, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(1310, 4).getEffects(this, player);

        SkillTable.getInstance().getInfo(1007, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1009, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1006, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1251, 2).getEffects(this, player);

        SkillTable.getInstance().getInfo(1252, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1253, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1284, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1308, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1309, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1362, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(1461, 1).getEffects(this, player);

        SkillTable.getInstance().getInfo(1306, 6).getEffects(this, player);

        SkillTable.getInstance().getInfo(1307, 3).getEffects(this, player);

        SkillTable.getInstance().getInfo(1388, 3).getEffects(this, player);

        showMessageWindow(player);

      }

      else

        super.onBypassFeedback(player, command);

    }

 

    @Override

    public void onAction(L2PcInstance player)

    {

      if (this != player.getTarget())

      {

        player.setTarget(this);

        player.sendPacket(new MyTargetSelected(getObjectId(), player.getLevel() - getLevel()));

        player.sendPacket(new ValidateLocation(this));

      }

      else if (isInsideRadius(player, INTERACTION_DISTANCE, false, false))

      {

        SocialAction sa = new SocialAction(this, Rnd.get();

        broadcastPacket(sa);

        player.setCurrentFolkNPC(this);

        showMessageWindow(player);

        player.sendPacket(ActionFailed.STATIC_PACKET);

      }

      else {

        player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);

        player.sendPacket(ActionFailed.STATIC_PACKET);

      }

    }

 

    private void showMessageWindow(L2PcInstance player)

    {

      NpcHtmlMessage html = new NpcHtmlMessage(1);

      final StringBuilder strBuffer = StringUtil.startAppend(3500, "<html><title>Buffer</title><body><center>");

 

        if (player.isSitting())

        {

          player.sendMessage("You can't use buffer while sitting.");

          strBuffer.append("Stand up, <font color=\"LEVEL\">%charname%</font>!

");

          strBuffer.append("How dare you to talk with me while you're sitting?

");

      }

        else if (player.isAlikeDead()) {

          player.sendMessage("You can't use buffer while you're dead or using fake death.");

          strBuffer.append("Sadly, <font color=\"LEVEL\">%charname%</font>, you're dead.

");

          strBuffer.append("Grow up my friend. I cannot buff you.

");

        }

        else if (player.isInCombat()) {

          player.sendMessage("You can't use buffer while you're in combat.");

          strBuffer.append("Sadly, <font color=\"LEVEL\">%charname%</font>, I can't serve you.

");

          strBuffer.append("Came back when you will not be in combat mode.

");

        }

        else

        {

          strBuffer.append("<font color=\"00FF00\">Welcome,</font> <font color=\"LEVEL\">%charname%</font>

");

        strBuffer.append("<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32 align=left>");

        strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_mage\">Mage[/url]</td></tr>");

        strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_fighter\">Fighter[/url]</td></tr>");

        strBuffer.append("<tr><td><font color=\"ff9900\">Choose:</font></td></tr>");

        strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_cancel\"><font color=\"00ff30\">Cancel Buffs</font>[/url]</td><td><a action=\"bypass -h npc_%objectId%_restore\"><font color=\"00ff30\">Fully Restore</font>[/url]</td></tr>");

        strBuffer.append("<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32 align=left>

");

            strBuffer.append("<table width=300>");

        strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1363 1\">Chant of Victory[/url]</td> " + "<td><a action=\"bypass -h npc_%objectId%_getbuff 1062 2\">Berserker Spirit[/url]</td> " + "<td><a action=\"bypass -h npc_%objectId%_getbuff 1413 1\">Magnus' Chant[/url]</td></tr>");

        strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 4699 13\">Blessing of Queen[/url]</td> " + "<td><a action=\"bypass -h npc_%objectId%_getbuff 4700 13\">Gift of Queen[/url]</td> " + "<td><a action=\"bypass -h npc_%objectId%_getbuff 4703 3\">Gift of Seraphim[/url]</td></tr>");

            strBuffer.append("</table>");

        strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 4702 13\">Blessing of Seraphim[/url]</td></tr>");

        strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1390 3\">War Chant[/url]</td> " + "<td><a action=\"bypass -h npc_%objectId%_getbuff 1391 3\">Earth Chant[/url]</td></tr>");

        strBuffer.append("<tr><td><a action=\"bypass -h npc_%objectId%_getbuff 1323 1\">Nobless[/url]</td></tr>");

        }

      strBuffer.append("</center></body></html>");

      html.setHtml(strBuffer.toString());

      html.replace("%objectId%", String.valueOf(getObjectId()));

      html.replace("%charname%", player.getName());

      player.sendPacket(html);

    }

}

 

The Green colors have been edited.

No problems the buffs are ok.

But when i Press the button with the many buffs Mage / Fighter

I have this error:

 

Bad RequestBypassToServer:
null

 

I've try to fix it but with no luck.

Whats the problem?

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.


×
×
  • Create New...