Autor Tema: .tradeoff .tradeon L2JFrozen  (Leído 49 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Conectado Pske

  • Grado D
  • *
  • Topic Author
  • Mensajes: 81
  • 00
  • Agradecimientos: 8
  • Cronica: : Interlude
  • Revision: 1132
  • S.O: otro
  • Serverpack : l2jfrozen
A MasterMage le gusta este post.

.tradeoff .tradeon L2JFrozen
« en: Noviembre 10, 2018, 09:51:51 pm »
gracias
Este post tiene 1 agradecimientos
  • Añade a tus favoritos
    Bueno aca dejo el codigo:

    Agregar en gameserver/handler/voicedcommandhandlers


    Código: [Seleccionar]
    /*
    * 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 com.l2jfrozen.gameserver.handler.voicedcommandhandlers;

    import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
    import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
    import com.l2jfrozen.gameserver.network.SystemMessageId;
    import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;

    /**
    * @author Intrepid
    *
    */

    public class TradeOff implements IVoicedCommandHandler
    {
    private static final String[] VOICED_COMMANDS =
    {
    "tradeoff",
    "tradeon"
    };

    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {
    if ((command.startsWith("tradeoff")))
    {
    if(activeChar.getTradeRefusal())
    {
    activeChar.sendMessage("Trade refusal is already enabled!");
    }
    else
    {
    activeChar.setTradeRefusal(true);
    activeChar.sendMessage("Trade refusal enabled");
    }
    }
    if ((command.startsWith("tradeon")))
    {
    if(!activeChar.getTradeRefusal())
    {
    activeChar.sendMessage("Trade refusal is already disabled!");
    }
    else
    {
    activeChar.setTradeRefusal(false);
    activeChar.sendMessage("Trade refusal disabled");
    }
    }
    return true;
    }

    public String[] getVoicedCommandList()
    {
    return VOICED_COMMANDS;
    }
    }

    Luego registran el comando en gameserver/handler/VoicedCommandHandler.java


    Código: [Seleccionar]
    +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.TradeOff;
    + registerVoicedCommandHandler(new TradeOff());

    y en L2PcInstance esto


    Código: [Seleccionar]
    //Line 1202

    private boolean _tradeRefusal = false;

    //Line 14245

    public void setTradeRefusal(boolean mode)
    {
    _tradeRefusal = mode;
    }

    public boolean getTradeRefusal()
    {
    return _tradeRefusal;
    }

    y en gameserver/network/clientpackets/traderequest.java


    Código: [Seleccionar]
    +		if (partner.getTradeRefusal())
    + {
    + player.sendMessage(partner.getName() + " is in Trade Protection Mode");
    + return;
    + }

    // Alt game - Karma punishment
    if (!Config.ALT_GAME_KARMA_PLAYER_CAN_TRADE && (player.getKarma() > 0 || partner.getKarma() > 0))

    :ok:
    « Última modificación: Noviembre 11, 2018, 03:19:36 pm por Pske »

    Conectado Pske

    • Grado D
    • *
    • Topic Author
    • Mensajes: 81
    • 00
    • Agradecimientos: 8
    • Cronica: : Interlude
    • Revision: 1132
    • S.O: otro
    • Serverpack : l2jfrozen
    Re:.tradeoff .tradeon L2JFrozen
    « Respuesta #1 en: Noviembre 11, 2018, 04:59:27 pm »
    gracias
    Este post tiene 0 agradecimientos
  • Añade a tus favoritos
    Para hacer un comando parecido en gameserver/network/clientpackets/RequestJoinParty.java


    Código: [Seleccionar]
    +		if (target.isPartyInvProt())
    + {
    + requestor.sendMessage("You can't invite that player because he is in party protection.");
    + return;
    + }

    O si  quieren el mensaje igual al del trade: target.getName() + " is in Party Protection Mode
    « Última modificación: Noviembre 12, 2018, 04:01:00 pm por Pske »