Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: net.sf.l2j.gameserver.model.actor.instance;L2PcInstance.JAVA
- ===================================================================
- --- net.sf.l2j.gameserver.model.actor.instance;L2PcInstance.JAVA (revision)
- +++ net.sf.l2j.gameserver.model.actor.instance;L2PcInstance.JAVA (working copy)
- Index: Referencia!
- switch (getPrivateStoreType())
- {
- case SELL:
- case PACKAGE_SELL:
- activeChar.sendPacket(new PrivateStoreMsgSell(this));
- break;
- case BUY:
- activeChar.sendPacket(new PrivateStoreMsgBuy(this));
- break;
- case DWARVEN_MANUFACTURE:
- case GENERAL_MANUFACTURE:
- activeChar.sendPacket(new RecipeShopMsg(this));
- break;
- }
- }
- Index: Adicionar Add!
- + private boolean _isPartyInvProt = false;
- + public boolean isPartyInvProt()
- + {
- + return _isPartyInvProt;
- + }
- +
- + public void setIsPartyInvProt(boolean value)
- + {
- + _isPartyInvProt = value;
- + }
- +
- + private boolean _isInTradeProt = false;
- + public boolean isInTradeProt()
- + {
- + return _isInTradeProt;
- + }
- +
- + public void setIsInTradeProt(boolean value)
- + {
- + _isInTradeProt = value;
- + }
- Index: Essa Parte Ja existe na C4 ///// Mais verifique e adicione se nao existir
- + private boolean _messageRefusal = false; // message refusal mode
- + public boolean getMessageRefusal()
- + {
- + return _messageRefusal;
- + }
- +
- + public void setMessageRefusal(boolean mode)
- + {
- + _messageRefusal = mode;
- + sendPacket(new EtcStatusUpdate(this));
- + }
- +
- + private boolean _getGainXpSp = true;
- +
- + public boolean getGainXpSp()
- + {
- + return _getGainXpSp;
- + }
- +
- + public void setGainXpSp(boolean XpSp)
- + {
- + _getGainXpSp = XpSp;
- + }
- Index: net.sf.l2j.gameserver.network.clientpackets;RequestJoinParty.JAVA
- ===================================================================
- --- net.sf.l2j.gameserver.network.clientpackets;RequestJoinParty.JAVA (revision)
- +++ net.sf.l2j.gameserver.network.clientpackets;RequestJoinParty.JAVA (working copy)
- Index: Referencia para adicionar! Protecão
- if ((requestor.getLootInvitation() >= 0) || (requestor.getActiveRequester() != null))
- {
- requestor.sendPacket(new SystemMessage(SystemMessage.WAITING_FOR_REPLY));
- return;
- }
- + if (target.isPartyInvProt())
- + {
- + requestor.sendMessage("The player you tried to invite is in offline Party mode.");
- + return;
- + }
- Index: net.sf.l2j.gameserver.network.clientpackets;TradeRequest.JAVA
- ===================================================================
- --- net.sf.l2j.gameserver.network.clientpackets;TradeRequest.JAVA (revision)
- +++ net.sf.l2j.gameserver.network.clientpackets;TradeRequest.JAVA (working copy)
- Index: Referencia para adicionar! Proteção
- if (player.isInStoreMode() || partner.isInStoreMode())
- {
- player.sendPacket(new SystemMessage(SystemMessage.CANNOT_TRADE_DISCARD_DROP_ITEM_WHILE_IN_SHOPMODE));
- return;
- }
- + if (partner.getTradeRefusal())
- + {
- + player.sendMessage("Target is in trade refusal mode.");
- + return;
- + }
- Index: net.sf.l2j.gameserver.network.clientpackets;Say2.JAVA
- ===================================================================
- --- net.sf.l2j.gameserver.network.clientpackets;Say2.JAVA (revision)
- +++ net.sf.l2j.gameserver.network.clientpackets;Say2.JAVA (working copy)
- Index: Adicionar dentro da runImpl
- + if (!receiver.getMessageRefusal() || activeChar.getAccessLevel() > receiver.getAccessLevel())
- + {
- + receiver.sendPacket(cs);
- + activeChar.sendPacket(new CreatureSay(activeChar.getObjectId(), _type, "->" + receiver.getName(), _text));
- + }
- Index: net.sf.l2j.gameserver.network.serverpackets;EtcStatusUpdate.JAVA
- ===================================================================
- --- net.sf.l2j.gameserver.network.serverpackets;EtcStatusUpdate.JAVA (revision)
- +++ net.sf.l2j.gameserver.network.serverpackets;EtcStatusUpdate.JAVA (working copy)
- Index: Adicionar dentro da writeImpl()
- + writeD((_activeChar.getMessageRefusal() || _activeChar.isChatBanned()) ? 1 : 0); // 1 = block all chat
- Index: net.sf.l2j.gameserver.model;L2World.JAVA
- ===================================================================
- --- net.sf.l2j.gameserver.model;L2World.JAVA (revision)
- +++ net.sf.l2j.gameserver.model;L2World.JAVA (working copy)
- Index: Verificar se quantidades de player final //// Verificar se ja existe
- + /** A map containing all the players in game */
- + private final Map<Integer, L2PcInstance> _allPlayers;
- + /**
- + * Return a collection containing all players in game.<BR>
- + * <BR>
- + * <FONT COLOR=#FF0000><B> <U>Caution</U> : Read-only, please! </B></FONT><BR>
- + * <BR>
- + * @return
- + */
- + public Collection<L2PcInstance> getAllPlayers()
- + {
- + return _allPlayers.values();
- + }
- Index: net.sf.l2j.gameserver.model.actor.stat;PcStat.JAVA
- ===================================================================
- --- net.sf.l2j.gameserver.model.actor.stat;PcStat.JAVA (revision)
- +++ net.sf.l2j.gameserver.model.actor.stat;PcStat.JAVA (working copy)
- Index: Referencia para adicionar /// # Procure pela Boolean addExp(long value)
- + // Prevent only gaining experience
- + if (!getActiveChar().getGainXpSp() && (value > 0))
- + {
- + return false;
- + }
- Index: Referencia para adicionar /// # Procure pela Boolean addSp(Int value)
- + if (!getActiveChar().getGainXpSp() && (value > 0))
- + {
- + return false;
- + }
- Index: Agora vamos registrar os comandos!
- Index: net.sf.l2j.gameserver.network.clientpackets;RequestBypassToServer.JAVA
- ===================================================================
- --- net.sf.l2j.gameserver.network.clientpackets;RequestBypassToServer.JAVA (revision)
- +++ net.sf.l2j.gameserver.network.clientpackets;RequestBypassToServer.JAVA (working copy)
- Index: Referencia para adicionar /// Procure pela # Public void runImpl Dentro da try Adicionar!
- + else if (_command.startsWith("setPartyRefuse"))
- + {
- + if (activeChar.isPartyInvProt())
- + activeChar.setIsPartyInvProt(false);
- + else
- + activeChar.setIsPartyInvProt(true);
- + activeChar.sendMessage("Party Protect: Enabled.");
- + Menu.sendMainWindow(activeChar);
- + }
- + else if (_command.startsWith("setTradeRefuse"))
- + {
- + if (activeChar.isInTradeProt())
- + activeChar.setIsInTradeProt(false);
- + else
- + activeChar.setIsInTradeProt(true);
- + activeChar.sendMessage("Trade Protect: Enabled.");
- + Menu.sendMainWindow(activeChar);
- + }
- + else if (_command.startsWith("setMessageRefuse"))
- + {
- + if (activeChar.getMessageRefusal())
- + activeChar.setMessageRefusal(false);
- +
- + else
- + activeChar.setMessageRefusal(true);
- + activeChar.sendMessage("Message Protect: Enabled.");
- + Menu.sendMainWindow(activeChar);
- + }
- + else if (_command.startsWith("setxpnot"))
- + {
- +
- + if (activeChar.getGainXpSp())
- + activeChar.setGainXpSp(false);
- +
- + else
- + activeChar.setGainXpSp(true);
- + activeChar.sendMessage("XP / SP: Enabled.");
- + Menu.sendMainWindow(activeChar);
- +
- +
- + }
- Index: net.sf.l2j.gameserver.network.serverpackets;NpcHtmlMessage.JAVA
- ===================================================================
- --- net.sf.l2j.gameserver.network.serverpackets;NpcHtmlMessage.JAVA ()
- +++ net.sf.l2j.gameserver.network.serverpackets;NpcHtmlMessage.JAVA ()
- + private String _html;
- + public void replace(String pattern, String value)
- + {
- + _html = _html.replaceAll(pattern, value.replaceAll("\\$", "\\\\\\$"));
- + }
- +
- + public void replace(String pattern, int value)
- + {
- + _html = _html.replaceAll(pattern, Integer.toString(value));
- + }
- +
- + public void replace(String pattern, long value)
- + {
- + _html = _html.replaceAll(pattern, Long.toString(value));
- + }
- +
- + public void replace(String pattern, double value)
- + {
- + _html = _html.replaceAll(pattern, Double.toString(value));
- + }
- +
- + public String getHtml()
- + {
- + return _html;
- + }
- Index: Agora vamos criar a Class para ler tudo isso que fizemos
- Index: net.sf.l2j.gameserver.handler.usercommandhandlers;Menu.JAVA
- ===================================================================
- --- net.sf.l2j.gameserver.handler.usercommandhandlers;Menu.JAVA ()
- +++ net.sf.l2j.gameserver.handler.usercommandhandlers;Menu.JAVA ()
- + package net.sf.l2j.gameserver.handler.usercommandhandlers
- +
- + import java.text.SimpleDateFormat;
- + import java.util.Calendar;
- +
- + import net.sf.l2j.gameserver.GameTimeController;
- + import net.sf.l2j.gameserver.handler.IUserCommandHandler;
- + import net.sf.l2j.gameserver.model.L2World;
- + import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- + import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +
- + /**
- + * @author COMBATE
- + *
- + */
- + public class Menu implements IUserCommandHandler
- + {
- + private static final String ACTIVED = "<font color=00FF00>ON</font>";
- + private static final String DESATIVED = "<font color=FF0000>OFF</font>";
- +
- + private static final int[] COMMAND_IDS =
- + {
- + 118
- + };
- +
- + @Override
- + public boolean useUserCommand(int id, L2PcInstance player)
- + {
- +
- + if (id == 118)
- + {
- + sendMainWindow(player);
- + }
- +
- + return true;
- + }
- +
- + public static void sendMainWindow(L2PcInstance player)
- + {
- + NpcHtmlMessage htm = new NpcHtmlMessage(0);
- +
- + int t = GameTimeController.getInstance().getGameTime();
- + int h = t/60;
- + int m = t%60;
- + SimpleDateFormat format = new SimpleDateFormat("h:mm a");
- + Calendar cal = Calendar.getInstance();
- + cal.set(Calendar.HOUR_OF_DAY, h);
- + cal.set(Calendar.MINUTE, m);
- +
- + htm.setFile("data/html/mods/menu.htm");
- + htm.replace("%online%", L2World.getInstance().getAllPlayers().size());
- + htm.replace("%partyRefusal%", player.isPartyInvProt() ? ACTIVED : DESATIVED);
- + htm.replace("%tradeRefusal%", player.isInTradeProt() ? ACTIVED : DESATIVED);
- + htm.replace("%cantGainXP%", player.getGainXpSp() ? ACTIVED : DESATIVED);
- + htm.replace("%messageRefusal%", player.getMessageRefusal() ? ACTIVED : DESATIVED);
- + htm.replace("%time%", format.format(cal.getTime()));
- + player.sendPacket(htm);
- + return;
- +
- + }
- +
- + @Override
- + public int[] getUserCommandList()
- + {
- + return COMMAND_IDS;
- + }
- + }
- Index: Agora vamos Registrar Usercomander que criamos com nome de Menu.Java
- Index: net.sf.l2j.gameserver.handler;UserCommandHandler.JAVA
- ===================================================================
- --- net.sf.l2j.gameserver.handler;UserCommandHandler.JAVA ()
- +++ net.sf.l2j.gameserver.handler;UserCommandHandler.JAVA ()
- + import net.sf.l2j.gameserver.handler.usercommandhandlers.Menu;
- - registerUserCommandHandler(new ChannelListUpdate());
- + registerUserCommandHandler(new ChannelListUpdate());
- + registerUserCommandHandler(new Menu());
- Index: Agora vamos Criar uma Html Ler nossa Class Menu.Java
- Index: data/html/mods/menu.htm
- ===================================================================
- --- data/html/mods/menu.htm ()
- +++ data/html/mods/menu.htm ()
- <html>
- <title>Menu Pessoal</title>
- <body>
- <center>
- <table width=224>
- <tr>
- <td width=32><img src=Icon.etc_alphabet_l_i00 height=32 width=32></td>
- <td width=32><img src=Icon.etc_alphabet_i_i00 height=32 width=32></td>
- <td width=32><img src=Icon.etc_alphabet_n_i00 height=32 width=32></td>
- <td width=32><img src=Icon.etc_alphabet_e_i00 height=32 width=32></td>
- <td width=32><img src=Icon.etc_alphabet_a_i00 height=32 width=32></td>
- <td width=32><img src=Icon.etc_alphabet_g_i00 height=32 width=32></td>
- <td width=32><img src=Icon.etc_alphabet_e_i00 height=32 width=32></td>
- </tr>
- </table>
- <br>
- <br>
- Player(s) online: <font color="00FF00">%online%</font></center>
- <br>
- <center><font color="LEVEL">Configure seu Char:</font></center>
- <img src="L2UI.SquareGray" width=270 height=1>
- <table bgcolor="000000">
- <tr>
- <td width=5></td>
- <td width=105>Tipo</td>
- <td width=100>Atual</td>
- <td width=50>Acao</td>
- </tr>
- </table>
- <img src="L2UI.SquareGray" width=270 height=1>
- <br>
- <table bgcolor="000000">
- <tr>
- <td width=5></td>
- <td width=100>Recusar Party</td>
- <td width=100>%partyRefusal%</td>
- <td width=50><button width=90 height=16 back="L2UI_CH3.br_bar2_hp" fore="L2UI_CH3.br_bar2_hp" action="bypass -h setPartyRefuse" value="Alterar"></td>
- </tr>
- <tr>
- <td width=5></td>
- <td width=100>Recusar Trade</td>
- <td width=100>%tradeRefusal%</td>
- <td width=50><button width=90 height=16 back="L2UI_CH3.br_bar2_hp1" fore="L2UI_CH3.br_bar2_hp1" action="bypass -h setTradeRefuse" value="Alterar"></td>
- </tr>
- <tr>
- <td width=5></td>
- <td width=100>Recusar PM</td>
- <td width=100>%messageRefusal%</td>
- <td width=50><button width=90 height=16 back="L2UI_CH3.br_bar2_hp1" fore="L2UI_CH3.br_bar2_hp1" action="bypass -h setMessageRefuse" value="Alterar"></td>
- </tr>
- <tr>
- <td width=5></td>
- <td width=100>Recusar XP</td>
- <td width=100>%cantGainXP%</td>
- <td width=50><button width=90 height=16 back="L2UI_CH3.br_bar2_hp1" fore="L2UI_CH3.br_bar2_hp1" action="bypass -h setxpnot" value="Alterar"></td>
- </tr>
- </table>
- <br>
- <center>Game Time : <font color="LEVEL">%time%</font></center>
- <br>
- <center>
- <img src="L2UI.SquareGray" width=160 height=1><br>
- </center>
- <br>
- <center>
- </body>
- </html>
- Index: Agora vamos Registrar o Comando para o jogador ultilizar!
- Index: LineageII/system/commandname-e.dat
- ===================================================================
- --- LineageII/system/commandname-e.dat ()
- +++ LineageII/system/commandname-e.dat ()
- 111 118 a,menu\0
- Salvar em 413
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement