- Хроники
- Fafurion
- Исходники
- Присутствуют
- Сборка
- L2jmobius
Добрый день, подскажите пожалуйста где ошибка , при входе через НПСа по строке диалога
в инст с ID 318 закидывает в ID 310, подскажите где ош. или что то дописать необходимо ?
Код:
<button action="bypass -h Quest SpiritForest enterInstance115" value="Лес Духов Ур. 115" width=200 height=31 back="L2UI_CT1.OlympiadWnd_DF_Apply_Down" fore="L2UI_CT1.OlympiadWnd_DF_Apply"></td>
Код:
package instances.SpiritForest;
import java.util.List;
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.model.Party;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.instancezone.Instance;
import org.l2jmobius.gameserver.network.NpcStringId;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ExSendUIEvent;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import instances.AbstractInstance;
public class SpiritForest extends AbstractInstance
{
private static final int[] TEMPLATE_IDS =
{
310, // lv. 110
314, // lv. 105
318, // lv. 115
};
public SpiritForest()
{
super(TEMPLATE_IDS);
addInstanceLeaveId(TEMPLATE_IDS);
}
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
if (event.contains("enterInstance"))
{
final int templateId = event.contains("110") ? TEMPLATE_IDS[0] : TEMPLATE_IDS[1];
if (player.isInParty())
{
final Party party = player.getParty();
if (!party.isLeader(player))
{
player.sendPacket(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER);
return null;
}
if (player.isInCommandChannel())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_ENTER_AS_YOU_DON_T_MEET_THE_REQUIREMENTS);
return null;
}
final long currentTime = System.currentTimeMillis();
final List<Player> members = party.getMembers();
for (Player member : members)
{
if (!member.isInsideRadius3D(npc, 1000))
{
player.sendMessage("Player " + member.getName() + " must go closer to Gatekeeper Spirit.");
return null;
}
for (int id : TEMPLATE_IDS)
{
if (currentTime < InstanceManager.getInstance().getInstanceTime(member, id))
{
final SystemMessage msg = new SystemMessage(SystemMessageId.SINCE_C1_ENTERED_ANOTHER_INSTANCE_ZONE_THEREFORE_YOU_CANNOT_ENTER_THIS_DUNGEON);
msg.addString(member.getName());
party.broadcastToPartyMembers(member, msg);
return null;
}
}
}
for (Player member : members)
{
enterInstance(member, npc, templateId);
}
}
else if (player.isGM())
{
enterInstance(player, npc, templateId);
}
else
{
player.sendPacket(SystemMessageId.YOU_ARE_NOT_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
}
}
return null;
}
@Override
protected void onEnter(Player player, Instance instance, boolean firstEnter)
{
super.onEnter(player, instance, firstEnter);
player.sendPacket(new ExSendUIEvent(player, false, false, Math.min(3600000, (int) (instance.getRemainingTime() / 1000)), 0, NpcStringId.TIME_LEFT));
}
@Override
public void onInstanceLeave(Player player, Instance instance)
{
player.sendPacket(new ExSendUIEvent(player, true, false, 3600, 0, NpcStringId.TIME_LEFT));
}
public static void main(String[] args)
{
new SpiritForest();
}
}