Support for Classic client.

This commit is contained in:
MobiusDev
2015-04-30 18:40:48 +00:00
parent cac02e4140
commit e096946601
15 changed files with 53097 additions and 36 deletions

View File

@@ -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));

View File

@@ -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();

View File

@@ -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<>();

View File

@@ -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);
}
}
}

View File

@@ -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);
}

View File

@@ -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);
}