Page 1 of 1

XP bonus stat on Champion mobs

Posted: Mon Apr 26, 2021 2:58 am
by Kyboi
Greetings,

Champion mobs have of course bonus xp according to my configs, but for some reason when I have an XP rune in my inventory and kill a champion mob the rune doesn't work (let's say if my champs give x2 exp, and i have a x2 exp rune the champ should give x4 exp, but it only gives x2)

The code for the exp distribution looks like this

Code: Select all

// Calculate Exp and SP rewards
	if (attacker.getKnownList().knowsObject(this))
		{
			// Calculate the difference of level between this attacker (player or servitor owner) and the L2Attackable
			// mob = 24, atk = 10, diff = -14 (full xp)
			// mob = 24, atk = 28, diff = 4 (some xp)
			// mob = 24, atk = 50, diff = 26 (no xp)
			final int levelDiff = attacker.getLevel() - getLevel();
			
			final int[] expSp = calculateExpAndSp(levelDiff, damage, totalDamage);
			long exp = expSp[0];
			int sp = expSp[1];
			
			if (Config.L2JMOD_CHAMPION_ENABLE && isChampion())
			{
				exp *= Config.L2JMOD_CHAMPION_REWARDS_EXP_SP;
				sp *= Config.L2JMOD_CHAMPION_REWARDS_EXP_SP;
			}
			
			if (Config.L2JMOD_SUPERCHAMPION_ENABLE && isSuperChampion())
			{
				exp *= Config.L2JMOD_SUPERCHAMPION_REWARDS_EXP_SP;
				sp *= Config.L2JMOD_SUPERCHAMPION_REWARDS_EXP_SP;
			}
					
			exp *= penalty;
							
			// Check for an over-hit enabled strike
			L2Character overhitAttacker = getOverhitAttacker();
			if (isOverhit() && (overhitAttacker != null) && (overhitAttacker.getActingPlayer() != null) && (attacker == overhitAttacker.getActingPlayer()))
			{
				attacker.sendPacket(SystemMessageId.OVER_HIT);
				exp += calculateOverhitExp(exp);
			}
							
			// Distribute the Exp and SP between the L2PcInstance and its L2Summon
			if (!attacker.isDead())
			{
				final long addexp = Math.round(attacker.calcStat(Stats.EXPSP_RATE, exp, null, null));
				final int addsp = (int) attacker.calcStat(Stats.EXPSP_RATE, sp, null, null);
				
				attacker.addExpAndSp(addexp, addsp, useVitalityRate());
				if (addexp > 0)
				{
					attacker.updateVitalityPoints(getVitalityPoints(damage), true, false);
					PcCafePointsManager.getInstance().givePcCafePoint((attacker), addexp);
				}
			}
		}
The problem is that the rune uses a stat, which is "BONUS_EXP", but i can't just add "* Stats.BONUS_EXP" to the "exp *= Config.L2JMOD_CHAMPION_REWARDS_EXP_SP;" line because i get "the * operator is undefined for the argument type(s) float, Stats" in return

I don't really know about java so i can't figure out a way to fix this, i searched for the error on internet but i didn't get how to fix it because they explained it in a way that surpasses my java knowledge

What can I do to get the results i want?

Re: XP bonus stat on Champion mobs

Posted: Tue Apr 27, 2021 3:00 pm
by Loup_Solitaire
This code come from an old l2j build

btw SuperChampion doesn't exit in L2J