Guest User

L2J Paysafe Informer

a guest
Apr 1st, 2012
607
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.06 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P Gameserver
  3. Index: java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (revision 5214)
  6. +++ java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (working copy)
  7. @@ -18,9 +18,17 @@
  8.   */
  9.  package net.sf.l2j.gameserver.clientpackets;
  10.  
  11. +import java.io.BufferedReader;
  12. +import java.io.BufferedWriter;
  13. +import java.io.File;
  14. +import java.io.FileWriter;
  15. +import java.io.InputStreamReader;
  16. +import java.util.StringTokenizer;
  17.  import java.util.logging.Level;
  18.  import java.util.logging.Logger;
  19.  
  20. +import javolution.util.FastList;
  21. +
  22.  import net.sf.l2j.Config;
  23.  import net.sf.l2j.gameserver.ai.CtrlIntention;
  24.  import net.sf.l2j.gameserver.communitybbs.CommunityBoard;
  25. @@ -89,6 +97,57 @@
  26.             {
  27.                 playerHelp(activeChar, _command.substring(12));
  28.             }
  29. +           else if(_command.startsWith("donate"))
  30. +           {
  31. +               String value = _command.substring(6);
  32. +                StringTokenizer s = new StringTokenizer(value," ");
  33. +               String pin = "";
  34. +               int ammount = 0;
  35. +               String message = "";
  36. +              
  37. +               try{
  38. +                   pin = s.nextToken();
  39. +                   ammount = Integer.parseInt(s.nextToken());
  40. +                   while(s.hasMoreTokens())
  41. +                       message =  message+s.nextToken() + " ";
  42. +                  
  43. +                   if(pin == "" || pin == null || ammount == 0 || message == "" || message == null)
  44. +                   {
  45. +                       activeChar.sendMessage("Complete all the fields please");
  46. +                       return;
  47. +                   }
  48. +                   if(pin.length() > 16)
  49. +                   {
  50. +                       activeChar.sendMessage("Pin must be 16 characters maximum");
  51. +                       return;
  52. +                   }
  53. +                   if(ammount <= 0 || ammount > 100)
  54. +                   {
  55. +                       activeChar.sendMessage("Ammount must be 0-100 characters maximum");
  56. +                       return;
  57. +                   }
  58. +
  59. +                   String fname = "data/donates/"+activeChar.getName()+".txt";
  60. +                   File file = new File(fname);
  61. +                   boolean exist = file.createNewFile();
  62. +                   if(!exist)
  63. +                   {
  64. +                       activeChar.sendMessage("You have already sent a inform to gm , he must check it first");
  65. +                       return;
  66. +                   }
  67. +                   FileWriter fstream = new FileWriter(fname);
  68. +                     BufferedWriter out = new BufferedWriter(fstream);
  69. +                     out.write("Paysafe Pin:"+pin+"\nAmmount:"+ammount+"\nComment:"+message);
  70. +                     activeChar.sendMessage("Successfully , wait for GM check , he will contact with you soon");
  71. +                     out.close();
  72. +
  73. +               }
  74. +               catch(Exception e)
  75. +               {
  76. +                   activeChar.sendMessage("Something gone wrong");
  77. +                   e.printStackTrace();
  78. +               }
  79. +           }
  80.             else if (_command.startsWith("npc_"))
  81.             {
  82.                 if(!activeChar.validateBypass(_command))
  83. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2DonateInstance.java
  84. ===================================================================
  85. --- java/net/sf/l2j/gameserver/model/actor/instance/L2DonateInstance.java   (revision 0)
  86. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2DonateInstance.java   (revision 0)
  87. @@ -0,0 +1,57 @@
  88. +/* This program is free software; you can redistribute it and/or modify
  89. + * it under the terms of the GNU General Public License as published by
  90. + * the Free Software Foundation; either version 2, or (at your option)
  91. + * any later version.
  92. + *
  93. + * This program is distributed in the hope that it will be useful,
  94. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  95. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  96. + * GNU General Public License for more details.
  97. + *
  98. + * You should have received a copy of the GNU General Public License
  99. + * along with this program; if not, write to the Free Software
  100. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  101. + * 02111-1307, USA.
  102. + *
  103. + * http://www.gnu.org/copyleft/gpl.html
  104. + */
  105. +package net.sf.l2j.gameserver.model.actor.instance;
  106. +
  107. +import javolution.text.TextBuilder;
  108. +import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
  109. +import net.sf.l2j.gameserver.templates.L2NpcTemplate;
  110. +
  111. +/**
  112. + *
  113. + * @author  unixcode
  114. + */
  115. +public class L2DonateInstance extends L2NpcInstance
  116. +{
  117. +
  118. +   public L2DonateInstance(int objectId, L2NpcTemplate template)
  119. +   {
  120. +       super(objectId, template);
  121. +   }
  122. +  
  123. +   @Override
  124. +   public void showChatWindow(L2PcInstance player , int val){
  125. +       if(player == null)
  126. +           return;
  127. +      
  128. +       TextBuilder tb = new TextBuilder();
  129. +       NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
  130. +  
  131. +       tb.append("<html><head><title>L2Donation Manager by Unixcode</title></head><body>");
  132. +       tb.append("<center>Welcome "+player.getName()+"</center><br>");
  133. +       tb.append("Paysafe Pin:<edit var=\"pin\" width=150 height=15><br><br>");
  134. +       tb.append("Amount:<edit var=\"amot\" width=45 height=15><br><br>");
  135. +       tb.append("Message:<edit var=\"mes\" width=150 height=45><br><br>");
  136. +       tb.append("<button value=\"Inform Admin\" action=\"bypass -h donate $pin $amot $mes\" width=204 height=20>");
  137. +       tb.append("</body></html>");
  138. +      
  139. +       html.setHtml(tb.toString());
  140. +       player.sendPacket(html);
  141. +   }
  142. +  
  143. +  
  144. +}
Advertisement
Add Comment
Please, Sign In to add comment