Jump to content
  • 0

Code To Adapt To 340. Acis Pvp/enchant


luzzifer

Question

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.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

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

Edited by SweeTs
Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0

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).

Link to comment
Share on other sites

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

    • the links are offiline, could you reupload them please, if you have other versions of h5 or c6 could you share them too, thanks!
    • Good afternoon everyone, we’ll get a couple of strong players in the CP, more details can be found here https://mw2.community/topic/211276-awr-team/  
    • so i bought this crap of the server few years back and i just found it laying around on my pc and i thought i should share it, if i remember correctly this crap has a lot of bugs that people abuse 🙂   https://drive.google.com/file/d/13QWg8pi4BPbGbTmlygZ078LjL6Fb0J2a/view?usp=sharing source   https://drive.google.com/file/d/13QWg8pi4BPbGbTmlygZ078LjL6Fb0J2a/view?usp=sharing system    
    • Error: Unable to access jarfile libs\Geodata_Converter_v01.jar
    • Since last massive leak as explained as 07/09 (notably all development branches), I don't accept anymore financial newcomers that easily. People will have to contribute 100 cookies worth of contributions (bug reports/fixes) as a first step to be accepted as Donator. Free user can join after sharing over 200 cookies out of contributions, compared to 100 cookies before. You can say thanks to RusAcis, and notably his worthless leader, UnleashedForce. The size of users will continue to shrink if more leaks occur, until true helpers only will be left. New prices are as following : Joining price: 200€ + 100 cookies, or 200 cookies This fee has to be paid if you are joining aCis project. Next month, and all other months, you will have to donate only basic monthly donation. Monthly price: 10€ / 10 cookies This fee has to be paid every month. I won't accept any new join fee before the 100 cookies contribution. Your money will be instantly sent back. Also, in the same shape of idea, actual supporters/donators have to be active to stay in sources. It doesn't have to be a particular amount, you just have to share from time to time *anything*. I don't accept anymore silent ppl. Only useful people will be kept.
  • Topics

×
×
  • Create New...