Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Heroe al matar X jugadores

Iniciado por Swarlog, Sep 01, 2022, 12:51 AM

Tema anterior - Siguiente tema

Swarlog

Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (revision 1901)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
@@ -488,6 +488,11 @@
 
    private boolean _noble = false;
    private boolean _hero = false;
+   
+   /** Special hero aura values */
+   private int heroConsecutiveKillCount = 0;
+   private boolean isPermaHero = false;
+   private boolean isPVPHero = false;
 
    /** The L2FolkInstance corresponding to the last Folk wich one the player talked. */
    private L2FolkInstance _lastFolkNpc = null;
@@ -1971,6 +1976,13 @@
    public void setPvpKills(int pvpKills)
    {
       _pvpKills = pvpKills;
+     
+      // Set hero aura if pvp kills > 5000
+      if (pvpKills > 5000)
+      {
+         isPermaHero = true;
+         setHero(true);
+      }
    }
 
    /**
@@ -4678,6 +4690,14 @@
 
       stopRentPet();
       stopWaterTask();
+     
+      // Remove kill count for special hero aura if total pvp < 100
+      heroConsecutiveKillCount = 0;
+      if (!isPermaHero)
+      {
+         setHero(false);
+         sendPacket(new UserInfo(this));
+      }
       return true;
    }
 
@@ -4897,6 +4917,13 @@
     {
         // Add karma to attacker and increase its PK counter
         setPvpKills(getPvpKills() + 1);
+       
+        // Increase the kill count for a special hero aura
+        heroConsecutiveKillCount++;
+       
+        // If heroConsecutiveKillCount > 4 (5+ kills) give hero aura
+        if(heroConsecutiveKillCount > 20)
+           setHero(true);
 
         // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
         sendPacket(new UserInfo(this));
@@ -8715,6 +8742,22 @@
    {
       return _blockList;
    }
+   
+   public void reloadPVPHeroAura()
+   {
+      sendPacket(new UserInfo(this));
+   }
+   
+   public void setHeroAura (boolean heroAura)
+   {
+      isPVPHero = heroAura;
+      return;
+   }
+   
+   public boolean getIsPVPHero()
+   {
+      return isPVPHero;
+   }
 
    public void setHero(boolean hero)
    {
Index: java/net/sf/l2j/gameserver/serverpackets/UserInfo.java
===================================================================
--- java/net/sf/l2j/gameserver/serverpackets/UserInfo.java   (revision 1901)
+++ java/net/sf/l2j/gameserver/serverpackets/UserInfo.java   (working copy)
@@ -337,7 +337,7 @@
 
         writeD(_activeChar.getClanCrestLargeId());
         writeC(_activeChar.isNoble() ? 1 : 0); //0x01: symbol on char menu ctrl+I
-        writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA)) ? 1 : 0); //0x01: Hero Aura
+        writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) || _activeChar.getIsPVPHero()) ? 1 : 0); //0x01: Hero Aura
 
         writeC(_activeChar.isFishing() ? 1 : 0); //Fishing Mode
         writeD(_activeChar.getFishx()); //fishing x