Addition of RequestSkillCoolTime.
Thanks to Fakee.
This commit is contained in:
@@ -98,11 +98,13 @@ public class Timestamp
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||
if (remainingTime == 0)
|
||||
{
|
||||
_stamp = 0;
|
||||
}
|
||||
|
||||
return remainingTime;
|
||||
}
|
||||
|
||||
@@ -116,11 +118,13 @@ public class Timestamp
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||
if (!hasNotPassed)
|
||||
{
|
||||
_stamp = 0;
|
||||
}
|
||||
|
||||
return hasNotPassed;
|
||||
}
|
||||
}
|
||||
|
@@ -26,9 +26,11 @@ public class RequestSkillCoolTime implements ClientPacket
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final Player player = client.getPlayer();
|
||||
if (player != null)
|
||||
if (player == null)
|
||||
{
|
||||
player.sendPacket(new SkillCoolTime(player));
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new SkillCoolTime(player));
|
||||
}
|
||||
}
|
@@ -28,18 +28,17 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
||||
*/
|
||||
public class SkillCoolTime extends ServerPacket
|
||||
{
|
||||
private final long _currentTime;
|
||||
public Collection<Timestamp> _reuseTimestamps;
|
||||
|
||||
public SkillCoolTime(Player player)
|
||||
{
|
||||
_currentTime = System.currentTimeMillis();
|
||||
_reuseTimestamps = player.getReuseTimeStamps();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write()
|
||||
{
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||
writeInt(_reuseTimestamps.size());
|
||||
for (Timestamp ts : _reuseTimestamps)
|
||||
@@ -47,7 +46,7 @@ public class SkillCoolTime extends ServerPacket
|
||||
writeInt(ts.getSkillId());
|
||||
writeInt(ts.getSkillLevel());
|
||||
writeInt((int) ts.getReuse() / 1000);
|
||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
||||
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user