Noticias:

No tienes permiso para ver los enlaces. Para poder verlos Registrate o Conectate.

Menú Principal

Level Up Rewards

Iniciado por St3eT, Ago 03, 2025, 01:22 AM

Tema anterior - Siguiente tema

St3eT

### Eclipse Workspace Patch 1.0
#P L2J_Server_BETA
Index: dist/game/config/l2jmods.properties
===================================================================
--- dist/game/config/l2jmods.properties  (revision 5048)
+++ dist/game/config/l2jmods.properties    (working copy)
@@ -461,4 +461,14 @@
 # ---------------------------------------------------------------------------
 # Enables .changepassword voiced command which allows the players to change their account's password ingame.
 # Default: False
-AllowChangePassword = False
\ No newline at end of file
+AllowChangePassword = False
+
+# ---------------------------------------------------------------------------
+# Reward by level
+# ---------------------------------------------------------------------------
+# Default: False
+AllowRewardByLevel = False;
+
+# Usage: level1,itemid1,count1;level2,itemid2,count2;...
+# Example: 30,57,1000;48,57,1500;...
+# Default:
+RewardItems = 
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (revision 5048)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
@@ -113,6 +113,7 @@
 import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.L2Party;
 import com.l2jserver.gameserver.model.L2Party.messageType;
+import com.l2jserver.gameserver.model.ItemHolder;
 import com.l2jserver.gameserver.model.L2PetData;
 import com.l2jserver.gameserver.model.L2PetLevelData;
 import com.l2jserver.gameserver.model.L2PremiumItem;
@@ -15377,4 +15378,13 @@
         
         return bonus;
     }
+    
+    public void playerRewardByLevel()
+    {
+        if (Config.ALLOW_REWARD_BY_LEVEL && Config.REWARD_ITEMS.containsKey(getLevel()))
+        {
+            ItemHolder holder = Config.REWARD_ITEMS.get(getLevel());
+            addItem("Reward", holder.getId(), holder.getCount(), null, true);
+        }
+    }
 }
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java    (revision 5048)
+++ java/com/l2jserver/Config.java    (working copy)
@@ -45,6 +45,7 @@
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 
+import com.l2jserver.gameserver.model.ItemHolder;
 import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
 import com.l2jserver.gameserver.util.FloodProtectorConfig;
 import com.l2jserver.util.L2Properties;
@@ -765,6 +766,8 @@
     public static int L2JMOD_DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP;
     public static TIntIntHashMap L2JMOD_DUALBOX_CHECK_WHITELIST;
     public static boolean L2JMOD_ALLOW_CHANGE_PASSWORD;
+    public static boolean ALLOW_REWARD_BY_LEVEL;
+    public static TIntObjectHashMap<ItemHolder> REWARD_ITEMS;
     
     //--------------------------------------------------
     // NPC Settings
@@ -2660,6 +2663,29 @@
                         }
                     }
                     L2JMOD_ALLOW_CHANGE_PASSWORD = Boolean.parseBoolean(L2JModSettings.getProperty("AllowChangePassword", "False"));
+                    ALLOW_REWARD_BY_LEVEL = Boolean.parseBoolean(L2JModSettings.getProperty("AllowRewardByLevel", "False"));
+                    String[] rewardItems = L2JModSettings.getProperty("RewardItems", "").split(";");
+                    REWARD_ITEMS = new TIntObjectHashMap<ItemHolder>(rewardItems.length);
+                    if (!rewardItems[0].isEmpty())
+                    {
+                        for (String item : rewardItems)
+                        {
+                            String[] itemSplit = item.split(",");
+                            if (itemSplit.length != 3)
+                                _log.warning(StringUtil.concat("Config.load(): invalid config property -> RewardItems \"", item, "\""));
+                            else
+                            {
+                                try
+                                {
+                                    REWARD_ITEMS.put(Integer.parseInt(itemSplit[0]), new ItemHolder(Integer.parseInt(itemSplit[1]), Long.parseLong(itemSplit[2])));
+                                }
+                                catch (NumberFormatException nfe)
+                                {
+                                    _log.warning(StringUtil.concat("Config.load(): invalid config property -> RewardItems \"", item, "\""));
+                                }
+                            }
+                        }
+                    }
                 }
                 catch (Exception e)
                 {
Index: java/com/l2jserver/gameserver/model/actor/stat/PcStat.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/stat/PcStat.java    (revision 5048)
+++ java/com/l2jserver/gameserver/model/actor/stat/PcStat.java    (working copy)
@@ -229,6 +229,8 @@
             getActiveChar().broadcastPacket(new SocialAction(getActiveChar(), SocialAction.LEVEL_UP));
             getActiveChar().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_INCREASED_YOUR_LEVEL));
             
+            getActiveChar().playerRewardByLevel();
+            
             L2ClassMasterInstance.showQuestionMark(getActiveChar());
         }

By No tienes permiso para ver los enlaces. Para poder verlos Registrate o Conectate.