ExEnterWorld improvements.
Contributed by Mode.
This commit is contained in:
@@ -16,6 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.zone.ZoneRules;
|
||||||
|
|
||||||
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
|
|
||||||
@@ -24,18 +29,27 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|||||||
*/
|
*/
|
||||||
public class ExEnterWorld implements IClientOutgoingPacket
|
public class ExEnterWorld implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
|
private final int _zoneIdOffsetSeconds;
|
||||||
|
private final int _epochInSeconds;
|
||||||
|
private final int _daylight;
|
||||||
|
|
||||||
public ExEnterWorld()
|
public ExEnterWorld()
|
||||||
{
|
{
|
||||||
|
Instant now = Instant.now();
|
||||||
|
_epochInSeconds = (int) now.getEpochSecond();
|
||||||
|
ZoneRules rules = ZoneId.systemDefault().getRules();
|
||||||
|
_zoneIdOffsetSeconds = rules.getStandardOffset(now).getTotalSeconds();
|
||||||
|
_daylight = (int) rules.getDaylightSavings(now).toSeconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_ENTER_WORLD.writeId(packet);
|
OutgoingPackets.EX_ENTER_WORLD.writeId(packet);
|
||||||
packet.writeD((int) (System.currentTimeMillis() / 1000));
|
packet.writeD(_epochInSeconds);
|
||||||
packet.writeD(0x00);
|
packet.writeD(-_zoneIdOffsetSeconds);
|
||||||
packet.writeD(0x00);
|
packet.writeD(_daylight);
|
||||||
packet.writeD(0x00);
|
packet.writeD(Config.SERVER_ID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -16,6 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.zone.ZoneRules;
|
||||||
|
|
||||||
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
|
|
||||||
@@ -24,18 +29,27 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|||||||
*/
|
*/
|
||||||
public class ExEnterWorld implements IClientOutgoingPacket
|
public class ExEnterWorld implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
|
private final int _zoneIdOffsetSeconds;
|
||||||
|
private final int _epochInSeconds;
|
||||||
|
private final int _daylight;
|
||||||
|
|
||||||
public ExEnterWorld()
|
public ExEnterWorld()
|
||||||
{
|
{
|
||||||
|
Instant now = Instant.now();
|
||||||
|
_epochInSeconds = (int) now.getEpochSecond();
|
||||||
|
ZoneRules rules = ZoneId.systemDefault().getRules();
|
||||||
|
_zoneIdOffsetSeconds = rules.getStandardOffset(now).getTotalSeconds();
|
||||||
|
_daylight = (int) rules.getDaylightSavings(now).toSeconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_ENTER_WORLD.writeId(packet);
|
OutgoingPackets.EX_ENTER_WORLD.writeId(packet);
|
||||||
packet.writeD((int) (System.currentTimeMillis() / 1000));
|
packet.writeD(_epochInSeconds);
|
||||||
packet.writeD(0x00);
|
packet.writeD(-_zoneIdOffsetSeconds);
|
||||||
packet.writeD(0x00);
|
packet.writeD(_daylight);
|
||||||
packet.writeD(0x00);
|
packet.writeD(Config.SERVER_ID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -16,6 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.zone.ZoneRules;
|
||||||
|
|
||||||
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
|
|
||||||
@@ -24,18 +29,27 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|||||||
*/
|
*/
|
||||||
public class ExEnterWorld implements IClientOutgoingPacket
|
public class ExEnterWorld implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
|
private final int _zoneIdOffsetSeconds;
|
||||||
|
private final int _epochInSeconds;
|
||||||
|
private final int _daylight;
|
||||||
|
|
||||||
public ExEnterWorld()
|
public ExEnterWorld()
|
||||||
{
|
{
|
||||||
|
Instant now = Instant.now();
|
||||||
|
_epochInSeconds = (int) now.getEpochSecond();
|
||||||
|
ZoneRules rules = ZoneId.systemDefault().getRules();
|
||||||
|
_zoneIdOffsetSeconds = rules.getStandardOffset(now).getTotalSeconds();
|
||||||
|
_daylight = (int) rules.getDaylightSavings(now).toSeconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_ENTER_WORLD.writeId(packet);
|
OutgoingPackets.EX_ENTER_WORLD.writeId(packet);
|
||||||
packet.writeD((int) (System.currentTimeMillis() / 1000));
|
packet.writeD(_epochInSeconds);
|
||||||
packet.writeD(0x00);
|
packet.writeD(-_zoneIdOffsetSeconds);
|
||||||
packet.writeD(0x00);
|
packet.writeD(_daylight);
|
||||||
packet.writeD(0x00);
|
packet.writeD(Config.SERVER_ID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -16,6 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.zone.ZoneRules;
|
||||||
|
|
||||||
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
|
|
||||||
@@ -24,18 +29,27 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|||||||
*/
|
*/
|
||||||
public class ExEnterWorld implements IClientOutgoingPacket
|
public class ExEnterWorld implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
|
private final int _zoneIdOffsetSeconds;
|
||||||
|
private final int _epochInSeconds;
|
||||||
|
private final int _daylight;
|
||||||
|
|
||||||
public ExEnterWorld()
|
public ExEnterWorld()
|
||||||
{
|
{
|
||||||
|
Instant now = Instant.now();
|
||||||
|
_epochInSeconds = (int) now.getEpochSecond();
|
||||||
|
ZoneRules rules = ZoneId.systemDefault().getRules();
|
||||||
|
_zoneIdOffsetSeconds = rules.getStandardOffset(now).getTotalSeconds();
|
||||||
|
_daylight = (int) rules.getDaylightSavings(now).toSeconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_ENTER_WORLD.writeId(packet);
|
OutgoingPackets.EX_ENTER_WORLD.writeId(packet);
|
||||||
packet.writeD((int) (System.currentTimeMillis() / 1000));
|
packet.writeD(_epochInSeconds);
|
||||||
packet.writeD(0x00);
|
packet.writeD(-_zoneIdOffsetSeconds);
|
||||||
packet.writeD(0x00);
|
packet.writeD(_daylight);
|
||||||
packet.writeD(0x00);
|
packet.writeD(Config.SERVER_ID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user