Addition of RequestSkillCoolTime.
Thanks to Fakee.
This commit is contained in:
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -163,7 +163,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -163,7 +163,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -98,11 +98,13 @@ public class Timestamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,11 +118,13 @@ public class Timestamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -98,11 +98,13 @@ public class Timestamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,11 +118,13 @@ public class Timestamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,9 +26,11 @@ public class RequestSkillCoolTime implements ClientPacket
|
|||||||
public void run(GameClient client)
|
public void run(GameClient client)
|
||||||
{
|
{
|
||||||
final Player player = client.getPlayer();
|
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
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
|
||||||
public Collection<Timestamp> _reuseTimestamps;
|
public Collection<Timestamp> _reuseTimestamps;
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
_reuseTimestamps = player.getReuseTimeStamps();
|
_reuseTimestamps = player.getReuseTimeStamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_reuseTimestamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (Timestamp ts : _reuseTimestamps)
|
for (Timestamp ts : _reuseTimestamps)
|
||||||
@@ -47,7 +46,7 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(ts.getSkillLevel());
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -142,11 +142,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,11 +162,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,9 +26,11 @@ public class RequestSkillCoolTime implements ClientPacket
|
|||||||
public void run(GameClient client)
|
public void run(GameClient client)
|
||||||
{
|
{
|
||||||
final Player player = client.getPlayer();
|
final Player player = client.getPlayer();
|
||||||
if (player != null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
player.sendPacket(new SkillCoolTime(player));
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.TimeStamp;
|
import org.l2jmobius.gameserver.model.TimeStamp;
|
||||||
@@ -29,17 +29,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if (_currentTime < ts.getStamp())
|
if (ts.hasNotPassed())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,14 +45,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(ts.getSkillLevel());
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -142,11 +142,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,11 +162,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -157,7 +157,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.TimeStamp;
|
import org.l2jmobius.gameserver.model.TimeStamp;
|
||||||
@@ -29,17 +29,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if (_currentTime < ts.getStamp())
|
if (ts.hasNotPassed())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,14 +45,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(ts.getSkillLevel());
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -142,11 +142,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,11 +162,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -157,7 +157,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.TimeStamp;
|
import org.l2jmobius.gameserver.model.TimeStamp;
|
||||||
@@ -29,17 +29,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if (_currentTime < ts.getStamp())
|
if (ts.hasNotPassed())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,14 +45,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(ts.getSkillLevel());
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -162,7 +162,7 @@ public enum ClientPackets
|
|||||||
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
SET_PRIVATE_STORE_MSG_BUY(0x9D, SetPrivateStoreMsgBuy::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
REQUEST_PRIVATE_STORE_SELL(0x9F, RequestPrivateStoreSell::new, ConnectionState.IN_GAME),
|
||||||
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
SEND_TIME_CHECK_PACKET(0xA0, null, ConnectionState.IN_GAME),
|
||||||
REQUEST_SKILL_COOL_TIME(0xA6, null, ConnectionState.IN_GAME),
|
REQUEST_SKILL_COOL_TIME(0xA6, RequestSkillCoolTime::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SENDABLE_ITEM_LIST(0xA7, RequestPackageSendableItemList::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
REQUEST_PACKAGE_SEND(0xA8, RequestPackageSend::new, ConnectionState.IN_GAME),
|
||||||
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
REQUEST_BLOCK(0xA9, RequestBlock::new, ConnectionState.IN_GAME),
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.l2jmobius.gameserver.network.clientpackets;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
|
||||||
|
|
||||||
|
public class RequestSkillCoolTime implements ClientPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final Player player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendPacket(new SkillCoolTime(player));
|
||||||
|
}
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
@@ -30,17 +30,15 @@ import org.l2jmobius.gameserver.network.ServerPackets;
|
|||||||
*/
|
*/
|
||||||
public class SkillCoolTime extends ServerPacket
|
public class SkillCoolTime extends ServerPacket
|
||||||
{
|
{
|
||||||
private final long _currentTime;
|
private final List<TimeStamp> _reuseTimestamps = new LinkedList<>();
|
||||||
private final List<TimeStamp> _skillReuseTimeStamps = new ArrayList<>();
|
|
||||||
|
|
||||||
public SkillCoolTime(Player player)
|
public SkillCoolTime(Player player)
|
||||||
{
|
{
|
||||||
_currentTime = System.currentTimeMillis();
|
|
||||||
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
for (TimeStamp ts : player.getSkillReuseTimeStamps().values())
|
||||||
{
|
{
|
||||||
if ((_currentTime < ts.getStamp()) && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
if (ts.hasNotPassed() && !SkillData.getInstance().getSkill(ts.getSkillId(), ts.getSkillLevel(), ts.getSkillSubLevel()).isNotBroadcastable())
|
||||||
{
|
{
|
||||||
_skillReuseTimeStamps.add(ts);
|
_reuseTimestamps.add(ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,14 +46,15 @@ public class SkillCoolTime extends ServerPacket
|
|||||||
@Override
|
@Override
|
||||||
public void write()
|
public void write()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
ServerPackets.SKILL_COOL_TIME.writeId(this);
|
||||||
writeInt(_skillReuseTimeStamps.size());
|
writeInt(_reuseTimestamps.size());
|
||||||
for (TimeStamp ts : _skillReuseTimeStamps)
|
for (TimeStamp ts : _reuseTimestamps)
|
||||||
{
|
{
|
||||||
writeInt(ts.getSkillId());
|
writeInt(ts.getSkillId());
|
||||||
writeInt(0); // ?
|
writeInt(ts.getSkillLevel());
|
||||||
writeInt((int) ts.getReuse() / 1000);
|
writeInt((int) ts.getReuse() / 1000);
|
||||||
writeInt((int) Math.max(ts.getStamp() - _currentTime, 0) / 1000);
|
writeInt((int) Math.max(ts.getStamp() - currentTime, 0) / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -155,11 +155,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||||
if (remainingTime == 0)
|
if (remainingTime == 0)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return remainingTime;
|
return remainingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +175,13 @@ public class TimeStamp
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||||
if (!hasNotPassed)
|
if (!hasNotPassed)
|
||||||
{
|
{
|
||||||
_stamp = 0;
|
_stamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasNotPassed;
|
return hasNotPassed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user