Welcome to MaxCheaters.com

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

  • 0

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


Share this post


Link to post
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

Share this post


Link to post
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/

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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 :(

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.