Secret Experience

Secret Experience (https://secretexperience.net/)
-   [Lineage] Java Mods (https://secretexperience.net/lineage-java-mods/)
-   -   [L2JFrozen] New Char Buffs (https://secretexperience.net/lineage-java-mods/34212-new-char-buffs.html)

RedHoT 28-09-2013 06:03 PM

New Char Buffs
 
Com este mod, é possível adicionar buffs aos players para nascer no primeiro log in.

Créditos: MEUS

Dúvidas? Leiam o código :cute:

Código:

### Eclipse Workspace Patch 1.0
#P L2jFrozen_GameServer
Index: head-src/com/l2jfrozen/Config.java
===================================================================
--- head-src/com/l2jfrozen/Config.java        (revision 939)
+++ head-src/com/l2jfrozen/Config.java        (working copy)
@@ -2121,8 +2121,11 @@
        public static String PM_TEXT1;
        public static String PM_TEXT2;
        public static boolean NEW_PLAYER_EFFECT;
-       
+        public static boolean NEW_PLAYER_BUFFS;
+        public static Map<Integer, Integer> FIGHTER_BUFF_LIST;
+        public static Map<Integer, Integer> MAGE_BUFF_LIST;
 
+
        //============================================================
        public static void loadFrozenConfig()
        {
@@ -2143,7 +2146,59 @@
                        PM_TEXT1  = frozenSettings.getProperty("PMText1", "Have Fun and Nice Stay on");
                        PM_TEXT2  = frozenSettings.getProperty("PMText2", "Vote for us every 24h");
                        NEW_PLAYER_EFFECT = Boolean.parseBoolean(frozenSettings.getProperty("NewPlayerEffect", "True"));
+                        NEW_PLAYER_BUFFS = Boolean.parseBoolean(frozenSettings.getProperty("AltNewCharBuffs", "False"));
+                        if(NEW_PLAYER_BUFFS)
+                        {
+                                String[] fighterBuffSplit = frozenSettings.getProperty("FighterBuffList", "").split(";");
+                                FIGHTER_BUFF_LIST = new FastMap<Integer, Integer>(fighterBuffSplit.length);
+                                for(String skill : fighterBuffSplit)
+                                {
+                                        String[] skillSplit = skill.split(",");
+                                        if(skillSplit.length != 2)
+                                        {
+                                                System.out.println("invalid config property in " + Frozen + " -> FighterBuffList \"" + skill + "\"");
+                                        }
+                                        else
+                                        {
+                                                try
+                                                {
+                                                        FIGHTER_BUFF_LIST.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
+                                                }
+                                                catch(NumberFormatException nfe)
+                                                {
+                                                        if(!skill.equals(""))
+                                                        {
+                                                                System.out.println("invalid config property in " + Frozen + " -> FighterBuffList \"" + skillSplit[0] + "\"" + skillSplit[1]);
+                                                        }
+                                                }
+                                        }
+                                }
 
+                                String[] mageBuffSplit = frozenSettings.getProperty("MageBuffList", "").split(";");
+                                MAGE_BUFF_LIST = new FastMap<Integer, Integer>(mageBuffSplit.length);
+                                for(String skill : mageBuffSplit)
+                                {
+                                        String[] skillSplit = skill.split(",");
+                                        if(skillSplit.length != 2)
+                                        {
+                                                System.out.println("invalid config property in " + Frozen + " -> MageBuffList \"" + skill + "\"");
+                                        }
+                                        else
+                                        {
+                                                try
+                                                {
+                                                        MAGE_BUFF_LIST.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
+                                                }
+                                                catch(NumberFormatException nfe)
+                                                {
+                                                        if(!skill.equals(""))
+                                                        {
+                                                                System.out.println("invalid config property in" + Frozen + " -> MageBuffList \"" + skillSplit[0] + "\"" + skillSplit[1]);
+                                                        }
+                                                }
+                                        }
+                                }
+                        }
                }
                catch(Exception e)
                {
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java        (revision 939)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java        (working copy)
@@ -285,6 +285,9 @@
                Announcements.getInstance().showAnnouncements(activeChar);
 
                loadTutorial(activeChar);
+
+                if(activeChar.getFirstLog())
+                        onEnterNewbie(activeChar);
               
                // Check for crowns
                CrownManager.getInstance().checkCrowns(activeChar);
@@ -543,20 +546,6 @@
                if (Config.ONLINE_PLAYERS_ON_LOGIN)
                        sendPacket(new SystemMessage(SystemMessageId.S1_S2).addString("There are " + L2World.getInstance().getAllPlayers().size() + " players online."));
 
-                if (activeChar.getFirstLog() && Config.NEW_PLAYER_EFFECT)
-                {
-                        L2Skill skill = SkillTable.getInstance().getInfo(2025,1);
-                        if (skill != null)
-                        {
-                                MagicSkillUser MSU = new MagicSkillUser(activeChar, activeChar, 2025, 1, 1, 0);
-                                activeChar.sendPacket(MSU);
-                                activeChar.broadcastPacket(MSU);
-                                activeChar.useMagic(skill, false, false);
-                        }
-                        activeChar.setFirstLog(false);
-                        activeChar.updateFirstLog();
-                }
-
                if (Config.WELCOME_HTM && isValidName(activeChar.getName()))
                {
                        String Welcome_Path = "data/html/welcome.htm";
@@ -688,6 +677,50 @@
        }
 
        /**
+        * @param activeChar
+        */
+        private void onEnterNewbie(L2PcInstance activeChar)
+        {
+                if(Config.NEW_PLAYER_EFFECT)
+                {
+                        L2Skill skill = SkillTable.getInstance().getInfo(2025, 1);
+                        if(skill != null)
+                        {
+                                MagicSkillUser MSU = new MagicSkillUser(activeChar, activeChar, 2025, 1, 1, 0);
+                                activeChar.sendPacket(MSU);
+                                activeChar.broadcastPacket(MSU);
+                                activeChar.useMagic(skill, false, false);
+                        }
+                }
+
+                if(Config.NEW_PLAYER_BUFFS)
+                {
+                        if(activeChar.isMageClass())
+                        {
+                                for(Integer skillid : Config.MAGE_BUFF_LIST.keySet())
+                                {
+                                        int skilllvl = Config.MAGE_BUFF_LIST.get(skillid);
+                                        L2Skill skill = SkillTable.getInstance().getInfo(skillid, skilllvl);
+                                        if(skill != null)
+                                                skill.getEffects(activeChar, activeChar);
+                                }
+                        }
+                        else
+                        {
+                                for(Integer skillid : Config.FIGHTER_BUFF_LIST.keySet())
+                                {
+                                        int skilllvl = Config.FIGHTER_BUFF_LIST.get(skillid);
+                                        L2Skill skill = SkillTable.getInstance().getInfo(skillid, skilllvl);
+                                        if(skill != null)
+                                                skill.getEffects(activeChar, activeChar);
+                                }
+                        }
+                }
+                activeChar.setFirstLog(false);
+                activeChar.updateFirstLog();
+        }
+
+        /**
          * @param cha
          */
        private void engage(L2PcInstance cha)
Index: config/frozen/frozen.properties
===================================================================
--- config/frozen/frozen.properties        (revision 939)
+++ config/frozen/frozen.properties        (working copy)
@@ -21,4 +21,18 @@
 
 # New players get fireworks the first time they log in
 # Default: False
-NewPlayerEffect = False
\ No newline at end of file
+NewPlayerEffect = False
+
+# Give buffs to character on first game log in.
+# Default: False
+AltNewCharBuffs = False
+
+# The List of Fighter Buffs
+# Format : skillid,skilllvl;skillid2,skilllvl2;....skillidn,skilllvln
+FighterBuffList = 1204,2;1068,3;1040,3;1035,4;1036,2;1045,6;1086,2;1077,3;1240,3;1242,3;\
+264,1;267,1;268,1;269,1;304,1;349,1;364,1;271,1;274,1;275,1;1363,1;1391,3;4699,1;4703,1
+
+# The List of Mage Buffs
+# Format : skillid,skilllvl;skillid2,skilllvl2;....skillidn,skilllvln
+MageBuffList = 1204,2;1040,3;1035,4;1045,6;1048,6;1036,2;1303,2;1085,3;1059,3;1078,6;\
+1062,2;1397,3;264,1;267,1;268,1;304,1;349,1;364,1;273,1;276,1;365,1;1413,1;1391,3;4703,1

Download: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]


Horários baseados na GMT -3. Agora são 04:16 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0