Gam3Master Posted May 4, 2016 Posted May 4, 2016 Starting buffs for newbie characters. ### Eclipse Workspace Patch 1.0 #P Hero-GS Index: config/players.properties =================================================================== --- config/players.properties (revision 36) +++ config/players.properties (working copy) @@ -5,6 +5,15 @@ #Amount of adenas that a new character is given, default is 100 StartingAdena = 250000 +#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; + # If True, when effects of the same stack group are used, lesser # effects will be canceled if stronger effects are used. New effects # that are added will be canceled if they are of lesser priority to the old one. Index: java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java =================================================================== --- java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (revision 35) +++ java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (working copy) @@ -22,15 +22,18 @@ import net.sf.l2j.gameserver.datatables.SkillTreeTable; import net.sf.l2j.gameserver.idfactory.IdFactory; import net.sf.l2j.gameserver.model.L2ShortCut; +import net.sf.l2j.gameserver.model.L2Skill; import net.sf.l2j.gameserver.model.L2SkillLearn; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.model.actor.template.PcTemplate; import net.sf.l2j.gameserver.model.item.instance.ItemInstance; import net.sf.l2j.gameserver.model.item.kind.Item; +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.scripting.ScriptManager; @@ -146,6 +149,7 @@ newChar.addAdena("Init", Config.STARTING_ADENA, null, false); } + if(Config.STARTING_BUFFS) + { + if(!newChar.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(newChar, newChar); + newChar.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(newChar, newChar); + newChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(buff[0])); + } + } + } + } newChar.setXYZInvisible(template.getSpawnX(), template.getSpawnY(), template.getSpawnZ()); newChar.setTitle(""); Index: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 46) +++ java/net/sf/l2j/Config.java (working copy) @@ -401,6 +401,9 @@ /** Misc */ public static int STARTING_ADENA; + public static boolean STARTING_BUFFS; + public static List<int[]> STARTING_BUFFS_M = new ArrayList<int[]>(); + public static List<int[]> STARTING_BUFFS_F = new ArrayList<int[]>(); public static boolean EFFECT_CANCELING; public static double HP_REGEN_MULTIPLIER; public static double MP_REGEN_MULTIPLIER; @@ -1075,6 +1078,47 @@ // players ExProperties players = load(PLAYERS_FILE); STARTING_ADENA = players.getProperty("StartingAdena", 100); + STARTING_BUFFS = players.getProperty("StartingBuffs", true); + String[] propertySplit = players.getProperty("StartingBuffsMage", "1204,2").split(";"); + STARTING_BUFFS_M.clear(); + for (String buff : propertySplit) + { + String[] buffSplit = buff.split(","); + if (buffSplit.length != 2) + _log.warning("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"); + } + } + } + propertySplit = players.getProperty("StartingBuffsFighter", "1204,2").split(";"); + STARTING_BUFFS_F.clear(); + for (String buff : propertySplit) + { + String[] buffSplit = buff.split(","); + if (buffSplit.length != 2) + _log.warning("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"); + } + } + } EFFECT_CANCELING = players.getProperty("CancelLesserEffect", true); HP_REGEN_MULTIPLIER = players.getProperty("HpRegenMultiplier", 1.); MP_REGEN_MULTIPLIER = players.getProperty("MpRegenMultiplier", 1.); Quote
Tryskell Posted May 7, 2016 Posted May 7, 2016 + if(Config.STARTING_BUFFS) + { + if(!newChar.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(newChar, newChar); + newChar.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(newChar, newChar); + newChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(buff[0])); + } + } + } + } > + if(Config.STARTING_BUFFS) + { + for (int[] buff : (newChar.isMageClass()) ? Config.STARTING_BUFFS_M : Config.STARTING_BUFFS_F) + { + L2Skill skill = SkillTable.getInstance().getInfo(buff[0], buff[1]); + if (skill != null) + { + skill.getEffects(newChar, newChar); + newChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(buff[0])); + } + } + } Quote
MarGaZeaS Posted May 12, 2016 Posted May 12, 2016 Good share. i select this code for create a guide. http://www.maxcheaters.com/topic/202517-l2jacis-%CF%80%CF%89%CF%82-%CE%BD%CE%B1-%CF%80%CE%B5%CF%81%CE%BD%CE%B1%CE%BC%CE%B5-%CE%B5%CE%BD%CE%B1-config/ I hope not to have problems. and I put the link from this share. :D Quote
Tryskell Posted May 12, 2016 Posted May 12, 2016 thanks. you are really skillful. You should use IntIntHolder instead of int[] too if your point was to hold skillid, skilllevel. Quote
Gam3Master Posted May 13, 2016 Author Posted May 13, 2016 Yes but InIntHolder have only aCis, among Interlude packs. Quote
Trance Posted May 13, 2016 Posted May 13, 2016 Yes but InIntHolder have only aCis, among Interlude packs. It's equal in performance. Quote
Tryskell Posted May 13, 2016 Posted May 13, 2016 It's equal in performance. It's cleaner, and there is embbed getSkill(). Quote
xxdem Posted May 13, 2016 Posted May 13, 2016 It's cleaner, and there is embbed getSkill(). whats the point of a getSkill() method since you CANT cache a L2Skill instance? Quote
Tryskell Posted May 13, 2016 Posted May 13, 2016 (edited) whats the point of a getSkill() method since you CANT cache a L2Skill instance? Avoid to rewrite SkillTable.getInstance().getSkill everytime. By definition, all skills are cached... private static final Map<Integer, L2Skill> _skills = new HashMap<>(); Edited May 13, 2016 by Tryskell Quote
Trance Posted May 13, 2016 Posted May 13, 2016 It's cleaner, and there is embbed getSkill(). I didn't say it's not. :p Quote
xxdem Posted May 13, 2016 Posted May 13, 2016 (edited) Avoid to rewrite SkillTable.getInstance().getSkill everytime. By definition, all skills are cached... private static final Map<Integer, L2Skill> _skills = new HashMap<>(); lol, the _skills will be updated with new L2Skill instances uppon //reload skills, while ALL other L2Skill references will hold the old obsolete L2Skill with old data inside. PS: "By definition" Edited May 13, 2016 by xxdem Quote
Tryskell Posted May 13, 2016 Posted May 13, 2016 (edited) lol, the _skills will be updated with new L2Skill instances uppon //reload skills, while ALL other L2Skill references will hold the old obsolete L2Skill with old data inside. PS: "By definition" Lol, what is the point to cache old skills upon skills reload ? That's all you don't want to do on a server. That would lead to a lot of idiot issues, and making the whole reload command totally pointless. I don't get your point. Moreover, reload commands are only for dev purposes, nothing more. And yes, almost everything is mapped or listed, so... Cached. I doubt I learn you anything. Edited May 13, 2016 by Tryskell Quote
xxdem Posted May 13, 2016 Posted May 13, 2016 Lol, what is the point to cache old skills upon skills reload ? That's all you don't want to do on a server. That would lead to a lot of idiot issues, and making the whole reload command totally pointless. I don't get your point. Moreover, reload commands are only for dev purposes, nothing more. And yes, almost everything is mapped or listed, so... Cached. I doubt I learn you anything. lmao, read again I won't bother Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.