Enable re-entry at Training Zone instance.

This commit is contained in:
MobiusDevelopment 2022-09-22 22:00:39 +00:00
parent a4a3ad4cab
commit 834f89797b
2 changed files with 4 additions and 34 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<instance id="224" maxWorlds="80" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/instance.xsd">
<time duration="60" empty="0" />
<time duration="60" empty="5" />
<locations>
<enter type="FIXED">
<location x="-49550" y="17189" z="-3016" />

View File

@ -20,7 +20,6 @@ import java.util.Arrays;
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.WorldObject;
@ -175,28 +174,7 @@ public class TrainingZone extends AbstractInstance
return null;
}
if (huntingZone.isSoloInstance())
{
enterInstance(player, npc, huntingZone.getInstanceId());
}
else
{
Instance world = null;
for (Instance instance : InstanceManager.getInstance().getInstances())
{
if (instance.getTemplateId() == huntingZone.getInstanceId())
{
world = instance;
break;
}
}
if (world == null)
{
world = InstanceManager.getInstance().createInstance(huntingZone.getInstanceId(), player);
}
player.teleToLocation(huntingZone.getEnterLocation(), world);
}
enterInstance(player, npc, huntingZone.getInstanceId());
}
switch (event)
{
@ -822,8 +800,8 @@ public class TrainingZone extends AbstractInstance
@Override
public void onInstanceEnter(Player player, Instance instance)
{
startEvent(player);
player.getInstanceWorld().setDuration(60);
instance.setParameter("BATTLEZONE", false);
player.sendPacket(new ExSendUIEvent(player, false, false, (int) (instance.getRemainingTime() / 1000), 0, NpcStringId.TIME_LEFT));
}
@Override
@ -879,14 +857,6 @@ public class TrainingZone extends AbstractInstance
player.sendPacket(new TimedHuntingZoneExit(player.getVariables().getInt(PlayerVariables.LAST_HUNTING_ZONE_ID, 0)));
removeBuffs(player);
instance.getParameters().remove("TRAINIG_AREA_TELEPORT");
instance.finishInstance();
}
private void startEvent(Player player)
{
final Instance instance = player.getInstanceWorld();
instance.setParameter("BATTLEZONE", false);
player.sendPacket(new ExSendUIEvent(player, false, false, Math.min(3600, (int) (instance.getRemainingTime() / 1000)), 0, NpcStringId.TIME_LEFT));
}
private void removeBuffs(Creature ch)