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));
		}
	}
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...