Package com.l2jfrozen.gameserver.skills.conditions

Source Code of com.l2jfrozen.gameserver.skills.conditions.ConditionPlayerWeight

package com.l2jfrozen.gameserver.skills.conditions;

import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.skills.Env;
import com.l2jfrozen.gameserver.skills.Stats;
/**
* The Class ConditionPlayerWeight.
* @author Kerberos
*/
public class ConditionPlayerWeight extends Condition
{

        private final int _weight;

        /**
         * Instantiates a new condition player weight.
         * @param weight the weight
         */
        public ConditionPlayerWeight(int weight)
        {
                _weight = weight;
        }

        @Override
        public boolean testImpl(Env env)
        {
                final L2PcInstance player = env.getPlayer();
                if ((player != null) && (player.getMaxLoad() > 0))
                {
                        int weightproc = (int) (((player.getCurrentLoad() - player.calcStat(Stats.WEIGHT_PENALTY, 1, player, null)) * 100) / player.getMaxLoad());
                        return (weightproc < _weight) || player.getDietMode();
                }
                return true;
        }
}
TOP

Related Classes of com.l2jfrozen.gameserver.skills.conditions.ConditionPlayerWeight

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.