Ничего заумного в ней нету, работает по принципу оффлайн трейда. Для любителей поизвращаться можно к ним написать АИ=)
Код:
CORE Side:
Index: java/com/descja/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/descja/gameserver/model/actor/instance/L2PcInstance.java (revision 38)
+++ java/com/descja/gameserver/model/actor/instance/L2PcInstance.java (revision 38)
private long _chatBanTimer = 0L;
private ScheduledFuture<?> _chatBanTask = null;
private boolean _isOffline = false;
+ private boolean _isFakePlayer = false;
public void setOffline(boolean set)
{
_isOffline = set;
}
+ public boolean isFakePlayer()
+ {
+ return _isFakePlayer;
+ }
===================================================================
Index: java/com/descja/FakePlayers.java
===================================================================
--- java/com/descja/FakePlayers.java (revision 0)
+++ java/com/descja/FakePlayers.java (revision 0)
package com.descja;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.descja.Config;
import com.descja.gameserver.model.actor.instance.L2PcInstance;
import com.descja.gameserver.network.L2GameClient;
import com.descja.gameserver.network.L2GameClient.GameClientState;
import com.descja.gameserver.thread.LoginServerThread;
import com.descja.util.ResourceUtil;
import com.descja.util.database.L2DatabaseFactory;
public class FakePlayers
{
private static final Log _log = LogFactory.getLog(FakePlayers.class.getName());
private static final String CLEAR_OFFLINE_TABLE = "DELETE FROM fake_players";
private static final String LOAD_OFFLINE_STATUS = "SELECT * FROM fake_players";
private static FakePlayers _instance;
public static FakePlayers getInstance()
{
if(_instance == null)
{
_instance = new FakePlayers();
}
return _instance;
}
private FakePlayers()
{
storeFakePlayers();
}
public static void storeFakePlayers()
{
_log.info("FakePlayers: Activated");
Connection con = null;
int nPlayers = 0;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement stm = con.prepareStatement(LOAD_OFFLINE_STATUS);
ResultSet rs = stm.executeQuery();
while(rs.next())
{
L2PcInstance player = null;
try
{
L2GameClient client = new L2GameClient(null);
player = L2PcInstance.load(rs.getInt("charId"));
client.setActiveChar(player);
client.setAccountName(player.getAccountNamePlayer());
client.setState(GameClientState.IN_GAME);
player.setClient(client);
player.isFakePlayer();
player.spawnMe(player.getX(), player.getY(), player.getZ());
LoginServerThread.getInstance().addGameServerLogin(player.getAccountName(), client);
if(Config.FAKE_PLAYERS_SIT)
{
player.sitDown();
}
player.setOnlineStatus(true);
player.restoreEffects();
player.broadcastUserInfo();
nPlayers++;
}
catch(Exception e)
{
_log.error("Fake Players Engine: Error loading player: "+player,e);
if(player != null)
{
player.deleteMe();
}
}
}
rs.close();
stm.close();
_log.info("Loaded: " +nPlayers+ " Fake Players");
}
catch(Exception e)
{
_log.error("Fake Players Engine : Error while loading player: ",e);
}
finally
{
ResourceUtil.closeConnection(con);
}
}
}
===================================================================
Index: java/com/descja/gameserver/GameServer.java
===================================================================
--- java/com/descja/gameserver/GameServer.java (revision 53)
+++ java/com/descja/gameserver/GameServer.java (revision 53)
+import com.descja.FakePlayers;
private static void loadCharacters()
{
Util.printSection("Characters");
ClanTable.getInstance();
CharTemplateTable.getInstance();
LevelUpData.getInstance();
}
+ //DescJa Fake Players//
+ private static void loadWhiteAttack()
+ {
+ if(Config.FAKE_PLAYERS)
+ {
+ Util.printSection("Fake Characters");
+ FakePlayers.getInstance();
+ }
+ }
+ //DescJa Fake Players//
===================================================================
Index: java/com/descja/Config.java
===================================================================
--- java/com/descja/Config.java (revision 162)
+++ java/com/descja/Config.java (revision 162)
+ /*DescJa*/
+ public static boolean FAKE_PLAYERS_SIT;
+ public static boolean FAKE_PLAYERS;
+ //FakePlayers.ini//
+ public static void FakePlayersConfig()
+ {
+ try
+ {
+ L2Properties p = new L2Properties(ConfigFiles.FakePlayers_INI);
+
+ FAKE_PLAYERS = TypeFormat.parseBoolean(FakePlayers.getProperty("FakePlayers", "False"));
+ FAKE_PLAYERS_SIT = TypeFormat.parseBoolean(FakePlayers.getProperty("FakePlayersSit", "False"));
+
+ p.clear();
+ }
+ catch(Exception e)
+ {
+ _log.warn("Failed to load " + ConfigFiles.FakePlayers_INI);
+ }
+ }
+ /*DescJa*/
===================================================================
Index: java/com/descja/util/services/ConfigFiles.java
===================================================================
--- java/com/descja/util/services/ConfigFiles.java
+++ java/com/descja/util/services/ConfigFiles.java
+ public static final String FakePlayers_INI = "./config/FakePlayers.ini";
===================================================================
Index: config/FakePlayers.ini
===================================================================
--- config/FakePlayers.ini
+++ config/FakePlayers.ini
+#============================================
+# Fake Players Mod #
+#============================================
+
+# Enable Fake Players System
+# Default: False
+FakePlayers = False
+
+# Fake Players Sit Down
+# Default: False
+FakePlayersSit = False
DP Side:
CREATE TABLE `fake_players` (
`charId` decimal(11,0) NOT NULL DEFAULT '0',
PRIMARY KEY (`charId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;