Guest User

Kodas

a guest
Jul 5th, 2013
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.06 KB | None | 0 0
  1. Index: java/com/descja/gameserver/model/actor/instance/L2PcInstance.java
  2. ===================================================================
  3. --- java/com/descja/gameserver/model/actor/instance/L2PcInstance.java (revision 38)
  4. +++ java/com/descja/gameserver/model/actor/instance/L2PcInstance.java (revision 38)
  5.  
  6. private long _chatBanTimer = 0L;
  7. private ScheduledFuture<?> _chatBanTask = null;
  8.  
  9. private boolean _isOffline = false;
  10. + private boolean _isFakePlayer = false;
  11.  
  12.  
  13.  
  14. public void setOffline(boolean set)
  15. {
  16. _isOffline = set;
  17. }
  18.  
  19. + public boolean isFakePlayer()
  20. + {
  21. + return _isFakePlayer;
  22. + }
  23. ===================================================================
  24. Index: java/com/descja/FakePlayers.java
  25. ===================================================================
  26. --- java/com/descja/FakePlayers.java (revision 0)
  27. +++ java/com/descja/FakePlayers.java (revision 0)
  28.  
  29. package com.descja;
  30.  
  31. import java.sql.Connection;
  32. import java.sql.PreparedStatement;
  33. import java.sql.ResultSet;
  34.  
  35. import org.apache.commons.logging.Log;
  36. import org.apache.commons.logging.LogFactory;
  37.  
  38. import com.descja.Config;
  39. import com.descja.gameserver.model.actor.instance.L2PcInstance;
  40. import com.descja.gameserver.network.L2GameClient;
  41. import com.descja.gameserver.network.L2GameClient.GameClientState;
  42. import com.descja.gameserver.thread.LoginServerThread;
  43. import com.descja.util.ResourceUtil;
  44. import com.descja.util.database.L2DatabaseFactory;
  45.  
  46.  
  47.  
  48. public class FakePlayers
  49. {
  50. private static final Log _log = LogFactory.getLog(FakePlayers.class.getName());
  51. private static final String CLEAR_OFFLINE_TABLE = "DELETE FROM fake_players";
  52. private static final String LOAD_OFFLINE_STATUS = "SELECT * FROM fake_players";
  53.  
  54.  
  55. private static FakePlayers _instance;
  56. public static FakePlayers getInstance()
  57. {
  58. if(_instance == null)
  59. {
  60. _instance = new FakePlayers();
  61. }
  62.  
  63. return _instance;
  64. }
  65. private FakePlayers()
  66. {
  67. storeFakePlayers();
  68. }
  69.  
  70. public static void storeFakePlayers()
  71. {
  72. _log.info("FakePlayers: Activated");
  73. Connection con = null;
  74. int nPlayers = 0;
  75. try
  76. {
  77. con = L2DatabaseFactory.getInstance().getConnection();
  78. PreparedStatement stm = con.prepareStatement(LOAD_OFFLINE_STATUS);
  79. ResultSet rs = stm.executeQuery();
  80. while(rs.next())
  81. {
  82. L2PcInstance player = null;
  83.  
  84. try
  85. {
  86. L2GameClient client = new L2GameClient(null);
  87. player = L2PcInstance.load(rs.getInt("charId"));
  88. client.setActiveChar(player);
  89. client.setAccountName(player.getAccountNamePlayer());
  90. client.setState(GameClientState.IN_GAME);
  91. player.setClient(client);
  92. player.isFakePlayer();
  93. player.spawnMe(player.getX(), player.getY(), player.getZ());
  94. LoginServerThread.getInstance().addGameServerLogin(player.getAccount
  95. Name(), client);
  96.  
  97. if(Config.FAKE_PLAYERS_SIT)
  98. {
  99. player.sitDown();
  100. }
  101. player.setOnlineStatus(true);
  102. player.restoreEffects();
  103. player.broadcastUserInfo();
  104. nPlayers++;
  105. }
  106. catch(Exception e)
  107. {
  108. _log.error("Fake Players Engine: Error loading player: "+player,e);
  109. if(player != null)
  110. {
  111. player.deleteMe();
  112. }
  113. }
  114. }
  115. rs.close();
  116. stm.close();
  117. _log.info("Loaded: " +nPlayers+ " Fake Players");
  118. }
  119. catch(Exception e)
  120. {
  121. _log.error("Fake Players Engine : Error while loading player: ",e);
  122. }
  123. finally
  124. {
  125. ResourceUtil.closeConnection(con);
  126. }
  127. }
  128.  
  129.  
  130. }
  131. ===================================================================
  132. Index: java/com/descja/gameserver/GameServer.java
  133. ===================================================================
  134. --- java/com/descja/gameserver/GameServer.java (revision 53)
  135. +++ java/com/descja/gameserver/GameServer.java (revision 53)
  136.  
  137. +import com.descja.FakePlayers;
  138.  
  139.  
  140. private static void loadCharacters()
  141. {
  142. Util.printSection("Characters");
  143. ClanTable.getInstance();
  144. CharTemplateTable.getInstance();
  145. LevelUpData.getInstance();
  146. }
  147.  
  148. + //DescJa Fake Players//
  149. + private static void loadWhiteAttack()
  150. + {
  151. + if(Config.FAKE_PLAYERS)
  152. + {
  153. + Util.printSection("Fake Characters");
  154. + FakePlayers.getInstance();
  155. + }
  156. + }
  157. + //DescJa Fake Players//
  158. ===================================================================
  159. Index: java/com/descja/Config.java
  160. ===================================================================
  161. --- java/com/descja/Config.java (revision 162)
  162. +++ java/com/descja/Config.java (revision 162)
  163.  
  164. + /*DescJa*/
  165. + public static boolean FAKE_PLAYERS_SIT;
  166. + public static boolean FAKE_PLAYERS;
  167. + //FakePlayers.ini//
  168. + public static void FakePlayersConfig()
  169. + {
  170. + try
  171. + {
  172. + L2Properties p = new L2Properties(ConfigFiles.FakePlayers_INI);
  173. +
  174. + FAKE_PLAYERS = TypeFormat.parseBoolean(FakePlayers.getProperty("FakePlayers", "False"));
  175. + FAKE_PLAYERS_SIT = TypeFormat.parseBoolean(FakePlayers.getProperty("FakePlayersSit"
  176. , "False"));
  177. +
  178. + p.clear();
  179. + }
  180. + catch(Exception e)
  181. + {
  182. + _log.warn("Failed to load " + ConfigFiles.FakePlayers_INI);
  183. + }
  184. + }
  185. + /*DescJa*/
  186. ===================================================================
  187. Index: java/com/descja/util/services/ConfigFiles.java
  188. ===================================================================
  189. --- java/com/descja/util/services/ConfigFiles.java
  190. +++ java/com/descja/util/services/ConfigFiles.java
  191.  
  192. + public static final String FakePlayers_INI = "./config/FakePlayers.ini";
  193. ===================================================================
  194. Index: config/FakePlayers.ini
  195. ===================================================================
  196. --- config/FakePlayers.ini
  197. +++ config/FakePlayers.ini
  198. +#============================================
  199. +# Fake Players Mod #
  200. +#============================================
  201. +
  202. +# Enable Fake Players System
  203. +# Default: False
  204. +FakePlayers = False
  205. +
  206. +# Fake Players Sit Down
  207. +# Default: False
  208. +FakePlayersSit = False
  209.  
  210.  
  211. DP Side:
  212.  
  213. CREATE TABLE `fake_players` (
  214. `charId` decimal(11,0) NOT NULL DEFAULT '0',
  215. PRIMARY KEY (`charId`)
  216. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Advertisement
Add Comment
Please, Sign In to add comment