There is no need to check transformations.

This commit is contained in:
MobiusDev
2018-05-15 14:44:26 +00:00
parent 5dd6dcd18a
commit 1926a69233
16 changed files with 139 additions and 255 deletions
@@ -467,11 +467,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
public void untransform() public void untransform()
{ {
if (isPlayer() && getActingPlayer().isFlyingMounted() && !getActingPlayer().canDismount())
{
return;
}
_transform.ifPresent(t -> t.onUntransform(this)); _transform.ifPresent(t -> t.onUntransform(this));
_transform = Optional.empty(); _transform = Optional.empty();
@@ -6138,31 +6138,6 @@ public final class L2PcInstance extends L2Playable
} }
public boolean dismount() public boolean dismount()
{
if (!canDismount())
{
return false;
}
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true;
}
public boolean canDismount()
{ {
L2WaterZone water = null; L2WaterZone water = null;
for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300)) for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300))
@@ -6197,6 +6172,22 @@ public final class L2PcInstance extends L2Playable
} }
}, 1500); }, 1500);
} }
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true; return true;
} }
@@ -467,11 +467,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
public void untransform() public void untransform()
{ {
if (isPlayer() && getActingPlayer().isFlyingMounted() && !getActingPlayer().canDismount())
{
return;
}
_transform.ifPresent(t -> t.onUntransform(this)); _transform.ifPresent(t -> t.onUntransform(this));
_transform = Optional.empty(); _transform = Optional.empty();
@@ -6144,31 +6144,6 @@ public final class L2PcInstance extends L2Playable
} }
public boolean dismount() public boolean dismount()
{
if (!canDismount())
{
return false;
}
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true;
}
public boolean canDismount()
{ {
L2WaterZone water = null; L2WaterZone water = null;
for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300)) for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300))
@@ -6203,6 +6178,22 @@ public final class L2PcInstance extends L2Playable
} }
}, 1500); }, 1500);
} }
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true; return true;
} }
@@ -467,11 +467,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
public void untransform() public void untransform()
{ {
if (isPlayer() && getActingPlayer().isFlyingMounted() && !getActingPlayer().canDismount())
{
return;
}
_transform.ifPresent(t -> t.onUntransform(this)); _transform.ifPresent(t -> t.onUntransform(this));
_transform = Optional.empty(); _transform = Optional.empty();
@@ -6146,31 +6146,6 @@ public final class L2PcInstance extends L2Playable
} }
public boolean dismount() public boolean dismount()
{
if (!canDismount())
{
return false;
}
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true;
}
public boolean canDismount()
{ {
L2WaterZone water = null; L2WaterZone water = null;
for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300)) for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300))
@@ -6205,6 +6180,22 @@ public final class L2PcInstance extends L2Playable
} }
}, 1500); }, 1500);
} }
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true; return true;
} }
@@ -467,11 +467,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
public void untransform() public void untransform()
{ {
if (isPlayer() && getActingPlayer().isFlyingMounted() && !getActingPlayer().canDismount())
{
return;
}
_transform.ifPresent(t -> t.onUntransform(this)); _transform.ifPresent(t -> t.onUntransform(this));
_transform = Optional.empty(); _transform = Optional.empty();
@@ -6143,31 +6143,6 @@ public final class L2PcInstance extends L2Playable
} }
public boolean dismount() public boolean dismount()
{
if (!canDismount())
{
return false;
}
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true;
}
public boolean canDismount()
{ {
L2WaterZone water = null; L2WaterZone water = null;
for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300)) for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300))
@@ -6202,6 +6177,22 @@ public final class L2PcInstance extends L2Playable
} }
}, 1500); }, 1500);
} }
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true; return true;
} }
@@ -17728,26 +17728,6 @@ public final class L2PcInstance extends L2Playable
* @return true, if successful * @return true, if successful
*/ */
public boolean dismount() public boolean dismount()
{
if (!canDismount())
{
return false;
}
final boolean wasFlying = isFlying();
setMountType(0);
if (wasFlying)
{
removeSkill(SkillTable.getInstance().getInfo(4289, 1));
}
Ride dismount = new Ride(getObjectId(), Ride.ACTION_DISMOUNT, 0);
broadcastPacket(dismount);
setMountObjectID(0);
broadcastUserInfo();
return true;
}
private boolean canDismount()
{ {
if (FishingZoneManager.getInstance().isInsideWaterZone(getX(), getY(), getZ() - 300) == null) if (FishingZoneManager.getInstance().isInsideWaterZone(getX(), getY(), getZ() - 300) == null)
{ {
@@ -17774,6 +17754,17 @@ public final class L2PcInstance extends L2Playable
} }
}, 1500); }, 1500);
} }
final boolean wasFlying = isFlying();
setMountType(0);
if (wasFlying)
{
removeSkill(SkillTable.getInstance().getInfo(4289, 1));
}
Ride dismount = new Ride(getObjectId(), Ride.ACTION_DISMOUNT, 0);
broadcastPacket(dismount);
setMountObjectID(0);
broadcastUserInfo();
return true; return true;
} }
@@ -4664,7 +4664,7 @@ public final class L2PcInstance extends L2Playable
@Override @Override
public void untransform() public void untransform()
{ {
if ((_transformation == null) || (isFlyingMounted() && !canDismount())) if (_transformation == null)
{ {
return; return;
} }
@@ -6372,30 +6372,6 @@ public final class L2PcInstance extends L2Playable
} }
public boolean dismount() public boolean dismount()
{
if (!canDismount())
{
return false;
}
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true;
}
private boolean canDismount()
{ {
L2WaterZone water = null; L2WaterZone water = null;
for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300)) for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300))
@@ -6430,6 +6406,21 @@ public final class L2PcInstance extends L2Playable
} }
}, 1500); }, 1500);
} }
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true; return true;
} }
@@ -467,11 +467,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
public void untransform() public void untransform()
{ {
if (isPlayer() && getActingPlayer().isFlyingMounted() && !getActingPlayer().canDismount())
{
return;
}
_transform.ifPresent(t -> t.onUntransform(this)); _transform.ifPresent(t -> t.onUntransform(this));
_transform = Optional.empty(); _transform = Optional.empty();
@@ -6110,31 +6110,6 @@ public final class L2PcInstance extends L2Playable
} }
public boolean dismount() public boolean dismount()
{
if (!canDismount())
{
return false;
}
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true;
}
public boolean canDismount()
{ {
L2WaterZone water = null; L2WaterZone water = null;
for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300)) for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300))
@@ -6169,6 +6144,22 @@ public final class L2PcInstance extends L2Playable
} }
}, 1500); }, 1500);
} }
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true; return true;
} }
@@ -467,11 +467,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
public void untransform() public void untransform()
{ {
if (isPlayer() && getActingPlayer().isFlyingMounted() && !getActingPlayer().canDismount())
{
return;
}
_transform.ifPresent(t -> t.onUntransform(this)); _transform.ifPresent(t -> t.onUntransform(this));
_transform = Optional.empty(); _transform = Optional.empty();
@@ -6110,31 +6110,6 @@ public final class L2PcInstance extends L2Playable
} }
public boolean dismount() public boolean dismount()
{
if (!canDismount())
{
return false;
}
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true;
}
public boolean canDismount()
{ {
L2WaterZone water = null; L2WaterZone water = null;
for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300)) for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300))
@@ -6169,6 +6144,22 @@ public final class L2PcInstance extends L2Playable
} }
}, 1500); }, 1500);
} }
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true; return true;
} }
@@ -467,11 +467,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
public void untransform() public void untransform()
{ {
if (isPlayer() && getActingPlayer().isFlyingMounted() && !getActingPlayer().canDismount())
{
return;
}
_transform.ifPresent(t -> t.onUntransform(this)); _transform.ifPresent(t -> t.onUntransform(this));
_transform = Optional.empty(); _transform = Optional.empty();
@@ -6112,31 +6112,6 @@ public final class L2PcInstance extends L2Playable
} }
public boolean dismount() public boolean dismount()
{
if (!canDismount())
{
return false;
}
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true;
}
public boolean canDismount()
{ {
L2WaterZone water = null; L2WaterZone water = null;
for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300)) for (L2ZoneType zone : ZoneManager.getInstance().getZones(getX(), getY(), getZ() - 300))
@@ -6171,6 +6146,22 @@ public final class L2PcInstance extends L2Playable
} }
}, 1500); }, 1500);
} }
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
clearPetData();
if (wasFlying)
{
removeSkill(CommonSkill.WYVERN_BREATH.getSkill());
}
broadcastPacket(new Ride(this));
setMountObjectID(0);
storePetFood(petId);
// Notify self and others about speed change
broadcastUserInfo();
return true; return true;
} }