Jump to content
  • 0

Log the PvP Points & Anti-PvP Farming System


Question

Posted

Hello MxCs Again,

 

I searched over the forum but I couldn't found anything. What do I need is an anti-PvP Farm System which prevents the player from farming PvPs constantly between two players, in detail:

 

If someone kills somebody else for the first time he will earn a PvP Point, if he kills the same person again he won't earn any PvP Points, we can also add a time like 5 minutes delay after that he could earn a pvp point again.

 

Thanks in advance,

Static

 

Okay, as I see no-one can or wants to help me so I'll ask for something else...

Can someone tell me how can I log the PvP Kills from the players, just when a player kills someone this should be logged in a file in the logs folder with time and date.

 

Okay because the topic was edited many times here is the last request:

 

 

 

Anti-PvP Farming System:

 

When a player (ex PlayerA) kills another Player (ex PlayerB) for a first time, he will take a PVP Point if he tries to kill again the same Player (PlayerB) he won't take pvp point but he has to kill a different player (PlayerC) in order to get a PvP from the second player (PlayerB) again.

 

Simply:

If Static kills George for a first time he'll take a pvp point.

If Static kills George for a second time he wont take a pvp point.

If Static kills George for a first time and then kills John he will take the PVP from John but if he tries to kill John he won't take the PVP Point however if he kills George again he'll earn the pvp point.

 

Log PvP Points:

 

Some kind of code that will log the PvP Points of the players like

Time and Date Player1 Killed Player2.

Example:

[08 Mar 17:40:18] Static Killed George.

Recommended Posts

  • 0
Posted

I understood what u want.The only system I know is the one that prevents pvp farming from the same IP(bots)..if that isn't what are u looking for,u should ask someone who know java that could write a code for u:) example:Coyote,Intrepid,Setekh

  • 0
Posted

the pvp from same ip protection will be more useful ...

 

But if two players does not have the same IP and arrange in-game to farm PvPs from different places they could still do it, this way they won't be able to do so.

If someone can code this I would really appreciate it, if it's possible I will award him with +1 Karma for  his work.

  • 0
Posted

Open the net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java

See code (Made by Mentor):

 

/********** Source code *********/

 

  public void onKillUpdatePvPKarma(L2Character target)

  {

      if (target == null) return;

      if (!(target instanceof L2Playable)) return;

 

      L2PcInstance targetPlayer = target.getActingPlayer();

+    L2PcInstance targetp = (L2PcInstance)getTarget();

+    String ip = getClient().getConnection().getInetAddress().getHostAddress();

+    String ip2 = targetp.getClient().getConnection().getInetAddress().getHostAddress();

 

 

      if (targetPlayer == null) return;                                          // Target player is null

      if (targetPlayer == this) return;                                          // Target player is self

 

/********** Source code *********/

 

                  isInsideZone(ZONE_PVP) &&                //  Player is inside pvp zone and

                  targetPlayer.isInsideZone(ZONE_PVP)    //  Target player is inside pvp zone

            )

      )

      {

        if (target instanceof L2PcInstance)

          increasePvpKills();

+        _log.warning(getName() + "(IP: " + ip + ") hunted " + getTarget().getName() + "(IP: " + ip2 + "). (PvP)");

        return;

      }

      else

      // Target player doesn't have pvp flag set

      {

        // check about wars

        if (targetPlayer.getClan() != null && getClan() != null

              && getClan().isAtWarWith(targetPlayer.getClanId())

              && targetPlayer.getClan().isAtWarWith(getClanId())

              && targetPlayer.getPledgeType() != L2Clan.SUBUNIT_ACADEMY

              && getPledgeType() != L2Clan.SUBUNIT_ACADEMY)

        {

            // 'Both way war' -> 'PvP Kill'

            if (target instanceof L2PcInstance)

            increasePvpKills();

+          _log.warning(getName() + "(IP: " + ip + ") killed " + getTarget().getName() + "(IP: " + ip2 + "). (PvP)");

            return;

        }

 

            // 'No war' or 'One way war' -> 'Normal PK'

        if (targetPlayer.getKarma() > 0)                                        // Target player has karma

        {

            if ( Config.KARMA_AWARD_PK_KILL )

            {

              if (target instanceof L2PcInstance)

                  increasePvpKills();

+              _log.warning(getName() + "(IP: " + ip + ") hunted " + getTarget().getName() + "(IP: " + ip2 + "). (PvP)");

            }

        }

        else if (targetPlayer.getPvpFlag() == 0)                                                                    // Target player doesn't have karma

        {

                increasePkKillsAndKarma(targetPlayer.getLevel(), target instanceof L2PcInstance);

+          _log.warning(getName() + "(IP: " + ip + ") assassinated " + getTarget().getName() + "(IP: " + ip2 + "). (Pk)");

            //Unequip adventurer items

            if(getInventory().getPaperdollItemId(7) >= 7816 && getInventory().getPaperdollItemId(7) <= 7831)

 

/********** Source Kód *********/

  • 0
Posted

Hints are examples hence they are not patches, they were not made through eclipse (hence methods may not exist), like the name says, they are just to guide you.

 

Simply:

If Static kills George for a first time he'll take a pvp point.

If Static kills George for a second time he wont take a pvp point.

If Static kills George for a first time and then kills John he will take the PVP from John but if he tries to kill John he won't take the PVP Point however if he kills George again he'll earn the pvp point.

Hint:

private int _lastKilled = null;
public lala(L2PcInstance killer, int killedId)
{
if(_lastKilled == killedId)
return;
else 
{
_lastKilled = killedId;
increasePvPCount();
}
}

 

Log PvP Points:

 

Some kind of code that will log the PvP Points of the players like

Time and Date Player1 Killed Player2.

Example:

[08 Mar 17:40:18] Static Killed George.

 

Hint:

private int _lastKilled = null;
private final DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
private Date date = null;

public lala(L2PcInstance killer, L2PcInstance target)
{
if(_lastKilled == targetgetObjectId())
return;
else 
{
_lastKilled = killedId;
increasePvPCount();
write(killer.getName(), target.getName());
}
}

private static void write(String killer, String killed) throws IOException{

try{
   date = new Date();

   FileWriter fwriter = new FileWriter("killerLog.txt",true);
   BufferedWriter out = new BufferedWriter(fwriter);
   out.write("[PvP] (" + dateFormat.format(date) + ") :" killed + " killed " + killed);
   out.close();
   }catch (Exception e){
     System.err.println("Error: " + e.getMessage());
   }         


   }

  • 0
Posted

Now you're just pushing it.The hints are pretty easy and in fact, they're nearly the whole work that needs to be done.

Don't be lazy, spend a few hours tweaking with eclipse and you'll do it alone.

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...