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

@ -570,9 +570,20 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
*/
public void onDecay()
{
if (Config.DISCONNECT_AFTER_DEATH && isPlayer())
if (isPlayer())
{
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));
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
{

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,9 +90,16 @@ public class DecayTaskManager implements Runnable
delay += Config.SPOILED_CORPSE_EXTEND_TIME;
}
if (Config.DISCONNECT_AFTER_DEATH && creature.isPlayer())
if (creature.isPlayer())
{
delay = 3600; // 1 hour
if (Config.DISCONNECT_AFTER_DEATH)
{
delay = 3600; // 1 hour
}
if (creature.isInsideZone(ZoneId.TIMED_HUNTING))
{
delay = 60; // 10 minutes
}
}
// Add to decay schedules.