Jump to content
  • 0

Pk Circle


Tachi

Question

hello guys i have a problem ..i have a simple mod like when you flag get pvp circle blue,

 

but this is not a problem cuz this feature work fine .

 

i want to add and pk circle ,like when you make karma get pk circle red, but this is a problem cuz i don't find the line where i can add the code :

 

my pvp blue cricle code is this..

 

 

 

 

package net.sf.l2j.gameserver.model.actor.instance.L2Pcinstance;


public void updatePvPStatus()
{
if (EventManager.getInstance().isRegistered(this) && EventManager.getInstance().isRunning())
return;


if (isInsideZone(ZoneId.PVP))
return;


PvpFlagTaskManager.getInstance().add(this, System.currentTimeMillis() + Config.PVP_NORMAL_TIME);


+ if (getPvpFlag() == 0)
+  {
+          updatePvPFlag(1);
+           setTeam(1);
+          }
+ }
}


public void updatePvPStatus(L2Character target)
{
final L2PcInstance player = target.getActingPlayer();
if (player == null)
return;


if (EventManager.getInstance().isRegistered(this) && EventManager.getInstance().isRunning())
return;


if (isInDuel() && player.getDuelId() == getDuelId())
return;


if ((!isInsideZone(ZoneId.PVP) || !target.isInsideZone(ZoneId.PVP)) && player.getKarma() == 0)
{
PvpFlagTaskManager.getInstance().add(this, System.currentTimeMillis() + ((checkIfPvP(player)) ? Config.PVP_PVP_TIME : Config.PVP_NORMAL_TIME));


+ if (getPvpFlag() == 0)
+ {
+              updatePvPFlag(1);
+               setTeam(1);
+          }
+}
}

package net.sf.l2j.gameserver.taskmanager.pvpflagtaskmanager.java

		public void run()
		{
			if (!_pvpFlagTask.isEmpty())
			{
				Long current = System.currentTimeMillis();
				synchronized (this)
				{
					for (L2PcInstance actor : _pvpFlagTask.keySet())
					{
						+   if (current > _pvpFlagTask.get(actor))
						+  {
						+	actor.updatePvPFlag(0);
						+	actor.setTeam(0);
						+	_pvpFlagTask.remove(actor);
						+    }

i need to know where i can add the code for the pk cirlce


Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Under setKarma , setPkKills + 1 ? That's so obvious

        // Otherwise, killer is considered as a PKer.
        else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
        {
            // PK Points are increased only if you kill a player.
            if (target instanceof L2PcInstance)
                setPkKills(getPkKills() + 1);
            
            // Calculate new karma.
            setKarma(getKarma() + Formulas.calculateKarmaGain(getPkKills(), target instanceof L2Summon));
            
            // Send UserInfo packet to attacker with its Karma and PK Counter
            sendPacket(new UserInfo(this));
        }

Also, you have to reset it <setTeam(0)> when you lose karma, under this method.

public void setKarma(int karma)
Edited by SweeTs
Link to comment
Share on other sites

  • 0

 

Under setKarma , setPkKills + 1 ? That's so obvious

        // Otherwise, killer is considered as a PKer.
        else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
        {
            // PK Points are increased only if you kill a player.
            if (target instanceof L2PcInstance)
                setPkKills(getPkKills() + 1);
            
            // Calculate new karma.
            setKarma(getKarma() + Formulas.calculateKarmaGain(getPkKills(), target instanceof L2Summon));
            
            // Send UserInfo packet to attacker with its Karma and PK Counter
            sendPacket(new UserInfo(this));
        }

Also, you have to reset it <setTeam(0)> when you lose karma, under this method.

public void setKarma(int karma)

 

 

 

don't work ..cuz i try this line :)

 

http://postimg.org/image/6zdh6awql/

Link to comment
Share on other sites

  • 0

It's working fine, you simply failed to add properly the code. Also red circle is 2 ;)

i set 2 not 1 i know  the code  for red :)

		// Otherwise, killer is considered as a PKer.
		else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)

		{
			// PK Points are increased only if you kill a player.
			if (target instanceof L2PcInstance)
				setPkKills(getPkKills() + 1);
			if (getPvpFlag() == 0)
			{
		            updatePvPFlag(2);
		            setTeam(2);
		      }


like this ?

	public void setKarma(int karma)
	{
		setTeam(0);
		if (karma < 0)
			karma = 0;
		
		if (_karma > 0 && karma == 0)
		{
			sendPacket(new UserInfo(this));
			broadcastRelationsChanges();
		}
Edited by Tachi
Link to comment
Share on other sites

  • 0

so i add another line here :D

 

l2pcinstance

		
		// Otherwise, killer is considered as a PKer.
		else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
			{
			if (getPvpFlag() == 0)
		            updatePvPFlag(2);
		            setTeam(2);
		      }
		{
			// PK Points are increased only if you kill a player.
			if (target instanceof L2PcInstance)
				setPkKills(getPkKills() + 1);

and this work 

 

http://postimg.org/image/l6yjars3x/

 

 

but after  5-10 second's cirlce going off without leave karma and do nothing

 

http://postimg.org/image/9p6232orn/

 

can you suggest :D?

Link to comment
Share on other sites

  • 0

well the circle as i understand work with flag so if you pk a player you get red name but in background flag work normal so flag after some seconds leave so circle too so in order to keep circle until karma get 0 you must set PvP to 1 (never leave flag) until player clean karma

Link to comment
Share on other sites

  • 0

2x no.

 

 

Your check MISS LOGIC. Before you are pk, you are flagged already, so how the heck you can be not flagged aka pvp flag == 0 ... ?  :rage:

THINK.

        // Otherwise, killer is considered as a PKer.
        else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
        {
            // PK Points are increased only if you kill a player.
            if (target instanceof L2PcInstance)
                setPkKills(getPkKills() + 1);
            
            // Calculate new karma.
            setKarma(getKarma() + Formulas.calculateKarmaGain(getPkKills(), target instanceof L2Summon));
            setTeam(2);
            
            // Send UserInfo packet to attacker with its Karma and PK Counter
            sendPacket(new UserInfo(this));
        }
        if (_karma > 0 && karma == 0)
        {
            sendPacket(new UserInfo(this));
            broadcastRelationsChanges();
            setTeam(0);
        }
Edited by SweeTs
Link to comment
Share on other sites

  • 0

 

2x no.

 

 

Your check MISS LOGIC. Before you are pk, you are flagged already, so how the heck you can be not flagged aka pvp flag == 0 ... ?  :rage:

THINK.

        // Otherwise, killer is considered as a PKer.
        else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
        {
            // PK Points are increased only if you kill a player.
            if (target instanceof L2PcInstance)
                setPkKills(getPkKills() + 1);
            
            // Calculate new karma.
            setKarma(getKarma() + Formulas.calculateKarmaGain(getPkKills(), target instanceof L2Summon));
            setTeam(2);
            
            // Send UserInfo packet to attacker with its Karma and PK Counter
            sendPacket(new UserInfo(this));
        }
        if (_karma > 0 && karma == 0)
        {
            sendPacket(new UserInfo(this));
            broadcastRelationsChanges();
            setTeam(0);
        }

so i try  this and  is same problem, i get pk ,i get cirlce,after  chracter  close from combat mode cirlce disappear :(

Link to comment
Share on other sites

  • 0

No. You have all info you need. I'm not gonna share full ready to apply code. You only have to setTeam(1) under pvp count and setTeam(2) under pk count. And setTeam(0) in pvptask and setKarma.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...