Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
- index ba3ddff..389d92a 100644
- --- a/java/net/sf/l2j/Config.java
- +++ b/java/net/sf/l2j/Config.java
- @@ -36,6 +36,7 @@
- public static final String SERVER_FILE = "./config/server.properties";
- public static final String SIEGE_FILE = "./config/siege.properties";
- public static final String SPECIAL_MODS = "./config/CustomMods/SpecialMods.ini";
- + public static final String NEWBIECHAR = "./config/CustomMods/NewbieCharacters.ini";
- // --------------------------------------------------
- // Clans settings
- // --------------------------------------------------
- @@ -530,12 +531,18 @@
- public static double PET_XP_RATE;
- public static int PET_FOOD_RATE;
- public static double SINEATER_XP_RATE;
- -
- + public static boolean CHAR_TITLE;
- + public static String ADD_CHAR_TITLE;
- public static double RATE_DROP_COMMON_HERBS;
- public static double RATE_DROP_HP_HERBS;
- public static double RATE_DROP_MP_HERBS;
- public static double RATE_DROP_SPECIAL_HERBS;
- -
- + public static boolean STARTING_BUFFS;
- + public static List<int[]> STARTING_BUFFS_M = new ArrayList<>();
- + public static List<int[]> STARTING_BUFFS_F = new ArrayList<>();
- + public static boolean CUSTOM_STARTER_ITEMS_ENABLED;
- + public static List<int[]> STARTING_CUSTOM_ITEMS_F = new ArrayList<>();
- + public static List<int[]> STARTING_CUSTOM_ITEMS_M = new ArrayList<>();
- /** Allow types */
- public static boolean ALLOW_FREIGHT;
- public static boolean ALLOW_WAREHOUSE;
- @@ -568,7 +575,15 @@
- /** Community Board */
- public static boolean ENABLE_COMMUNITY_BOARD;
- public static String BBS_DEFAULT;
- -
- + public static boolean ALLOW_CREATE_LVL;
- + public static int CHAR_CREATE_LVL;
- + public static boolean SPAWN_CHAR;
- + /** X Coordinate of the SPAWN_CHAR setting. */
- + public static int SPAWN_X;
- + /** Y Coordinate of the SPAWN_CHAR setting. */
- + public static int SPAWN_Y;
- + /** Z Coordinate of the SPAWN_CHAR setting. */
- + public static int SPAWN_Z;
- /** Flood Protectors */
- public static int ROLL_DICE_TIME;
- public static int HERO_VOICE_TIME;
- @@ -880,6 +895,124 @@
- }
- }
- + private static final void loadNewChar()
- + {
- + final ExProperties newChar = initProperties(NEWBIECHAR);
- + CHAR_TITLE = Boolean.parseBoolean(newChar.getProperty("CharTitle", "false"));
- + ADD_CHAR_TITLE = newChar.getProperty("CharAddTitle", "Welcome");
- + ALLOW_CREATE_LVL = Boolean.parseBoolean(newChar.getProperty("CustomStartingLvl", "False"));
- + CHAR_CREATE_LVL = Integer.parseInt(newChar.getProperty("CharLvl", "80"));
- + SPAWN_CHAR = Boolean.parseBoolean(newChar.getProperty("CustomSpawn", "false"));
- + SPAWN_X = Integer.parseInt(newChar.getProperty("SpawnX", ""));
- + SPAWN_Y = Integer.parseInt(newChar.getProperty("SpawnY", ""));
- + SPAWN_Z = Integer.parseInt(newChar.getProperty("SpawnZ", ""));
- + STARTING_BUFFS = Boolean.parseBoolean(newChar.getProperty("StartingBuffs", "True"));
- + String[] startingBuffsSplit = newChar.getProperty("StartingBuffsMage", "1204,2").split(";");
- + STARTING_BUFFS_M.clear();
- + for (String buff : startingBuffsSplit)
- + {
- + String[] buffSplit = buff.split(",");
- + if (buffSplit.length != 2)
- + LOGGER.warn("StartingBuffsMage[Config.load()]: invalid config property -> StartingBuffsMage \"" + buff + "\"");
- + else
- + {
- + try
- + {
- + STARTING_BUFFS_M.add(new int[]
- + {
- + Integer.parseInt(buffSplit[0]),
- + Integer.parseInt(buffSplit[1])
- + });
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (STARTING_BUFFS_M.equals(""))
- + System.out.println("EROOOOOOOOOOOR WITH STARTING BUFS");
- + }
- + }
- + }
- + startingBuffsSplit = newChar.getProperty("StartingBuffsFighter", "1204,2").split(";");
- + STARTING_BUFFS_F.clear();
- + for (String buff : startingBuffsSplit)
- + {
- + String[] buffSplit = buff.split(",");
- + if (buffSplit.length != 2)
- + LOGGER.warn("StartingBuffsFighter[Config.load()]: invalid config property -> StartingBuffsFighter \"" + buff + "\"");
- + else
- + {
- + try
- + {
- + STARTING_BUFFS_F.add(new int[]
- + {
- + Integer.parseInt(buffSplit[0]),
- + Integer.parseInt(buffSplit[1])
- + });
- + }
- + catch (NumberFormatException nfe)
- + {
- + if (STARTING_BUFFS_F.equals(""))
- + System.out.println("EROOOOOOOOOOOR WITH STARTING BUFS");
- + }
- + }
- + }
- + CUSTOM_STARTER_ITEMS_ENABLED = Boolean.parseBoolean(newChar.getProperty("CustomStarterItemsEnabled", "False"));
- + if (Config.CUSTOM_STARTER_ITEMS_ENABLED)
- + {
- + String[] propertySplit = newChar.getProperty("StartingCustomItemsMage", "57,0").split(";");
- + STARTING_CUSTOM_ITEMS_M.clear();
- + for (final String reward : propertySplit)
- + {
- + final String[] rewardSplit = reward.split(",");
- + if (rewardSplit.length != 2)
- + LOGGER.warn("StartingCustomItemsMage[Config.load()]: invalid config property -> StartingCustomItemsMage \"" + reward + "\"");
- + else
- + {
- + try
- + {
- + STARTING_CUSTOM_ITEMS_M.add(new int[]
- + {
- + Integer.parseInt(rewardSplit[0]),
- + Integer.parseInt(rewardSplit[1])
- + });
- + }
- + catch (final NumberFormatException nfe)
- + {
- + nfe.printStackTrace();
- + if (!reward.isEmpty())
- + LOGGER.warn("StartingCustomItemsMage[Config.load()]: invalid config property -> StartingCustomItemsMage \"" + reward + "\"");
- + }
- + }
- + }
- +
- + propertySplit = newChar.getProperty("StartingCustomItemsFighter", "57,0").split(";");
- + STARTING_CUSTOM_ITEMS_F.clear();
- + for (final String reward : propertySplit)
- + {
- + final String[] rewardSplit = reward.split(",");
- + if (rewardSplit.length != 2)
- + LOGGER.warn("StartingCustomItemsFighter[Config.load()]: invalid config property -> StartingCustomItemsFighter \"" + reward + "\"");
- + else
- + {
- + try
- + {
- + STARTING_CUSTOM_ITEMS_F.add(new int[]
- + {
- + Integer.parseInt(rewardSplit[0]),
- + Integer.parseInt(rewardSplit[1])
- + });
- + }
- + catch (final NumberFormatException nfe)
- + {
- + nfe.printStackTrace();
- +
- + if (!reward.isEmpty())
- + LOGGER.warn("StartingCustomItemsFighter[Config.load()]: invalid config property -> StartingCustomItemsFighter \"" + reward + "\"");
- + }
- + }
- + }
- + }
- + }
- +
- private static final void loadSpecial()
- {
- final ExProperties Special = initProperties(SPECIAL_MODS);
- @@ -1327,6 +1460,7 @@
- // NPCs/monsters settings
- loadNpcs();
- loadSpecial();
- + loadNewChar();
- // players settings
- loadPlayers();
- diff --git a/java/net/sf/l2j/gameserver/data/xml/ItemData.java b/java/net/sf/l2j/gameserver/data/xml/ItemData.java
- index a6f5da2..e2884d0 100644
- --- a/java/net/sf/l2j/gameserver/data/xml/ItemData.java
- +++ b/java/net/sf/l2j/gameserver/data/xml/ItemData.java
- @@ -7,6 +7,7 @@
- import net.sf.l2j.commons.logging.CLogger;
- import net.sf.l2j.gameserver.data.DocumentItem;
- +import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- import net.sf.l2j.gameserver.model.item.kind.Armor;
- import net.sf.l2j.gameserver.model.item.kind.EtcItem;
- import net.sf.l2j.gameserver.model.item.kind.Item;
- @@ -73,7 +74,19 @@
- LOGGER.info("Loaded items.");
- }
- -
- + /**
- + * Dummy item is created by setting the ID of the object in the world at null value
- + * @param itemId : int designating the item
- + * @return ItemInstance designating the dummy item created
- + */
- + public ItemInstance createDummyItem(int itemId)
- + {
- + final Item item = getTemplate(itemId);
- + if (item == null)
- + return null;
- +
- + return new ItemInstance(0, item);
- + }
- /**
- * @param id : the item id to check.
- * @return the {@link Item} corresponding to the item id.
- diff --git a/java/net/sf/l2j/gameserver/model/base/Experience.java b/java/net/sf/l2j/gameserver/model/base/Experience.java
- new file mode 100644
- index 0000000..9a48e7b
- --- /dev/null
- +++ b/java/net/sf/l2j/gameserver/model/base/Experience.java
- @@ -0,0 +1,97 @@
- +package net.sf.l2j.gameserver.model.base;
- +
- +public class Experience
- +{
- + public static final long LEVEL[] =
- + {
- + -1L, // level 0 (unreachable)
- + 0L,
- + 68L,
- + 363L,
- + 1168L,
- + 2884L,
- + 6038L,
- + 11287L,
- + 19423L,
- + 31378L,
- + 48229L, // level 10
- + 71201L,
- + 101676L,
- + 141192L,
- + 191452L,
- + 254327L,
- + 331864L,
- + 426284L,
- + 539995L,
- + 675590L,
- + 835854L, // level 20
- + 1023775L,
- + 1242536L,
- + 1495531L,
- + 1786365L,
- + 2118860L,
- + 2497059L,
- + 2925229L,
- + 3407873L,
- + 3949727L,
- + 4555766L, // level 30
- + 5231213L,
- + 5981539L,
- + 6812472L,
- + 7729999L,
- + 8740372L,
- + 9850111L,
- + 11066012L,
- + 12395149L,
- + 13844879L,
- + 15422851L, // level 40
- + 17137002L,
- + 18995573L,
- + 21007103L,
- + 23180442L,
- + 25524751L,
- + 28049509L,
- + 30764519L,
- + 33679907L,
- + 36806133L,
- + 40153995L, // level 50
- + 45524865L,
- + 51262204L,
- + 57383682L,
- + 63907585L,
- + 70852742L,
- + 80700339L,
- + 91162131L,
- + 102265326L,
- + 114038008L,
- + 126509030L, // level 60
- + 146307211L,
- + 167243291L,
- + 189363788L,
- + 212716741L,
- + 237351413L,
- + 271973532L,
- + 308441375L,
- + 346825235L,
- + 387197529L,
- + 429632402L, // level 70
- + 474205751L,
- + 532692055L,
- + 606319094L,
- + 696376867L,
- + 804219972L,
- + 931275828L,
- + 1151275834L,
- + 1511275834L,
- + 2099275834L,
- + 4200000000L, // level 80
- + 6299994999L
- + };
- +
- + /**
- + * This is the first UNREACHABLE level.<BR>
- + * ex: If you want a max at 80 & 99.99%, you have to put 81.<BR>
- + * <BR>
- + */
- + public static final byte MAX_LEVEL = 81;
- +}
- diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/RequestCharacterCreate.java b/java/net/sf/l2j/gameserver/network/clientpackets/RequestCharacterCreate.java
- index 3d4cfae..ea403a1 100644
- --- a/java/net/sf/l2j/gameserver/network/clientpackets/RequestCharacterCreate.java
- +++ b/java/net/sf/l2j/gameserver/network/clientpackets/RequestCharacterCreate.java
- @@ -2,7 +2,10 @@
- import net.sf.l2j.commons.lang.StringUtil;
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.SkillTable;
- import net.sf.l2j.gameserver.data.sql.PlayerInfoTable;
- +import net.sf.l2j.gameserver.data.xml.ItemData;
- import net.sf.l2j.gameserver.data.xml.NpcData;
- import net.sf.l2j.gameserver.data.xml.PlayerData;
- import net.sf.l2j.gameserver.data.xml.ScriptData;
- @@ -14,13 +17,17 @@
- import net.sf.l2j.gameserver.model.World;
- import net.sf.l2j.gameserver.model.actor.Player;
- import net.sf.l2j.gameserver.model.actor.template.PlayerTemplate;
- +import net.sf.l2j.gameserver.model.base.Experience;
- import net.sf.l2j.gameserver.model.holder.ItemTemplateHolder;
- import net.sf.l2j.gameserver.model.holder.skillnode.GeneralSkillNode;
- import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- +import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.CharCreateFail;
- import net.sf.l2j.gameserver.network.serverpackets.CharCreateOk;
- import net.sf.l2j.gameserver.network.serverpackets.CharSelectInfo;
- +import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
- import net.sf.l2j.gameserver.scripting.Quest;
- +import net.sf.l2j.gameserver.skills.L2Skill;
- public final class RequestCharacterCreate extends L2GameClientPacket
- {
- @@ -133,8 +140,71 @@
- World.getInstance().addObject(player);
- - player.getPosition().set(template.getRandomSpawn());
- - player.setTitle("");
- + if (Config.ALLOW_CREATE_LVL)
- + player.getStatus().addExp(Experience.LEVEL[Config.CHAR_CREATE_LVL]);
- +
- +
- + if (Config.SPAWN_CHAR)
- + player.setXYZInvisible(Config.SPAWN_X, Config.SPAWN_Y, Config.SPAWN_Z);
- + else
- + player.setXYZInvisible(template.getRandomSpawn());
- + if (Config.CUSTOM_STARTER_ITEMS_ENABLED)
- + {
- + if (player.isMageClass())
- + {
- + for (final int[] reward : Config.STARTING_CUSTOM_ITEMS_M)
- + {
- + if (ItemData.getInstance().createDummyItem(reward[0]).isStackable())
- + player.getInventory().addItem("Starter Items Mage", reward[0], reward[1], player, null);
- + else
- + for (int i = 0; i < reward[1]; ++i)
- + player.getInventory().addItem("Starter Items Mage", reward[0], 1, player, null);
- + }
- + }
- + else
- + {
- + for (final int[] reward : Config.STARTING_CUSTOM_ITEMS_F)
- + {
- + if (ItemData.getInstance().createDummyItem(reward[0]).isStackable())
- + player.getInventory().addItem("Starter Items Fighter", reward[0], reward[1], player, null);
- + else
- + for (int i = 0; i < reward[1]; ++i)
- + player.getInventory().addItem("Starter Items Fighter", reward[0], 1, player, null);
- + }
- + }
- + }
- + if (Config.STARTING_BUFFS)
- + {
- + if (!player.isMageClass())
- + {
- + for (int[] buff : Config.STARTING_BUFFS_F) // Custom buffs for fighters
- + {
- + L2Skill skill = SkillTable.getInstance().getInfo(buff[0], buff[1]);
- + if (skill != null)
- + {
- + skill.getEffects(player, player);
- + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(buff[0]));
- + }
- + }
- + }
- + else
- + {
- + for (int[] buff : Config.STARTING_BUFFS_M) // Custom buffs for mystics
- + {
- + L2Skill skill = SkillTable.getInstance().getInfo(buff[0], buff[1]);
- + if (skill != null)
- + {
- + skill.getEffects(player, player);
- + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(buff[0]));
- + }
- + }
- + }
- + }
- + //player.getPosition().set(template.getRandomSpawn());
- + if (Config.CHAR_TITLE)
- + player.setTitle(Config.ADD_CHAR_TITLE);
- + else
- + player.setTitle("");
- // Register shortcuts.
- player.getShortcutList().addShortcut(new Shortcut(0, 0, ShortcutType.ACTION, 2, -1, 1)); // attack shortcut
- @@ -176,4 +246,5 @@
- sendPacket(csi);
- getClient().setCharSelectSlot(csi.getCharacterSlots());
- }
- +
- }
- \ No newline at end of file
- +#===============================================================
- +# Spawn New Character
- +#===============================================================
- +# Custom starting spawn location.
- +CustomSpawn = True
- +SpawnX = 149999
- +SpawnY = 46728
- +SpawnZ = -3414
- +
- +# Custom title on new chars.
- +CharTitle = True
- +CharAddTitle = NewChar
- +
- +# Custom Level New Character.
- +CustomStartingLvl = True
- +# Character Level You Want
- +CharLvl = 10
- +
- +#===============================================================
- +# Spawn New Itens for Character
- +#===============================================================
- +# Default: False
- +CustomStarterItemsEnabled = True
- +# Starting itens for fighter's classes
- +StartingCustomItemsFighter = 57,1000;
- +# Starting itens for mage's classes
- +StartingCustomItemsMage = 57,1000;
- +
- +#===============================================================
- +# Spawn New Character for Buffs
- +#===============================================================
- +# Newbie Characters have starting buffs
- +StartingBuffs = True
- +
- +# Starting Buffs for Mystics.
- +StartingBuffsMage = 1204,2;1085,3;
- +
- +# Starting Buffs for Fighters.
- +StartingBuffsFighter = 1204,2;1086,2;
Add Comment
Please, Sign In to add comment