Addition of TimeRestrictFieldDieLimitTime and TimeRestrictFieldUserAlarm.

Thanks to nasseka.
This commit is contained in:
MobiusDevelopment 2022-08-30 22:50:06 +00:00
parent ed5b923658
commit f044766abb
40 changed files with 650 additions and 146 deletions

View File

@ -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));
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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));
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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));
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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));
}
}

View File

@ -570,10 +570,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
*/
public void onDecay()
{
if (Config.DISCONNECT_AFTER_DEATH && isPlayer())
if (isPlayer())
{
if (isInsideZone(ZoneId.TIMED_HUNTING))
{
getActingPlayer().stopTimedHuntingZoneTask();
abortCast();
stopMove(null);
teleToLocation(MapRegionManager.getInstance().getTeleToLocation(this, TeleportWhereType.TOWN));
setInstance(null);
}
else if (Config.DISCONNECT_AFTER_DEATH)
{
Disconnection.of(getActingPlayer()).deleteMe().defaultSequence(new SystemMessage(SystemMessageId.SIXTY_MIN_HAVE_PASSED_AFTER_THE_DEATH_OF_YOUR_CHARACTER_SO_YOU_WERE_DISCONNECTED_FROM_THE_GAME));
}
}
else
{
decayMe();

View File

@ -366,6 +366,7 @@ import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExActivateAutoSho
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
import org.l2jmobius.gameserver.network.serverpackets.commission.ExResponseCommissionInfo;
import org.l2jmobius.gameserver.network.serverpackets.friend.FriendStatus;
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimeRestrictFieldDieLimitTime;
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExBloodyCoinCount;
import org.l2jmobius.gameserver.network.serverpackets.olympiad.ExOlympiadMode;
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
@ -5089,7 +5090,12 @@ public class Player extends Playable
setReputation(newRep < -20 ? newRep : 0);
}
if (Config.DISCONNECT_AFTER_DEATH)
if (isInsideZone(ZoneId.TIMED_HUNTING))
{
DecayTaskManager.getInstance().add(this);
sendPacket(new TimeRestrictFieldDieLimitTime());
}
else if (Config.DISCONNECT_AFTER_DEATH)
{
DecayTaskManager.getInstance().add(this);
}

View File

@ -0,0 +1,39 @@
/*
* 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 NasSeKa
*/
public class TimeRestrictFieldDieLimitTime implements IClientOutgoingPacket
{
public TimeRestrictFieldDieLimitTime()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_TIME_RESTRICT_FIELD_DIE_LIMT_TIME.writeId(packet);
packet.writeD(600); // RemainTime (zone left time)
return true;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -25,6 +25,7 @@ import org.l2jmobius.commons.threads.ThreadPool;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
/**
* @author Mobius
@ -89,10 +90,17 @@ public class DecayTaskManager implements Runnable
delay += Config.SPOILED_CORPSE_EXTEND_TIME;
}
if (Config.DISCONNECT_AFTER_DEATH && creature.isPlayer())
if (creature.isPlayer())
{
if (Config.DISCONNECT_AFTER_DEATH)
{
delay = 3600; // 1 hour
}
if (creature.isInsideZone(ZoneId.TIMED_HUNTING))
{
delay = 60; // 10 minutes
}
}
// Add to decay schedules.
DECAY_SCHEDULES.put(creature, System.currentTimeMillis() + (delay * 1000));

View File

@ -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));
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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));
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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));
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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));
}
}

View File

@ -571,10 +571,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
*/
public void onDecay()
{
if (Config.DISCONNECT_AFTER_DEATH && isPlayer())
if (isPlayer())
{
if (isInsideZone(ZoneId.TIMED_HUNTING))
{
getActingPlayer().stopTimedHuntingZoneTask();
abortCast();
stopMove(null);
teleToLocation(MapRegionManager.getInstance().getTeleToLocation(this, TeleportWhereType.TOWN));
setInstance(null);
}
else if (Config.DISCONNECT_AFTER_DEATH)
{
Disconnection.of(getActingPlayer()).deleteMe().defaultSequence(new SystemMessage(SystemMessageId.SIXTY_MIN_HAVE_PASSED_AFTER_THE_DEATH_OF_YOUR_CHARACTER_SO_YOU_WERE_DISCONNECTED_FROM_THE_GAME));
}
}
else
{
decayMe();

View File

@ -383,6 +383,7 @@ import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySetting
import org.l2jmobius.gameserver.network.serverpackets.commission.ExResponseCommissionInfo;
import org.l2jmobius.gameserver.network.serverpackets.elementalspirits.ElementalSpiritInfo;
import org.l2jmobius.gameserver.network.serverpackets.friend.FriendStatus;
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimeRestrictFieldDieLimitTime;
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExBloodyCoinCount;
import org.l2jmobius.gameserver.network.serverpackets.pet.PetInfo;
import org.l2jmobius.gameserver.network.serverpackets.vip.ReceiveVipInfo;
@ -5099,7 +5100,12 @@ public class Player extends Playable
setReputation(newRep < -20 ? newRep : 0);
}
if (Config.DISCONNECT_AFTER_DEATH)
if (isInsideZone(ZoneId.TIMED_HUNTING))
{
DecayTaskManager.getInstance().add(this);
sendPacket(new TimeRestrictFieldDieLimitTime());
}
else if (Config.DISCONNECT_AFTER_DEATH)
{
DecayTaskManager.getInstance().add(this);
}

View File

@ -0,0 +1,39 @@
/*
* 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 NasSeKa
*/
public class TimeRestrictFieldDieLimitTime implements IClientOutgoingPacket
{
public TimeRestrictFieldDieLimitTime()
{
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_TIME_RESTRICT_FIELD_DIE_LIMT_TIME.writeId(packet);
packet.writeD(600); // RemainTime (zone left time)
return true;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -25,6 +25,7 @@ import org.l2jmobius.commons.threads.ThreadPool;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
/**
* @author Mobius
@ -97,10 +98,17 @@ public class DecayTaskManager implements Runnable
delay += Config.SPOILED_CORPSE_EXTEND_TIME;
}
if (Config.DISCONNECT_AFTER_DEATH && creature.isPlayer())
if (creature.isPlayer())
{
if (Config.DISCONNECT_AFTER_DEATH)
{
delay = 3600; // 1 hour
}
if (creature.isInsideZone(ZoneId.TIMED_HUNTING))
{
delay = 60; // 10 minutes
}
}
// Add to decay schedules.
DECAY_SCHEDULES.put(creature, System.currentTimeMillis() + (delay * 1000));