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

    • Hello guys, I’m Morientes, owner of the servers you might know: L2Lionna / L2Pandora / L2Ramona / L2ERA / L2Zaken / L2Classic / L2Peri / L2Alice / L2EVA / L2Dragon and more. Over the years I’ve been developing Lineage II projects starting from High Five, then Classic, and later Essence. I started with High Five, which I turned into a very well-tested server with over 100 openings. My peak was around 2800 players online, and the server was stable (no crashes). With every opening there was always something to improve, fix, or optimize, and over time it became more and more stable. I still have all SVN commits from all those years, I can show everything via screen share if needed. The reason I’m selling is not because of the quality. The files are solid and ready to run any type of server (any rates). The problem was on our side;  we didn’t have a good long-term strategy for reopening servers as a team. About Classic: I started from 2.0 (Zaken version) and gradually upgraded it up to 4.7 Kamael. Each chronicle upgrade came with a lot of improvements, especially in terms of stability. About Essence: I started from the very first version and developed it up to High Elf (Protocol 464). Starting from Protocol 286 (Secrets of Empire), I worked with PTS files and extracted a lot of deep fixes. I unpacked AI.obj with full functionality, used official sniffers, and whenever something wasn’t clear, I checked directly on official servers and sniffed packets or data. For every chronicle update, I basically sniffed the entire official server, zones, monsters, events, mechanics, everything. From Chronicle 388, Reborn approached us to buy our files. The current L2Reborn Essence is based on my work! I can prove everything. I also have their updates integrated into my pack. I stopped development after High Elf mainly because my main developer was constantly looking for other opportunities. It became difficult to maintain a stable team, especially with everything going on (including the situation in Ukraine at that time). Eventually, I couldn’t find a reliable dev to continue working on Essence, so I decided to step away from this market last year. Now I’ve decided to sell everything. What I’m selling: All necessary tools (sniffing, geodata build, pack upgrade tools, game client parsers, L2Wiki parser, interfaces etc.) Full SVN repositories with all commits (Essence / Classic / High Five) All edited clients I still have All my data I can also include on sell an official character that is active daily, ranked, end up gear, and has access to end-game zones!!! useful for deep sniffing where normal players don’t have access. If someone wants to buy everything, I prefer a full deal and I will transfer full ownership. If needed, I can also sell parts separately, but honestly I’d prefer to sell everything to one team that can continue this project — this has been my work, my hobby, my baby. Important: I don’t offer further updates. The files are sold exactly as they are. I will, of course, explain everything you need to know to continue working on them. Contact: Telegram: @AlexAlexey Discord: .primsl2
    • Grand Opening: April 11, 2026 Website: https://l2strive.com Discord: https://discord.gg/SsUARZpbkG   🛡️ Server Rates Strive is a High Five Mid-PvP/Craft Server  Experience (XP): x15 Skill Points (SP): x15 Adena: x10 Drop: x15 Spoil: x3 Safe Enchant: +3 Max Enchant: +16 ⚔️ Enhanced Boss Jewelry     ⚔️ Making Bosses Useful Again Let’s be real: usually, Core, Orfen, and Baylor are just placeholder bosses that nobody cares about. We’ve overhauled their jewelry to make them legit end-game gear. We’ve turned these into high-value targets for PvP—if you want these massive percentage boosts, you’re going to have to fight for them.   ⚔️ Enhanced Boss Jewelry   💍 Improved Ring of Core Base Stats: M.Def 48 | HP +445 | MP +21 Offensive: P. Atk +12% | M. Atk +12% Critical: Physical Critical Rate +14 | Magic Critical Rate +2 Utility: Skill Reuse Delay -10% | MP Consumption -5% 🛡️ Improved Earring of Orfen Base Stats: M.Def 71 | MP +31 Defensive: P. Def +15% | M. Def +15% Recovery: Vampiric Rage +4% | Healing Received +6% Resistances: Bleed / Poison / Root / Sleep +20% (Chance & Resistance) 💎 Baylor's Earring Base Stats: M.Def 71 | MP +31 Speed: Atk. Spd +5% | Casting Spd +5% Combat: MP Regeneration +5% Resistances: Stun / Paralyze +30% (Chance & Resistance) 🚀 Core Features Full & Enchanted Buffs: Enjoy 6-hour durations on all standard and enchanted buffs. Premium Buffs: Premium users benefit from extended 9-hour buff durations. 100% Free AutoFarm: Built-in system for seamless progression while away from your PC. Custom Shop: Professional and intuitive UI for all essential equipment and consumables. NPC Buffer: Full scheme support to get you battle-ready instantly. Stability: Dedicated high-performance hardware with professional Anti-DDoS protection.  
    • Hello,   im looking for c4 client developer that can fix some issues, missing icons etc. if you are l2off developer then even better.   its easy ones, fix few skill icons, item icon, easy money if someone has time. I guess its lack of files in my patch, but might be smth other   contact with me on discord: endART_#6190 @DumanisT @SkyLord @XManton @Fr3DBr @mjst @Sighed any ideas who could help me XD
  • 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..