Jump to content
  • 0

[Help] Pvp points from Mobs


Question

Posted

Hello i have pvp points on my server. From each killed pleyera gets his 10% pvpPoints and that points has stored in db new column in characters

Wanna know how to add these points to the mobs and get them together with exp and sp.

but if exp is set to 7000 is a mob would give me 7 pvppoints.

hope u understand me cuz my english is more funny than the understandable.

Recommended Posts

  • 0
Posted

Hello again ;]

Have problem with Raid boss

I added the PvpPoints to L2RaidBossInstance but my bosses is strong and need party to kill him and only 1 player get points ;/

Want add for party and have problem with distribute points

 

look:

public boolean doDie(L2Character killer)
{
	if (!super.doDie(killer))
		return false;

	L2PcInstance player = null;
	if (killer instanceof L2PcInstance)
		player = (L2PcInstance) killer;
	else if (killer instanceof L2Summon)
		player = ((L2Summon) killer).getOwner();

	if (player != null)
	{
		broadcastPacket(new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));
		if (player.getParty() != null)
		{
			for (L2PcInstance member : player.getParty().getPartyMembers())
			{
				int numberToAdd = 500;
				member.setPvpPoints(member.getPvpPoints() + numberToAdd );
				member.sendMessage("You have earned " + numberToAdd + " PvP Points");
				RaidBossPointsManager.addPoints(member, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
				if(member.isNoble())
					Hero.getInstance().setRBkilled(member.getObjectId(), this.getNpcId());


			}
		}
		else
		{
			int numberToAdd = 500;
			player.setPvpPoints(player.getPvpPoints() + numberToAdd );
			player.sendMessage("You have earned " + numberToAdd + " PvP Points");				
			RaidBossPointsManager.addPoints(player, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
			if(player.isNoble())
				Hero.getInstance().setRBkilled(player.getObjectId(), this.getNpcId());

		}
	}

	RaidBossSpawnManager.getInstance().updateStatus(this, true);
	return true;
}

 

raidboss everyone has a lvl 80 so everybody gives the same number of points

tried to add:  int numberToAdd = 500 / this.getPartyMember();  but error ;/

want to ex if in party is 4 members - int numberToAdd = 500/4

is posible or not??

  • 0
Posted

Never initialize a variable inside a (for, while) loop.

	if (player != null)
	{
		int numberToAdd = 500;
		broadcastPacket(new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));

		if (player.getParty() != null)
		{
			for (L2PcInstance member : player.getParty().getPartyMembers())
			{
				member.setPvpPoints(member.getPvpPoints() + numberToAdd );
				member.sendMessage("You have earned " + numberToAdd + " PvP Points");
				RaidBossPointsManager.addPoints(member, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));

				if(member.isNoble())
					Hero.getInstance().setRBkilled(member.getObjectId(), this.getNpcId());
			}
		}
		else
		{
			player.setPvpPoints(player.getPvpPoints() + numberToAdd );
			player.sendMessage("You have earned " + numberToAdd + " PvP Points");				
			RaidBossPointsManager.addPoints(player, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
			if(player.isNoble())
				Hero.getInstance().setRBkilled(player.getObjectId(), this.getNpcId());

		}
	}

 

And don't say "I got an error", send the error :p. I'm not 3 years old indian programmer genius.

 

I want to add your code give 500 pvppoints to each member. It's not 500 points in total splitted in "x" party members. Well perhaps you know it, but better to say.

 

PS :I reread your message, and it's what you were asking lol :). Check the xp/sp sharing system for party members, you have your answer here.

  • 0
Posted

here is xp/sp sharing but dont know from where i can take party size

 

	public void distributeXpAndSp(long xpReward, int spReward, List<L2Playable> rewardedMembers, int topLvl, int partyDmg, L2Attackable target)
{
	L2SummonInstance summon = null;
	List<L2Playable> validMembers = getValidMembers(rewardedMembers, topLvl);

	float penalty;
	double sqLevel;
	double preCalculation;

	xpReward *= getExpBonus(validMembers.size());
	spReward *= getSpBonus(validMembers.size());

	double sqLevelSum = 0;
	for (L2Playable character : validMembers)
		sqLevelSum += (character.getLevel() * character.getLevel());

       final float vitalityPoints = target.getVitalityPoints(partyDmg) * Config.RATE_PARTY_XP / validMembers.size();
       final boolean useVitalityRate = target.useVitalityRate();

       // Go through the L2PcInstances and L2PetInstances (not L2SummonInstances) that must be rewarded
	synchronized(rewardedMembers)
	{
		for (L2Character member : rewardedMembers)
		{
			if(member.isDead()) continue;

			penalty = 0;

			// The L2SummonInstance penalty
			if (member.getPet() instanceof L2SummonInstance)
			{
				summon     = (L2SummonInstance)member.getPet();
				penalty    = summon.getExpPenalty();
			}
			// Pets that leech xp from the owner (like babypets) do not get rewarded directly
			if (member instanceof L2PetInstance)
			{
				if (((L2PetInstance)member).getPetData().getOwnerExpTaken() > 0)
					continue;
				else // TODO: This is a temporary fix while correct pet xp in party is figured out
					penalty = (float)0.85;
			}


			// Calculate and add the EXP and SP reward to the member
			if (validMembers.contains(member))
			{
				sqLevel = member.getLevel() * member.getLevel();
				preCalculation = (sqLevel / sqLevelSum) * (1 - penalty);

				// Add the XP/SP points to the requested party member
				if (!member.isDead())
                   {
                       long addexp = Math.round(member.calcStat(Stats.EXPSP_RATE, xpReward * preCalculation, null, null));
                       int addsp = (int)member.calcStat(Stats.EXPSP_RATE, spReward * preCalculation, null, null);
                       if (member instanceof L2PcInstance)
                       {
                       	if (((L2PcInstance)member).getSkillLevel(467) > 0)
                       	{
                       		L2Skill skill = SkillTable.getInstance().getInfo(467,((L2PcInstance)member).getSkillLevel(467));
                       		
                       		if (skill.getExpNeeded() <= addexp)
                       			((L2PcInstance)member).absorbSoul(skill,target);
                       	}
                           ((L2PcInstance)member).addExpAndSp(addexp, addsp, useVitalityRate);
                           if (addexp > 0)
                               ((L2PcInstance)member).updateVitalityPoints(vitalityPoints, true, false);
                       }
                       else
                           member.addExpAndSp(addexp, addsp);
                   }
			}
			else
			{
				member.addExpAndSp(0, 0);
			}
		}
	}
}

 

"parytRoom" is party matching = distribute in party ?

  • 0
Posted

ok done i have all i need (i think that)

 

look

	public boolean doDie(L2Character killer)
{
	if (!super.doDie(killer))
		return false;

	L2PcInstance player = null;
	if (killer instanceof L2PcInstance)
		player = (L2PcInstance) killer;
	else if (killer instanceof L2Summon)
		player = ((L2Summon) killer).getOwner();

	if (player != null)
	{
		int numberToAdd = (500/(player.getParty().getMemberCount()));
		broadcastPacket(new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));

		if (player.getParty() != null)
		{
			for (L2PcInstance member : player.getParty().getPartyMembers())
			{
				member.setPvpPoints(member.getPvpPoints() + numberToAdd);
				member.sendMessage("You have earned " + numberToAdd + " PvP Points");
				RaidBossPointsManager.addPoints(member, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));

				if(member.isNoble())
					Hero.getInstance().setRBkilled(member.getObjectId(), this.getNpcId());
			}
		}
		else
		{
			player.setPvpPoints(player.getPvpPoints() + numberToAdd );
			player.sendMessage("You have earned " + numberToAdd + " PvP Points");				
			RaidBossPointsManager.addPoints(player, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
			if(player.isNoble())
				Hero.getInstance().setRBkilled(player.getObjectId(), this.getNpcId());

		}
	}

	RaidBossSpawnManager.getInstance().updateStatus(this, true);
	return true;
}

 

and work fine tested with 2 and 3 party members

 

Sorry for post after post*

 

 

edit: sorry I was glad too fast

 

when I'm in a party and party member is in town and so divided the party and give away even as they are

 

i found somethink like this:

 

	if (!Util.checkIfInRange(Config.ALT_PARTY_RANGE2, player, member, true)) continue;

 

but dont know wher put this code ;[

 

  • 0
Posted

You have to test the range of each party member, so you have to test inside the loop.

 

for (L2PcInstance member : player.getParty().getPartyMembers())
{
   if(Util.checkIfInRange(....
  { 
      member.setPvpPoints(me...
  }
}

 

You should check the checkIfInRange about the boolean in the method.

checkIfInRange(Config.ALT_PARTY_RANGE2, player, member, true)

As you can see, it takes a config range, the player loc, the member loc, and a boolean. Be sure what does this boolean. Just as security.

 

I don't want to bitch, but you should have problem with your code if you haven't a party. Well, ok, RB can't be made w/o party, but imagine if a destro leave the party and kill the boss alone. Well, you guess it, the numberToAdd check about the member count of the party, but the party will be null. So normally you have a NPE error.

 

Initialize numberToAdd without any values.

 

int numberToAdd;

 

if player.get.party != null ---------> numberToAdd = (500/(player.getParty().getMemberCount()));

and for the "else" part ----------------> numberToAdd = 500

 

Put this just before .setPvpPoints methods.

 

first part will look like that :

for (L2PcInstance member : player.getParty().getPartyMembers())
{
   if(Util.checkIfInRange(....
  { 
      numberToAdd = (500/(player.getParty().getMemberCount()));
      member.setPvpPoints(me...
  }
}

 

Basically you don't even need to use "numberToAdd" for a single player.

 

			else
		{
			player.setPvpPoints(player.getPvpPoints() + 500);

 

------------

 

Remember the checkIfInRange is a boolean type. It returns true if it's in range, and false if not.

  • 0
Posted

I did as you wrote but dont work cuz never use boolean and dont know how ;/ tried looks in other scripts but did not succeed.

 

for now have:

 

	public boolean doDie(L2Character killer)
{
	if (!super.doDie(killer))
		return false;

	L2PcInstance player = null;
	if (killer instanceof L2PcInstance)
		player = (L2PcInstance) killer;
	else if (killer instanceof L2Summon)
		player = ((L2Summon) killer).getOwner();

	if (player != null)
	{
		List<L2PcInstance> ToReward = FastList.newInstance();
		int count = 500 / ToReward.size(); 
		broadcastPacket(new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));
		if (player.getParty() != null )
		{							
			for (L2PcInstance member :  player.getParty().getPartyMembers())					
			{				
			if (!Util.checkIfInRange(Config.ALT_PARTY_RANGE2, player, member, true)) continue;
			ToReward.add(member);

			{					
				member.setPvpPoints(member.getPvpPoints() + count);
				member.sendMessage("You have earned " + count + " PvP Points");
				RaidBossPointsManager.addPoints(member, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));

				if(member.isNoble())
					Hero.getInstance().setRBkilled(member.getObjectId(), this.getNpcId());
				}				
			FastList.recycle((FastList<?>) ToReward);
			}
		}
		else
		{

			player.setPvpPoints(player.getPvpPoints() + 500);
			player.sendMessage("You have earned 500 PvP Points");				
			RaidBossPointsManager.addPoints(player, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
			if(player.isNoble())
				Hero.getInstance().setRBkilled(player.getObjectId(), this.getNpcId());

		}
	}

	RaidBossSpawnManager.getInstance().updateStatus(this, true);
	return true;
}

 

 

i read about boolean and know only: have 2 option false or true but how use this dont know ;/

 

  • 0
Posted

What doesn't work, be more accurate.

 

  • Compilation ? If yes, give error.
  • Ingame ? If yes, try to make your code talks for you, adding some
     
    player.sendMessage("Test to see if that work");
     
    in good places (after each conditions).

  • 0
Posted

when i'am in paryt have error; (when party member is in range and out of range)

Failed executing hittask.

java.lang.ArthmeticException:  / by zero

 

I know what it means [ToReward.size()] is still 0

 

Whe i read about bolean i came to this; when party memmbers is out of range partysize=1 but how to write this (or im wong)

GN i didnt sleep 2 night in a row now need to rest a little cu soon ;]

  • 0
Posted

I just reread your code, wtf are you using

 

			List<L2PcInstance> ToReward = FastList.newInstance();
		int count = 500 / ToReward.size(); 

 

Drop the ToReward stuff, it's what it bugs.

 

You initialize a FastList in a list, and divide this empty list from 500. Total illogismadnessupawesomerror.

 

Just do as you did later about the number of party mmebers, I don't get this "new List feature" lol.

 

----

 

I don't think you understand you have to initialize the variable OUT of the for loop, but must add this variable INSIDE it aswell.

 

And remove the CONTINUE after the "if" omg. Try to understand what you copy/paste.

 

----

 

Reread correctly all my posts, you have all answers. If you're blocked in a point I already talked sooner, you won't have any answer. Post back your code with error in the same post, that will avoid me to ask for error or for the code.

  • 0
Posted

lost myself, I do not know what I have now remove.

 

i need this;

 

List<L2PcInstance> ToReward = FastList.newInstance();

 

and this:

 

FastList.recycle((FastList<?>) ToReward);

 

and if checkIfInRange is boolean type how do I calculate the number of players in the party and the range?

 

now i have nothing new in code and stuck.

 

  • 0
Posted

Take back your code of the 20th december, it was near all good. I don't get why you began to use ToReward stuff.

 

	public boolean doDie(L2Character killer)
{
	if (!super.doDie(killer))
		return false;

	L2PcInstance player = null;
	if (killer instanceof L2PcInstance)
		player = (L2PcInstance) killer;
	else if (killer instanceof L2Summon)
		player = ((L2Summon) killer).getOwner();

	if (player != null)
	{
		int numberToAdd = (500/(player.getParty().getMemberCount()));
		broadcastPacket(new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));

		if (player.getParty() != null)
		{
			for (L2PcInstance member : player.getParty().getPartyMembers())
			{
				member.setPvpPoints(member.getPvpPoints() + numberToAdd);
				member.sendMessage("You have earned " + numberToAdd + " PvP Points");
				RaidBossPointsManager.addPoints(member, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));

				if(member.isNoble())
					Hero.getInstance().setRBkilled(member.getObjectId(), this.getNpcId());
			}
		}
		else
		{
			player.setPvpPoints(player.getPvpPoints() + numberToAdd );
			player.sendMessage("You have earned " + numberToAdd + " PvP Points");				
			RaidBossPointsManager.addPoints(player, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
			if(player.isNoble())
				Hero.getInstance().setRBkilled(player.getObjectId(), this.getNpcId());

		}
	}

	RaidBossSpawnManager.getInstance().updateStatus(this, true);
	return true;
}

 

Instead of int numberToAdd = (500/(player.getParty().getMemberCount())); write int numberToAdd = 500;. You will initialize it to 500. I explain why after.

 

Now we have to change value on numberToAdd, right ? The value differs from if you got a party (numberToAdd divided by party members) or if you solo (numberToAdd). Again right ?

 

So basically, we initialized numberToAdd with a fixed number, 500. Where to calculate this value for the team ? Logically, you have to put it after the party check.

			if (player.getParty() != null)
		{
                              numberToAdd = (500/(player.getParty().getMemberCount()));

 

The solo part will use the basic value, 500. So you haven't to change anything on it.

  • 0
Posted

When i killl RB solo its ok 500 PvP Points.

When i kill RB in party and 1 party member is far in town killer takes 250 PvP Pooints and member takes 250 PvP Points.

why I want to add (!(Util.checkIfInRange... for checking member if in range.

that "ToReward." is from distributionAdena but u tell me is wrong, now i don know what is wrong and where i must put code util for check who is in range.

  • 0
Posted

Well first do as I said, post a clean code and try to add ONLY the range check.

 

I know (!(Util.checkIfInRange... is for range, but that doesn't have any relation with ToReward lol.

 

I want to see how you include the check, I think you did one or 2 errors, and I perhaps know them.

 

About the location of the check, take one minute to think. When do you want to verify the range ? "Only when I got a party" is a first point. Second point is "who is affected ?" Only the killer, or each member ? With those 2 questions you got the location.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • First, you need to understand what you're doing and what you want to achieve. You have to choose a server core. After that, decide what you want your server to include, code it, modify the client to fit your server, go public, and drink champagne.   If you know how to code, creating a server is relatively easy — a few months of work and you can make it happen. Modifying the client is a completely different story. There’s a lack of tutorials, tools, and source materials. I’m currently working on the client myself, and I’ve already spent over three weeks just trying to get started due to the lack of information. If you don’t have the knowledge and experience, you’ll need a team and a bag of money — but realistically, it just won’t succeed.
    • The server has been online and stable for over 2 months now, and we’re still going strong! No wipes, no shortcuts ~ just continuous work, daily fixes, events, and improvements to ensure the best possible experience.   Great News! 🔥 CHAPTER II IS COMING — GRACIA FINAL 🔥 On February 16, L2Elixir enters a new era. The server will be officially updated to Gracia Final, opening Chapter II of our journey. Expect new content, improvements, and surprises that will refresh the gameplay while keeping the classic Gracia Final spirit alive.   More challenges, more competition, and more reasons to log in.   📅 Update Date: February 16 ⚔️ Chapter II: Gracia Final This is not a reset. This is evolution.   Prepare yourselves — Chapter II begins soon.   Website: https://l2elixir.org/ Discord: https://discord.gg/5ydPHvhbxs    
    • Server owners, Top.MaxCheaters.com is now live and accepting Lineage 2 server listings. There is no voting, no rankings manipulation, and no paid advantages. Visibility is clean and equal, and early listings naturally appear at the top while the platform grows. If your server is active, it should already be listed. Submit here 👉https://Top.MaxCheaters.com This platform is part of the MaxCheaters.com network and is being built as a long-term reference point for the Lineage 2 community. — MaxCheaters.com Team
    • Hello! We are Genesis, small team that works on new Lineage 2 project. Our goal with this project is to create a fresh new place to play — built around real community feedback, with no aggressive pay-to-win donations and with carefully thought-out quality-of-life improvements, balance changes etc. We believe that even tho we all love this game, everyone has at least one or two things they would like to change in the game to make it more enjoyable. Thats why we want the comunity feedback to shape our server. Main information about the server: • Interlude Classic version • Rates: EXP x4 SP x2 Loot x2, Spoil x2 (not set in stone, might be changed) • Local & Server-Side Dualbox Protection • Complete, Clear Website with Integrated Account Panel (Game account creation, direct communication with support, bug reporting, voting and reward system) • Launcher – External Game Login System: manage all your accounts inside the launcher, “Play” button logs you directly into the game server Here are list of few changes we already added/decided to add to the server: • Reworked Client to fit interlude Era with upgraded Classic Ui • Custom Antibot system • Custom AntiDualBox System • Offline shops • Offline shop with buffs (available only in towns) • Mass Sweeper added to the game • Newbie buffs available all the way to lvl 76 (nothing crazy, but its free) • Slight balance change to Destroyer damage with Polearm and Cancel spell from SPS • PvP zones on every Epic spawn spot • Overbuffing blocked • And more! Since we put big focus on community feedback and suggestions, we are looking for people for our internal tests, that will discuss whether current changes „fit” into the game and maybe suggest some changes themselves. If what you’ve just read sounds interesting to you, if you want to help creating server fitted for you, join our server Discord. Help us to understand what Lineage 2 players in 2026 actually expect and need — so we can meet those expectations and avoid becoming just another server that dies a natural death.     Even if you’re not interested in playing right now, but you are a long-time Lineage 2 player, feel free to join our community. We would greatly appreciate your experience and feedback to help us improve and develop our project. Join the growing L2Genesis community: https://discord.gg/mcuHsQzNCm Also check our website: https://l2genesis.com/
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..