Jump to content
  • 0

Anti Feed Manager Bug


Question

Posted (edited)

I add this code on my config:

 

# ================================================================
#                        Anti feed protection
# ================================================================
 
# This option will enable antifeed for pvp/pk/clanrep points
AntiFeedEnable = True
 
# If set to True, kills from dualbox will not increase pvp/pk points
# and clan reputation will not be transferred
AntiFeedDualbox = False
 
# If set to True, server will count disconnected (unable to determine ip address)
# as dualbox
AntiFeedDisconnectedAsDualbox = False
 
# If character died faster than timeout - pvp/pk points for killer will not increase
# and clan reputation will not be transferred
AntiFeedInterval = 120
 
In dual box i try and pvp not work so i don't give pvp point but at pk is the bug when i make pk in dual box i take pk point.
So where is the problem?
Please help me.
Edited by IoNuTzU01

9 answers to this question

Recommended Posts

  • 0
Posted

Please, tell me that you only add that text to the config and you expected it to work just like that, please, tell me you did that so I can laugh a lot.

  • 0
Posted (edited)

Please, tell me that you only add that text to the config and you expected it to work just like that, please, tell me you did that so I can laugh a lot.

I don't add only this text in my config i add completly code and work perfect... but only pk have bug i say not and pvp

Edited by IoNuTzU01
  • 0
Posted

Give us your code...We can fix it...Configs are useless :P

Ok i will give now :

 

public class AntiFeedManager
{
public static final int GAME_ID = 0;
 
final Map<Integer,Long> _lastDeathTimes;
 
private final TIntObjectHashMap<Map<Integer, Connections>> _eventIPs;
 
public static final AntiFeedManager getInstance()
{
return SingletonHolder._instance;
}
 
protected AntiFeedManager()
{
_lastDeathTimes = new ConcurrentHashMap<>();
_eventIPs = new TIntObjectHashMap<>();
}
 
/**
* 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());
ThreadPoolManager.getInstance().scheduleGeneral(new DeleteDeathTime(objectId), 120000);
}
 
private class DeleteDeathTime implements Runnable
{
int id;
public DeleteDeathTime(int objectId)
{
id = objectId;
}
 
@Override
public void run()
{
_lastDeathTimes.remove(id);
}
}
 
/**
* 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 = target.getActingPlayer();
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 = attacker.getActingPlayer();
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();
}
 
/**
* Register new event for dualbox check.
* Should be called only once.
* @param eventId
*/
public final void registerEvent(int eventId)
{
if (!_eventIPs.containsKey(eventId))
_eventIPs.put(eventId, new HashMap<Integer, Connections>());
}
 
/**
* Decreasing number of active connection from player's IP address
* @param eventId
* @param player
* @return true if success and false if any problem detected.
*/
public final boolean removePlayer(int eventId, L2PcInstance player)
{
final L2GameClient client = player.getClient();
if (client == null)
return false; // unable to determine IP address
 
final Map<Integer, Connections> event = _eventIPs.get(eventId);
if (event == null)
return false; // no such event registered
 
final Integer addrHash = Integer.valueOf(client.getConnection().getInetAddress().hashCode());
Connections conns = event.get(addrHash);
if (conns == null)
return false; // address not registered
 
synchronized (event)
{
if (conns.testAndDecrement())
event.remove(addrHash);
}
 
return true;
}
 
/**
* Remove player connection IP address from all registered events lists.
* @param client
*/
public final void onDisconnect(L2GameClient client)
{
if (client == null)
return;
 
final Integer addrHash = Integer.valueOf(client.getConnection().getInetAddress().hashCode());
_eventIPs.forEachValue(new DisconnectProcedure(addrHash));
}
 
/**
* Clear all entries for this eventId.
* @param eventId
*/
public final void clear(int eventId)
{
final Map<Integer, Connections> event = _eventIPs.get(eventId);
if (event != null)
event.clear();
}
 
protected static final class Connections
{
private int _num = 0;
 
/**
* and false if maximum number is reached.
* @param max 
* @return true if successfully incremented number of connections
*/
public final synchronized boolean testAndIncrement(int max)
{
if (_num < max)
{
_num++;
return true;
}
return false;
}
 
/**
* @return true if all connections are removed
*/
public final synchronized boolean testAndDecrement()
{
if (_num > 0)
_num--;
 
return _num == 0;
}
}
 
private static final class DisconnectProcedure implements TObjectProcedure<Map<Integer, Connections>>
{
private final Integer _addrHash;
 
public DisconnectProcedure(Integer addrHash)
{
_addrHash = addrHash;
}
  • 0
Posted (edited)

Most likely it's actual version(?) of l2jserver, if it's outdated, use the recent one.

 

You should post L2PcInstance changes you did. Gods know what pack you are using and pvp/pk could be separated for 2 methods, so you must add the check in both places.

 

I guess, that's your case.

Edited by SweeTs
  • 0
Posted

Next time post the part which I ask, not the whole file.. :okey: As I said, the check if only made for the pvp case, so DO THE SAME for pk check.

  • 0
Posted (edited)

Change line L2PcInstance 4314 from

 if (target instanceof L2PcInstance)

to:

  if (target instanceof L2PcInstance && AntiFeedManager.getInstance().check(this, target))

I think it will work...

Edited by Solomun
  • 0
Posted

Change line L2PcInstance 4314 from

 if (target instanceof L2PcInstance)

to:

  if (target instanceof L2PcInstance && AntiFeedManager.getInstance().check(this, target))

I think it will work...

I try and is same..

Pvp no bug,no reward pvp point.

Pk bug in dual box work reward pk point.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...