Proper support for hunting teleports.

This commit is contained in:
MobiusDevelopment
2019-03-14 08:45:07 +00:00
parent 8ee8645caf
commit 5f2d4e835a
104 changed files with 309 additions and 258 deletions

View File

@@ -45,6 +45,7 @@
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="NORMAL" />
<xs:enumeration value="HUNTING" />
<xs:enumeration value="NOBLES_TOKEN" />
<xs:enumeration value="NOBLES_ADENA" />
<xs:enumeration value="OTHER" />

View File

@@ -22,6 +22,7 @@ package com.l2jmobius.gameserver.enums;
public enum TeleportType
{
NORMAL,
HUNTING,
NOBLES_TOKEN,
NOBLES_ADENA,
OTHER;

View File

@@ -73,6 +73,18 @@ public final class L2TeleporterInstance extends L2Npc
holder.showTeleportList(player, this);
break;
}
case "showTeleportsHunting":
{
final String listName = (st.hasMoreTokens()) ? st.nextToken() : TeleportType.HUNTING.name();
final TeleportHolder holder = TeleportersData.getInstance().getHolder(getId(), listName);
if (holder == null)
{
LOGGER.warning("Player " + player.getObjectId() + " requested show teleports for hunting list with name " + listName + " at NPC " + getId() + "!");
return;
}
holder.showTeleportList(player, this);
break;
}
case "teleport":
{
// Check for required count of params.

View File

@@ -75,7 +75,7 @@ public final class TeleportHolder
*/
public boolean isNoblesse()
{
return _type == TeleportType.NOBLES_ADENA || _type == TeleportType.NOBLES_TOKEN;
return (_type == TeleportType.NOBLES_ADENA) || (_type == TeleportType.NOBLES_TOKEN);
}
/**
@@ -140,7 +140,7 @@ public final class TeleportHolder
}
// Load variables
final int questZoneId = (_type == TeleportType.NORMAL) ? player.getQuestZoneId() : -1;
final int questZoneId = isNormalTeleport() ? player.getQuestZoneId() : -1;
// Build html
final StringBuilder sb = new StringBuilder();
@@ -216,7 +216,7 @@ public final class TeleportHolder
}
// Validate conditions for NORMAL teleport
if (_type == TeleportType.NORMAL)
if (isNormalTeleport())
{
if (npc.getCastle().getSiege().isInProgress())
{
@@ -270,7 +270,7 @@ public final class TeleportHolder
*/
private boolean shouldPayFee(L2PcInstance player, TeleportLocation loc)
{
return (_type != TeleportType.NORMAL) || (((player.getLevel() > Config.MAX_FREE_TELEPORT_LEVEL) || player.isSubClassActive()) && ((loc.getFeeId() != 0) && (loc.getFeeCount() > 0)));
return !isNormalTeleport() || (((player.getLevel() > Config.MAX_FREE_TELEPORT_LEVEL) || player.isSubClassActive()) && ((loc.getFeeId() != 0) && (loc.getFeeCount() > 0)));
}
/**
@@ -283,7 +283,7 @@ public final class TeleportHolder
*/
private long calculateFee(L2PcInstance player, TeleportLocation loc)
{
if (_type == TeleportType.NORMAL)
if (isNormalTeleport())
{
if (!player.isSubClassActive() && (player.getLevel() <= Config.MAX_FREE_TELEPORT_LEVEL))
{
@@ -301,6 +301,11 @@ public final class TeleportHolder
return loc.getFeeCount();
}
private boolean isNormalTeleport()
{
return (_type == TeleportType.NORMAL) || (_type == TeleportType.HUNTING);
}
/**
* Gets name of specified item.
* @param itemId template id of item