Support for Classic client.
This commit is contained in:
@ -432,9 +432,6 @@ public final class Config
|
||||
// General Settings
|
||||
// --------------------------------------------------
|
||||
public static boolean EVERYBODY_HAS_ADMIN_RIGHTS;
|
||||
public static boolean SERVER_LIST_BRACKET;
|
||||
public static int SERVER_LIST_TYPE;
|
||||
public static int SERVER_LIST_AGE;
|
||||
public static boolean SERVER_GMONLY;
|
||||
public static boolean GM_HERO_AURA;
|
||||
public static boolean GM_STARTUP_INVULNERABLE;
|
||||
@ -993,6 +990,10 @@ public final class Config
|
||||
public static int REQUEST_ID;
|
||||
public static boolean RESERVE_HOST_ON_LOGIN = false;
|
||||
public static List<Integer> PROTOCOL_LIST;
|
||||
public static int SERVER_LIST_TYPE;
|
||||
public static int SERVER_LIST_AGE;
|
||||
public static boolean SERVER_LIST_BRACKET;
|
||||
public static boolean SERVER_CLASSIC_SUPPORT = false;
|
||||
public static boolean LOGIN_SERVER_SCHEDULE_RESTART;
|
||||
public static long LOGIN_SERVER_SCHEDULE_RESTART_TIME;
|
||||
|
||||
@ -1235,6 +1236,9 @@ public final class Config
|
||||
_log.log(Level.WARNING, "Wrong config protocol version: " + protocol + ". Skipped.");
|
||||
}
|
||||
}
|
||||
SERVER_LIST_TYPE = getServerTypeId(serverSettings.getString("ServerListType", "Free").split(","));
|
||||
SERVER_LIST_AGE = serverSettings.getInt("ServerListAge", 0);
|
||||
SERVER_LIST_BRACKET = serverSettings.getBoolean("ServerListBrackets", false);
|
||||
|
||||
// Hosts and Subnets
|
||||
IPConfigData ipcd = new IPConfigData();
|
||||
@ -1766,9 +1770,6 @@ public final class Config
|
||||
// Load General L2Properties file (if exists)
|
||||
final PropertiesParser General = new PropertiesParser(GENERAL_CONFIG_FILE);
|
||||
EVERYBODY_HAS_ADMIN_RIGHTS = General.getBoolean("EverybodyHasAdminRights", false);
|
||||
SERVER_LIST_BRACKET = General.getBoolean("ServerListBrackets", false);
|
||||
SERVER_LIST_TYPE = getServerTypeId(General.getString("ServerListType", "Normal").split(","));
|
||||
SERVER_LIST_AGE = General.getInt("ServerListAge", 0);
|
||||
SERVER_GMONLY = General.getBoolean("ServerGMOnly", false);
|
||||
GM_HERO_AURA = General.getBoolean("GMHeroAura", false);
|
||||
GM_STARTUP_INVULNERABLE = General.getBoolean("GMStartupInvulnerable", false);
|
||||
@ -3897,6 +3898,7 @@ public final class Config
|
||||
break;
|
||||
case "classic":
|
||||
serverType |= 0x400;
|
||||
SERVER_CLASSIC_SUPPORT = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.util.data.xml.IXmlReader;
|
||||
|
||||
/**
|
||||
@ -50,7 +51,7 @@ public final class ExperienceData implements IXmlReader
|
||||
public void load()
|
||||
{
|
||||
_expTable.clear();
|
||||
parseDatapackFile("data/stats/experience.xml");
|
||||
parseDatapackFile(Config.SERVER_CLASSIC_SUPPORT ? "data/stats/classic_experience.xml" : "data/stats/experience.xml");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _expTable.size() + " levels.");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Max Player Level is: " + (MAX_LEVEL - 1));
|
||||
LOGGER.info(getClass().getSimpleName() + ": Max Pet Level is: " + (MAX_PET_LEVEL - 1));
|
||||
|
@ -145,7 +145,14 @@ public final class SkillTreesData implements IXmlReader
|
||||
_dualClassSkillTree.clear();
|
||||
|
||||
// Load files.
|
||||
parseDatapackDirectory("data/skillTrees/", true);
|
||||
if (Config.SERVER_CLASSIC_SUPPORT)
|
||||
{
|
||||
parseDatapackDirectory("data/skillTrees/", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
parseDatapackDirectory("data/skillTrees/", true);
|
||||
}
|
||||
|
||||
// Generate check arrays.
|
||||
generateCheckArrays();
|
||||
|
@ -53,7 +53,7 @@ public final class SpawnTable implements IXmlReader
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(SpawnTable.class.getName());
|
||||
// SQL
|
||||
private static final String SELECT_SPAWNS = "SELECT count, npc_templateid, locx, locy, locz, heading, respawn_delay, respawn_random, loc_id, periodOfDay FROM spawnlist";
|
||||
private static final String SELECT_SPAWNS = "SELECT count, npc_templateid, locx, locy, locz, heading, respawn_delay, respawn_random, loc_id, periodOfDay FROM " + (Config.SERVER_CLASSIC_SUPPORT ? "classic_spawnlist" : "spawnlist");
|
||||
private static final String SELECT_CUSTOM_SPAWNS = "SELECT count, npc_templateid, locx, locy, locz, heading, respawn_delay, respawn_random, loc_id, periodOfDay FROM custom_spawnlist";
|
||||
|
||||
private static final Map<Integer, Set<L2Spawn>> _spawnTable = new ConcurrentHashMap<>();
|
||||
|
@ -77,7 +77,7 @@ public class RaidBossSpawnManager
|
||||
_schedules.clear();
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT * FROM raidboss_spawnlist ORDER BY boss_id");
|
||||
PreparedStatement statement = con.prepareStatement("SELECT * FROM " + (Config.SERVER_CLASSIC_SUPPORT ? "classic_raidboss_spawnlist" : "raidboss_spawnlist") + " ORDER BY boss_id");
|
||||
ResultSet rset = statement.executeQuery())
|
||||
{
|
||||
while (rset.next())
|
||||
@ -98,7 +98,7 @@ public class RaidBossSpawnManager
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": Couldnt load raidboss_spawnlist table");
|
||||
_log.warning(getClass().getSimpleName() + ": Couldnt load raidboss spawnlist table.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -266,7 +266,7 @@ public class RaidBossSpawnManager
|
||||
if (storeInDb)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("INSERT INTO raidboss_spawnlist (boss_id,amount,loc_x,loc_y,loc_z,heading,respawn_time,currentHp,currentMp) VALUES(?,?,?,?,?,?,?,?,?)"))
|
||||
PreparedStatement statement = con.prepareStatement("INSERT INTO " + (Config.SERVER_CLASSIC_SUPPORT ? "classic_raidboss_spawnlist" : "raidboss_spawnlist") + " (boss_id,amount,loc_x,loc_y,loc_z,heading,respawn_time,currentHp,currentMp) VALUES(?,?,?,?,?,?,?,?,?)"))
|
||||
{
|
||||
statement.setInt(1, spawnDat.getId());
|
||||
statement.setInt(2, spawnDat.getAmount());
|
||||
@ -327,7 +327,7 @@ public class RaidBossSpawnManager
|
||||
if (updateDb)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("DELETE FROM raidboss_spawnlist WHERE boss_id=?"))
|
||||
PreparedStatement statement = con.prepareStatement("DELETE FROM " + (Config.SERVER_CLASSIC_SUPPORT ? "classic_raidboss_spawnlist" : "raidboss_spawnlist") + " WHERE boss_id=?"))
|
||||
{
|
||||
statement.setInt(1, bossId);
|
||||
statement.execute();
|
||||
@ -346,7 +346,7 @@ public class RaidBossSpawnManager
|
||||
private void updateDb()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("UPDATE raidboss_spawnlist SET respawn_time = ?, currentHP = ?, currentMP = ? WHERE boss_id = ?"))
|
||||
PreparedStatement statement = con.prepareStatement("UPDATE " + (Config.SERVER_CLASSIC_SUPPORT ? "classic_raidboss_spawnlist" : "raidboss_spawnlist") + " SET respawn_time = ?, currentHP = ?, currentMP = ? WHERE boss_id = ?"))
|
||||
{
|
||||
for (Integer bossId : _storedInfo.keySet())
|
||||
{
|
||||
@ -385,7 +385,7 @@ public class RaidBossSpawnManager
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldnt update raidboss_spawnlist table " + e.getMessage(), e);
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldnt update raidboss spawnlist table " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -299,6 +299,44 @@ public final class CharacterCreate extends L2GameClientPacket
|
||||
{
|
||||
newChar.setXYZInvisible(Config.FACTION_STARTING_LOCATION.getX(), Config.FACTION_STARTING_LOCATION.getY(), Config.FACTION_STARTING_LOCATION.getZ());
|
||||
}
|
||||
else if (Config.SERVER_CLASSIC_SUPPORT)
|
||||
{
|
||||
switch (template.getRace())
|
||||
{
|
||||
case HUMAN:
|
||||
{
|
||||
if (template.getClassId().isMage())
|
||||
{
|
||||
newChar.setXYZInvisible(-90875, 248162, -3570);
|
||||
}
|
||||
else
|
||||
{
|
||||
newChar.setXYZInvisible(-71338, 258271, -3104);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ELF:
|
||||
{
|
||||
newChar.setXYZInvisible(46045, 41251, -3440);
|
||||
break;
|
||||
}
|
||||
case DARK_ELF:
|
||||
{
|
||||
newChar.setXYZInvisible(28295, 11063, -4224);
|
||||
break;
|
||||
}
|
||||
case ORC:
|
||||
{
|
||||
newChar.setXYZInvisible(-56733, -113459, -690);
|
||||
break;
|
||||
}
|
||||
case DWARF:
|
||||
{
|
||||
newChar.setXYZInvisible(108644, -173947, -400);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Location createLoc = template.getCreationPoint();
|
||||
@ -359,7 +397,7 @@ public final class CharacterCreate extends L2GameClientPacket
|
||||
EventDispatcher.getInstance().notifyEvent(new OnPlayerCreate(newChar, newChar.getObjectId(), newChar.getName(), client), Containers.Players());
|
||||
|
||||
newChar.setOnlineStatus(true, false);
|
||||
if (Config.SHOW_GOD_VIDEO_INTRO)
|
||||
if (Config.SHOW_GOD_VIDEO_INTRO && !Config.SERVER_CLASSIC_SUPPORT)
|
||||
{
|
||||
newChar.getVariables().set("intro_god_video", true);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
|
||||
addComponentType(NpcInfoType.CURRENT_MP);
|
||||
}
|
||||
|
||||
if (npc.getTemplate().getDisplayId() != npc.getTemplate().getId())
|
||||
if ((npc.getTemplate().getDisplayId() != npc.getTemplate().getId()) || Config.SERVER_CLASSIC_SUPPORT)
|
||||
{
|
||||
addComponentType(NpcInfoType.NAME);
|
||||
}
|
||||
|
@ -149,6 +149,10 @@ public interface IXmlReader
|
||||
{
|
||||
for (File f : files)
|
||||
{
|
||||
if (!Config.SERVER_CLASSIC_SUPPORT && f.getName().contains("classic"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (recursive && f.isDirectory())
|
||||
{
|
||||
parseDirectory(f, recursive);
|
||||
|
Reference in New Issue
Block a user