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

    • Hi, for l2jfrozen...   I want Bless Enchat to have a limit.   Example: 7+ to +15 with Bless Enchat.   That for +16, it doesn't allow use.
    • @FixerRay the problem is that my dev will not be available for a while so if you could help that will be great 
    • Tired of watching your Instagram account grow at a snail’s pace? Feeling frustrated when your quality content doesn’t reach the audience it deserves? Let me share a secret that changed the game for me and many others: using a reliable SMM panel Instagram service like GoUpSocial. Whether you're building a brand, promoting a product, or growing a personal page, GoUpSocial offers the best and cheapest SMM panel for Instagram followers, likes, and views — with real results, fast delivery, and budget-friendly pricing. ✅ What Is an SMM Panel Instagram and Why Should You Care? An Instagram SMM panel is a specialized marketing tool that helps you grow your account faster by automating likes, followers, views, and even verification services. But not all SMM panels are created equal. GoUpSocial stands out because it offers: Safe and real SMM followers Instagram services High-retention SMM panel for Instagram views Instant Instagram likes SMM panel to boost engagement Smart Instagram comment like SMM panel to highlight key messages Trusted SMM panel Instagram blue tick strategies to increase verification chances All of this is delivered through an intuitive, user-friendly platform with 24/7 customer support. 📈 Instagram Followers Increase SMM Panel – Grow with Confidence If you’re looking for meaningful growth, the Instagram followers increase SMM panel is your go-to solution. GoUpSocial provides real followers, delivered gradually to keep your profile looking natural and compliant with Instagram’s algorithm. Whether you’re launching a business page or trying to build a fan base as a creator, more followers = more trust and more visibility. ❤️ Drive More Engagement with the Instagram Likes SMM Panel Instagram rewards popular posts with more visibility. That means more likes lead to more exposure. With the Instagram likes SMM panel, you can boost your post’s visibility instantly, increasing your chance of hitting the Explore page or going viral. If you're managing brand mentions or public feedback, the Instagram comment like SMM panel is perfect for pushing important comments to the top — ideal for testimonials, FAQs, or influencer interactions. 🎥 Don’t Miss Out on Views – Try the SMM Panel for Instagram Views Instagram is prioritizing video content more than ever. Whether it’s Reels, Stories, or feed videos, performance matters — and GoUpSocial’s SMM panel for Instagram views ensures you get noticed. Combined with the Instagram likes SMM panel, this powerful duo can significantly increase your profile’s reach and influence. Don’t just post content — get it seen. 🔵 Boost Verification Potential with SMM Panel Instagram Blue Tick Getting verified on Instagram isn’t easy — but it’s also not impossible. Instagram looks at follower count, engagement, and public presence. That’s where GoUpSocial’s SMM panel Instagram blue tick service can give you the edge. By growing your followers and interaction rates authentically, you increase your chances of being verified. It’s a smart, strategic move for influencers, entrepreneurs, and anyone seeking social credibility. ⚙️ Easy SMM Panel Instagram – Simplicity Meets Power Forget clunky dashboards or complicated processes. GoUpSocial provides an easy SMM panel Instagram interface that lets you: Place orders quickly Monitor real-time progress Manage multiple services effortlessly Choose from flexible packages Pay securely and safely Even if you're new to digital marketing, you’ll feel confident using this system. 💸 Cheapest SMM Panel for Instagram Followers, Likes, and Views Let’s talk about pricing — GoUpSocial is hands-down the cheapest SMM panel for Instagram followers, likes, and views that doesn’t compromise on quality. They offer: Low-cost follower packages Budget-friendly like boosts Affordable video views with high retention Targeted solutions to maximize ROI Ideal for students, startups, creators, and agencies alike. 🤝 Manage Clients Efficiently with the Instagram Reseller Panel If you’re a digital agency or freelancer, GoUpSocial’s Instagram reseller panel is a goldmine. You get access to all the same high-quality services at reseller prices — with API access, white-label delivery, and bulk order management. You can resell these services under your own brand and watch your revenue grow alongside your client base. 🎯 A Complete Growth System – Why GoUpSocial Wins There are many panels out there. But here’s why GoUpSocial consistently ranks as the best and cheap SMM panel for Instagram server: 🔒 Safe and compliant with Instagram’s systems ⚡ Fast and automatic delivery 💬 Real engagement from real users 🛠️ Easy-to-use platform for all experience levels 🧩 All-in-one panel for followers, likes, views, comments, and verification 💼 Reseller-ready for agencies and freelancers If you want a system that works, and works well — this is it. 👉 Ready to accelerate your Instagram growth? Sign up now at https://goupsocial.com and experience the easiest, most reliable, and cheapest SMM panel Instagram solution available today. Whether you're after likes, views, followers, or even a verified badge, GoUpSocial delivers everything you need — fast, safe, and with real impact. 🔥 Don’t wait — your Instagram success story starts here! 🔥
  • Topics

×
×
  • 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