Jump to content

Question

Posted

Hello i have a problem with this code i get no errors in eclipse but in game it doesnt work..

to Player.java

if (getParty() != null)
		{
			for (Player p : getParty().getMembers())
			{
				if (Config.Synergy_Class.contains(p.getClassId().getId()) && p.isInCombat() && (Rnd.get(100) <= 90))
				{
					p.sendMessage("You have earned a pvp by supporting " + target.getName());
					p.getPvpKills();
				}
			}
		}


and the config
  
  public static List<Integer> Synergy_Class = new ArrayList<>();


  	String Synergy_Class = customs.getProperty("ClassesSupp", "97");
		String[] atdc_splitted = Synergy_Class.split(",");
		for (String s : atdc_splitted)
		{
			Synergy_Class.add(Integer.valueOf(s));
		}

Recommended Posts

  • 1
Posted (edited)
1 hour ago, melron said:

@Evie Frye the guy didnt ask for new assist system but asked for a fix in this one (even if it is not good) so i answered to this one. Feel free to sell your services to him :D kisses 

 

Sell? Bitches, you're all my fans !

Index: java/com/l2evie/gameserver/model/Assist.java
===================================================================
--- java/com/l2evie/gameserver/model/Assist.java	(revision 0)
+++ java/com/l2evie/gameserver/model/Assist.java	(revision 0)
@@ -0,0 +1,36 @@
+package com.l2evie.gameserver.model;
+
+import com.l2evie.gameserver.model.actor.instance.L2PcInstance;
+
+public class Assist
+{
+	private final L2PcInstance _owner;
+	private int _totalHeal = 0;
+	private long _lastHeal = 0;
+	
+	public Assist(final L2PcInstance player)
+	{
+		_owner = player;
+	}
+	
+	public L2PcInstance getPlayer()
+	{
+		return _owner;
+	}
+	
+	public int getTotalHeal()
+	{
+		return _totalHeal;
+	}
+	
+	public long lastHeal()
+	{
+		return _lastHeal;
+	}
+	
+	public void addHealPoints(int points)
+	{
+		_lastHeal = System.currentTimeMillis();
+		_totalHeal =+ points;
+	}
+}
Index: java/com/l2evie/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2evie/gameserver/model/actor/instance/L2PcInstance.java	(revision 2)
+++ java/com/l2evie/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -98,6 +98,7 @@
 import com.l2evie.gameserver.instancemanager.TerritoryWarManager;
 import com.l2evie.gameserver.instancemanager.TownManager;
+import com.l2evie.gameserver.model.Assist;
 import com.l2evie.gameserver.model.BlockList;
 import com.l2evie.gameserver.model.CharEffectList;
 import com.l2evie.gameserver.model.CursedWeapon;
@@ -6108,9 +6109,24 @@

 		setPvpKills(getPvpKills() + 1);
+			
+		for (Assist assist : getAllAssist())
+		{
+			if (getParty() == null || assist.getPlayer() == null || assist.lastHeal() + (15 * 1000) <= System.currentTimeMillis())
+			{
+				removeAssist(assist);
+			}
+			else if (getParty().getPartyMembers().contains(assist.getPlayer()) && Util.calculateDistance(this, assist.getPlayer(), false) <= 1450)
+			{ 
+				assist.addHealPoints(0);
+				assist.getPlayer().setPvpKills(assist.getPlayer().getPvpKills() + 1);
+				assist.getPlayer().sendMessage("You received 1 pvp kill for assisting player " + getName());
+			}
+		}
+			
  	
 	public void waitSecs(final int i)
@@ -16559,4 +16575,21 @@
 	{
 		return _unlockable;
 	}
+	
+	private final HashMap<Integer, Assist> _assist = new HashMap<>();
+	
+	public Assist getAssist(int healerId)
+	{
+		return _assist.get(healerId) !=null ? _assist.get(healerId) : _assist.put(healerId, new Assist(L2World.getInstance().getPlayer(healerId)));
+	}
+	
+	public void removeAssist(final Assist assist)
+	{
+		_assist.remove(assist);
+	}
+	
+	public Collection<Assist> getAllAssist()
+	{
+		return _assist.values();
+	}
 }
\ No newline at end of file

Also in Heal.java or i dont know what other files exist. 

 

if (activeChar instanceof L2PcInstance && target instanceof L2PcInstance)
{
	final L2Party party = ((L2PcInstance) activeChar).getParty();
			
	if (party !=null && party.getPartyMembers().contains(((L2PcInstance) target)))
	{
		if (((L2PcInstance) activeChar).isInCombat() && !((L2PcInstance) activeChar).getAttackByList().isEmpty() && !((L2PcInstance) activeChar).getAttackByList().contains(target))
		{
			((L2PcInstance) target).getAssist(activeChar.getObjectId()).addHealPoints((int) hp);
		}
	}
}

 

Ps its not tested or so. But just the idea. 

Edited by Evie Frye
  • 0
Posted

what this one supposed to do? Increase pvp in supporter class? if yes
replace
 

p.getPvpKills();

with this

p.setPvpKills(p.getPvpKills() +1);

 

  • 0
Posted
1 hour ago, ThelwHelpRePaidia said:

i've tried it but it doesnt work and like that  xD

then the location of your code is wrong or you do not meet the conditions. add debugs for each boolean for all these 'if' and check out whats going on

  • 0
Posted

How you expect people to help you? You don't provide any info just some fail coding. 

Where did you place the code? What are your configurations? Does the message appear ? Possibly you've added the code in wrong place

or you ignored the config and you haven't add your class ID in their. Or even worst the config is wrong and u just didn't see the error

because config errors appear upon server load which is barely visible. 

  • 0
Posted
3 minutes ago, Evie Frye said:

How you expect people to help you? You don't provide any info just some fail coding. 

Where did you place the code? What are your configurations? Does the message appear ? Possibly you've added the code in wrong place

or you ignored the config and you haven't add your class ID in their. Or even worst the config is wrong and u just didn't see the error

because config errors appear upon server load which is barely visible. 

holy shit

  • 0
Posted (edited)

1st im getting 0 errors on eclipse and on gameserver

2nd i dont get the message

3rd i placed the code here

public void onKillUpdatePvPKarma(Playable target)
	{
		if (target == null)
			return;
		
		final Player targetPlayer = target.getActingPlayer();
		if (targetPlayer == null || targetPlayer == this)
			return;
		
		// Don't rank up the CW if it was a summon.
		if (isCursedWeaponEquipped() && target instanceof Player)
		{
			CursedWeaponsManager.getInstance().increaseKills(_cursedWeaponEquippedId);
			return;
		}
		
		// If in duel and you kill (only can kill l2summon), do nothing
		if (isInDuel() && targetPlayer.isInDuel())
			return;
		
		if (EventManager.getInstance().isRunning() && EventManager.getInstance().isRegistered(this) && EventManager.getInstance().isRegistered(targetPlayer))
			return;
		
		if (getParty() != null)
		{
			for (Player player : getParty().getMembers())
			{
				if (Config.Synergy_Class.contains(player.getClassId().getId()) && player.isInCombat() && (Rnd.get(100) <= 90))
				{
					player.sendMessage("You have earned a pvp by supporting " + target.getName());
					player.setPvpKills(player.getPvpKills() + 1);
				}
			}
		}
		// If in pvp zone, do nothing.
		if (isInsideZone(ZoneId.PVP) && targetPlayer.isInsideZone(ZoneId.PVP))
		{
			// Until the zone was a siege zone. Check also if victim was a player. Randomers aren't counted.
			if (target instanceof Player && getSiegeState() > 0 && targetPlayer.getSiegeState() > 0 && getSiegeState() != targetPlayer.getSiegeState())
			{
				// Now check clan relations.
				final Clan killerClan = getClan();
				if (killerClan != null)
					killerClan.setSiegeKills(killerClan.getSiegeKills() + 1);
				
				final Clan targetClan = targetPlayer.getClan();
				if (targetClan != null)
					targetClan.setSiegeDeaths(targetClan.getSiegeDeaths() + 1);
			}
			return;
		}

 

Edited by ThelwHelpRePaidia
  • 0
Posted

Try add the code after this: 

  // Check if it's pvp (cases : regular, wars, victim is PKer)
  if (checkIfPvP(target) || (targetPlayer.getClan() != null && getClan() != null && getClan().isAtWarWith(targetPlayer.getClanId()) && targetPlayer.getClan().isAtWarWith(getClanId()) && targetPlayer.getPledgeType() != Clan.SUBUNIT_ACADEMY && getPledgeType() != Clan.SUBUNIT_ACADEMY) || (targetPlayer.getKarma() > 0 && Config.KARMA_AWARD_PK_KILL))
  {
   if (target instanceof Player)
   {

        //here

 

  • 0
Posted (edited)

How many times did you test it? I mean how many kills did you got?

 

As you didnt understood my last suggestion i will explain you:

 

You have to meet 4 conditions in order the party member to get pvp point too.

 

  • Be in party
  • Config got the user class id
  • user is in combat
  • And 90% chance.

 

Are you sure for all these conditions ?

 

Why you do not simply add debugs to check it?

 

if (getParty() != null)
{
	for (Player player : getParty().getMembers())
	{
		final int rnd = Rnd.get(100);
		System.out.println("Checking for " + player.getName() + " Conditions...");
		System.out.println(Config.Synergy_Class.contains(player.getClassId().getId()) ? "Config missing player's class ID!" : " Config got player's ID!");
		System.out.println(player.isInCombat() ? " Player is in combat!" : " Player is not in combat!");
		System.out.println(rnd <= 90 ? " Chance is OK!" : " Chance is not OK! ( " + rnd + "");
		System.out.println(Config.Synergy_Class.contains(player.getClassId().getId()) && player.isInCombat() && (rnd <= 90) ? " Reward can be given!" : " Cannot give the reward!");
		if (Config.Synergy_Class.contains(player.getClassId().getId()) && player.isInCombat() && (rnd <= 90))
		{
			player.sendMessage("You have earned a pvp by supporting " + target.getName());
			player.setPvpKills(player.getPvpKills() + 1);
		}
	}
}
else
	System.out.println("No party found.");

 

Edited by melron
  • 0
Posted (edited)

@melron it's working like this but im getting something that it seems weird i dont get +1 pvp i get the pvps that my party mate has if he has 551 and me 0 if he gets pvp i will go 552

 

Party party = getParty();
				
				if (party != null)
				{
					for (Player partymate : party.getMembers())
					{
						if (partymate == null)
							continue;
						
						if (partymate.getClassId().getId() == 97 && partymate.isInCombat() && partymate.getPvpFlag() > 0)
						{
							if (partymate.isInsideRadius(this, 1100, false, false))
							{
								if (Rnd.nextInt(100) < 100)
								{
									partymate.setPvpKills(partymate.getPvpKills() + 1);
									break;
								}
							}
						}
					}
				}
				
					
					// Add PvP point to attacker.
					setPvpKills(getPvpKills() + 1);

 

Edited by ThelwHelpRePaidia
  • 0
Posted
				for(Player member : getParty().getMembers())
				{
					if(member != null)
					{
						if(member.getClassId().getId() == 97 && member.isInCombat() && member.isInsideRadius(this, 1100, false, false) && Rnd.nextInt(100) < 100)
						{
							setPvpKills(getPvpKills() + 1);
						}
					}
				}

i dont know if help this

  • 0
Posted (edited)
3 hours ago, ThelwHelpRePaidia said:

@melron it's working like this but im getting something that it seems weird i dont get +1 pvp i get the pvps that my party mate has if he has 551 and me 0 if he gets pvp i will go 552

 

 

 

  • Check the method setPvpKills and getPvpKills maybe you forgot to delete some custom things inside
  • Add a check for same player like 
if (partymate == this)
     continue;
  • Remove break, you dont need this

 

about the pvp value issue, probably when you compiled your code was like this

 

if (Rnd.nextInt(100) < 100)
{
	partymate.setPvpKills(getPvpKills() + 1);
	break;
}

 

Edited by melron
  • 0
Posted (edited)

Holy shit with these answers.

 

I imagine Melron and Tazerman in a group of superheroes fighting against stackoverflow bad guys! This would be more epic than Avengers which is coming in 2 months. Speaking of assist. You must make it a bit more "comblex" in order to work properly. Example each player must have a holder of the healerId (the objectId of person who healed it) & the heal ammount. Upon kill it must check the healAmmount if > than Rnd(X) and if the objectId (healer) is still in range to give him +1 pvp. 

so basically a

private final HashMap<Integer, Long> _healerData = new HashMap<>():
  
public HashMap<Integer, Long> getHealerData()
{
  return _healerData;
}
  
public void addHeal(int objectId, long heal)
{
 	if (_healerData.containsKey(objectId))
  	{
   		_healerData.put(objectId, _healerData.get(objectId) + heal);
  	}
  	else
  	{
  		_healerData.put(objectId, heal);
  	}
}

at Heal.java do something

if (target instanceof L2PcInstance && target.getParty() !=null && target.getParty().containMember(activeChar)
{
 	((L2PcInstance) target).addHeal(activeChar.getObjectId(), healAmmount);
}

and in increasePvPKills() method reset the data for > X ammounts of heal and give reward.

 

All these.. Rnd and Rnd its amateur and useless. If you want to make a assist system at least make it properly. Consider the code i also wrote is fail by default cause mostly i didn't even sit to think about it + i didn't open intellij but just to give you the idea of how not properly working is the code you post.

Edited by Evie Frye
  • 0
Posted (edited)

@Evie Frye the guy didnt ask for new assist system but asked for a fix in this one (even if it is not good) so i answered to this one. Feel free to sell your services to him :D kisses 

Edited by melron

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.



  • Posts

    • hello everyone! I am wanting to save the files (Ini. - Data - ) of the EP5 Client: Salvation... But they generate the error "corrupt files"... I tried several versions of L2FileEditor without good results. I need help! Thank you!
    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
    • small update: dc robe set sold   wts adena 1kk = 1.5$ 
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/hood-services https://campsite.bio/utchihaamkt
  • Topics

×
×
  • Create New...