Advertisement
Guest User

Kara`

a guest
Oct 4th, 2018
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.29 KB | None | 0 0
  1. Index: java/com/l2jserver/gameserver/model/actor/L2Playable.java
  2. ===================================================================
  3. --- java/com/l2jserver/gameserver/model/actor/L2Playable.java   (revision 2)
  4. +++ java/com/l2jserver/gameserver/model/actor/L2Playable.java   (working copy)
  5. @@ -12,10 +12,14 @@
  6.   */
  7.  package com.l2jserver.gameserver.model.actor;
  8.  
  9. +import java.util.LinkedList;
  10. +import java.util.List;
  11. +
  12.  import com.l2jserver.gameserver.ai.CtrlEvent;
  13.  import com.l2jserver.gameserver.model.CharEffectList;
  14.  import com.l2jserver.gameserver.model.L2Effect;
  15.  import com.l2jserver.gameserver.model.L2Skill;
  16. +import com.l2jserver.gameserver.model.L2World;
  17.  import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  18.  import com.l2jserver.gameserver.model.actor.knownlist.PlayableKnownList;
  19.  import com.l2jserver.gameserver.model.actor.stat.PlayableStat;
  20. @@ -25,6 +29,7 @@
  21.  import com.l2jserver.gameserver.model.quest.QuestState;
  22.  import com.l2jserver.gameserver.templates.chars.L2CharTemplate;
  23.  import com.l2jserver.gameserver.templates.skills.L2EffectType;
  24. +import com.l2jserver.util.Rnd;
  25.  
  26.  /**
  27.   * This class represents all Playable characters in the world.<BR>
  28. @@ -368,4 +373,62 @@
  29.         }
  30.         return _faction;
  31.     }
  32. +  
  33. +   public static class HealerInfo
  34. +   {
  35. +       private final int _objectId;
  36. +       private long _healAmount;
  37. +       private long _lastHeal;
  38. +      
  39. +       HealerInfo(int objectId, long amount)
  40. +       {
  41. +           _objectId = objectId;
  42. +           addAndRecord(amount);
  43. +       }
  44. +      
  45. +       public void addAndRecord(long amount)
  46. +       {
  47. +           _healAmount += amount;
  48. +           _lastHeal = System.currentTimeMillis();
  49. +       }
  50. +      
  51. +       public L2PcInstance getHealer()
  52. +       {
  53. +           return L2World.getInstance().getPlayer(_objectId);
  54. +       }
  55. +      
  56. +       public long getHeal()
  57. +       {
  58. +           return _healAmount;
  59. +       }
  60. +      
  61. +       public long getLastHeal()
  62. +       {
  63. +           return _lastHeal;
  64. +       }
  65. +      
  66. +       public boolean isNullOrLate()
  67. +       {
  68. +           return (getHealer() == null) || (getLastHeal() >= (System.currentTimeMillis() + (12 * 1000)));
  69. +       }
  70. +      
  71. +       public boolean isCloseTo(L2PcInstance target)
  72. +       {
  73. +           L2PcInstance healer = getHealer();
  74. +           return healer != null && healer.getDistanceSq(target) <= 1750;
  75. +       }
  76. +      
  77. +       public boolean hasHealEnough()
  78. +       {
  79. +           L2PcInstance healer = getHealer();
  80. +           return healer != null && Rnd.get(10, 20) * getHeal() >= healer.getLevel() * 341 * 100;
  81. +       }
  82. +   }
  83. +  
  84. +   public final List<HealerInfo> _healerInfo = new LinkedList<>();
  85. +  
  86. +   public void addHeal(int healerId, long amount)
  87. +   {
  88. +      
  89. +   }
  90.  }
  91. \ No newline at end of file
  92. Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  93. ===================================================================
  94. --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (revision 3)
  95. +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
  96. @@ -5945,6 +5945,15 @@
  97.         {
  98.             setPvpKills(getPvpKills() + 1);
  99.            
  100. +           _healerInfo.removeIf(HealerInfo::isNullOrLate);
  101. +          
  102. +           _healerInfo.stream().filter(i -> i.hasHealEnough()).filter(i -> i.isCloseTo(this)).forEach(i ->
  103. +           {
  104. +               L2PcInstance healer = i.getHealer();
  105. +               healer.setPvpKills(healer.getPvpKills() + 1);
  106. +               _healerInfo.remove(i);
  107. +           });
  108. +          
  109.             if (Config.ENABLED_COUPLE_SUPPORT_SYSTEM)
  110.             {
  111.                 CoupleRevenge.checkForPartner(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement