Jump to content
  • 0

Adaptation


Question

Posted

Hi guys i need help to adapt this code for l2j

 

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

 

 

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • 💎 Premium Google AI One features unlocked: Get Gemini Pro workspace integrations and full cloud storage today.
    • Οχι για ενα merge script για 2 λογους   1. οτι καποιος ζηταει κατι, του λες τιμη, σου δινει λιγοτερα και μετα σου λεει θα παρεις τα αλλα στην επομενη πληρωμη κ εξαφανιζεται   2. οτι εσυ του εξηγεις πως δουλευει κατι, του λες τιμη, συμφωνει, σου λεει μπες κανε μου αυτο τζαμπα λιγο για να προχωρησουμε στο merge, του λες οχι πληρωσε με πρωτα για αυτο κ μετα. σου λεει καντο και σε πληρωνω, του το κανεις, σε γραφει για 10 μερες στο chat και ξαφνικα βλεπεις [WTB] δικο του στο maxc κ οταν τον ρωτας λεει "ναι δικο μου ειναι κ εχω αρχισει ηδη και με αλλον dev".    Αρα καταλαβαινεις τι παιζει εδω, επισης τα λεφτα δεν μ τα εδωσε ακομη κ δεν τα θελω απλα τονιζω τον ορκισμο του "scam" κ οχι αυτα τα τοπικ που εκανα εγω ban trades με 15 ατομα απο τα 1,500 που εχω δουλεψει απο το 2014.
    • Όλα αυτά για ένα merge script ρε παιδιά ? 😅  
    • Έχει ψωμάκι εδώ      
    • afto pou akoma 12.5 xronia meta exeis akoma apopsi gia pragmata pou den gnwrizeis den allazei ?
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..