Jump to content
  • 0

How does weight system colors work?


Question

4 answers to this question

Recommended Posts

  • 0
Posted

L2PcInstance.java

 

public void refreshOverloaded()

 

	/**
 * Update the overloaded status of the L2PcInstance.<BR><BR>
 */
public void refreshOverloaded()
{
	int maxLoad = getMaxLoad();
	if (maxLoad > 0)
	{
		long weightproc = (long)getCurrentLoad() * 1000 / maxLoad;
		weightproc *= calcStat(Stats.WEIGHT_LIMIT, 1, this, null);
		int newWeightPenalty;
		if (weightproc < 500 || _dietMode)
		{
			newWeightPenalty = 0;
		}
		else if (weightproc < 666)
		{
			newWeightPenalty = 1;
		}
		else if ( weightproc < 800)
		{
			newWeightPenalty = 2;
		}
		else if (weightproc < 1000)
		{
			newWeightPenalty = 3;
		}
		else
		{
			newWeightPenalty = 4;
		}

		if (_curWeightPenalty != newWeightPenalty)
		{
			_curWeightPenalty = newWeightPenalty;
			if (newWeightPenalty > 0 && !_dietMode)
			{
				super.addSkill(SkillTable.getInstance().getInfo(4270,newWeightPenalty));
				setIsOverloaded(getCurrentLoad() > maxLoad);
			}
			else
			{
				super.removeSkill(getKnownSkill(4270));
				setIsOverloaded(false);
			}
			sendPacket(new UserInfo(this));
			sendPacket(new EtcStatusUpdate(this));
			broadcastPacket(new CharInfo(this));
			broadcastPacket(new ExBrExtraUserInfo(this));
		}
	}
}

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


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