Jump to content
  • 0

[Help] Pk in PvP Mod ?


Bobi
 Share

Question

10 answers to this question

Recommended Posts

  • 0

when you say pvp mod you mean pvp stance or some pvp event?

 

anyway this is the important code section of l2PcInstance:

 

public void onKillUpdatePvPKarma(L2Character target)
{
	if (target == null) return;
	if (!(target instanceof L2Playable)) return;

	L2PcInstance targetPlayer = target.getActingPlayer();

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

	if (isCursedWeaponEquipped())
	{
		CursedWeaponsManager.getInstance().increaseKills(_cursedWeaponEquippedId);
		// Custom message for time left
		// CursedWeapon cw = CursedWeaponsManager.getInstance().getCursedWeapon(_cursedWeaponEquipedId);
		// SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.THERE_IS_S1_HOUR_AND_S2_MINUTE_LEFT_OF_THE_FIXED_USAGE_TIME);
		// int timeLeftInHours = (int)(((cw.getTimeLeft()/60000)/60));
		// msg.addItemName(_cursedWeaponEquipedId);
		// msg.addNumber(timeLeftInHours);
		// sendPacket(msg);
		return;
	}

	// If in duel and you kill (only can kill l2summon), do nothing
	if (isInDuel() && targetPlayer.isInDuel()) return;

	// If in Arena, do nothing
	if (isInsideZone(ZONE_PVP) || targetPlayer.isInsideZone(ZONE_PVP))
		return;

	// Check if it's pvp
	if (
			(
					checkIfPvP(target) &&            //   Can pvp and
					targetPlayer.getPvpFlag() != 0   //   Target player has pvp flag set
			) ||                                     // or
			(
					isInsideZone(ZONE_PVP) &&         		 //   Player is inside pvp zone and
					targetPlayer.isInsideZone(ZONE_PVP) 	 //   Target player is inside pvp zone
			)
	)
		increasePvpKills(target);
	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'
			increasePvpKills(target);
			return;
		}

		// 'No war' or 'One way war' -> 'Normal PK'
		if (targetPlayer.getKarma() > 0)                                        // Target player has karma
		{
			if (Config.KARMA_AWARD_PK_KILL)
				increasePvpKills(target);
		}
		else if (targetPlayer.getPvpFlag() == 0)                                                                    // Target player doesn't have karma
		{
			increasePkKillsAndKarma(target);
			//Unequip adventurer items
			checkItemRestriction();
		}
	}

if your problem is with pvp flag, then check that your code is same than this (or maybe is some pvp flag update problem)

 

else if its the event, just add some check like duel's one

 

else i didnt get the question :s

Link to comment
Share on other sites

  • 0

when you say pvp mod you mean pvp stance or some pvp event?

 

anyway this is the important code section of l2PcInstance:

 

public void onKillUpdatePvPKarma(L2Character target)
{
	if (target == null) return;
	if (!(target instanceof L2Playable)) return;

	L2PcInstance targetPlayer = target.getActingPlayer();

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

	if (isCursedWeaponEquipped())
	{
		CursedWeaponsManager.getInstance().increaseKills(_cursedWeaponEquippedId);
		// Custom message for time left
		// CursedWeapon cw = CursedWeaponsManager.getInstance().getCursedWeapon(_cursedWeaponEquipedId);
		// SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.THERE_IS_S1_HOUR_AND_S2_MINUTE_LEFT_OF_THE_FIXED_USAGE_TIME);
		// int timeLeftInHours = (int)(((cw.getTimeLeft()/60000)/60));
		// msg.addItemName(_cursedWeaponEquipedId);
		// msg.addNumber(timeLeftInHours);
		// sendPacket(msg);
		return;
	}

	// If in duel and you kill (only can kill l2summon), do nothing
	if (isInDuel() && targetPlayer.isInDuel()) return;

	// If in Arena, do nothing
	if (isInsideZone(ZONE_PVP) || targetPlayer.isInsideZone(ZONE_PVP))
		return;

	// Check if it's pvp
	if (
			(
					checkIfPvP(target) &&            //   Can pvp and
					targetPlayer.getPvpFlag() != 0   //   Target player has pvp flag set
			) ||                                     // or
			(
					isInsideZone(ZONE_PVP) &&         		 //   Player is inside pvp zone and
					targetPlayer.isInsideZone(ZONE_PVP) 	 //   Target player is inside pvp zone
			)
	)
		increasePvpKills(target);
	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'
			increasePvpKills(target);
			return;
		}

		// 'No war' or 'One way war' -> 'Normal PK'
		if (targetPlayer.getKarma() > 0)                                        // Target player has karma
		{
			if (Config.KARMA_AWARD_PK_KILL)
				increasePvpKills(target);
		}
		else if (targetPlayer.getPvpFlag() == 0)                                                                    // Target player doesn't have karma
		{
			increasePkKillsAndKarma(target);
			//Unequip adventurer items
			checkItemRestriction();
		}
	}

if your problem is with pvp flag, then check that your code is same than this (or maybe is some pvp flag update problem)

 

else if its the event, just add some check like duel's one

 

else i didnt get the question :s

i mean when players make normal pvp in normal zone when they are all flag and some time they become PK

 

did u see something wrong here ?

 

public void onKillUpdatePvPKarma(L2Character target)
{
	if (target == null) return;
	if (!(target instanceof L2PlayableInstance)) return;

	if (_inEventCTF || _inEventTvT)
		return;
	if (_inEventFOS) return;

	if (_inEventVIP)
	{
		increasePvpKills(target);
		return;
	}

	L2PcInstance targetPlayer = null;
	if (target instanceof L2PcInstance)
		targetPlayer = (L2PcInstance)target;
	else if (target instanceof L2Summon)
		targetPlayer = ((L2Summon)target).getOwner();

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

	if (isCursedWeaponEquiped())
	{
		CursedWeaponsManager.getInstance().increaseKills(_cursedWeaponEquipedId);
		return;
	}

	// If in duel and you kill (only can kill l2summon), do nothing
	if (isInDuel() && targetPlayer.isInDuel()) return;
        
	if (Config.L2F_ENABLE_EVENT_ENGINE==true)
        {
	if (EventManager.getInstance().isRegistered(this) && EventManager.getInstance().isRegistered(targetPlayer))
					return;
        }
        // If in Arena, do nothing
	if (isInsideZone(ZONE_PVP) || targetPlayer.isInsideZone(ZONE_PVP))
		return;

        // Check if it's pvp
	if ((checkIfPvP(target) && targetPlayer.getPvpFlag() != 0 ) || ( isInsideZone(ZONE_PVP) && targetPlayer.isInsideZone(ZONE_PVP)))
	{
            increasePvpKills(target);  
	}
	else
	{
            // check about wars
            if (targetPlayer.getClan() != null && getClan() != null)
            {
                if (getClan().isAtWarWith(targetPlayer.getClanId()))
                {
                    if (targetPlayer.getClan().isAtWarWith(getClanId()))
                    {
                        // 'Both way war' -> 'PvP Kill'
                    	increasePvpKills(target);
                        return;
                    }
                }
            }

            // 'No war' or 'One way war' -> 'Normal PK'
		if (targetPlayer.getKarma() > 0)                                        // Target player has karma
		{
			if ( Config.KARMA_AWARD_PK_KILL )
			{
				increasePvpKills(target);
			}
		}
		else if (targetPlayer.getPvpFlag() == 0)                                                                    // Target player doesn't have karma
		{
			increasePkKillsAndKarma(targetPlayer.getLevel(),target);
		}
	}
}

Link to comment
Share on other sites

  • 0

can you explain better your problem?

when someone pk or pvp someone their status doesn't get updated?

 

when few players make pvp in any zone some time when u kill flag players u are become PK

 

so u kill flaed player and u are PK 

 

not every time but many time that happen

Link to comment
Share on other sites

  • 0

seems your updatePkStatus ( or something like this ) is wrong or idea my idea?

i didnt see something wrong with can make this bug

because i ask if someone was have same problem or can give any idea

where can be problem or how to detect how that happen or something else

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

 Share



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock