Advertisement
Guest User

Bots Prevenções V1.1 Adapted By Revengeance

a guest
Jun 30th, 2016
657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 21.36 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2jaCis 360
  3.  
  4. Index: aCis_gameserver/config/l2jcustom/protect.properties
  5. ===================================================================
  6. --- aCis_gameserver/config/l2jcustom/protect.properties (revision 0)
  7. +++ aCis_gameserver/config/l2jcustom/protect.properties (working copy)
  8. @@ -0,0 +1,23 @@
  9. +# =================================================================
  10. +#                                Bots Prevention
  11. +# =================================================================
  12. +
  13. +# Bots prevention system.
  14. +EnableBotsPrevention = False
  15. +# How many monsters have to be killed to run validation task?
  16. +KillsCounter = 60
  17. +# Specify range of randomly taken values summed with main counter.
  18. +KillsCounterRandomization = 50
  19. +# How long validation window awaits an answer? (in seconds)
  20. +ValidationTime = 60
  21. +# Punishments:
  22. +0 = move character to the closest village.
  23. +#  1 = kick characters from the server.
  24. +2 = put character to jail.
  25. +3 = ban character from the server.
  26. +Punishment = 0
  27. +# How long character were suppose to stay in jail? (in minutes)
  28. +PunishmentTime = 60
  29. +
  30. +# Basic protection against L2Walker.
  31. +L2WalkerProtection = False
  32. Index: aCis_gameserver/config/server.properties
  33. ===================================================================
  34. --- aCis_gameserver/config/server.properties    (revision 2)
  35. +++ aCis_gameserver/config/server.properties    (working copy)
  36. @@ -295,9 +295,6 @@
  37.  #                                Misc
  38.  # =================================================================
  39.  
  40. -# Basic protection against L2Walker.
  41. -L2WalkerProtection = False
  42. -
  43.  # Zone setting.
  44.  #   0 = Peace All the Time
  45.  #   1 = PVP During Siege for siege participants
  46. Index: aCis_gameserver/java/net/sf/l2j/Config.java
  47. ===================================================================
  48. --- aCis_gameserver/java/net/sf/l2j/Config.java (revision 2)
  49. +++ aCis_gameserver/java/net/sf/l2j/Config.java (working copy)
  50. @@ -51,6 +51,7 @@
  51.     public static final String PLAYERS_FILE = "./config/players.properties";
  52.     public static final String SERVER_FILE = "./config/server.properties";
  53.     public static final String SIEGE_FILE = "./config/siege.properties";
  54. +   public static final String PROTECT_FILE = "./config/l2jcustom/protect.properties";
  55.    
  56.     // --------------------------------------------------
  57.     // Clans settings
  58. @@ -641,11 +642,19 @@
  59.     public static int THREADS_PER_INSTANT_THREAD_POOL;
  60.    
  61.     /** Misc */
  62. -   public static boolean L2WALKER_PROTECTION;
  63.     public static boolean SERVER_NEWS;
  64.     public static int ZONE_TOWN;
  65.     public static boolean DISABLE_TUTORIAL;
  66.    
  67. +   /** Bots Prevention */
  68. +   public static boolean L2WALKER_PROTECTION;
  69. +   public static boolean BOTS_PREVENTION;
  70. +   public static int KILLS_COUNTER;
  71. +   public static int KILLS_COUNTER_RANDOMIZATION;
  72. +   public static int VALIDATION_TIME;
  73. +   public static int PUNISHMENT;
  74. +   public static int PUNISHMENT_TIME;
  75. +  
  76.     // --------------------------------------------------
  77.     // Those "hidden" settings haven't configs to avoid admins to fuck their server
  78.     // You still can experiment changing values here. But don't say I didn't warn you.
  79. @@ -1359,6 +1368,23 @@
  80.     }
  81.    
  82.     /**
  83. +    * Loads protect settings.<br>
  84. +    * Bot Prevention.
  85. +    */
  86. +   private static final void loadProtect()
  87. +   {
  88. +       final ExProperties protect = initProperties(PROTECT_FILE);
  89. +       BOTS_PREVENTION = protect.getProperty("EnableBotsPrevention", false);
  90. +       KILLS_COUNTER = protect.getProperty("KillsCounter", 60);
  91. +       KILLS_COUNTER_RANDOMIZATION = protect.getProperty("KillsCounterRandomization", 50);
  92. +       VALIDATION_TIME = protect.getProperty("ValidationTime", 60);
  93. +       PUNISHMENT = protect.getProperty("Punishment", 0);
  94. +       PUNISHMENT_TIME = protect.getProperty("PunishmentTime", 60);
  95. +       L2WALKER_PROTECTION = protect.getProperty("L2WalkerProtection", false);
  96. +      
  97. +   }
  98. +  
  99. +   /**
  100.      * Loads loginserver settings.<br>
  101.      * IP addresses, database, account, misc.
  102.      */
  103. @@ -1427,6 +1453,9 @@
  104.        
  105.         // server settings
  106.         loadServer();
  107. +      
  108. +       // Protect settings
  109. +       loadProtect();
  110.     }
  111.    
  112.     public static final void loadLoginServer()
  113. Index: aCis_gameserver/java/net/sf/l2j/gameserver/instancemanager/BotsPreventionManager.java
  114. ===================================================================
  115. --- aCis_gameserver/java/net/sf/l2j/gameserver/instancemanager/BotsPreventionManager.java   (revision 0)
  116. +++ aCis_gameserver/java/net/sf/l2j/gameserver/instancemanager/BotsPreventionManager.java   (working copy)
  117. @@ -0,0 +1,466 @@
  118. +package net.sf.l2j.gameserver.instancemanager;
  119. +
  120. +import java.io.File;
  121. +import java.io.RandomAccessFile;
  122. +import java.sql.Connection;
  123. +import java.sql.PreparedStatement;
  124. +import java.sql.SQLException;
  125. +import java.util.ArrayList;
  126. +import java.util.Calendar;
  127. +import java.util.HashMap;
  128. +import java.util.List;
  129. +import java.util.Map;
  130. +import java.util.Random;
  131. +import java.util.concurrent.Future;
  132. +
  133. +import net.sf.l2j.commons.concurrent.ThreadPool;
  134. +
  135. +import net.sf.l2j.Config;
  136. +import net.sf.l2j.L2DatabaseFactory;
  137. +
  138. +import net.sf.l2j.commons.lang.StringUtil;
  139. +
  140. +import net.sf.l2j.gameserver.datatables.MapRegionTable.TeleportWhereType;
  141. +import net.sf.l2j.gameserver.model.actor.L2Character;
  142. +import net.sf.l2j.gameserver.model.actor.instance.L2MonsterInstance;
  143. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  144. +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  145. +import net.sf.l2j.gameserver.network.serverpackets.PledgeCrest;
  146. +
  147. +/**
  148. + * @Adaptacao Revengeance
  149. + */
  150. +
  151. +public class BotsPreventionManager
  152. +{
  153. +   private class PlayerData
  154. +   {
  155. +       public PlayerData()
  156. +       {
  157. +           firstWindow = true;
  158. +       }
  159. +      
  160. +       public int mainpattern;
  161. +       public List<Integer> options = new ArrayList<>();
  162. +       public boolean firstWindow;
  163. +       public int patternid;
  164. +   }
  165. +  
  166. +   protected Random _randomize;
  167. +   protected static Map<Integer, Integer> _monsterscounter;
  168. +   protected static Map<Integer, Future<?>> _beginvalidation;
  169. +   protected static Map<Integer, PlayerData> _validation;
  170. +   protected static Map<Integer, byte[]> _images;
  171. +   protected int WINDOW_DELAY = 3; //delay used to generate new window if previous have been closed.
  172. +   protected int VALIDATION_TIME = Config.VALIDATION_TIME * 1000;
  173. +  
  174. +   public static final BotsPreventionManager getInstance()
  175. +   {
  176. +       return SingletonHolder._instance;
  177. +   }
  178. +  
  179. +   BotsPreventionManager()
  180. +   {
  181. +       _randomize = new Random();
  182. +       _monsterscounter = new HashMap<>();
  183. +       _beginvalidation = new HashMap<>();
  184. +       _validation = new HashMap<>();
  185. +       _images = new HashMap<>();
  186. +       _beginvalidation = new HashMap<>();
  187. +      
  188. +       getimages();
  189. +   }
  190. +  
  191. +   public void updatecounter(L2Character player, L2Character monster)
  192. +   {
  193. +       if ((player instanceof L2PcInstance) && (monster instanceof L2MonsterInstance))
  194. +       {
  195. +           L2PcInstance killer = (L2PcInstance) player;
  196. +          
  197. +           if (_validation.get(killer.getObjectId()) != null)
  198. +           {
  199. +               return;
  200. +           }
  201. +          
  202. +           int count = 1;
  203. +           if (_monsterscounter.get(killer.getObjectId()) != null)
  204. +           {
  205. +               count = _monsterscounter.get(killer.getObjectId()) + 1;
  206. +           }
  207. +          
  208. +           int next = _randomize.nextInt(Config.KILLS_COUNTER_RANDOMIZATION);
  209. +           if (Config.KILLS_COUNTER + next < count)
  210. +           {
  211. +               validationtasks(killer);
  212. +               _monsterscounter.remove(killer.getObjectId());
  213. +           }
  214. +           else
  215. +           {
  216. +               _monsterscounter.put(killer.getObjectId(), count);
  217. +           }
  218. +       }
  219. +   }
  220. +  
  221. +   private static void getimages()
  222. +   {
  223. +       String CRESTS_DIR = "data/html/mods/prevention";
  224. +      
  225. +       final File directory = new File(CRESTS_DIR);
  226. +       directory.mkdirs();
  227. +      
  228. +       int i = 0;
  229. +       for (File file : directory.listFiles())
  230. +       {
  231. +           if (!file.getName().endsWith(".dds"))
  232. +               continue;
  233. +          
  234. +           byte[] data;
  235. +          
  236. +           try (RandomAccessFile f = new RandomAccessFile(file, "r"))
  237. +           {
  238. +               data = new byte[(int) f.length()];
  239. +               f.readFully(data);
  240. +           }
  241. +           catch (Exception e)
  242. +           {
  243. +               continue;
  244. +           }
  245. +           _images.put(i, data);
  246. +           i++;
  247. +       }
  248. +   }
  249. +  
  250. +   public void prevalidationwindow(L2PcInstance player)
  251. +   {
  252. +       NpcHtmlMessage html = new NpcHtmlMessage(1);
  253. +       StringBuilder tb = new StringBuilder();
  254. +       StringUtil.append(tb, "<html>");
  255. +       StringUtil.append(tb, "<title>Bots prevention</title>");
  256. +       StringUtil.append(tb, "<body><center><br><br><img src=\"L2UI_CH3.herotower_deco\" width=\"256\" height=\"32\">");
  257. +       StringUtil.append(tb, "<br><br><font color=\"a2a0a2\">if such window appears it means server suspect,<br1>that you may using cheating software.</font>");
  258. +       StringUtil.append(tb, "<br><br><font color=\"b09979\">if given answer results are incorrect or no action is made<br1>server is going to punish character instantly.</font>");
  259. +       StringUtil.append(tb, "<br><br><button value=\"CONTINUE\" action=\"bypass report_continue\" width=\"75\" height=\"21\" back=\"L2UI_CH3.Btn1_normal\" fore=\"L2UI_CH3.Btn1_normal\">");
  260. +       StringUtil.append(tb, "</center></body>");
  261. +       StringUtil.append(tb, "</html>");
  262. +       html.setHtml(tb.toString());
  263. +       player.sendPacket(html);
  264. +   }
  265. +  
  266. +   private static void validationwindow(L2PcInstance player)
  267. +   {
  268. +       PlayerData container = _validation.get(player.getObjectId());
  269. +       NpcHtmlMessage html = new NpcHtmlMessage(1);
  270. +      
  271. +       StringBuilder tb = new StringBuilder();
  272. +       StringUtil.append(tb, "<html>");
  273. +       StringUtil.append(tb, "<title>Bots prevention</title>");
  274. +       StringUtil.append(tb, "<body><center><br><br><img src=\"L2UI_CH3.herotower_deco\" width=\"256\" height=\"32\">");
  275. +       StringUtil.append(tb, "<br><br><font color=\"a2a0a2\">in order to prove you are a human being<br1>you've to</font> <font color=\"b09979\">match colours within generated pattern:</font>");
  276. +      
  277. +       // generated main pattern.
  278. +       StringUtil.append(tb, "<br><br><img src=\"Crest.crest_" + Config.SERVER_ID + "_" + (_validation.get(player.getObjectId()).patternid) + "\" width=\"32\" height=\"32\"></td></tr>");
  279. +       StringUtil.append(tb, "<br><br><font color=b09979>click-on pattern of your choice beneath:</font>");
  280. +      
  281. +       // generate random colours.
  282. +       StringUtil.append(tb, "<table><tr>");
  283. +       for (int i = 0; i < container.options.size(); i++)
  284. +       {
  285. +           StringUtil.append(tb, "<td><button action=\"bypass -h report_" + i + "\" width=32 height=32 back=\"Crest.crest_" + Config.SERVER_ID + "_" + (container.options.get(i) + 1500) + "\" fore=\"Crest.crest_" + Config.SERVER_ID + "_" + (container.options.get(i) + 1500) + "\"></td>");
  286. +       }
  287. +       StringUtil.append(tb, "</tr></table>");
  288. +       StringUtil.append(tb, "</center></body>");
  289. +       StringUtil.append(tb, "</html>");
  290. +      
  291. +       html.setHtml(tb.toString());
  292. +       player.sendPacket(html);
  293. +   }
  294. +  
  295. +   public void punishmentnwindow(L2PcInstance player)
  296. +   {
  297. +       NpcHtmlMessage html = new NpcHtmlMessage(1);
  298. +       StringBuilder tb = new StringBuilder();
  299. +       StringUtil.append(tb, "<html>");
  300. +       StringUtil.append(tb, "<title>Bots prevention</title>");
  301. +       StringUtil.append(tb, "<body><center><br><br><img src=\"L2UI_CH3.herotower_deco\" width=\"256\" height=\"32\">");
  302. +       StringUtil.append(tb, "<br><br><font color=\"a2a0a2\">if such window appears, it means character haven't<br1>passed through prevention system.");
  303. +       StringUtil.append(tb, "<br><br><font color=\"b09979\">in such case character get moved to nearest town.</font>");
  304. +       StringUtil.append(tb, "</center></body>");
  305. +       StringUtil.append(tb, "</html>");
  306. +       html.setHtml(tb.toString());
  307. +       player.sendPacket(html);
  308. +   }
  309. +  
  310. +   public void validationtasks(L2PcInstance player)
  311. +   {
  312. +       PlayerData container = new PlayerData();
  313. +       randomizeimages(container, player);
  314. +      
  315. +       for (int i = 0; i < container.options.size(); i++)
  316. +       {
  317. +           PledgeCrest packet = new PledgeCrest((container.options.get(i) + 1500), _images.get(container.options.get(i)));
  318. +           player.sendPacket(packet);
  319. +          
  320. +       }
  321. +      
  322. +       PledgeCrest packet = new PledgeCrest(container.patternid, _images.get(container.options.get(container.mainpattern)));
  323. +       player.sendPacket(packet);
  324. +      
  325. +       _validation.put(player.getObjectId(), container);
  326. +      
  327. +       Future<?> newTask = ThreadPool.schedule(new ReportCheckTask(player), VALIDATION_TIME);
  328. +       ThreadPool.schedule(new countdown(player, VALIDATION_TIME / 1000), 0);
  329. +       _beginvalidation.put(player.getObjectId(), newTask);
  330. +   }
  331. +  
  332. +   protected void randomizeimages(PlayerData container,L2PcInstance player)
  333. +   {
  334. +       int buttonscount = 4;
  335. +       int imagescount = _images.size();
  336. +      
  337. +       for (int i = 0; i < buttonscount; i++)
  338. +       {
  339. +           int next = _randomize.nextInt(imagescount);
  340. +           while (container.options.indexOf(next) > -1)
  341. +           {
  342. +               next = _randomize.nextInt(imagescount);
  343. +           }
  344. +           container.options.add(next);
  345. +       }
  346. +              
  347. +       int mainIndex = _randomize.nextInt(buttonscount);
  348. +       container.mainpattern = mainIndex; 
  349. +      
  350. +       Calendar token =  Calendar.getInstance();
  351. +       String uniquetoken = Integer.toString(token.get(Calendar.DAY_OF_MONTH))+Integer.toString(token.get(Calendar.HOUR_OF_DAY))+Integer.toString(token.get(Calendar.MINUTE))+Integer.toString(token.get(Calendar.SECOND))+Integer.toString(token.get(Calendar.MILLISECOND)/100);
  352. +       container.patternid = Integer.parseInt(uniquetoken);   
  353. +   }
  354. +  
  355. +   protected void banpunishment(L2PcInstance player)
  356. +   {
  357. +       _validation.remove(player.getObjectId());
  358. +       _beginvalidation.get(player.getObjectId()).cancel(true);
  359. +       _beginvalidation.remove(player.getObjectId());
  360. +      
  361. +       switch (Config.PUNISHMENT)
  362. +       {
  363. +       // 0 = move character to the closest village.
  364. +       // 1 = kick characters from the server.
  365. +       // 2 = put character to jail.
  366. +       // 3 = ban character from the server.
  367. +           case 0:
  368. +               player.stopMove(null);
  369. +               player.teleToLocation(TeleportWhereType.TOWN);
  370. +               punishmentnwindow(player);
  371. +               break;
  372. +           case 1:
  373. +               if (player.isOnline())
  374. +               {
  375. +                   player.logout(true);
  376. +               }
  377. +               break;
  378. +           case 2:
  379. +               jailpunishment(player, Config.PUNISHMENT_TIME * 60);
  380. +               break;
  381. +           case 3:
  382. +               //player.setAccessLevel(-100);
  383. +               changeaccesslevel(player, -100);
  384. +               break;
  385. +       }
  386. +      
  387. +       player.sendMessage("Unfortunately, colours doesn't match.");
  388. +   }
  389. +  
  390. +   private static void changeaccesslevel(L2PcInstance targetPlayer, int lvl)
  391. +   {
  392. +       if (targetPlayer.isOnline())
  393. +       {
  394. +           targetPlayer.setAccessLevel(lvl);
  395. +           targetPlayer.logout();
  396. +       }
  397. +       else
  398. +       {
  399. +           try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  400. +           {
  401. +               PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE obj_id=?");
  402. +               statement.setInt(1, lvl);
  403. +               statement.setInt(2, targetPlayer.getObjectId());
  404. +               statement.execute();
  405. +               statement.close();
  406. +           }
  407. +           catch (SQLException se)
  408. +           {
  409. +               if (Config.DEBUG)
  410. +                   se.printStackTrace();
  411. +           }
  412. +       }
  413. +   }
  414. +  
  415. +   private static void jailpunishment(L2PcInstance activeChar, int delay)
  416. +   {
  417. +       if (activeChar.isOnline())
  418. +       {
  419. +           activeChar.setPunishLevel(L2PcInstance.PunishLevel.JAIL, Config.PUNISHMENT_TIME);
  420. +       }
  421. +       else
  422. +       {
  423. +           try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  424. +           {
  425. +               PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE obj_id=?");
  426. +               statement.setInt(1, -114356);
  427. +               statement.setInt(2, -249645);
  428. +               statement.setInt(3, -2984);
  429. +               statement.setInt(4, L2PcInstance.PunishLevel.JAIL.value());
  430. +               statement.setLong(5, (delay > 0 ? delay * Config.PUNISHMENT_TIME * 100 : 0));
  431. +               statement.setInt(6, activeChar.getObjectId());
  432. +              
  433. +               statement.execute();
  434. +               statement.close();
  435. +           }
  436. +           catch (SQLException se)
  437. +           {
  438. +               activeChar.sendMessage("SQLException while jailing player");
  439. +               if (Config.DEBUG)
  440. +                   se.printStackTrace();
  441. +           }
  442. +       }
  443. +   }
  444. +  
  445. +   public void AnalyseBypass(String command, L2PcInstance player)
  446. +   {
  447. +       if (!_validation.containsKey(player.getObjectId()))
  448. +           return;
  449. +      
  450. +       String params = command.substring(command.indexOf("_") + 1);
  451. +      
  452. +       if (params.startsWith("continue"))
  453. +       {
  454. +           validationwindow(player);
  455. +           _validation.get(player.getObjectId()).firstWindow = false;
  456. +           return;
  457. +       }
  458. +      
  459. +       int choosenoption = -1;
  460. +       if (tryParseInt(params))
  461. +       {
  462. +           choosenoption = Integer.parseInt(params);
  463. +       }
  464. +      
  465. +       if (choosenoption > -1)
  466. +       {
  467. +           PlayerData playerData = _validation.get(player.getObjectId());
  468. +           if (choosenoption != playerData.mainpattern)
  469. +           {
  470. +               banpunishment(player);
  471. +           }
  472. +           else
  473. +           {
  474. +               player.sendMessage("Congratulations, colours match!");
  475. +               _validation.remove(player.getObjectId());
  476. +               _beginvalidation.get(player.getObjectId()).cancel(true);
  477. +               _beginvalidation.remove(player.getObjectId());
  478. +           }
  479. +       }
  480. +   }
  481. +  
  482. +   protected class countdown implements Runnable
  483. +   {
  484. +       private final L2PcInstance _player;
  485. +       private int _time;
  486. +      
  487. +       public countdown(L2PcInstance player, int time)
  488. +       {
  489. +           _time = time;
  490. +           _player = player;
  491. +       }
  492. +      
  493. +       @Override
  494. +       public void run()
  495. +       {
  496. +           if (_player.isOnline())
  497. +           {
  498. +               if (_validation.containsKey(_player.getObjectId()) && _validation.get(_player.getObjectId()).firstWindow)
  499. +               {
  500. +                   if (_time % WINDOW_DELAY == 0)
  501. +                   {
  502. +                       prevalidationwindow(_player);
  503. +                   }
  504. +               }
  505. +              
  506. +               switch (_time)
  507. +               {
  508. +                   case 300:
  509. +                   case 240:
  510. +                   case 180:
  511. +                   case 120:
  512. +                   case 60:
  513. +                       _player.sendMessage(_time / 60 + " minute(s) to match colors.");
  514. +                       break;
  515. +                   case 30:
  516. +                   case 10:
  517. +                   case 5:
  518. +                   case 4:
  519. +                   case 3:
  520. +                   case 2:
  521. +                   case 1:
  522. +                       _player.sendMessage(_time + " second(s) to match colors!");
  523. +                       break;
  524. +               }
  525. +               if (_time > 1 && _validation.containsKey(_player.getObjectId()))
  526. +               {
  527. +                   ThreadPool.schedule(new countdown(_player, _time - 1), 1000);
  528. +               }
  529. +           }
  530. +       }
  531. +   }
  532. +  
  533. +   protected boolean tryParseInt(String value)
  534. +   {
  535. +       try
  536. +       {
  537. +           Integer.parseInt(value);
  538. +           return true;
  539. +       }
  540. +      
  541. +       catch (NumberFormatException e)
  542. +       {
  543. +           return false;
  544. +       }
  545. +   }
  546. +  
  547. +   public void CaptchaSuccessfull(L2PcInstance player)
  548. +   {
  549. +       if (_validation.get(player.getObjectId()) != null)
  550. +       {
  551. +           _validation.remove(player.getObjectId());
  552. +       }
  553. +   }
  554. +  
  555. +   public Boolean IsAlredyInReportMode(L2PcInstance player)
  556. +   {
  557. +       if (_validation.get(player.getObjectId()) != null)
  558. +       {
  559. +           return true;
  560. +       }
  561. +       return false;
  562. +   }
  563. +  
  564. +   private class ReportCheckTask implements Runnable
  565. +   {
  566. +       private final L2PcInstance _player;
  567. +      
  568. +       public ReportCheckTask(L2PcInstance player)
  569. +       {
  570. +           _player = player;
  571. +       }
  572. +      
  573. +       @Override
  574. +       public void run()
  575. +       {
  576. +           if (_validation.get(_player.getObjectId()) != null)
  577. +           {
  578. +               banpunishment(_player);
  579. +           }
  580. +       }
  581. +   }
  582. +  
  583. +   private static class SingletonHolder
  584. +   {
  585. +       protected static final BotsPreventionManager _instance = new BotsPreventionManager();
  586. +   }
  587. +}
  588. Index: aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2Character.java
  589. ===================================================================
  590. --- aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2Character.java (revision 2)
  591. +++ aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/L2Character.java (working copy)
  592. @@ -36,6 +36,7 @@
  593.  import net.sf.l2j.gameserver.geoengine.GeoEngine;
  594.  import net.sf.l2j.gameserver.handler.ISkillHandler;
  595.  import net.sf.l2j.gameserver.handler.SkillHandler;
  596. +import net.sf.l2j.gameserver.instancemanager.BotsPreventionManager;
  597.  import net.sf.l2j.gameserver.instancemanager.DimensionalRiftManager;
  598.  import net.sf.l2j.gameserver.model.ChanceSkillList;
  599.  import net.sf.l2j.gameserver.model.CharEffectList;
  600. @@ -1527,6 +1528,11 @@
  601.         stopAllEffectsExceptThoseThatLastThroughDeath();
  602.        
  603.         calculateRewards(killer);
  604. +       if (Config.BOTS_PREVENTION)
  605. +       {
  606. +           BotsPreventionManager.getInstance().updatecounter(killer,this);
  607. +       }
  608. +
  609.        
  610.         // Send the Server->Client packet StatusUpdate with current HP and MP to all other L2PcInstance to inform
  611.         broadcastStatusUpdate();
  612. Index: aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
  613. ===================================================================
  614. --- aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (revision 2)
  615. +++ aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
  616. @@ -22,6 +22,7 @@
  617.  import net.sf.l2j.gameserver.datatables.AdminCommandAccessRights;
  618.  import net.sf.l2j.gameserver.handler.AdminCommandHandler;
  619.  import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  620. +import net.sf.l2j.gameserver.instancemanager.BotsPreventionManager;
  621.  import net.sf.l2j.gameserver.model.L2Object;
  622.  import net.sf.l2j.gameserver.model.L2World;
  623.  import net.sf.l2j.gameserver.model.actor.L2Npc;
  624. @@ -181,6 +182,11 @@
  625.                 final int arenaId = Integer.parseInt(_command.substring(12).trim());
  626.                 activeChar.enterOlympiadObserverMode(arenaId);
  627.             }
  628. +           else if (_command.startsWith("report"))
  629. +           {
  630. +               BotsPreventionManager.getInstance().AnalyseBypass(_command,activeChar);
  631. +           }
  632. +
  633.         }
  634.         catch (Exception e)
  635.         {
  636. Index: aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/PledgeCrest.java
  637. ===================================================================
  638. --- aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/PledgeCrest.java   (revision 2)
  639. +++ aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/PledgeCrest.java   (working copy)
  640. @@ -28,6 +28,12 @@
  641.         _data = CrestCache.getInstance().getCrest(CrestType.PLEDGE, _crestId);
  642.     }
  643.    
  644. +   public PledgeCrest(int crestId, byte[] data)
  645. +   {
  646. +       _crestId = crestId;
  647. +       _data = data;
  648. +   }
  649. +  
  650.     @Override
  651.     protected final void writeImpl()
  652.     {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement