Skip to content

Instantly share code, notes, and snippets.

@Pandragon
Last active September 5, 2015 08:25
Show Gist options
  • Save Pandragon/dbe9189d1c8eb6f41584 to your computer and use it in GitHub Desktop.
Save Pandragon/dbe9189d1c8eb6f41584 to your computer and use it in GitHub Desktop.
### Eclipse Workspace Patch 1.0
#P L2J_Server
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 10651)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -431,7 +431,7 @@
private long _expBeforeDeath;
/** The Karma of the L2PcInstance (if higher than 0, the name of the L2PcInstance appears in red) */
- private int _karma;
+ private int _karma = 0;
/** The number of player killed during a PvP (the player killed was PvP Flagged) */
private int _pvpKills;
@@ -5476,12 +5476,16 @@
}
// Calculate new karma. (calculate karma before incrase pk count!)
- setKarma(getKarma() + Formulas.calculateKarmaGain(getPkKills(), target.isSummon()));
-
- // PK Points are increased only if you kill a player.
- if (target.isPlayer())
+ final int addedKarma = Formulas.calculateKarmaGain(getPkKills(), target);
+ if (addedKarma > 0)
{
- setPkKills(getPkKills() + 1);
+ setKarma(getKarma() + addedKarma);
+
+ // PK Points are increased only if you kill a player.
+ if (target.isPlayer())
+ {
+ setPkKills(getPkKills() + 1);
+ }
}
// Update player's UI.
Index: java/com/l2jserver/gameserver/model/stats/Formulas.java
===================================================================
--- java/com/l2jserver/gameserver/model/stats/Formulas.java (revision 10651)
+++ java/com/l2jserver/gameserver/model/stats/Formulas.java (working copy)
@@ -2111,14 +2111,19 @@
/**
* Calculates karma gain upon playable kill.</br> Updated to High Five on 10.09.2014 by Zealar tested in retail.
* @param pkCount
- * @param isSummon
+ * @param target
* @return karma points that will be added to the player.
*/
- public static int calculateKarmaGain(int pkCount, boolean isSummon)
+ public static int calculateKarmaGain(int pkCount, L2Character target)
{
+ if ((target.isPlayer() && (target.getActingPlayer().getKarma() > 0)) || (target.isSummon() && (target.getSummoner().getActingPlayer().getKarma() > 0)))
+ {
+ return 0;
+ }
+
int result = 43200;
- if (isSummon)
+ if (target.isSummon())
{
result = (int) ((((pkCount * 0.375) + 1) * 60) * 4) - 150;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment