Proper collision methods, float values and usage.
This commit is contained in:
@@ -503,15 +503,15 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
return _transform.filter(transform -> !transform.isStance()).map(Transform::getDisplayId).orElse(0);
|
||||
}
|
||||
|
||||
public double getCollisionRadius()
|
||||
public float getCollisionRadius()
|
||||
{
|
||||
final double defaultCollisionRadius = _template.getCollisionRadius();
|
||||
final float defaultCollisionRadius = _template.getCollisionRadius();
|
||||
return _transform.map(transform -> transform.getCollisionRadius(this, defaultCollisionRadius)).orElse(defaultCollisionRadius);
|
||||
}
|
||||
|
||||
public double getCollisionHeight()
|
||||
public float getCollisionHeight()
|
||||
{
|
||||
final double defaultCollisionHeight = _template.getCollisionHeight();
|
||||
final float defaultCollisionHeight = _template.getCollisionHeight();
|
||||
return _transform.map(transform -> transform.getCollisionHeight(this, defaultCollisionHeight)).orElse(defaultCollisionHeight);
|
||||
}
|
||||
|
||||
|
@@ -137,8 +137,8 @@ public class Npc extends Creature
|
||||
private int _currentLHandId; // normally this shouldn't change from the template, but there exist exceptions
|
||||
private int _currentRHandId; // normally this shouldn't change from the template, but there exist exceptions
|
||||
private int _currentEnchant; // normally this shouldn't change from the template, but there exist exceptions
|
||||
private double _currentCollisionHeight; // used for npc grow effect skills
|
||||
private double _currentCollisionRadius; // used for npc grow effect skills
|
||||
private float _currentCollisionHeight; // used for npc grow effect skills
|
||||
private float _currentCollisionRadius; // used for npc grow effect skills
|
||||
|
||||
private int _soulshotamount = 0;
|
||||
private int _spiritshotamount = 0;
|
||||
@@ -188,8 +188,8 @@ public class Npc extends Creature
|
||||
_currentEnchant = Config.ENABLE_RANDOM_ENCHANT_EFFECT ? Rnd.get(4, 21) : getTemplate().getWeaponEnchant();
|
||||
|
||||
// initialize the "current" collisions
|
||||
_currentCollisionHeight = getTemplate().getfCollisionHeight();
|
||||
_currentCollisionRadius = getTemplate().getfCollisionRadius();
|
||||
_currentCollisionHeight = getTemplate().getFCollisionHeight();
|
||||
_currentCollisionRadius = getTemplate().getFCollisionRadius();
|
||||
setFlying(template.isFlying());
|
||||
initStatusUpdateCache();
|
||||
}
|
||||
@@ -899,8 +899,8 @@ public class Npc extends Creature
|
||||
// we do need to reset the weapons back to the initial template weapon.
|
||||
_currentLHandId = getTemplate().getLHandId();
|
||||
_currentRHandId = getTemplate().getRHandId();
|
||||
_currentCollisionHeight = getTemplate().getfCollisionHeight();
|
||||
_currentCollisionRadius = getTemplate().getfCollisionRadius();
|
||||
_currentCollisionHeight = getTemplate().getFCollisionHeight();
|
||||
_currentCollisionRadius = getTemplate().getFCollisionRadius();
|
||||
|
||||
final Weapon weapon = (killer != null) ? killer.getActiveWeaponItem() : null;
|
||||
_killingBlowWeaponId = (weapon != null) ? weapon.getId() : 0;
|
||||
@@ -1249,24 +1249,24 @@ public class Npc extends Creature
|
||||
return getTemplate().isShowName();
|
||||
}
|
||||
|
||||
public void setCollisionHeight(double height)
|
||||
public void setCollisionHeight(float height)
|
||||
{
|
||||
_currentCollisionHeight = height;
|
||||
}
|
||||
|
||||
public void setCollisionRadius(double radius)
|
||||
public void setCollisionRadius(float radius)
|
||||
{
|
||||
_currentCollisionRadius = radius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCollisionHeight()
|
||||
public float getCollisionHeight()
|
||||
{
|
||||
return _currentCollisionHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCollisionRadius()
|
||||
public float getCollisionRadius()
|
||||
{
|
||||
return _currentCollisionRadius;
|
||||
}
|
||||
|
@@ -12457,26 +12457,26 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCollisionRadius()
|
||||
public float getCollisionRadius()
|
||||
{
|
||||
if (isMounted() && (_mountNpcId > 0))
|
||||
{
|
||||
return NpcData.getInstance().getTemplate(getMountNpcId()).getfCollisionRadius();
|
||||
return NpcData.getInstance().getTemplate(getMountNpcId()).getFCollisionRadius();
|
||||
}
|
||||
|
||||
final double defaultCollisionRadius = _appearance.isFemale() ? getBaseTemplate().getFCollisionRadiusFemale() : getBaseTemplate().getfCollisionRadius();
|
||||
final float defaultCollisionRadius = _appearance.isFemale() ? getBaseTemplate().getFCollisionRadiusFemale() : getBaseTemplate().getFCollisionRadius();
|
||||
return getTransformation().map(transform -> transform.getCollisionRadius(this, defaultCollisionRadius)).orElse(defaultCollisionRadius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCollisionHeight()
|
||||
public float getCollisionHeight()
|
||||
{
|
||||
if (isMounted() && (_mountNpcId > 0))
|
||||
{
|
||||
return NpcData.getInstance().getTemplate(getMountNpcId()).getfCollisionHeight();
|
||||
return NpcData.getInstance().getTemplate(getMountNpcId()).getFCollisionHeight();
|
||||
}
|
||||
|
||||
final double defaultCollisionHeight = _appearance.isFemale() ? getBaseTemplate().getFCollisionHeightFemale() : getBaseTemplate().getfCollisionHeight();
|
||||
final float defaultCollisionHeight = _appearance.isFemale() ? getBaseTemplate().getFCollisionHeightFemale() : getBaseTemplate().getFCollisionHeight();
|
||||
return getTransformation().map(transform -> transform.getCollisionHeight(this, defaultCollisionHeight)).orElse(defaultCollisionHeight);
|
||||
}
|
||||
|
||||
|
@@ -41,8 +41,8 @@ public class CreatureTemplate extends ListenersContainer
|
||||
/** For client info use {@link #_fCollisionHeight} */
|
||||
private int _collisionHeight;
|
||||
|
||||
private double _fCollisionRadius;
|
||||
private double _fCollisionHeight;
|
||||
private float _fCollisionRadius;
|
||||
private float _fCollisionHeight;
|
||||
|
||||
protected final Map<Stat, Double> _baseValues = new EnumMap<>(Stat.class);
|
||||
|
||||
@@ -118,8 +118,8 @@ public class CreatureTemplate extends ListenersContainer
|
||||
_baseValues.put(Stat.BASE_ATTRIBUTE_RES, set.getDouble("baseElementRes", 0));
|
||||
|
||||
// Geometry
|
||||
_fCollisionHeight = set.getDouble("collision_height", 0);
|
||||
_fCollisionRadius = set.getDouble("collision_radius", 0);
|
||||
_fCollisionHeight = set.getFloat("collision_height", 0);
|
||||
_fCollisionRadius = set.getFloat("collision_radius", 0);
|
||||
_collisionRadius = (int) _fCollisionRadius;
|
||||
_collisionHeight = (int) _fCollisionHeight;
|
||||
|
||||
@@ -522,7 +522,7 @@ public class CreatureTemplate extends ListenersContainer
|
||||
/**
|
||||
* @return the fCollisionRadius
|
||||
*/
|
||||
public double getfCollisionRadius()
|
||||
public float getFCollisionRadius()
|
||||
{
|
||||
return _fCollisionRadius;
|
||||
}
|
||||
@@ -530,7 +530,7 @@ public class CreatureTemplate extends ListenersContainer
|
||||
/**
|
||||
* @return the fCollisionHeight
|
||||
*/
|
||||
public double getfCollisionHeight()
|
||||
public float getFCollisionHeight()
|
||||
{
|
||||
return _fCollisionHeight;
|
||||
}
|
||||
|
@@ -112,8 +112,8 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
|
||||
private Set<Integer> _ignoreClanNpcIds;
|
||||
private CopyOnWriteArrayList<DropHolder> _dropListDeath;
|
||||
private CopyOnWriteArrayList<DropHolder> _dropListSpoil;
|
||||
private double _collisionRadiusGrown;
|
||||
private double _collisionHeightGrown;
|
||||
private float _collisionRadiusGrown;
|
||||
private float _collisionHeightGrown;
|
||||
private int _mpRewardValue;
|
||||
private MpRewardType _mpRewardType;
|
||||
private int _mpRewardTicks;
|
||||
@@ -196,8 +196,8 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
|
||||
_maxSkillChance = set.getInt("maxSkillChance", 15);
|
||||
_hitTimeFactor = set.getInt("hitTime", 100) / 100d;
|
||||
_hitTimeFactorSkill = set.getInt("hitTimeSkill", 100) / 100d;
|
||||
_collisionRadiusGrown = set.getDouble("collisionRadiusGrown", 0);
|
||||
_collisionHeightGrown = set.getDouble("collisionHeightGrown", 0);
|
||||
_collisionRadiusGrown = set.getFloat("collisionRadiusGrown", 0);
|
||||
_collisionHeightGrown = set.getFloat("collisionHeightGrown", 0);
|
||||
_mpRewardValue = set.getInt("mpRewardValue", 0);
|
||||
_mpRewardType = set.getEnum("mpRewardType", MpRewardType.class, MpRewardType.DIFF);
|
||||
_mpRewardTicks = set.getInt("mpRewardTicks", 0);
|
||||
@@ -937,12 +937,12 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
|
||||
return null;
|
||||
}
|
||||
|
||||
public double getCollisionRadiusGrown()
|
||||
public float getCollisionRadiusGrown()
|
||||
{
|
||||
return _collisionRadiusGrown;
|
||||
}
|
||||
|
||||
public double getCollisionHeightGrown()
|
||||
public float getCollisionHeightGrown()
|
||||
{
|
||||
return _collisionHeightGrown;
|
||||
}
|
||||
|
@@ -42,8 +42,8 @@ public class PlayerTemplate extends CreatureTemplate
|
||||
private final double[] _baseMpReg;
|
||||
private final double[] _baseCpReg;
|
||||
|
||||
private final double _fCollisionHeightFemale;
|
||||
private final double _fCollisionRadiusFemale;
|
||||
private final float _fCollisionHeightFemale;
|
||||
private final float _fCollisionRadiusFemale;
|
||||
|
||||
private final int _baseSafeFallHeight;
|
||||
|
||||
@@ -76,8 +76,8 @@ public class PlayerTemplate extends CreatureTemplate
|
||||
_baseSlotDef.put(Inventory.PAPERDOLL_NECK, set.getInt("baseMDefneck", 0));
|
||||
_baseSlotDef.put(Inventory.PAPERDOLL_HAIR, set.getInt("basePDefhair", 0));
|
||||
|
||||
_fCollisionRadiusFemale = set.getDouble("collisionFemaleradius");
|
||||
_fCollisionHeightFemale = set.getDouble("collisionFemaleheight");
|
||||
_fCollisionRadiusFemale = set.getFloat("collisionFemaleradius");
|
||||
_fCollisionHeightFemale = set.getFloat("collisionFemaleheight");
|
||||
_baseSafeFallHeight = set.getInt("baseSafeFall", 333);
|
||||
_creationPoints = creationPoints;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ public class PlayerTemplate extends CreatureTemplate
|
||||
/**
|
||||
* @return the template collision height for female characters.
|
||||
*/
|
||||
public double getFCollisionHeightFemale()
|
||||
public float getFCollisionHeightFemale()
|
||||
{
|
||||
return _fCollisionHeightFemale;
|
||||
}
|
||||
@@ -215,7 +215,7 @@ public class PlayerTemplate extends CreatureTemplate
|
||||
/**
|
||||
* @return the template collision radius for female characters.
|
||||
*/
|
||||
public double getFCollisionRadiusFemale()
|
||||
public float getFCollisionRadiusFemale()
|
||||
{
|
||||
return _fCollisionRadiusFemale;
|
||||
}
|
||||
|
@@ -202,7 +202,7 @@ public class Transform implements IIdentifiable
|
||||
return _type == TransformType.PURE_STAT;
|
||||
}
|
||||
|
||||
public double getCollisionHeight(Creature creature, double defaultCollisionHeight)
|
||||
public float getCollisionHeight(Creature creature, float defaultCollisionHeight)
|
||||
{
|
||||
final TransformTemplate template = getTemplate(creature);
|
||||
if ((template != null) && (template.getCollisionHeight() != null))
|
||||
@@ -212,7 +212,7 @@ public class Transform implements IIdentifiable
|
||||
return defaultCollisionHeight;
|
||||
}
|
||||
|
||||
public double getCollisionRadius(Creature creature, double defaultCollisionRadius)
|
||||
public float getCollisionRadius(Creature creature, float defaultCollisionRadius)
|
||||
{
|
||||
final TransformTemplate template = getTemplate(creature);
|
||||
if ((template != null) && (template.getCollisionRadius() != null))
|
||||
|
@@ -37,8 +37,8 @@ import org.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
|
||||
*/
|
||||
public class TransformTemplate
|
||||
{
|
||||
private final Double _collisionRadius;
|
||||
private final Double _collisionHeight;
|
||||
private final Float _collisionRadius;
|
||||
private final Float _collisionHeight;
|
||||
private final WeaponType _baseAttackType;
|
||||
private List<SkillHolder> _skills;
|
||||
private List<AdditionalSkillHolder> _additionalSkills;
|
||||
@@ -51,8 +51,8 @@ public class TransformTemplate
|
||||
|
||||
public TransformTemplate(StatSet set)
|
||||
{
|
||||
_collisionRadius = set.contains("radius") ? set.getDouble("radius") : null;
|
||||
_collisionHeight = set.contains("height") ? set.getDouble("height") : null;
|
||||
_collisionRadius = set.contains("radius") ? set.getFloat("radius") : null;
|
||||
_collisionHeight = set.contains("height") ? set.getFloat("height") : null;
|
||||
_baseAttackType = set.getEnum("attackType", WeaponType.class, null);
|
||||
if (set.contains("range"))
|
||||
{
|
||||
@@ -222,7 +222,7 @@ public class TransformTemplate
|
||||
/**
|
||||
* @return collision radius if set, {@code null} otherwise.
|
||||
*/
|
||||
public Double getCollisionRadius()
|
||||
public Float getCollisionRadius()
|
||||
{
|
||||
return _collisionRadius;
|
||||
}
|
||||
@@ -230,7 +230,7 @@ public class TransformTemplate
|
||||
/**
|
||||
* @return collision height if set, {@code null} otherwise.
|
||||
*/
|
||||
public Double getCollisionHeight()
|
||||
public Float getCollisionHeight()
|
||||
{
|
||||
return _collisionHeight;
|
||||
}
|
||||
|
@@ -57,8 +57,8 @@ public class MonRaceInfo implements IClientOutgoingPacket
|
||||
packet.writeD(12080); // end X
|
||||
packet.writeD(181875 + (58 * (7 - i))); // end Y
|
||||
packet.writeD(-3566); // end Z
|
||||
packet.writeF(_monsters[i].getTemplate().getfCollisionHeight()); // coll. height
|
||||
packet.writeF(_monsters[i].getTemplate().getfCollisionRadius()); // coll. radius
|
||||
packet.writeF(_monsters[i].getTemplate().getFCollisionHeight()); // coll. height
|
||||
packet.writeF(_monsters[i].getTemplate().getFCollisionRadius()); // coll. radius
|
||||
packet.writeD(120); // ?? unknown
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
|
@@ -118,8 +118,8 @@ public class PetInfo implements IClientOutgoingPacket
|
||||
|
||||
packet.writeF(_moveMultiplier);
|
||||
packet.writeF(_summon.getAttackSpeedMultiplier()); // attack speed multiplier
|
||||
packet.writeF(_summon.getTemplate().getfCollisionRadius());
|
||||
packet.writeF(_summon.getTemplate().getfCollisionHeight());
|
||||
packet.writeF(_summon.getTemplate().getFCollisionRadius());
|
||||
packet.writeF(_summon.getTemplate().getFCollisionHeight());
|
||||
|
||||
packet.writeD(_summon.getWeapon()); // right hand weapon
|
||||
packet.writeD(_summon.getArmor()); // body armor
|
||||
|
Reference in New Issue
Block a user