Moved some common utils to gameserver.

This commit is contained in:
MobiusDev 2018-04-07 00:03:03 +00:00
parent 7fcc48a051
commit 0d3fa9f075
52 changed files with 236 additions and 236 deletions

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -25,7 +25,6 @@ import java.util.List;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.geoengine.geodata.ABlock;
import com.l2jmobius.gameserver.geoengine.geodata.BlockComplex;
@ -46,6 +45,7 @@ import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Hasha

View File

@ -34,7 +34,6 @@ import java.util.function.BiPredicate;
import java.util.stream.Stream;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.CharEffectList;
@ -50,6 +49,7 @@ import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.StatsHolder;
import com.l2jmobius.gameserver.model.stats.TraitType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.util.MathUtil;
public class CharStat
{

View File

@ -21,7 +21,6 @@ import java.util.Optional;
import java.util.function.BiFunction;
import java.util.logging.Logger;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.stats.finalizers.AttributeFinalizer;
@ -51,6 +50,7 @@ import com.l2jmobius.gameserver.model.stats.finalizers.ShieldDefenceRateFinalize
import com.l2jmobius.gameserver.model.stats.finalizers.ShotsBonusFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.SpeedFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.VampiricChanceFinalizer;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* Enum of basic stats.

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.commons.util;
package com.l2jmobius.gameserver.util;
/**
* @author UnAfraid

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -25,7 +25,6 @@ import java.util.List;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.geoengine.geodata.ABlock;
import com.l2jmobius.gameserver.geoengine.geodata.BlockComplex;
@ -46,6 +45,7 @@ import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Hasha

View File

@ -34,7 +34,6 @@ import java.util.function.BiPredicate;
import java.util.stream.Stream;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.CharEffectList;
@ -50,6 +49,7 @@ import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.StatsHolder;
import com.l2jmobius.gameserver.model.stats.TraitType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.util.MathUtil;
public class CharStat
{

View File

@ -21,7 +21,6 @@ import java.util.Optional;
import java.util.function.BiFunction;
import java.util.logging.Logger;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.stats.finalizers.AttributeFinalizer;
@ -51,6 +50,7 @@ import com.l2jmobius.gameserver.model.stats.finalizers.ShieldDefenceRateFinalize
import com.l2jmobius.gameserver.model.stats.finalizers.ShotsBonusFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.SpeedFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.VampiricChanceFinalizer;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* Enum of basic stats.

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.commons.util;
package com.l2jmobius.gameserver.util;
/**
* @author UnAfraid

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -25,7 +25,6 @@ import java.util.List;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.geoengine.geodata.ABlock;
import com.l2jmobius.gameserver.geoengine.geodata.BlockComplex;
@ -46,6 +45,7 @@ import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Hasha

View File

@ -34,7 +34,6 @@ import java.util.function.BiPredicate;
import java.util.stream.Stream;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.CharEffectList;
@ -50,6 +49,7 @@ import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.StatsHolder;
import com.l2jmobius.gameserver.model.stats.TraitType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.util.MathUtil;
public class CharStat
{

View File

@ -21,7 +21,6 @@ import java.util.Optional;
import java.util.function.BiFunction;
import java.util.logging.Logger;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.stats.finalizers.AttributeFinalizer;
@ -51,6 +50,7 @@ import com.l2jmobius.gameserver.model.stats.finalizers.ShieldDefenceRateFinalize
import com.l2jmobius.gameserver.model.stats.finalizers.ShotsBonusFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.SpeedFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.VampiricChanceFinalizer;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* Enum of basic stats.

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.commons.util;
package com.l2jmobius.gameserver.util;
/**
* @author UnAfraid

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -25,7 +25,6 @@ import java.util.List;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.geoengine.geodata.ABlock;
import com.l2jmobius.gameserver.geoengine.geodata.BlockComplex;
@ -46,6 +45,7 @@ import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Hasha

View File

@ -34,7 +34,6 @@ import java.util.function.BiPredicate;
import java.util.stream.Stream;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.CharEffectList;
@ -50,6 +49,7 @@ import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.StatsHolder;
import com.l2jmobius.gameserver.model.stats.TraitType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.util.MathUtil;
public class CharStat
{

View File

@ -21,7 +21,6 @@ import java.util.Optional;
import java.util.function.BiFunction;
import java.util.logging.Logger;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.stats.finalizers.AttributeFinalizer;
@ -51,6 +50,7 @@ import com.l2jmobius.gameserver.model.stats.finalizers.ShieldDefenceRateFinalize
import com.l2jmobius.gameserver.model.stats.finalizers.ShotsBonusFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.SpeedFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.VampiricChanceFinalizer;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* Enum of basic stats.

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.commons.util;
package com.l2jmobius.gameserver.util;
/**
* @author UnAfraid

View File

@ -20,7 +20,7 @@ import java.util.BitSet;
import java.util.concurrent.atomic.AtomicInteger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.PrimeFinder;
import com.l2jmobius.gameserver.util.PrimeFinder;
/**
* This class ..

View File

@ -9,7 +9,7 @@
* suitability of this software for any purpose. It is provided "as is"
* without expressed or implied warranty.
*/
package com.l2jmobius.commons.util;
package com.l2jmobius.gameserver.util;
import java.util.Arrays;

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -1,94 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.commons.util;
/**
* @author UnAfraid
*/
public class MathUtil
{
public static byte add(byte oldValue, byte value)
{
return (byte) (oldValue + value);
}
public static short add(short oldValue, short value)
{
return (short) (oldValue + value);
}
public static int add(int oldValue, int value)
{
return oldValue + value;
}
public static double add(double oldValue, double value)
{
return oldValue + value;
}
public static byte mul(byte oldValue, byte value)
{
return (byte) (oldValue * value);
}
public static short mul(short oldValue, short value)
{
return (short) (oldValue * value);
}
public static int mul(int oldValue, int value)
{
return oldValue * value;
}
public static double mul(double oldValue, double value)
{
return oldValue * value;
}
public static byte div(byte oldValue, byte value)
{
return (byte) (oldValue / value);
}
public static short div(short oldValue, short value)
{
return (short) (oldValue / value);
}
public static int div(int oldValue, int value)
{
return oldValue / value;
}
public static double div(double oldValue, double value)
{
return oldValue / value;
}
/**
* @param numToTest : The number to test.
* @param min : The minimum limit.
* @param max : The maximum limit.
* @return the number or one of the limit (mininum / maximum).
*/
public static int limit(int numToTest, int min, int max)
{
return (numToTest > max) ? max : ((numToTest < min) ? min : numToTest);
}
}

View File

@ -25,7 +25,6 @@ import java.util.List;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.geoengine.geodata.ABlock;
import com.l2jmobius.gameserver.geoengine.geodata.BlockComplex;
@ -46,6 +45,7 @@ import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Hasha

View File

@ -34,7 +34,6 @@ import java.util.function.BiPredicate;
import java.util.stream.Stream;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.CharEffectList;
@ -50,6 +49,7 @@ import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.StatsHolder;
import com.l2jmobius.gameserver.model.stats.TraitType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.util.MathUtil;
public class CharStat
{

View File

@ -21,7 +21,6 @@ import java.util.Optional;
import java.util.function.BiFunction;
import java.util.logging.Logger;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.stats.finalizers.AttributeFinalizer;
@ -51,6 +50,7 @@ import com.l2jmobius.gameserver.model.stats.finalizers.ShieldDefenceRateFinalize
import com.l2jmobius.gameserver.model.stats.finalizers.ShotsBonusFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.SpeedFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.VampiricChanceFinalizer;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* Enum of basic stats.

View File

@ -0,0 +1,94 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.util;
/**
* @author UnAfraid
*/
public class MathUtil
{
public static byte add(byte oldValue, byte value)
{
return (byte) (oldValue + value);
}
public static short add(short oldValue, short value)
{
return (short) (oldValue + value);
}
public static int add(int oldValue, int value)
{
return oldValue + value;
}
public static double add(double oldValue, double value)
{
return oldValue + value;
}
public static byte mul(byte oldValue, byte value)
{
return (byte) (oldValue * value);
}
public static short mul(short oldValue, short value)
{
return (short) (oldValue * value);
}
public static int mul(int oldValue, int value)
{
return oldValue * value;
}
public static double mul(double oldValue, double value)
{
return oldValue * value;
}
public static byte div(byte oldValue, byte value)
{
return (byte) (oldValue / value);
}
public static short div(short oldValue, short value)
{
return (short) (oldValue / value);
}
public static int div(int oldValue, int value)
{
return oldValue / value;
}
public static double div(double oldValue, double value)
{
return oldValue / value;
}
/**
* @param numToTest : The number to test.
* @param min : The minimum limit.
* @param max : The maximum limit.
* @return the number or one of the limit (mininum / maximum).
*/
public static int limit(int numToTest, int min, int max)
{
return (numToTest > max) ? max : ((numToTest < min) ? min : numToTest);
}
}

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,13 +16,13 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -16,11 +16,11 @@
*/
package handlers.effecthandlers;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Sdw

View File

@ -1,94 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.commons.util;
/**
* @author UnAfraid
*/
public class MathUtil
{
public static byte add(byte oldValue, byte value)
{
return (byte) (oldValue + value);
}
public static short add(short oldValue, short value)
{
return (short) (oldValue + value);
}
public static int add(int oldValue, int value)
{
return oldValue + value;
}
public static double add(double oldValue, double value)
{
return oldValue + value;
}
public static byte mul(byte oldValue, byte value)
{
return (byte) (oldValue * value);
}
public static short mul(short oldValue, short value)
{
return (short) (oldValue * value);
}
public static int mul(int oldValue, int value)
{
return oldValue * value;
}
public static double mul(double oldValue, double value)
{
return oldValue * value;
}
public static byte div(byte oldValue, byte value)
{
return (byte) (oldValue / value);
}
public static short div(short oldValue, short value)
{
return (short) (oldValue / value);
}
public static int div(int oldValue, int value)
{
return oldValue / value;
}
public static double div(double oldValue, double value)
{
return oldValue / value;
}
/**
* @param numToTest : The number to test.
* @param min : The minimum limit.
* @param max : The maximum limit.
* @return the number or one of the limit (mininum / maximum).
*/
public static int limit(int numToTest, int min, int max)
{
return (numToTest > max) ? max : ((numToTest < min) ? min : numToTest);
}
}

View File

@ -25,7 +25,6 @@ import java.util.List;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.data.xml.impl.DoorData;
import com.l2jmobius.gameserver.geoengine.geodata.ABlock;
import com.l2jmobius.gameserver.geoengine.geodata.BlockComplex;
@ -46,6 +45,7 @@ import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* @author Hasha

View File

@ -34,7 +34,6 @@ import java.util.function.BiPredicate;
import java.util.stream.Stream;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.enums.Position;
import com.l2jmobius.gameserver.model.CharEffectList;
@ -50,6 +49,7 @@ import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.model.stats.StatsHolder;
import com.l2jmobius.gameserver.model.stats.TraitType;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import com.l2jmobius.gameserver.util.MathUtil;
public class CharStat
{

View File

@ -21,7 +21,6 @@ import java.util.Optional;
import java.util.function.BiFunction;
import java.util.logging.Logger;
import com.l2jmobius.commons.util.MathUtil;
import com.l2jmobius.gameserver.enums.AttributeType;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.stats.finalizers.AttributeFinalizer;
@ -51,6 +50,7 @@ import com.l2jmobius.gameserver.model.stats.finalizers.ShieldDefenceRateFinalize
import com.l2jmobius.gameserver.model.stats.finalizers.ShotsBonusFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.SpeedFinalizer;
import com.l2jmobius.gameserver.model.stats.finalizers.VampiricChanceFinalizer;
import com.l2jmobius.gameserver.util.MathUtil;
/**
* Enum of basic stats.

View File

@ -0,0 +1,94 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.util;
/**
* @author UnAfraid
*/
public class MathUtil
{
public static byte add(byte oldValue, byte value)
{
return (byte) (oldValue + value);
}
public static short add(short oldValue, short value)
{
return (short) (oldValue + value);
}
public static int add(int oldValue, int value)
{
return oldValue + value;
}
public static double add(double oldValue, double value)
{
return oldValue + value;
}
public static byte mul(byte oldValue, byte value)
{
return (byte) (oldValue * value);
}
public static short mul(short oldValue, short value)
{
return (short) (oldValue * value);
}
public static int mul(int oldValue, int value)
{
return oldValue * value;
}
public static double mul(double oldValue, double value)
{
return oldValue * value;
}
public static byte div(byte oldValue, byte value)
{
return (byte) (oldValue / value);
}
public static short div(short oldValue, short value)
{
return (short) (oldValue / value);
}
public static int div(int oldValue, int value)
{
return oldValue / value;
}
public static double div(double oldValue, double value)
{
return oldValue / value;
}
/**
* @param numToTest : The number to test.
* @param min : The minimum limit.
* @param max : The maximum limit.
* @return the number or one of the limit (mininum / maximum).
*/
public static int limit(int numToTest, int min, int max)
{
return (numToTest > max) ? max : ((numToTest < min) ? min : numToTest);
}
}