Timed Hunting Zone UI improvements.

Contributed by Index.
This commit is contained in:
MobiusDevelopment
2021-10-20 14:06:21 +00:00
parent 7cb1075e2b
commit aa84c8ce99
42 changed files with 390 additions and 66 deletions

View File

@@ -26,6 +26,7 @@ import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
/**
@@ -76,6 +77,7 @@ public class AddHuntingTime extends AbstractEffect
{
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, _time + player.getTimedHuntingZoneRemainingTime(_zoneId));
player.startTimedHuntingZone(_zoneId, endTime);
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
}
else
{

View File

@@ -14627,9 +14627,7 @@ public class PlayerInstance extends Playable
// Stop previous task.
stopTimedHuntingZoneTask();
// TODO: Delay window.
// sendPacket(new TimedHuntingZoneEnter((int) (delay / 60 / 1000)));
sendMessage("You have " + (delay / 60 / 1000) + " minutes left for this timed zone.");
// sendMessage("You have " + (delay / 60 / 1000) + " minutes left for this timed zone.");
_timedHuntingZoneTask = ThreadPool.scheduleAtFixedRate(() ->
{
if (isInTimedHuntingZone(zoneId))

View File

@@ -840,7 +840,7 @@ public enum OutgoingPackets
EX_TIME_RESTRICT_FIELD_USER_ENTER(0xFE, 0x22A),
EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT(0xFE, 0x22B),
EX_TIME_RESTRICT_FIELD_USER_ALARM(0xFE, 0x22C),
EX_TIME_RESTRICT_FIELD_USER_EXIT(0xFE, 0x22D),
EX_TIME_RESTRICT_FIELD_USER_CLOSE(0xFE, 0x22D),
EX_RANKING_CHAR_INFO(0xFE, 0x22E),
EX_RANKING_CHAR_HISTORY(0xFE, 0x22F),
EX_RANKING_CHAR_RANKERS(0xFE, 0x230),

View File

@@ -30,6 +30,8 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
/**
* @author Mobius
@@ -151,11 +153,15 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
if (instanceId == 0)
{
player.teleToLocation(holder.getEnterLocation());
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
}
else // Transcendent zones.
{
QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + _zoneId, null, player);
}
// Close window.
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
}
else
{

View File

@@ -0,0 +1,40 @@
/*
* 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.serverpackets.huntingzones;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Mobius
*/
public class TimedHuntingZoneClose implements IClientOutgoingPacket
{
public static final TimedHuntingZoneClose STATIC_PACKET = new TimedHuntingZoneClose();
public TimedHuntingZoneClose()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CLOSE.writeId(packet);
return true;
}
}

View File

@@ -17,26 +17,33 @@
package org.l2jmobius.gameserver.network.serverpackets.huntingzones;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.commons.util.Chronos;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Mobius
* @author Mobius, Index, NasSeKa`, Serenitty
*/
public class TimedHuntingZoneEnter implements IClientOutgoingPacket
{
private final int _remainingTime;
private final PlayerInstance _player;
private final int _zoneId;
public TimedHuntingZoneEnter(int remainingTime)
public TimedHuntingZoneEnter(PlayerInstance player, int zoneId)
{
_remainingTime = remainingTime;
_player = player;
_zoneId = zoneId;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
packet.writeC(_remainingTime);
packet.writeC(0x01); // bEnterSuccess
packet.writeD(_zoneId);
packet.writeD((int) ((Chronos.currentTimeMillis() / 60) / 1000)); // nEnterTimeStamp (current time in minutes)
packet.writeD(_player.getTimedHuntingZoneRemainingTime(_zoneId) / 1000); // nRemainTime (zone left time)
return true;
}
}

View File

@@ -21,7 +21,7 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Mobius
* @author Mobius, Index
*/
public class TimedHuntingZoneExit implements IClientOutgoingPacket
{
@@ -34,7 +34,8 @@ public class TimedHuntingZoneExit implements IClientOutgoingPacket
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_EXIT.writeId(packet);
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
packet.writeC(0x00); // bEnterSuccess
return true;
}
}