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.



×
×
  • Create New...