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

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