Jump to content
  • 0

Question

Posted

well .. ive installed it manual , no erros , just 2 unused imports but in game , no html comes to the player no nothing...only the spam msg "YOU CAN'T MOVE BIATCH " But the player can move .. trade.. everything...

 

 

The import com.l2jserver.gameserver.ThreadPoolManager is never used

The import javolution.text.TextBuilder is never used

### Eclipse Workspace Patch 1.0
#P L2J_Server_BETA2
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java        (revision 5757)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java        (working copy)
@@ -306,6 +308,49 @@
  */
 public final class L2PcInstance extends L2Playable
 {    
+       boolean secured = false;
+       public void setSecured(boolean s)
+       {
+               secured = s;
+       }
+      
+       public boolean isSecured()
+       {
+               return secured;
+       }
+      
@@ -11883,6 +11976,12 @@
       
        public void onActionRequest()
        {
+               if (!isSecured())
+               {
+                       sendMessage("YOU CAN'T MOVE BIATCH ");
+                       return;
+               }
+              
                if (isSpawnProtected())
                {
                        sendPacket(SystemMessageId.YOU_ARE_NO_LONGER_PROTECTED_FROM_AGGRESSIVE_MONSTERS);
Index: java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java      (revision 5757)
+++ java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java      (working copy)
@@ -18,13 +18,20 @@
  */
 package com.l2jserver.gameserver.network.clientpackets;
 
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.util.List;
 import java.util.StringTokenizer;
 import java.util.logging.Level;
 
+import javolution.text.TextBuilder;
 import javolution.util.FastList;
 
 import com.l2jserver.Config;
+import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.communitybbs.CommunityBoard;
 import com.l2jserver.gameserver.datatables.AdminTable;
@@ -39,7 +46,9 @@
 import com.l2jserver.gameserver.model.actor.instance.L2MerchantSummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.entity.Hero;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
+import com.l2jserver.gameserver.network.L2GameClient;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;
 import com.l2jserver.gameserver.network.communityserver.writepackets.RequestShowCommunityBoard;
@@ -136,6 +145,286 @@
                        {
                                comeHere(activeChar);
                        }
+                       else if (_command.startsWith("checkCode "))
+                       {
+                               String c = "";
+                               StringTokenizer st = new StringTokenizer(_command, " ");
+                               st.nextToken();
+                               while (st.hasMoreTokens())
+                               {
+                                       c = c + st.nextToken();
+                               }
+                               Connection con = null;
+                               try
+                               {
+                                      
+                                       con = L2DatabaseFactory.getInstance().getConnection();
+                                       PreparedStatement stm = con.prepareStatement("SELECT code FROM codes WHERE name=?");
+                                       stm.setString(1, activeChar.getName());
+                                       stm.execute();
+                                       ResultSet rs = stm.executeQuery();
+                                       while (rs.next())
+                                       {
+                                               String ip = rs.getString("code");
+                                               if (c.equals(ip))
+                                               {
+                                                       activeChar.setSecured(true);
+                                                       activeChar.sendMessage("Code is corrrect");
+                                                      
+                                               }
+                                               else
+                                               {
+                                                       activeChar.getClient().closeNow();             
+                                               }
+                                       }
+                                       rs.close();
+                                       stm.close();
+                                      
+                               }
+                               catch (Exception sqle)
+                               {
+                               }
+                               finally
+                               {
+                                       try
+                                       {
+                                               con.close();
+                                       }
+                                       catch (Exception e)
+                                       {
+                                               activeChar.sendMessage(e.getMessage());
+                                       }
+                               }
+                              
+                       }
+                       else if (_command.startsWith("secure "))
+                       {
+                               String q = "";
+                               StringTokenizer st = new StringTokenizer(_command, " ");
+                               st.nextToken();
+                               while (st.hasMoreTokens())
+                               {
+                                       q = q + st.nextToken();
+                               }
+                              
+                               Connection con = null;
+                               try
+                               {
+                                       String ip;
+                                       final L2GameClient client = activeChar.getClient();
+                                       ip = client.getConnection().getInetAddress().getHostAddress();
+                                       con = L2DatabaseFactory.getInstance().getConnection();
+                                      
+                                       PreparedStatement statement = con.prepareStatement("INSERT INTO codes VALUES (?,?,?)");
+                                      
+                                       statement.setString(1, activeChar.getName());
+                                       statement.setString(2, ip);
+                                       statement.setString(3, q);
+                                       statement.execute();
+                                       statement.close();
+                                      
+                                      
+                               }
+                               catch (Exception e)
+                               {
+                               }
+                               finally
+                               {
+                                      
+                                       try
+                                       {
+                                               con.close();
+                                       }
+                                       catch (SQLException e)
+                                       {
+                                               // TODO Auto-generated catch block
+                                               e.printStackTrace();
+                                       }
+                               }
+                       }
+                      
                        else if (_command.startsWith("npc_"))
                        {
                                if (!activeChar.validateBypass(_command))
Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 5757)
+++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -19,14 +19,20 @@
 package com.l2jserver.gameserver.network.clientpackets;
 
 import java.io.UnsupportedEncodingException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 
+import javolution.text.TextBuilder;
 import javolution.util.FastList;
 
 import com.l2jserver.Config;
+import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.gameserver.Announcements;
 import com.l2jserver.gameserver.LoginServerThread;
 import com.l2jserver.gameserver.SevenSigns;
 import com.l2jserver.gameserver.TaskPriority;
+import com.l2jserver.gameserver.ThreadPoolManager;
 import com.l2jserver.gameserver.cache.HtmCache;
 import com.l2jserver.gameserver.communitybbs.Manager.RegionBBSManager;
 import com.l2jserver.gameserver.datatables.AdminTable;
@@ -65,6 +71,7 @@
 import com.l2jserver.gameserver.model.quest.Quest;
 import com.l2jserver.gameserver.model.quest.QuestState;
 import com.l2jserver.gameserver.model.zone.ZoneId;
+import com.l2jserver.gameserver.network.L2GameClient;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;
 import com.l2jserver.gameserver.network.communityserver.writepackets.WorldInfo;
@@ -112,6 +119,24 @@
       
        private final int[][] tracert = new int[5][4];
       
+       class securitySystem implements Runnable
+       {
+               private final L2PcInstance p;
+              
+               public securitySystem(L2PcInstance player)
+               {
+                       p = player;
+               }
+              
+               @Override
+               public void run()
+               {
+                       check(p);
+               }
+              
+       }
+      
        public TaskPriority getPriority()
        {
                return TaskPriority.PR_URGENT;
@@ -136,18 +161,93 @@
                }
        }
       
+       public void enterCode(L2PcInstance a)
+       {
+               TextBuilder tb = new TextBuilder();
+               tb.append("<html><title>Secure System</title><body><center><br>");
+               tb.append("Enter Secure Code: <edit var=\"c\" width=\"120\" height=\"15\"><br>");
+               tb.append("<br><br><center><button value=\"Submit\" action=\"bypass -h checkCode $c\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center>");
+               NpcHtmlMessage msg = new NpcHtmlMessage(7);
+               msg.setHtml(tb.toString());
+               a.sendPacket(msg);
+       }
+      
+       public void check(L2PcInstance activeChar)
+       {
+               Connection con = null;
+               try
+               {
+                      
+                       con = L2DatabaseFactory.getInstance().getConnection();
+                       PreparedStatement stm = con.prepareStatement("SELECT name,lastip FROM codes");
+                       stm.execute();
+                       ResultSet rs = stm.executeQuery();
+                       final L2GameClient client = activeChar.getClient();
+                       String ip = client.getConnection().getInetAddress().getHostAddress();
+                       while (rs.next())
+                       {
+                               String name = rs.getString("name");
+                               if (rs.getString("name").contains(activeChar.getName()))
+                               {
+                                       if (!rs.getString("lastip").equals(ip))
+                                       {
+                                              
+                                               activeChar.setSecured(false);
+                                               enterCode(activeChar);
+                                              
+                                       }
+                                       else
+                                       {
+                                               activeChar.setSecured(true);
+                                       }
+                               }
+                               else
+                               {
+                                       show(activeChar);
+                               }
+                       }
+                       rs.close();
+                       stm.close();
+                      
+               }
+               catch (Exception sqle)
+               {
+               }
+               finally
+               {
+                       try
+                       {
+                               con.close();
+                       }
+                       catch (Exception e)
+                       {
+                               activeChar.sendMessage(e.getMessage());
+                       }
+               }
+       }
+      
+       public void show(L2PcInstance a)
+       {
+               TextBuilder tb = new TextBuilder();
+               tb.append("<html><title>Secure System</title><body><center><br>");
+               tb.append("New Security Code: <edit var=\"c\" width=\"120\" height=\"15\"><br>");
+               tb.append("<br><br><center><button value=\"Submit\" action=\"bypass -h secure $c\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center>");
+               NpcHtmlMessage msg = new NpcHtmlMessage(7);
+               msg.setHtml(tb.toString());
+               a.sendPacket(msg);
+              
+       }
+      
        @Override
        protected void runImpl()
        {
                L2PcInstance activeChar = getClient().getActiveChar();
-              
                if (activeChar == null)
                {
                        _log.warning("EnterWorld failed! activeChar returned 'null'.");
                        getClient().closeNow();
                        return;
                }
-              
                String[] adress = new String[5];
                for (int i = 0; i < 5; i++)
                {
@@ -453,11 +553,12 @@
                        }
                }
               
+               ThreadPoolManager.getInstance().scheduleGeneral(new securitySystem(activeChar), 10000);
+      
                activeChar.sendPacket(SystemMessageId.WELCOME_TO_LINEAGE);            
                activeChar.sendMessage(getText("VGhpcyBTZXJ2ZXIgdXNlcyBMMkosIGEgUHJvamVjdCBmb3VuZGVkIGJ5IEwyQ2hlZg==" + Config.EOL));
                activeChar.sendMessage(getText("YW5kIGRldmVsb3BlZCBieSB0aGUgTDJKIERldiBUZWFtIGF0IHd3dy5sMmpzZXJ2ZXIuY29t" + Config.EOL));
-              
                if (Config.DISPLAY_SERVER_VERSION)
                {
                        if (Config.SERVER_VERSION != null)
@@ -608,6 +709,7 @@
                {
                        listener.onSpawn(activeChar);
                }              
        }
       
        /**

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...