Jump to content
  • 0

Code To Adapt To 340. Acis Pvp/enchant


Question

Posted

Hello, someone would have some code in order to adapt to 340. ACIS server?
I'm interested that after killing 100 players become the weapon +1.
After 1000 after killing players become the weapon +2
That is by way of example, excuse my English.

 

As it was in the Good vs Evil server.

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

Create a switch which checks pvp count and add a method to enchant the equipped weapon.

Edited by SweeTs
  • 0
Posted

I found this code for frozen, someone help me adapt to acis 340 ?, have no idea that changes to the code to work properly in ACIS.

### Eclipse Workspace Patch 1.0
#P trunk2
Index: gameserver/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java   (revision 1004)
+++ gameserver/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
@@ -678,7 +678,8 @@
     private int heroConsecutiveKillCount = 0;
     private boolean isPVPHero = false;
     
-   
+   /** Pvp enchant System **/
+    private int rewardConsecutiveKillCount = 0;
    /** character away mode **/
    private boolean _awaying = false;
    private boolean _isAway = false;
@@ -6822,6 +6823,10 @@
        // Increase the kill count for a special hero aura
        heroConsecutiveKillCount++;
       
+       
+        // Increase item +1 enchant as a reward
+        rewardConsecutiveKillCount++;
+        
        // If heroConsecutiveKillCount == 30 give hero aura
        if(heroConsecutiveKillCount == Config.KILLS_TO_GET_WAR_LEGEND_AURA && Config.WAR_LEGEND_AURA)
        {
@@ -6830,6 +6835,85 @@
           
        }
        
+   //====================== Enchant PvP =============================   
+   //=========== Adaptacion y Modificacion CaiFacu ==================
+if (rewardConsecutiveKillCount >= Config.PVP_COUNT_TILL_ENCHANTMENT && Config.ENABLE_PVP_ENCHANTMENT)  
+                          {
+                          
+                             switch (Rnd.get(9))
+                             {
+                                   case 0:
+                                   {
+                                      /** Weapon **/     
+                                    final L2ItemInstance pvpwep = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
+                                 
+                                      if (pvpwep.getEnchantLevel() < Config.ENCHANT_WEAPON_MAX)
+                                      {
+                                      pvpwep.setEnchantLevel(pvpwep.getEnchantLevel() + 1);
+                                      sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) + "has been enchanted by +1 due to your pvp kills");
+                                      rewardConsecutiveKillCount = 0;
+                                      break;
+                                      }
+                                   }
+                                   case 1:
+                                  {
+                                     /** Armor **/
+                                   final L2ItemInstance pvphead = getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD);
+                               if (pvphead.getEnchantLevel() < Config.ENCHANT_ARMOR_MAX)
+                                      {
+                                     pvphead.setEnchantLevel(pvphead.getEnchantLevel() + 1);
+                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD) + "has been enchanted by +1 due to your pvp kills");
+                                     rewardConsecutiveKillCount = 0;
+                                     break;
+                                  }}
+                                   case 2:
+                                  {
+                                     /** Armor **/
+                                   final L2ItemInstance pvpgloves = getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES);
+                                   if (pvpgloves.getEnchantLevel() < Config.ENCHANT_ARMOR_MAX)
+                                      {
+                                     pvpgloves.setEnchantLevel(pvpgloves.getEnchantLevel() + 1);
+                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES) + "has been enchanted by +1 due to your pvp kills");
+                                     rewardConsecutiveKillCount = 0;
+                                     break;
+                                  }}
+                                   case 3:
+                                  {
+                                     /** Armor **/
+                                   final L2ItemInstance pvpchest = getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);
+                                   if (pvpchest.getEnchantLevel() < Config.ENCHANT_ARMOR_MAX)
+                                      {
+                                     pvpchest.setEnchantLevel(pvpchest.getEnchantLevel() + 1);
+                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST) + "has been enchanted by +1 due to your pvp kills");
+                                     rewardConsecutiveKillCount = 0;
+                                     break;
+                                  }}
+                                   case 4:
+                                  {
+                                     /** Armor **/
+                                   final L2ItemInstance pvplegs = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS);
+                                   if (pvplegs.getEnchantLevel() < Config.ENCHANT_ARMOR_MAX)
+                                      {
+                                     pvplegs.setEnchantLevel(pvplegs.getEnchantLevel() + 1);
+                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS) + "has been enchanted by +1 due to your pvp kills");
+                                     rewardConsecutiveKillCount = 0;
+                                     break;
+                                  }}
+                                   case 5:
+                                  {
+                                     /** Armor **/
+                                   final L2ItemInstance pvpfeet = getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET);
+                                if (pvpfeet.getEnchantLevel() < Config.ENCHANT_ARMOR_MAX)
+                                      {
+                                     pvpfeet.setEnchantLevel(pvpfeet.getEnchantLevel() + 1);
+                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET) + "has been enchanted by +1 due to your pvp kills");
+                                     rewardConsecutiveKillCount = 0;
+                                     break;
+                                  }}
+                                   case 6:
+                                  {
+                                     /** Jewel **/
+                                   final L2ItemInstance pvpneck = getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK);
+                                   if (pvpneck.getEnchantLevel() < Config.ENCHANT_JEWELRY_MAX)
+                                      {
+                                     pvpneck.setEnchantLevel(pvpneck.getEnchantLevel() + 1);
+                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK) + "has been enchanted by +1 due to your pvp kills");
+                                     rewardConsecutiveKillCount = 0;
+                                     break;
+                                  }}
+                                   case 7:
+                                  {
+                                     /** Jewel **/
+                                   final L2ItemInstance pvplf = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER);
+                                   if (pvplf.getEnchantLevel() < Config.ENCHANT_JEWELRY_MAX)
+                                      {
+                                     pvplf.setEnchantLevel(pvplf.getEnchantLevel() + 1);
+                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER) + "has been enchanted by +1 due to your pvp kills");
+                                     rewardConsecutiveKillCount = 0;
+                                     break;
+                                  }}
+                                   case 8:
+                                  {
+                                     /** Jewel **/
+                                   final L2ItemInstance pvprf = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER);
+                               if (pvprf.getEnchantLevel() < Config.ENCHANT_JEWELRY_MAX)
+                                      {
+                                     pvprf.setEnchantLevel(pvprf.getEnchantLevel() + 1);
+                                     sendMessage("Your " + getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER) + "has been enchanted by +1 due to your pvp kills");
+                                     rewardConsecutiveKillCount = 0;
+                                     break;
+                                  }}
+                       } 
+                   }         }
+   //====================== Enchant PvP =============================   
+   //=========== Adaptacion y Modificacion CaiFacu ==================
       if(Config.PVPEXPSP_SYSTEM)
       {
Index: gameserver/head-src/com/l2jfrozen/Config.java
===================================================================
--- gameserver/head-src/com/l2jfrozen/Config.java   (revision 1004)
+++ gameserver/head-src/com/l2jfrozen/Config.java   (working copy)
@@ -2091,6 +2091,8 @@
    public static String PM_TEXT1;
    public static String PM_TEXT2;
    public static boolean NEW_PLAYER_EFFECT;
+   public static boolean ENABLE_PVP_ENCHANTMENT;
+   public static int PVP_COUNT_TILL_ENCHANTMENT;
    
 
    //============================================================
@@ -2113,7 +2115,9 @@
          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"));
-
+         ENABLE_PVP_ENCHANTMENT = Boolean.parseBoolean(frozenSettings.getProperty("EnablePvpEnchantSystem", "False"));
+         PVP_COUNT_TILL_ENCHANTMENT = Integer.parseInt(frozenSettings.getProperty("PvpCountTillEnchanment", "20"));
+         
       }
       catch(Exception e)
       {
 
    //============================================================
    public static void loadL2JFrozenConfig()
@@ -2467,6 +2475,10 @@
          FARM2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("Farm2CustomMeesage", "You have been teleported to Farm Zone 2!");
          PVP1_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!");
          PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");
+         
+         SKILL_GIVER_SKILL_ID = Integer.parseInt(L2JFrozenSettings.getProperty("SkillGiverSkillId", "1"));
+         SKILL_GIVER_SKILL_LEVEL = Integer.parseInt(L2JFrozenSettings.getProperty("SkillGiverSkillLevel", "1"));
+         SKILL_GIVER_ID = Integer.parseInt(L2JFrozenSettings.getProperty("SkillGiverItemId", "3470"));
       }
       catch(Exception e)
       {
Index: gameserver/config/frozen/frozen.properties
===================================================================
--- gameserver/config/frozen/frozen.properties   (revision 1004)
+++ gameserver/config/frozen/frozen.properties   (working copy)
@@ -21,4 +21,17 @@
 
 # New players get fireworks the first time they log in
 # Default: False
-NewPlayerEffect = False
\ No newline at end of file
+NewPlayerEffect = False
+
+#=================================#
+#=Elfocrash's Pvp Enchant System==#
+#=================================#
+#By enabling this then every X pvp
+#in a row the player will get randomly
+#a part of his armor,weapon or jewel that
+#is currently equiped automatically enchanted
+#To enable the system set True below
+EnablePvpEnchantSystem = True
+#Every how many kills you want the chars to be
+#awared with +1?
+PvpCountTillEnchanment = 20
\ No poner lineas nuevas al final del codigo
  • 0
Posted

That piece of code probably throw NPEs, because it doesn't check if you currently wear such piece of equipement (missing != null check). The switch can be shortcuted by 75% (3 cases instead of 9).

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Hello! I need help with the file lineageeffect.u (Interlude client) I need to remove ForcedLifeTime from the following skills:   Battle Heal Greater Major Heal Hurricane Solar Flare Hydro Blast Aura Bolt Aura Flare Aura Flash   Thank you in advance for your help!
    • Used to have the same issue managing all my masked files from different edits. What really helped me stay organized was this list: https://www.blueberry-ai.com/blog/12-best-digital-asset-management-software-for-photographers. Found a couple of tools there that make sorting, tagging, and finding assets way easier, especially when working on multiple projects or sharing with clients. Took a massive load off my workflow and saved me a lot of time digging through folders.
    • IBServer for L2OFF GF-H5-GD-Classic I’m excited to share IBServer, a fully standalone authentication and billing server designed for Lineage II Official (L2OFF) Generations Supporting Gracia Final (GF), High Five (H5), Glory Days (GD), and Classic Year(2018-2020).   Key features: 🔌 Real IB Communication: Integrates directly with the L2OFF client protocol for in‑band packet handling. ⚙️ Zero Client/Server Modification: No changes required to L2Server.exe, no extenders, no hooks — plug and play. 🛠️ ODBC SQL Server Support: Built‑in DBManager C++ class for handling premium points, purchases, and account data via stored procedures. 📦 Complete Packet API: Full implementation of RequestCheckVersion, GetPremiumItems, GetGamePoint, AddGamePoint, BuyItem, DeleteItem, etc. 🚀 Ready to Deploy: Simple config.txt for port and connection string, runs as a native Windows service or console app.   Price: $150 USD (one‑time payment, no licensing restrictions — use on as many PCs as you want)   How to purchase & support: Please reply here or send me a private message on MaxCheaters. I’ll provide a compiled binary along with installation instructions.
    • Hello everyone I'm Albert, Starting now with the dream on have a L2 server, I'm having several issues with RS and I need someone help to Create an skill and implement to the correct class ID and make it work. Skill Required from me is  Festival Sweep  Skill or Item with the ability. I really need help guys and then after if possible i would need NPC and skins with .dressme        
  • Topics

×
×
  • Create New...