L2J_CE

Вы хотите отреагировать на этот пост ? Создайте аккаунт всего в несколько кликов или войдите на форум.
L2J_CE

L2J_CE Server


    Инстант Магазин

    Owned
    Owned


    Сообщения : 148
    Дата регистрации : 2010-03-22

    Инстант Магазин Empty Инстант Магазин

    Сообщение  Owned Ср Мар 24, 2010 5:14 am

    Создаем файл com.l2jserver.gameserver.model.actor.instance.L2PVPInstance.java

    Код:
    package com.l2jserver.gameserver.model.actor.instance;

    import java.util.StringTokenizer;

    import com.l2jserver.gameserver.TradeController;
    import com.l2jserver.gameserver.model.L2Multisell;
    import com.l2jserver.gameserver.model.L2TradeList;
    import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
    import com.l2jserver.gameserver.network.serverpackets.ExBuySellListPacket;
    import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
    import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
    import com.l2jserver.gameserver.util.StringUtil;

    /**
     *
     * @author Mentor
     * @version 1.1
     * @web www.teamsrv.net
     *
     */

    public class L2PVPInstance extends L2NpcInstance
    {
       public L2PVPInstance(int objectId, L2NpcTemplate template)
       {
          super(objectId, template);
       }

       @Override
       public String getHtmlPath(int npcId, int val)
       {
          String pom = "";

          if (val == 0) pom = "" + npcId;
          else pom = npcId + "-" + val;

          return "data/html/PVPMerchant/" + pom + ".htm";
       }

       protected final void showBuyWindow(L2PcInstance player, int val)
       {
          player.tempInventoryDisable();

          L2TradeList list = TradeController.getInstance().getBuyList(val);

          if (list != null && list.getNpcId().equals(String.valueOf(getNpcId())))
             player.sendPacket(new ExBuySellListPacket(player, list, 0, false));
          else
          {
             _log.warning("buylist id:" + val);
          }

          player.sendPacket(ActionFailed.STATIC_PACKET);
       }

       @Override
       public void onBypassFeedback(L2PcInstance player, String command)
       {
          StringTokenizer st = new StringTokenizer(command, " ");
          String actualCommand = st.nextToken(); // Get actual command
          int pvp = Integer.parseInt(st.nextToken());
          if (actualCommand.equalsIgnoreCase("Buy") && player.getPvpKills() >= pvp)
          {
             if (st.countTokens() < 1)
                return;
             
             int val = Integer.parseInt(st.nextToken());
             showBuyWindow(player, val);
          }
          else if (actualCommand.equalsIgnoreCase("Multisell") && player.getPvpKills() >= pvp)
          {
             if (st.countTokens() < 1)
                return;

             int val = Integer.parseInt(st.nextToken());
             L2Multisell.getInstance().separateAndSend(val, player, getNpcId(), false, getCastle().getTaxRate());
          }
          else if (actualCommand.equalsIgnoreCase("Exc_Multisell") && player.getPvpKills() >= pvp)
          {
             if (st.countTokens() < 1)
                return;

             int val = Integer.parseInt(st.nextToken());
             L2Multisell.getInstance().separateAndSend(val, player, getNpcId(), true, getCastle().getTaxRate());
          }
          else
          {
             NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
             final StringBuilder html1 = StringUtil.startAppend(2000,
             "<html><body><font color=\"06ff0a\">PvP Manager:</font><br>   You not enough pvp kills.<br1>You have <font color=\"LEVEL\">",
             String.valueOf(player.getPvpKills()),
             "</font> pvp kills in <font color=\"FF0000\">",
             String.valueOf(pvp),
             "</font> pvp kills.<br><center>Created by <font color=\"06ff0a\">Mentor</font></center></body></html>");
             html.setHtml(html1.toString());
             player.sendPacket(html);
             super.onBypassFeedback(player, command);
          }
       }
    }

    NPC
    Код:

    INSERT INTO `custom_npc` VALUES ('40000', '32226', 'Barika', '1', 'PVP Shop Manager', '1', 'LineageNPC2.K_F1_grand', '11.00', '22.25', '70', 'male', '[b]L2PVP[/b]', '40', '2444', '2444', '0.00', '0.00', '10', '10', '10', '10', '10', '10', '0', '0', '500', '500', '500', '500', '278', '0', '333', '0', '0', null, '0', '28', '120', '0', '0', 'LAST_HIT', 'false');


    HTML:
    Create PVPMerchant directory in data/html.
    data/html/PVPMerchant/40000.htm
    Код:
    <html><body>L2PVP Shop Instance By Mentor:<br>
    <font color="LEVEL">Npc by Mentor</font><br>
    <a action="bypass -h npc_%objectId%_multisell 200 452">Multisell PvP (PVP 200)</a><br1>
    <a action="bypass -h npc_%objectId%_exc_multisell 400 452">Exc_Multisell PvP (PVP 400)</a><br1>
    <a action="bypass -h npc_%objectId%_buy 0 40000">Buy (PVP 0)</a><br1>
    </body></html>
    Код:

    <a action="bypass -h npc_%objectId%_multisell PVP_COUNT MULTISELL_ID">Buy Weapon</a>
    <a action="bypass -h npc_%objectId%_exc_multisell PVP_COUNT MULTISELL_ID">Buy Weapon</a>
    <a action="bypass -h npc_%objectId%_buy PVP_COUNT MERCHANT_BUYLIST_ID">Buy Weapon</a>

    rev 3900+ тестировалось

    (с)
    Owned
    Owned


    Сообщения : 148
    Дата регистрации : 2010-03-22

    Инстант Магазин Empty Re: Инстант Магазин

    Сообщение  Owned Ср Мар 24, 2010 5:23 am

    Как понимаю это к этому же :

    1. Примените патч
    * Вручную не Автоматически
    2. Мы должны сделать NPC
    2-1. Перейти в базу данных, выберите таблицу ВСНП и добавить новую строку
    2-2. Вы можете копировать строки из другого NPC, но
    * Необходимо изменить класс столбца в L2PVPMerchant
    3. Создайте папку в HTML / данные с PVPMerchant имя
    3-1. Создание HTML-файла
    3-2. Вы сделали, и вы можете положить multisell файла
    Есть вопросы?

    Код:
    Index: C:/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PVPMerchantInstance.java
    ===================================================================
    /*
     * 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.model.actor.instance;

    import java.util.StringTokenizer;

    import net.sf.l2j.gameserver.model.L2Multisell;
    import net.sf.l2j.gameserver.templates.L2NpcTemplate;

    /**
    * Author xAddytzu
    */

    public class L2PVPMerchantInstance extends L2FolkInstance
    {
       public L2PVPMerchantInstance(int objectId, L2NpcTemplate template)
       {
          super(objectId, template);
       }
       @Override
       public String getHtmlPath(int npcId, int val)
       {
          String pom = "";

          if (val == 0) pom = "" + npcId;
          else pom = npcId + "-" + val;

          return "data/html/PVPMerchant/" + pom + ".htm";
       }
       @Override
       public void onBypassFeedback(L2PcInstance player, String command)
       {
          StringTokenizer st = new StringTokenizer(command, " ");
          String actualCommand = st.nextToken();

          if (actualCommand.equalsIgnoreCase("Exc_Multisell"))
          {
          L2Multisell.getInstance().SeparateAndSend(Integer.parseInt(command.substring(9).trim()), player, true, getCastle().getTaxRate());
          }
          else if (actualCommand.equalsIgnoreCase("Multisell"))
          {
             L2Multisell.getInstance().SeparateAndSend(Integer.parseInt(command.substring(9).trim()), player, false, getCastle().getTaxRate());
          }
          else
          {
             super.onBypassFeedback(player, command);
          }
       }
    }

    Index: C:/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java
    ===================================================================

             else if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && this instanceof L2FishermanInstance)
             {
                if (showPkDenyChatWindow(player, "fisherman"))
                   return;
             }
             // Custom staff
    +         else if (player.getPvpKills() >= Config.PVP_MIN)
    +         { 
    +            if (this instanceof L2PVPMerchantInstance)
    +            {
    +               if (showPkDenyChatWindow(player, "PVPMerchant"))
    +                  return;
    +            }
    +         }

    Index: C:/workspace/L2_GameServer_t1/java/net/sf/l2j/Config.java
    ===================================================================
    +   //Custom stuff
    +    public static int PVP_MIN;
    @@
    +   PVP_MIN = Integer.parseInt(otherSettings.getProperty("PVPMerchant", "100"));
       }
       catch (Exception e)
       {

    Index: C:/L2_GameServer/java/config/other.properties
    ===================================================================
    +
    +#------------------------------------------
    +# If you have >= 100 points
    +# You can buy usefull items
    +#------------------------------------------
    +PVPMerchant = 100

      Текущее время Пт Окт 04, 2024 5:27 am