Advertisement
VANPER

Scions of Destiny C4 /menu

Mar 21st, 2020
876
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 13.51 KB | None | 0 0
  1. Index: net.sf.l2j.gameserver.model.actor.instance;L2PcInstance.JAVA
  2. ===================================================================
  3. --- net.sf.l2j.gameserver.model.actor.instance;L2PcInstance.JAVA (revision)
  4. +++ net.sf.l2j.gameserver.model.actor.instance;L2PcInstance.JAVA (working copy)
  5.  
  6. Index: Referencia!
  7.  
  8.     switch (getPrivateStoreType())
  9.     {
  10.         case SELL:
  11.         case PACKAGE_SELL:
  12.             activeChar.sendPacket(new PrivateStoreMsgSell(this));
  13.             break;
  14.         case BUY:
  15.             activeChar.sendPacket(new PrivateStoreMsgBuy(this));
  16.             break;
  17.         case DWARVEN_MANUFACTURE:
  18.         case GENERAL_MANUFACTURE:
  19.             activeChar.sendPacket(new RecipeShopMsg(this));
  20.             break;
  21.     }
  22. }
  23. Index: Adicionar Add!
  24.  
  25. +   private boolean _isPartyInvProt = false;
  26. +   public boolean isPartyInvProt()
  27. +   {
  28. +       return _isPartyInvProt;
  29. +   }
  30. +      
  31. +   public void setIsPartyInvProt(boolean value)
  32. +   {
  33. +       _isPartyInvProt = value;
  34. +   }
  35. +  
  36. +   private boolean _isInTradeProt = false;
  37. +   public boolean isInTradeProt()
  38. +   {
  39. +       return _isInTradeProt;
  40. +   }
  41. +      
  42. +   public void setIsInTradeProt(boolean value)
  43. +   {
  44. +       _isInTradeProt = value;
  45. +   }
  46.  
  47. Index: Essa Parte Ja existe na C4 /////  Mais verifique e adicione se nao existir
  48.  
  49. +   private boolean _messageRefusal = false; // message refusal mode
  50. +   public boolean getMessageRefusal()
  51. +   {
  52. +       return _messageRefusal;
  53. +   }
  54. +  
  55. +   public void setMessageRefusal(boolean mode)
  56. +   {
  57. +       _messageRefusal = mode;
  58. +       sendPacket(new EtcStatusUpdate(this));
  59. +   }
  60. +  
  61. +   private boolean _getGainXpSp = true;
  62. +  
  63. +       public boolean getGainXpSp()
  64. +   {
  65. +       return _getGainXpSp;
  66. +   }
  67. +  
  68. +   public void setGainXpSp(boolean XpSp)
  69. +   {
  70. +       _getGainXpSp = XpSp;
  71. +   }
  72.  
  73. Index: net.sf.l2j.gameserver.network.clientpackets;RequestJoinParty.JAVA
  74. ===================================================================
  75. --- net.sf.l2j.gameserver.network.clientpackets;RequestJoinParty.JAVA (revision)
  76. +++ net.sf.l2j.gameserver.network.clientpackets;RequestJoinParty.JAVA (working copy)
  77.  
  78. Index: Referencia para adicionar! Protecão
  79.  
  80.  
  81.     if ((requestor.getLootInvitation() >= 0) || (requestor.getActiveRequester() != null))
  82.     {
  83.         requestor.sendPacket(new SystemMessage(SystemMessage.WAITING_FOR_REPLY));
  84.         return;
  85.     }
  86.  
  87.  
  88. +   if (target.isPartyInvProt())
  89. +   {
  90. +       requestor.sendMessage("The player you tried to invite is in offline Party mode.");
  91. +       return;
  92. +   }
  93.  
  94. Index: net.sf.l2j.gameserver.network.clientpackets;TradeRequest.JAVA
  95. ===================================================================
  96. --- net.sf.l2j.gameserver.network.clientpackets;TradeRequest.JAVA (revision)
  97. +++ net.sf.l2j.gameserver.network.clientpackets;TradeRequest.JAVA (working copy)
  98.  
  99. Index: Referencia para adicionar! Proteção
  100.  
  101.     if (player.isInStoreMode() || partner.isInStoreMode())
  102.     {
  103.         player.sendPacket(new SystemMessage(SystemMessage.CANNOT_TRADE_DISCARD_DROP_ITEM_WHILE_IN_SHOPMODE));
  104.         return;
  105.     }
  106.  
  107. +   if (partner.getTradeRefusal())
  108. +   {
  109. +       player.sendMessage("Target is in trade refusal mode.");
  110. +       return;
  111. +   }
  112.  
  113. Index: net.sf.l2j.gameserver.network.clientpackets;Say2.JAVA
  114. ===================================================================
  115. --- net.sf.l2j.gameserver.network.clientpackets;Say2.JAVA (revision)
  116. +++ net.sf.l2j.gameserver.network.clientpackets;Say2.JAVA (working copy)
  117.  
  118. Index: Adicionar dentro da runImpl
  119.  
  120. +   if (!receiver.getMessageRefusal() || activeChar.getAccessLevel() > receiver.getAccessLevel())
  121. +   {
  122. +       receiver.sendPacket(cs);
  123. +       activeChar.sendPacket(new CreatureSay(activeChar.getObjectId(), _type, "->" + receiver.getName(), _text));
  124. +   }
  125.  
  126. Index: net.sf.l2j.gameserver.network.serverpackets;EtcStatusUpdate.JAVA
  127. ===================================================================
  128. --- net.sf.l2j.gameserver.network.serverpackets;EtcStatusUpdate.JAVA (revision)
  129. +++ net.sf.l2j.gameserver.network.serverpackets;EtcStatusUpdate.JAVA (working copy)
  130.  
  131. Index: Adicionar dentro da writeImpl()
  132.  
  133. +   writeD((_activeChar.getMessageRefusal() || _activeChar.isChatBanned()) ? 1 : 0); // 1 = block all chat
  134.  
  135.  
  136. Index: net.sf.l2j.gameserver.model;L2World.JAVA
  137. ===================================================================
  138. --- net.sf.l2j.gameserver.model;L2World.JAVA (revision)
  139. +++ net.sf.l2j.gameserver.model;L2World.JAVA (working copy)
  140.  
  141. Index: Verificar se quantidades de player final //// Verificar se ja existe
  142.  
  143. +   /** A map containing all the players in game */
  144. +   private final Map<Integer, L2PcInstance> _allPlayers;
  145.  
  146.  
  147. +   /**
  148. +    * Return a collection containing all players in game.<BR>
  149. +    * <BR>
  150. +    * <FONT COLOR=#FF0000><B> <U>Caution</U> : Read-only, please! </B></FONT><BR>
  151. +    * <BR>
  152. +    * @return
  153. +    */
  154. +   public Collection<L2PcInstance> getAllPlayers()
  155. +   {
  156. +       return _allPlayers.values();
  157. +   }
  158.  
  159. Index: net.sf.l2j.gameserver.model.actor.stat;PcStat.JAVA
  160. ===================================================================
  161. --- net.sf.l2j.gameserver.model.actor.stat;PcStat.JAVA (revision)
  162. +++ net.sf.l2j.gameserver.model.actor.stat;PcStat.JAVA (working copy)
  163.  
  164. Index: Referencia para adicionar ///  # Procure pela Boolean addExp(long value)
  165.  
  166.  
  167. +   // Prevent only gaining experience
  168. +   if (!getActiveChar().getGainXpSp() && (value > 0))
  169. +   {
  170. +       return false;
  171. +   }
  172.    
  173.  
  174. Index: Referencia para adicionar ///  # Procure pela Boolean addSp(Int value)
  175.  
  176. +   if (!getActiveChar().getGainXpSp() && (value > 0))
  177. +   {
  178. +       return false;
  179. +   }
  180.  
  181. Index: Agora vamos registrar os comandos!
  182.  
  183. Index: net.sf.l2j.gameserver.network.clientpackets;RequestBypassToServer.JAVA
  184. ===================================================================
  185. --- net.sf.l2j.gameserver.network.clientpackets;RequestBypassToServer.JAVA (revision)
  186. +++ net.sf.l2j.gameserver.network.clientpackets;RequestBypassToServer.JAVA (working copy)
  187.  
  188. Index: Referencia para adicionar /// Procure pela # Public void runImpl Dentro da try Adicionar!
  189.  
  190. +   else if (_command.startsWith("setPartyRefuse"))
  191. +   {
  192. +       if (activeChar.isPartyInvProt())
  193. +           activeChar.setIsPartyInvProt(false);
  194. +       else
  195. +           activeChar.setIsPartyInvProt(true);
  196. +       activeChar.sendMessage("Party Protect: Enabled.");
  197. +       Menu.sendMainWindow(activeChar);
  198. +   }
  199. +   else if (_command.startsWith("setTradeRefuse"))
  200. +   {
  201. +       if (activeChar.isInTradeProt())
  202. +           activeChar.setIsInTradeProt(false);
  203. +       else
  204. +           activeChar.setIsInTradeProt(true);
  205. +       activeChar.sendMessage("Trade Protect: Enabled.");
  206. +       Menu.sendMainWindow(activeChar);
  207. +   }
  208. +   else if (_command.startsWith("setMessageRefuse"))
  209. +   {
  210. +       if (activeChar.getMessageRefusal())
  211. +           activeChar.setMessageRefusal(false);
  212. +  
  213. +       else
  214. +           activeChar.setMessageRefusal(true);
  215. +       activeChar.sendMessage("Message Protect: Enabled.");
  216. +       Menu.sendMainWindow(activeChar);
  217. +   }
  218. +   else if (_command.startsWith("setxpnot"))
  219. +   {
  220. +      
  221. +       if (activeChar.getGainXpSp())
  222. +           activeChar.setGainXpSp(false);
  223. +      
  224. +       else
  225. +       activeChar.setGainXpSp(true);
  226. +       activeChar.sendMessage("XP / SP: Enabled.");
  227. +       Menu.sendMainWindow(activeChar);
  228. +      
  229. +  
  230. +   }
  231.  
  232. Index: net.sf.l2j.gameserver.network.serverpackets;NpcHtmlMessage.JAVA
  233. ===================================================================
  234. --- net.sf.l2j.gameserver.network.serverpackets;NpcHtmlMessage.JAVA ()
  235. +++ net.sf.l2j.gameserver.network.serverpackets;NpcHtmlMessage.JAVA ()
  236.  
  237. + private String _html;
  238.  
  239. +   public void replace(String pattern, String value)
  240. +   {
  241. +       _html = _html.replaceAll(pattern, value.replaceAll("\\$", "\\\\\\$"));
  242. +   }
  243. +  
  244. +   public void replace(String pattern, int value)
  245. +   {
  246. +       _html = _html.replaceAll(pattern, Integer.toString(value));
  247. +   }
  248. +  
  249. +   public void replace(String pattern, long value)
  250. +   {
  251. +       _html = _html.replaceAll(pattern, Long.toString(value));
  252. +   }
  253. +  
  254. +   public void replace(String pattern, double value)
  255. +   {
  256. +       _html = _html.replaceAll(pattern, Double.toString(value));
  257. +   }
  258. +  
  259. +   public String getHtml()
  260. +   {
  261. +       return _html;
  262. +   }
  263.  
  264.  
  265.  
  266. Index: Agora vamos criar a Class para ler tudo isso que fizemos
  267.  
  268. Index: net.sf.l2j.gameserver.handler.usercommandhandlers;Menu.JAVA
  269. ===================================================================
  270. --- net.sf.l2j.gameserver.handler.usercommandhandlers;Menu.JAVA ()
  271. +++ net.sf.l2j.gameserver.handler.usercommandhandlers;Menu.JAVA ()
  272.  
  273. +   package net.sf.l2j.gameserver.handler.usercommandhandlers
  274. +  
  275. +   import java.text.SimpleDateFormat;
  276. +   import java.util.Calendar;
  277. +  
  278. +   import net.sf.l2j.gameserver.GameTimeController;
  279. +   import net.sf.l2j.gameserver.handler.IUserCommandHandler;
  280. +   import net.sf.l2j.gameserver.model.L2World;
  281. +   import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  282. +   import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  283. +  
  284. +   /**
  285. +    * @author COMBATE
  286. +    *
  287. +    */
  288. +   public class Menu implements IUserCommandHandler
  289. +   {
  290. +       private static final String ACTIVED = "<font color=00FF00>ON</font>";
  291. +       private static final String DESATIVED = "<font color=FF0000>OFF</font>";
  292. +      
  293. +       private static final int[] COMMAND_IDS =
  294. +       {
  295. +           118
  296. +       };
  297. +      
  298. +       @Override
  299. +       public boolean useUserCommand(int id, L2PcInstance player)
  300. +       {
  301. +          
  302. +           if (id == 118)
  303. +           {
  304. +                   sendMainWindow(player);
  305. +           }
  306. +          
  307. +           return true;
  308. +       }
  309. +      
  310. +       public static void sendMainWindow(L2PcInstance player)
  311. +       {
  312. +           NpcHtmlMessage htm = new NpcHtmlMessage(0);
  313. +          
  314. +           int t = GameTimeController.getInstance().getGameTime();
  315. +           int h = t/60;
  316. +           int m = t%60;
  317. +           SimpleDateFormat format = new SimpleDateFormat("h:mm a");
  318. +           Calendar cal = Calendar.getInstance();
  319. +           cal.set(Calendar.HOUR_OF_DAY, h);
  320. +           cal.set(Calendar.MINUTE, m);
  321. +          
  322. +           htm.setFile("data/html/mods/menu.htm");
  323. +           htm.replace("%online%", L2World.getInstance().getAllPlayers().size());
  324. +           htm.replace("%partyRefusal%", player.isPartyInvProt() ? ACTIVED : DESATIVED);
  325. +           htm.replace("%tradeRefusal%", player.isInTradeProt() ? ACTIVED : DESATIVED);
  326. +           htm.replace("%cantGainXP%", player.getGainXpSp() ? ACTIVED : DESATIVED);
  327. +           htm.replace("%messageRefusal%", player.getMessageRefusal() ? ACTIVED : DESATIVED);
  328. +           htm.replace("%time%",  format.format(cal.getTime()));
  329. +           player.sendPacket(htm);
  330. +           return;
  331. +          
  332. +       }
  333. +      
  334. +       @Override
  335. +       public int[] getUserCommandList()
  336. +       {
  337. +           return COMMAND_IDS;
  338. +       }
  339. +   }
  340.  
  341. Index: Agora vamos Registrar Usercomander que criamos com nome de Menu.Java
  342.  
  343. Index: net.sf.l2j.gameserver.handler;UserCommandHandler.JAVA
  344. ===================================================================
  345. --- net.sf.l2j.gameserver.handler;UserCommandHandler.JAVA ()
  346. +++ net.sf.l2j.gameserver.handler;UserCommandHandler.JAVA ()
  347.  
  348. +   import net.sf.l2j.gameserver.handler.usercommandhandlers.Menu;
  349.  
  350.  
  351. -   registerUserCommandHandler(new ChannelListUpdate());
  352. +   registerUserCommandHandler(new ChannelListUpdate());
  353. +   registerUserCommandHandler(new Menu());
  354.  
  355. Index: Agora vamos Criar uma Html Ler nossa Class Menu.Java
  356.  
  357. Index: data/html/mods/menu.htm
  358. ===================================================================
  359. --- data/html/mods/menu.htm ()
  360. +++ data/html/mods/menu.htm ()
  361.  
  362. <html>
  363. <title>Menu Pessoal</title>
  364. <body>
  365.  
  366. <center>
  367. <table width=224>
  368.     <tr>
  369.         <td width=32><img src=Icon.etc_alphabet_l_i00 height=32 width=32></td>
  370.         <td width=32><img src=Icon.etc_alphabet_i_i00 height=32 width=32></td>
  371.         <td width=32><img src=Icon.etc_alphabet_n_i00 height=32 width=32></td>
  372.         <td width=32><img src=Icon.etc_alphabet_e_i00 height=32 width=32></td>
  373.         <td width=32><img src=Icon.etc_alphabet_a_i00 height=32 width=32></td>
  374.         <td width=32><img src=Icon.etc_alphabet_g_i00 height=32 width=32></td>
  375.         <td width=32><img src=Icon.etc_alphabet_e_i00 height=32 width=32></td>
  376.     </tr>
  377. </table>
  378. <br>
  379. <br>
  380. Player(s) online: <font color="00FF00">%online%</font></center>
  381. <br>
  382.  
  383. <center><font color="LEVEL">Configure seu Char:</font></center>
  384. <img src="L2UI.SquareGray" width=270 height=1>
  385. <table bgcolor="000000">
  386. <tr>
  387. <td width=5></td>
  388. <td width=105>Tipo</td>
  389. <td width=100>Atual</td>
  390. <td width=50>Acao</td>
  391. </tr>
  392. </table>
  393. <img src="L2UI.SquareGray" width=270 height=1>
  394. <br>
  395.  
  396. <table bgcolor="000000">
  397. <tr>
  398. <td width=5></td>
  399. <td width=100>Recusar Party</td>
  400. <td width=100>%partyRefusal%</td>
  401. <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>
  402. </tr>
  403.  
  404. <tr>
  405. <td width=5></td>
  406. <td width=100>Recusar Trade</td>
  407. <td width=100>%tradeRefusal%</td>
  408. <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>
  409. </tr>
  410.  
  411. <tr>
  412. <td width=5></td>
  413. <td width=100>Recusar PM</td>
  414. <td width=100>%messageRefusal%</td>
  415. <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>
  416. </tr>
  417.  
  418. <tr>
  419. <td width=5></td>
  420. <td width=100>Recusar XP</td>
  421. <td width=100>%cantGainXP%</td>
  422. <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>
  423. </tr>
  424.  
  425. </table>
  426.  
  427. <br>
  428. <center>Game Time : <font color="LEVEL">%time%</font></center>
  429. <br>
  430. <center>
  431. <img src="L2UI.SquareGray" width=160 height=1><br>
  432. </center>
  433. <br>
  434. <center>
  435.  
  436. </body>
  437. </html>
  438.  
  439. Index: Agora vamos Registrar o Comando para o jogador ultilizar!
  440.  
  441. Index: LineageII/system/commandname-e.dat
  442. ===================================================================
  443. --- LineageII/system/commandname-e.dat ()
  444. +++ LineageII/system/commandname-e.dat ()
  445.  
  446. 111 118 a,menu\0
  447.  
  448. Salvar em 413
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement