Jump to content
  • 0

Same Ip


L2KingWorld

Question

6 answers to this question

Recommended Posts

  • 0


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 file

Index: 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

 

Link to comment
Share on other sites

  • 0

    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] Note: C:\workspace3\L2jFrozenInterlude\branches\Beta\gameserver\head-src\com\l2jfrozen\gameserver\managers\AntiFeedManager.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 1 warning

 

afto einai entaksi ???

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...