Addition of TimeRestrictFieldDieLimitTime and TimeRestrictFieldUserAlarm.
Thanks to nasseka.
This commit is contained in:
@@ -25,8 +25,8 @@ import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimeRestrictFieldUserAlarm;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneChargeResult;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ public class AddHuntingTime extends AbstractEffect
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) > holder.getMaximumAddedTime()))
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
player.sendMessage("You cannot exceed the time zone limit.");
|
||||
@@ -88,12 +88,10 @@ public class AddHuntingTime extends AbstractEffect
|
||||
if (player.isInTimedHuntingZone(_zoneId))
|
||||
{
|
||||
player.startTimedHuntingZone(_zoneId, endTime);
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
player.sendPacket(new TimeRestrictFieldUserAlarm(player, _zoneId));
|
||||
}
|
||||
|
||||
player.sendPacket(new TimedHuntingZoneChargeResult(_zoneId, (int) (remainTime / 1000), (int) ((remainTime + _time) / 1000), (int) _time / 1000));
|
||||
player.sendPacket(new TimedHuntingZoneList(player));
|
||||
|
||||
// TODO: TimedHuntingZoneChargeResult
|
||||
player.sendPacket(new ExShowScreenMessage("Time of adventure in the " + holder.getZoneName() + " area is extended for " + (_time / 60 / 1000) + " min.", 10000));
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author NasSeKa
|
||||
*/
|
||||
public class TimeRestrictFieldUserAlarm implements IClientOutgoingPacket
|
||||
{
|
||||
private final Player _player;
|
||||
private final int _zoneId;
|
||||
|
||||
public TimeRestrictFieldUserAlarm(Player player, int zoneId)
|
||||
{
|
||||
_player = player;
|
||||
_zoneId = zoneId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ALARM.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
packet.writeD(_player.getTimedHuntingZoneRemainingTime(_zoneId) / 1000); // RemainTime (zone left time)
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -21,19 +21,21 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author dontknowdontcare
|
||||
* @author NasSeKa
|
||||
*/
|
||||
public class TimedHuntingZoneChargeResult implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _zoneId;
|
||||
private final int _secondsLeft;
|
||||
private final int _newExtensionValue;
|
||||
private final int _remainTime;
|
||||
private final int _refillTime;
|
||||
private final int _chargeTime;
|
||||
|
||||
public TimedHuntingZoneChargeResult(int zoneId, int secondsLeft, int newExtensionValue)
|
||||
public TimedHuntingZoneChargeResult(int zoneId, int remainTime, int refillTime, int chargeTime)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
_secondsLeft = secondsLeft;
|
||||
_newExtensionValue = newExtensionValue;
|
||||
_remainTime = remainTime;
|
||||
_refillTime = refillTime;
|
||||
_chargeTime = chargeTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,8 +43,9 @@ public class TimedHuntingZoneChargeResult implements IClientOutgoingPacket
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
packet.writeD(_secondsLeft); // Remaining Time in zone.
|
||||
packet.writeD(_newExtensionValue); // New Extension value.
|
||||
packet.writeD(_remainTime);
|
||||
packet.writeD(_refillTime);
|
||||
packet.writeD(_chargeTime);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -41,8 +41,8 @@ public class TimedHuntingZoneEnter implements IClientOutgoingPacket
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
|
||||
packet.writeC(1); // bEnterSuccess
|
||||
packet.writeD(_zoneId);
|
||||
packet.writeD((int) ((System.currentTimeMillis() / 60) / 1000)); // nEnterTimeStamp (current time in minutes)
|
||||
packet.writeD(_player.getTimedHuntingZoneRemainingTime(_zoneId) / 1000); // nRemainTime (zone left time)
|
||||
packet.writeD((int) (System.currentTimeMillis() / 1000)); // nEnterTimeStamp
|
||||
packet.writeD((_player.getTimedHuntingZoneRemainingTime(_zoneId) / 1000) + 59); // nRemainTime (zone left time)
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user