Page 1 of 1
Antifeed to Interlude
Posted: Wed Jul 21, 2010 8:54 am
by SeRk
Hello everybody,i managed to adapt antifeed from epilogue to interlude.
All fine no error,and i though it would be better for me i would test it,to search for errors etc
All fine no errors,but guys i logged with localhost with 2 windows i pvp/pk but i still take pvp/pk
Did i forgot something?can you tell me all the java files that i must search for it?
Ahh btw i searched and i saw only at instance manager and l2pcinstance..its correct?
thanks
Re: Antifeed to Interlude
Posted: Wed Jul 21, 2010 10:50 am
by LasTravel
Now I'm using my telekinesis skill lvl 5 for check if you forgot something on your patch but I fail, so wait janii's reply he have same skill but lvl 10 maybe he/she can help you.
Please post your patch if you want support.
PS: Sorry for irony mode.
Re: Antifeed to Interlude
Posted: Wed Jul 21, 2010 11:07 am
by janiii
the only files changed by anti-feed are:
Config.java
AntiFeedManager.java
L2PcInstance.java
if it doesnt work, check your config properties, check Config java class. be sure that the config is without errors and that your changes are used (output to console if necessary).
Re: Antifeed to Interlude
Posted: Wed Jul 21, 2010 12:10 pm
by jurchiks
there might easily be some missing/changed methods
Re: Antifeed to Interlude
Posted: Wed Jul 21, 2010 12:33 pm
by SeRk
sure let me post it
Code: Select all
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java===================================================================--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 174)+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)@@ -74,6 +74,7 @@ import net.sf.l2j.gameserver.handler.skillhandlers.SiegeFlag; import net.sf.l2j.gameserver.handler.skillhandlers.StrSiegeAssault; import net.sf.l2j.gameserver.handler.skillhandlers.TakeCastle;+import net.sf.l2j.gameserver.instancemanager.AntiFeedManager; import net.sf.l2j.gameserver.instancemanager.CastleManager; import net.sf.l2j.gameserver.instancemanager.CoupleManager; import net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager;@@ -4415,7 +4416,9 @@ && _clan.isAtWarWith(((L2PcInstance) killer).getClanId()) && ((L2PcInstance)killer).getClan().isAtWarWith(_clan.getClanId())) {- if (getClan().getReputationScore() > 0) // when your reputation score is 0 or below, the other clan cannot acquire any reputation points+ if (AntiFeedManager.getInstance().check(killer, this))+ {+ if (getClan().getReputationScore() > 0) // when your reputation score is 0 or below, the other clan cannot acquire any reputation points ((L2PcInstance) killer).getClan().setReputationScore(((L2PcInstance) killer).getClan().getReputationScore()+2, true); if (((L2PcInstance)killer).getClan().getReputationScore() > 0) // when the opposing sides reputation score is 0 or below, your clans reputation score does not decrease _clan.setReputationScore(_clan.getReputationScore()-2, true);@@ -4434,6 +4437,7 @@ } } }+ } setPvpFlag(0); // Clear the pvp flag @@ -4464,8 +4468,10 @@ calculateDeathPenaltyBuffLevel(killer); stopRentPet();- stopWaterTask(); + stopWaterTask(); + AntiFeedManager.getInstance().setLastDeathTime(getObjectId());+ if (quakeSystem == 1) { quakeSystem = 0;@@ -4628,7 +4634,7 @@ ) { if (target instanceof L2PcInstance)- increasePvpKills();+ increasePvpKills(target); } else // Target player doesn't have pvp flag set {@@ -4641,7 +4647,7 @@ { // 'Both way war' -> 'PvP Kill' if (target instanceof L2PcInstance)- increasePvpKills();+ increasePvpKills(target); return; } }@@ -4653,12 +4659,12 @@ if ( Config.KARMA_AWARD_PK_KILL ) { if (target instanceof L2PcInstance)- increasePvpKills();+ increasePvpKills(target); } } else if (targetPlayer.getPvpFlag() == 0) // Target player doesn't have karma {- increasePkKillsAndKarma(targetPlayer.getLevel());+ increasePkKillsAndKarma(target); } } }@@ -4667,8 +4673,12 @@ * Increase the pvp kills count and send the info to the player * */- public void increasePvpKills()+ public void increasePvpKills(L2Character target) {+ if (target instanceof L2PcInstance+ && AntiFeedManager.getInstance().check(this, target))+ {+ // Add karma to attacker and increase its PK counter setPvpKills(getPvpKills() + 1); @@ -4731,6 +4741,7 @@ // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter sendPacket(new UserInfo(this)); }+ } /** * Get info on pk's from pk table@@ -4831,7 +4842,7 @@ * * @param targLVL : level of the killed player */- public void increasePkKillsAndKarma(int targLVL)+ public void increasePkKillsAndKarma(L2Character target) { int baseKarma = Config.KARMA_MIN_KARMA; int newKarma = baseKarma;@@ -4839,6 +4850,8 @@ int pkLVL = getLevel(); int pkPKCount = getPkKills();+ + int targLVL = target.getLevel(); int lvlDiffMulti = 0; int pkCountMulti = 0;@@ -4871,6 +4884,8 @@ // Add karma to attacker and increase its PK counter setPkKills(getPkKills() + 1);+ if (target instanceof L2PcInstance+ && AntiFeedManager.getInstance().check(this, target)) setKarma(getKarma() + newKarma); //Update the character's title color if they reached any of the 5 PK levels.Index: java/net/sf/l2j/Config.java===================================================================--- java/net/sf/l2j/Config.java (revision 173)+++ java/net/sf/l2j/Config.java (working copy)@@ -913,6 +913,10 @@ public static boolean AWAY_PEACE_ZONE; public static boolean ANNOUNCE_CASTLE_LORDS; public static int MAX_PLAYERS_FROM_ONE_PC;+ public static boolean ANTIFEED_ENABLE;+ public static boolean ANTIFEED_DUALBOX;+ public static boolean ANTIFEED_DISCONNECTED_AS_DUALBOX;+ public static int ANTIFEED_INTERVAL; /** Overdose Mods - End */ /** Overdose Events - Start */@@ -2142,6 +2146,10 @@ AWAY_PEACE_ZONE = Boolean.parseBoolean(OverdoseModsSettings.getProperty("AwayOnlyInPeaceZone", "False")); ANNOUNCE_CASTLE_LORDS = Boolean.parseBoolean(OverdoseModsSettings.getProperty("AnnounceCastleLors", "False")); MAX_PLAYERS_FROM_ONE_PC = Integer.parseInt(OverdoseModsSettings.getProperty("MultiboxesPerPC", "2"));+ ANTIFEED_ENABLE = Boolean.parseBoolean(OverdoseModsSettings.getProperty("AntiFeedEnable", "false"));+ ANTIFEED_DUALBOX = Boolean.parseBoolean(OverdoseModsSettings.getProperty("AntiFeedDualbox", "true"));+ ANTIFEED_DISCONNECTED_AS_DUALBOX = Boolean.parseBoolean(OverdoseModsSettings.getProperty("AntiFeedDisconnectedAsDualbox", "true"));+ ANTIFEED_INTERVAL = 1000*Integer.parseInt(OverdoseModsSettings.getProperty("AntiFeedInterval", "120")); } catch (Exception e)@@ -2822,6 +2830,10 @@ else if (pName.equalsIgnoreCase("MultiBoxesPerPC")) MAX_PLAYERS_FROM_ONE_PC = Integer.parseInt(pValue);+ else if (pName.equalsIgnoreCase("AntiFeedEnable")) ANTIFEED_ENABLE = Boolean.parseBoolean(pValue);+ else if (pName.equalsIgnoreCase("AntiFeedDualbox")) ANTIFEED_DUALBOX = Boolean.parseBoolean(pValue);+ else if (pName.equalsIgnoreCase("AntiFeedDisconnectedAsDualbox")) ANTIFEED_DISCONNECTED_AS_DUALBOX = Boolean.parseBoolean(pValue);+ else if (pName.equalsIgnoreCase("AntiFeedInterval")) ANTIFEED_INTERVAL = 1000*Integer.parseInt(pValue); // PvP settings else if (pName.equalsIgnoreCase("MinKarma")) KARMA_MIN_KARMA = Integer.parseInt(pValue);Index: config/overdose_mods.properties===================================================================--- config/overdose_mods.properties (revision 173)+++ config/overdose_mods.properties (working copy)@@ -198,4 +198,27 @@ # MultiBox Protection - # ------------------------------------------------------------- # Multibox protection based on client tracert comparison -MultiBoxesPerPC = 2\ No newline at end of file+MultiBoxesPerPC = 2++# -------------------------------------------------------------+# AntiFeed -+# -------------------------------------------------------------+# This option will enable antifeed for pvp/pk/clanrep points.+# Default: False+AntiFeedEnable = False++# If set to True, kills from dualbox will not increase pvp/pk points+# and clan reputation will not be transferred.+# Default: True+AntiFeedDualbox = True++# If set to True, server will count disconnected (unable to determine ip address)+# as dualbox.+# Default: True+AntiFeedDisconnectedAsDualbox = True++# If character died faster than timeout - pvp/pk points for killer will not increase+# and clan reputation will not be transferred.+# Setting to 0 will disable this feature.+# Default: 120 seconds.+AntiFeedInterval = 120\ No newline at end of fileIndex: java/net/sf/l2j/gameserver/instancemanager/AntiFeedManager.java===================================================================--- java/net/sf/l2j/gameserver/instancemanager/AntiFeedManager.java (revision 0)+++ java/net/sf/l2j/gameserver/instancemanager/AntiFeedManager.java (revision 0)@@ -0,0 +1,104 @@+/*+ * This program is free software: you can redistribute it and/or modify it under+ * the terms of the GNU General Public License as published by the Free Software+ * Foundation, either version 3 of the License, or (at your option) any later+ * version.+ * + * This program is distributed in the hope that it will be useful, but WITHOUT+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more+ * details.+ * + * You should have received a copy of the GNU General Public License along with+ * this program. If not, see <http://www.gnu.org/licenses/>.+ */+package net.sf.l2j.gameserver.instancemanager;++import java.util.Map;++import javolution.util.FastMap;+import net.sf.l2j.Config;+import net.sf.l2j.gameserver.model.L2Character;+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;+import net.sf.l2j.gameserver.network.L2GameClient;++public class AntiFeedManager+{+ private Map<Integer,Long> _lastDeathTimes;++ public static final AntiFeedManager getInstance()+ {+ return SingletonHolder._instance;+ }++ private AntiFeedManager()+ {+ _lastDeathTimes = new FastMap<Integer,Long>().setShared(true);+ }++ /**+ * Set time of the last player's death to current+ * @param objectId Player's objectId+ */+ public final void setLastDeathTime(int objectId)+ {+ _lastDeathTimes.put(objectId, System.currentTimeMillis());+ }++ /**+ * Check if current kill should be counted as non-feeded.+ * @param attacker Attacker character+ * @param target Target character+ * @return True if kill is non-feeded.+ */+ public final boolean check(L2Character attacker, L2Character target)+ {+ if (!Config.ANTIFEED_ENABLE)+ return true;++ if (target == null)+ return false;++ final L2PcInstance targetPlayer = null;+ if (targetPlayer == null)+ return false;++ if (Config.ANTIFEED_INTERVAL > 0+ && _lastDeathTimes.containsKey(targetPlayer.getObjectId()))+ return (System.currentTimeMillis() - _lastDeathTimes.get(targetPlayer.getObjectId())) > Config.ANTIFEED_INTERVAL;++ if (Config.ANTIFEED_DUALBOX && attacker != null)+ {+ final L2PcInstance attackerPlayer = null;+ if (attackerPlayer == null)+ return false;++ final L2GameClient targetClient = targetPlayer.getClient();+ final L2GameClient attackerClient = attackerPlayer.getClient();+ if (targetClient == null+ || attackerClient == null+ || targetClient.isDetached()+ || attackerClient.isDetached())+ // unable to check ip address+ return !Config.ANTIFEED_DISCONNECTED_AS_DUALBOX;++ return !targetClient.getConnection().getInetAddress().equals(attackerClient.getConnection().getInetAddress());+ }++ return true;+ }++ /**+ * Clears all timestamps+ */+ public final void clear()+ {+ _lastDeathTimes.clear();+ }++ @SuppressWarnings("synthetic-access")+ private static class SingletonHolder+ {+ protected static final AntiFeedManager _instance = new AntiFeedManager();+ }+}\ No newline at end of file
Re: Antifeed to Interlude
Posted: Wed Jul 21, 2010 5:22 pm
by SeRk
so?anyone willing to help me?
Re: Antifeed to Interlude
Posted: Wed Jul 21, 2010 5:51 pm
by hope
it you check if all the patch patched, none of it missing
Re: Antifeed to Interlude
Posted: Wed Jul 21, 2010 5:52 pm
by SeRk
hope wrote:it you check if all the patch patched, none of it missing
what?sorry i dont understand
Re: Antifeed to Interlude
Posted: Wed Jul 21, 2010 10:17 pm
by hope
I mean, did you check after you applied the patch that all of it applied, no parts of it missing
Re: Antifeed to Interlude
Posted: Thu Jul 22, 2010 8:41 am
by SeRk
hope wrote:I mean, did you check after you applied the patch that all of it applied, no parts of it missing
yes i did