Advertisement
Fabbian

Untitled

Apr 19th, 2016
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 113.07 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P Dream
  3. Index: Dream_GameServer/dist/config/main/player.properties
  4. ===================================================================
  5. --- Dream_GameServer/dist/config/main/player.properties (revision 83)
  6. +++ Dream_GameServer/dist/config/main/player.properties (working copy)
  7. @@ -240,6 +240,10 @@
  8. AutoLootHerbs = False
  9. AutoLootAdena = False
  10.  
  11. +# Items ID Cannot Auto Picked
  12. +# example : 1,2,3,4,5
  13. +NoAutoLootList = 0
  14. +
  15. #=======================================#
  16. # Addition to characters
  17. #=======================================#
  18. Index: Dream_GameServer/src/com/dream/game/manager/SaoManager.java
  19. ===================================================================
  20. --- Dream_GameServer/src/com/dream/game/manager/SaoManager.java (revision 0)
  21. +++ Dream_GameServer/src/com/dream/game/manager/SaoManager.java (working copy)
  22. @@ -0,0 +1,177 @@
  23. +/*
  24. + * This program is free software: you can redistribute it and/or modify it under
  25. + * the terms of the GNU General Public License as published by the Free Software
  26. + * Foundation, either version 3 of the License, or (at your option) any later
  27. + * version.
  28. + *
  29. + * This program is distributed in the hope that it will be useful, but WITHOUT
  30. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  31. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  32. + * details.
  33. + *
  34. + * You should have received a copy of the GNU General Public License along with
  35. + * this program. If not, see <http://www.gnu.org/licenses/>.
  36. + */
  37. +package com.dream.game.manager;
  38. +
  39. +import java.sql.Connection;
  40. +import java.sql.PreparedStatement;
  41. +import java.sql.ResultSet;
  42. +import java.util.Map;
  43. +import java.util.concurrent.ConcurrentHashMap;
  44. +import java.util.concurrent.ScheduledFuture;
  45. +
  46. +import org.apache.log4j.Logger;
  47. +
  48. +import com.dream.Config;
  49. +import com.dream.L2DatabaseFactory;
  50. +import com.dream.game.model.actor.instance.L2PcInstance;
  51. +import com.dream.game.model.world.L2World;
  52. +import com.dream.game.network.ThreadPoolManager;
  53. +import com.dream.game.network.serverpackets.Die;
  54. +import com.dream.game.network.serverpackets.ExShowScreenMessage;
  55. +
  56. +public class SaoManager
  57. +{
  58. + private static final Logger _log = Logger.getLogger(SaoManager.class.getName());
  59. +
  60. + private final Map<Integer, Long> _saos;
  61. + protected final Map<Integer, Long> _saosTask;
  62. + private ScheduledFuture<?> _scheduler;
  63. +
  64. + public static SaoManager getInstance()
  65. + {
  66. + return SingletonHolder._instance;
  67. + }
  68. +
  69. + protected SaoManager()
  70. + {
  71. + _saos = new ConcurrentHashMap<>();
  72. + _saosTask = new ConcurrentHashMap<>();
  73. + _scheduler = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new SaoTask(), 1000, 1000);
  74. + load();
  75. + }
  76. +
  77. + public void reload()
  78. + {
  79. + _saos.clear();
  80. + _saosTask.clear();
  81. + if (_scheduler != null)
  82. + _scheduler.cancel(true);
  83. + _scheduler = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new SaoTask(), 1000, 1000);
  84. + load();
  85. + }
  86. +
  87. + public void load()
  88. + {
  89. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  90. + {
  91. + PreparedStatement statement = con.prepareStatement("SELECT charId, duration FROM character_sao ORDER BY charId");
  92. + ResultSet rs = statement.executeQuery();
  93. + while (rs.next())
  94. + _saos.put(rs.getInt("charId"), rs.getLong("duration"));
  95. + rs.close();
  96. + statement.close();
  97. + }
  98. + catch (Exception e)
  99. + {
  100. + _log.warn("Exception: SaoManager load: " + e.getMessage());
  101. + }
  102. +
  103. + _log.info("SaoManager: Loaded " + _saos.size() + " characters with Sao mod actived.");
  104. + }
  105. +
  106. + public void addSao(int charId, long duration)
  107. + {
  108. + _saos.put(charId, duration);
  109. + _saosTask.put(charId, duration);
  110. + manageSaoPrivileges(charId);
  111. +
  112. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  113. + {
  114. + PreparedStatement statement = con.prepareStatement("INSERT INTO character_sao (charId, duration) VALUES (?, ?)");
  115. + statement.setInt(1, charId);
  116. + statement.setLong(2, duration);
  117. + statement.execute();
  118. + statement.close();
  119. + }
  120. + catch (Exception e)
  121. + {
  122. + _log.warn("Exception: SaoManager addSao: " + e.getMessage());
  123. + }
  124. + }
  125. +
  126. + public void removeSao(int charId)
  127. + {
  128. + _saos.remove(charId);
  129. + _saosTask.remove(charId);
  130. + manageSaoPrivileges(charId);
  131. +
  132. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  133. + {
  134. + PreparedStatement statement = con.prepareStatement("DELETE FROM character_sao WHERE charId = ?");
  135. + statement.setInt(1, charId);
  136. + statement.execute();
  137. + statement.close();
  138. + }
  139. + catch (Exception e)
  140. + {
  141. + _log.warn("Exception: SaoManager removeSao: " + e.getMessage());
  142. + }
  143. + }
  144. +
  145. + public boolean hasSaoPrivileges(int charId)
  146. + {
  147. + return _saos.containsKey(charId);
  148. + }
  149. +
  150. + public long getSaoDuration(int charId)
  151. + {
  152. + return _saos.get(charId);
  153. + }
  154. +
  155. + public void addSaoTask(int charId, long duration)
  156. + {
  157. + _saosTask.put(charId, duration);
  158. + }
  159. +
  160. + public void removeSaoTask(int charId)
  161. + {
  162. + _saosTask.remove(charId);
  163. + }
  164. +
  165. + public void manageSaoPrivileges(int charId)
  166. + {
  167. + final L2PcInstance player = L2World.getInstance().getPlayer(charId);
  168. + player.broadcastUserInfo();
  169. + }
  170. +
  171. + public class SaoTask implements Runnable
  172. + {
  173. + @Override
  174. + public final void run()
  175. + {
  176. + if (_saosTask.isEmpty())
  177. + return;
  178. +
  179. + for (Map.Entry<Integer, Long> entry : _saosTask.entrySet())
  180. + {
  181. + final long duration = entry.getValue();
  182. + if (System.currentTimeMillis() > duration)
  183. + {
  184. + final int charId = entry.getKey();
  185. + removeSao(charId);
  186. +
  187. + final L2PcInstance player = L2World.getInstance().getPlayer(charId);
  188. + player.sendPacket(new ExShowScreenMessage(Config.SAO_END_MSG, 10000));
  189. + player.sendPacket(new Die(player));
  190. + }
  191. + }
  192. + }
  193. + }
  194. +
  195. + private static class SingletonHolder
  196. + {
  197. + protected static final SaoManager _instance = new SaoManager();
  198. + }
  199. +}
  200. \ No newline at end of file
  201. Index: Dream_GameServer/src/com/dream/game/manager/VipManagerOne.java
  202. ===================================================================
  203. --- Dream_GameServer/src/com/dream/game/manager/VipManagerOne.java (revision 0)
  204. +++ Dream_GameServer/src/com/dream/game/manager/VipManagerOne.java (working copy)
  205. @@ -0,0 +1,179 @@
  206. +package com.dream.game.manager;
  207. +
  208. +import java.sql.Connection;
  209. +import java.sql.PreparedStatement;
  210. +import java.sql.ResultSet;
  211. +import java.util.Map;
  212. +import java.util.concurrent.ConcurrentHashMap;
  213. +import java.util.concurrent.ScheduledFuture;
  214. +import java.util.logging.Logger;
  215. +
  216. +import com.dream.L2DatabaseFactory;
  217. +import com.dream.game.model.actor.instance.L2PcInstance;
  218. +import com.dream.game.model.world.L2World;
  219. +import com.dream.game.network.ThreadPoolManager;
  220. +import com.dream.game.network.serverpackets.ExShowScreenMessage;
  221. +import com.dream.util.CloseUtil;
  222. +
  223. +/**
  224. + * @author rapfersan92
  225. + */
  226. +public class VipManagerOne
  227. +{
  228. + private static final Logger _log = Logger.getLogger(VipManager.class.getName());
  229. +
  230. + private final Map<Integer, Long> _vips;
  231. + protected final Map<Integer, Long> _vipsTask;
  232. + private ScheduledFuture<?> _scheduler;
  233. +
  234. + public static VipManager getInstance()
  235. + {
  236. + return SingletonHolder._instance;
  237. + }
  238. +
  239. + protected VipManagerOne()
  240. + {
  241. + _vips = new ConcurrentHashMap<>();
  242. + _vipsTask = new ConcurrentHashMap<>();
  243. + _scheduler = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new VipTask(), 1000, 1000);
  244. + load();
  245. + }
  246. +
  247. + public void reload()
  248. + {
  249. + _vips.clear();
  250. + _vipsTask.clear();
  251. + if (_scheduler != null)
  252. + _scheduler.cancel(true);
  253. + _scheduler = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new VipTask(), 1000, 1000);
  254. + load();
  255. + }
  256. +
  257. + public void load()
  258. + {
  259. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  260. + {
  261. + PreparedStatement statement = con.prepareStatement("SELECT charId, duration FROM character_vip_one ORDER BY charId");
  262. + ResultSet rs = statement.executeQuery();
  263. + while (rs.next())
  264. + _vips.put(rs.getInt("charId"), rs.getLong("duration"));
  265. + rs.close();
  266. + statement.close();
  267. + }
  268. + catch (Exception e)
  269. + {
  270. + _log.warning("Exception: VipManager load: " + e.getMessage());
  271. + }
  272. +
  273. + _log.info("VipManager: Loaded " + _vips.size() + " characters with vip privileges.");
  274. + }
  275. +
  276. + public void addVip(int charId, long duration)
  277. + {
  278. + _vips.put(charId, duration);
  279. + _vipsTask.put(charId, duration);
  280. + manageVipPrivileges(charId);
  281. + }
  282. +
  283. + public static void doVip(L2PcInstance player, int days)
  284. + {
  285. + if (player == null)
  286. + return;
  287. +
  288. + player.setEndTime("vip", days);
  289. +
  290. + Connection connection = null;
  291. + try
  292. + {
  293. + connection = L2DatabaseFactory.getInstance().getConnection();
  294. +
  295. + PreparedStatement statement = connection.prepareStatement("INSERT INTO character_vip_one (charId, duration) VALUES (?, ?)");
  296. + statement.setInt(1, player.getObjectId());
  297. + statement.setLong(2, player.getVipEndTime());
  298. + statement.execute();
  299. + statement.close();
  300. + connection.close();
  301. + }
  302. + catch (Exception e)
  303. + {
  304. +
  305. + }
  306. + finally
  307. + {
  308. + CloseUtil.close(connection);
  309. + }
  310. + }
  311. +
  312. + public void removeVip(int charId)
  313. + {
  314. + _vips.remove(charId);
  315. + _vipsTask.remove(charId);
  316. + manageVipPrivileges(charId);
  317. +
  318. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  319. + {
  320. + PreparedStatement statement = con.prepareStatement("DELETE FROM character_vip_one WHERE charId = ?");
  321. + statement.setInt(1, charId);
  322. + statement.execute();
  323. + statement.close();
  324. + }
  325. + catch (Exception e)
  326. + {
  327. + _log.warning("Exception: VipManager removeVip: " + e.getMessage());
  328. + }
  329. + }
  330. +
  331. + public boolean hasVipPrivileges(int charId)
  332. + {
  333. + return _vips.containsKey(charId);
  334. + }
  335. +
  336. + public long getVipDuration(int charId)
  337. + {
  338. + return _vips.get(charId);
  339. + }
  340. +
  341. + public void addVipTask(int charId, long duration)
  342. + {
  343. + _vipsTask.put(charId, duration);
  344. + }
  345. +
  346. + public void removeVipTask(int charId)
  347. + {
  348. + _vipsTask.remove(charId);
  349. + }
  350. +
  351. + public void manageVipPrivileges(int charId)
  352. + {
  353. + final L2PcInstance player = L2World.getInstance().getPlayer(charId);
  354. + player.broadcastUserInfo();
  355. + }
  356. +
  357. + public class VipTask implements Runnable
  358. + {
  359. + @Override
  360. + public final void run()
  361. + {
  362. + if (_vipsTask.isEmpty())
  363. + return;
  364. +
  365. + for (Map.Entry<Integer, Long> entry : _vipsTask.entrySet())
  366. + {
  367. + final long duration = entry.getValue();
  368. + if (System.currentTimeMillis() > duration)
  369. + {
  370. + final int charId = entry.getKey();
  371. + removeVip(charId);
  372. +
  373. + final L2PcInstance player = L2World.getInstance().getPlayer(charId);
  374. + player.sendPacket(new ExShowScreenMessage("Your vip privileges were removed.", 10000));
  375. + }
  376. + }
  377. + }
  378. + }
  379. +
  380. + private static class SingletonHolder
  381. + {
  382. + protected static final VipManager _instance = new VipManager();
  383. + }
  384. +}
  385. \ No newline at end of file
  386. Index: Dream_GameServer/src/com/dream/Config.java
  387. ===================================================================
  388. --- Dream_GameServer/src/com/dream/Config.java (revision 83)
  389. +++ Dream_GameServer/src/com/dream/Config.java (working copy)
  390. @@ -16,6 +16,7 @@
  391. import java.util.Map;
  392. import java.util.Properties;
  393. import java.util.StringTokenizer;
  394. +import java.util.concurrent.TimeUnit;
  395. import java.util.regex.Pattern;
  396.  
  397. import org.apache.log4j.Logger;
  398. @@ -27,6 +28,7 @@
  399. import com.dream.game.model.actor.instance.L2PcInstance;
  400. import com.dream.game.util.ClassMasterSettings;
  401.  
  402. +import javolution.text.TextBuilder;
  403. import javolution.text.TypeFormat;
  404.  
  405. public class Config extends L2Config
  406. @@ -68,6 +70,67 @@
  407. WorldObjectSet
  408. }
  409.  
  410. + public static String PHANTOM_PLAYERS_AKK;
  411. + public static boolean ALLOW_PHANTOM_PLAYERS = false;
  412. + public static int PHANTOM_PLAYERS_COUNT_FIRST;
  413. + public static boolean PHANTOM_PLAYERS_SOULSHOT_ANIM;
  414. + public static long PHANTOM_PLAYERS_DELAY_FIRST;
  415. + public static long PHANTOM_PLAYERS_DESPAWN_FIRST;
  416. + public static int PHANTOM_PLAYERS_DELAY_SPAWN_FIRST;
  417. + public static int PHANTOM_PLAYERS_DELAY_DESPAWN_FIRST;
  418. + public static int PHANTOM_PLAYERS_COUNT_NEXT;
  419. + public static long PHANTOM_PLAYERS_DELAY_NEXT;
  420. + public static long PHANTOM_PLAYERS_DESPAWN_NEXT;
  421. + public static int PHANTOM_PLAYERS_DELAY_SPAWN_NEXT;
  422. + public static int PHANTOM_PLAYERS_DELAY_DESPAWN_NEXT;
  423. + public static int PHANTOM_PLAYERS_ENCHANT_MIN;
  424. + public static int PHANTOM_PLAYERS_ENCHANT_MAX;
  425. + public static final ArrayList<Integer> PHANTOM_PLAYERS_NAME_CLOLORS = new ArrayList<>();
  426. + public static final ArrayList<Integer> PHANTOM_PLAYERS_TITLE_CLOLORS = new ArrayList<>();
  427. +
  428. + public static void loadPhantomConfig()
  429. + {
  430. + System.out.println("Loading: ./config/phantom/PhantomPlayers.properties.");
  431. + try
  432. + {
  433. + L2Properties localL2Properties = new L2Properties("./config/phantom/PhantomPlayers.properties");
  434. + PHANTOM_PLAYERS_AKK = localL2Properties.getProperty("PhantomPlayerAccounts", "l2jlovely.net");
  435. + PHANTOM_PLAYERS_SOULSHOT_ANIM = Boolean.parseBoolean(localL2Properties.getProperty("PhantomSoulshotAnimation", "True"));
  436. + PHANTOM_PLAYERS_COUNT_FIRST = Integer.parseInt(localL2Properties.getProperty("FirstCount", "50"));
  437. + PHANTOM_PLAYERS_DELAY_FIRST = TimeUnit.MINUTES.toMillis(Integer.parseInt(localL2Properties.getProperty("FirstDelay", "5")));
  438. + PHANTOM_PLAYERS_DESPAWN_FIRST = TimeUnit.MINUTES.toMillis(Integer.parseInt(localL2Properties.getProperty("FirstDespawn", "60")));
  439. + PHANTOM_PLAYERS_DELAY_SPAWN_FIRST = (int) TimeUnit.SECONDS.toMillis(Integer.parseInt(localL2Properties.getProperty("FirstDelaySpawn", "1")));
  440. + PHANTOM_PLAYERS_DELAY_DESPAWN_FIRST = (int) TimeUnit.SECONDS.toMillis(Integer.parseInt(localL2Properties.getProperty("FirstDelayDespawn", "20")));
  441. + PHANTOM_PLAYERS_COUNT_NEXT = Integer.parseInt(localL2Properties.getProperty("NextCount", "50"));
  442. + PHANTOM_PLAYERS_DELAY_NEXT = TimeUnit.MINUTES.toMillis(Integer.parseInt(localL2Properties.getProperty("NextDelay", "15")));
  443. + PHANTOM_PLAYERS_DESPAWN_NEXT = TimeUnit.MINUTES.toMillis(Integer.parseInt(localL2Properties.getProperty("NextDespawn", "90")));
  444. + PHANTOM_PLAYERS_DELAY_SPAWN_NEXT = (int) TimeUnit.SECONDS.toMillis(Integer.parseInt(localL2Properties.getProperty("NextDelaySpawn", "20")));
  445. + PHANTOM_PLAYERS_DELAY_DESPAWN_NEXT = (int) TimeUnit.SECONDS.toMillis(Integer.parseInt(localL2Properties.getProperty("NextDelayDespawn", "30")));
  446. + String[] arrayOfString12 = localL2Properties.getProperty("FakeEnchant", "0,14").split(",");
  447. + PHANTOM_PLAYERS_ENCHANT_MIN = Integer.parseInt(arrayOfString12[0]);
  448. + PHANTOM_PLAYERS_ENCHANT_MAX = Integer.parseInt(arrayOfString12[1]);
  449. + arrayOfString12 = localL2Properties.getProperty("FakeNameColors", "FFFFFF,FFFFFF").split(",");
  450. +
  451. + String mode1;
  452. + for (String mode : arrayOfString12)
  453. + {
  454. + mode1 = new TextBuilder(mode).reverse().toString();
  455. + PHANTOM_PLAYERS_NAME_CLOLORS.add(Integer.decode("0x" + mode1));
  456. + }
  457. + arrayOfString12 = localL2Properties.getProperty("FakeTitleColors", "FFFF77,FFFF77").split(",");
  458. + for (String mode : arrayOfString12)
  459. + {
  460. + mode1 = new TextBuilder(mode).reverse().toString();
  461. + PHANTOM_PLAYERS_TITLE_CLOLORS.add(Integer.decode("0x" + mode1));
  462. + }
  463. + }
  464. + catch (Exception localException)
  465. + {
  466. + _log.error(localException.getMessage(), localException);
  467. + throw new Error("Failed to Load ./config/phantom/PhantomPlayers.properties File.");
  468. + }
  469. + }
  470. +
  471. public static boolean ENABLE_EVENT_MANAGER;
  472.  
  473. public static int EVENT_MANAGER_ID;
  474. @@ -159,6 +222,7 @@
  475. public static boolean SHOW_DEBUFF_ONLY;
  476. public static boolean ALLOW_AUTO_LOOT;
  477. public static boolean AUTO_LOOT;
  478. + public static ArrayList<Integer> NO_AUTO_LOOT_LIST = new ArrayList<>();
  479. public static boolean AUTO_LOOT_RAID;
  480. public static boolean AUTO_LOOT_HERBS;
  481. public static boolean AUTO_LOOT_ADENA;
  482. @@ -1718,6 +1782,52 @@
  483. }
  484. }
  485.  
  486. + public static boolean ALLOW_SAO_MOD;
  487. + public static int SAO_TIME_CONFIG;
  488. + public static int SAO_TIME_CONFIG_MULTIPLIER;
  489. + public static String SAO_END_MSG;
  490. + public static String SAO_START_MSG;
  491. + public static String SAO_TIME_INFO;
  492. +
  493. + public static boolean ALLOW_VIP_CHARACTERS;
  494. + public static int VIP_TITLE_COLOR;
  495. + public static int VIP_TITLE_COLOR_ONE;
  496. + public static int VIP_TITLE_COLOR_TWO;
  497. + public static int VIP_RATE_DROP_ADENA;
  498. + public static int VIP_RATE_DROP_ADENA_ONE;
  499. + public static int VIP_RATE_DROP_ADENA_TWO;
  500. + public static int VIP_RATE_DROP_SPOIL;
  501. + public static int VIP_RATE_DROP_SPOIL_ONE;
  502. + public static int VIP_RATE_DROP_SPOIL_TWO;
  503. + public static int VIP_RATE_DROP;
  504. + public static int VIP_RATE_DROP_ONE;
  505. + public static int VIP_RATE_DROP_TWO;
  506. + public static int VIP_RATE_DROP_BLUESEAL;
  507. + public static int VIP_RATE_DROP_BLUESEAL_ONE;
  508. + public static int VIP_RATE_DROP_BLUESEAL_TWO;
  509. + public static int VIP_RATE_DROP_GREENSEAL;
  510. + public static int VIP_RATE_DROP_GREENSEAL_ONE;
  511. + public static int VIP_RATE_DROP_GREENSEAL_TWO;
  512. + public static int VIP_RATE_DROP_REDSEAL;
  513. + public static int VIP_RATE_DROP_REDSEAL_ONE;
  514. + public static int VIP_RATE_DROP_REDSEAL_TWO;
  515. + public static int RATE_DROP_BLUESEAL;
  516. + public static int RATE_DROP_GREENSEAL;
  517. + public static int RATE_DROP_REDSEAL;
  518. + public static int VIP_RATE_XP;
  519. + public static int VIP_RATE_XP_ONE;
  520. + public static int VIP_RATE_XP_TWO;
  521. + public static int VIP_RATE_SP;
  522. + public static int VIP_RATE_SP_ONE;
  523. + public static int VIP_RATE_SP_TWO;
  524. + public static int VIP_ITEM_ID;
  525. + public static int VIP_ITEM_ID_ONE;
  526. + public static int VIP_ITEM_ID_TWO;
  527. + public static int VIP_ITEM_DAYS;
  528. + public static int VIP_ITEM_DAYS_ONE;
  529. + public static int VIP_ITEM_DAYS_TWO;
  530. + public static int VIP_ITEM_MULTIPLIER;
  531. +
  532. public static void loadMods()
  533. {
  534. try
  535. @@ -1798,6 +1908,53 @@
  536. SPAWN_EVENT_MANAGER = Boolean.parseBoolean(p.getProperty("EnableAutoSpawn", "false"));
  537.  
  538. ACTIVATED_SYSTEM = Boolean.parseBoolean(p.getProperty("ActivateSystem", "false"));
  539. +
  540. + ALLOW_SAO_MOD = Boolean.parseBoolean(p.getProperty("AllowSaoMod", "false"));
  541. + SAO_TIME_CONFIG = Integer.parseInt(p.getProperty("SaoTimeConfig", "1"));
  542. + SAO_TIME_CONFIG_MULTIPLIER = Integer.parseInt(p.getProperty("SaoTimeMultiplier", "3600000"));
  543. + SAO_START_MSG = p.getProperty("SaoStartMsg", "Your Sao restrictions were added.");
  544. + SAO_END_MSG = p.getProperty("SaoEndMsg", "Your Sao restrictions were removed.");
  545. + SAO_TIME_INFO = p.getProperty("SaoInfoMsg", "Your Sao restrictions end at");
  546. +
  547. + ALLOW_VIP_CHARACTERS = Boolean.parseBoolean(p.getProperty("AllowVipCharacters", "False"));
  548. + VIP_TITLE_COLOR = Integer.decode("0x" + p.getProperty("VipTitleColor", "00FF00"));
  549. + VIP_TITLE_COLOR_ONE = Integer.decode("0x" + p.getProperty("VipTitleColorOne", "00FF00"));
  550. + VIP_TITLE_COLOR_TWO = Integer.decode("0x" + p.getProperty("VipTitleColorTwo", "00FF00"));
  551. + VIP_RATE_DROP_ADENA = Integer.parseInt(p.getProperty("VipDropAdena", "1"));
  552. + VIP_RATE_DROP_ADENA_ONE = Integer.parseInt(p.getProperty("VipDropAdenaOne", "1"));
  553. + VIP_RATE_DROP_ADENA_TWO = Integer.parseInt(p.getProperty("VipDropAdenaTwo", "1"));
  554. + VIP_RATE_DROP_SPOIL = Integer.parseInt(p.getProperty("VipDropSpoil", "1"));
  555. + VIP_RATE_DROP_SPOIL_ONE = Integer.parseInt(p.getProperty("VipDropSpoilOne", "1"));
  556. + VIP_RATE_DROP_SPOIL_TWO = Integer.parseInt(p.getProperty("VipDropSpoilTwo", "1"));
  557. + VIP_RATE_DROP = Integer.parseInt(p.getProperty("VipDrop", "1"));
  558. + VIP_RATE_DROP_ONE = Integer.parseInt(p.getProperty("VipDropOne", "1"));
  559. + VIP_RATE_DROP_TWO = Integer.parseInt(p.getProperty("VipDropTwo", "1"));
  560. +
  561. + VIP_RATE_DROP_BLUESEAL = Integer.parseInt(p.getProperty("VipDropBlueSeal", "1"));
  562. + VIP_RATE_DROP_BLUESEAL_ONE = Integer.parseInt(p.getProperty("VipDropBlueSealOne", "1"));
  563. + VIP_RATE_DROP_BLUESEAL_TWO = Integer.parseInt(p.getProperty("VipDropBlueSealTwo", "1"));
  564. + VIP_RATE_DROP_GREENSEAL = Integer.parseInt(p.getProperty("VipDropGreenSeal", "1"));
  565. + VIP_RATE_DROP_GREENSEAL_ONE = Integer.parseInt(p.getProperty("VipDropGreenSealOne", "1"));
  566. + VIP_RATE_DROP_GREENSEAL_TWO = Integer.parseInt(p.getProperty("VipDropGreenSealTwo", "1"));
  567. + VIP_RATE_DROP_REDSEAL = Integer.parseInt(p.getProperty("VipDropRedSeal", "1"));
  568. + VIP_RATE_DROP_REDSEAL_ONE = Integer.parseInt(p.getProperty("VipDropRedSealOne", "1"));
  569. + VIP_RATE_DROP_REDSEAL_TWO = Integer.parseInt(p.getProperty("VipDropRedSealTwo", "1"));
  570. + RATE_DROP_BLUESEAL = Integer.parseInt(p.getProperty("DropBlueSeal", "1"));
  571. + RATE_DROP_GREENSEAL = Integer.parseInt(p.getProperty("DropGreenSeal", "1"));
  572. + RATE_DROP_REDSEAL = Integer.parseInt(p.getProperty("DropRedSeal", "1"));
  573. +
  574. + VIP_RATE_XP = Integer.parseInt(p.getProperty("VipExpRate", "1"));
  575. + VIP_RATE_XP_ONE = Integer.parseInt(p.getProperty("VipExpRateOne", "1"));
  576. + VIP_RATE_XP_TWO = Integer.parseInt(p.getProperty("VipExpRateTwo", "1"));
  577. + VIP_RATE_SP = Integer.parseInt(p.getProperty("VipSpRate", "1"));
  578. + VIP_RATE_SP_ONE = Integer.parseInt(p.getProperty("VipSpRateOne", "1"));
  579. + VIP_RATE_SP_TWO = Integer.parseInt(p.getProperty("VipSpRateTwo", "1"));
  580. + VIP_ITEM_ID = Integer.parseInt(p.getProperty("VipItemId", "9955"));
  581. + VIP_ITEM_ID_ONE = Integer.parseInt(p.getProperty("VipItemIdOne", "9955"));
  582. + VIP_ITEM_ID_TWO = Integer.parseInt(p.getProperty("VipItemIdTwo", "9955"));
  583. + VIP_ITEM_DAYS = Integer.parseInt(p.getProperty("VipItemDays", "30"));
  584. + VIP_ITEM_DAYS_ONE = Integer.parseInt(p.getProperty("VipItemDaysOne", "30"));
  585. + VIP_ITEM_DAYS_TWO = Integer.parseInt(p.getProperty("VipItemDaysTwo", "30"));
  586. }
  587. catch (Exception e)
  588. {
  589. @@ -1961,6 +2118,9 @@
  590. }
  591. }
  592.  
  593. + public static boolean OFF_TELEPORTER_ENABLE;
  594. + public static List<Integer> OFF_ACCEPTED_TELEPORTERS = new ArrayList<>();
  595. +
  596. public static void loadOptionsConfig()
  597. {
  598. try
  599. @@ -2102,6 +2262,16 @@
  600. }
  601. SHOUT_CHAT_LEVEL = Integer.parseInt(p.getProperty("ShoutChatLevel", "1"));
  602. TRADE_CHAT_LEVEL = Integer.parseInt(p.getProperty("TradeChatLevel", "1"));
  603. +
  604. + OFF_TELEPORTER_ENABLE = Boolean.valueOf(p.getProperty("EnableOFFTeleporter", "false"));
  605. + if (OFF_TELEPORTER_ENABLE)
  606. + {
  607. + OFF_ACCEPTED_TELEPORTERS = new ArrayList<>();
  608. + for (String type : p.getProperty("OFFAcceptedTeleportersId", "30080").split(","))
  609. + {
  610. + OFF_ACCEPTED_TELEPORTERS.add(Integer.valueOf(type));
  611. + }
  612. + }
  613. }
  614. catch (Exception e)
  615. {
  616. @@ -2190,6 +2360,22 @@
  617. AUTO_LOOT_HERBS = p.getProperty("AutoLootHerbs").trim().equalsIgnoreCase("true");
  618. AUTO_LOOT_ADENA = p.getProperty("AutoLootAdena").trim().equalsIgnoreCase("true");
  619.  
  620. + String[] noAutoLoot = p.getProperty("NoAutoLootList", "0").split(",");
  621. + if (noAutoLoot.length > 0)
  622. + {
  623. + for (String id : noAutoLoot)
  624. + {
  625. + try
  626. + {
  627. + int npcId = Integer.valueOf(id);
  628. + if (npcId != 0)
  629. + NO_AUTO_LOOT_LIST.add(npcId);
  630. + }
  631. + catch (NumberFormatException nfe)
  632. + {
  633. + }
  634. + }
  635. + }
  636. PLAYER_SPAWN_PROTECTION = Integer.parseInt(p.getProperty("PlayerSpawnProtection", "5"));
  637. PLAYER_FAKEDEATH_UP_PROTECTION = Integer.parseInt(p.getProperty("PlayerFakeDeathUpProtection", "0"));
  638. DEATH_PENALTY_CHANCE = Integer.parseInt(p.getProperty("DeathPenaltyChance", "20"));
  639. Index: Dream_GameServer/src/com/dream/game/network/SystemMessageId.java
  640. ===================================================================
  641. --- Dream_GameServer/src/com/dream/game/network/SystemMessageId.java (revision 83)
  642. +++ Dream_GameServer/src/com/dream/game/network/SystemMessageId.java (working copy)
  643. @@ -12237,8 +12237,14 @@
  644. * ID: 680<br>
  645. * Message: You cannot participate in an auction.
  646. */
  647. - CANNOT_PARTICIPATE_IN_AN_AUCTION(680);
  648. + CANNOT_PARTICIPATE_IN_AN_AUCTION(680),
  649.  
  650. + /**
  651. + * ID: 2155<br>
  652. + * Message: You will be moved to (). Do you wish to continue?
  653. + */
  654. + OFF_REQUEST_TELEPORTER(2155);
  655. +
  656. public static final SystemMessageId getSystemMessageId(int id)
  657. {
  658. return getSystemMessageId(id, true);
  659. Index: Dream_GameServer/src/com/dream/game/manager/VipManagerTwo.java
  660. ===================================================================
  661. --- Dream_GameServer/src/com/dream/game/manager/VipManagerTwo.java (revision 0)
  662. +++ Dream_GameServer/src/com/dream/game/manager/VipManagerTwo.java (working copy)
  663. @@ -0,0 +1,179 @@
  664. +package com.dream.game.manager;
  665. +
  666. +import java.sql.Connection;
  667. +import java.sql.PreparedStatement;
  668. +import java.sql.ResultSet;
  669. +import java.util.Map;
  670. +import java.util.concurrent.ConcurrentHashMap;
  671. +import java.util.concurrent.ScheduledFuture;
  672. +import java.util.logging.Logger;
  673. +
  674. +import com.dream.L2DatabaseFactory;
  675. +import com.dream.game.model.actor.instance.L2PcInstance;
  676. +import com.dream.game.model.world.L2World;
  677. +import com.dream.game.network.ThreadPoolManager;
  678. +import com.dream.game.network.serverpackets.ExShowScreenMessage;
  679. +import com.dream.util.CloseUtil;
  680. +
  681. +/**
  682. + * @author rapfersan92
  683. + */
  684. +public class VipManagerTwo
  685. +{
  686. + private static final Logger _log = Logger.getLogger(VipManager.class.getName());
  687. +
  688. + private final Map<Integer, Long> _vips;
  689. + protected final Map<Integer, Long> _vipsTask;
  690. + private ScheduledFuture<?> _scheduler;
  691. +
  692. + public static VipManager getInstance()
  693. + {
  694. + return SingletonHolder._instance;
  695. + }
  696. +
  697. + protected VipManagerTwo()
  698. + {
  699. + _vips = new ConcurrentHashMap<>();
  700. + _vipsTask = new ConcurrentHashMap<>();
  701. + _scheduler = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new VipTask(), 1000, 1000);
  702. + load();
  703. + }
  704. +
  705. + public void reload()
  706. + {
  707. + _vips.clear();
  708. + _vipsTask.clear();
  709. + if (_scheduler != null)
  710. + _scheduler.cancel(true);
  711. + _scheduler = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new VipTask(), 1000, 1000);
  712. + load();
  713. + }
  714. +
  715. + public void load()
  716. + {
  717. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  718. + {
  719. + PreparedStatement statement = con.prepareStatement("SELECT charId, duration FROM character_vip_two ORDER BY charId");
  720. + ResultSet rs = statement.executeQuery();
  721. + while (rs.next())
  722. + _vips.put(rs.getInt("charId"), rs.getLong("duration"));
  723. + rs.close();
  724. + statement.close();
  725. + }
  726. + catch (Exception e)
  727. + {
  728. + _log.warning("Exception: VipManager load: " + e.getMessage());
  729. + }
  730. +
  731. + _log.info("VipManager: Loaded " + _vips.size() + " characters with vip privileges.");
  732. + }
  733. +
  734. + public void addVip(int charId, long duration)
  735. + {
  736. + _vips.put(charId, duration);
  737. + _vipsTask.put(charId, duration);
  738. + manageVipPrivileges(charId);
  739. + }
  740. +
  741. + public static void doVip(L2PcInstance player, int days)
  742. + {
  743. + if (player == null)
  744. + return;
  745. +
  746. + player.setEndTime("vip", days);
  747. +
  748. + Connection connection = null;
  749. + try
  750. + {
  751. + connection = L2DatabaseFactory.getInstance().getConnection();
  752. +
  753. + PreparedStatement statement = connection.prepareStatement("INSERT INTO character_vip_two (charId, duration) VALUES (?, ?)");
  754. + statement.setInt(1, player.getObjectId());
  755. + statement.setLong(2, player.getVipEndTime());
  756. + statement.execute();
  757. + statement.close();
  758. + connection.close();
  759. + }
  760. + catch (Exception e)
  761. + {
  762. +
  763. + }
  764. + finally
  765. + {
  766. + CloseUtil.close(connection);
  767. + }
  768. + }
  769. +
  770. + public void removeVip(int charId)
  771. + {
  772. + _vips.remove(charId);
  773. + _vipsTask.remove(charId);
  774. + manageVipPrivileges(charId);
  775. +
  776. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  777. + {
  778. + PreparedStatement statement = con.prepareStatement("DELETE FROM character_vip_two WHERE charId = ?");
  779. + statement.setInt(1, charId);
  780. + statement.execute();
  781. + statement.close();
  782. + }
  783. + catch (Exception e)
  784. + {
  785. + _log.warning("Exception: VipManager removeVip: " + e.getMessage());
  786. + }
  787. + }
  788. +
  789. + public boolean hasVipPrivileges(int charId)
  790. + {
  791. + return _vips.containsKey(charId);
  792. + }
  793. +
  794. + public long getVipDuration(int charId)
  795. + {
  796. + return _vips.get(charId);
  797. + }
  798. +
  799. + public void addVipTask(int charId, long duration)
  800. + {
  801. + _vipsTask.put(charId, duration);
  802. + }
  803. +
  804. + public void removeVipTask(int charId)
  805. + {
  806. + _vipsTask.remove(charId);
  807. + }
  808. +
  809. + public void manageVipPrivileges(int charId)
  810. + {
  811. + final L2PcInstance player = L2World.getInstance().getPlayer(charId);
  812. + player.broadcastUserInfo();
  813. + }
  814. +
  815. + public class VipTask implements Runnable
  816. + {
  817. + @Override
  818. + public final void run()
  819. + {
  820. + if (_vipsTask.isEmpty())
  821. + return;
  822. +
  823. + for (Map.Entry<Integer, Long> entry : _vipsTask.entrySet())
  824. + {
  825. + final long duration = entry.getValue();
  826. + if (System.currentTimeMillis() > duration)
  827. + {
  828. + final int charId = entry.getKey();
  829. + removeVip(charId);
  830. +
  831. + final L2PcInstance player = L2World.getInstance().getPlayer(charId);
  832. + player.sendPacket(new ExShowScreenMessage("Your vip privileges were removed.", 10000));
  833. + }
  834. + }
  835. + }
  836. + }
  837. +
  838. + private static class SingletonHolder
  839. + {
  840. + protected static final VipManager _instance = new VipManager();
  841. + }
  842. +}
  843. \ No newline at end of file
  844. Index: Dream_DataPack/sql/server/character_sao.sql
  845. ===================================================================
  846. --- Dream_DataPack/sql/server/character_sao.sql (revision 0)
  847. +++ Dream_DataPack/sql/server/character_sao.sql (working copy)
  848. @@ -0,0 +1,5 @@
  849. +CREATE TABLE IF NOT EXISTS `character_sao` (
  850. + `objectId` INT NOT NULL DEFAULT 0,
  851. + `duration` BIGINT NOT NULL DEFAULT 0,
  852. + PRIMARY KEY (`objectId`)
  853. +);
  854. \ No newline at end of file
  855. Index: Dream_GameServer/src/com/dream/game/L2GameServer.java
  856. ===================================================================
  857. --- Dream_GameServer/src/com/dream/game/L2GameServer.java (revision 83)
  858. +++ Dream_GameServer/src/com/dream/game/L2GameServer.java (working copy)
  859. @@ -87,10 +87,12 @@
  860. import com.dream.game.manager.QuestManager;
  861. import com.dream.game.manager.RaidBossSpawnManager;
  862. import com.dream.game.manager.RaidPointsManager;
  863. +import com.dream.game.manager.SaoManager;
  864. import com.dream.game.manager.SiegeManager;
  865. import com.dream.game.manager.SiegeRewardManager;
  866. import com.dream.game.manager.TaskManager;
  867. import com.dream.game.manager.TownManager;
  868. +import com.dream.game.manager.VipManager;
  869. import com.dream.game.manager.clanhallsiege.BanditStrongholdSiege;
  870. import com.dream.game.manager.clanhallsiege.DevastatedCastleSiege;
  871. import com.dream.game.manager.clanhallsiege.FortResistSiegeManager;
  872. @@ -463,6 +465,8 @@
  873. TaskManager.getInstance();
  874. GmListTable.getInstance();
  875. PetitionManager.getInstance();
  876. + SaoManager.getInstance();
  877. + VipManager.getInstance();
  878.  
  879. if (Config.COMMUNITY_TYPE.equals("full"))
  880. {
  881. Index: Dream_GameServer/src/com/dream/game/manager/BossSpawnManager.java
  882. ===================================================================
  883. --- Dream_GameServer/src/com/dream/game/manager/BossSpawnManager.java (revision 83)
  884. +++ Dream_GameServer/src/com/dream/game/manager/BossSpawnManager.java (working copy)
  885. @@ -27,6 +27,7 @@
  886. import com.dream.game.model.L2Spawn;
  887. import com.dream.game.network.ThreadPoolManager;
  888. import com.dream.game.templates.chars.L2NpcTemplate;
  889. +import com.dream.game.util.Broadcast;
  890. import com.dream.tools.random.Rnd;
  891. import com.dream.util.StatsSet;
  892.  
  893. @@ -68,7 +69,7 @@
  894.  
  895. _storedInfo.put(bossId, info);
  896.  
  897. - GmListTable.broadcastMessageToGMs("Spawning Raid Boss " + raidboss.getName());
  898. + Broadcast.announceToOnlinePlayers("Spawning Raid Boss " + raidboss.getName());
  899.  
  900. _bosses.put(bossId, raidboss);
  901. }
  902. Index: Dream_GameServer/src/com/dream/game/model/actor/instance/L2PcInstance.java
  903. ===================================================================
  904. --- Dream_GameServer/src/com/dream/game/model/actor/instance/L2PcInstance.java (revision 83)
  905. +++ Dream_GameServer/src/com/dream/game/model/actor/instance/L2PcInstance.java (working copy)
  906. @@ -4,11 +4,14 @@
  907. import java.sql.PreparedStatement;
  908. import java.sql.ResultSet;
  909. import java.sql.SQLException;
  910. +import java.text.SimpleDateFormat;
  911. import java.util.ArrayList;
  912. import java.util.Calendar;
  913. import java.util.Collection;
  914. +import java.util.Date;
  915. import java.util.HashMap;
  916. import java.util.HashSet;
  917. +import java.util.Iterator;
  918. import java.util.LinkedHashMap;
  919. import java.util.List;
  920. import java.util.Map;
  921. @@ -64,6 +67,7 @@
  922. import com.dream.game.manager.PartyRoomManager;
  923. import com.dream.game.manager.QuestManager;
  924. import com.dream.game.manager.RecipeController;
  925. +import com.dream.game.manager.SaoManager;
  926. import com.dream.game.manager.SiegeManager;
  927. import com.dream.game.model.BlockList;
  928. import com.dream.game.model.CursedWeapon;
  929. @@ -98,6 +102,7 @@
  930. import com.dream.game.model.actor.L2Summon;
  931. import com.dream.game.model.actor.appearance.PcAppearance;
  932. import com.dream.game.model.actor.knownlist.PcKnownList;
  933. +import com.dream.game.model.actor.position.L2CharPosition;
  934. import com.dream.game.model.actor.reference.ClearableReference;
  935. import com.dream.game.model.actor.reference.ImmutableReference;
  936. import com.dream.game.model.actor.stat.PcStat;
  937. @@ -130,6 +135,7 @@
  938. import com.dream.game.model.restriction.ObjectRestrictions;
  939. import com.dream.game.model.world.L2World;
  940. import com.dream.game.model.world.L2WorldRegion;
  941. +import com.dream.game.model.world.Location;
  942. import com.dream.game.model.zone.L2TradeZone;
  943. import com.dream.game.model.zone.L2Zone;
  944. import com.dream.game.network.AuthServerThread;
  945. @@ -157,6 +163,7 @@
  946. import com.dream.game.network.serverpackets.ExOlympiadUserInfo;
  947. import com.dream.game.network.serverpackets.ExPutEnchantTargetItemResult;
  948. import com.dream.game.network.serverpackets.ExSetCompassZoneCode;
  949. +import com.dream.game.network.serverpackets.ExShowScreenMessage;
  950. import com.dream.game.network.serverpackets.ExStorageMaxCount;
  951. import com.dream.game.network.serverpackets.FriendList;
  952. import com.dream.game.network.serverpackets.HennaInfo;
  953. @@ -4199,6 +4206,18 @@
  954. stopRentPet();
  955. stopWaterTask();
  956. sendPacket(new EtcStatusUpdate(this));
  957. +
  958. + if (Config.ALLOW_SAO_MOD && !isGM())
  959. + {
  960. + SaoManager.getInstance().addSao(getObjectId(), System.currentTimeMillis() + Config.SAO_TIME_CONFIG * Config.SAO_TIME_CONFIG_MULTIPLIER);
  961. + sendChatMessage(0, SystemChatChannelId.Chat_None, "SAO", Config.SAO_TIME_INFO + new SimpleDateFormat("MMM dd, yyyy HH:mm").format(new Date(System.currentTimeMillis() + Config.SAO_TIME_CONFIG * Config.SAO_TIME_CONFIG_MULTIPLIER)) + ".");
  962. + sendPacket(new ExShowScreenMessage(Config.SAO_START_MSG, 10000));
  963. + SaoManager.getInstance().addSaoTask(getObjectId(), (System.currentTimeMillis() + Config.SAO_TIME_CONFIG * Config.SAO_TIME_CONFIG_MULTIPLIER));
  964. + NpcHtmlMessage html = new NpcHtmlMessage(0);
  965. + html.setFile("data/html/mods/SAOHtml.htm");
  966. + sendPacket(html);
  967. + }
  968. +
  969. return true;
  970. }
  971.  
  972. @@ -4413,6 +4432,13 @@
  973. _reviveRequested = false;
  974. _revivePower = 0;
  975.  
  976. + if (Config.ALLOW_SAO_MOD && SaoManager.getInstance().hasSaoPrivileges(getObjectId()) && !isGM())
  977. + {
  978. + SaoManager.getInstance().removeSao(getObjectId());
  979. + sendPacket(new ExShowScreenMessage(Config.SAO_END_MSG, 10000));
  980. + SaoManager.getInstance().removeSaoTask(getObjectId());
  981. + }
  982. +
  983. if (isMounted())
  984. {
  985. startFeed(_mountNpcId);
  986. @@ -12601,4 +12627,298 @@
  987. return _wantsPeace;
  988. }
  989.  
  990. + private int[] KAY_TELEPORTER_COORDS;
  991. +
  992. + public void addKayTeleporterCoords(int[] cords)
  993. + {
  994. + this.KAY_TELEPORTER_COORDS = cords;
  995. + }
  996. +
  997. + public int[] getTeleporterKayCoords()
  998. + {
  999. + return this.KAY_TELEPORTER_COORDS;
  1000. + }
  1001. +
  1002. + private long _vip_endTime = 0;
  1003. +
  1004. + public void setVipEndTime(long val)
  1005. + {
  1006. + _vip_endTime = val;
  1007. + }
  1008. +
  1009. + public long getVipEndTime()
  1010. + {
  1011. + return _vip_endTime;
  1012. + }
  1013. +
  1014. + public void setEndTime(String process, int val)
  1015. + {
  1016. + if (val > 0)
  1017. + {
  1018. + long end_day;
  1019. + Calendar calendar = Calendar.getInstance();
  1020. + if (val >= 30)
  1021. + {
  1022. + while (val >= 30)
  1023. + {
  1024. + if (calendar.get(Calendar.MONTH) == 11)
  1025. + {
  1026. + calendar.roll(Calendar.YEAR, true);
  1027. + }
  1028. + calendar.roll(Calendar.MONTH, true);
  1029. + val -= 30;
  1030. + }
  1031. + }
  1032. + if ((val < 30) && (val > 0))
  1033. + {
  1034. + while (val > 0)
  1035. + {
  1036. + if ((calendar.get(Calendar.DATE) == 28) && (calendar.get(Calendar.MONTH) == 1))
  1037. + {
  1038. + calendar.roll(Calendar.MONTH, true);
  1039. + }
  1040. + if (calendar.get(Calendar.DATE) == 30)
  1041. + {
  1042. + if (calendar.get(Calendar.MONTH) == 11)
  1043. + {
  1044. + calendar.roll(Calendar.YEAR, true);
  1045. + }
  1046. + calendar.roll(Calendar.MONTH, true);
  1047. +
  1048. + }
  1049. + calendar.roll(Calendar.DATE, true);
  1050. + val--;
  1051. + }
  1052. + }
  1053. +
  1054. + end_day = calendar.getTimeInMillis();
  1055. + if (process.equals("vip"))
  1056. + {
  1057. + _vip_endTime = end_day;
  1058. + }
  1059. + else
  1060. + {
  1061. + _log.warn("process " + process + "no Known while try set end date");
  1062. + return;
  1063. + }
  1064. + Date dt = new Date(end_day);
  1065. + _log.info("" + process + " End time for player " + getName() + " is " + dt);
  1066. + }
  1067. + else
  1068. + {
  1069. + if (process.equals("aio"))
  1070. + {
  1071. + _vip_endTime = 0;
  1072. + }
  1073. + else
  1074. + {
  1075. + _log.info("process " + process + "no Known while try set end date");
  1076. + return;
  1077. + }
  1078. + }
  1079. + }
  1080. +
  1081. + @SuppressWarnings("unused")
  1082. + private boolean _IsPhantom = false;
  1083. + private int _fakeProtect = 0;
  1084. + public Location _phantomLoc = null;
  1085. +
  1086. + public Location getPhantomLoc()
  1087. + {
  1088. + return this._phantomLoc;
  1089. + }
  1090. +
  1091. + public boolean rndWalk(L2Character paramL2Character, boolean paramBoolean)
  1092. + {
  1093. + rndWalk();
  1094. + if (this._fakeProtect > 2)
  1095. + {
  1096. + return false;
  1097. + }
  1098. + this._fakeProtect += 1;
  1099. + return true;
  1100. + }
  1101. +
  1102. + public void rndWalk()
  1103. + {
  1104. + int i = getX();
  1105. + int j = getY();
  1106. + int k = getZ();
  1107. + switch (Rnd.get(1, 6))
  1108. + {
  1109. + case 1:
  1110. + i += 40;
  1111. + j += 180;
  1112. + break;
  1113. + case 2:
  1114. + i += 150;
  1115. + j += 50;
  1116. + break;
  1117. + case 3:
  1118. + i += 69;
  1119. + j -= 100;
  1120. + break;
  1121. + case 4:
  1122. + i += 10;
  1123. + j -= 100;
  1124. + break;
  1125. + case 5:
  1126. + i -= 150;
  1127. + j -= 20;
  1128. + break;
  1129. + case 6:
  1130. + i -= 100;
  1131. + j += 60;
  1132. + }
  1133. + setRunning();
  1134. + getAI().setIntention(CtrlIntention.MOVE_TO, new L2CharPosition(i, j, k, calcHeading(i, j)));
  1135. + }
  1136. +
  1137. + public void clearRndWalk()
  1138. + {
  1139. + }
  1140. +
  1141. + public void setOnlineStatusPhantom(boolean paramBoolean)
  1142. + {
  1143. + Connection localConnection = null;
  1144. + try
  1145. + {
  1146. + localConnection = L2DatabaseFactory.getInstance().getConnection(localConnection);
  1147. + PreparedStatement localPreparedStatement = localConnection.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE charId=?");
  1148. + if (paramBoolean)
  1149. + {
  1150. + localPreparedStatement.setInt(1, 1);
  1151. + }
  1152. + else
  1153. + {
  1154. + localPreparedStatement.setInt(1, 0);
  1155. + }
  1156. + localPreparedStatement.setLong(2, System.currentTimeMillis());
  1157. + localPreparedStatement.setInt(3, getObjectId());
  1158. + localPreparedStatement.execute();
  1159. + localPreparedStatement.close();
  1160. +
  1161. + return;
  1162. + }
  1163. + catch (Exception localException)
  1164. + {
  1165. + _log.error("Failed updating character online status.", localException);
  1166. + }
  1167. + finally
  1168. + {
  1169. + try
  1170. + {
  1171. + if (localConnection != null)
  1172. + {
  1173. + localConnection.close();
  1174. + }
  1175. + }
  1176. + catch (SQLException localSQLException3)
  1177. + {
  1178. + localSQLException3.printStackTrace();
  1179. + }
  1180. + }
  1181. + }
  1182. +
  1183. + public void setPhantomLoc(int paramInt1, int paramInt2, int paramInt3)
  1184. + {
  1185. + this._phantomLoc = new Location(paramInt1, paramInt2, paramInt3);
  1186. + }
  1187. +
  1188. + public static L2PcInstance loadPhantom(int paramInt1, int paramInt2, int paramInt3, boolean paramBoolean)
  1189. + {
  1190. + L2PcInstance localL2PcInstance = null;
  1191. + int i = Rnd.get(89, 112);
  1192. + if (paramInt3 > 0)
  1193. + {
  1194. + i = paramInt3;
  1195. + }
  1196. + boolean bool1 = Rnd.get(0, 1) != 0;
  1197. + L2PcTemplate localL2PcTemplate = CharTemplateTable.getInstance().getTemplate(i);
  1198. + byte b = (byte) Rnd.get(3);
  1199. + PcAppearance localPcAppearance = new PcAppearance(b, b, b, bool1);
  1200. + if (paramBoolean)
  1201. + {
  1202. + localL2PcInstance = new L2PcInstance(paramInt1, localL2PcTemplate, "fake_qwerty", localPcAppearance);
  1203. + }
  1204. + else
  1205. + {
  1206. + localL2PcInstance = new L2PcInstance(paramInt1, localL2PcTemplate, "fake_qwerty", localPcAppearance);
  1207. + }
  1208. + localL2PcInstance.setIsPhantom(true);
  1209. + localL2PcInstance._lastAccess = 0L;
  1210. + localL2PcInstance.getStat().setSp(Integer.MAX_VALUE);
  1211. + long l1 = localL2PcInstance.getExp();
  1212. + long l2 = Experience.LEVEL[paramInt2];
  1213. + localL2PcInstance.addExpAndSp(l2 - l1, 0);
  1214. + localL2PcInstance.setHeading(Rnd.get(1, 65535));
  1215. + localL2PcInstance.setKarma(0);
  1216. + localL2PcInstance.setPvpKills(0);
  1217. + localL2PcInstance.setPkKills(0);
  1218. + localL2PcInstance.setOnlineTime(0L);
  1219. + localL2PcInstance.setNewbie(0);
  1220. + boolean bool2 = Rnd.get(0, 1) != 0;
  1221. + localL2PcInstance.setNoble(bool2);
  1222. + localL2PcInstance.setHero(false);
  1223. + localL2PcInstance.setClanJoinExpiryTime(0L);
  1224. + localL2PcInstance.setClanJoinExpiryTime(0L);
  1225. + localL2PcInstance.setClanCreateExpiryTime(0L);
  1226. + localL2PcInstance.setClanCreateExpiryTime(0L);
  1227. + localL2PcInstance.setPledgeType(0);
  1228. + localL2PcInstance.setPledgeRank(0);
  1229. + localL2PcInstance.setApprentice(0);
  1230. + localL2PcInstance.setLastRecomUpdate(0L);
  1231. + localL2PcInstance.setDeleteTimer(0L);
  1232. + localL2PcInstance.setFistsWeaponItem(localL2PcInstance.findFistsWeaponItem(i));
  1233. + localL2PcInstance.setUptime(System.currentTimeMillis());
  1234. + localL2PcInstance.getStatus().setCurrentHp(localL2PcInstance.getMaxHp());
  1235. + localL2PcInstance.getStatus().setCurrentCp(localL2PcInstance.getMaxCp());
  1236. + localL2PcInstance.getStatus().setCurrentMp(localL2PcInstance.getMaxMp());
  1237. + localL2PcInstance.checkRecom(5, 1);
  1238. + localL2PcInstance._classIndex = 0;
  1239. + try
  1240. + {
  1241. + localL2PcInstance.setBaseClass(2);
  1242. + }
  1243. + catch (Exception localException)
  1244. + {
  1245. + localL2PcInstance.setBaseClass(i);
  1246. + }
  1247. + if ((restoreSubClassData(localL2PcInstance)) && (i != localL2PcInstance.getBaseClass()))
  1248. + {
  1249. + Iterator<SubClass> localIterator = localL2PcInstance.getSubClasses().values().iterator();
  1250. + while (localIterator.hasNext())
  1251. + {
  1252. + SubClass localSubClass = localIterator.next();
  1253. + if (localSubClass.getClassId() == i)
  1254. + {
  1255. + localL2PcInstance._classIndex = localSubClass.getClassIndex();
  1256. + }
  1257. + }
  1258. + }
  1259. + localL2PcInstance._activeClass = i;
  1260. + localL2PcInstance.setApprentice(0);
  1261. + localL2PcInstance.setSponsor(0);
  1262. + localL2PcInstance.setLvlJoinedAcademy(0);
  1263. + localL2PcInstance.setIsIn7sDungeon(false);
  1264. + localL2PcInstance.setInJail(false);
  1265. + localL2PcInstance.setJailTimer(0L);
  1266. + localL2PcInstance.setAllianceWithVarkaKetra(0);
  1267. + localL2PcInstance.setDeathPenaltyBuffLevel(0);
  1268. + localL2PcInstance.setPcCaffePoints(0);
  1269. + try
  1270. + {
  1271. + localL2PcInstance.stopAllTimers();
  1272. + }
  1273. + catch (Throwable localThrowable)
  1274. + {
  1275. + _log.warn("deleteMe()", localThrowable);
  1276. + }
  1277. + return localL2PcInstance;
  1278. + }
  1279. +
  1280. + public void setIsPhantom(boolean paramBoolean)
  1281. + {
  1282. + _IsPhantom = paramBoolean;
  1283. + }
  1284. }
  1285. \ No newline at end of file
  1286. Index: Dream_GameServer/src/com/dream/game/model/actor/L2Attackable.java
  1287. ===================================================================
  1288. --- Dream_GameServer/src/com/dream/game/model/actor/L2Attackable.java (revision 83)
  1289. +++ Dream_GameServer/src/com/dream/game/model/actor/L2Attackable.java (working copy)
  1290. @@ -32,6 +32,9 @@
  1291. import com.dream.game.manager.CursedWeaponsManager;
  1292. import com.dream.game.manager.EventsDropManager;
  1293. import com.dream.game.manager.ItemsAutoDestroy;
  1294. +import com.dream.game.manager.VipManager;
  1295. +import com.dream.game.manager.VipManagerOne;
  1296. +import com.dream.game.manager.VipManagerTwo;
  1297. import com.dream.game.manager.clanhallsiege.FortResistSiegeManager;
  1298. import com.dream.game.model.L2Boss;
  1299. import com.dream.game.model.L2CommandChannel;
  1300. @@ -743,17 +746,123 @@
  1301. champRate = 1;
  1302. }
  1303.  
  1304. - if (drop.getItemId() == 57)
  1305. + if (drop.getItemId() == 6360)
  1306. {
  1307. - dropChance *= Config.RATE_DROP_ADENA;
  1308. + if (VipManager.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1309. + {
  1310. + dropChance *= Config.VIP_RATE_DROP_BLUESEAL;
  1311. + }
  1312. + else if (VipManagerOne.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1313. + {
  1314. + dropChance *= Config.VIP_RATE_DROP_BLUESEAL_ONE;
  1315. + }
  1316. + else if (VipManagerTwo.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1317. + {
  1318. + dropChance *= Config.VIP_RATE_DROP_BLUESEAL_TWO;
  1319. + }
  1320. + else
  1321. + {
  1322. + dropChance *= Config.RATE_DROP_BLUESEAL;
  1323. + }
  1324. +
  1325. }
  1326. + else if (drop.getItemId() == 6361)
  1327. + {
  1328. + if (VipManager.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1329. + {
  1330. + dropChance *= Config.VIP_RATE_DROP_GREENSEAL;
  1331. + }
  1332. + else if (VipManagerOne.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1333. + {
  1334. + dropChance *= Config.VIP_RATE_DROP_GREENSEAL_ONE;
  1335. + }
  1336. + else if (VipManagerTwo.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1337. + {
  1338. + dropChance *= Config.VIP_RATE_DROP_GREENSEAL_TWO;
  1339. + }
  1340. + else
  1341. + {
  1342. + dropChance *= Config.RATE_DROP_GREENSEAL;
  1343. + }
  1344. +
  1345. + }
  1346. + else if (drop.getItemId() == 6362)
  1347. + {
  1348. + if (VipManager.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1349. + {
  1350. + dropChance *= Config.VIP_RATE_DROP_REDSEAL;
  1351. + }
  1352. + else if (VipManagerOne.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1353. + {
  1354. + dropChance *= Config.VIP_RATE_DROP_REDSEAL_ONE;
  1355. + }
  1356. + else if (VipManagerTwo.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1357. + {
  1358. + dropChance *= Config.VIP_RATE_DROP_REDSEAL_TWO;
  1359. + }
  1360. + else
  1361. + {
  1362. + dropChance *= Config.RATE_DROP_REDSEAL;
  1363. + }
  1364. +
  1365. + }
  1366. + else if (drop.getItemId() == 57)
  1367. + {
  1368. + if (VipManager.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1369. + {
  1370. + dropChance *= Config.VIP_RATE_DROP_ADENA;
  1371. + }
  1372. + else if (VipManagerOne.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1373. + {
  1374. + dropChance *= Config.VIP_RATE_DROP_ADENA_ONE;
  1375. + }
  1376. + else if (VipManagerTwo.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1377. + {
  1378. + dropChance *= Config.VIP_RATE_DROP_ADENA_TWO;
  1379. + }
  1380. + else
  1381. + {
  1382. + dropChance *= Config.RATE_DROP_ADENA;
  1383. + }
  1384. +
  1385. + }
  1386. else if (isSweep)
  1387. {
  1388. - dropChance *= Config.RATE_DROP_SPOIL;
  1389. + if (VipManager.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1390. + {
  1391. + dropChance *= Config.VIP_RATE_DROP_SPOIL;
  1392. + }
  1393. + else if (VipManagerOne.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1394. + {
  1395. + dropChance *= Config.VIP_RATE_DROP_SPOIL_ONE;
  1396. + }
  1397. + else if (VipManagerTwo.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1398. + {
  1399. + dropChance *= Config.VIP_RATE_DROP_SPOIL_TWO;
  1400. + }
  1401. + else
  1402. + {
  1403. + dropChance *= Config.RATE_DROP_SPOIL;
  1404. + }
  1405. }
  1406. else
  1407. {
  1408. - dropChance *= isRaid() && !isRaidMinion() ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS;
  1409. + if (VipManager.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1410. + {
  1411. + dropChance *= Config.VIP_RATE_DROP;
  1412. + }
  1413. + else if (VipManagerOne.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1414. + {
  1415. + dropChance *= Config.VIP_RATE_DROP_ONE;
  1416. + }
  1417. + else if (VipManagerTwo.getInstance().hasVipPrivileges(lastAttacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1418. + {
  1419. + dropChance *= Config.VIP_RATE_DROP_TWO;
  1420. + }
  1421. + else
  1422. + {
  1423. + dropChance *= isRaid() && !isRaidMinion() ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS;
  1424. + }
  1425. }
  1426.  
  1427. dropChance = Math.round(dropChance) * champRate;
  1428. @@ -1003,6 +1112,22 @@
  1429. player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ACQUIRED_S1_BONUS_EXPERIENCE_THROUGH_OVER_HIT).addNumber(overHitExp));
  1430. exp += overHitExp;
  1431. }
  1432. +
  1433. + if (VipManager.getInstance().hasVipPrivileges(attacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1434. + {
  1435. + exp *= Config.VIP_RATE_XP;
  1436. + sp *= Config.VIP_RATE_SP;
  1437. + }
  1438. + if (VipManagerOne.getInstance().hasVipPrivileges(attacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1439. + {
  1440. + exp *= Config.VIP_RATE_XP_ONE;
  1441. + sp *= Config.VIP_RATE_SP_ONE;
  1442. + }
  1443. + if (VipManagerTwo.getInstance().hasVipPrivileges(attacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1444. + {
  1445. + exp *= Config.VIP_RATE_XP_TWO;
  1446. + sp *= Config.VIP_RATE_SP_TWO;
  1447. + }
  1448. }
  1449.  
  1450. // Distribute the Exp and SP between the
  1451. @@ -1166,6 +1291,24 @@
  1452. player.sendPacket(SystemMessageId.OVER_HIT);
  1453. exp += calculateOverhitExp(exp);
  1454. }
  1455. +
  1456. + if (VipManager.getInstance().hasVipPrivileges(attacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1457. + {
  1458. + exp *= Config.VIP_RATE_XP;
  1459. + sp *= Config.VIP_RATE_SP;
  1460. + }
  1461. +
  1462. + if (VipManagerOne.getInstance().hasVipPrivileges(attacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1463. + {
  1464. + exp *= Config.VIP_RATE_XP_ONE;
  1465. + sp *= Config.VIP_RATE_SP_ONE;
  1466. + }
  1467. +
  1468. + if (VipManagerTwo.getInstance().hasVipPrivileges(attacker.getObjectId()) && Config.ALLOW_VIP_CHARACTERS)
  1469. + {
  1470. + exp *= Config.VIP_RATE_XP_TWO;
  1471. + sp *= Config.VIP_RATE_SP_TWO;
  1472. + }
  1473. }
  1474.  
  1475. // champion xp/sp :)
  1476. @@ -1339,8 +1482,12 @@
  1477. if (Rnd.get(L2DropData.MAX_CHANCE) < drop.chance)
  1478. {
  1479. RewardItem item = new RewardItem(drop.items[Rnd.get(drop.items.length)], Rnd.get(drop.min, drop.max));
  1480. - if (Config.AUTO_LOOT_RAID && isRaid() && player.isAutoLootEnabled())
  1481. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1482. {
  1483. + dropItem(player, item);
  1484. + }
  1485. + else if (Config.AUTO_LOOT_RAID && isRaid() && player.isAutoLootEnabled())
  1486. + {
  1487. player.doAutoLoot(this, item);
  1488. }
  1489. else if (player.isAutoLootEnabled() && !isRaid())
  1490. @@ -1434,8 +1581,12 @@
  1491. _log.warn("Item id to drop: " + item.getItemId() + " amount: " + item.getCount());
  1492. }
  1493.  
  1494. - if (player.isAutoLootEnabled() && !isRaid())
  1495. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1496. {
  1497. + dropItem(player, item);
  1498. + }
  1499. + else if (player.isAutoLootEnabled() && !isRaid())
  1500. + {
  1501. player.doAutoLoot(this, item);
  1502. }
  1503. else
  1504. @@ -1472,8 +1623,12 @@
  1505. if (rewardItem[0] > 0 && rewardItem[1] > 0)
  1506. {
  1507. RewardItem item = new RewardItem(rewardItem[0], rewardItem[1]);
  1508. - if (player.isAutoLootEnabled())
  1509. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1510. {
  1511. + dropItem(player, item);
  1512. + }
  1513. + else if (player.isAutoLootEnabled())
  1514. + {
  1515. player.doAutoLoot(this, item);
  1516. }
  1517. else
  1518. @@ -1493,8 +1648,12 @@
  1519. if (random < Config.RATE_DROP_SPECIAL_HERBS && !_spec)
  1520. {
  1521. RewardItem item = new RewardItem(8612, 1);
  1522. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1523. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1524. {
  1525. + dropItem(player, item);
  1526. + }
  1527. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1528. + {
  1529. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1530. }
  1531. else
  1532. @@ -1524,8 +1683,12 @@
  1533. // Attack - Rate
  1534. break;
  1535. }
  1536. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1537. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1538. {
  1539. + dropItem(player, item);
  1540. + }
  1541. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1542. + {
  1543. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1544. }
  1545. else
  1546. @@ -1541,8 +1704,12 @@
  1547. if (random < Config.RATE_DROP_SPECIAL_HERBS && !_spec)
  1548. {
  1549. RewardItem item = new RewardItem(8613, 1); // Herb of Mystic
  1550. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1551. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1552. {
  1553. + dropItem(player, item);
  1554. + }
  1555. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1556. + {
  1557. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1558. }
  1559. else
  1560. @@ -1570,8 +1737,12 @@
  1561. // Speed
  1562. }
  1563.  
  1564. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1565. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1566. {
  1567. + dropItem(player, item);
  1568. + }
  1569. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1570. + {
  1571. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1572. }
  1573. else
  1574. @@ -1587,8 +1758,12 @@
  1575. if (random < Config.RATE_DROP_SPECIAL_HERBS && !_spec)
  1576. {
  1577. RewardItem item = new RewardItem(8614, 1); // Herb of Recovery
  1578. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1579. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1580. {
  1581. + dropItem(player, item);
  1582. + }
  1583. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1584. + {
  1585. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1586. }
  1587. else
  1588. @@ -1606,8 +1781,12 @@
  1589. if (random < Config.RATE_DROP_MP_HP_HERBS)
  1590. {
  1591. RewardItem item = new RewardItem(8600, 1); // Herb of Life
  1592. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1593. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1594. {
  1595. + dropItem(player, item);
  1596. + }
  1597. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1598. + {
  1599. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1600. }
  1601. else
  1602. @@ -1624,8 +1803,12 @@
  1603. {
  1604. RewardItem item = new RewardItem(8601, 1); // Greater Herb
  1605. // of Life
  1606. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1607. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1608. {
  1609. + dropItem(player, item);
  1610. + }
  1611. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1612. + {
  1613. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1614. }
  1615. else
  1616. @@ -1641,8 +1824,12 @@
  1617. if (random < Config.RATE_DROP_SUPERIOR_HERBS)
  1618. {
  1619. RewardItem item = new RewardItem(8602, 1);
  1620. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1621. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1622. {
  1623. + dropItem(player, item);
  1624. + }
  1625. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1626. + {
  1627. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1628. }
  1629. else
  1630. @@ -1657,8 +1844,12 @@
  1631. if (random < Config.RATE_DROP_MP_HP_HERBS)
  1632. {
  1633. RewardItem item = new RewardItem(8603, 1);
  1634. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1635. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1636. {
  1637. + dropItem(player, item);
  1638. + }
  1639. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1640. + {
  1641. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1642. }
  1643. else
  1644. @@ -1674,8 +1865,12 @@
  1645. if (random < Config.RATE_DROP_GREATER_HERBS)
  1646. {
  1647. RewardItem item = new RewardItem(8604, 1);
  1648. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1649. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1650. {
  1651. + dropItem(player, item);
  1652. + }
  1653. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1654. + {
  1655. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1656. }
  1657. else
  1658. @@ -1691,8 +1886,12 @@
  1659. if (random < Config.RATE_DROP_SUPERIOR_HERBS)
  1660. {
  1661. RewardItem item = new RewardItem(8605, 1);
  1662. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1663. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1664. {
  1665. + dropItem(player, item);
  1666. + }
  1667. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1668. + {
  1669. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1670. }
  1671. else
  1672. @@ -1706,8 +1905,12 @@
  1673. if (random < Config.RATE_DROP_COMMON_HERBS)
  1674. {
  1675. RewardItem item = new RewardItem(8611, 1);
  1676. - if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1677. + if (Config.NO_AUTO_LOOT_LIST.contains(this.getNpcId()))
  1678. {
  1679. + dropItem(player, item);
  1680. + }
  1681. + else if (player.isAutoLootEnabled() && Config.AUTO_LOOT_HERBS)
  1682. + {
  1683. player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
  1684. }
  1685. else
  1686. Index: Dream_GameServer/src/com/dream/game/network/clientpackets/EnterWorld.java
  1687. ===================================================================
  1688. --- Dream_GameServer/src/com/dream/game/network/clientpackets/EnterWorld.java (revision 83)
  1689. +++ Dream_GameServer/src/com/dream/game/network/clientpackets/EnterWorld.java (working copy)
  1690. @@ -1,5 +1,8 @@
  1691. package com.dream.game.network.clientpackets;
  1692.  
  1693. +import java.text.SimpleDateFormat;
  1694. +import java.util.Date;
  1695. +
  1696. import org.apache.log4j.Logger;
  1697.  
  1698. import com.dream.Config;
  1699. @@ -20,8 +23,12 @@
  1700. import com.dream.game.manager.FortManager;
  1701. import com.dream.game.manager.FortSiegeManager;
  1702. import com.dream.game.manager.PetitionManager;
  1703. +import com.dream.game.manager.SaoManager;
  1704. import com.dream.game.manager.SiegeManager;
  1705. import com.dream.game.manager.SiegeRewardManager;
  1706. +import com.dream.game.manager.VipManager;
  1707. +import com.dream.game.manager.VipManagerOne;
  1708. +import com.dream.game.manager.VipManagerTwo;
  1709. import com.dream.game.manager.clanhallsiege.DevastatedCastleSiege;
  1710. import com.dream.game.manager.clanhallsiege.FortressOfDeadSiege;
  1711. import com.dream.game.model.L2Clan;
  1712. @@ -53,6 +60,7 @@
  1713. import com.dream.game.network.serverpackets.Die;
  1714. import com.dream.game.network.serverpackets.EtcStatusUpdate;
  1715. import com.dream.game.network.serverpackets.ExBasicActionList;
  1716. +import com.dream.game.network.serverpackets.ExShowScreenMessage;
  1717. import com.dream.game.network.serverpackets.ExStorageMaxCount;
  1718. import com.dream.game.network.serverpackets.FriendList;
  1719. import com.dream.game.network.serverpackets.HennaInfo;
  1720. @@ -439,7 +447,6 @@
  1721. activeChar.sendPacket(SystemMessageId.WELCOME_TO_LINEAGE);
  1722. SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar);
  1723. Announcements.getInstance().showAnnouncements(activeChar);
  1724. - activeChar.sendChatMessage(0, SystemChatChannelId.Chat_None, Config.SERVER_NAME, "Thank you for using Dream Project..");
  1725.  
  1726. ObjectRestrictions.getInstance().resumeTasks(activeChar.getObjectId());
  1727.  
  1728. @@ -557,6 +564,26 @@
  1729. sendPacket(html);
  1730. }
  1731.  
  1732. + if (SaoManager.getInstance().hasSaoPrivileges(activeChar.getObjectId()))
  1733. + {
  1734. + final L2PcInstance player = L2World.getInstance().getPlayer(activeChar.getObjectId());
  1735. +
  1736. + long duration = SaoManager.getInstance().getSaoDuration(activeChar.getObjectId());
  1737. + player.sendPacket(new ExShowScreenMessage(Config.SAO_TIME_INFO + new SimpleDateFormat("MMM dd, yyyy HH:mm").format(new Date(duration)) + ".", 10000));
  1738. + player.sendChatMessage(0, SystemChatChannelId.Chat_None, "SAO", Config.SAO_TIME_INFO + new SimpleDateFormat("MMM dd, yyyy HH:mm").format(new Date(duration)) + ".");
  1739. + SaoManager.getInstance().addSaoTask(activeChar.getObjectId(), duration);
  1740. + }
  1741. +
  1742. + if (VipManager.getInstance().hasVipPrivileges(activeChar.getObjectId()) || VipManagerOne.getInstance().hasVipPrivileges(activeChar.getObjectId()) || VipManagerTwo.getInstance().hasVipPrivileges(activeChar.getObjectId()))
  1743. + {
  1744. + final L2PcInstance player = L2World.getInstance().getPlayer(activeChar.getObjectId());
  1745. +
  1746. + long duration = VipManager.getInstance().getVipDuration(activeChar.getObjectId());
  1747. + player.sendPacket(new ExShowScreenMessage("Your VIP end at " + new SimpleDateFormat("MMM dd, yyyy HH:mm").format(new Date(duration)) + ".", 10000));
  1748. + player.sendChatMessage(0, SystemChatChannelId.Chat_None, "VIP", "Dear " + player.getName() + " now you have VIP Status " + " you have acess granted in VIPs NPC's," + " remember your VIP end at " + new SimpleDateFormat("MMM dd, yyyy HH:mm").format(new Date(duration)) + ".");
  1749. + VipManager.getInstance().addVipTask(activeChar.getObjectId(), duration);
  1750. + }
  1751. +
  1752. if ((activeChar._event != null) && (activeChar._event.getState() == GameEvent.STATE_ACTIVE))
  1753. {
  1754. activeChar.addMessage("<html><body><br>Don't forget, you party the remaining <font color=\"LEVEL\">" + activeChar._event.getName() + "</font>!</body></html>");
  1755. Index: Dream_GameServer/dist/config/main/npc.properties
  1756. ===================================================================
  1757. --- Dream_GameServer/dist/config/main/npc.properties (revision 83)
  1758. +++ Dream_GameServer/dist/config/main/npc.properties (working copy)
  1759. @@ -98,10 +98,18 @@
  1760. # Instantly update a database of information on the status of the boss after his assassination
  1761. # Use this option with caution.
  1762. ForceUpdateRaidBossOnDB = False
  1763. +<<<<<<< .mine
  1764.  
  1765. # If True, Lethal Protected Mobs (in LethalProtectedMobs property) cannot receive Lethal shot
  1766. AllowLethalProtectionMobs = False
  1767. +# es. : LethalProtectedMobs = 35062,21436
  1768. +# 35062 = CTFFlag
  1769. +LethalProtectedMobs = 35062
  1770. +=======
  1771.  
  1772. +# If True, Lethal Protected Mobs (in LethalProtectedMobs property) cannot receive Lethal shot
  1773. +AllowLethalProtectionMobs = False
  1774. +
  1775. # es. : LethalProtectedMobs = 35062,21436
  1776. # 35062 = CTFFlag
  1777. -LethalProtectedMobs = 35062
  1778. \ No newline at end of file
  1779. +LethalProtectedMobs = 35062>>>>>>> .r81
  1780. Index: Dream_GameServer/src/com/dream/game/network/clientpackets/DlgAnswer.java
  1781. ===================================================================
  1782. --- Dream_GameServer/src/com/dream/game/network/clientpackets/DlgAnswer.java (revision 83)
  1783. +++ Dream_GameServer/src/com/dream/game/network/clientpackets/DlgAnswer.java (working copy)
  1784. @@ -32,8 +32,16 @@
  1785. }
  1786. getClient().getActiveChar().removeConfirmDlgRequestTime(_requesterId);
  1787.  
  1788. - if (_messageId == SystemMessageId.S1_MAKING_RESSURECTION_REQUEST.getId())
  1789. + if (_messageId == SystemMessageId.OFF_REQUEST_TELEPORTER.getId())
  1790. {
  1791. + if (cha.getTeleporterKayCoords() != null && _answer != 0)
  1792. + {
  1793. + cha.teleToLocation(cha.getTeleporterKayCoords()[0], cha.getTeleporterKayCoords()[1], cha.getTeleporterKayCoords()[2]);
  1794. + cha.addKayTeleporterCoords(null);
  1795. + }
  1796. + }
  1797. + else if (_messageId == SystemMessageId.S1_MAKING_RESSURECTION_REQUEST.getId())
  1798. + {
  1799. cha.reviveAnswer(_answer);
  1800. }
  1801. else if (_messageId == SystemMessageId.S1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId())
  1802. Index: Dream_GameServer/src/com/dream/game/network/serverpackets/Die.java
  1803. ===================================================================
  1804. --- Dream_GameServer/src/com/dream/game/network/serverpackets/Die.java (revision 83)
  1805. +++ Dream_GameServer/src/com/dream/game/network/serverpackets/Die.java (working copy)
  1806. @@ -1,6 +1,8 @@
  1807. package com.dream.game.network.serverpackets;
  1808.  
  1809. +import com.dream.Config;
  1810. import com.dream.game.manager.FortSiegeManager;
  1811. +import com.dream.game.manager.SaoManager;
  1812. import com.dream.game.manager.SiegeManager;
  1813. import com.dream.game.manager.clanhallsiege.BanditStrongholdSiege;
  1814. import com.dream.game.manager.clanhallsiege.WildBeastFarmSiege;
  1815. @@ -11,6 +13,7 @@
  1816. import com.dream.game.model.actor.instance.L2PcInstance;
  1817. import com.dream.game.model.entity.siege.FortSiege;
  1818. import com.dream.game.model.entity.siege.Siege;
  1819. +import com.dream.game.model.world.L2World;
  1820.  
  1821. public class Die extends L2GameServerPacket
  1822. {
  1823. @@ -17,7 +20,7 @@
  1824. private final int _charObjId;
  1825. private final boolean _fallDown;
  1826. private boolean _sweepable;
  1827. - private boolean _inFunEvent = false;
  1828. + private boolean _inFunEvent;
  1829. private final L2Character _activeChar;
  1830. private final int _showVillage;
  1831. private int _showClanhall;
  1832. @@ -95,17 +98,29 @@
  1833. @Override
  1834. protected final void writeImpl()
  1835. {
  1836. + final L2PcInstance player = L2World.getInstance().getPlayer(_activeChar.getObjectId());
  1837. +
  1838. if (!_fallDown)
  1839. return;
  1840.  
  1841. - writeC(0x6);
  1842. - writeD(_charObjId);
  1843. - writeD(_inFunEvent ? 0x00 : _showVillage);
  1844. - writeD(_inFunEvent ? 0x00 : _showClanhall);
  1845. - writeD(_inFunEvent ? 0x00 : _showCastle);
  1846. - writeD(_showFlag);
  1847. - writeD(_sweepable ? 0x01 : 0x00);
  1848. - writeD(_inFunEvent ? 0x00 : _fixedres);
  1849. + writeC(0x6);
  1850. + writeD(_charObjId);
  1851. +
  1852. + if (Config.ALLOW_SAO_MOD && player != null && _activeChar instanceof L2PcInstance)
  1853. + {
  1854. + writeD(SaoManager.getInstance().hasSaoPrivileges(player.getObjectId()) ? 0x00 : _showVillage);
  1855. + writeD(SaoManager.getInstance().hasSaoPrivileges(player.getObjectId()) ? 0x00 : _showClanhall);
  1856. + writeD(SaoManager.getInstance().hasSaoPrivileges(player.getObjectId()) ? 0x00 : _showCastle);
  1857. + }
  1858. + else
  1859. + {
  1860. + writeD(_inFunEvent ? 0x00 : _showVillage);
  1861. + writeD(_inFunEvent ? 0x00 : _showClanhall);
  1862. + writeD(_inFunEvent ? 0x00 : _showCastle);
  1863. + }
  1864. + writeD(_showFlag);
  1865. + writeD(_sweepable ? 0x01 : 0x00);
  1866. + writeD(_inFunEvent ? 0x00 : _fixedres);
  1867. }
  1868.  
  1869. }
  1870. \ No newline at end of file
  1871. Index: Dream_GameServer/src/com/dream/game/model/actor/instance/L2TeleporterInstance.java
  1872. ===================================================================
  1873. --- Dream_GameServer/src/com/dream/game/model/actor/instance/L2TeleporterInstance.java (revision 83)
  1874. +++ Dream_GameServer/src/com/dream/game/model/actor/instance/L2TeleporterInstance.java (working copy)
  1875. @@ -18,6 +18,7 @@
  1876. import com.dream.game.model.restriction.ObjectRestrictions;
  1877. import com.dream.game.network.SystemMessageId;
  1878. import com.dream.game.network.serverpackets.ActionFailed;
  1879. +import com.dream.game.network.serverpackets.ConfirmDlg;
  1880. import com.dream.game.network.serverpackets.NpcHtmlMessage;
  1881. import com.dream.game.templates.chars.L2NpcTemplate;
  1882.  
  1883. @@ -80,7 +81,26 @@
  1884.  
  1885. if (!list.isForNoble() && player.reduceAdena("Teleport", price, this, true))
  1886. {
  1887. - player.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ(), true);
  1888. + if (Config.OFF_TELEPORTER_ENABLE && Config.OFF_ACCEPTED_TELEPORTERS.contains(this.getTemplate().getNpcId()))
  1889. + {
  1890. + ConfirmDlg confirm = new ConfirmDlg(SystemMessageId.OFF_REQUEST_TELEPORTER.getId());
  1891. + confirm.addString(this.getTemplate().getName());
  1892. + confirm.addZoneName(list.getLocX(), list.getLocY(), list.getLocZ());
  1893. + confirm.addTime(15000);
  1894. + confirm.addRequesterId(player.getObjectId());
  1895. + int[] cords =
  1896. + {
  1897. + list.getLocX(),
  1898. + list.getLocY(),
  1899. + list.getLocZ()
  1900. + };
  1901. + player.addKayTeleporterCoords(cords);
  1902. + player.sendPacket(confirm);
  1903. + }
  1904. + else
  1905. + {
  1906. + player.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ(), true);
  1907. + }
  1908. if (Config.PLAYER_SPAWN_PROTECTION > 0 && !isInsidePeaceZone(player))
  1909. {
  1910. player.sendMessage(String.format(Message.getMessage(player, Message.MessageId.MSG_SPAWN_PROTECTION), Config.PLAYER_SPAWN_PROTECTION));
  1911. Index: Dream_GameServer/dist/config/custom/mods.properties
  1912. ===================================================================
  1913. --- Dream_GameServer/dist/config/custom/mods.properties (revision 83)
  1914. +++ Dream_GameServer/dist/config/custom/mods.properties (working copy)
  1915. @@ -165,4 +165,71 @@
  1916. # The item info list for Clan Leader (You must fill both list to CL get reward).
  1917. # CL must be online during siege ofc - so we dont care to reward him offline.
  1918. # To add a item with count just add " , " to split the item and count and " ; " to close the statement
  1919. -RewardClInfo = 57,2000;5575,200000
  1920. \ No newline at end of file
  1921. +RewardClInfo = 57,2000;5575,200000
  1922. +
  1923. +#=======================================#
  1924. +# Sword Arts Online System
  1925. +#=======================================#
  1926. +# Enable Disable Sao Mod
  1927. +# Default = False
  1928. +AllowSaoMod = False
  1929. +
  1930. +# Time you want to aplly Sao Mod
  1931. +# Can be multipler in config above
  1932. +SaoTimeConfig = 1
  1933. +
  1934. +# Time for Multiplier.
  1935. +# 1 - Minutes = 60000
  1936. +# 2 - Hours = 3600000
  1937. +# 3 - Days = 86400000
  1938. +SaoTimeMultiplier = 3600000
  1939. +
  1940. +# Sao Start Message
  1941. +SaoStartMsg = Your Sao restrictions were added.
  1942. +
  1943. +# Sao End Message
  1944. +SaoEndMsg = Your Sao restrictions were removed.
  1945. +
  1946. +# Sao Time Info
  1947. +SaoInfoMsg = Your Sao restrictions end at
  1948. +
  1949. +#=======================================#
  1950. +# Vip Characters System
  1951. +#=======================================#
  1952. +AllowVipCharacters = False
  1953. +VipTitleColor = 00FF00
  1954. +VipTitleColorOne = 00FF00
  1955. +VipTitleColorTwo = 00FF00
  1956. +VipDropAdena = 1
  1957. +VipDropAdenaOne = 1
  1958. +VipDropAdenaTwo = 1
  1959. +VipDropSpoil = 1
  1960. +VipDropSpoilOne = 1
  1961. +VipDropSpoilTwo = 1
  1962. +VipDrop = 1
  1963. +VipDropOne = 1
  1964. +VipDropTwo = 1
  1965. +VipDropBlueSeal = 1
  1966. +VipDropBlueSealOne = 1
  1967. +VipDropBlueSealTwo = 1
  1968. +VipDropGreenSeal = 1
  1969. +VipDropGreenSealOne = 1
  1970. +VipDropGreenSealTwo = 1
  1971. +VipDropRedSeal = 1
  1972. +VipDropRedSealOne = 1
  1973. +VipDropRedSealTwo = 1
  1974. +DropBlueSeal = 1
  1975. +DropGreenSeal = 1
  1976. +DropRedSeal = 1
  1977. +VipExpRate = 1
  1978. +VipExpRateOne = 1
  1979. +VipExpRateTwo = 1
  1980. +VipSpRate = 1
  1981. +VipSpRateOne = 1
  1982. +VipSpRateTwo = 1
  1983. +VipItemId = 9955
  1984. +VipItemIdOne = 9955
  1985. +VipItemIdTwo = 9955
  1986. +VipItemDays = 30
  1987. +VipItemDaysOne = 30
  1988. +VipItemDaysTwo = 30
  1989. \ No newline at end of file
  1990. Index: Dream_GameServer/src/com/dream/game/model/PhantomPlayers.java
  1991. ===================================================================
  1992. --- Dream_GameServer/src/com/dream/game/model/PhantomPlayers.java (revision 0)
  1993. +++ Dream_GameServer/src/com/dream/game/model/PhantomPlayers.java (working copy)
  1994. @@ -0,0 +1,1159 @@
  1995. +package com.dream.game.model;
  1996. +
  1997. +import java.io.BufferedReader;
  1998. +import java.io.File;
  1999. +import java.io.FileReader;
  2000. +import java.io.LineNumberReader;
  2001. +import java.sql.Connection;
  2002. +import java.sql.PreparedStatement;
  2003. +import java.sql.ResultSet;
  2004. +import java.util.ArrayList;
  2005. +import java.util.Collection;
  2006. +import java.util.Iterator;
  2007. +import java.util.Map;
  2008. +import java.util.Map.Entry;
  2009. +import java.util.concurrent.ConcurrentHashMap;
  2010. +import java.util.concurrent.ConcurrentLinkedQueue;
  2011. +
  2012. +import org.apache.log4j.Logger;
  2013. +
  2014. +import com.dream.Config;
  2015. +import com.dream.L2DatabaseFactory;
  2016. +import com.dream.game.ai.CtrlIntention;
  2017. +import com.dream.game.datatables.sql.ClanTable;
  2018. +import com.dream.game.datatables.sql.ItemTable;
  2019. +import com.dream.game.model.actor.instance.L2ItemInstance;
  2020. +import com.dream.game.model.actor.instance.L2PcInstance;
  2021. +import com.dream.game.model.actor.position.L2CharPosition;
  2022. +import com.dream.game.model.world.L2World;
  2023. +import com.dream.game.model.world.Location;
  2024. +import com.dream.game.network.Disconnection;
  2025. +import com.dream.game.network.ThreadPoolManager;
  2026. +import com.dream.game.network.serverpackets.MagicSkillUse;
  2027. +import com.dream.game.templates.item.L2Weapon;
  2028. +import com.dream.game.templates.item.L2WeaponType;
  2029. +import com.dream.tools.random.Rnd;
  2030. +
  2031. +import javolution.text.TextBuilder;
  2032. +import javolution.util.FastMap;
  2033. +
  2034. +public class PhantomPlayers
  2035. +{
  2036. + public static final Logger _log = Logger.getLogger(PhantomPlayers.class.getName());
  2037. + public static String _phantomAcc = Config.PHANTOM_PLAYERS_AKK;
  2038. + @SuppressWarnings("unused")
  2039. + private static int _PhantomsCount = 0;
  2040. + public static int _PhantomsLimit = 0;
  2041. + private static int _setsCount = 0;
  2042. + private static int _setsCountClan = 0;
  2043. + public volatile int _PhantomsTownTotal = 0;
  2044. + private static int _nameColCount = 0;
  2045. + private static int _titleColCount = 0;
  2046. + private static ArrayList<Integer> _nameColors = new ArrayList<>();
  2047. + private static ArrayList<Integer> _titleColors = new ArrayList<>();
  2048. + private static ArrayList<L2Set> _sets = new ArrayList<>();
  2049. + private static int _setsArcherCount = 0;
  2050. + private static ArrayList<L2Set> _setsArcher = new ArrayList<>();
  2051. + private static PhantomPlayers _instance;
  2052. + private static int _setsOlyCount = 0;
  2053. + private static ArrayList<L2Set> _setsOly = new ArrayList<>();
  2054. + private static int _locsCount = 0;
  2055. + private static ArrayList<Location> _PhantomsTownLoc = new ArrayList<>();
  2056. + public static FastMap<Integer, L2Fantome> _phantoms = new FastMap<>();
  2057. + private static int _PhantomsEnchPhsCount = 0;
  2058. + private static ArrayList<String> _PhantomsEnchPhrases = new ArrayList<>();
  2059. + private static int _PhantomsLastPhsCount = 0;
  2060. + private static ArrayList<String> _PhantomsLastPhrases = new ArrayList<>();
  2061. + public static Map<Integer, ConcurrentLinkedQueue<L2PcInstance>> _PhantomsTown = new ConcurrentHashMap<>();
  2062. + @SuppressWarnings("unused")
  2063. + private static Map<Integer, ConcurrentLinkedQueue<L2PcInstance>> _PhantomsTownClan = new ConcurrentHashMap<>();
  2064. + private static Map<Integer, ConcurrentLinkedQueue<Integer>> _PhantomsTownClanList = new ConcurrentHashMap<>();
  2065. + private Location localLocation;
  2066. +
  2067. + public static PhantomPlayers getInstance()
  2068. + {
  2069. + return _instance;
  2070. + }
  2071. +
  2072. + private void load()
  2073. + {
  2074. + parceArmors();
  2075. + parceArcherArmors();
  2076. + parceOlyArmors();
  2077. + parceColors();
  2078. + cacheLastPhrases();
  2079. + if (Config.ALLOW_PHANTOM_PLAYERS)
  2080. + {
  2081. + parceTownLocs();
  2082. + parceTownClans();
  2083. + cacheFantoms();
  2084. + cacheEnchantPhrases();
  2085. + _PhantomsLimit = Config.PHANTOM_PLAYERS_COUNT_FIRST + Config.PHANTOM_PLAYERS_COUNT_NEXT + 10;
  2086. + _PhantomsTown.put(Integer.valueOf(1), new ConcurrentLinkedQueue<L2PcInstance>());
  2087. + _PhantomsTown.put(Integer.valueOf(2), new ConcurrentLinkedQueue<L2PcInstance>());
  2088. + }
  2089. + }
  2090. +
  2091. + public static void init()
  2092. + {
  2093. + _instance = new PhantomPlayers();
  2094. + _instance.load();
  2095. + }
  2096. +
  2097. + private int getTitleColor()
  2098. + {
  2099. + return _titleColors.get(Rnd.get(_titleColCount)).intValue();
  2100. + }
  2101. +
  2102. + private int getNameColor()
  2103. + {
  2104. + return _nameColors.get(Rnd.get(_nameColCount)).intValue();
  2105. + }
  2106. +
  2107. + public L2PcInstance loadPhantom(int paramInt)
  2108. + {
  2109. + int i = L2World.getInstance().getAllPlayersCount();
  2110. + if (i < Config.MAXIMUM_ONLINE_USERS)
  2111. + {
  2112. + L2Fantome localL2Fantome = _phantoms.get(Integer.valueOf(paramInt));
  2113. + if (localL2Fantome == null)
  2114. + {
  2115. + return null;
  2116. + }
  2117. + Collection<?> localCollection = L2World.getInstance().getAllPlayers();
  2118. + L2PcInstance[] arrayOfL2PcInstance = localCollection.toArray(new L2PcInstance[localCollection.size()]);
  2119. + for (int j = 0; j < arrayOfL2PcInstance.length; j++)
  2120. + {
  2121. + if (paramInt == arrayOfL2PcInstance[j].getObjectId())
  2122. + {
  2123. + return null;
  2124. + }
  2125. + }
  2126. + L2Set localL2Set = getRandomSet();
  2127. + L2ItemInstance localL2ItemInstance1 = ItemTable.getInstance().createDummyItem(localL2Set._body);
  2128. + L2ItemInstance localL2ItemInstance2 = ItemTable.getInstance().createDummyItem(localL2Set._gaiters);
  2129. + L2ItemInstance localL2ItemInstance3 = ItemTable.getInstance().createDummyItem(localL2Set._gloves);
  2130. + L2ItemInstance localL2ItemInstance4 = ItemTable.getInstance().createDummyItem(localL2Set._boots);
  2131. + L2ItemInstance localL2ItemInstance5 = ItemTable.getInstance().createDummyItem(localL2Set._weapon);
  2132. + L2ItemInstance localL2ItemInstance6 = null;
  2133. + int k = localL2Set._grade;
  2134. + int m = 1;
  2135. + int n = 0;
  2136. + if (k == 0)
  2137. + {
  2138. + m = Rnd.get(1, 19);
  2139. + }
  2140. + if (k == 1)
  2141. + {
  2142. + m = Rnd.get(20, 39);
  2143. + }
  2144. + if (k == 2)
  2145. + {
  2146. + m = Rnd.get(40, 51);
  2147. + }
  2148. + if (k == 3)
  2149. + {
  2150. + m = Rnd.get(52, 60);
  2151. + }
  2152. + if (k == 4)
  2153. + {
  2154. + m = Rnd.get(61, 75);
  2155. + }
  2156. + if (k == 5)
  2157. + {
  2158. + m = Rnd.get(76, 80);
  2159. + }
  2160. + L2PcInstance localL2PcInstance = L2PcInstance.loadPhantom(paramInt, m, n, false);
  2161. + localL2PcInstance.setName(localL2Fantome.name);
  2162. + localL2PcInstance.setTitle(localL2Fantome.title);
  2163. + localL2PcInstance.getAppearance().setNameColor(getNameColor());
  2164. + localL2PcInstance.getAppearance().setTitleColor(getTitleColor());
  2165. + if (Rnd.get(100) < 40)
  2166. + {
  2167. + localL2PcInstance.setClan(ClanTable.getInstance().getClan(getRandomClan()));
  2168. + }
  2169. + localL2PcInstance.getInventory().equipItemAndRecord(localL2ItemInstance1);
  2170. + localL2PcInstance.getInventory().equipItemAndRecord(localL2ItemInstance2);
  2171. + localL2PcInstance.getInventory().equipItemAndRecord(localL2ItemInstance3);
  2172. + localL2PcInstance.getInventory().equipItemAndRecord(localL2ItemInstance4);
  2173. + int[] arrayOfInt =
  2174. + {
  2175. + 92,
  2176. + 102,
  2177. + 109
  2178. + };
  2179. + if (localL2Set._custom > 0)
  2180. + {
  2181. + localL2ItemInstance6 = ItemTable.getInstance().createDummyItem(localL2Set._custom);
  2182. + localL2PcInstance.getInventory().equipItemAndRecord(localL2ItemInstance6);
  2183. + }
  2184. + localL2ItemInstance5.setEnchantLevel(Rnd.get(Config.PHANTOM_PLAYERS_ENCHANT_MIN, Config.PHANTOM_PLAYERS_ENCHANT_MAX));
  2185. + if (Rnd.get(100) < 30)
  2186. + {
  2187. + localL2ItemInstance5.setAugmentation(new L2Augmentation(1067847165, 3250, 1));
  2188. + }
  2189. + L2Weapon localL2Weapon = localL2ItemInstance5.getWeaponItem();
  2190. + if ((localL2Weapon.getItemType() == L2WeaponType.BOW) && ((localL2PcInstance.getClassId().getId() != 92) || (localL2PcInstance.getClassId().getId() != 102) || (localL2PcInstance.getClassId().getId() != 109)))
  2191. + {
  2192. + localL2PcInstance.setClassId(arrayOfInt[Rnd.get(arrayOfInt.length)]);
  2193. + }
  2194. + localL2PcInstance.getInventory().equipItemAndRecord(localL2ItemInstance5);
  2195. + Location localLocation = getRandomLoc();
  2196. + localL2PcInstance.setPhantomLoc(localLocation.getX(), localLocation.getY(), localLocation.getZ());
  2197. + localL2PcInstance.getPosition().setXYZInvisible(localLocation.getX() + Rnd.get(60), localLocation.getY() + Rnd.get(60), localLocation.getZ());
  2198. + localL2PcInstance.spawnMe(localLocation.getX() + Rnd.get(1, 250), localLocation.getY() + Rnd.get(1, 250), localLocation.getZ());
  2199. + localL2PcInstance.broadcastUserInfo();
  2200. + localL2PcInstance.setOnlineStatusPhantom(true);
  2201. + startWalk(localL2PcInstance);
  2202. + return localL2PcInstance;
  2203. + }
  2204. + return null;
  2205. + }
  2206. +
  2207. + private Location getRandomLoc()
  2208. + {
  2209. + localLocation = null;
  2210. + if (localLocation == null)
  2211. + {
  2212. + localLocation = _PhantomsTownLoc.get(Rnd.get(0, _locsCount));
  2213. + }
  2214. + return localLocation;
  2215. + }
  2216. +
  2217. + private void parceColors()
  2218. + {
  2219. + _nameColors = Config.PHANTOM_PLAYERS_NAME_CLOLORS;
  2220. + _titleColors = Config.PHANTOM_PLAYERS_TITLE_CLOLORS;
  2221. + _nameColCount = _nameColors.size() - 1;
  2222. + _titleColCount = _titleColors.size() - 1;
  2223. + }
  2224. +
  2225. + public void startWalk(L2PcInstance paramL2PcInstance)
  2226. + {
  2227. + ThreadPoolManager.getInstance().scheduleGeneral(new PhantomWalk(paramL2PcInstance), 15000L);
  2228. + }
  2229. +
  2230. + private void parceArmors()
  2231. + {
  2232. + if (!_sets.isEmpty())
  2233. + {
  2234. + _sets.clear();
  2235. + }
  2236. + LineNumberReader localLineNumberReader = null;
  2237. + BufferedReader localBufferedReader = null;
  2238. + FileReader localFileReader = null;
  2239. + try
  2240. + {
  2241. + File localFile = new File("./config/phantom/town_sets.ini");
  2242. + if (!localFile.exists())
  2243. + {
  2244. + return;
  2245. + }
  2246. + localFileReader = new FileReader(localFile);
  2247. + localBufferedReader = new BufferedReader(localFileReader);
  2248. + localLineNumberReader = new LineNumberReader(localBufferedReader);
  2249. + String str;
  2250. + while ((str = localLineNumberReader.readLine()) != null)
  2251. + {
  2252. + if ((str.trim().length() != 0) && (!str.startsWith("#")))
  2253. + {
  2254. + String[] arrayOfString = str.split(",");
  2255. + int i = 0;
  2256. + try
  2257. + {
  2258. + i = Integer.parseInt(arrayOfString[5]);
  2259. + }
  2260. + catch (Exception localException5)
  2261. + {
  2262. + i = 0;
  2263. + }
  2264. + _sets.add(new L2Set(Integer.parseInt(arrayOfString[0]), Integer.parseInt(arrayOfString[1]), Integer.parseInt(arrayOfString[2]), Integer.parseInt(arrayOfString[3]), Integer.parseInt(arrayOfString[4]), Integer.parseInt(arrayOfString[5]), i));
  2265. + }
  2266. + }
  2267. + _setsCount = _sets.size() - 1;
  2268. + _log.info("Load " + _setsCount + " phantom armor sets");
  2269. + return;
  2270. + }
  2271. + catch (Exception localException2)
  2272. + {
  2273. + localException2.printStackTrace();
  2274. + }
  2275. + finally
  2276. + {
  2277. + try
  2278. + {
  2279. + if (localFileReader != null)
  2280. + {
  2281. + localFileReader.close();
  2282. + }
  2283. + if (localBufferedReader != null)
  2284. + {
  2285. + localBufferedReader.close();
  2286. + }
  2287. + if (localLineNumberReader != null)
  2288. + {
  2289. + localLineNumberReader.close();
  2290. + }
  2291. + }
  2292. + catch (Exception localException6)
  2293. + {
  2294. + }
  2295. + }
  2296. + }
  2297. +
  2298. + private void cacheFantoms()
  2299. + {
  2300. + new Thread(new Runnable()
  2301. + {
  2302. + @SuppressWarnings("unused")
  2303. + private String str2;
  2304. + @SuppressWarnings("unused")
  2305. + private Object localObject1;
  2306. +
  2307. + @Override
  2308. + public void run()
  2309. + {
  2310. + String str1 = "";
  2311. + str2 = "";
  2312. + Connection localConnection = null;
  2313. + localObject1 = null;
  2314. + try
  2315. + {
  2316. + localConnection = L2DatabaseFactory.getInstance().getConnection();
  2317. + localConnection.setTransactionIsolation(1);
  2318. + PreparedStatement localPreparedStatement = localConnection.prepareStatement("SELECT charId,char_name,title,x,y,z,clanid FROM characters WHERE account_name = ?");
  2319. + localPreparedStatement.setString(1, PhantomPlayers._phantomAcc);
  2320. + ResultSet localResultSet = localPreparedStatement.executeQuery();
  2321. + localResultSet.setFetchSize(250);
  2322. + while (localResultSet.next())
  2323. + {
  2324. + str1 = localResultSet.getString("char_name");
  2325. + PhantomPlayers._phantoms.put(Integer.valueOf(localResultSet.getInt("charId")), new PhantomPlayers.L2Fantome(str1, localResultSet.getString("title"), localResultSet.getInt("x"), localResultSet.getInt("y"), localResultSet.getInt("z"), localResultSet.getInt("clanid")));
  2326. + }
  2327. + localPreparedStatement.close();
  2328. + localResultSet.close();
  2329. + localConnection.close();
  2330. + PhantomPlayers._log.info("PhantomPlayers: Cached " + PhantomPlayers._phantoms.size() + " players.");
  2331. + }
  2332. + catch (Exception localException)
  2333. + {
  2334. + PhantomPlayers._log.warn("PhantomPlayers: could not load chars from DB: " + localException);
  2335. + }
  2336. + finally
  2337. + {
  2338. + if (localConnection != null)
  2339. + {
  2340. + localConnection = null;
  2341. + }
  2342. + }
  2343. + if (!PhantomPlayers._phantoms.isEmpty())
  2344. + {
  2345. + ThreadPoolManager.getInstance().scheduleGeneral(new FantomTask(1), Config.PHANTOM_PLAYERS_DELAY_FIRST);
  2346. + }
  2347. + }
  2348. + }).start();
  2349. + }
  2350. +
  2351. + private L2Set getRandomSet()
  2352. + {
  2353. + return _sets.get(Rnd.get(_setsCount));
  2354. + }
  2355. +
  2356. + private void parceArcherArmors()
  2357. + {
  2358. + if (!_setsArcher.isEmpty())
  2359. + {
  2360. + _setsArcher.clear();
  2361. + }
  2362. + LineNumberReader localLineNumberReader = null;
  2363. + BufferedReader localBufferedReader = null;
  2364. + FileReader localFileReader = null;
  2365. + try
  2366. + {
  2367. + File localFile = new File("./config/phantom/archer_sets.ini");
  2368. + if (!localFile.exists())
  2369. + {
  2370. + return;
  2371. + }
  2372. + localFileReader = new FileReader(localFile);
  2373. + localBufferedReader = new BufferedReader(localFileReader);
  2374. + localLineNumberReader = new LineNumberReader(localBufferedReader);
  2375. + String str;
  2376. + while ((str = localLineNumberReader.readLine()) != null)
  2377. + {
  2378. + if ((str.trim().length() != 0) && (!str.startsWith("#")))
  2379. + {
  2380. + String[] arrayOfString = str.split(",");
  2381. + int i = 0;
  2382. + try
  2383. + {
  2384. + i = Integer.parseInt(arrayOfString[5]);
  2385. + }
  2386. + catch (Exception localException5)
  2387. + {
  2388. + i = 0;
  2389. + }
  2390. + _setsArcher.add(new L2Set(Integer.parseInt(arrayOfString[0]), Integer.parseInt(arrayOfString[1]), Integer.parseInt(arrayOfString[2]), Integer.parseInt(arrayOfString[3]), Integer.parseInt(arrayOfString[4]), Integer.parseInt(arrayOfString[5]), i));
  2391. + }
  2392. + }
  2393. + _setsArcherCount = _setsArcher.size() - 1;
  2394. + _log.info("Load " + _setsArcherCount + " Aecher phantom armor sets");
  2395. + return;
  2396. + }
  2397. + catch (Exception localException2)
  2398. + {
  2399. + localException2.printStackTrace();
  2400. + }
  2401. + finally
  2402. + {
  2403. + try
  2404. + {
  2405. + if (localFileReader != null)
  2406. + {
  2407. + localFileReader.close();
  2408. + }
  2409. + if (localBufferedReader != null)
  2410. + {
  2411. + localBufferedReader.close();
  2412. + }
  2413. + if (localLineNumberReader != null)
  2414. + {
  2415. + localLineNumberReader.close();
  2416. + }
  2417. + }
  2418. + catch (Exception localException6)
  2419. + {
  2420. + }
  2421. + }
  2422. + }
  2423. +
  2424. + private void parceOlyArmors()
  2425. + {
  2426. + if (!_setsOly.isEmpty())
  2427. + {
  2428. + _setsOly.clear();
  2429. + }
  2430. + LineNumberReader localLineNumberReader = null;
  2431. + BufferedReader localBufferedReader = null;
  2432. + FileReader localFileReader = null;
  2433. + try
  2434. + {
  2435. + File localFile = new File("./config/phantom/oly_sets.ini");
  2436. + if (!localFile.exists())
  2437. + {
  2438. + return;
  2439. + }
  2440. + localFileReader = new FileReader(localFile);
  2441. + localBufferedReader = new BufferedReader(localFileReader);
  2442. + localLineNumberReader = new LineNumberReader(localBufferedReader);
  2443. + String str;
  2444. + while ((str = localLineNumberReader.readLine()) != null)
  2445. + {
  2446. + if ((str.trim().length() != 0) && (!str.startsWith("#")))
  2447. + {
  2448. + String[] arrayOfString = str.split(",");
  2449. + int i = 0;
  2450. + try
  2451. + {
  2452. + i = Integer.parseInt(arrayOfString[6]);
  2453. + }
  2454. + catch (Exception localException5)
  2455. + {
  2456. + i = 0;
  2457. + }
  2458. + _setsOly.add(new L2Set(Integer.parseInt(arrayOfString[0]), Integer.parseInt(arrayOfString[1]), Integer.parseInt(arrayOfString[2]), Integer.parseInt(arrayOfString[3]), Integer.parseInt(arrayOfString[4]), Integer.parseInt(arrayOfString[5]), i));
  2459. + }
  2460. + }
  2461. + _setsOlyCount = _setsOly.size() - 1;
  2462. + _log.info("Load " + _setsOlyCount + " phantom Only armor sets");
  2463. + return;
  2464. + }
  2465. + catch (Exception localException2)
  2466. + {
  2467. + localException2.printStackTrace();
  2468. + }
  2469. + finally
  2470. + {
  2471. + try
  2472. + {
  2473. + if (localFileReader != null)
  2474. + {
  2475. + localFileReader.close();
  2476. + }
  2477. + if (localBufferedReader != null)
  2478. + {
  2479. + localBufferedReader.close();
  2480. + }
  2481. + if (localLineNumberReader != null)
  2482. + {
  2483. + localLineNumberReader.close();
  2484. + }
  2485. + }
  2486. + catch (Exception localException6)
  2487. + {
  2488. + }
  2489. + }
  2490. + }
  2491. +
  2492. + private void parceTownClans()
  2493. + {
  2494. + LineNumberReader localLineNumberReader = null;
  2495. + BufferedReader localBufferedReader = null;
  2496. + FileReader localFileReader = null;
  2497. + try
  2498. + {
  2499. + File localFile = new File("./config/phantom/town_clans.ini");
  2500. + if (!localFile.exists())
  2501. + {
  2502. + return;
  2503. + }
  2504. + localFileReader = new FileReader(localFile);
  2505. + localBufferedReader = new BufferedReader(localFileReader);
  2506. + localLineNumberReader = new LineNumberReader(localBufferedReader);
  2507. + int i = 0;
  2508. + String str1;
  2509. + while ((str1 = localLineNumberReader.readLine()) != null)
  2510. + {
  2511. + if ((str1.trim().length() != 0) && (!str1.startsWith("#")))
  2512. + {
  2513. + String[] arrayOfString1 = str1.split(":");
  2514. + i = Integer.parseInt(arrayOfString1[0]);
  2515. + String[] arrayOfString2 = arrayOfString1[1].split(",");
  2516. + ConcurrentLinkedQueue<Integer> localConcurrentLinkedQueue = new ConcurrentLinkedQueue<>();
  2517. + for (String str2 : arrayOfString2)
  2518. + {
  2519. + localConcurrentLinkedQueue.add(Integer.valueOf(Integer.parseInt(str2)));
  2520. + }
  2521. + _PhantomsTownClanList.put(Integer.valueOf(i), localConcurrentLinkedQueue);
  2522. + }
  2523. + }
  2524. + _setsCountClan = _PhantomsTownClanList.size() - 1;
  2525. + _log.info("Load " + _setsCountClan + " phantom Clans");
  2526. + return;
  2527. + }
  2528. + catch (Exception localException2)
  2529. + {
  2530. + localException2.printStackTrace();
  2531. + }
  2532. + finally
  2533. + {
  2534. + try
  2535. + {
  2536. + if (localFileReader != null)
  2537. + {
  2538. + localFileReader.close();
  2539. + }
  2540. + if (localBufferedReader != null)
  2541. + {
  2542. + localBufferedReader.close();
  2543. + }
  2544. + if (localLineNumberReader != null)
  2545. + {
  2546. + localLineNumberReader.close();
  2547. + }
  2548. + }
  2549. + catch (Exception localException5)
  2550. + {
  2551. + }
  2552. + }
  2553. + }
  2554. +
  2555. + private void parceTownLocs()
  2556. + {
  2557. + _PhantomsTownLoc.clear();
  2558. + LineNumberReader localLineNumberReader = null;
  2559. + BufferedReader localBufferedReader = null;
  2560. + FileReader localFileReader = null;
  2561. + try
  2562. + {
  2563. + File localFile = new File("./config/phantom/town_locs.ini");
  2564. + if (!localFile.exists())
  2565. + {
  2566. + return;
  2567. + }
  2568. + localFileReader = new FileReader(localFile);
  2569. + localBufferedReader = new BufferedReader(localFileReader);
  2570. + localLineNumberReader = new LineNumberReader(localBufferedReader);
  2571. + String str;
  2572. + while ((str = localLineNumberReader.readLine()) != null)
  2573. + {
  2574. + if ((str.trim().length() != 0) && (!str.startsWith("#")))
  2575. + {
  2576. + String[] arrayOfString = str.split(",");
  2577. + _PhantomsTownLoc.add(new Location(Integer.parseInt(arrayOfString[0]), Integer.parseInt(arrayOfString[1]), Integer.parseInt(arrayOfString[2])));
  2578. + }
  2579. + }
  2580. + _locsCount = _PhantomsTownLoc.size() - 1;
  2581. + _log.info("Load " + _locsCount + " phantom Town Locations");
  2582. + return;
  2583. + }
  2584. + catch (Exception localException2)
  2585. + {
  2586. + localException2.printStackTrace();
  2587. + }
  2588. + finally
  2589. + {
  2590. + try
  2591. + {
  2592. + if (localFileReader != null)
  2593. + {
  2594. + localFileReader.close();
  2595. + }
  2596. + if (localBufferedReader != null)
  2597. + {
  2598. + localBufferedReader.close();
  2599. + }
  2600. + if (localLineNumberReader != null)
  2601. + {
  2602. + localLineNumberReader.close();
  2603. + }
  2604. + }
  2605. + catch (Exception localException5)
  2606. + {
  2607. + }
  2608. + }
  2609. + }
  2610. +
  2611. + private void cacheEnchantPhrases()
  2612. + {
  2613. + _PhantomsEnchPhrases.clear();
  2614. + LineNumberReader localLineNumberReader = null;
  2615. + BufferedReader localBufferedReader = null;
  2616. + FileReader localFileReader = null;
  2617. + try
  2618. + {
  2619. + File localFile = new File("./config/phantom/phrases_enchant.txt");
  2620. + if (!localFile.exists())
  2621. + {
  2622. + return;
  2623. + }
  2624. + localFileReader = new FileReader(localFile);
  2625. + localBufferedReader = new BufferedReader(localFileReader);
  2626. + localLineNumberReader = new LineNumberReader(localBufferedReader);
  2627. + String str;
  2628. + while ((str = localLineNumberReader.readLine()) != null)
  2629. + {
  2630. + if ((str.trim().length() != 0) && (!str.startsWith("#")))
  2631. + {
  2632. + _PhantomsEnchPhrases.add(str);
  2633. + }
  2634. + }
  2635. + _PhantomsEnchPhsCount = _PhantomsEnchPhrases.size() - 1;
  2636. + _log.info("Load " + _PhantomsEnchPhsCount + " phantom Ench");
  2637. + return;
  2638. + }
  2639. + catch (Exception localException2)
  2640. + {
  2641. + localException2.printStackTrace();
  2642. + }
  2643. + finally
  2644. + {
  2645. + try
  2646. + {
  2647. + if (localFileReader != null)
  2648. + {
  2649. + localFileReader.close();
  2650. + }
  2651. + if (localBufferedReader != null)
  2652. + {
  2653. + localBufferedReader.close();
  2654. + }
  2655. + if (localLineNumberReader != null)
  2656. + {
  2657. + localLineNumberReader.close();
  2658. + }
  2659. + }
  2660. + catch (Exception localException5)
  2661. + {
  2662. + }
  2663. + }
  2664. + }
  2665. +
  2666. + private void cacheLastPhrases()
  2667. + {
  2668. + _PhantomsLastPhrases.clear();
  2669. + LineNumberReader localLineNumberReader = null;
  2670. + BufferedReader localBufferedReader = null;
  2671. + FileReader localFileReader = null;
  2672. + try
  2673. + {
  2674. + File localFile = new File("./config/phantom/phrases_last.ini");
  2675. + if (!localFile.exists())
  2676. + {
  2677. + return;
  2678. + }
  2679. + localFileReader = new FileReader(localFile);
  2680. + localBufferedReader = new BufferedReader(localFileReader);
  2681. + localLineNumberReader = new LineNumberReader(localBufferedReader);
  2682. + String str;
  2683. + while ((str = localLineNumberReader.readLine()) != null)
  2684. + {
  2685. + if ((str.trim().length() != 0) && (!str.startsWith("#")))
  2686. + {
  2687. + _PhantomsLastPhrases.add(str);
  2688. + }
  2689. + }
  2690. + _PhantomsLastPhsCount = _PhantomsLastPhrases.size() - 1;
  2691. + _log.info("Load " + _PhantomsLastPhsCount + " phantom Last");
  2692. + return;
  2693. + }
  2694. + catch (Exception localException2)
  2695. + {
  2696. + localException2.printStackTrace();
  2697. + }
  2698. + finally
  2699. + {
  2700. + try
  2701. + {
  2702. + if (localFileReader != null)
  2703. + {
  2704. + localFileReader.close();
  2705. + }
  2706. + if (localBufferedReader != null)
  2707. + {
  2708. + localBufferedReader.close();
  2709. + }
  2710. + if (localLineNumberReader != null)
  2711. + {
  2712. + localLineNumberReader.close();
  2713. + }
  2714. + }
  2715. + catch (Exception localException5)
  2716. + {
  2717. + }
  2718. + }
  2719. + }
  2720. +
  2721. + @SuppressWarnings("unused")
  2722. + private L2Set getRandomArcherSet()
  2723. + {
  2724. + return _setsArcher.get(Rnd.get(_setsArcherCount));
  2725. + }
  2726. +
  2727. + @SuppressWarnings("unused")
  2728. + private int getRandomPhantom()
  2729. + {
  2730. + return Rnd.get(511151115, 511157100);
  2731. + }
  2732. +
  2733. + public int getRandomPhantomNext()
  2734. + {
  2735. + int i = 0;
  2736. + for (int j = 6; j > 0; j--)
  2737. + {
  2738. + i = Rnd.get(511151115, 511157100);
  2739. + if ((!_PhantomsTown.get(Integer.valueOf(1)).contains(Integer.valueOf(i))) && (!_PhantomsTown.get(Integer.valueOf(2)).contains(Integer.valueOf(i))))
  2740. + {
  2741. + return i;
  2742. + }
  2743. + }
  2744. + return getRandomPhantomNext();
  2745. + }
  2746. +
  2747. + private int getRandomClan()
  2748. + {
  2749. + return Rnd.get(511158000, 511158008);
  2750. + }
  2751. +
  2752. + @SuppressWarnings("unused")
  2753. + private String getRandomEnchantPhrase()
  2754. + {
  2755. + return _PhantomsEnchPhrases.get(Rnd.get(_PhantomsEnchPhsCount));
  2756. + }
  2757. +
  2758. + public String getRandomLastPhrase()
  2759. + {
  2760. + return _PhantomsLastPhrases.get(Rnd.get(_PhantomsLastPhsCount));
  2761. + }
  2762. +
  2763. + private class PhantomWalk implements Runnable
  2764. + {
  2765. + L2PcInstance _phantom;
  2766. +
  2767. + public PhantomWalk(L2PcInstance paramL2PcInstance)
  2768. + {
  2769. + this._phantom = paramL2PcInstance;
  2770. + }
  2771. +
  2772. + @Override
  2773. + public void run()
  2774. + {
  2775. + if (this._phantom.getAI().getIntention() != CtrlIntention.ATTACK)
  2776. + {
  2777. + this._phantom.rndWalk();
  2778. + }
  2779. + PhantomPlayers.this.startWalk(this._phantom);
  2780. + }
  2781. + }
  2782. +
  2783. + static class L2Set
  2784. + {
  2785. + public int _body;
  2786. + public int _gaiters;
  2787. + public int _gloves;
  2788. + public int _boots;
  2789. + public int _weapon;
  2790. + public int _custom;
  2791. + public int _grade;
  2792. +
  2793. + L2Set(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, int paramInt7)
  2794. + {
  2795. + this._body = paramInt1;
  2796. + this._gaiters = paramInt2;
  2797. + this._gloves = paramInt3;
  2798. + this._boots = paramInt4;
  2799. + this._weapon = paramInt5;
  2800. + this._grade = paramInt6;
  2801. + this._custom = paramInt7;
  2802. + }
  2803. + }
  2804. +
  2805. + static class L2Fantome
  2806. + {
  2807. + public String name;
  2808. + public String title;
  2809. + public int x;
  2810. + public int y;
  2811. + public int z;
  2812. + public int clanId;
  2813. +
  2814. + L2Fantome(String paramString1, String paramString2, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  2815. + {
  2816. + this.name = paramString1;
  2817. + this.title = paramString2;
  2818. + this.x = paramInt1;
  2819. + this.y = paramInt2;
  2820. + this.z = paramInt3;
  2821. + this.clanId = paramInt4;
  2822. + }
  2823. + }
  2824. +
  2825. + public class FantomTask implements Runnable
  2826. + {
  2827. + public int _task;
  2828. +
  2829. + public FantomTask(int paramInt)
  2830. + {
  2831. + this._task = paramInt;
  2832. + }
  2833. +
  2834. + @Override
  2835. + public void run()
  2836. + {
  2837. + int i = 0;
  2838. + int j = 0;
  2839. + int k = 0;
  2840. + int m = 0;
  2841. + L2PcInstance localL2PcInstance;
  2842. + switch (this._task)
  2843. + {
  2844. + case 1:
  2845. + PhantomPlayers._log.info("PhantomPlayers: 1st wave, spawn started.");
  2846. + while (i < Config.PHANTOM_PLAYERS_COUNT_FIRST)
  2847. + {
  2848. + localL2PcInstance = null;
  2849. + k = getRandomPhantomNext();
  2850. + if (!_PhantomsTown.get(Integer.valueOf(1)).contains(Integer.valueOf(k)))
  2851. + {
  2852. + localL2PcInstance = loadPhantom(k);
  2853. + if (localL2PcInstance != null)
  2854. + {
  2855. + _PhantomsTown.get(Integer.valueOf(1)).add(localL2PcInstance);
  2856. + if ((Config.PHANTOM_PLAYERS_SOULSHOT_ANIM) && (Rnd.get(100) < 45))
  2857. + {
  2858. + try
  2859. + {
  2860. + Thread.sleep(900L);
  2861. + }
  2862. + catch (InterruptedException localInterruptedException1)
  2863. + {
  2864. + }
  2865. + if (Rnd.get(100) < 3)
  2866. + {
  2867. + localL2PcInstance.sitDown();
  2868. + }
  2869. + localL2PcInstance.broadcastPacket(new MagicSkillUse(localL2PcInstance, localL2PcInstance, 2154, 1, 0, 0, false));
  2870. + try
  2871. + {
  2872. + Thread.sleep(300L);
  2873. + }
  2874. + catch (InterruptedException localInterruptedException2)
  2875. + {
  2876. + }
  2877. + localL2PcInstance.broadcastPacket(new MagicSkillUse(localL2PcInstance, localL2PcInstance, 2164, 1, 0, 0, false));
  2878. + }
  2879. + try
  2880. + {
  2881. + Thread.sleep(Config.PHANTOM_PLAYERS_DELAY_SPAWN_FIRST);
  2882. + }
  2883. + catch (InterruptedException localInterruptedException3)
  2884. + {
  2885. + }
  2886. + i++;
  2887. + }
  2888. + }
  2889. + }
  2890. + PhantomPlayers._log.info("FPhantomPlayers: 1st wave, spawned " + i + " players.");
  2891. + System.out.println("4");
  2892. + ThreadPoolManager.getInstance().scheduleGeneral(new FantomTaskDespawn(1), Config.PHANTOM_PLAYERS_DESPAWN_FIRST);
  2893. + ThreadPoolManager.getInstance().scheduleGeneral(new FantomTask(2), Config.PHANTOM_PLAYERS_DELAY_NEXT);
  2894. + ThreadPoolManager.getInstance().scheduleGeneral(new Social(), 12000L);
  2895. + ThreadPoolManager.getInstance().scheduleGeneral(new CheckCount(), 300000L);
  2896. + break;
  2897. + case 2:
  2898. + PhantomPlayers._log.info("PhantomPlayers: 2nd wave, spawn started.");
  2899. + while (j < Config.PHANTOM_PLAYERS_COUNT_NEXT)
  2900. + {
  2901. + localL2PcInstance = null;
  2902. + m = PhantomPlayers.this.getRandomPhantomNext();
  2903. + if ((!_PhantomsTown.get(Integer.valueOf(1)).contains(Integer.valueOf(m))) || (!_PhantomsTown.get(Integer.valueOf(2)).contains(Integer.valueOf(m))))
  2904. + {
  2905. + localL2PcInstance = PhantomPlayers.this.loadPhantom(m);
  2906. + if (localL2PcInstance != null)
  2907. + {
  2908. + _PhantomsTown.get(Integer.valueOf(2)).add(localL2PcInstance);
  2909. + if ((Config.PHANTOM_PLAYERS_SOULSHOT_ANIM) && (Rnd.get(100) < 45))
  2910. + {
  2911. + try
  2912. + {
  2913. + Thread.sleep(900L);
  2914. + }
  2915. + catch (InterruptedException localInterruptedException4)
  2916. + {
  2917. + }
  2918. + if (Rnd.get(100) < 3)
  2919. + {
  2920. + localL2PcInstance.sitDown();
  2921. + }
  2922. + localL2PcInstance.broadcastPacket(new MagicSkillUse(localL2PcInstance, localL2PcInstance, 2154, 1, 0, 0, false));
  2923. + try
  2924. + {
  2925. + Thread.sleep(300L);
  2926. + }
  2927. + catch (InterruptedException localInterruptedException5)
  2928. + {
  2929. + }
  2930. + localL2PcInstance.broadcastPacket(new MagicSkillUse(localL2PcInstance, localL2PcInstance, 2164, 1, 0, 0, false));
  2931. + }
  2932. + try
  2933. + {
  2934. + Thread.sleep(Config.PHANTOM_PLAYERS_DELAY_SPAWN_NEXT);
  2935. + }
  2936. + catch (InterruptedException localInterruptedException6)
  2937. + {
  2938. + }
  2939. + j++;
  2940. + }
  2941. + }
  2942. + }
  2943. + PhantomPlayers._log.info("PhantomPlayers: 2nd wave, spawned " + j + " players.");
  2944. + ThreadPoolManager.getInstance().scheduleGeneral(new PhantomPlayers.FantomTaskDespawn(2), Config.PHANTOM_PLAYERS_DESPAWN_NEXT);
  2945. + }
  2946. + }
  2947. + }
  2948. +
  2949. + public class FantomTaskDespawn implements Runnable
  2950. + {
  2951. + public int _task;
  2952. + @SuppressWarnings("unused")
  2953. + private Location localLocation;
  2954. +
  2955. + public FantomTaskDespawn(int paramInt)
  2956. + {
  2957. + this._task = paramInt;
  2958. + }
  2959. +
  2960. + @Override
  2961. + public void run()
  2962. + {
  2963. + localLocation = null;
  2964. + L2PcInstance localL2PcInstance1 = null;
  2965. + ConcurrentLinkedQueue<?> localConcurrentLinkedQueue = _PhantomsTown.get(Integer.valueOf(this._task));
  2966. + Iterator<?> localIterator = localConcurrentLinkedQueue.iterator();
  2967. + while (localIterator.hasNext())
  2968. + {
  2969. + Object localObject = localIterator.next();
  2970. + L2PcInstance localL2PcInstance2 = (L2PcInstance) localObject;
  2971. + if (localObject != null)
  2972. + {
  2973. + localLocation = localL2PcInstance2.getPhantomLoc();
  2974. + new Disconnection(localL2PcInstance2).defaultSequence(false);
  2975. + localL2PcInstance2.setOnlineStatus(false);
  2976. + _PhantomsTown.get(Integer.valueOf(this._task)).remove(localObject);
  2977. + try
  2978. + {
  2979. + Thread.sleep(this._task == 1 ? Config.PHANTOM_PLAYERS_DELAY_DESPAWN_FIRST : Config.PHANTOM_PLAYERS_DELAY_DESPAWN_NEXT);
  2980. + }
  2981. + catch (InterruptedException localInterruptedException1)
  2982. + {
  2983. + }
  2984. + if (_PhantomsTownTotal <= _PhantomsLimit)
  2985. + {
  2986. + int i = PhantomPlayers.this.getRandomPhantomNext();
  2987. + if (!_PhantomsTown.get(Integer.valueOf(this._task)).contains(Integer.valueOf(i)))
  2988. + {
  2989. + localL2PcInstance1 = PhantomPlayers.this.loadPhantom(i);
  2990. + if (localL2PcInstance1 != null)
  2991. + {
  2992. + _PhantomsTown.get(Integer.valueOf(this._task)).add(localL2PcInstance1);
  2993. + if ((Config.PHANTOM_PLAYERS_SOULSHOT_ANIM) && (Rnd.get(100) < 45))
  2994. + {
  2995. + try
  2996. + {
  2997. + Thread.sleep(900L);
  2998. + }
  2999. + catch (InterruptedException localInterruptedException2)
  3000. + {
  3001. + }
  3002. + if (Rnd.get(100) < 3)
  3003. + {
  3004. + localL2PcInstance1.sitDown();
  3005. + }
  3006. + localL2PcInstance1.broadcastPacket(new MagicSkillUse(localL2PcInstance1, localL2PcInstance1, 2154, 1, 0, 0, false));
  3007. + try
  3008. + {
  3009. + Thread.sleep(300L);
  3010. + }
  3011. + catch (InterruptedException localInterruptedException3)
  3012. + {
  3013. + }
  3014. + localL2PcInstance1.broadcastPacket(new MagicSkillUse(localL2PcInstance1, localL2PcInstance1, 2164, 1, 0, 0, false));
  3015. + }
  3016. + try
  3017. + {
  3018. + Thread.sleep(100L);
  3019. + }
  3020. + catch (InterruptedException localInterruptedException4)
  3021. + {
  3022. + }
  3023. + }
  3024. + }
  3025. + }
  3026. + }
  3027. + }
  3028. + ThreadPoolManager.getInstance().scheduleGeneral(new FantomTaskDespawn(1), this._task == 1 ? Config.PHANTOM_PLAYERS_DESPAWN_FIRST : Config.PHANTOM_PLAYERS_DESPAWN_NEXT);
  3029. + }
  3030. + }
  3031. +
  3032. + public class CheckCount implements Runnable
  3033. + {
  3034. + public CheckCount()
  3035. + {
  3036. + }
  3037. +
  3038. + @Override
  3039. + public void run()
  3040. + {
  3041. + Iterator<?> localIterator1 = _PhantomsTown.entrySet().iterator();
  3042. + while (localIterator1.hasNext())
  3043. + {
  3044. + Entry<?, ?> localEntry = (Entry<?, ?>) localIterator1.next();
  3045. + Integer localInteger = (Integer) localEntry.getKey();
  3046. + ConcurrentLinkedQueue<?> localConcurrentLinkedQueue = (ConcurrentLinkedQueue<?>) localEntry.getValue();
  3047. + if ((localInteger != null) && (localConcurrentLinkedQueue != null) && (!localConcurrentLinkedQueue.isEmpty()))
  3048. + {
  3049. + int i = localInteger.intValue() == 1 ? Config.PHANTOM_PLAYERS_COUNT_FIRST : Config.PHANTOM_PLAYERS_COUNT_NEXT;
  3050. + int j = localConcurrentLinkedQueue.size() - i;
  3051. + if (j >= 1)
  3052. + {
  3053. + Iterator<?> localIterator2 = localConcurrentLinkedQueue.iterator();
  3054. + while (localIterator2.hasNext())
  3055. + {
  3056. + Object localObject = localIterator2.next();
  3057. + L2PcInstance localL2PcInstance = (L2PcInstance) localObject;
  3058. + new Disconnection(localL2PcInstance).defaultSequence(false);
  3059. + localL2PcInstance.setOnlineStatus(false);
  3060. + PhantomPlayers._PhantomsTown.get(localInteger).remove(localObject);
  3061. + j--;
  3062. + if (j == 0)
  3063. + {
  3064. + break;
  3065. + }
  3066. + }
  3067. + }
  3068. + }
  3069. + }
  3070. + ThreadPoolManager.getInstance().scheduleGeneral(new CheckCount(), 300000L);
  3071. + }
  3072. + }
  3073. +
  3074. + public class Social implements Runnable
  3075. + {
  3076. + public Social()
  3077. + {
  3078. + }
  3079. +
  3080. + @Override
  3081. + public void run()
  3082. + {
  3083. + TextBuilder localTextBuilder = new TextBuilder();
  3084. + Iterator<?> localIterator1 = PhantomPlayers._PhantomsTown.entrySet().iterator();
  3085. + while (localIterator1.hasNext())
  3086. + {
  3087. + Entry<?, ?> localEntry = (Entry<?, ?>) localIterator1.next();
  3088. + Integer localInteger = (Integer) localEntry.getKey();
  3089. + ConcurrentLinkedQueue<?> localConcurrentLinkedQueue = (ConcurrentLinkedQueue<?>) localEntry.getValue();
  3090. + if ((localInteger != null) && (localConcurrentLinkedQueue != null) && (!localConcurrentLinkedQueue.isEmpty()))
  3091. + {
  3092. + int i = 0;
  3093. + Iterator<?> localIterator2 = localConcurrentLinkedQueue.iterator();
  3094. + while (localIterator2.hasNext())
  3095. + {
  3096. + Object localObject = localIterator2.next();
  3097. + L2PcInstance localL2PcInstance = (L2PcInstance) localObject;
  3098. + if (Rnd.get(100) < 65)
  3099. + {
  3100. + switch (Rnd.get(2))
  3101. + {
  3102. + case 0:
  3103. + case 1:
  3104. + L2ItemInstance localL2ItemInstance = localL2PcInstance.getActiveWeaponInstance();
  3105. + int j = localL2ItemInstance.getEnchantLevel();
  3106. + int k = j + 1;
  3107. + if ((Rnd.get(100) < 45) && (j <= Config.ENCHANT_MAX_WEAPON_NORMAL))
  3108. + {
  3109. + localL2ItemInstance.setEnchantLevel(k);
  3110. + }
  3111. + else if (Rnd.get(100) < 70)
  3112. + {
  3113. + localL2ItemInstance.setEnchantLevel(3);
  3114. + if ((k > 13) && (Rnd.get(100) < 2))
  3115. + {
  3116. + localTextBuilder.append("!");
  3117. + for (int m = Rnd.get(2, 13); m > 0; m--)
  3118. + {
  3119. + localTextBuilder.append("!");
  3120. + }
  3121. + localTextBuilder.clear();
  3122. + }
  3123. + }
  3124. + localL2PcInstance.broadcastUserInfo();
  3125. + break;
  3126. + case 2:
  3127. + if (Rnd.get(100) < 5)
  3128. + {
  3129. + localL2PcInstance.getAI().setIntention(CtrlIntention.MOVE_TO, new L2CharPosition(localL2PcInstance.getX() + Rnd.get(30), localL2PcInstance.getY() + Rnd.get(30), localL2PcInstance.getZ(), 0));
  3130. + }
  3131. + break;
  3132. + }
  3133. + try
  3134. + {
  3135. + Thread.sleep(Rnd.get(500, 1500));
  3136. + }
  3137. + catch (InterruptedException localInterruptedException)
  3138. + {
  3139. + }
  3140. + i++;
  3141. + }
  3142. + if (i > 55)
  3143. + {
  3144. + break;
  3145. + }
  3146. + }
  3147. + }
  3148. + }
  3149. + localTextBuilder.clear();
  3150. + ThreadPoolManager.getInstance().scheduleGeneral(new Social(), 12000L);
  3151. + }
  3152. + }
  3153. +}
  3154. \ No newline at end of file
  3155. Index: Dream_GameServer/dist/config/main/options.properties
  3156. ===================================================================
  3157. --- Dream_GameServer/dist/config/main/options.properties (revision 83)
  3158. +++ Dream_GameServer/dist/config/main/options.properties (working copy)
  3159. @@ -375,4 +375,7 @@
  3160.  
  3161. # Levels, with which you can communicate and trade auto chat rooms
  3162. ShoutChatLevel = 1
  3163. -TradeChatLevel = 1
  3164. \ No newline at end of file
  3165. +TradeChatLevel = 1
  3166. +
  3167. +EnableOFFTeleporter = True
  3168. +OFFAcceptedTeleportersId = 30080
  3169. \ No newline at end of file
  3170. Index: Dream_GameServer/dist/config/custom/custom.properties
  3171. ===================================================================
  3172. --- Dream_GameServer/dist/config/custom/custom.properties (revision 83)
  3173. +++ Dream_GameServer/dist/config/custom/custom.properties (working copy)
  3174. @@ -88,7 +88,7 @@
  3175. # Load Custom Droplist's Table
  3176. LoadCustomDroplistTable = False
  3177.  
  3178. -# Load Custom Teleport's Table
  3179. +# Load Custom ArmorSet's Table
  3180. LoadCustomArmorSetTable = False
  3181.  
  3182. # Load Custom Spawnlist's Table
  3183. Index: Dream_GameServer/src/com/dream/game/manager/VipManager.java
  3184. ===================================================================
  3185. --- Dream_GameServer/src/com/dream/game/manager/VipManager.java (revision 0)
  3186. +++ Dream_GameServer/src/com/dream/game/manager/VipManager.java (working copy)
  3187. @@ -0,0 +1,179 @@
  3188. +package com.dream.game.manager;
  3189. +
  3190. +import java.sql.Connection;
  3191. +import java.sql.PreparedStatement;
  3192. +import java.sql.ResultSet;
  3193. +import java.util.Map;
  3194. +import java.util.concurrent.ConcurrentHashMap;
  3195. +import java.util.concurrent.ScheduledFuture;
  3196. +import java.util.logging.Logger;
  3197. +
  3198. +import com.dream.L2DatabaseFactory;
  3199. +import com.dream.game.model.actor.instance.L2PcInstance;
  3200. +import com.dream.game.model.world.L2World;
  3201. +import com.dream.game.network.ThreadPoolManager;
  3202. +import com.dream.game.network.serverpackets.ExShowScreenMessage;
  3203. +import com.dream.util.CloseUtil;
  3204. +
  3205. +/**
  3206. + * @author rapfersan92
  3207. + */
  3208. +public class VipManager
  3209. +{
  3210. + private static final Logger _log = Logger.getLogger(VipManager.class.getName());
  3211. +
  3212. + private final Map<Integer, Long> _vips;
  3213. + protected final Map<Integer, Long> _vipsTask;
  3214. + private ScheduledFuture<?> _scheduler;
  3215. +
  3216. + public static VipManager getInstance()
  3217. + {
  3218. + return SingletonHolder._instance;
  3219. + }
  3220. +
  3221. + protected VipManager()
  3222. + {
  3223. + _vips = new ConcurrentHashMap<>();
  3224. + _vipsTask = new ConcurrentHashMap<>();
  3225. + _scheduler = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new VipTask(), 1000, 1000);
  3226. + load();
  3227. + }
  3228. +
  3229. + public void reload()
  3230. + {
  3231. + _vips.clear();
  3232. + _vipsTask.clear();
  3233. + if (_scheduler != null)
  3234. + _scheduler.cancel(true);
  3235. + _scheduler = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new VipTask(), 1000, 1000);
  3236. + load();
  3237. + }
  3238. +
  3239. + public void load()
  3240. + {
  3241. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  3242. + {
  3243. + PreparedStatement statement = con.prepareStatement("SELECT charId, duration FROM character_vip ORDER BY charId");
  3244. + ResultSet rs = statement.executeQuery();
  3245. + while (rs.next())
  3246. + _vips.put(rs.getInt("charId"), rs.getLong("duration"));
  3247. + rs.close();
  3248. + statement.close();
  3249. + }
  3250. + catch (Exception e)
  3251. + {
  3252. + _log.warning("Exception: VipManager load: " + e.getMessage());
  3253. + }
  3254. +
  3255. + _log.info("VipManager: Loaded " + _vips.size() + " characters with vip privileges.");
  3256. + }
  3257. +
  3258. + public void addVip(int charId, long duration)
  3259. + {
  3260. + _vips.put(charId, duration);
  3261. + _vipsTask.put(charId, duration);
  3262. + manageVipPrivileges(charId);
  3263. + }
  3264. +
  3265. + public static void doVip(L2PcInstance player, int days)
  3266. + {
  3267. + if (player == null)
  3268. + return;
  3269. +
  3270. + player.setEndTime("vip", days);
  3271. +
  3272. + Connection connection = null;
  3273. + try
  3274. + {
  3275. + connection = L2DatabaseFactory.getInstance().getConnection();
  3276. +
  3277. + PreparedStatement statement = connection.prepareStatement("INSERT INTO character_vip (charId, duration) VALUES (?, ?)");
  3278. + statement.setInt(1, player.getObjectId());
  3279. + statement.setLong(2, player.getVipEndTime());
  3280. + statement.execute();
  3281. + statement.close();
  3282. + connection.close();
  3283. + }
  3284. + catch (Exception e)
  3285. + {
  3286. +
  3287. + }
  3288. + finally
  3289. + {
  3290. + CloseUtil.close(connection);
  3291. + }
  3292. + }
  3293. +
  3294. + public void removeVip(int charId)
  3295. + {
  3296. + _vips.remove(charId);
  3297. + _vipsTask.remove(charId);
  3298. + manageVipPrivileges(charId);
  3299. +
  3300. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  3301. + {
  3302. + PreparedStatement statement = con.prepareStatement("DELETE FROM character_vip WHERE charId = ?");
  3303. + statement.setInt(1, charId);
  3304. + statement.execute();
  3305. + statement.close();
  3306. + }
  3307. + catch (Exception e)
  3308. + {
  3309. + _log.warning("Exception: VipManager removeVip: " + e.getMessage());
  3310. + }
  3311. + }
  3312. +
  3313. + public boolean hasVipPrivileges(int charId)
  3314. + {
  3315. + return _vips.containsKey(charId);
  3316. + }
  3317. +
  3318. + public long getVipDuration(int charId)
  3319. + {
  3320. + return _vips.get(charId);
  3321. + }
  3322. +
  3323. + public void addVipTask(int charId, long duration)
  3324. + {
  3325. + _vipsTask.put(charId, duration);
  3326. + }
  3327. +
  3328. + public void removeVipTask(int charId)
  3329. + {
  3330. + _vipsTask.remove(charId);
  3331. + }
  3332. +
  3333. + public void manageVipPrivileges(int charId)
  3334. + {
  3335. + final L2PcInstance player = L2World.getInstance().getPlayer(charId);
  3336. + player.broadcastUserInfo();
  3337. + }
  3338. +
  3339. + public class VipTask implements Runnable
  3340. + {
  3341. + @Override
  3342. + public final void run()
  3343. + {
  3344. + if (_vipsTask.isEmpty())
  3345. + return;
  3346. +
  3347. + for (Map.Entry<Integer, Long> entry : _vipsTask.entrySet())
  3348. + {
  3349. + final long duration = entry.getValue();
  3350. + if (System.currentTimeMillis() > duration)
  3351. + {
  3352. + final int charId = entry.getKey();
  3353. + removeVip(charId);
  3354. +
  3355. + final L2PcInstance player = L2World.getInstance().getPlayer(charId);
  3356. + player.sendPacket(new ExShowScreenMessage("Your vip privileges were removed.", 10000));
  3357. + }
  3358. + }
  3359. + }
  3360. + }
  3361. +
  3362. + private static class SingletonHolder
  3363. + {
  3364. + protected static final VipManager _instance = new VipManager();
  3365. + }
  3366. +}
  3367. \ No newline at end of file
  3368. Index: Dream_DataPack/data/html/mods/SAOHtml.htm
  3369. ===================================================================
  3370. --- Dream_DataPack/data/html/mods/SAOHtml.htm (revision 0)
  3371. +++ Dream_DataPack/data/html/mods/SAOHtml.htm (working copy)
  3372. @@ -0,0 +1,8 @@
  3373. +<html>
  3374. +<title></title>
  3375. +<body>
  3376. +<br>
  3377. +<br>
  3378. +<center>
  3379. +Luan bixona.
  3380. +</body></html>
  3381. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement