From 2ad96b714344739ad17c6ad5473d391c6ea615fb Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 16 Mar 2019 00:36:35 +0000 Subject: [PATCH] Balthus Knights character creation support. --- .../dist/game/config/BalthusKnights.ini | 28 ++++++ .../java/com/l2jmobius/Config.java | 27 ++++++ .../instancemanager/PremiumManager.java | 2 +- .../clientpackets/CharacterCreate.java | 96 ++++++++++++++++--- .../serverpackets/CharSelectionInfo.java | 31 +++++- .../dist/game/config/BalthusKnights.ini | 28 ++++++ .../java/com/l2jmobius/Config.java | 27 ++++++ .../instancemanager/PremiumManager.java | 2 +- .../clientpackets/CharacterCreate.java | 96 ++++++++++++++++--- .../serverpackets/CharSelectionInfo.java | 30 +++++- .../dist/game/config/BalthusKnights.ini | 28 ++++++ .../java/com/l2jmobius/Config.java | 27 ++++++ .../instancemanager/PremiumManager.java | 2 +- .../clientpackets/CharacterCreate.java | 96 ++++++++++++++++--- .../serverpackets/CharSelectionInfo.java | 30 +++++- 15 files changed, 493 insertions(+), 57 deletions(-) create mode 100644 L2J_Mobius_5.0_Salvation/dist/game/config/BalthusKnights.ini create mode 100644 L2J_Mobius_5.5_EtinasFate/dist/game/config/BalthusKnights.ini create mode 100644 L2J_Mobius_6.0_Fafurion/dist/game/config/BalthusKnights.ini diff --git a/L2J_Mobius_5.0_Salvation/dist/game/config/BalthusKnights.ini b/L2J_Mobius_5.0_Salvation/dist/game/config/BalthusKnights.ini new file mode 100644 index 0000000000..d255539457 --- /dev/null +++ b/L2J_Mobius_5.0_Salvation/dist/game/config/BalthusKnights.ini @@ -0,0 +1,28 @@ +# --------------------------------------------------------------------------- +# Balthus Knights Settings +# --------------------------------------------------------------------------- + +# Enable high level boost character creation. +# Default: True +BalthusKnightsEnabled = True + +# Level for boosted characters. +# Retail: 85 +BalthusKnightsLevel = 85 + +# Enable high level boost only for premium accounts. +# Default: True +BalthusKnightsPremium = True + +# Coordinates for starting location. +# Default: -114371,256483,-1286 (Talking Island) +BalthusKnightsLocation = -114371,256483,-1286 + +# Items rewarded to boosted players. +# You can add multiple items separated by commas. +# Default: 46919;1 +BalthusKnightsRewards = 46919;1 + +# Reward available skills to boosted characters. +# Default: True +BalthusKnightsRewardSkills = True diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/Config.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/Config.java index 682b586da0..9f818ba0fe 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/Config.java @@ -86,6 +86,7 @@ public final class Config public static final String SIEGE_CONFIG_FILE = "./config/Siege.ini"; public static final String FORTSIEGE_CONFIG_FILE = "./config/FortSiege.ini"; private static final String ATTENDANCE_CONFIG_FILE = "./config/AttendanceRewards.ini"; + private static final String BALTHUS_KNIGHTS_CONFIG_FILE = "./config/BalthusKnights.ini"; private static final String CHARACTER_CONFIG_FILE = "./config/Character.ini"; private static final String FEATURE_CONFIG_FILE = "./config/Feature.ini"; private static final String FLOOD_PROTECTOR_CONFIG_FILE = "./config/FloodProtector.ini"; @@ -145,6 +146,12 @@ public final class Config public static boolean ATTENDANCE_REWARDS_SHARE_ACCOUNT; public static int ATTENDANCE_REWARD_DELAY; public static boolean ATTENDANCE_POPUP_WINDOW; + public static boolean BALTHUS_KNIGHTS_ENABLED; + public static int BALTHUS_KNIGHTS_LEVEL; + public static boolean BALTHUS_KNIGHTS_PREMIUM; + public static Location BALTHUS_KNIGHTS_LOCATION; + public static List BALTHUS_KNIGHTS_REWARDS; + public static boolean BALTHUS_KNIGHTS_REWARD_SKILLS; public static boolean PLAYER_DELEVEL; public static int DELEVEL_MINIMUM; public static boolean DECREASE_SKILL_LEVEL; @@ -1399,12 +1406,32 @@ public final class Config // Load Attandance config file (if exists) final PropertiesParser Attandance = new PropertiesParser(ATTENDANCE_CONFIG_FILE); + ENABLE_ATTENDANCE_REWARDS = Attandance.getBoolean("EnableAttendanceRewards", false); PREMIUM_ONLY_ATTENDANCE_REWARDS = Attandance.getBoolean("PremiumOnlyAttendanceRewards", false); ATTENDANCE_REWARDS_SHARE_ACCOUNT = Attandance.getBoolean("AttendanceRewardsShareAccount", false); ATTENDANCE_REWARD_DELAY = Attandance.getInt("AttendanceRewardDelay", 30); ATTENDANCE_POPUP_WINDOW = Attandance.getBoolean("AttendancePopupWindow", false); + // Load BalthusKnights config file (if exists) + final PropertiesParser BalthusKnights = new PropertiesParser(BALTHUS_KNIGHTS_CONFIG_FILE); + + BALTHUS_KNIGHTS_ENABLED = BalthusKnights.getBoolean("BalthusKnightsEnabled", true); + BALTHUS_KNIGHTS_LEVEL = BalthusKnights.getInt("BalthusKnightsLevel", 85); + BALTHUS_KNIGHTS_PREMIUM = BalthusKnights.getBoolean("BalthusKnightsPremium", true); + final String[] balthusKnightsLocation = BalthusKnights.getString("BalthusKnightsLocation", "-114371,256483,-1286").split(","); + BALTHUS_KNIGHTS_LOCATION = new Location(Integer.parseInt(balthusKnightsLocation[0]), Integer.parseInt(balthusKnightsLocation[1]), Integer.parseInt(balthusKnightsLocation[2])); + BALTHUS_KNIGHTS_REWARDS = new ArrayList<>(); + for (String s : BalthusKnights.getString("BalthusKnightsRewards", "46919;1").split(",")) + { + if (s.isEmpty()) + { + continue; + } + BALTHUS_KNIGHTS_REWARDS.add(new ItemHolder(Integer.parseInt(s.split(";")[0]), Integer.parseInt(s.split(";")[1]))); + } + BALTHUS_KNIGHTS_REWARD_SKILLS = BalthusKnights.getBoolean("BalthusKnightsRewardSkills", true); + // Load Character config file (if exists) final PropertiesParser Character = new PropertiesParser(CHARACTER_CONFIG_FILE); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java index c03a9a8aae..431fc1f561 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java @@ -126,7 +126,7 @@ public class PremiumManager } } - private void loadPremiumData(String accountName) + public void loadPremiumData(String accountName) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement stmt = con.prepareStatement(LOAD_SQL)) diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java index 969aea0360..0c97523fa3 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java @@ -22,12 +22,14 @@ import java.util.logging.Logger; import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import com.l2jmobius.gameserver.data.xml.impl.ExperienceData; import com.l2jmobius.gameserver.data.xml.impl.FakePlayerData; import com.l2jmobius.gameserver.data.xml.impl.InitialEquipmentData; import com.l2jmobius.gameserver.data.xml.impl.InitialShortcutData; import com.l2jmobius.gameserver.data.xml.impl.PlayerTemplateData; import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; +import com.l2jmobius.gameserver.instancemanager.PremiumManager; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.Location; @@ -39,6 +41,7 @@ import com.l2jmobius.gameserver.model.base.ClassId; import com.l2jmobius.gameserver.model.events.Containers; import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerCreate; +import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.PcItemTemplate; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.network.Disconnection; @@ -148,6 +151,7 @@ public final class CharacterCreate implements IClientIncomingPacket L2PcInstance newChar = null; L2PcTemplate template = null; + boolean balthusKnights = false; /* * DrHouse: Since checks for duplicate names are done using SQL, lock must be held until data is written to DB as well. @@ -165,8 +169,45 @@ public final class CharacterCreate implements IClientIncomingPacket return; } + // Balthus Knights. + if (Config.BALTHUS_KNIGHTS_ENABLED && (!Config.BALTHUS_KNIGHTS_PREMIUM || (Config.PREMIUM_SYSTEM_ENABLED && (PremiumManager.getInstance().getPremiumExpiration(client.getAccountName()) > 0)))) + { + if (_classId == 190) + { + _classId = 188; // EVISCERATOR + balthusKnights = true; + } + if (_classId == 191) + { + _classId = 189; // SAYHA_SEER + balthusKnights = true; + } + if ((_classId > 138) && (_classId < 147)) + { + final String properClass = ClassId.getClassId(_classId).toString().split("_")[0]; + for (ClassId classId : ClassId.values()) + { + if (classId.getRace() == null) + { + continue; + } + if ((classId.getRace().ordinal() == _race) && classId.toString().startsWith(properClass)) + { + _classId = classId.getId(); + balthusKnights = true; + break; + } + } + } + } + else if (ClassId.getClassId(_classId).level() > 0) + { + client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED)); + return; + } + template = PlayerTemplateData.getInstance().getTemplate(_classId); - if ((template == null) || (ClassId.getClassId(_classId).level() > 0)) + if (template == null) { client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED)); return; @@ -243,6 +284,17 @@ public final class CharacterCreate implements IClientIncomingPacket newChar = L2PcInstance.create(template, client.getAccountName(), _name, new PcAppearance(_face, _hairColor, _hairStyle, _sex != 0)); } + if (balthusKnights) + { + newChar.setExp(ExperienceData.getInstance().getExpForLevel(Config.BALTHUS_KNIGHTS_LEVEL)); + newChar.getStat().setLevel((byte) Config.BALTHUS_KNIGHTS_LEVEL); + + if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS) + { + newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true); + } + } + // HP and MP are at maximum and CP is zero by default. newChar.setCurrentHp(newChar.getMaxHp()); newChar.setCurrentMp(newChar.getMaxMp()); @@ -250,18 +302,6 @@ public final class CharacterCreate implements IClientIncomingPacket client.sendPacket(CharCreateOk.STATIC_PACKET); - initNewChar(client, newChar); - - LOGGER_ACCOUNTING.info("Created new character, " + newChar + ", " + client); - } - - private static boolean isValidName(String text) - { - return Config.CHARNAME_TEMPLATE_PATTERN.matcher(text).matches(); - } - - private void initNewChar(L2GameClient client, L2PcInstance newChar) - { L2World.getInstance().addObject(newChar); if (Config.STARTING_ADENA > 0) @@ -269,8 +309,6 @@ public final class CharacterCreate implements IClientIncomingPacket newChar.addAdena("Init", Config.STARTING_ADENA, null, false); } - final L2PcTemplate template = newChar.getTemplate(); - if (Config.CUSTOM_STARTING_LOC) { final Location createLoc = new Location(Config.CUSTOM_STARTING_LOC_X, Config.CUSTOM_STARTING_LOC_Y, Config.CUSTOM_STARTING_LOC_Z); @@ -280,6 +318,10 @@ public final class CharacterCreate implements IClientIncomingPacket { newChar.setXYZInvisible(Config.FACTION_STARTING_LOCATION.getX(), Config.FACTION_STARTING_LOCATION.getY(), Config.FACTION_STARTING_LOCATION.getZ()); } + else if (balthusKnights) + { + newChar.setXYZInvisible(Config.BALTHUS_KNIGHTS_LOCATION.getX(), Config.BALTHUS_KNIGHTS_LOCATION.getY(), Config.BALTHUS_KNIGHTS_LOCATION.getZ()); + } else { final Location createLoc = template.getCreationPoint(); @@ -318,6 +360,23 @@ public final class CharacterCreate implements IClientIncomingPacket } } } + if (balthusKnights) + { + for (ItemHolder reward : Config.BALTHUS_KNIGHTS_REWARDS) + { + final L2ItemInstance item = newChar.getInventory().addItem("Balthus Rewards", reward.getId(), reward.getCount(), newChar, null); + if (item == null) + { + LOGGER.warning("Could not create item during char creation: itemId " + reward.getId() + ", amount " + reward.getCount() + "."); + continue; + } + + if (item.isEquipable()) + { + newChar.getInventory().equipItem(item); + } + } + } for (L2SkillLearn skill : SkillTreesData.getInstance().getAvailableSkills(newChar, newChar.getClassId(), false, true)) { @@ -338,5 +397,12 @@ public final class CharacterCreate implements IClientIncomingPacket final CharSelectionInfo cl = new CharSelectionInfo(client.getAccountName(), client.getSessionId().playOkID1); client.setCharSelection(cl.getCharInfo()); + + LOGGER_ACCOUNTING.info("Created new character, " + newChar + ", " + client); + } + + private static boolean isValidName(String text) + { + return Config.CHARNAME_TEMPLATE_PATTERN.matcher(text).matches(); } } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java index cfa3caa2b7..4ef1d3eab7 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java @@ -30,6 +30,7 @@ import com.l2jmobius.commons.network.PacketWriter; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.xml.impl.ExperienceData; import com.l2jmobius.gameserver.idfactory.IdFactory; +import com.l2jmobius.gameserver.instancemanager.PremiumManager; import com.l2jmobius.gameserver.model.CharSelectInfoPackage; import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2World; @@ -137,7 +138,32 @@ public class CharSelectionInfo implements IClientOutgoingPacket packet.writeC(size == Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT ? 0x01 : 0x00); // if 1 can't create new char packet.writeC(0x01); // 0=can't play, 1=can play free until level 85, 2=100% free play packet.writeD(0x02); // if 1, Korean client - packet.writeH(0x00); // Balthus Knights, if 1 suggests premium account + packet.writeC(0x00); // Gift message for inactive accounts // 152 + + // Balthus Knights + if (Config.BALTHUS_KNIGHTS_ENABLED) + { + if (Config.BALTHUS_KNIGHTS_PREMIUM) + { + if (Config.PREMIUM_SYSTEM_ENABLED) + { + PremiumManager.getInstance().loadPremiumData(_loginName); + packet.writeC(PremiumManager.getInstance().getPremiumExpiration(_loginName) > 0 ? 0x01 : 0x00); + } + else + { + packet.writeC(0x00); + } + } + else + { + packet.writeC(0x01); + } + } + else + { + packet.writeC(0x00); + } long lastAccess = 0; if (_activeId == -1) @@ -185,8 +211,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket packet.writeQ(charInfoPackage.getSp()); packet.writeQ(charInfoPackage.getExp()); - packet.writeF((float) (charInfoPackage.getExp() - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel())) / (ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel() + 1) - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel()))); // High - // Five + packet.writeF((float) (charInfoPackage.getExp() - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel())) / (ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel() + 1) - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel()))); packet.writeD(charInfoPackage.getLevel()); packet.writeD(charInfoPackage.getReputation()); diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/config/BalthusKnights.ini b/L2J_Mobius_5.5_EtinasFate/dist/game/config/BalthusKnights.ini new file mode 100644 index 0000000000..d255539457 --- /dev/null +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/config/BalthusKnights.ini @@ -0,0 +1,28 @@ +# --------------------------------------------------------------------------- +# Balthus Knights Settings +# --------------------------------------------------------------------------- + +# Enable high level boost character creation. +# Default: True +BalthusKnightsEnabled = True + +# Level for boosted characters. +# Retail: 85 +BalthusKnightsLevel = 85 + +# Enable high level boost only for premium accounts. +# Default: True +BalthusKnightsPremium = True + +# Coordinates for starting location. +# Default: -114371,256483,-1286 (Talking Island) +BalthusKnightsLocation = -114371,256483,-1286 + +# Items rewarded to boosted players. +# You can add multiple items separated by commas. +# Default: 46919;1 +BalthusKnightsRewards = 46919;1 + +# Reward available skills to boosted characters. +# Default: True +BalthusKnightsRewardSkills = True diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/Config.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/Config.java index 682b586da0..9f818ba0fe 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/Config.java @@ -86,6 +86,7 @@ public final class Config public static final String SIEGE_CONFIG_FILE = "./config/Siege.ini"; public static final String FORTSIEGE_CONFIG_FILE = "./config/FortSiege.ini"; private static final String ATTENDANCE_CONFIG_FILE = "./config/AttendanceRewards.ini"; + private static final String BALTHUS_KNIGHTS_CONFIG_FILE = "./config/BalthusKnights.ini"; private static final String CHARACTER_CONFIG_FILE = "./config/Character.ini"; private static final String FEATURE_CONFIG_FILE = "./config/Feature.ini"; private static final String FLOOD_PROTECTOR_CONFIG_FILE = "./config/FloodProtector.ini"; @@ -145,6 +146,12 @@ public final class Config public static boolean ATTENDANCE_REWARDS_SHARE_ACCOUNT; public static int ATTENDANCE_REWARD_DELAY; public static boolean ATTENDANCE_POPUP_WINDOW; + public static boolean BALTHUS_KNIGHTS_ENABLED; + public static int BALTHUS_KNIGHTS_LEVEL; + public static boolean BALTHUS_KNIGHTS_PREMIUM; + public static Location BALTHUS_KNIGHTS_LOCATION; + public static List BALTHUS_KNIGHTS_REWARDS; + public static boolean BALTHUS_KNIGHTS_REWARD_SKILLS; public static boolean PLAYER_DELEVEL; public static int DELEVEL_MINIMUM; public static boolean DECREASE_SKILL_LEVEL; @@ -1399,12 +1406,32 @@ public final class Config // Load Attandance config file (if exists) final PropertiesParser Attandance = new PropertiesParser(ATTENDANCE_CONFIG_FILE); + ENABLE_ATTENDANCE_REWARDS = Attandance.getBoolean("EnableAttendanceRewards", false); PREMIUM_ONLY_ATTENDANCE_REWARDS = Attandance.getBoolean("PremiumOnlyAttendanceRewards", false); ATTENDANCE_REWARDS_SHARE_ACCOUNT = Attandance.getBoolean("AttendanceRewardsShareAccount", false); ATTENDANCE_REWARD_DELAY = Attandance.getInt("AttendanceRewardDelay", 30); ATTENDANCE_POPUP_WINDOW = Attandance.getBoolean("AttendancePopupWindow", false); + // Load BalthusKnights config file (if exists) + final PropertiesParser BalthusKnights = new PropertiesParser(BALTHUS_KNIGHTS_CONFIG_FILE); + + BALTHUS_KNIGHTS_ENABLED = BalthusKnights.getBoolean("BalthusKnightsEnabled", true); + BALTHUS_KNIGHTS_LEVEL = BalthusKnights.getInt("BalthusKnightsLevel", 85); + BALTHUS_KNIGHTS_PREMIUM = BalthusKnights.getBoolean("BalthusKnightsPremium", true); + final String[] balthusKnightsLocation = BalthusKnights.getString("BalthusKnightsLocation", "-114371,256483,-1286").split(","); + BALTHUS_KNIGHTS_LOCATION = new Location(Integer.parseInt(balthusKnightsLocation[0]), Integer.parseInt(balthusKnightsLocation[1]), Integer.parseInt(balthusKnightsLocation[2])); + BALTHUS_KNIGHTS_REWARDS = new ArrayList<>(); + for (String s : BalthusKnights.getString("BalthusKnightsRewards", "46919;1").split(",")) + { + if (s.isEmpty()) + { + continue; + } + BALTHUS_KNIGHTS_REWARDS.add(new ItemHolder(Integer.parseInt(s.split(";")[0]), Integer.parseInt(s.split(";")[1]))); + } + BALTHUS_KNIGHTS_REWARD_SKILLS = BalthusKnights.getBoolean("BalthusKnightsRewardSkills", true); + // Load Character config file (if exists) final PropertiesParser Character = new PropertiesParser(CHARACTER_CONFIG_FILE); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java index c03a9a8aae..431fc1f561 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java @@ -126,7 +126,7 @@ public class PremiumManager } } - private void loadPremiumData(String accountName) + public void loadPremiumData(String accountName) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement stmt = con.prepareStatement(LOAD_SQL)) diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java index 969aea0360..0c97523fa3 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java @@ -22,12 +22,14 @@ import java.util.logging.Logger; import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import com.l2jmobius.gameserver.data.xml.impl.ExperienceData; import com.l2jmobius.gameserver.data.xml.impl.FakePlayerData; import com.l2jmobius.gameserver.data.xml.impl.InitialEquipmentData; import com.l2jmobius.gameserver.data.xml.impl.InitialShortcutData; import com.l2jmobius.gameserver.data.xml.impl.PlayerTemplateData; import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; +import com.l2jmobius.gameserver.instancemanager.PremiumManager; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.Location; @@ -39,6 +41,7 @@ import com.l2jmobius.gameserver.model.base.ClassId; import com.l2jmobius.gameserver.model.events.Containers; import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerCreate; +import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.PcItemTemplate; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.network.Disconnection; @@ -148,6 +151,7 @@ public final class CharacterCreate implements IClientIncomingPacket L2PcInstance newChar = null; L2PcTemplate template = null; + boolean balthusKnights = false; /* * DrHouse: Since checks for duplicate names are done using SQL, lock must be held until data is written to DB as well. @@ -165,8 +169,45 @@ public final class CharacterCreate implements IClientIncomingPacket return; } + // Balthus Knights. + if (Config.BALTHUS_KNIGHTS_ENABLED && (!Config.BALTHUS_KNIGHTS_PREMIUM || (Config.PREMIUM_SYSTEM_ENABLED && (PremiumManager.getInstance().getPremiumExpiration(client.getAccountName()) > 0)))) + { + if (_classId == 190) + { + _classId = 188; // EVISCERATOR + balthusKnights = true; + } + if (_classId == 191) + { + _classId = 189; // SAYHA_SEER + balthusKnights = true; + } + if ((_classId > 138) && (_classId < 147)) + { + final String properClass = ClassId.getClassId(_classId).toString().split("_")[0]; + for (ClassId classId : ClassId.values()) + { + if (classId.getRace() == null) + { + continue; + } + if ((classId.getRace().ordinal() == _race) && classId.toString().startsWith(properClass)) + { + _classId = classId.getId(); + balthusKnights = true; + break; + } + } + } + } + else if (ClassId.getClassId(_classId).level() > 0) + { + client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED)); + return; + } + template = PlayerTemplateData.getInstance().getTemplate(_classId); - if ((template == null) || (ClassId.getClassId(_classId).level() > 0)) + if (template == null) { client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED)); return; @@ -243,6 +284,17 @@ public final class CharacterCreate implements IClientIncomingPacket newChar = L2PcInstance.create(template, client.getAccountName(), _name, new PcAppearance(_face, _hairColor, _hairStyle, _sex != 0)); } + if (balthusKnights) + { + newChar.setExp(ExperienceData.getInstance().getExpForLevel(Config.BALTHUS_KNIGHTS_LEVEL)); + newChar.getStat().setLevel((byte) Config.BALTHUS_KNIGHTS_LEVEL); + + if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS) + { + newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true); + } + } + // HP and MP are at maximum and CP is zero by default. newChar.setCurrentHp(newChar.getMaxHp()); newChar.setCurrentMp(newChar.getMaxMp()); @@ -250,18 +302,6 @@ public final class CharacterCreate implements IClientIncomingPacket client.sendPacket(CharCreateOk.STATIC_PACKET); - initNewChar(client, newChar); - - LOGGER_ACCOUNTING.info("Created new character, " + newChar + ", " + client); - } - - private static boolean isValidName(String text) - { - return Config.CHARNAME_TEMPLATE_PATTERN.matcher(text).matches(); - } - - private void initNewChar(L2GameClient client, L2PcInstance newChar) - { L2World.getInstance().addObject(newChar); if (Config.STARTING_ADENA > 0) @@ -269,8 +309,6 @@ public final class CharacterCreate implements IClientIncomingPacket newChar.addAdena("Init", Config.STARTING_ADENA, null, false); } - final L2PcTemplate template = newChar.getTemplate(); - if (Config.CUSTOM_STARTING_LOC) { final Location createLoc = new Location(Config.CUSTOM_STARTING_LOC_X, Config.CUSTOM_STARTING_LOC_Y, Config.CUSTOM_STARTING_LOC_Z); @@ -280,6 +318,10 @@ public final class CharacterCreate implements IClientIncomingPacket { newChar.setXYZInvisible(Config.FACTION_STARTING_LOCATION.getX(), Config.FACTION_STARTING_LOCATION.getY(), Config.FACTION_STARTING_LOCATION.getZ()); } + else if (balthusKnights) + { + newChar.setXYZInvisible(Config.BALTHUS_KNIGHTS_LOCATION.getX(), Config.BALTHUS_KNIGHTS_LOCATION.getY(), Config.BALTHUS_KNIGHTS_LOCATION.getZ()); + } else { final Location createLoc = template.getCreationPoint(); @@ -318,6 +360,23 @@ public final class CharacterCreate implements IClientIncomingPacket } } } + if (balthusKnights) + { + for (ItemHolder reward : Config.BALTHUS_KNIGHTS_REWARDS) + { + final L2ItemInstance item = newChar.getInventory().addItem("Balthus Rewards", reward.getId(), reward.getCount(), newChar, null); + if (item == null) + { + LOGGER.warning("Could not create item during char creation: itemId " + reward.getId() + ", amount " + reward.getCount() + "."); + continue; + } + + if (item.isEquipable()) + { + newChar.getInventory().equipItem(item); + } + } + } for (L2SkillLearn skill : SkillTreesData.getInstance().getAvailableSkills(newChar, newChar.getClassId(), false, true)) { @@ -338,5 +397,12 @@ public final class CharacterCreate implements IClientIncomingPacket final CharSelectionInfo cl = new CharSelectionInfo(client.getAccountName(), client.getSessionId().playOkID1); client.setCharSelection(cl.getCharInfo()); + + LOGGER_ACCOUNTING.info("Created new character, " + newChar + ", " + client); + } + + private static boolean isValidName(String text) + { + return Config.CHARNAME_TEMPLATE_PATTERN.matcher(text).matches(); } } diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java index d7da6a3d29..70c90fc509 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java @@ -30,6 +30,7 @@ import com.l2jmobius.commons.network.PacketWriter; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.xml.impl.ExperienceData; import com.l2jmobius.gameserver.idfactory.IdFactory; +import com.l2jmobius.gameserver.instancemanager.PremiumManager; import com.l2jmobius.gameserver.model.CharSelectInfoPackage; import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2World; @@ -165,7 +166,31 @@ public class CharSelectionInfo implements IClientOutgoingPacket packet.writeC(0x01); // 0=can't play, 1=can play free until level 85, 2=100% free play packet.writeD(0x02); // if 1, Korean client packet.writeC(0x00); // Gift message for inactive accounts // 152 - packet.writeC(0x00); // Balthus Knights, if 1 suggests premium account + + // Balthus Knights + if (Config.BALTHUS_KNIGHTS_ENABLED) + { + if (Config.BALTHUS_KNIGHTS_PREMIUM) + { + if (Config.PREMIUM_SYSTEM_ENABLED) + { + PremiumManager.getInstance().loadPremiumData(_loginName); + packet.writeC(PremiumManager.getInstance().getPremiumExpiration(_loginName) > 0 ? 0x01 : 0x00); + } + else + { + packet.writeC(0x00); + } + } + else + { + packet.writeC(0x01); + } + } + else + { + packet.writeC(0x00); + } long lastAccess = 0; if (_activeId == -1) @@ -213,8 +238,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket packet.writeQ(charInfoPackage.getSp()); packet.writeQ(charInfoPackage.getExp()); - packet.writeF((float) (charInfoPackage.getExp() - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel())) / (ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel() + 1) - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel()))); // High - // Five + packet.writeF((float) (charInfoPackage.getExp() - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel())) / (ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel() + 1) - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel()))); packet.writeD(charInfoPackage.getLevel()); packet.writeD(charInfoPackage.getReputation()); diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/config/BalthusKnights.ini b/L2J_Mobius_6.0_Fafurion/dist/game/config/BalthusKnights.ini new file mode 100644 index 0000000000..d255539457 --- /dev/null +++ b/L2J_Mobius_6.0_Fafurion/dist/game/config/BalthusKnights.ini @@ -0,0 +1,28 @@ +# --------------------------------------------------------------------------- +# Balthus Knights Settings +# --------------------------------------------------------------------------- + +# Enable high level boost character creation. +# Default: True +BalthusKnightsEnabled = True + +# Level for boosted characters. +# Retail: 85 +BalthusKnightsLevel = 85 + +# Enable high level boost only for premium accounts. +# Default: True +BalthusKnightsPremium = True + +# Coordinates for starting location. +# Default: -114371,256483,-1286 (Talking Island) +BalthusKnightsLocation = -114371,256483,-1286 + +# Items rewarded to boosted players. +# You can add multiple items separated by commas. +# Default: 46919;1 +BalthusKnightsRewards = 46919;1 + +# Reward available skills to boosted characters. +# Default: True +BalthusKnightsRewardSkills = True diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/Config.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/Config.java index 56d67a3284..0f81eda892 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/Config.java @@ -86,6 +86,7 @@ public final class Config public static final String SIEGE_CONFIG_FILE = "./config/Siege.ini"; public static final String FORTSIEGE_CONFIG_FILE = "./config/FortSiege.ini"; private static final String ATTENDANCE_CONFIG_FILE = "./config/AttendanceRewards.ini"; + private static final String BALTHUS_KNIGHTS_CONFIG_FILE = "./config/BalthusKnights.ini"; private static final String CHARACTER_CONFIG_FILE = "./config/Character.ini"; private static final String FEATURE_CONFIG_FILE = "./config/Feature.ini"; private static final String FLOOD_PROTECTOR_CONFIG_FILE = "./config/FloodProtector.ini"; @@ -145,6 +146,12 @@ public final class Config public static boolean ATTENDANCE_REWARDS_SHARE_ACCOUNT; public static int ATTENDANCE_REWARD_DELAY; public static boolean ATTENDANCE_POPUP_WINDOW; + public static boolean BALTHUS_KNIGHTS_ENABLED; + public static int BALTHUS_KNIGHTS_LEVEL; + public static boolean BALTHUS_KNIGHTS_PREMIUM; + public static Location BALTHUS_KNIGHTS_LOCATION; + public static List BALTHUS_KNIGHTS_REWARDS; + public static boolean BALTHUS_KNIGHTS_REWARD_SKILLS; public static boolean PLAYER_DELEVEL; public static int DELEVEL_MINIMUM; public static boolean DECREASE_SKILL_LEVEL; @@ -1405,12 +1412,32 @@ public final class Config // Load Attandance config file (if exists) final PropertiesParser Attandance = new PropertiesParser(ATTENDANCE_CONFIG_FILE); + ENABLE_ATTENDANCE_REWARDS = Attandance.getBoolean("EnableAttendanceRewards", false); PREMIUM_ONLY_ATTENDANCE_REWARDS = Attandance.getBoolean("PremiumOnlyAttendanceRewards", false); ATTENDANCE_REWARDS_SHARE_ACCOUNT = Attandance.getBoolean("AttendanceRewardsShareAccount", false); ATTENDANCE_REWARD_DELAY = Attandance.getInt("AttendanceRewardDelay", 30); ATTENDANCE_POPUP_WINDOW = Attandance.getBoolean("AttendancePopupWindow", false); + // Load BalthusKnights config file (if exists) + final PropertiesParser BalthusKnights = new PropertiesParser(BALTHUS_KNIGHTS_CONFIG_FILE); + + BALTHUS_KNIGHTS_ENABLED = BalthusKnights.getBoolean("BalthusKnightsEnabled", true); + BALTHUS_KNIGHTS_LEVEL = BalthusKnights.getInt("BalthusKnightsLevel", 85); + BALTHUS_KNIGHTS_PREMIUM = BalthusKnights.getBoolean("BalthusKnightsPremium", true); + final String[] balthusKnightsLocation = BalthusKnights.getString("BalthusKnightsLocation", "-114371,256483,-1286").split(","); + BALTHUS_KNIGHTS_LOCATION = new Location(Integer.parseInt(balthusKnightsLocation[0]), Integer.parseInt(balthusKnightsLocation[1]), Integer.parseInt(balthusKnightsLocation[2])); + BALTHUS_KNIGHTS_REWARDS = new ArrayList<>(); + for (String s : BalthusKnights.getString("BalthusKnightsRewards", "46919;1").split(",")) + { + if (s.isEmpty()) + { + continue; + } + BALTHUS_KNIGHTS_REWARDS.add(new ItemHolder(Integer.parseInt(s.split(";")[0]), Integer.parseInt(s.split(";")[1]))); + } + BALTHUS_KNIGHTS_REWARD_SKILLS = BalthusKnights.getBoolean("BalthusKnightsRewardSkills", true); + // Load Character config file (if exists) final PropertiesParser Character = new PropertiesParser(CHARACTER_CONFIG_FILE); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java index c03a9a8aae..431fc1f561 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java @@ -126,7 +126,7 @@ public class PremiumManager } } - private void loadPremiumData(String accountName) + public void loadPremiumData(String accountName) { try (Connection con = DatabaseFactory.getConnection(); PreparedStatement stmt = con.prepareStatement(LOAD_SQL)) diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java index 969aea0360..0c97523fa3 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java @@ -22,12 +22,14 @@ import java.util.logging.Logger; import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; +import com.l2jmobius.gameserver.data.xml.impl.ExperienceData; import com.l2jmobius.gameserver.data.xml.impl.FakePlayerData; import com.l2jmobius.gameserver.data.xml.impl.InitialEquipmentData; import com.l2jmobius.gameserver.data.xml.impl.InitialShortcutData; import com.l2jmobius.gameserver.data.xml.impl.PlayerTemplateData; import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; +import com.l2jmobius.gameserver.instancemanager.PremiumManager; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.Location; @@ -39,6 +41,7 @@ import com.l2jmobius.gameserver.model.base.ClassId; import com.l2jmobius.gameserver.model.events.Containers; import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerCreate; +import com.l2jmobius.gameserver.model.holders.ItemHolder; import com.l2jmobius.gameserver.model.items.PcItemTemplate; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.network.Disconnection; @@ -148,6 +151,7 @@ public final class CharacterCreate implements IClientIncomingPacket L2PcInstance newChar = null; L2PcTemplate template = null; + boolean balthusKnights = false; /* * DrHouse: Since checks for duplicate names are done using SQL, lock must be held until data is written to DB as well. @@ -165,8 +169,45 @@ public final class CharacterCreate implements IClientIncomingPacket return; } + // Balthus Knights. + if (Config.BALTHUS_KNIGHTS_ENABLED && (!Config.BALTHUS_KNIGHTS_PREMIUM || (Config.PREMIUM_SYSTEM_ENABLED && (PremiumManager.getInstance().getPremiumExpiration(client.getAccountName()) > 0)))) + { + if (_classId == 190) + { + _classId = 188; // EVISCERATOR + balthusKnights = true; + } + if (_classId == 191) + { + _classId = 189; // SAYHA_SEER + balthusKnights = true; + } + if ((_classId > 138) && (_classId < 147)) + { + final String properClass = ClassId.getClassId(_classId).toString().split("_")[0]; + for (ClassId classId : ClassId.values()) + { + if (classId.getRace() == null) + { + continue; + } + if ((classId.getRace().ordinal() == _race) && classId.toString().startsWith(properClass)) + { + _classId = classId.getId(); + balthusKnights = true; + break; + } + } + } + } + else if (ClassId.getClassId(_classId).level() > 0) + { + client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED)); + return; + } + template = PlayerTemplateData.getInstance().getTemplate(_classId); - if ((template == null) || (ClassId.getClassId(_classId).level() > 0)) + if (template == null) { client.sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED)); return; @@ -243,6 +284,17 @@ public final class CharacterCreate implements IClientIncomingPacket newChar = L2PcInstance.create(template, client.getAccountName(), _name, new PcAppearance(_face, _hairColor, _hairStyle, _sex != 0)); } + if (balthusKnights) + { + newChar.setExp(ExperienceData.getInstance().getExpForLevel(Config.BALTHUS_KNIGHTS_LEVEL)); + newChar.getStat().setLevel((byte) Config.BALTHUS_KNIGHTS_LEVEL); + + if (Config.BALTHUS_KNIGHTS_REWARD_SKILLS) + { + newChar.giveAvailableSkills(Config.AUTO_LEARN_FS_SKILLS, true); + } + } + // HP and MP are at maximum and CP is zero by default. newChar.setCurrentHp(newChar.getMaxHp()); newChar.setCurrentMp(newChar.getMaxMp()); @@ -250,18 +302,6 @@ public final class CharacterCreate implements IClientIncomingPacket client.sendPacket(CharCreateOk.STATIC_PACKET); - initNewChar(client, newChar); - - LOGGER_ACCOUNTING.info("Created new character, " + newChar + ", " + client); - } - - private static boolean isValidName(String text) - { - return Config.CHARNAME_TEMPLATE_PATTERN.matcher(text).matches(); - } - - private void initNewChar(L2GameClient client, L2PcInstance newChar) - { L2World.getInstance().addObject(newChar); if (Config.STARTING_ADENA > 0) @@ -269,8 +309,6 @@ public final class CharacterCreate implements IClientIncomingPacket newChar.addAdena("Init", Config.STARTING_ADENA, null, false); } - final L2PcTemplate template = newChar.getTemplate(); - if (Config.CUSTOM_STARTING_LOC) { final Location createLoc = new Location(Config.CUSTOM_STARTING_LOC_X, Config.CUSTOM_STARTING_LOC_Y, Config.CUSTOM_STARTING_LOC_Z); @@ -280,6 +318,10 @@ public final class CharacterCreate implements IClientIncomingPacket { newChar.setXYZInvisible(Config.FACTION_STARTING_LOCATION.getX(), Config.FACTION_STARTING_LOCATION.getY(), Config.FACTION_STARTING_LOCATION.getZ()); } + else if (balthusKnights) + { + newChar.setXYZInvisible(Config.BALTHUS_KNIGHTS_LOCATION.getX(), Config.BALTHUS_KNIGHTS_LOCATION.getY(), Config.BALTHUS_KNIGHTS_LOCATION.getZ()); + } else { final Location createLoc = template.getCreationPoint(); @@ -318,6 +360,23 @@ public final class CharacterCreate implements IClientIncomingPacket } } } + if (balthusKnights) + { + for (ItemHolder reward : Config.BALTHUS_KNIGHTS_REWARDS) + { + final L2ItemInstance item = newChar.getInventory().addItem("Balthus Rewards", reward.getId(), reward.getCount(), newChar, null); + if (item == null) + { + LOGGER.warning("Could not create item during char creation: itemId " + reward.getId() + ", amount " + reward.getCount() + "."); + continue; + } + + if (item.isEquipable()) + { + newChar.getInventory().equipItem(item); + } + } + } for (L2SkillLearn skill : SkillTreesData.getInstance().getAvailableSkills(newChar, newChar.getClassId(), false, true)) { @@ -338,5 +397,12 @@ public final class CharacterCreate implements IClientIncomingPacket final CharSelectionInfo cl = new CharSelectionInfo(client.getAccountName(), client.getSessionId().playOkID1); client.setCharSelection(cl.getCharInfo()); + + LOGGER_ACCOUNTING.info("Created new character, " + newChar + ", " + client); + } + + private static boolean isValidName(String text) + { + return Config.CHARNAME_TEMPLATE_PATTERN.matcher(text).matches(); } } diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java index d7da6a3d29..70c90fc509 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java @@ -30,6 +30,7 @@ import com.l2jmobius.commons.network.PacketWriter; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.xml.impl.ExperienceData; import com.l2jmobius.gameserver.idfactory.IdFactory; +import com.l2jmobius.gameserver.instancemanager.PremiumManager; import com.l2jmobius.gameserver.model.CharSelectInfoPackage; import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2World; @@ -165,7 +166,31 @@ public class CharSelectionInfo implements IClientOutgoingPacket packet.writeC(0x01); // 0=can't play, 1=can play free until level 85, 2=100% free play packet.writeD(0x02); // if 1, Korean client packet.writeC(0x00); // Gift message for inactive accounts // 152 - packet.writeC(0x00); // Balthus Knights, if 1 suggests premium account + + // Balthus Knights + if (Config.BALTHUS_KNIGHTS_ENABLED) + { + if (Config.BALTHUS_KNIGHTS_PREMIUM) + { + if (Config.PREMIUM_SYSTEM_ENABLED) + { + PremiumManager.getInstance().loadPremiumData(_loginName); + packet.writeC(PremiumManager.getInstance().getPremiumExpiration(_loginName) > 0 ? 0x01 : 0x00); + } + else + { + packet.writeC(0x00); + } + } + else + { + packet.writeC(0x01); + } + } + else + { + packet.writeC(0x00); + } long lastAccess = 0; if (_activeId == -1) @@ -213,8 +238,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket packet.writeQ(charInfoPackage.getSp()); packet.writeQ(charInfoPackage.getExp()); - packet.writeF((float) (charInfoPackage.getExp() - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel())) / (ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel() + 1) - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel()))); // High - // Five + packet.writeF((float) (charInfoPackage.getExp() - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel())) / (ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel() + 1) - ExperienceData.getInstance().getExpForLevel(charInfoPackage.getLevel()))); packet.writeD(charInfoPackage.getLevel()); packet.writeD(charInfoPackage.getReputation());