Support for special teleports.
This commit is contained in:
parent
009fccfc2a
commit
df5b69bc91
@ -12,6 +12,7 @@
|
||||
<xs:attribute type="xs:integer" name="y" use="required" />
|
||||
<xs:attribute type="xs:integer" name="z" use="required" />
|
||||
<xs:attribute type="xs:integer" name="price" use="required" />
|
||||
<xs:attribute type="xs:boolean" name="special" use="optional" />
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
|
@ -61,7 +61,8 @@ public class TeleportListData implements IXmlReader
|
||||
final int y = set.getInt("y");
|
||||
final int z = set.getInt("z");
|
||||
final int tpPrice = set.getInt("price");
|
||||
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice));
|
||||
final boolean special = set.getBoolean("special", false);
|
||||
_teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice, special));
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -26,14 +26,16 @@ public class TeleportListHolder
|
||||
private final int _y;
|
||||
private final int _z;
|
||||
private final int _price;
|
||||
private final boolean _special;
|
||||
|
||||
public TeleportListHolder(int locId, int x, int y, int z, int price)
|
||||
public TeleportListHolder(int locId, int x, int y, int z, int price, boolean special)
|
||||
{
|
||||
_locId = locId;
|
||||
_x = x;
|
||||
_y = y;
|
||||
_z = z;
|
||||
_price = price;
|
||||
_special = special;
|
||||
}
|
||||
|
||||
public int getLocId()
|
||||
@ -60,4 +62,9 @@ public class TeleportListHolder
|
||||
{
|
||||
return _price;
|
||||
}
|
||||
|
||||
public boolean isSpecial()
|
||||
{
|
||||
return _special;
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.effects.EffectFlag;
|
||||
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.siege.Castle;
|
||||
import org.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
@ -104,12 +105,29 @@ public class ExRequestTeleport implements IClientIncomingPacket
|
||||
final int price = teleport.getPrice();
|
||||
if (price > 0)
|
||||
{
|
||||
if (player.getAdena() < price)
|
||||
// Check if player has fee.
|
||||
if (teleport.isSpecial())
|
||||
{
|
||||
if (player.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < price)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (player.getAdena() < price)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
return;
|
||||
}
|
||||
player.reduceAdena("Teleport", price, player, true);
|
||||
// Reduce items.
|
||||
if (teleport.isSpecial())
|
||||
{
|
||||
player.destroyItemByItemId("Teleport", Inventory.LCOIN_ID, price, player, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.reduceAdena("Teleport", price, player, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user